query
stringlengths 8
6.75k
| document
stringlengths 9
1.89M
| negatives
listlengths 19
19
| metadata
dict |
---|---|---|---|
connect makes a connection to the collector server. It must be called with rc.mu held.
|
func (rc *RemoteCollector) connect() error {
if rc.pconn != nil {
rc.pconn.Close()
rc.pconn = nil
}
c, err := rc.dial()
if err == nil {
// Create a protobuf delimited writer wrapping the connection. When the
// writer is closed, it also closes the underlying connection (see
// source code for details).
rc.pconn = pio.NewDelimitedWriter(c)
}
return err
}
|
[
"func (c *Connection) connect(ctx context.Context) error {\n\tc.log.Debug(\"Connection: %s\",\n\t\tLogField{Key: ConnectionLogMsgKey, Value: \"dialing transport\"})\n\n\t// connect\n\ttransport, err := c.transport.Dial(ctx)\n\tif err != nil {\n\t\tc.log.Warning(\"Connection: error %s: %v\",\n\t\t\tLogField{Key: ConnectionLogMsgKey, Value: \"dialing transport\"},\n\t\t\tLogField{Key: \"error\", Value: err})\n\t\treturn err\n\t}\n\n\tclient := NewClient(transport, c.errorUnwrapper, c.tagsFunc)\n\tserver := NewServer(transport, c.wef)\n\n\tfor _, p := range c.protocols {\n\t\tif err := server.Register(p); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// call the connect handler\n\tc.log.Debug(\"Connection: %s\", LogField{Key: ConnectionLogMsgKey, Value: \"calling OnConnect\"})\n\terr = c.handler.OnConnect(ctx, c, client, server)\n\tif err != nil {\n\t\tc.log.Warning(\"Connection: error calling %s handler: %v\",\n\t\t\tLogField{Key: ConnectionLogMsgKey, Value: \"OnConnect\"},\n\t\t\tLogField{Key: \"error\", Value: err})\n\t\treturn err\n\t}\n\n\t// set the client for other callers.\n\t// we wait to do this so the handler has time to do\n\t// any setup required, e.g. authenticate.\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\tc.client = client\n\tc.server = server\n\tc.transport.Finalize()\n\n\tc.log.Debug(\"Connection: %s\", LogField{Key: ConnectionLogMsgKey, Value: \"connected\"})\n\treturn nil\n}",
"func (app *Application) connect(ctx context.Context, onProgress func(*protocol.ProgressParams)) (*connection, error) {\n\tswitch {\n\tcase app.Remote == \"\":\n\t\tclient := newClient(app, onProgress)\n\t\tserver := lsp.NewServer(cache.NewSession(ctx, cache.New(nil), app.options), client)\n\t\tconn := newConnection(server, client)\n\t\tif err := conn.initialize(protocol.WithClient(ctx, client), app.options); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn conn, nil\n\n\tcase strings.HasPrefix(app.Remote, \"internal@\"):\n\t\tinternalMu.Lock()\n\t\tdefer internalMu.Unlock()\n\t\topts := source.DefaultOptions().Clone()\n\t\tif app.options != nil {\n\t\t\tapp.options(opts)\n\t\t}\n\t\tkey := fmt.Sprintf(\"%s %v %v %v\", app.wd, opts.PreferredContentFormat, opts.HierarchicalDocumentSymbolSupport, opts.SymbolMatcher)\n\t\tif c := internalConnections[key]; c != nil {\n\t\t\treturn c, nil\n\t\t}\n\t\tremote := app.Remote[len(\"internal@\"):]\n\t\tctx := xcontext.Detach(ctx) //TODO:a way of shutting down the internal server\n\t\tconnection, err := app.connectRemote(ctx, remote)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tinternalConnections[key] = connection\n\t\treturn connection, nil\n\tdefault:\n\t\treturn app.connectRemote(ctx, app.Remote)\n\t}\n}",
"func (b *broker) connect(ctx context.Context) (net.Conn, error) {\n\tb.cl.cfg.logger.Log(LogLevelDebug, \"opening connection to broker\", \"addr\", b.addr, \"broker\", b.meta.NodeID)\n\tstart := time.Now()\n\tconn, err := b.cl.cfg.dialFn(ctx, \"tcp\", b.addr)\n\tsince := time.Since(start)\n\tb.cl.cfg.hooks.each(func(h Hook) {\n\t\tif h, ok := h.(HookBrokerConnect); ok {\n\t\t\th.OnConnect(b.meta, since, conn, err)\n\t\t}\n\t})\n\tif err != nil {\n\t\tb.cl.cfg.logger.Log(LogLevelWarn, \"unable to open connection to broker\", \"addr\", b.addr, \"broker\", b.meta.NodeID, \"err\", err)\n\t\treturn nil, fmt.Errorf(\"unable to dial: %w\", err)\n\t} else {\n\t\tb.cl.cfg.logger.Log(LogLevelDebug, \"connection opened to broker\", \"addr\", b.addr, \"broker\", b.meta.NodeID)\n\t}\n\treturn conn, nil\n}",
"func (s *Server) connect() error {\n\tif s.config.Schema == \"amqp\" {\n\t\treturn s.connectAMQP()\n\t}\n\n\treturn s.connectAMQPS()\n}",
"func (ch *InternalChannel) Connect(c *Client) {}",
"func (c *Connection) connect() error {\n\tlog.Tracef(\"creating TCP connection for %s\", c.name)\n\tvar err error\n\tvar conn *net.TCPConn\n\n\tlog.Tracef(\"creating regular TCP connection\")\n\tif conn, err = net.DialTCP(\"tcp\", nil, c.addr); err != nil {\n\t\tlog.Errorf(\"unable to dial %v for %s! %v\", c.addr, c.name, err)\n\t\treturn err\n\t}\n\n\tlog.Tracef(\"attempting to set a keepalive for %s\", c.name)\n\tif err = conn.SetKeepAlive(true); err != nil {\n\t\tlog.Warningf(\"unable to set keep alive for %s - you may get booted. %v\", c.name, err)\n\t}\n\tif err = conn.SetKeepAlivePeriod(keepalive); err != nil {\n\t\tlog.Warningf(\"unable to set keep alive period for %s - you may get booted. %v\", c.name, err)\n\t}\n\tc.connection = conn\n\tlog.Debugf(\"connected to server for %s\", c.name)\n\n\tif c.server.SSL {\n\t\tlog.Tracef(\"creating SSL connection\")\n\t\tvar conf *tls.Config\n\t\tif c.server.Insecure {\n\t\t\tconf = &tls.Config{InsecureSkipVerify: true}\n\t\t} else {\n\t\t\tconf = &tls.Config{ServerName: c.server.Host}\n\t\t}\n\t\tc.connection = tls.Client(conn, conf)\n\t\tlog.Debugf(\"connected to server over SSL for %s\", c.name)\n\t}\n\n\tc.Connected = true\n\treturn nil\n}",
"func (s *Server) connect(conn net.Conn) {\n\tname := promptForNickName(conn)\n\tclient := NewClient(name, conn, s.incoming)\n\ts.clients = append(s.clients, client)\n}",
"func (c *Config) connect() {\n\tc.emitEvent(Event{Type: EventConnected})\n}",
"func (mon *SocketMonitor) Connect() error {\n\tenc := json.NewEncoder(mon.c)\n\tdec := json.NewDecoder(mon.c)\n\n\t// Check for banner on startup\n\tvar ban banner\n\tif err := dec.Decode(&ban); err != nil {\n\t\treturn err\n\t}\n\tmon.Version = &ban.QMP.Version\n\tmon.Capabilities = ban.QMP.Capabilities\n\n\t// Issue capabilities handshake\n\tcmd := Command{Execute: qmpCapabilities}\n\tif err := enc.Encode(cmd); err != nil {\n\t\treturn err\n\t}\n\n\t// Check for no error on return\n\tvar r response\n\tif err := dec.Decode(&r); err != nil {\n\t\treturn err\n\t}\n\tif err := r.Err(); err != nil {\n\t\treturn err\n\t}\n\n\t// Initialize socket listener for command responses and asynchronous\n\t// events\n\tevents := make(chan Event)\n\tstream := make(chan streamResponse)\n\tgo mon.listen(mon.c, events, stream)\n\n\tmon.events = events\n\tmon.stream = stream\n\n\treturn nil\n}",
"func (ctl *Control) connectServer() (conn net.Conn, err error) {\n\treturn ctl.cm.Connect()\n}",
"func (c *Easee) connect(ts oauth2.TokenSource) func() (signalr.Connection, error) {\n\tbo := backoff.NewExponentialBackOff()\n\tbo.MaxInterval = time.Minute\n\n\treturn func() (conn signalr.Connection, err error) {\n\t\tdefer func() {\n\t\t\tif err != nil {\n\t\t\t\ttime.Sleep(bo.NextBackOff())\n\t\t\t} else {\n\t\t\t\tbo.Reset()\n\t\t\t}\n\t\t}()\n\n\t\ttok, err := ts.Token()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(context.Background(), request.Timeout)\n\t\tdefer cancel()\n\n\t\treturn signalr.NewHTTPConnection(ctx, \"https://streams.easee.com/hubs/chargers\",\n\t\t\tsignalr.WithHTTPClient(c.Client),\n\t\t\tsignalr.WithHTTPHeaders(func() (res http.Header) {\n\t\t\t\treturn http.Header{\n\t\t\t\t\t\"Authorization\": []string{fmt.Sprintf(\"Bearer %s\", tok.AccessToken)},\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\t}\n}",
"func (s *StatsdClient) connect() bool {\n\ts.Lock()\n\tdefer s.Unlock()\n\tif s.reconTimer != nil {\n\t\ts.reconTimer.Stop()\n\t\ts.reconTimer = nil\n\t}\n\tvar err error\n\n\tif s.client != nil {\n\t\t// TODO we could be closing a client that is in use by one of\n\t\t// the methods below. This code needs rewriting.\n\t\ts.client.Close()\n\t}\n\ts.client, err = statsd.New(s.hostPort, s.prefix)\n\tif err != nil {\n\t\ts.Error(\"STATSD Failed to create client (stats will noop): \" + err.Error())\n\t\ts.client, err = statsd.NewNoopClient()\n\t} else {\n\t\ts.Finef(\"STATSD sending to [%s] with prefix [%s] at rate [%f]\", s.hostPort, s.prefix, s.rate)\n\t}\n\tif s.reconEvery != 0 {\n\t\ts.reconTimer = time.AfterFunc(s.reconEvery, func() { s.connect() })\n\t}\n\treturn true\n}",
"func (l *LogWriter) connect() {\n\tif l.connecting {\n\t\treturn\n\t}\n\tl.connecting = true\n\tvar err error\n\tfor l.conn == nil {\n\t\tl.conn, err = net.Dial(\"tcp\", l.Addr)\n\t\tif err != nil {\n\t\t\ttime.Sleep(time.Second)\n\t\t\tcontinue\n\t\t}\n\t\terr = l.sendMsg([]byte(fmt.Sprintf(\"!!cutelog!!format=%s\", l.Format)))\n\t\tif err != nil {\n\t\t\tl.Close()\n\t\t}\n\t}\n\tl.connecting = false\n}",
"func (s *Server) connect() {\n\tln, err := net.Listen(\"tcp\", \":\"+strconv.Itoa(s.port))\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t} else {\n\t\ts.listener = ln\n\t\tlog.Println(\"Listening on port :\" + strconv.Itoa(s.port))\n\t}\n}",
"func (pool *hostConnPool) connect() error {\n\t// try to connect\n\tconn, err := Connect(pool.addr, pool.connCfg, pool, pool.session)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif pool.keyspace != \"\" {\n\t\t// set the keyspace\n\t\tif err := conn.UseKeyspace(pool.keyspace); err != nil {\n\t\t\tconn.Close()\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// add the Conn to the pool\n\tpool.mu.Lock()\n\tdefer pool.mu.Unlock()\n\n\tif pool.closed {\n\t\tconn.Close()\n\t\treturn nil\n\t}\n\n\tpool.conns = append(pool.conns, conn)\n\tpool.policy.SetConns(pool.conns)\n\treturn nil\n}",
"func (s *Server) Connect(client *Client) {\n s.Clients.Store(client.Id, client)\n\n s.GM.Log.Debugf(\"Connecting new client %s\", client.Id)\n\n go client.Conn.Reader(client, s)\n go client.Conn.Writer(client, s)\n\n s.GM.FireEvent(NewDirectEvent(\"connected\", client, client.Id))\n}",
"func (w *Writer) connect() (err error) {\n if w.conn != nil {\n // ignore err from close, it makes sense to continue anyway\n w.conn.close()\n w.conn = nil\n }\n if w.network == \"ctcp\" {\n w.network = \"tcp\"\n }\n if w.network == \"\" {\n w.conn, err = unixSyslog()\n if w.hostname == \"\" {\n w.hostname = \"localhost\"\n }\n } else if w.network == \"tls\" {\n var c net.Conn\n c, err = tls.Dial(\"tcp\", w.raddr,\n &tls.Config{InsecureSkipVerify: true})\n if err == nil {\n w.conn = &netConn{conn: c}\n if w.hostname == \"\" {\n w.hostname = c.LocalAddr().String()\n }\n }\n } else {\n var conn net.Conn\n conn, err = net.DialTimeout(w.network, w.raddr, settings.SOCKET_TIMEOUT)\n if err == nil {\n c, ok := conn.(*net.TCPConn)\n if !ok {\n panic(\"dial tcp error\")\n }\n c.SetKeepAlive(true)\n c.SetKeepAlivePeriod(30 * time.Second)\n w.conn = &netConn{conn: c}\n if w.hostname == \"\" {\n w.hostname = c.LocalAddr().String()\n }\n }\n }\n return\n}",
"func (c *rpcclient) connect(ctx context.Context) (err error) {\n\tvar success bool\n\n\tc.clients = make([]*ethConn, 0, len(c.endpoints))\n\tc.neverConnectedEndpoints = make([]endpoint, 0, len(c.endpoints))\n\n\tfor _, endpoint := range c.endpoints {\n\t\tec, err := c.connectToEndpoint(ctx, endpoint)\n\t\tif err != nil {\n\t\t\tc.log.Errorf(\"Error connecting to %q: %v\", endpoint, err)\n\t\t\tc.neverConnectedEndpoints = append(c.neverConnectedEndpoints, endpoint)\n\t\t\tcontinue\n\t\t}\n\n\t\tdefer func() {\n\t\t\t// If all connections are outdated, we will not start, so close any open connections.\n\t\t\tif !success {\n\t\t\t\tec.Close()\n\t\t\t}\n\t\t}()\n\n\t\tc.clients = append(c.clients, ec)\n\t}\n\n\tsuccess = c.sortConnectionsByHealth(ctx)\n\n\tif !success {\n\t\treturn fmt.Errorf(\"failed to connect to an up-to-date ethereum node\")\n\t}\n\n\tgo c.monitorConnectionsHealth(ctx)\n\n\treturn nil\n}",
"func (c *Client) connect() {\n\tjwtCreds, err := oauth.NewJWTAccessFromFile(\n\t\tc.groundstation.Key)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create JWT credentials: %v\", err)\n\t}\n\n\ttc := credentials.NewTLS(&tls.Config{\n\t\tInsecureSkipVerify: true,\n\t})\n\n\tconn, err := grpc.Dial(c.groundstation.Address,\n\t\tgrpc.WithTransportCredentials(tc),\n\t\tgrpc.WithPerRPCCredentials(jwtCreds))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Couldn't connect to ground station: %v\\n\", err)\n\t}\n\n\tgo func() {\n\t\tc.runner.Wait()\n\t\tconn.Close()\n\t}()\n\n\tc.client = api.NewGroundStationServiceClient(conn)\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
NewServer creates and starts a new server that listens for spans and annotations on l and adds them to the collector c. Call the CollectorServer's Start method to start listening and serving.
|
func NewServer(l net.Listener, c Collector) *CollectorServer {
cs := &CollectorServer{c: c, l: l}
return cs
}
|
[
"func NewServer(cfg config.Config, ll *log.Logger) *Server {\n\tif ll == nil {\n\t\tll = log.New(ioutil.Discard, \"\", 0)\n\t}\n\n\t// Set up Prometheus instrumentation using the typical Go collectors.\n\treg := prometheus.NewPedanticRegistry()\n\treg.MustRegister(\n\t\tprometheus.NewGoCollector(),\n\t\tprometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}),\n\t\tnewInterfaceCollector(cfg.Interfaces),\n\t)\n\n\treturn &Server{\n\t\tcfg: cfg,\n\n\t\tll: ll,\n\t\treg: reg,\n\n\t\tready: make(chan struct{}),\n\t}\n}",
"func NewServer(h *Handlers, limits Limits, l net.Listener) *Server {\n return &Server{Handlers:h, Limits:limits, listener:l}\n}",
"func (m *Metrics) NewServer(ln net.Listener) *http.Server {\n\tm.registry.MustRegister(m.clockTimeSeconds)\n\tm.registry.MustRegister(m.clockTimeSecondsGauge)\n\tm.registry.MustRegister(m.certificateExpiryTimeSeconds)\n\tm.registry.MustRegister(m.certificateRenewalTimeSeconds)\n\tm.registry.MustRegister(m.certificateReadyStatus)\n\tm.registry.MustRegister(m.acmeClientRequestDurationSeconds)\n\tm.registry.MustRegister(m.venafiClientRequestDurationSeconds)\n\tm.registry.MustRegister(m.acmeClientRequestCount)\n\tm.registry.MustRegister(m.controllerSyncCallCount)\n\tm.registry.MustRegister(m.controllerSyncErrorCount)\n\n\tmux := http.NewServeMux()\n\tmux.Handle(\"/metrics\", promhttp.HandlerFor(m.registry, promhttp.HandlerOpts{}))\n\n\tserver := &http.Server{\n\t\tAddr: ln.Addr().String(),\n\t\tReadTimeout: prometheusMetricsServerReadTimeout,\n\t\tWriteTimeout: prometheusMetricsServerWriteTimeout,\n\t\tMaxHeaderBytes: prometheusMetricsServerMaxHeaderBytes,\n\t\tHandler: mux,\n\t}\n\n\treturn server\n}",
"func NewServer() *Server {}",
"func NewCollectServer(cfg *ServerConfig) *CollectServer {\n\tserver := &CollectServer{Config: cfg}\n\tlogger := logrus.New()\n\tlogger.Out = cfg.LogCfg.Output\n\tlogger.Level = cfg.LogCfg.Level\n\tlogger.Formatter = cfg.LogCfg.Format\n\tserver.Logger = logger\n\treturn server\n}",
"func New(listener net.Listener, httpServer *http.Server) goroutine.BackgroundRoutine {\n\treturn &server{\n\t\tserver: httpServer,\n\t\tmakeListener: func() (net.Listener, error) { return listener, nil },\n\t}\n}",
"func NewServer(authFunc, cmdFunc func(io.ReadWriter, []byte) error) (*Server, error) {\n\tvar err error\n\ts := new(Server)\n\ts.ln, err = nettest.NewLocalListener(\"tcp\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgo s.serve(authFunc, cmdFunc)\n\treturn s, nil\n}",
"func newServer(ctx context.Context, logger zerolog.Logger, dsn datastore.PGDatasourceName) (*server.Server, func(), error) {\n\t// This will be filled in by Wire with providers from the provider sets in\n\t// wire.Build.\n\twire.Build(\n\t\twire.InterfaceValue(new(trace.Exporter), trace.Exporter(nil)),\n\t\tgoCloudServerSet,\n\t\tapplicationSet,\n\t\tappHealthChecks,\n\t\twire.Struct(new(server.Options), \"HealthChecks\", \"TraceExporter\", \"DefaultSamplingPolicy\", \"Driver\"),\n\t\tdatastore.NewDB,\n\t\twire.Bind(new(datastore.Datastorer), new(*datastore.Datastore)),\n\t\tdatastore.NewDatastore)\n\treturn nil, nil, nil\n}",
"func New(addr string, host app.HostService, collector *metrics.Collector) app.Server {\n\treturn &server{\n\t\tsrv: telnet.Server{Addr: addr, Handler: nil},\n\t\thost: host,\n\t\tcollector: collector,\n\t}\n}",
"func New(args []string) *Server {\n\treturn &Server{\n\t\targs: args,\n\t\twatchStopCh: make(chan os.Signal, 1),\n\t}\n}",
"func NewServer(opts Opts) (net.Listener, *grpc.Server) {\n\tlis, err := net.Listen(\"tcp\", fmt.Sprintf(\"%s:%d\", opts.Host, opts.Port))\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to listen on %s:%d: %v\", opts.Host, opts.Port, err)\n\t}\n\tlog.Notice(\"Listening on %s:%d\", opts.Host, opts.Port)\n\n\ts := grpc.NewServer(OptionalTLS(opts.KeyFile, opts.CertFile, opts.TLSMinVersion,\n\t\tgrpc.ChainUnaryInterceptor(append([]grpc.UnaryServerInterceptor{\n\t\t\tLogUnaryRequests,\n\t\t\tserverMetrics.UnaryServerInterceptor(),\n\t\t\tgrpc_recovery.UnaryServerInterceptor(),\n\t\t}, unaryAuthInterceptor(opts)...)...),\n\t\tgrpc.ChainStreamInterceptor(append([]grpc.StreamServerInterceptor{\n\t\t\tLogStreamRequests,\n\t\t\tserverMetrics.StreamServerInterceptor(),\n\t\t\tgrpc_recovery.StreamServerInterceptor(),\n\t\t}, streamAuthInterceptor(opts)...)...),\n\t\tgrpc.MaxRecvMsgSize(419430400), // 400MB\n\t\tgrpc.MaxSendMsgSize(419430400),\n\t)...)\n\n\tserverMetrics.InitializeMetrics(s)\n\treflection.Register(s)\n\tif !opts.NoHealth {\n\t\tgrpc_health_v1.RegisterHealthServer(s, health.NewServer())\n\t}\n\treturn lis, s\n}",
"func newServer(deps dependencies) Component {\n\treturn newServerCompat(deps.Config, deps.Log, deps.Replay, deps.Debug, deps.Params.Serverless)\n}",
"func NewServer(config *ClusterConfig, store mcmodel.MCConfigStore) (*Server, error) {\n\trouter := mux.NewRouter()\n\ts := &Server{\n\t\thttpServer: http.Server{\n\t\t\tReadTimeout: 10 * time.Second,\n\t\t\tWriteTimeout: 10 * time.Second,\n\t\t\tAddr: fmt.Sprintf(\":%d\", config.AgentPort),\n\t\t\tHandler: router,\n\t\t},\n\t\tstore: store,\n\t\tconfig: config,\n\t}\n\t_ = router.NewRoute().PathPrefix(\"/exposed/{clusterID}\").Methods(\"GET\").HandlerFunc(s.handlePoliciesReq)\n\n\treturn s, nil\n}",
"func NewServer(ctx *Context, registrations ...func(server *grpc.Server)) (*GrpcServer, error) {\n\tcancel := make(chan bool)\n\n\t// Fire up a gRPC server and start listening for incomings.\n\thandle, err := rpcutil.ServeWithOptions(rpcutil.ServeOptions{\n\t\tCancel: cancel,\n\t\tInit: func(srv *grpc.Server) error {\n\t\t\tfor _, registration := range registrations {\n\t\t\t\tregistration(srv)\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t\tOptions: rpcutil.OpenTracingServerInterceptorOptions(ctx.tracingSpan),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &GrpcServer{\n\t\tcancel: cancel,\n\t\thandle: handle,\n\t}, nil\n}",
"func NewServer(addr string, callback func(pdata.Traces)) (*Server, error) {\n\tconf := util.Untab(fmt.Sprintf(`\nprocessors:\n\tfunc_processor:\nreceivers:\n otlp:\n\t\tprotocols:\n\t\t\tgrpc:\n\t\t\t\tendpoint: %s\nexporters:\n noop:\nservice:\n\tpipelines:\n\t\ttraces:\n\t\t\treceivers: [otlp]\n\t\t\tprocessors: [func_processor]\n\t\t\texporters: [noop]\n\t`, addr))\n\n\tvar cfg map[string]interface{}\n\tif err := yaml.NewDecoder(strings.NewReader(conf)).Decode(&cfg); err != nil {\n\t\tpanic(\"could not decode config: \" + err.Error())\n\t}\n\n\textensionsFactory, err := component.MakeExtensionFactoryMap()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to make extension factory map: %w\", err)\n\t}\n\n\treceiversFactory, err := component.MakeReceiverFactoryMap(otlpreceiver.NewFactory())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to make receiver factory map: %w\", err)\n\t}\n\n\texportersFactory, err := component.MakeExporterFactoryMap(newNoopExporterFactory())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to make exporter factory map: %w\", err)\n\t}\n\n\tprocessorsFactory, err := component.MakeProcessorFactoryMap(\n\t\tnewFuncProcessorFactory(callback),\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to make processor factory map: %w\", err)\n\t}\n\n\tfactories := component.Factories{\n\t\tExtensions: extensionsFactory,\n\t\tReceivers: receiversFactory,\n\t\tProcessors: processorsFactory,\n\t\tExporters: exportersFactory,\n\t}\n\n\tconfigMap := config.NewMapFromStringMap(cfg)\n\tcfgUnmarshaler := configunmarshaler.NewDefault()\n\totelCfg, err := cfgUnmarshaler.Unmarshal(configMap, factories)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to make otel config: %w\", err)\n\t}\n\n\tvar (\n\t\tlogger = zap.NewNop()\n\t\tstartInfo component.BuildInfo\n\t)\n\n\tsettings := component.TelemetrySettings{\n\t\tLogger: logger,\n\t\tTracerProvider: trace.NewNoopTracerProvider(),\n\t\tMeterProvider: metric.NewNoopMeterProvider(),\n\t}\n\n\texporters, err := builder.BuildExporters(settings, startInfo, otelCfg, factories.Exporters)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to build exporters: %w\", err)\n\t}\n\tif err := exporters.StartAll(context.Background(), nil); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to start exporters: %w\", err)\n\t}\n\n\tpipelines, err := builder.BuildPipelines(settings, startInfo, otelCfg, exporters, factories.Processors)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to build pipelines: %w\", err)\n\t}\n\tif err := pipelines.StartProcessors(context.Background(), nil); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to start pipelines: %w\", err)\n\t}\n\n\treceivers, err := builder.BuildReceivers(settings, startInfo, otelCfg, pipelines, factories.Receivers)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to build receivers: %w\", err)\n\t}\n\th := &mocks.Host{}\n\th.On(\"GetExtensions\").Return(nil)\n\tif err := receivers.StartAll(context.Background(), h); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to start receivers: %w\", err)\n\t}\n\n\treturn &Server{\n\t\treceivers: receivers,\n\t\tpipelines: pipelines,\n\t\texporters: exporters,\n\t}, nil\n}",
"func NewServer(l net.Listener, reg registry.Cache, ctl *config.Controller, opts ...ServerOption) *Server {\n\to := defaultServerOptions()\n\tfor _, opt := range opts {\n\t\topt(o)\n\t}\n\n\teds := newEndpointDiscoveryServer(reg)\n\tcds := newConfigDiscoveryServer(ctl)\n\tdds := newDependencyDiscoveryServer(ctl)\n\ts := &Server{\n\t\tl: l,\n\t\toptions: o,\n\t\teds: eds,\n\t\tcds: cds,\n\t\tdds: dds,\n\t}\n\n\tg := grpc.NewServer(s.grpcOptions()...)\n\tapi.RegisterDiscoveryServiceServer(g, s)\n\ts.g = g\n\treturn s\n}",
"func NewServer(dir string, c *WrapCallbacks) (*server.Server, error) {\n\tds, err := file.NewDatastore(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\twds := &WrapDatastore{W: ds, C: c}\n\n\tsys, err := system.NewDatastore(wds)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn server.NewServer(wds, sys, nil, nil, \"json\",\n\t\tfalse, 10, 10, 4, 4, 0, 0, false, false, false, true,\n\t\tserver.ProfOff, false)\n}",
"func newServer() *server {\n\ts := &server{\n\t\trouter: echo.New(),\n\t}\n\n\ts.initHTTPServer()\n\ts.routes()\n\n\treturn s\n}",
"func New(c *ovsnl.Client) prometheus.Collector {\n\treturn &collector{\n\t\tcs: []prometheus.Collector{\n\t\t\t// Additional generic netlink family collectors can be added here.\n\t\t\tnewDatapathCollector(c.Datapath.List),\n\t\t},\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
NewUInt64 creates a new UInt64 with default values.
|
func NewUInt64() *UInt64 {
self := UInt64{}
self.SetDefaults()
return &self
}
|
[
"func NewUInt64(name, description string) *UInt64 {\n\treturn &UInt64{name: name, description: description}\n}",
"func NewUint64(x uint64) *Numeric {\n\tvar r Numeric\n\treturn r.SetUint64(x)\n}",
"func NewUint64(store *store.Store, cfgPath string) *Uint64 {\n\tf := &Uint64{}\n\tf.init(store, f.mapCfgValue, cfgPath)\n\treturn f\n}",
"func NewUint64(value uint64) *Uint64 {\n\treturn &Uint64{\n\t\tvalue: value,\n\t}\n}",
"func NewUint64(inp uint64) B64 {\n\tvar resp = []B64{\n\t\tnewUint64(inp),\n\t}\n\treturn resp[0]\n}",
"func NewOptionalUInt64(v interface{}) *OptionalUInt64 {\n\ts, ok := v.(uint64)\n\tif ok {\n\t\treturn &OptionalUInt64{Value: s}\n\t}\n\treturn nil\n}",
"func NewUInt64Handler() *TypeHandler {\n\tTypeHandler := TypeHandler{\n\t\tKind: reflect.Uint64,\n\t\tType: \"uint64\",\n\t}\n\n\tTypeHandler.GetDefaultFaker = func() reflect.Value {\n\t\tr := rand.New(rand.NewSource(time.Now().UnixNano()))\n\t\treturn reflect.ValueOf(r.Uint64())\n\t}\n\n\treturn &TypeHandler\n}",
"func NewU64(index []int32, elts []uint64) (a *U64, err error) {\n\ta = &U64{}\n\terr = a.Init(index, elts)\n\tif err != nil {\n\t\ta = nil\n\t}\n\treturn a, err\n}",
"func NewUint64(data arrow.ArrayData, shape, strides []int64, names []string) *Uint64 {\n\ttsr := &Uint64{tensorBase: *newTensor(arrow.PrimitiveTypes.Uint64, data, shape, strides, names)}\n\tvals := tsr.data.Buffers()[1]\n\tif vals != nil {\n\t\ttsr.values = arrow.Uint64Traits.CastFromBytes(vals.Bytes())\n\t\tbeg := tsr.data.Offset()\n\t\tend := beg + tsr.data.Len()\n\t\ttsr.values = tsr.values[beg:end]\n\t}\n\treturn tsr\n}",
"func VariantNewUint64(value uint64) *Variant {\n\tc_value := (C.guint64)(value)\n\n\tretC := C.g_variant_new_uint64(c_value)\n\tretGo := VariantNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}",
"func NewTagUint64(ls *lua.LState) int {\n\tvar val = uint64(ls.CheckInt(1))\n\tPushTag(ls, &LuaTag{wpk.TagUint64(val)})\n\treturn 1\n}",
"func NewUint64WithSize(size int) Uint64 {\n\tset := Uint64{\n\t\tm: make(map[uint64]struct{}, size),\n\t}\n\treturn set\n}",
"func UInt64(v uint64) *uint64 {\n\treturn &v\n}",
"func NewUint64Setting(name string, description string, fallback uint64) *Uint64Setting {\n\treturn &Uint64Setting{\n\t\tBaseSetting: &BaseSetting{\n\t\t\tNameValue: name,\n\t\t\tDescriptionValue: description,\n\t\t},\n\t\tUint64Value: &fallback,\n\t}\n}",
"func (c *Client) NewGaugeUint64(name string, opts ...MOption) *GaugeUint64 {\n\tg := &GaugeUint64{name: name}\n\tc.register(g, opts...)\n\treturn g\n}",
"func NewUInt(name, description string) *UInt {\n\treturn &UInt{name: name, description: description}\n}",
"func NewRandUint64() (uint64, error) {\n\tvar b [8]byte\n\t_, err := rand.Read(b[:])\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn binary.LittleEndian.Uint64(b[:]), nil\n}",
"func NewUint64Flag(name, usage string, opts ...FlagOption) *pflag.Flag {\n\tflag := &pflag.Flag{\n\t\tName: name,\n\t\tUsage: usage,\n\t\tValue: &Uint64Value{},\n\t}\n\tApplyOptions(flag, opts...)\n\treturn flag\n}",
"func MakeUInt64(in *uint64) *google_protobuf.UInt64Value {\n\tif in == nil {\n\t\treturn nil\n\t}\n\n\treturn &google_protobuf.UInt64Value{\n\t\tValue: *in,\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
CloneUInt64Slice clones src to dst by calling Clone for each element in src. Panics if len(dst) < len(src).
|
func CloneUInt64Slice(dst, src []UInt64) {
for i := range src {
dst[i] = *src[i].Clone()
}
}
|
[
"func CloneUInt8Slice(dst, src []UInt8) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}",
"func CloneImuSlice(dst, src []Imu) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}",
"func CloneFloat64Slice(dst, src []Float64) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}",
"func CloneUInt16MultiArraySlice(dst, src []UInt16MultiArray) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}",
"func Uint64Slice(src []*uint64) []uint64 {\n\tdst := make([]uint64, len(src))\n\tfor i := 0; i < len(src); i++ {\n\t\tif src[i] != nil {\n\t\t\tdst[i] = *(src[i])\n\t\t}\n\t}\n\treturn dst\n}",
"func CloneIntegerRangeSlice(dst, src []IntegerRange) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}",
"func CloneInt8MultiArraySlice(dst, src []Int8MultiArray) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}",
"func Uint64PtrSlice(src []uint64) []*uint64 {\n\tdst := make([]*uint64, len(src))\n\tfor i := 0; i < len(src); i++ {\n\t\tdst[i] = &(src[i])\n\t}\n\treturn dst\n}",
"func CutUint64(slice []uint64, i, j uint64) []uint64 {\n\treturn append(slice[:i], slice[j:]...)\n}",
"func (ids IDSlice) Copy() IDSlice {\n\tn := len(ids)\n\tnewIds := make([]ID, n)\n\tcopy(newIds, ids)\n\treturn newIds\n}",
"func Uint64SlicePtr(src []uint64) []*uint64 {\n\tdst := make([]*uint64, len(src))\n\tfor i := 0; i < len(src); i++ {\n\t\tdst[i] = &(src[i])\n\t}\n\treturn dst\n}",
"func Int64Slice(src []*int64) []int64 {\n\tdst := make([]int64, len(src))\n\tfor i := 0; i < len(src); i++ {\n\t\tif src[i] != nil {\n\t\t\tdst[i] = *(src[i])\n\t\t}\n\t}\n\treturn dst\n}",
"func NewFromUint64Slice(items []uint64) *SliceOfUint64 {\n\tslicy := &SliceOfUint64{items}\n\treturn slicy\n}",
"func copyUintList(dst *list.List, src *list.List) {\n if dst == nil {\n dst = list.New()\n }\n if src == nil {\n src = list.New()\n }\n for e := src.Front(); e != nil; e = e.Next() {\n pId := e.Value.(uint)\n dst.PushBack(pId)\n }\n}",
"func CloneTimeReferenceSlice(dst, src []TimeReference) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}",
"func Uint64(src []uint64) []uint64 {\n\tdst := make([]uint64, len(src))\n\tcopy(dst, src)\n\treturn dst\n}",
"func Int64PtrSlice(src []int64) []*int64 {\n\tdst := make([]*int64, len(src))\n\tfor i := 0; i < len(src); i++ {\n\t\tdst[i] = &(src[i])\n\t}\n\treturn dst\n}",
"func (vals *int64Values) Copy() Values {\n\tv := *vals\n\tnewValues := make(int64Values, len(v))\n\tfor i := 0; i < len(v); i++ {\n\t\tnewValues[i] = v[i]\n\t}\n\treturn &newValues\n}",
"func clone(dst, src *image.Gray) {\n\tif dst.Stride == src.Stride {\n\t\t// no need to correct stride, simply copy pixels.\n\t\tcopy(dst.Pix, src.Pix)\n\t\treturn\n\t}\n\t// need to correct stride.\n\tfor i := 0; i < src.Rect.Dy(); i++ {\n\t\tdstH := i * dst.Stride\n\t\tsrcH := i * src.Stride\n\t\tcopy(dst.Pix[dstH:dstH+dst.Stride], src.Pix[srcH:srcH+dst.Stride])\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetEcsServiceConfig returns config for aws_ecs_service
|
func GetEcsServiceConfig(c *ecs.Service) []AWSResourceConfig {
cf := EcsServiceConfig{
Config: Config{
Name: c.ServiceName,
Tags: c.Tags,
},
IamRole: c.Role,
}
return []AWSResourceConfig{{
Resource: cf,
Metadata: c.AWSCloudFormationMetadata,
}}
}
|
[
"func GetServiceConfig(req *restful.Request, resp *restful.Response) {\n\tconst (\n\t\thandler = \"GetServiceConfig\"\n\t)\n\tspan := v1http.SetHTTPSpanContextInfo(req, handler)\n\tdefer span.Finish()\n\n\tr, err := generateData(req, getMultiCls)\n\tif err != nil {\n\t\tutils.SetSpanLogTagError(span, err)\n\t\tblog.Errorf(\"%s | err: %v\", common.BcsErrStorageGetResourceFailStr, err)\n\t\tlib.ReturnRest(&lib.RestResponse{\n\t\t\tResp: resp,\n\t\t\tErrCode: common.BcsErrStorageGetResourceFail,\n\t\t\tMessage: common.BcsErrStorageGetResourceFailStr})\n\t\treturn\n\t}\n\tlib.ReturnRest(&lib.RestResponse{Resp: resp, Data: r})\n}",
"func (configProvider) GetServiceConfig(c context.Context) (*tricium.ServiceConfig, error) {\n\treturn getServiceConfig(c)\n}",
"func (mockProvider) GetServiceConfig(c context.Context) (*tricium.ServiceConfig, error) {\n\treturn &tricium.ServiceConfig{}, nil\n}",
"func GetEsConfig(key string) ConfigEs {\n\tvar conf ConfigEs\n\tconf.Addr = GetString(key + \".\" + \"addr\")\n\tconf.UserName = GetString(key + \".\" + \"userName\")\n\tconf.Password = GetString(key + \".\" + \"password\")\n\tconf.TimeOutMs = GetUInt32(key + \".\" + \"timeOutMs\")\n\n\treturn conf\n}",
"func (s *server) GetServiceConfig(ctx context.Context, _ *transactionpb.GetServiceConfigRequest) (*transactionpb.GetServiceConfigResponse, error) {\n\tsubsidizer := s.subsidizer.Public().(ed25519.PublicKey)\n\n\tappIndex, _ := app.GetAppIndex(ctx)\n\tif appIndex > 0 {\n\t\tcfg, err := s.appConfig.Get(ctx, appIndex)\n\t\tif err != nil && err != app.ErrNotFound {\n\t\t\treturn nil, status.Error(codes.Internal, \"failed to get app config\")\n\t\t} else if err == nil && cfg.Subsidizer != nil {\n\t\t\tsubsidizer = cfg.Subsidizer\n\t\t}\n\t}\n\n\treturn &transactionpb.GetServiceConfigResponse{\n\t\tToken: &commonpb.SolanaAccountId{\n\t\t\tValue: s.token,\n\t\t},\n\t\tTokenProgram: &commonpb.SolanaAccountId{\n\t\t\tValue: token.ProgramKey,\n\t\t},\n\t\tSubsidizerAccount: &commonpb.SolanaAccountId{\n\t\t\tValue: subsidizer,\n\t\t},\n\t}, nil\n}",
"func (a *Client) EmsConfigGet(params *EmsConfigGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EmsConfigGetOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewEmsConfigGetParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"ems_config_get\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/support/ems\",\n\t\tProducesMediaTypes: []string{\"application/hal+json\", \"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/hal+json\", \"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &EmsConfigGetReader{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.(*EmsConfigGetOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*EmsConfigGetDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}",
"func (s *Service) ServiceConfig() *registry.ServiceConfig {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\treturn s.config.copy()\n}",
"func getConfig() (aws.Config, error) {\n\tif os.Getenv(\"AWS_REGION\") == \"\" {\n\t\treturn aws.Config{}, errors.New(\"AWS_REGION is not set\")\n\t}\n\tcfg, err := config.LoadDefaultConfig(context.TODO())\n\tif err != nil {\n\t\treturn aws.Config{}, err\n\t}\n\treturn cfg, nil\n}",
"func (tco *EVServiceConfigObj) EVServiceConfiguration() *EVServiceConfig {\n\tif tco.Config == nil {\n\t\treturn tco.NewEVServiceConfig(defaultCType).Config\n\t}\n\treturn tco.Config\n}",
"func getServiceConfig(cfgs []config.ServiceConfig, name string) config.ServiceConfig {\n\n\tfor i := range cfgs {\n\t\tif cfgs[i].Name == name {\n\t\t\treturn cfgs[i]\n\t\t}\n\t}\n\n\tpanic(fmt.Sprintf(\"Cannot find service configurations for `%s` service\", name))\n}",
"func (s *site) getEtcdConfig(ctx context.Context, opCtx *operationContext, server *ProvisionedServer) (*etcdConfig, error) {\n\tetcdClient, err := clients.DefaultEtcdMembers()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tmembers, err := etcdClient.List(ctx)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tinitialCluster := []string{opCtx.provisionedServers.InitialCluster(s.domainName)}\n\t// add existing members\n\tfor _, member := range members {\n\t\taddress, err := utils.URLHostname(member.PeerURLs[0])\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tinitialCluster = append(initialCluster, fmt.Sprintf(\"%s:%s\",\n\t\t\tmember.Name, address))\n\t}\n\tproxyMode := etcdProxyOff\n\tif !server.IsMaster() {\n\t\tproxyMode = etcdProxyOn\n\t}\n\treturn &etcdConfig{\n\t\tinitialCluster: strings.Join(initialCluster, \",\"),\n\t\tinitialClusterState: etcdExistingCluster,\n\t\tproxyMode: proxyMode,\n\t}, nil\n}",
"func (c *Core) GetServiceConfigText(serviceID, applicationID uint64) (string, error) {\n\tif c.clusterID == nil {\n\t\treturn \"\", fmt.Errorf(\"cluster id must be provided\")\n\t}\n\n\tserviceConfigKey := c.getServiceConfigKey(*c.clusterID, applicationID, serviceID)\n\texists, err := c.kvClient.Exists(serviceConfigKey)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"cannot find service config: %v\", err)\n\t}\n\tif !exists {\n\t\treturn \"\", fmt.Errorf(\"service config does not exist\")\n\t}\n\n\treturn c.kvClient.Get(serviceConfigKey)\n}",
"func Get() ServiceConfig {\n\n\tonce.Do(func() {\n\n\t\tconfigFile := \"/var/www/config.dev.yaml\"\n\t\tfmt.Println(configFile)\n\t\tconfigData, err := ioutil.ReadFile(configFile)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Load config data error: %s\", err)\n\t\t}\n\n\t\terr = yaml.Unmarshal([]byte(configData), &sCfg)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Yaml unmarshal error: %s\", err)\n\t\t}\n\t})\n\n\treturn sCfg\n}",
"func (aws *Aws) GetK8sConfig() (*rest.Config, *clientcmdapi.Config) {\n\treturn nil, nil\n}",
"func GetHSSConfig() (*mconfig.HSSConfig, error) {\n\tserviceBaseName := filepath.Base(os.Args[0])\n\tserviceBaseName = strings.TrimSuffix(serviceBaseName, filepath.Ext(serviceBaseName))\n\tif hssServiceName != serviceBaseName {\n\t\tglog.Errorf(\n\t\t\t\"NOTE: HSS Service name: %s does not match its managed configs key: %s\\n\",\n\t\t\tserviceBaseName, hssServiceName)\n\t}\n\n\tconfigsPtr := &mconfig.HSSConfig{}\n\terr := configs.GetServiceConfigs(hssServiceName, configsPtr)\n\tif err != nil || configsPtr.Server == nil || configsPtr.DefaultSubProfile == nil {\n\t\tglog.Errorf(\"%s Managed Configs Load Error: %v\\n\", hssServiceName, err)\n\t\treturn &mconfig.HSSConfig{\n\t\t\tServer: &mconfig.DiamServerConfig{\n\t\t\t\tProtocol: diameter.GetValueOrEnv(diameter.NetworkFlag, ServerProtocol, hssDefaultProtocol),\n\t\t\t\tAddress: diameter.GetValueOrEnv(diameter.AddrFlag, ServerAddress, \"\"),\n\t\t\t\tLocalAddress: diameter.GetValueOrEnv(diameter.LocalAddrFlag, ServerLocalAddress, \"\"),\n\t\t\t\tDestHost: diameter.GetValueOrEnv(diameter.DestHostFlag, ServerDestHost, hssDefaultHost),\n\t\t\t\tDestRealm: diameter.GetValueOrEnv(diameter.DestRealmFlag, ServerDestRealm, hssDefaultRealm),\n\t\t\t},\n\t\t\tLteAuthOp: hssDefaultLteAuthOp,\n\t\t\tLteAuthAmf: hssDefaultLteAuthAmf,\n\t\t\tDefaultSubProfile: &mconfig.HSSConfig_SubscriptionProfile{\n\t\t\t\tMaxUlBitRate: diameter.GetValueUint64(maxUlBitRateFlag, defaultMaxUlBitRate),\n\t\t\t\tMaxDlBitRate: diameter.GetValueUint64(maxDlBitRateFlag, defaultMaxDlBitRate),\n\t\t\t},\n\t\t\tSubProfiles: make(map[string]*mconfig.HSSConfig_SubscriptionProfile),\n\t\t\tStreamSubscribers: *streamSubscribersFlag,\n\t\t}, err\n\t}\n\n\tglog.V(2).Infof(\"Loaded %s configs: %+v\\n\", hssServiceName, configsPtr)\n\treturn &mconfig.HSSConfig{\n\t\tServer: &mconfig.DiamServerConfig{\n\t\t\tAddress: diameter.GetValue(diameter.AddrFlag, configsPtr.Server.Address),\n\t\t\tProtocol: diameter.GetValue(diameter.NetworkFlag, configsPtr.Server.Protocol),\n\t\t\tLocalAddress: diameter.GetValue(diameter.LocalAddrFlag, configsPtr.Server.LocalAddress),\n\t\t\tDestHost: diameter.GetValue(diameter.DestHostFlag, configsPtr.Server.DestHost),\n\t\t\tDestRealm: diameter.GetValue(diameter.DestRealmFlag, configsPtr.Server.DestRealm),\n\t\t},\n\t\tLteAuthOp: configsPtr.LteAuthOp,\n\t\tLteAuthAmf: configsPtr.LteAuthAmf,\n\t\tDefaultSubProfile: &mconfig.HSSConfig_SubscriptionProfile{\n\t\t\tMaxUlBitRate: diameter.GetValueUint64(maxUlBitRateFlag, configsPtr.DefaultSubProfile.MaxUlBitRate),\n\t\t\tMaxDlBitRate: diameter.GetValueUint64(maxDlBitRateFlag, configsPtr.DefaultSubProfile.MaxDlBitRate),\n\t\t},\n\t\tSubProfiles: configsPtr.SubProfiles,\n\t\tStreamSubscribers: configsPtr.StreamSubscribers || *streamSubscribersFlag,\n\t}, nil\n}",
"func getConfig() (*rest.Config, error) {\n\tkubeconfig := os.Getenv(\"KUBECONFIG\")\n\t// K8s Core api client\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", kubeconfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn config, nil\n}",
"func (s *Service) Config() *config.ServiceConfig {\n\treturn s.serviceConfig\n}",
"func ServiceProviderConfig() core.ServiceProviderConfig {\n\treturn serviceProviderConfig\n}",
"func GetEndpointsConfig() []string {\n\tos.Setenv(\"ETCDCTL_API\", viper.GetString(\"Etcd.Api\"))\n\t//fmt.Println(\"ETCD Api version: \", os.Getenv(\"ETCDCTL_API\"))\n\tos.Setenv(\"ETCDCTL_ENDPOINTS\", viper.GetString(\"Etcd.Endpoints\"))\n\t//fmt.Println(\"ETCD ENDPOINTS: \", os.Getenv(\"ETCDCTL_ENDPOINTS\"))\n\tos.Setenv(\"ETCDCTL_CERT\", viper.GetString(\"Etcd.Cert\"))\n\t//fmt.Println(\"ETCD CERT: \", os.Getenv(\"ETCDCTL_CERT\"))\n\tos.Setenv(\"ETCDCTL_CACERT\", viper.GetString(\"Etcd.CaCert\"))\n\t//fmt.Println(\"ETCD CACERT: \", os.Getenv(\"ETCDCTL_CACERT\"))\n\tos.Setenv(\"ETCDCTL_KEY\", viper.GetString(\"Etcd.Key\"))\n\t//fmt.Println(\"ETCD KEY: \", os.Getenv(\"ETCDCTL_KEY\"))\n\treturn []string{(viper.GetViper().GetString(\"Etcd.Endpoints\"))}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetPageConfig will parse the web post entry at filepath.
|
func GetPageConfig(filepath, sitepath string) (Post, error) {
cfg, err := getPageConfig(filepath)
if err != nil {
return cfg, err
}
cfg.FilePath = filepath
cfg.SitePath = sitepath
if cfg.Date != "" {
t, err := time.Parse(time.RFC3339, cfg.Date)
if err != nil {
return cfg, fmt.Errorf("parsing date %s: %w", cfg.Date, err)
}
date := t.Format(time.RFC3339)
if cfg.Date != date {
return cfg, fmt.Errorf("dates don't match: %s != %s", cfg.Date, date)
}
}
return cfg, nil
}
|
[
"func ParseConfigFile(url string, wd *url.URL) (*Config, error) {\n\treturn ParseConfigFileWithSchemes(urlfetch.DefaultSchemes, url, wd)\n}",
"func (o Ocs) GetConfig(w http.ResponseWriter, r *http.Request) {\n\tmustNotFail(render.Render(w, r, response.DataRender(&data.ConfigData{\n\t\tVersion: \"1.7\", // TODO get from env\n\t\tWebsite: \"ocis\", // TODO get from env\n\t\tHost: \"\", // TODO get from FRONTEND config\n\t\tContact: \"\", // TODO get from env\n\t\tSSL: \"true\", // TODO get from env\n\t})))\n}",
"func GetConfigHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tconfigName := ps.ByName(\"config\")\n\n\tconfiguration, err := ubus.UciGetConfig(uci.ConfigType(configName))\n\tif err != nil {\n\t\trend.JSON(w, http.StatusOK, map[string]string{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\trend.JSON(w, http.StatusOK, configuration)\n}",
"func GetConfig(filePath string) (*Configuration, error) {\n\tpath, _ := filepath.Abs(filePath)\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconfig := Configuration{}\n\tdecoder := json.NewDecoder(file)\n\terr = decoder.Decode(&config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconfig.processConfig()\n\n\treturn &config, nil\n}",
"func GetConfigHandler(w http.ResponseWriter, r *http.Request) {\n\thttp.ServeFile(w, r, \"swagger.json\")\n}",
"func (m *OnenoteSection) GetPagesUrl()(*string) {\n val, err := m.GetBackingStore().Get(\"pagesUrl\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}",
"func GetConfig() string {\n\tproberMu.Lock()\n\tdefer proberMu.Unlock()\n\treturn prober.textConfig\n}",
"func (e VCSEntry) GetConfigFile() string {\n\tif e.Path == \"\" {\n\t\treturn constants.DefaultConfigYaml\n\t}\n\treturn e.Path\n}",
"func (CTRL *BaseController) ConfigPage(page string) {\n\tCTRL.GetDB()\n\tCTRL.GetCache()\n\ttheme := template.GetActiveTheme(false)\n\tCTRL.Layout = theme[0] + \"/\" + \"layout-admin.html\"\n\tdevice := CTRL.Ctx.Input.GetData(\"device_type\").(string)\n\tCTRL.LayoutSections = make(map[string]string)\n\tCTRL.LayoutSections[\"Head\"] = theme[0] + \"/\" + \"partial/html_head_\" + device + \".html\"\n\tCTRL.TplName = theme[0] + \"/\" + page\n\tCTRL.Data[\"Theme\"] = theme[0]\n\tCTRL.Data[\"Style\"] = theme[1]\n\tCTRL.Data[\"ModuleMenu\"] = CTRL.GetModuleMenu()\n\tCTRL.GetBlocks()\n\t//CTRL.GetActiveModule()\n\t//CTRL.GetActiveCategory()\n\t//CTRL.GetActiveAds()\n}",
"func (p *IPTablesPlugin) retrieveConfig() (*Config, error) {\n\tconfig := &Config{\n\t\t// default configuration\n\t\tGoRoutinesCnt: defaultGoRoutinesCnt,\n\t\tHandlerConfig: linuxcalls.HandlerConfig{\n\t\t\tMinRuleCountForPerfRuleAddition: defaultMinRuleCountForPerfRuleAddition,\n\t\t},\n\t}\n\tfound, err := p.Cfg.LoadValue(config)\n\tif !found {\n\t\tp.Log.Debug(\"Linux IPTablesPlugin config not found\")\n\t\treturn config, nil\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp.configFound = true\n\treturn config, err\n}",
"func GetConfig(configFile string) (*viper.Viper, error) {\n\ts, err := os.Stat(configFile)\n\tif os.IsNotExist(err) {\n\t\treturn nil, err\n\t}\n\tif s.IsDir() {\n\t\treturn nil, errors.New(\"Config file is not a file\")\n\t}\n\tc := viper.New()\n\tdir := filepath.Dir(configFile)\n\tc.SetConfigName(strings.TrimSuffix(filepath.Base(configFile), filepath.Ext(configFile)))\n\tc.SetConfigType(\"json\")\n\tc.AddConfigPath(dir)\n\terr = c.ReadInConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c, nil\n}",
"func (c Config) GetConfigFile() string {\n\treturn c.viper.GetString(configFile)\n}",
"func (b *backend) pathConfigRead(ctx context.Context, req *logical.Request, _ *framework.FieldData) (*logical.Response, error) {\n\tc, err := b.Config(ctx, req.Storage)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// dont' return credentials, they may show svc account JSON info!\n\treturn &logical.Response{\n\t\tData: map[string]interface{}{\n\t\t\t\"project\": c.Project,\n\t\t\t\"location\": c.Location,\n\t\t\t\"pool\": c.Pool,\n\t\t\t\"scopes\": c.Scopes,\n\t\t},\n\t}, nil\n}",
"func ParseConfig(configFile string) *SubmitConfig {\n\t// ------------------- load paddle config -------------------\n\tbuf, err := ioutil.ReadFile(configFile)\n\tconfig := SubmitConfig{}\n\tif err == nil {\n\t\tyamlErr := yaml.Unmarshal(buf, &config)\n\t\tif yamlErr != nil {\n\t\t\tglog.Errorf(\"load config %s error: %v\\n\", configFile, yamlErr)\n\t\t\treturn nil\n\t\t}\n\t\t// put active config\n\t\tconfig.ActiveConfig = nil\n\t\tfor _, item := range config.DC {\n\t\t\tif item.Name == config.CurrentDatacenter {\n\t\t\t\tconfig.ActiveConfig = &item\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn &config\n\t}\n\tglog.Errorf(\"config %s error: %v\\n\", configFile, err)\n\treturn nil\n}",
"func getConfigFilePath() string {\n\tvar configFile string\n\tflag.StringVar(&configFile, \"config\", \"./config.json\", \"JSON config file path\")\n\tflag.Parse()\n\n\tlog.Printf(\"Using config file %s\", configFile)\n\n\treturn configFile\n}",
"func ParseConfig(filepath string) error {\n\tf, err := ioutil.ReadFile(filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconf := make(map[string]interface{})\n\n\terr = json.Unmarshal(f, &conf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconList := make(map[string]Elem)\n\tconfig = list{self: \"\", value: conList}\n\n\tlog.Printf(\"about to parse config\\n\")\n\tparseMap(conf, &config)\n\tlog.Printf(\"parsed config\\n\")\n\n\treturn nil\n}",
"func ProcessConfig() (c *Config, err error) {\n\tfile, err := os.Open(\"config.json\")\n\tif err != nil {\n\t\tlog.Println(\"Config not found in working directory, trying user's home\")\n\t\tcfgName, err2 := utils.GetHomeDirConfigFileName(\"config.json\", \".kdevpije\")\n\t\tif err2 != nil {\n\t\t\tlog.Println(\"Error obtaining home directory:\", err2)\n\t\t\treturn c, err2\n\t\t}\n\t\tvar err3 error\n\t\tfile, err3 = os.Open(cfgName)\n\t\tif err3 != nil {\n\t\t\tlog.Println(\"Config not found in ~/.kdevpije/\")\n\t\t\treturn c, err3\n\t\t}\n\t}\n\tdecoder := json.NewDecoder(file)\n\tc = &Config{}\n\terr = decoder.Decode(c)\n\tif err != nil {\n\t\tlog.Fatalln(\"Config decode error\")\n\t\treturn c, err\n\t}\n\tif c.Aliases == nil {\n\t\tc.Aliases = make(map[string][]string)\n\t}\n\tif c.PDConfig == nil {\n\t\tc.PDConfig = pagerduty.NewPDConfiguration()\n\t\tc.PDConfig.Token = \"s23zntFxLYp9NjYK99XH\"\n\t}\n\treturn\n}",
"func (p *MackerelProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"api_key\": cty.StringVal(p.apiKey),\n\t})\n}",
"func ParseFile(configFilePath string) (*Config, error) {\n\t// Read the config file\n\tconfigData, err := ioutil.ReadFile(configFilePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Parse the config JSON\n\tconfig := Config{}\n\terr = json.Unmarshal(configData, &config)\n\tif err != nil {\n\t\treturn nil, errors.New(\"invalid config file\")\n\t}\n\n\t// Validate the ports\n\tif config.TelnetPort <= 0 {\n\t\treturn nil, errors.New(\"invalid telnet port\")\n\t}\n\n\tif config.WebPort <= 0 {\n\t\treturn nil, errors.New(\"invalid web port\")\n\t}\n\n\t// Validate the web client path\n\tinfo, err := os.Stat(config.WebClientPath)\n\tif (err != nil && os.IsNotExist(err)) || !info.IsDir() {\n\t\treturn nil, errors.New(\"invalid web client path\")\n\t}\n\n\treturn &config, nil\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
multidimensional slices and arrays are currently not supported
|
func MyMultiSliceFunc(nums [][][]int) { fmt.Println(nums) }
|
[
"func BytesSlice(out *[][]byte) MultiResolver { return multiByteSliceResolver{out} }",
"func (s *slice) slice(start, stop int, elemsize uintptr) slice {\n\tif start >= s.cap_ || start < 0 || stop > s.cap_ || stop < 0 {\n\t\tpanic(\"cuda4/safe: slice index out of bounds\")\n\t}\n\tif start > stop {\n\t\tpanic(\"cuda4/safe: inverted slice range\")\n\t}\n\treturn slice{cu.DevicePtr(uintptr(s.ptr_) + uintptr(start)*elemsize), stop - start, s.cap_ - start}\n}",
"func Slice(slice interface{}) {\n\tswitch p := slice.(type) {\n\tcase []bool:\n\t\tBools(p)\n\tcase []uint8:\n\t\tUint8s(p)\n\tcase []uint16:\n\t\tUint16s(p)\n\tcase []uint32:\n\t\tUint32s(p)\n\tcase []uint64:\n\t\tUint64s(p)\n\tcase []int8:\n\t\tInt8s(p)\n\tcase []int16:\n\t\tInt16s(p)\n\tcase []int32:\n\t\tInt32s(p)\n\tcase []int64:\n\t\tInt64s(p)\n\tcase []float32:\n\t\tFloat32s(p)\n\tcase []float64:\n\t\tFloat64s(p)\n\tcase []complex64:\n\t\tComplex64s(p)\n\tcase []complex128:\n\t\tComplex128s(p)\n\tcase []uint:\n\t\tUints(p)\n\tcase []int:\n\t\tInts(p)\n\tcase []uintptr:\n\t\tUintptrs(p)\n\tcase []string:\n\t\tStrings(p)\n\tcase Interface:\n\t\tFlip(p)\n\tdefault:\n\t\trv := reflectValueOf(slice)\n\t\tswap := reflectSwapper(slice)\n\t\tFlip(reflectSlice{rv, swap})\n\t}\n}",
"func SliceStruct(){\n\t// The type []T is a slice with elements of type T\n\t// A slice is formed by specifing two indices, a low and a high bound, separated by a colon \n\t// a[low: high] (Default = [0:length])\n\t// This selects a half-open range which includes the first element but excludes the second one\n\t\n\tprimes := [6]int{2,3,5,7,11,13}\t// This is an array\n\tvar s []int = primes[1:4] \n\tfmt.Printf(\"Array = %v, slice[1:4] = %v \\n\", primes, s)\n\t\n\t//-------------------------------------------IMPORTANT------------------------------------------//\n\t// A SLICE DOES NOT STORE ANY DATA it just describes a section of an underlying array\t\t\t//\n\t// Changing elements of a slice modifies the corresponding elements of its underlying array\t\t//\n\t// Other slices that share the same underlying array will see those changes \t\t\t\t\t//\n\t//-------------------------------------------IMPORTANT------------------------------------------//\n\n\tnumbers := []int{0,1,2,3,4,5}\n\ta := numbers[1:4]\n\tb := numbers[:2]\n\tc := numbers[1:]\n\tfmt.Println(\"Original array: \", numbers)\n\tfmt.Println(\"slice[1:4]\", a)\n\tfmt.Println(\"slice[:2]\", b)\n\tfmt.Println(\"slice[1:]\", c)\n\n\n\t// Slice literals are like an array literal without the length\n\tq := []int{2,5,3,8}\n\tr := []bool{true, false, true, false}\n\tt := []struct{\n\t\tint\n\t\tbool\n\t}{\n\t\t{5, true},\n\t\t{3, false},\n\t\t{10, false},\n\t}\n\tfmt.Println(\"slice literals (q := []int{2,5,3,8}), example:\")\n\tfmt.Println(q, \" // \", r, \" // \", t)\n\n\t// Slice has both length and capacity\n\t// The length \"len(s)\" of a slice is the number of elements it contains\n\t// The capacity \"cap(s)\" of a slice is the number of elements in the underlying array, counting from the first element in the slice\n\ty := []int{1,2,3,4,5,6,7,8,9}\n\tfmt.Printf(\"len=%d, cap = %d, %v\\n\", len(y), cap(y), y)\n\ty = y[:0]\n\tfmt.Printf(\"len=%d, cap = %d, %v\\n\", len(y), cap(y), y)\n\t// You can extend a slice's length by re-slicing it\n\ty = y[:4]\n\tfmt.Printf(\"len=%d, cap = %d, %v\\n\", len(y), cap(y), y)\n\ty = y[2:]\n\tfmt.Printf(\"len=%d, cap = %d, %v\\n\", len(y), cap(y), y)\n\ty = y[1:]\n\tfmt.Printf(\"len=%d, cap = %d, %v\\n\", len(y), cap(y), y)\n\n\t// Nil slices\n\t// A zero value of slice is nil\n\t// A nil slice has zero length and capacity and no underlying array\n\tvar z []int\n\tfmt.Printf(\"len=%d, cap = %d, %v\\n\", len(z), cap(z), z)\n\n\t// Create slice with make\n\t// The make function allocates a zeroed value and returns a slice that refers to that array\n\t// a := make([]int, 5) // len(a) = 5\n\t// To specify a capacity pass a third argument\n\trt := make([]int, 5, 10) \n\tfmt.Printf(\"make : len=%d, cap = %d, %v\\n\", len(rt), cap(rt), rt)\n\n\t// Slices of slices\n\tboard := [][]string{\n\t\t[]string{\"-\",\"-\",\"-\"},\n\t\t[]string{\"-\",\"-\",\"-\"},\n\t\t[]string{\"-\",\"-\",\"-\"},\n\t}\n\t// board[xAxis][yAxis]\n\tboard[0][0] = \"X\"\n\tboard[0][2] = \"X\"\n\tboard[1][2] = \"O\"\n\n\tfor i := 0; i < len(board); i++{\n\t\tfmt.Printf(\"%s\\n\", strings.Join(board[i], \" \"))\n\t}\n\n\t// Appending to slide\n\tk := []int{1,2,3,4,5}\n\n\tk = append(k, 6)\n\tfmt.Println(\"Append 6 to slice\", k)\n\n\n}",
"func tcSlice(n *ir.SliceExpr) ir.Node {\n\tn.X = DefaultLit(Expr(n.X), nil)\n\tn.Low = indexlit(Expr(n.Low))\n\tn.High = indexlit(Expr(n.High))\n\tn.Max = indexlit(Expr(n.Max))\n\thasmax := n.Op().IsSlice3()\n\tl := n.X\n\tif l.Type() == nil {\n\t\tn.SetType(nil)\n\t\treturn n\n\t}\n\tif l.Type().IsArray() {\n\t\tif !ir.IsAddressable(n.X) {\n\t\t\tbase.Errorf(\"invalid operation %v (slice of unaddressable value)\", n)\n\t\t\tn.SetType(nil)\n\t\t\treturn n\n\t\t}\n\n\t\taddr := NodAddr(n.X)\n\t\taddr.SetImplicit(true)\n\t\tn.X = Expr(addr)\n\t\tl = n.X\n\t}\n\tt := l.Type()\n\tvar tp *types.Type\n\tif t.IsString() {\n\t\tif hasmax {\n\t\t\tbase.Errorf(\"invalid operation %v (3-index slice of string)\", n)\n\t\t\tn.SetType(nil)\n\t\t\treturn n\n\t\t}\n\t\tn.SetType(t)\n\t\tn.SetOp(ir.OSLICESTR)\n\t} else if t.IsPtr() && t.Elem().IsArray() {\n\t\ttp = t.Elem()\n\t\tn.SetType(types.NewSlice(tp.Elem()))\n\t\ttypes.CalcSize(n.Type())\n\t\tif hasmax {\n\t\t\tn.SetOp(ir.OSLICE3ARR)\n\t\t} else {\n\t\t\tn.SetOp(ir.OSLICEARR)\n\t\t}\n\t} else if t.IsSlice() {\n\t\tn.SetType(t)\n\t} else {\n\t\tbase.Errorf(\"cannot slice %v (type %v)\", l, t)\n\t\tn.SetType(nil)\n\t\treturn n\n\t}\n\n\tif n.Low != nil && !checksliceindex(l, n.Low, tp) {\n\t\tn.SetType(nil)\n\t\treturn n\n\t}\n\tif n.High != nil && !checksliceindex(l, n.High, tp) {\n\t\tn.SetType(nil)\n\t\treturn n\n\t}\n\tif n.Max != nil && !checksliceindex(l, n.Max, tp) {\n\t\tn.SetType(nil)\n\t\treturn n\n\t}\n\tif !checksliceconst(n.Low, n.High) || !checksliceconst(n.Low, n.Max) || !checksliceconst(n.High, n.Max) {\n\t\tn.SetType(nil)\n\t\treturn n\n\t}\n\treturn n\n}",
"func (arr *Array) Slice(i, j int) *Array {\n\tvar elems []*Term\n\tvar hashs []int\n\tif j == -1 {\n\t\telems = arr.elems[i:]\n\t\thashs = arr.hashs[i:]\n\t} else {\n\t\telems = arr.elems[i:j]\n\t\thashs = arr.hashs[i:j]\n\t}\n\t// If arr is ground, the slice is, too.\n\t// If it's not, the slice could still be.\n\tgr := arr.ground || termSliceIsGround(elems)\n\n\ts := &Array{elems: elems, hashs: hashs, ground: gr}\n\ts.rehash()\n\treturn s\n}",
"func (o Op) IsSlice3() bool",
"func (t *Dense) Slice(slices ...Slice) (retVal Tensor, err error) {\n\tvar newAP *AP\n\tvar ndStart, ndEnd int\n\n\tif newAP, ndStart, ndEnd, err = t.AP.S(t.len(), slices...); err != nil {\n\t\treturn\n\t}\n\n\tview := new(Dense)\n\tview.t = t.t\n\tview.viewOf = t\n\tview.AP = newAP\n\tview.hdr = new(reflect.SliceHeader)\n\tview.data = t.data\n\tview.hdr.Data = t.hdr.Data\n\tview.hdr.Len = t.hdr.Len\n\tview.hdr.Cap = t.hdr.Cap\n\tview.slice(ndStart, ndEnd)\n\n\tif t.IsMasked() {\n\t\tview.mask = t.mask[ndStart:ndEnd]\n\t}\n\treturn view, err\n}",
"func (items IntSlice) SubSlice(i, j int) Interface { return items[i:j] }",
"func (x *Lazy) Slice(p, q int, ar AnyValue) {\n\n\toar := reflect.ValueOf(ar)\n\tvar ii = 0\n\tk := oar.Len()\n\tfor i := p; i < q && k >= 0; i++ {\n\t\tvar v reflect.Value\n\t\tif _, ok := x.omap[i]; ok {\n\t\t\tv = x.omap[i]\n\t\t} else {\n\t\t\tvar vv = []reflect.Value{x.iar.Index(i)}\n\t\t\tfor j := 0; j < len(x.fns); j++ {\n\t\t\t\tvv = x.fns[j].Call(vv)\n\t\t\t}\n\t\t\tv = vv[0]\n\t\t\tx.omap[p] = v //setting value in v\n\t\t}\n\t\toar.Index(ii).Set(v)\n\t\tii++\n\t\tk--\n\t}\n}",
"func (vp *baseVectorParty) Slice(startRow, numRows int) common.SlicedVector {\n\tsize := vp.length - startRow\n\tif size < 0 {\n\t\tsize = 0\n\t}\n\tif size > numRows {\n\t\tsize = numRows\n\t}\n\tvector := common.SlicedVector{\n\t\tValues: make([]interface{}, size),\n\t\tCounts: make([]int, size),\n\t}\n\tfor i := 0; i < size; i++ {\n\t\tvector.Values[i] = vp.getDataValueFn(startRow + i).ConvertToHumanReadable(vp.dataType)\n\t\tvector.Counts[i] = i + 1\n\t}\n\n\treturn vector\n}",
"func (A *Uint8) View(slice Slice) (*ViewUint8, error) {\n\n\tview := &ViewUint8{}\n\t// var err error\n\n\t// fmt.Printf(\"-- INSIDE FLOAT64.VIEW\\n\")\n\n\t// -- Check if the number of dimensions implied by the slice agrees with the number of dimensions of the array.\n\tif len(slice) != A.ndims {\n\t\treturn view, fmt.Errorf(\"the implied number of dimensions of the slice does not much the number of dimensions of the array\")\n\t}\n\n\t// fmt.Printf(\"-- CHECKED THE # OF DIMENIONS\\n\")\n\n\t// -- A view always has the same number of dimensions as the array.\n\tview.dims = make([]int, A.ndims)\n\tvar err error\n\tfor k := range slice {\n\t\tview.dims[k], err = slice[k].Numels()\n\t\tif err != nil {\n\t\t\treturn view, fmt.Errorf(\"[Uint8.View] error while populating the dims of a view : %s\\n\", err.Error())\n\t\t}\n\t}\n\n\tview.ndims = A.ndims\n\tview.numels = NumelsFromDims(view.dims)\n\tview.micf = MultiIndexConversionFactors(view.dims, len(view.dims))\n\tview.Array = A\n\tview.S = slice\n\tview.Err = nil\n\n\treturn view, nil\n\n}",
"func (e *encoder) slices(tag tag, values url.Values, v reflect.Value) error {\n\tel := v.Type().Elem()\n\tswitch el.Kind() {\n\tcase reflect.Struct:\n\t\treturn e.structSlices(tag, values, v)\n\tcase reflect.Ptr:\n\t\tif el.Elem().Kind() == reflect.Struct {\n\t\t\treturn e.structSlices(tag, values, v)\n\t\t}\n\tdefault:\n\t}\n\tif v.Len() < 1 {\n\t\treturn nil\n\t}\n\tvar strs []string\n\tfor i := 0; i < v.Len(); i++ {\n\t\tvv := e.indirect(v.Index(i))\n\t\tif !vv.IsValid() {\n\t\t\tcontinue\n\t\t}\n\t\tstr, err := e.conv(vv)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tstrs = append(strs, str)\n\t}\n\tif tag.comma {\n\t\tvalues.Set(tag.name, strings.Join(strs, \",\"))\n\t\treturn nil\n\t}\n\tvalues[tag.name+\"[]\"] = strs\n\treturn nil\n}",
"func (v ByteView) Slice(from, to int) ByteView {\n\tif v.b != nil {\n\t\treturn ByteView{b: v.b[from:to]}\n\t}\n\treturn ByteView{s: v.s[from:to]}\n}",
"func main() {\n\n\t//REPLACETYPE use your type of data instead of string, for custom struct you will need to add the struct\n\t//definition to this file \n\toriginalSlice := [][]string{[]string{\"a0\", \"a1\", \"a2\"}, []string{\"b0\", \"b1\", \"b2\"}, []string{\"c0\", \"c1\", \"c2\", \"c3\"}}\n\n\t//this is a 1D representation of the original slice with identical data \n\t//so for the sample data above it would be\n\t//[]string{\"a0\", \"a1\", \"a2\", \"b0\", \"b1\", \"b2\", \"c0\", \"c1\", \"c2\", \"c3\"}\n\t//this allows for indexing combinations using a \"binary cursor\" \n\t//as seen throughout the code\n\toriginalSliceTo1DSlice := []string{}\n\n\n\tfor i := 0; i < len(originalSlice); i++ {\n\t\toriginalSliceTo1DSlice = append(originalSliceTo1DSlice, originalSlice[i]...)\n\t}\n\n\t//a bit cursor is used to index combinations from the 1D representation\n\tbitCursor := []int{}\n\t\n\t//break points are where type ends into another\n\t//for the example slice:\n\t//\n\t//[]string{\"a0\", \"a1\", \"a2\", \"b0\", \"b1\", \"b2\", \"c0\", \"c1\", \"c2\", \"c3\"}\n\t//\n\t//indices: 0 1 2 3 4 5 6 7 8 9\n\t//\n\t//the breakpoints are \n\t//0, 3, and 5 as from left to right these are where \"new inner slice beginnings\"\n\t//this is more easily seen in the original 2D representation:\n\t//\n\t//[][]string{[]string{\"a0\", \"a1\", \"a2\"}, []string{\"b0\", \"b1\", \"b2\"}, []string{\"c0\", \"c1\", \"c2\", \"c3\"}}\n\t//\n\t//indices: 0 1 2 3 4 5 6 7 8 9\n\t//\n\t//these breakpoints help the cursor ensure it never chooses a combination with two \n\t//elements from the same inner slice\n\tbreakpoints := []int{}\n\n\tbreakPointTracker := 0\n\n\n\tfor i := 0; i < len(originalSlice); i++ {\n\n\t\tcurrentInnerSlice := originalSlice[i]\n\n\t\tfor j := 0; j < len(currentInnerSlice); j++ {\n\n\t\t\t//only append breakpoint for each new inner slice beginning\n\t\t\tif(j == 0 ){\n\t\t\t\tbreakpoints = append(breakpoints, breakPointTracker)\n\t\t\t}\n\t\t\tbitCursor = append(bitCursor, 0)\n\n\t\t\tbreakPointTracker++\n\n\t\t}\n\n\n\t}\n\n\t//this return a 2D slice of type [][]int\n\t//each []int contained is a binary cursor indexing the 1D representation\n\t//and each binary cursor ensures a unique combination is chosen\n\t//all combinations will be generated\n\tallCombinationIndices := AllCombinationsIndices(breakpoints, bitCursor, len(bitCursor))\n\n\t//REPLACETYPE use your type of data instead of string, for custom struct you will need to add the struct\n\t//definition to this file\n\toutputCombinationsSlice := [][]string{}\n\n\tfor i := 0; i < len(allCombinationIndices); i++ {\n\n\t\tcurrentIndices := allCombinationIndices[i]\n\n\t\tcombinationToAppend := []string{}\n\n\t\tfor j := 0; j < len(currentIndices); j++ {\n\t\t\tif(currentIndices[j] == 1){\n\t\t\t\tcombinationToAppend = append(combinationToAppend, originalSliceTo1DSlice[j])\n\t\t\t}\n\t\t}\n\n\t\t//IMPORTANT this is slice of interest that should be returned to your main program\n\t\toutputCombinationsSlice = append(outputCombinationsSlice, combinationToAppend)\n\n\t}\n\t//Print the resulting data for all combinations to check the data looks correct\n\tfor i := 0; i < len(outputCombinationsSlice); i++ {\n\n\t\tfmt.Println(outputCombinationsSlice[i])\n\n\t}\n\n\t//TODO:\n\n\t//Here is where you can return the combination slice back to your main program\n\n\n\n}",
"func (A *Float64) View(slice Slice) (*ViewFloat64, error) {\n\n\tview := &ViewFloat64{}\n\t// var err error\n\n\t// fmt.Printf(\"-- INSIDE FLOAT64.VIEW\\n\")\n\n\t// -- Check if the number of dimensions implied by the slice agrees with the number of dimensions of the array.\n\tif len(slice) != A.ndims {\n\t\treturn view, fmt.Errorf(\"the implied number of dimensions of the slice does not much the number of dimensions of the array\")\n\t}\n\n\t// fmt.Printf(\"-- CHECKED THE # OF DIMENIONS\\n\")\n\n\t// -- A view always has the same number of dimensions as the array.\n\tview.dims = make([]int, A.ndims)\n\tvar err error\n\tfor k := range slice {\n\t\tview.dims[k], err = slice[k].Numels()\n\t\tif err != nil {\n\t\t\treturn view, fmt.Errorf(\"[Float64.View] error while populating the dims of a view : %s\\n\", err.Error())\n\t\t}\n\t}\n\n\tview.ndims = A.ndims\n\tview.numels = NumelsFromDims(view.dims)\n\tview.micf = MultiIndexConversionFactors(view.dims, len(view.dims))\n\tview.Array = A\n\tview.S = slice\n\tview.Err = nil\n\n\treturn view, nil\n\n}",
"func MkSlice(args ...interface{}) []interface{} {\n\treturn args\n}",
"func Slice[T any](vs ...Value[T]) Value[[]T] {\n\treturn &slice[T]{vals: vs}\n}",
"func MakingSlices() {\n\ta := make([]int, 5)\n\tprintSliceWithName(\"a\", a)\n\n\tb := make([]int, 0, 5)\n\tprintSliceWithName(\"b\", b)\n\n\tc := b[:2]\n\tprintSliceWithName(\"c\", c)\n\n\td := c[2:5]\n\tprintSliceWithName(\"d\", d)\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
NewMockProviders creates a new mock instance
|
func NewMockProviders(ctrl *gomock.Controller) *MockProviders {
mock := &MockProviders{ctrl: ctrl}
mock.recorder = &MockProvidersMockRecorder{mock}
return mock
}
|
[
"func newMockProvider() *mockProviderAsync {\n\tprovider := newSyncMockProvider()\n\t// By default notifier is set to a function which is a no-op. In the event we've implemented the PodNotifier interface,\n\t// it will be set, and then we'll call a real underlying implementation.\n\t// This makes it easier in the sense we don't need to wrap each method.\n\treturn &mockProviderAsync{provider}\n}",
"func newProvider(t *testing.T) (*Provider, *KeycloakMock) {\n\tcfg := zap.NewDevelopmentConfig()\n\tcfg.DisableStacktrace = true\n\tl, _ := cfg.Build()\n\n\tc := Config{\n\t\tClientID: clientID,\n\t\tClientSecret: clientSecret,\n\t\tRealm: realm,\n\t\tKeycloakHostPort: \"https://localhost\",\n\t\tKeycloakTimeout: 100 * time.Millisecond,\n\t\tKeycloakRetryInterval: 10 * time.Millisecond,\n\t\tRefreshThreshold: 900 * time.Millisecond,\n\t\tLogger: l,\n\t}\n\n\tp, err := New(c)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tmock := NewKeycloakMock(t)\n\n\tp.keycloak = mock\n\n\treturn p, mock\n}",
"func NewMock(middleware []Middleware) OrganizationService {\n\tvar svc OrganizationService = NewBasicOrganizationServiceServiceMock()\n\tfor _, m := range middleware {\n\t\tsvc = m(svc)\n\t}\n\treturn svc\n}",
"func newMockAddressProvider(t interface {\n\tmock.TestingT\n\tCleanup(func())\n}) *mockAddressProvider {\n\tmock := &mockAddressProvider{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}",
"func NewProviders() *Providers {\n\treturn &Providers{\n\t\tinternal: provider.Unknown,\n\t\tproviders: map[string]Provider{},\n\t}\n}",
"func NewProvider(ctrl *gomock.Controller) *Provider {\n\tmock := &Provider{ctrl: ctrl}\n\tmock.recorder = &ProviderMockRecorder{mock}\n\treturn mock\n}",
"func NewEventProviderMock(t NewEventProviderMockT) *EventProviderMock {\n\tmock := &EventProviderMock{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}",
"func NewMockprovider(ctrl *gomock.Controller) *Mockprovider {\n\tmock := &Mockprovider{ctrl: ctrl}\n\tmock.recorder = &MockproviderMockRecorder{mock}\n\treturn mock\n}",
"func NewMockInterfaceProvider(managedInterfacesRegexp string, autoRefresh bool) (nt.InterfaceProvider,\n\tchan time.Time, error) {\n\tch := make(chan time.Time)\n\tip, err := nt.NewChanInterfaceProvider(ch, &MockInterfaceLister{}, managedInterfacesRegexp,\n\t\tautoRefresh)\n\treturn ip, ch, err\n}",
"func NewMock(t *testing.T) *MockT { return &MockT{t: t} }",
"func NewMockProvider(ctrl *gomock.Controller) *MockProvider {\n\tmock := &MockProvider{ctrl: ctrl}\n\tmock.recorder = &MockProviderMockRecorder{mock}\n\treturn mock\n}",
"func ProviderTest(initial Initial, observer invoker.Observer, settings Settings) (Configurator, func(), error) {\n\tc, e := NewMockConfigurator(initial, observer, settings)\n\treturn c, func() {}, e\n}",
"func NewConfigProvider(t mockConstructorTestingTNewConfigProvider) *ConfigProvider {\n\tmock := &ConfigProvider{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}",
"func NewFakeProvider(t *testing.T) *FakeProvider {\n\tbuilder := chain.NewBuilder(t, address.Address{})\n\treturn &FakeProvider{\n\t\tBuilder: builder,\n\t\tt: t,\n\t\tactors: make(map[address.Address]*types.Actor)}\n}",
"func New(config getmoe.ProviderConfiguration) *Provider {\n\tvar provider *Provider\n\tprovider.New(config)\n\treturn provider\n}",
"func GetProviders(w http.ResponseWriter, r *http.Request) {\n\tencoder := json.NewEncoder(w)\n\n\tencoder.Encode(mock.Providers)\n}",
"func newTestFabricProviderSet(providers ...string) *FabricProviderSet {\n\tset := new(FabricProviderSet)\n\tfor i, p := range providers {\n\t\tset.Add(&FabricProvider{\n\t\t\tName: p,\n\t\t\tPriority: i,\n\t\t})\n\t}\n\n\treturn set\n}",
"func New() *Mock {\n\treturn &Mock{\n\t\tm: mockMap{},\n\t\toldTransport: http.DefaultTransport,\n\t}\n}",
"func (m *MockProviderManager) GetProviders(arg0 string) ([]*resource.ResourceProvider, error) {\n\tret := m.ctrl.Call(m, \"GetProviders\", arg0)\n\tret0, _ := ret[0].([]*resource.ResourceProvider)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
ChannelProvider mocks base method
|
func (m *MockProviders) ChannelProvider() fab.ChannelProvider {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ChannelProvider")
ret0, _ := ret[0].(fab.ChannelProvider)
return ret0
}
|
[
"func (m *MockClient) ChannelProvider() fab.ChannelProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ChannelProvider\")\n\tret0, _ := ret[0].(fab.ChannelProvider)\n\treturn ret0\n}",
"func (m *MockRConnectionInterface) Channel() (*amqp.Channel, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Channel\")\n\tret0, _ := ret[0].(*amqp.Channel)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func NewMockChannelProvider(ctx fab.Context) (*MockChannelProvider, error) {\n\tchannels := make(map[string]fab.Channel)\n\n\t// Create a mock client with the mock channel\n\tcp := MockChannelProvider{\n\t\tctx,\n\t\tchannels,\n\t}\n\treturn &cp, nil\n}",
"func (m *AMQPConnection) Channel() (*amqp091.Channel, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Channel\")\n\tret0, _ := ret[0].(*amqp091.Channel)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (suite *KeeperTestSuite) TestChanCloseInit() {\n\tvar (\n\t\tpath *ibctesting.Path\n\t\tchannelCap *capabilitytypes.Capability\n\t)\n\n\ttestCases := []testCase{\n\t\t{\"success\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, true},\n\t\t{\"channel doesn't exist\", func() {\n\t\t\t// any non-nil values work for connections\n\t\t\tpath.EndpointA.ConnectionID = ibctesting.FirstConnectionID\n\t\t\tpath.EndpointB.ConnectionID = ibctesting.FirstConnectionID\n\n\t\t\tpath.EndpointA.ChannelID = ibctesting.FirstChannelID\n\t\t\tpath.EndpointB.ChannelID = ibctesting.FirstChannelID\n\n\t\t\t// ensure channel capability check passes\n\t\t\tsuite.chainA.CreateChannelCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, false},\n\t\t{\"channel state is CLOSED\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\n\t\t\t// close channel\n\t\t\terr := path.EndpointA.SetChannelClosed()\n\t\t\tsuite.Require().NoError(err)\n\t\t}, false},\n\t\t{\"connection not found\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\n\t\t\t// set the channel's connection hops to wrong connection ID\n\t\t\tchannel := path.EndpointA.GetChannel()\n\t\t\tchannel.ConnectionHops[0] = \"doesnotexist\"\n\t\t\tsuite.chainA.App.GetIBCKeeper().ChannelKeeper.SetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel)\n\t\t}, false},\n\t\t{\"connection is not OPEN\", func() {\n\t\t\tsuite.coordinator.SetupClients(path)\n\n\t\t\terr := path.EndpointA.ConnOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\t// create channel in init\n\t\t\tpath.SetChannelOrdered()\n\t\t\terr = path.EndpointA.ChanOpenInit()\n\n\t\t\t// ensure channel capability check passes\n\t\t\tsuite.chainA.CreateChannelCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, false},\n\t\t{\"channel capability not found\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = capabilitytypes.NewCapability(3)\n\t\t}, false},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tsuite.Run(fmt.Sprintf(\"Case %s\", tc.msg), func() {\n\t\t\tsuite.SetupTest() // reset\n\t\t\tpath = ibctesting.NewPath(suite.chainA, suite.chainB)\n\n\t\t\ttc.malleate()\n\n\t\t\terr := suite.chainA.App.GetIBCKeeper().ChannelKeeper.ChanCloseInit(\n\t\t\t\tsuite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, ibctesting.FirstChannelID, channelCap,\n\t\t\t)\n\n\t\t\tif tc.expPass {\n\t\t\t\tsuite.Require().NoError(err)\n\t\t\t} else {\n\t\t\t\tsuite.Require().Error(err)\n\t\t\t}\n\t\t})\n\t}\n}",
"func TestChannelStore(t *testing.T) {\n\t// mock Insert function\n\tfn := func(_ context.Context, v are_hub.Archetype) error {\n\t\treturn nil\n\t}\n\n\t// create mock repo and controller\n\trepo := &mock.ChannelRepo{InsertFunc: fn}\n\tcontroller := NewChannel(repo)\n\n\t// create and embed a new channel\n\tmsport := are_hub.Channel{Name: \"Bentley Team M-Sport\", Password: \"abc123\"}\n\n\t// create a mock request\n\treq, e := http.NewRequest(http.MethodPost, \"/channel\", nil)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// update the request's context with the channel\n\treq = req.WithContext(msport.ToCtx(req.Context()))\n\n\t// create a response recorder and run the controller method\n\tw := httptest.NewRecorder()\n\te = controller.Store(w, req)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// check if the repo was hit\n\tif !repo.InsertCalled {\n\t\tt.Error(\"Did not call repo.Insert\")\n\t}\n\n\t// get the response\n\tres := w.Result()\n\n\t// ensure the content type is application/json\n\tcheckCT(res, t)\n\n\t// extract the returned channel\n\tdefer res.Body.Close()\n\tresBody, e := io.ReadAll(res.Body)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// unmarshal the response body\n\treceived := are_hub.Channel{}\n\te = json.Unmarshal(resBody, &received)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// compare the sent and received channels\n\tif msport.Name != received.Name {\n\t\tt.Fatalf(\"Expected: %+v. Actual: %+v\", msport, received)\n\t}\n}",
"func TestConsumerChannel(t *testing.T) {\n\tconsumerTestWithCommits(t, \"Channel Consumer\", 0, true, eventTestChannelConsumer, nil)\n}",
"func (b *BrokerMock) Listen(channel string) {}",
"func (m *MockContext) CM() channel.Manager {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CM\")\n\tret0, _ := ret[0].(channel.Manager)\n\treturn ret0\n}",
"func testChannel(t *testing.T, src, dst *Chain) {\n\tchans, err := src.QueryChannels(1, 1000)\n\trequire.NoError(t, err)\n\trequire.Equal(t, 1, len(chans))\n\trequire.Equal(t, chans[0].GetOrdering().String(), \"ORDERED\")\n\trequire.Equal(t, chans[0].GetState().String(), \"OPEN\")\n\trequire.Equal(t, chans[0].GetCounterparty().GetChannelID(), dst.PathEnd.ChannelID)\n\trequire.Equal(t, chans[0].GetCounterparty().GetPortID(), dst.PathEnd.PortID)\n\n\th, err := src.Client.Status()\n\trequire.NoError(t, err)\n\n\tch, err := src.QueryChannel(h.SyncInfo.LatestBlockHeight)\n\trequire.NoError(t, err)\n\trequire.Equal(t, ch.Channel.GetOrdering().String(), \"ORDERED\")\n\trequire.Equal(t, ch.Channel.GetState().String(), \"OPEN\")\n\trequire.Equal(t, ch.Channel.GetCounterparty().GetChannelID(), dst.PathEnd.ChannelID)\n\trequire.Equal(t, ch.Channel.GetCounterparty().GetPortID(), dst.PathEnd.PortID)\n}",
"func (suite *KeeperTestSuite) TestSetChannel() {\n\t// create client and connections on both chains\n\tpath := ibctesting.NewPath(suite.chainA, suite.chainB)\n\tsuite.coordinator.SetupConnections(path)\n\n\t// check for channel to be created on chainA\n\t_, found := suite.chainA.App.GetIBCKeeper().ChannelKeeper.GetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\tsuite.False(found)\n\n\tpath.SetChannelOrdered()\n\n\t// init channel\n\terr := path.EndpointA.ChanOpenInit()\n\tsuite.NoError(err)\n\n\tstoredChannel, found := suite.chainA.App.GetIBCKeeper().ChannelKeeper.GetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t// counterparty channel id is empty after open init\n\texpectedCounterparty := types.NewCounterparty(path.EndpointB.ChannelConfig.PortID, \"\")\n\n\tsuite.True(found)\n\tsuite.Equal(types.INIT, storedChannel.State)\n\tsuite.Equal(types.ORDERED, storedChannel.Ordering)\n\tsuite.Equal(expectedCounterparty, storedChannel.Counterparty)\n}",
"func (c *Provider) ChannelProvider() fab.ChannelProvider {\n\treturn c.channelProvider\n}",
"func (_m *Knapsack) UpdateChannel() string {\n\tret := _m.Called()\n\n\tvar r0 string\n\tif rf, ok := ret.Get(0).(func() string); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(string)\n\t}\n\n\treturn r0\n}",
"func newMockListener(endpoint net.Conn) *mockListener {\n \n c := make(chan net.Conn, 1)\n c <- endpoint\n listener := &mockListener{\n connChannel: c,\n serverEndpoint: endpoint,\n }\n return listener\n}",
"func (m *MockCallResult) Channel() <-chan *Result {\n\targs := m.MethodCalled(\"Channel\")\n\n\tif resultChan := args.Get(0); resultChan != nil {\n\t\treturn resultChan.(<-chan *Result)\n\t}\n\n\treturn nil\n}",
"func NewMockInterfaceProvider(managedInterfacesRegexp string, autoRefresh bool) (nt.InterfaceProvider,\n\tchan time.Time, error) {\n\tch := make(chan time.Time)\n\tip, err := nt.NewChanInterfaceProvider(ch, &MockInterfaceLister{}, managedInterfacesRegexp,\n\t\tautoRefresh)\n\treturn ip, ch, err\n}",
"func newMockProvider() *mockProviderAsync {\n\tprovider := newSyncMockProvider()\n\t// By default notifier is set to a function which is a no-op. In the event we've implemented the PodNotifier interface,\n\t// it will be set, and then we'll call a real underlying implementation.\n\t// This makes it easier in the sense we don't need to wrap each method.\n\treturn &mockProviderAsync{provider}\n}",
"func TestChannelUpdate(t *testing.T) {\n\t// mock UpdateID function\n\tfn := func(_ context.Context, str string, v are_hub.Archetype) error {\n\t\t_, e := findChannelID(nil, str)\n\n\t\t// the update itself has no bearing on the test so simply return\n\t\t// the error (if there was one)\n\t\treturn e\n\t}\n\n\t// create mock repo and controller\n\trepo := &mock.ChannelRepo{UpdateIDFunc: fn}\n\tcontroller := NewChannel(repo)\n\n\t// mock channel\n\twrt := are_hub.Channel{Name: \"Belgian Audi Club WRT\", Password: \"abc123\"}\n\n\t// create mock request\n\tp := httprouter.Param{Key: \"id\", Value: \"1\"}\n\treq, e := http.NewRequest(http.MethodPut, \"/channel/\"+p.Value, nil)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// embed the updated channel in the request's context\n\treq = req.WithContext(wrt.ToCtx(req.Context()))\n\n\t// embed parameters in the request's context\n\tuf.EmbedParams(req, p)\n\n\t// create a response recorder run the update method\n\tw := httptest.NewRecorder()\n\te = controller.Update(w, req)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\tres := w.Result()\n\n\t// check if repo was hit\n\tif !repo.UpdateIDCalled {\n\t\tt.Error(\"Did not call repo.UpdateID\")\n\t}\n\n\t// ensure the content type is applicaton/json\n\tcheckCT(res, t)\n\n\t// read and unmarshal the body\n\tdefer res.Body.Close()\n\tresBody, e := io.ReadAll(res.Body)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\treceived := are_hub.Channel{}\n\te = json.Unmarshal(resBody, &received)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// compare the sent and received channels\n\tif wrt.Name != received.Name {\n\t\tt.Fatalf(\"Expected: %+v. Actual: %+v\", wrt, received)\n\t}\n\n\t// check if Update returns a 404 error on an invalid ID\n\tp = httprouter.Param{Key: \"id\", Value: \"-1\"}\n\treq, e = http.NewRequest(http.MethodPut, \"/channel/\"+p.Value, nil)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// embed non-existant channel into the request's context\n\tgpx := are_hub.Channel{Name: \"Grand Prix Extreme\", Password: \"porsche\"}\n\treq = req.WithContext(gpx.ToCtx(req.Context()))\n\n\t// embed parameters\n\tuf.EmbedParams(req, p)\n\n\t// create a new response recorder and call the update method\n\tw = httptest.NewRecorder()\n\te = controller.Update(w, req)\n\n\tif e == nil {\n\t\tt.Fatal(\"Expected: 404 Not found error. Actual: nil\")\n\t}\n\n\the, ok := e.(uf.HttpError)\n\n\tif !ok {\n\t\tt.Fatalf(\"Expected: 404 Not Found error. Actual: %+v\", e)\n\t}\n\n\tif he.Code != http.StatusNotFound {\n\t\tt.Fatalf(\"Expected: %d. Actual: %d\", http.StatusNotFound, he.Code)\n\t}\n}",
"func TestChannelIndex(t *testing.T) {\n\t// mock All function\n\tfn := func(_ context.Context) ([]are_hub.Channel, error) {\n\t\treturn channels, nil\n\t}\n\n\t// create the mock repo and controller\n\trepo := &mock.ChannelRepo{AllFunc: fn}\n\tcontroller := NewChannel(repo)\n\n\t// create a mock request\n\treq, e := http.NewRequest(http.MethodGet, \"/channel\", nil)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// create a response recorder and run the controller method\n\tw := httptest.NewRecorder()\n\te = controller.Index(w, req)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// get the response\n\tres := w.Result()\n\n\t// check if the repo was hit\n\tif !repo.AllCalled {\n\t\tt.Error(\"Did not call repo.All\")\n\t}\n\n\t// ensure the content type is application/json\n\tcheckCT(res, t)\n\n\t// extract the body and confirm all data was returned\n\tdefer res.Body.Close()\n\tbody, e := io.ReadAll(res.Body)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\tvar received []are_hub.Channel\n\te = json.Unmarshal(body, &received)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\tlr := len(received)\n\tlc := len(channels)\n\n\t// check that all channels were returned\n\tif lr != lc {\n\t\tt.Fatalf(\"Expected: %d channels. Actual: %d.\", lc, lr)\n\t}\n\n\t// loop and ensure the data is correct\n\tfor i := 0; i < lr; i++ {\n\t\tif received[i].Name != channels[i].Name {\n\t\t\tt.Fatalf(\"Expected: %s. Actual: %s.\", channels[i].Name, received[i].Name)\n\t\t}\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
ChannelProvider indicates an expected call of ChannelProvider
|
func (mr *MockProvidersMockRecorder) ChannelProvider() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChannelProvider", reflect.TypeOf((*MockProviders)(nil).ChannelProvider))
}
|
[
"func (mr *MockClientMockRecorder) ChannelProvider() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ChannelProvider\", reflect.TypeOf((*MockClient)(nil).ChannelProvider))\n}",
"func (m *MockClient) ChannelProvider() fab.ChannelProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ChannelProvider\")\n\tret0, _ := ret[0].(fab.ChannelProvider)\n\treturn ret0\n}",
"func (c *Provider) ChannelProvider() fab.ChannelProvider {\n\treturn c.channelProvider\n}",
"func (m *MockProviders) ChannelProvider() fab.ChannelProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ChannelProvider\")\n\tret0, _ := ret[0].(fab.ChannelProvider)\n\treturn ret0\n}",
"func TestConsumerChannel(t *testing.T) {\n\tconsumerTestWithCommits(t, \"Channel Consumer\", 0, true, eventTestChannelConsumer, nil)\n}",
"func (a *AbstractSSHConnectionHandler) OnUnsupportedChannel(_ uint64, _ string, _ []byte) {}",
"func (s *RingpopOptionsTestSuite) TestChannelRequired() {\n\trp, err := New(\"test\")\n\ts.Nil(rp)\n\ts.Error(err)\n}",
"func (s *ChannelAcceptor) acceptChannel(_ context.Context,\n\treq *lndclient.AcceptorRequest) (*lndclient.AcceptorResponse, error) {\n\n\ts.expectedChansMtx.Lock()\n\tdefer s.expectedChansMtx.Unlock()\n\n\texpectedChanBid, ok := s.expectedChans[req.PendingChanID]\n\n\t// It's not a channel we've registered within the funding manager so we\n\t// just accept it to not interfere with the normal node operation.\n\tif !ok {\n\t\treturn &lndclient.AcceptorResponse{Accept: true}, nil\n\t}\n\n\t// The push amount in the acceptor request is in milli sats, we need to\n\t// convert it first.\n\tpushAmtSat := lnwire.MilliSatoshi(req.PushAmt).ToSatoshis()\n\n\t// Push amount must be exactly what we expect. Otherwise the asker could\n\t// be trying to cheat.\n\tif expectedChanBid.SelfChanBalance != pushAmtSat {\n\t\treturn &lndclient.AcceptorResponse{\n\t\t\tAccept: false,\n\t\t\tError: fmt.Sprintf(\"invalid push amount %v\",\n\t\t\t\treq.PushAmt),\n\t\t}, nil\n\t}\n\n\treturn &lndclient.AcceptorResponse{Accept: true}, nil\n}",
"func (ecm *ErrorConsumerFake) Channel() string {\n\treturn ecm.channel\n}",
"func (m *AMQPConnection) Channel() (*amqp091.Channel, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Channel\")\n\tret0, _ := ret[0].(*amqp091.Channel)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func TestChannelAttachNotMember(t *testing.T) {\n\th := newHelper(t)\n\n\tch := h.repoMakePrivateCh()\n\n\th.apiChAttach(ch, []byte(\"NOPE\")).\n\t\tAssert(helpers.AssertError(\"not allowed to attach files this channel\")).\n\t\tEnd()\n}",
"func (mr *AMQPConnectionMockRecorder) Channel() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Channel\", reflect.TypeOf((*AMQPConnection)(nil).Channel))\n}",
"func (p *peer) hasChannel(chID byte) bool {\r\n\tfor _, ch := range p.channels {\r\n\t\tif ch == chID {\r\n\t\t\treturn true\r\n\t\t}\r\n\t}\r\n\t// NOTE: probably will want to remove this\r\n\t// but could be helpful while the feature is new\r\n\tp.Logger.Debug(\r\n\t\t\"Unknown channel for peer\",\r\n\t\t\"channel\",\r\n\t\tchID,\r\n\t\t\"channels\",\r\n\t\tp.channels,\r\n\t)\r\n\treturn false\r\n}",
"func TestConjur_Provider(t *testing.T) {\n\tvar err error\n\tvar provider plugin_v1.Provider\n\tname := \"conjur\"\n\n\toptions := plugin_v1.ProviderOptions{\n\t\tName: name,\n\t}\n\n\tConvey(\"Can create the Conjur provider\", t, func() {\n\t\tprovider, err = providers.ProviderFactories[name](options)\n\t\tSo(err, ShouldBeNil)\n\t})\n\n\tConvey(\"Has the expected provider name\", t, func() {\n\t\tSo(provider.GetName(), ShouldEqual, \"conjur\")\n\t})\n\n\tConvey(\"Can provide an access token\", t, func() {\n\t\tid := \"accessToken\"\n\t\tvalues, err := provider.GetValues(id)\n\n\t\tSo(err, ShouldBeNil)\n\t\tSo(values[id], ShouldNotBeNil)\n\t\tSo(values[id].Error, ShouldBeNil)\n\t\tSo(values[id].Value, ShouldNotBeNil)\n\n\t\ttoken := make(map[string]string)\n\t\terr = json.Unmarshal(values[id].Value, &token)\n\t\tSo(err, ShouldBeNil)\n\t\tSo(token[\"protected\"], ShouldNotBeNil)\n\t\tSo(token[\"payload\"], ShouldNotBeNil)\n\t})\n\n\tConvey(\n\t\t\"Reports an unknown value\",\n\t\tt,\n\t\ttestutils.Reports(\n\t\t\tprovider,\n\t\t\t\"foobar\",\n\t\t\t\"404 Not Found. Variable 'foobar' not found in account 'dev'.\",\n\t\t),\n\t)\n\n\tConvey(\"Provides\", t, func() {\n\t\tfor _, testCase := range canProvideTestCases {\n\t\t\tConvey(\n\t\t\t\ttestCase.Description,\n\t\t\t\ttestutils.CanProvide(provider, testCase.ID, testCase.ExpectedValue),\n\t\t\t)\n\t\t}\n\t})\n}",
"func (*ProtocolHeader) Channel() uint16 {\n\tpanic(\"Should never be called\")\n}",
"func TestProducerChannel(t *testing.T) {\n\tproducerTest(t, \"Channel producer (without DR)\",\n\t\tnil, producerCtrl{},\n\t\tfunc(p *Producer, m *Message, drChan chan Event) {\n\t\t\tp.ProduceChannel() <- m\n\t\t})\n}",
"func (mr *MockRConnectionInterfaceMockRecorder) Channel() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Channel\", reflect.TypeOf((*MockRConnectionInterface)(nil).Channel))\n}",
"func TestConjur_Provider(t *testing.T) {\n\tvar err error\n\tvar provider plugin_v1.Provider\n\tname := \"conjur\"\n\n\toptions := plugin_v1.ProviderOptions{\n\t\tName: name,\n\t}\n\n\tt.Run(\"Can create the Conjur provider\", func(t *testing.T) {\n\t\tprovider, err = providers.ProviderFactories[name](options)\n\t\tassert.NoError(t, err)\n\t})\n\n\tt.Run(\"Has the expected provider name\", func(t *testing.T) {\n\t\tassert.Equal(t, \"conjur\", provider.GetName())\n\t})\n\n\tt.Run(\"Can provide an access token\", func(t *testing.T) {\n\t\tid := \"accessToken\"\n\t\tvalues, err := provider.GetValues(id)\n\n\t\tassert.NoError(t, err)\n\t\tassert.NotNil(t, values[id])\n\t\tassert.NoError(t, values[id].Error)\n\t\tassert.NotNil(t, values[id].Value)\n\n\t\ttoken := make(map[string]string)\n\t\terr = json.Unmarshal(values[id].Value, &token)\n\t\tassert.NoError(t, err)\n\t\tassert.NotNil(t, token[\"protected\"])\n\t\tassert.NotNil(t, token[\"payload\"])\n\t})\n\n\tt.Run(\"Reports an unknown value\",\n\t\ttestutils.Reports(\n\t\t\tprovider,\n\t\t\t\"foobar\",\n\t\t\t\"404 Not Found. CONJ00076E Variable dev:variable:foobar is empty or not found..\",\n\t\t),\n\t)\n\n\tt.Run(\"Provides\", func(t *testing.T) {\n\t\tfor _, testCase := range canProvideTestCases {\n\t\t\tt.Run(testCase.Description, testutils.CanProvide(provider, testCase.ID, testCase.ExpectedValue))\n\t\t}\n\t})\n}",
"func (a *AbstractSessionChannelHandler) OnUnsupportedChannelRequest(\n\t_ uint64,\n\t_ string,\n\t_ []byte,\n) {\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
CryptoSuite indicates an expected call of CryptoSuite
|
func (mr *MockProvidersMockRecorder) CryptoSuite() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CryptoSuite", reflect.TypeOf((*MockProviders)(nil).CryptoSuite))
}
|
[
"func (mr *MockProvidersMockRecorder) CryptoSuite() *gomock.Call {\r\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CryptoSuite\", reflect.TypeOf((*MockProviders)(nil).CryptoSuite))\r\n}",
"func (mr *MockClientMockRecorder) CryptoSuite() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CryptoSuite\", reflect.TypeOf((*MockClient)(nil).CryptoSuite))\n}",
"func (pc *MockProviderContext) CryptoSuite() apicryptosuite.CryptoSuite {\n\treturn pc.cryptoSuite\n}",
"func (c *Provider) CryptoSuite() core.CryptoSuite {\n\treturn c.cryptoSuite\n}",
"func CipherSuiteName(suite uint16) string {\n\tswitch suite {\n\tcase tls.TLS_RSA_WITH_RC4_128_SHA:\n\t\treturn \"TLS_RSA_WITH_RC4_128_SHA\"\n\tcase tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA:\n\t\treturn \"TLS_RSA_WITH_3DES_EDE_CBC_SHA\"\n\tcase tls.TLS_RSA_WITH_AES_128_CBC_SHA:\n\t\treturn \"TLS_RSA_WITH_AES_128_CBC_SHA\"\n\tcase tls.TLS_RSA_WITH_AES_256_CBC_SHA:\n\t\treturn \"TLS_RSA_WITH_AES_256_CBC_SHA\"\n\tcase tls.TLS_RSA_WITH_AES_128_CBC_SHA256:\n\t\treturn \"TLS_RSA_WITH_AES_128_CBC_SHA256\"\n\tcase tls.TLS_RSA_WITH_AES_128_GCM_SHA256:\n\t\treturn \"TLS_RSA_WITH_AES_128_GCM_SHA256\"\n\tcase tls.TLS_RSA_WITH_AES_256_GCM_SHA384:\n\t\treturn \"TLS_RSA_WITH_AES_256_GCM_SHA384\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA\"\n\tcase tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA:\n\t\treturn \"TLS_ECDHE_RSA_WITH_RC4_128_SHA\"\n\tcase tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA:\n\t\treturn \"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384\"\n\tcase tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:\n\t\treturn \"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256\"\n\tcase tls.TLS_AES_128_GCM_SHA256:\n\t\treturn \"TLS_AES_128_GCM_SHA256\"\n\tcase tls.TLS_AES_256_GCM_SHA384:\n\t\treturn \"TLS_AES_256_GCM_SHA384\"\n\tcase tls.TLS_CHACHA20_POLY1305_SHA256:\n\t\treturn \"TLS_CHACHA20_POLY1305_SHA256\"\n\tcase tls.TLS_FALLBACK_SCSV:\n\t\treturn \"TLS_FALLBACK_SCSV\"\n\t}\n\n\treturn \"Unknown\"\n}",
"func TestHandshake66(t *testing.T) { testHandshake(t, ETH66) }",
"func CompareChainCryptoSuite(chain1, chain2 []*x509.Certificate) int {\n\tcs1 := HashPriority(chain1) + KeyAlgoPriority(chain1)\n\tcs2 := HashPriority(chain2) + KeyAlgoPriority(chain2)\n\treturn cs1 - cs2\n}",
"func testBatchACKSEC(t testing.TB) {\n\tmockBatch := mockBatchACK(t)\n\tmockBatch.Header.StandardEntryClassCode = RCK\n\terr := mockBatch.Validate()\n\tif !base.Match(err, ErrBatchSECType) {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n}",
"func TestECCPasses(t *testing.T) {\n\tassert := assert.New(t)\n\n\tchecks := append(codecs, NoECC{})\n\n\tfor _, check := range checks {\n\t\tfor i := 0; i < 2000; i++ {\n\t\t\tnumBytes := cmn.RandInt()%60 + 1\n\t\t\tdata := cmn.RandBytes(numBytes)\n\n\t\t\tchecked := check.AddECC(data)\n\t\t\tres, err := check.CheckECC(checked)\n\t\t\tif assert.Nil(err, \"%#v: %+v\", check, err) {\n\t\t\t\tassert.Equal(data, res, \"%v\", check)\n\t\t\t}\n\t\t}\n\t}\n}",
"func TestPagarmeEncryptCard(t *testing.T) {\n\t\n\tCard := new(pagarme.Card)\n\tPagarme := pagarme.NewPagarme(\"pt-BR\", ApiKey, CryptoKey)\n Pagarme.SetDebug()\n\n\tpagarmeFillCard(Card)\n\n\tresult, err := Pagarme.EncryptCard(Card)\n\n if err != nil {\n \tt.Errorf(\"Erro ao encrypt card: %v\", err)\n return\n }\n\n if len(result.Hash) == 0 {\n t.Errorf(\"card hash is expected\")\n return\n }\n}",
"func TestInitAessiv(t *testing.T) {\n\tdir := test_helpers.InitFS(t, \"-aessiv\")\n\t_, c, err := configfile.LoadAndDecrypt(dir+\"/\"+configfile.ConfDefaultName, testPw)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !c.IsFeatureFlagSet(configfile.FlagAESSIV) {\n\t\tt.Error(\"AESSIV flag should be set but is not\")\n\t}\n}",
"func TestSignContractFailure(t *testing.T) {\n\tsignatureHelper(t, true)\n}",
"func CipherSuiteString(value uint16) string {\n\tif str, found := tlsCipherSuiteString[value]; found {\n\t\treturn str\n\t}\n\treturn fmt.Sprintf(\"TLS_CIPHER_SUITE_UNKNOWN_%d\", value)\n}",
"func cipherSuiteScan(addr, hostname string) (grade Grade, output Output, err error) {\n\tvar cvList cipherVersionList\n\tallCiphers := allCiphersIDs()\n\n\tvar vers uint16\n\tfor vers = tls.VersionTLS12; vers >= tls.VersionSSL30; vers-- {\n\t\tciphers := make([]uint16, len(allCiphers))\n\t\tcopy(ciphers, allCiphers)\n\t\tfor len(ciphers) > 0 {\n\t\t\tvar cipherIndex int\n\t\t\tcipherIndex, _, _, err = sayHello(addr, hostname, ciphers, nil, vers, nil)\n\t\t\tif err != nil {\n\t\t\t\tif err == errHelloFailed {\n\t\t\t\t\terr = nil\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif vers == tls.VersionSSL30 {\n\t\t\t\tgrade = Warning\n\t\t\t}\n\t\t\tcipherID := ciphers[cipherIndex]\n\n\t\t\t// If this is an EC cipher suite, do a second scan for curve support\n\t\t\tvar supportedCurves []tls.CurveID\n\t\t\tif tls.CipherSuites[cipherID].EllipticCurve {\n\t\t\t\tsupportedCurves, err = doCurveScan(addr, hostname, vers, cipherID, ciphers)\n\t\t\t\tif len(supportedCurves) == 0 {\n\t\t\t\t\terr = errors.New(\"couldn't negotiate any curves\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor i, c := range cvList {\n\t\t\t\tif cipherID == c.cipherID {\n\t\t\t\t\tcvList[i].data = append(c.data, cipherDatum{vers, supportedCurves})\n\t\t\t\t\tgoto exists\n\t\t\t\t}\n\t\t\t}\n\t\t\tcvList = append(cvList, cipherVersions{cipherID, []cipherDatum{{vers, supportedCurves}}})\n\t\texists:\n\t\t\tciphers = append(ciphers[:cipherIndex], ciphers[cipherIndex+1:]...)\n\t\t}\n\t}\n\n\tif len(cvList) == 0 {\n\t\terr = errors.New(\"couldn't negotiate any cipher suites\")\n\t\treturn\n\t}\n\n\tif grade != Warning {\n\t\tgrade = Good\n\t}\n\n\toutput = cvList\n\treturn\n}",
"func TestCV12(t *testing.T) {\n\tstatedb, _ := state.New(common.Hash{}, state.NewDatabase(ethdb.NewMemDatabase()))\n\tmsg := createValidator()\n\t// security contact length: 140 characters\n\tmsg.SecurityContact = \"Helloiwfhwifbwfbcerghveugbviuscbhwiefbcusidbcifwefhgciwefherhbfiwuehfciwiuebfcuyiewfhwieufwiweifhcwefhwefhwidsffevjnononwondqmeofniowfndjowe\"\n\tstatedb.AddBalance(msg.ValidatorAddress, tenK)\n\tif _, err := VerifyAndCreateValidatorFromMsg(\n\t\tstatedb, postStakingEpoch, big.NewInt(0), msg,\n\t); err != nil {\n\t\tt.Error(\"expected\", nil, \"got\", err)\n\t}\n}",
"func TestVigenereCipher(t *testing.T) {\n\tvar vigenere Vigenere\n\n\tcases := []struct {\n\t\tcaseString string\n\t\tcaseKey string\n\t\texpected string\n\t\t// Tells if a case is of success or fail\n\t\tsuccess bool\n\t}{\n\t\t{\n\t\t\tcaseString: \"Deus e bom, o tempo todo\",\n\t\t\tcaseKey: \"UnB\",\n\t\t\texpected: \"Xrvm r ciz, p nrnjb uiqp\",\n\t\t\tsuccess: true,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"Fim de semestre eh assim\",\n\t\t\tcaseKey: \"hard\",\n\t\t\texpected: \"Mid gl svplskul ey dzszp\",\n\t\t\tsuccess: true,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"this year was a tragic year\",\n\t\t\tcaseKey: \"corona\",\n\t\t\texpected: \"vvzg lecf nof a vfruvc asrf\",\n\t\t\tsuccess: true,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"die Kunst des Rechnens\",\n\t\t\tcaseKey: \"GOLANG\",\n\t\t\texpected: \"jwp Khtyh oef Xkqsnrty\",\n\t\t\tsuccess: true,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"a chave de codificacao eh restrita\",\n\t\t\tcaseKey: \"%\",\n\t\t\texpected: \"? a,?:) () a3(-*-a?a?3 ), 6)786-8?\",\n\t\t\tsuccess: false,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"somente caracteres alfabeticos da ascii podem ser utilizados\",\n\t\t\tcaseKey: \"123\",\n\t\t\texpected: \"c@?5?f5 43b25d6d5d 3<7326f94ac 53 1d59: b?57= d7b ff9=;j26?d\",\n\t\t\tsuccess: false,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"Porem, tanto faz Usar MaIUsCUlo ou MINUSculo\",\n\t\t\tcaseKey: \"GOisNice\",\n\t\t\texpected: \"Vczwz, bcrzc nsm Cuex AiAHaEYrc wm ZQPYYqcdb\",\n\t\t\tsuccess: true,\n\t\t},\n\t}\n\tfor _, c := range cases {\n\t\tif c.success {\n\t\t\t// Success cases\n\t\t\tt.Logf(\"Vigenere testing: %s <key: %s> -> %s\", c.caseString, c.caseKey, c.expected)\n\t\t\tresult, err := vigenere.Cipher(c.caseString, c.caseKey)\n\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"Vigenere FAILED: %s <key: %s> -> expected: %s; got ERROR: %s\", c.caseString, c.caseKey, c.expected, err)\n\t\t\t}\n\n\t\t\tif result != c.expected {\n\t\t\t\tt.Errorf(\"Vigenere FAILED: %s <key: %s> -> expected: %s; got: %s\", c.caseString, c.caseKey, c.expected, result)\n\t\t\t}\n\t\t} else {\n\t\t\t// Fail cases\n\t\t\tt.Logf(\"Vigenere testing: %s <key: %s> -> expected err\", c.caseString, c.caseKey)\n\t\t\tresult, err := vigenere.Cipher(c.caseString, c.caseKey)\n\n\t\t\tif err == nil {\n\t\t\t\tt.Errorf(\"Vigenere FAILED: %s <key: %s> -> expected error, but got: %s\", c.caseString, c.caseKey, result)\n\t\t\t}\n\t\t}\n\t}\n}",
"func (mr *MockisCryptoApiRequest_CryptoApiReqMockRecorder) isCryptoApiRequest_CryptoApiReq() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"isCryptoApiRequest_CryptoApiReq\", reflect.TypeOf((*MockisCryptoApiRequest_CryptoApiReq)(nil).isCryptoApiRequest_CryptoApiReq))\n}",
"func InsecureCipherSuites() []*tls.CipherSuite",
"func testMultipleEncryptionsNotEqual(t *testing.T, newHarness HarnessMaker) {\n\tctx := context.Background()\n\tharness, err := newHarness(ctx, t)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer harness.Close()\n\n\tdrv, err := harness.MakeDriver(ctx)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tkeeper := secrets.NewKeeper(drv)\n\n\tmsg := []byte(\"I'm a secret message!\")\n\tencryptedMsg1, err := keeper.Encrypt(ctx, msg)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tencryptedMsg2, err := keeper.Encrypt(ctx, msg)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif cmp.Equal(encryptedMsg1, encryptedMsg2) {\n\t\tt.Errorf(\"Got same encrypted messages from multiple encryptions %v, want them to be different\", string(encryptedMsg1))\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
EndpointConfig mocks base method
|
func (m *MockProviders) EndpointConfig() fab.EndpointConfig {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "EndpointConfig")
ret0, _ := ret[0].(fab.EndpointConfig)
return ret0
}
|
[
"func (m *MockClient) EndpointConfig() fab.EndpointConfig {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"EndpointConfig\")\n\tret0, _ := ret[0].(fab.EndpointConfig)\n\treturn ret0\n}",
"func (m *MockConfiguration) IntrospectionEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IntrospectionEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}",
"func mockGetConfig(profileName string) (config.Configuration, error) {\n\tmockConfig := &mocks.MockClientConfig{}\n\n\tmockConfig.ProfileNameFunc = func() string {\n\t\treturn profileName\n\t}\n\n\tmockConfig.EnvironmentFunc = func() string {\n\t\treturn \"mypurecloud.com\"\n\t}\n\n\tmockConfig.LogFilePathFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.LoggingEnabledFunc = func() bool {\n\t\treturn false\n\t}\n\n\tmockConfig.AutoPaginationEnabledFunc = func() bool {\n\t\treturn false\n\t}\n\n\tmockConfig.ClientIDFunc = func() string {\n\t\treturn utils.GenerateGuid()\n\t}\n\n\tmockConfig.ClientSecretFunc = func() string {\n\t\treturn utils.GenerateGuid()\n\t}\n\n\tmockConfig.RedirectURIFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.OAuthTokenDataFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.AccessTokenFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.ProxyConfigurationFunc = func() *config.ProxyConfiguration {\n\t\treturn &config.ProxyConfiguration{}\n\t}\n\n\treturn mockConfig, nil\n}",
"func (m *MockAPIConfigFromFlags) MakeEndpoint() (http.Endpoint, error) {\n\tret := m.ctrl.Call(m, \"MakeEndpoint\")\n\tret0, _ := ret[0].(http.Endpoint)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (m *MockConfiguration) UserinfoEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UserinfoEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}",
"func (m *MockConfiguration) TokenEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"TokenEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}",
"func (m *MockProvider) ServiceEndpoint() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ServiceEndpoint\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func setupMockEndpoint(url string) http.RoundTripper {\n\ttransport := httpmock.NewMockTransport()\n\ttransport.RegisterResponder(\"POST\", url, randomlySlowResponder)\n\n\treturn transport\n}",
"func TestEndpoint(t *testing.T) {\n\tvar result Endpoint\n\terr := json.NewDecoder(endpointBody).Decode(&result)\n\n\tif err != nil {\n\t\tt.Errorf(\"Error decoding JSON: %s\", err)\n\t}\n\n\tif result.ID != \"Endpoint-1\" {\n\t\tt.Errorf(\"Received invalid ID: %s\", result.ID)\n\t}\n\n\tif result.Name != \"EndpointOne\" {\n\t\tt.Errorf(\"Received invalid name: %s\", result.Name)\n\t}\n\n\tif len(result.ConnectedEntities) != 1 {\n\t\tt.Errorf(\"Expected on connected entity, got: %d\", len(result.ConnectedEntities))\n\t}\n\n\tif result.EndpointProtocol != common.NVMeProtocol {\n\t\tt.Errorf(\"Received endpoint protocol: %s\", result.EndpointProtocol)\n\t}\n\n\tif result.HostReservationMemoryBytes != 8589934592 {\n\t\tt.Errorf(\"Received host reservation memory bytes: %d\", result.HostReservationMemoryBytes)\n\t}\n\n\tif len(result.IPTransportDetails) != 1 {\n\t\tt.Errorf(\"Received %d IP transport details\", len(result.IPTransportDetails))\n\t}\n\n\tif result.IPTransportDetails[0].IPv4Address != \"127.0.0.1\" {\n\t\tt.Errorf(\"Received IP transport IPv4: %s\", result.IPTransportDetails[0].IPv4Address)\n\t}\n\n\tif len(result.Identifiers) != 1 {\n\t\tt.Errorf(\"Received %d identifiers\", len(result.Identifiers))\n\t}\n\n\tif result.Identifiers[0].DurableNameFormat != common.IQNDurableNameFormat {\n\t\tt.Errorf(\"Received durable name format: %s\", result.Identifiers[0].DurableNameFormat)\n\t}\n}",
"func (m *MockConfiguration) AuthorizationEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AuthorizationEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}",
"func Test_setRegInfoExplicitEndpoint(t *testing.T) {\n\tinitMetadata() // Used from metadata_test.go\n\n\tsvc := bridge.Service{\n\t\tAttrs: map[string]string{\n\t\t\t\"eureka_lookup_elbv2_endpoint\": \"false\",\n\t\t\t\"eureka_elbv2_hostname\": \"hostname-i-set\",\n\t\t\t\"eureka_elbv2_port\": \"65535\",\n\t\t\t\"eureka_datacenterinfo_name\": \"AMAZON\",\n\t\t},\n\t\tName: \"app\",\n\t\tOrigin: bridge.ServicePort{\n\t\t\tContainerID: \"123123412\",\n\t\t},\n\t}\n\n\tawsInfo := eureka.AmazonMetadataType{\n\t\tPublicHostname: \"i-should-be-changed\",\n\t\tHostName: \"i-should-be-changed\",\n\t\tInstanceID: \"i-should-be-changed\",\n\t}\n\n\tdcInfo := eureka.DataCenterInfo{\n\t\tName: eureka.Amazon,\n\t\tMetadata: awsInfo,\n\t}\n\n\treg := eureka.Instance{\n\t\tDataCenterInfo: dcInfo,\n\t\tPort: 5001,\n\t\tIPAddr: \"4.3.2.1\",\n\t\tApp: \"app\",\n\t\tVipAddress: \"4.3.2.1\",\n\t\tHostName: \"hostname_identifier\",\n\t\tStatus: eureka.UP,\n\t}\n\n\t// Init LB info cache\n\t// if things are working correctly, this won't be used for this test\n\tlbCache[\"123123412\"] = &LBInfo{\n\t\tDNSName: \"i-should-not-be-used\",\n\t\tPort: 666,\n\t}\n\n\twantedAwsInfo := eureka.AmazonMetadataType{\n\t\tPublicHostname: svc.Attrs[\"eureka_elbv2_hostname\"],\n\t\tHostName: svc.Attrs[\"eureka_elbv2_hostname\"],\n\t\tInstanceID: svc.Attrs[\"eureka_elbv2_hostname\"] + \"_\" + svc.Attrs[\"eureka_elbv2_port\"],\n\t}\n\twantedDCInfo := eureka.DataCenterInfo{\n\t\tName: eureka.Amazon,\n\t\tMetadata: wantedAwsInfo,\n\t}\n\n\texpectedPort, _ := strconv.Atoi(svc.Attrs[\"eureka_elbv2_port\"])\n\twanted := eureka.Instance{\n\t\tDataCenterInfo: wantedDCInfo,\n\t\tPort: expectedPort,\n\t\tApp: svc.Name,\n\t\tIPAddr: \"\",\n\t\tVipAddress: \"\",\n\t\tHostName: svc.Attrs[\"eureka_elbv2_hostname\"],\n\t\tStatus: eureka.UP,\n\t}\n\n\ttype args struct {\n\t\tservice *bridge.Service\n\t\tregistration *eureka.Instance\n\t}\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\twant *eureka.Instance\n\t}{\n\t\t{\n\t\t\tname: \"Should match data\",\n\t\t\targs: args{service: &svc, registration: ®},\n\t\t\twant: &wanted,\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tgot := setRegInfo(tt.args.service, tt.args.registration, true)\n\t\t\tval := got.Metadata.GetMap()[\"has-elbv2\"]\n\t\t\tif val != \"true\" {\n\t\t\t\tt.Errorf(\"setRegInfo() = %+v, \\n Wanted has-elbv2=true in metadata, was %+v\", got, val)\n\t\t\t}\n\t\t\tval2 := got.Metadata.GetMap()[\"elbv2-endpoint\"]\n\t\t\twantVal := svc.Attrs[\"eureka_elbv2_hostname\"] + \"_\" + svc.Attrs[\"eureka_elbv2_port\"]\n\t\t\tif val2 != wantVal {\n\t\t\t\tt.Errorf(\"setRegInfo() = %+v, \\n Wanted elbv2-endpoint=%v in metadata, was %+v\", got, wantVal, val2)\n\t\t\t}\n\t\t\t//Overwrite metadata before comparing data structure - we've directly checked the flag we are looking for\n\t\t\tgot.Metadata = eureka.InstanceMetadata{}\n\t\t\tif !reflect.DeepEqual(got, tt.want) {\n\t\t\t\tt.Errorf(\"setRegInfo() = %+v, \\nwant %+v\\n\", got, tt.want)\n\t\t\t}\n\t\t})\n\t}\n\n}",
"func Endpoint(url string, configureFunc func()) {\n\touterCurrentMockHandler := currentMockHandler\n\tSwitch(extractor.ExtractMethod(), configureFunc)\n\tcurrentMockery.Handle(url, currentMockHandler)\n\tcurrentMockHandler = outerCurrentMockHandler\n}",
"func awsMetadataApiMock(endpoints []*endpoint) func() {\n\tts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\t\tw.Header().Add(\"Server\", \"MockEC2\")\n\t\tlog.Printf(\"[DEBUG] Mocker server received request to %q\", r.RequestURI)\n\t\tfor _, e := range endpoints {\n\t\t\tif r.RequestURI == e.Uri {\n\t\t\t\tfmt.Fprintln(w, e.Body)\n\t\t\t\tw.WriteHeader(200)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tw.WriteHeader(400)\n\t}))\n\n\tos.Setenv(\"AWS_METADATA_URL\", ts.URL+\"/latest\")\n\treturn ts.Close\n}",
"func (c *MockRemoteWriteClient) Endpoint() string { return \"\" }",
"func EndpointForCondition(predicate predicate.Predicate, configFunc func()) {\n\touterCurrentMockHandler := currentMockHandler\n\tconfigFunc()\n\tcurrentMockery.HandleForCondition(DefaultPriority, predicate, currentMockHandler)\n\tcurrentMockHandler = outerCurrentMockHandler\n}",
"func TestEndpointCase20(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tBucket: ptr.String(\"bucketname\"),\n\t\tRegion: ptr.String(\"us-west-2\"),\n\t\tForcePathStyle: ptr.Bool(true),\n\t\tUseFIPS: ptr.Bool(false),\n\t\tAccelerate: ptr.Bool(false),\n\t\tUseDualStack: ptr.Bool(true),\n\t\tEndpoint: ptr.String(\"https://abc.com\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err == nil {\n\t\tt.Fatalf(\"expect error, got none\")\n\t}\n\tif e, a := \"Cannot set dual-stack in combination with a custom endpoint.\", err.Error(); !strings.Contains(a, e) {\n\t\tt.Errorf(\"expect %v error in %v\", e, a)\n\t}\n}",
"func (c *Provider) EndpointConfig() fab.EndpointConfig {\n\treturn c.endpointConfig\n}",
"func (m *MockConfiguration) KeysEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"KeysEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}",
"func TestValidate1(t *testing.T) {\n\tendpoints := make(map[string]map[string]*Endpoint)\n\tendpoints[\"/test\"] = map[string]*Endpoint{\n\t\t\"get\": {\n\t\t\tParams: &Parameters{\n\t\t\t\tQuery: map[string]*ParamEntry{\"test\": {Type: \"string\", Required: true}},\n\t\t\t\tPath: map[string]*ParamEntry{\"test\": {Type: \"boolean\", Required: true}},\n\t\t\t},\n\t\t\tRecieves: &Recieves{\n\t\t\t\tHeaders: map[string]string{\"foo\": \"bar\"},\n\t\t\t\tBody: map[string]string{\"example_array.0.foo\": \"string\"},\n\t\t\t},\n\t\t\tResponses: map[int]*Response{\n\t\t\t\t200: {\n\t\t\t\t\tHeaders: map[string]string{\"foo\": \"bar\"},\n\t\t\t\t\tBody: map[string]interface{}{\"bar\": \"foo\"},\n\t\t\t\t\tWeight: 100,\n\t\t\t\t\tActions: []map[string]interface{}{\n\t\t\t\t\t\t{\"delay\": 10},\n\t\t\t\t\t\t{\"request\": map[interface{}]interface{}{\"target\": \"testService\", \"id\": \"testRequest\"}},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tActions: []map[string]interface{}{\n\t\t\t\t{\"delay\": 10},\n\t\t\t\t{\"request\": map[interface{}]interface{}{\"target\": \"testService\", \"id\": \"testRequest\"}},\n\t\t\t},\n\t\t},\n\t}\n\n\tcfg := &Config{\n\t\tVersion: 1.0,\n\t\tServices: map[string]*Service{\n\t\t\t\"testService\": {Hostname: \"localhost\", Port: 8080},\n\t\t},\n\t\tStartupActions: []map[string]interface{}{\n\t\t\t{\"delay\": 10},\n\t\t\t{\"request\": map[interface{}]interface{}{\"target\": \"testService\", \"id\": \"testRequest\"}},\n\t\t},\n\t\tRequests: map[string]*Request{\n\t\t\t\"testRequest\": {\n\t\t\t\tURL: \"/test\",\n\t\t\t\tProtocol: \"http\",\n\t\t\t\tMethod: \"get\",\n\t\t\t\tHeaders: map[string]string{\"foo\": \"bar\"},\n\t\t\t\tBody: nil,\n\t\t\t\tExpectedResponse: &Response{\n\t\t\t\t\tStatusCode: 200,\n\t\t\t\t\tBody: map[string]interface{}{\"foo.bar\": \"string\"},\n\t\t\t\t\tHeaders: nil,\n\t\t\t\t\tWeight: 100,\n\t\t\t\t\tActions: []map[string]interface{}{\n\t\t\t\t\t\t{\"delay\": 10},\n\t\t\t\t\t\t{\"request\": map[interface{}]interface{}{\"target\": \"testService\", \"id\": \"testRequest\"}},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tEndpoints: endpoints,\n\t}\n\n\tif err := Validate(cfg); err != nil {\n\t\tt.Errorf(\"Validation Failed: %s\", err.Error())\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
EndpointConfig indicates an expected call of EndpointConfig
|
func (mr *MockProvidersMockRecorder) EndpointConfig() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndpointConfig", reflect.TypeOf((*MockProviders)(nil).EndpointConfig))
}
|
[
"func (mr *MockClientMockRecorder) EndpointConfig() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"EndpointConfig\", reflect.TypeOf((*MockClient)(nil).EndpointConfig))\n}",
"func (m *MockClient) EndpointConfig() fab.EndpointConfig {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"EndpointConfig\")\n\tret0, _ := ret[0].(fab.EndpointConfig)\n\treturn ret0\n}",
"func (m *MockProviders) EndpointConfig() fab.EndpointConfig {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"EndpointConfig\")\n\tret0, _ := ret[0].(fab.EndpointConfig)\n\treturn ret0\n}",
"func (c *Provider) EndpointConfig() fab.EndpointConfig {\n\treturn c.endpointConfig\n}",
"func (c *Config) Endpoint() string { return c.ESEndpoint }",
"func TestValidateInvalidEndpoint(t *testing.T) {\n\tendpoint, err := url.Parse(\"https://\")\n\trequire.NoError(t, err)\n\n\tcfg, err := newConfig(WithEndpoint(*endpoint))\n\trequire.NoError(t, err)\n\n\tassert.Equal(t, cfg.endpoint, *endpoint)\n}",
"func checkEndpoint(e string) error {\n\tsplit := strings.Split(e, \":\")\n\tif len(split) != 2 {\n\t\treturn fmt.Errorf(\"malformed endpoint definition: %s\", e)\n\t}\n\tif split[1] == \"eth0\" {\n\t\treturn fmt.Errorf(\"eth0 interface can't be used in the endpoint definition as it is added by docker automatically: '%s'\", e)\n\t}\n\treturn nil\n}",
"func (h Handler) TestEndpoint() error {\n\tr, err := http.Get(h.url)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif r.StatusCode != 200 {\n\t\treturn errors.New(\"Endpoint not replying typical 200 answer on ping\")\n\t}\n\n\treturn nil\n}",
"func TestEndpointCase46(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(true),\n\t\tEndpoint: ptr.String(\"https://example.com\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err == nil {\n\t\tt.Fatalf(\"expect error, got none\")\n\t}\n\tif e, a := \"Invalid Configuration: FIPS and custom endpoint are not supported\", err.Error(); !strings.Contains(a, e) {\n\t\tt.Errorf(\"expect %v error in %v\", e, a)\n\t}\n}",
"func TestEndpoint(t *testing.T) {\n\tvar result Endpoint\n\terr := json.NewDecoder(endpointBody).Decode(&result)\n\n\tif err != nil {\n\t\tt.Errorf(\"Error decoding JSON: %s\", err)\n\t}\n\n\tif result.ID != \"Endpoint-1\" {\n\t\tt.Errorf(\"Received invalid ID: %s\", result.ID)\n\t}\n\n\tif result.Name != \"EndpointOne\" {\n\t\tt.Errorf(\"Received invalid name: %s\", result.Name)\n\t}\n\n\tif len(result.ConnectedEntities) != 1 {\n\t\tt.Errorf(\"Expected on connected entity, got: %d\", len(result.ConnectedEntities))\n\t}\n\n\tif result.EndpointProtocol != common.NVMeProtocol {\n\t\tt.Errorf(\"Received endpoint protocol: %s\", result.EndpointProtocol)\n\t}\n\n\tif result.HostReservationMemoryBytes != 8589934592 {\n\t\tt.Errorf(\"Received host reservation memory bytes: %d\", result.HostReservationMemoryBytes)\n\t}\n\n\tif len(result.IPTransportDetails) != 1 {\n\t\tt.Errorf(\"Received %d IP transport details\", len(result.IPTransportDetails))\n\t}\n\n\tif result.IPTransportDetails[0].IPv4Address != \"127.0.0.1\" {\n\t\tt.Errorf(\"Received IP transport IPv4: %s\", result.IPTransportDetails[0].IPv4Address)\n\t}\n\n\tif len(result.Identifiers) != 1 {\n\t\tt.Errorf(\"Received %d identifiers\", len(result.Identifiers))\n\t}\n\n\tif result.Identifiers[0].DurableNameFormat != common.IQNDurableNameFormat {\n\t\tt.Errorf(\"Received durable name format: %s\", result.Identifiers[0].DurableNameFormat)\n\t}\n}",
"func TestEndpointCase20(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tBucket: ptr.String(\"bucketname\"),\n\t\tRegion: ptr.String(\"us-west-2\"),\n\t\tForcePathStyle: ptr.Bool(true),\n\t\tUseFIPS: ptr.Bool(false),\n\t\tAccelerate: ptr.Bool(false),\n\t\tUseDualStack: ptr.Bool(true),\n\t\tEndpoint: ptr.String(\"https://abc.com\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err == nil {\n\t\tt.Fatalf(\"expect error, got none\")\n\t}\n\tif e, a := \"Cannot set dual-stack in combination with a custom endpoint.\", err.Error(); !strings.Contains(a, e) {\n\t\tt.Errorf(\"expect %v error in %v\", e, a)\n\t}\n}",
"func (c *ServerConfig) getConfigEndpoint() string {\n\tnurl := *c.ParsedEndpoint\n\tnurl.Path = path.Join(nurl.Path, c.APIPaths.Config)\n\treturn nurl.String()\n}",
"func TestEndpointCase47(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-1\"),\n\t\tUseDualStack: ptr.Bool(true),\n\t\tUseFIPS: ptr.Bool(false),\n\t\tEndpoint: ptr.String(\"https://example.com\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err == nil {\n\t\tt.Fatalf(\"expect error, got none\")\n\t}\n\tif e, a := \"Invalid Configuration: Dualstack and custom endpoint are not supported\", err.Error(); !strings.Contains(a, e) {\n\t\tt.Errorf(\"expect %v error in %v\", e, a)\n\t}\n}",
"func ResolveEndpointConfig(sources []interface{}) (value string, found bool, err error) {\n\tfor _, source := range sources {\n\t\tif resolver, ok := source.(EndpointResolver); ok {\n\t\t\tvalue, found, err = resolver.GetEC2IMDSEndpoint()\n\t\t\tif err != nil || found {\n\t\t\t\treturn value, found, err\n\t\t\t}\n\t\t}\n\t}\n\treturn value, found, err\n}",
"func validateAdapterEndpoint(endpoint string, adapterName string, errs []error) []error {\n\tif endpoint == \"\" {\n\t\treturn append(errs, fmt.Errorf(\"There's no default endpoint available for %s. Calls to this bidder/exchange will fail. \"+\n\t\t\t\"Please set adapters.%s.endpoint in your app config\", adapterName, adapterName))\n\t}\n\n\t// Create endpoint template\n\tendpointTemplate, err := template.New(\"endpointTemplate\").Parse(endpoint)\n\tif err != nil {\n\t\treturn append(errs, fmt.Errorf(\"Invalid endpoint template: %s for adapter: %s. %v\", endpoint, adapterName, err))\n\t}\n\t// Resolve macros (if any) in the endpoint URL\n\tresolvedEndpoint, err := macros.ResolveMacros(*endpointTemplate, macros.EndpointTemplateParams{\n\t\tHost: dummyHost,\n\t\tPublisherID: dummyPublisherID,\n\t\tAccountID: dummyAccountID,\n\t})\n\tif err != nil {\n\t\treturn append(errs, fmt.Errorf(\"Unable to resolve endpoint: %s for adapter: %s. %v\", endpoint, adapterName, err))\n\t}\n\t// Validate the resolved endpoint\n\t//\n\t// Validating using both IsURL and IsRequestURL because IsURL allows relative paths\n\t// whereas IsRequestURL requires absolute path but fails to check other valid URL\n\t// format constraints.\n\t//\n\t// For example: IsURL will allow \"abcd.com\" but IsRequestURL won't\n\t// IsRequestURL will allow \"http://http://abcd.com\" but IsURL won't\n\tif !validator.IsURL(resolvedEndpoint) || !validator.IsRequestURL(resolvedEndpoint) {\n\t\terrs = append(errs, fmt.Errorf(\"The endpoint: %s for %s is not a valid URL\", resolvedEndpoint, adapterName))\n\t}\n\treturn errs\n}",
"func (mr *MockConfigurationMockRecorder) IntrospectionEndpoint() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IntrospectionEndpoint\", reflect.TypeOf((*MockConfiguration)(nil).IntrospectionEndpoint))\n}",
"func (m *MockConfiguration) IntrospectionEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IntrospectionEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}",
"func EndpointForCondition(predicate predicate.Predicate, configFunc func()) {\n\touterCurrentMockHandler := currentMockHandler\n\tconfigFunc()\n\tcurrentMockery.HandleForCondition(DefaultPriority, predicate, currentMockHandler)\n\tcurrentMockHandler = outerCurrentMockHandler\n}",
"func TestFailedEndpoint1(t *testing.T) {\n\tisTesting = true\n\tvar request = Request{\n\t\tPath: \"/api/device\",\n\t\tHTTPMethod: \"GET\",\n\t}\n\tvar response, _ = Handler(request)\n\tif response.StatusCode != 404 {\n\t\tt.Errorf(\"response status code has to be 404 but is %d\", response.StatusCode)\n\t}\n\tif response.Body != `{\"message\":\"requested endpoint not found\"}` {\n\t\tt.Errorf(\"body is: %s\", response.Body)\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
IdentityConfig mocks base method
|
func (m *MockProviders) IdentityConfig() msp.IdentityConfig {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "IdentityConfig")
ret0, _ := ret[0].(msp.IdentityConfig)
return ret0
}
|
[
"func (m *MockClient) IdentityConfig() msp.IdentityConfig {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IdentityConfig\")\n\tret0, _ := ret[0].(msp.IdentityConfig)\n\treturn ret0\n}",
"func mockGetConfig(profileName string) (config.Configuration, error) {\n\tmockConfig := &mocks.MockClientConfig{}\n\n\tmockConfig.ProfileNameFunc = func() string {\n\t\treturn profileName\n\t}\n\n\tmockConfig.EnvironmentFunc = func() string {\n\t\treturn \"mypurecloud.com\"\n\t}\n\n\tmockConfig.LogFilePathFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.LoggingEnabledFunc = func() bool {\n\t\treturn false\n\t}\n\n\tmockConfig.AutoPaginationEnabledFunc = func() bool {\n\t\treturn false\n\t}\n\n\tmockConfig.ClientIDFunc = func() string {\n\t\treturn utils.GenerateGuid()\n\t}\n\n\tmockConfig.ClientSecretFunc = func() string {\n\t\treturn utils.GenerateGuid()\n\t}\n\n\tmockConfig.RedirectURIFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.OAuthTokenDataFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.AccessTokenFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.ProxyConfigurationFunc = func() *config.ProxyConfiguration {\n\t\treturn &config.ProxyConfiguration{}\n\t}\n\n\treturn mockConfig, nil\n}",
"func (m *MockChoriaProvider) Identity() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func TestGetIdentity(t *testing.T) {\n\ttests := []struct {\n\t\tdescription string\n\t\tinARN string\n\t\toutIdentity Identity\n\t\toutName string\n\t\toutAccountID string\n\t\toutPartition string\n\t\toutType string\n\t}{\n\t\t{\n\t\t\tdescription: \"role identity\",\n\t\t\tinARN: \"arn:aws:iam::123456789012:role/custom/path/EC2ReadOnly\",\n\t\t\toutIdentity: Role{},\n\t\t\toutName: \"EC2ReadOnly\",\n\t\t\toutAccountID: \"123456789012\",\n\t\t\toutPartition: \"aws\",\n\t\t\toutType: \"role\",\n\t\t},\n\t\t{\n\t\t\tdescription: \"assumed role identity\",\n\t\t\tinARN: \"arn:aws:sts::123456789012:assumed-role/DatabaseAccess/i-1234567890\",\n\t\t\toutIdentity: Role{},\n\t\t\toutName: \"DatabaseAccess\",\n\t\t\toutAccountID: \"123456789012\",\n\t\t\toutPartition: \"aws\",\n\t\t\toutType: \"assumed-role\",\n\t\t},\n\t\t{\n\t\t\tdescription: \"user identity\",\n\t\t\tinARN: \"arn:aws-us-gov:iam::123456789012:user/custom/path/alice\",\n\t\t\toutIdentity: User{},\n\t\t\toutName: \"alice\",\n\t\t\toutAccountID: \"123456789012\",\n\t\t\toutPartition: \"aws-us-gov\",\n\t\t\toutType: \"user\",\n\t\t},\n\t\t{\n\t\t\tdescription: \"unsupported identity\",\n\t\t\tinARN: \"arn:aws:iam::123456789012:group/readers\",\n\t\t\toutIdentity: Unknown{},\n\t\t\toutName: \"readers\",\n\t\t\toutAccountID: \"123456789012\",\n\t\t\toutPartition: \"aws\",\n\t\t\toutType: \"group\",\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tt.Run(test.description, func(t *testing.T) {\n\t\t\tidentity, err := GetIdentityWithClient(context.Background(), &stsMock{arn: test.inARN})\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.IsType(t, test.outIdentity, identity)\n\t\t\trequire.Equal(t, test.outName, identity.GetName())\n\t\t\trequire.Equal(t, test.outAccountID, identity.GetAccountID())\n\t\t\trequire.Equal(t, test.outPartition, identity.GetPartition())\n\t\t\trequire.Equal(t, test.outType, identity.GetType())\n\t\t})\n\t}\n}",
"func (m *MockFramework) Identity() string {\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func mockGetConfigWithAccessToken(profileName string) (config.Configuration, error) {\n\tmockConfig := &mocks.MockClientConfig{}\n\n\tmockConfig.ProfileNameFunc = func() string {\n\t\treturn profileName\n\t}\n\n\tmockConfig.EnvironmentFunc = func() string {\n\t\treturn \"mypurecloud.com\"\n\t}\n\n\tmockConfig.LogFilePathFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.LoggingEnabledFunc = func() bool {\n\t\treturn false\n\t}\n\n\tmockConfig.AutoPaginationEnabledFunc = func() bool {\n\t\treturn false\n\t}\n\n\tmockConfig.ClientIDFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.ClientSecretFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.OAuthTokenDataFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.AccessTokenFunc = func() string {\n\t\treturn \"XNiJQrSf2YQmJODySCxG6HaVIE2lfZfJ35Y4JDh5L9YEBJOTG3p6szRyUvWVM7pDmziPHHcq9NW7e0KxN_lb6w\" // this is a \"bad\" token for testing purposes\n\t}\n\n\treturn mockConfig, nil\n}",
"func (m *MockSecurityProvider) Identity() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func MockIdentityContext() (sdk.Context, *keeper.Keeper) {\n\t// Codec\n\tinterfaceRegistry := codectypes.NewInterfaceRegistry()\n\tcdc := codec.NewProtoCodec(interfaceRegistry)\n\n\t// Store keys\n\tkeys := sdk.NewKVStoreKeys(types.StoreKey)\n\n\t// Keeper\n\tidentityKeeper := keeper.NewKeeper(cdc, keys[types.StoreKey], keys[types.MemStoreKey])\n\n\t// Create multiStore in memory\n\tdb := dbm.NewMemDB()\n\tcms := store.NewCommitMultiStore(db)\n\n\t// Mount stores\n\tcms.MountStoreWithDB(keys[types.StoreKey], sdk.StoreTypeIAVL, db)\n\tcms.LoadLatestVersion()\n\n\t// Create context\n\tctx := sdk.NewContext(cms, tmproto.Header{}, false, log.NewNopLogger())\n\n\treturn ctx, identityKeeper\n}",
"func (m *MockMachine) Identity() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func mockConfig(num int) *KConf {\n\tconfig := clientcmdapi.NewConfig()\n\tfor i := 0; i < num; i++ {\n\t\tvar name string\n\t\tif i == 0 {\n\t\t\tname = \"test\"\n\t\t} else {\n\t\t\tname = fmt.Sprintf(\"test-%d\", i)\n\t\t}\n\t\tconfig.Clusters[name] = &clientcmdapi.Cluster{\n\t\t\tLocationOfOrigin: \"/home/user/.kube/config\",\n\t\t\tServer: fmt.Sprintf(\"https://example-%s.com:6443\", name),\n\t\t\tInsecureSkipTLSVerify: true,\n\t\t\tCertificateAuthority: \"bbbbbbbbbbbb\",\n\t\t\tCertificateAuthorityData: []byte(\"bbbbbbbbbbbb\"),\n\t\t}\n\t\tconfig.AuthInfos[name] = &clientcmdapi.AuthInfo{\n\t\t\tLocationOfOrigin: \"/home/user/.kube/config\",\n\t\t\tToken: fmt.Sprintf(\"bbbbbbbbbbbb-%s\", name),\n\t\t}\n\t\tconfig.Contexts[name] = &clientcmdapi.Context{\n\t\t\tLocationOfOrigin: \"/home/user/.kube/config\",\n\t\t\tCluster: name,\n\t\t\tAuthInfo: name,\n\t\t\tNamespace: \"default\",\n\t\t}\n\t}\n\treturn &KConf{Config: *config}\n}",
"func WrapMockAuthConfig(hfn http.HandlerFunc, cfg *config.APICfg, brk brokers.Broker, str stores.Store, mgr *oldPush.Manager, c push.Client, roles ...string) http.HandlerFunc {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\n\t\turlVars := mux.Vars(r)\n\n\t\tuserRoles := []string{\"publisher\", \"consumer\"}\n\t\tif len(roles) > 0 {\n\t\t\tuserRoles = roles\n\t\t}\n\n\t\tnStr := str.Clone()\n\t\tdefer nStr.Close()\n\n\t\tprojectUUID := projects.GetUUIDByName(urlVars[\"project\"], nStr)\n\t\tgorillaContext.Set(r, \"auth_project_uuid\", projectUUID)\n\t\tgorillaContext.Set(r, \"brk\", brk)\n\t\tgorillaContext.Set(r, \"str\", nStr)\n\t\tgorillaContext.Set(r, \"mgr\", mgr)\n\t\tgorillaContext.Set(r, \"apsc\", c)\n\t\tgorillaContext.Set(r, \"auth_resource\", cfg.ResAuth)\n\t\tgorillaContext.Set(r, \"auth_user\", \"UserA\")\n\t\tgorillaContext.Set(r, \"auth_user_uuid\", \"uuid1\")\n\t\tgorillaContext.Set(r, \"auth_roles\", userRoles)\n\t\tgorillaContext.Set(r, \"push_worker_token\", cfg.PushWorkerToken)\n\t\tgorillaContext.Set(r, \"push_enabled\", cfg.PushEnabled)\n\t\thfn.ServeHTTP(w, r)\n\n\t})\n}",
"func MockOpenIDConnect(t *testing.T) string {\n\tconst discovery = `{\n\t\t\"issuer\": \"https://example.com/\",\n\t\t\"authorization_endpoint\": \"https://example.com/authorize\",\n\t\t\"token_endpoint\": \"https://example.com/token\",\n\t\t\"userinfo_endpoint\": \"https://example.com/userinfo\",\n\t\t\"jwks_uri\": \"https://example.com/.well-known/jwks.json\",\n\t\t\"scopes_supported\": [\n\t\t\t\"pets_read\",\n\t\t\t\"pets_write\",\n\t\t\t\"admin\"\n\t\t],\n\t\t\"response_types_supported\": [\n\t\t\t\"code\",\n\t\t\t\"id_token\",\n\t\t\t\"token id_token\"\n\t\t],\n\t\t\"token_endpoint_auth_methods_supported\": [\n\t\t\t\"client_secret_basic\"\n\t\t]\n\t}`\n\tsrv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusOK)\n\t\t_, err := w.Write([]byte(discovery))\n\t\trequire.NoError(t, err)\n\t}))\n\tt.Cleanup(func() {\n\t\tsrv.Close()\n\t})\n\treturn srv.URL + \"/.well-known/openid-configuration\"\n}",
"func TestStrategyHeaderOidcWithImpersonationAuthentication(t *testing.T) {\n\trand.New(rand.NewSource(time.Now().UnixNano()))\n\tcfg := config.NewConfig()\n\tcfg.Auth.Strategy = config.AuthStrategyHeader\n\tcfg.LoginToken.SigningKey = util.RandomString(16)\n\tconfig.Set(cfg)\n\n\tclockTime := time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)\n\tutil.Clock = util.ClockMock{Time: clockTime}\n\n\t// Mock K8S API to accept credentials\n\tmockK8s(t, false)\n\n\t// OIDC Token\n\toidcToken := \"eyJhbGciOiJSUzI1NiIsImtpZCI6Imh1MUIyczUxR2xQbjRBWmJTNHNpWjR6VXY0MkZCcUhGM1g0Q3hjY3B4WU0ifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJvcGVudW5pc29uIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6Im9wZW51bmlzb24tb3JjaGVzdHJhLXRva2VuLTV4ZmZwIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6Im9wZW51bmlzb24tb3JjaGVzdHJhIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiNWU4NTcwMDItMmIwMy00ODUxLTljNDEtOGM5NGRhZTNhZWQzIiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Om9wZW51bmlzb246b3BlbnVuaXNvbi1vcmNoZXN0cmEifQ.eXlVuwZYYF85menphWJEHgSVNL8BTnCQfQiuE3QoJCEKO3Mi-xG1psPMxXnFkgeNlRdu30sejyd23_2ccW2b7q7Ss94o_m3ypWVV95ylGLegQOR8-b4mnysA8W9H1xpDsDii6kqc6k0IkJggUhBqImZHjSxbuvexuNuBmp-E_EOTuALIPmfWH3A7_z6dQEYc6sZ6xcmwBFJ-CuTDTpmYO-FvHvmBKVELpgCkEtMTeaXL3Avjg9KrrZ9T6rMcFfeDlMxNj-8KCEFV3QIiZCzULERuGU1WKKfukmb_sgEm5CshOHfC06ah0dyclZq8ctDPRqPVyRTgF5ZGtA_p4U6RsA\"\n\n\t// Create request\n\tform := url.Values{}\n\tform.Add(\"token\", \"foo\")\n\trequest := httptest.NewRequest(\"POST\", \"http://kiali/api/authenticate\", nil)\n\trequest.Header.Set(\"Authorization\", \"Bearer \"+oidcToken)\n\trequest.Header.Set(\"Impersonate-User\", \"mmosley\")\n\trequest.PostForm = form\n\n\tresponseRecorder := httptest.NewRecorder()\n\tAuthenticate(responseRecorder, request)\n\tresponse := responseRecorder.Result()\n\n\tassert.Equal(t, http.StatusOK, response.StatusCode)\n\tassert.Len(t, response.Cookies(), 1)\n\n\t// Simply check that some cookie is set and has the right expiration. Testing cookie content is left to the session_persistor_test.go\n\tcookie := response.Cookies()[0]\n\tassert.Equal(t, authentication.AESSessionCookieName, cookie.Name)\n\tassert.True(t, cookie.HttpOnly)\n\n\tassert.Equal(t, clockTime.Add(time.Second*time.Duration(cfg.LoginToken.ExpirationSeconds)), cookie.Expires)\n}",
"func (u *MockUser) Identity() ([]byte, error) {\n\treturn []byte(\"test\"), nil\n}",
"func mockConfigFromFile(t *testing.T, e External, path string) configuration {\n\tc := newDefaultConfiguration(e)\n\n\tc.Path = path\n\n\terr := c.loadConfig()\n\tif err != nil {\n\t\tt.Fatalf(\"Configuration could not be read (%s)\", err)\n\t}\n\n\treturn c\n}",
"func (n *mockAgent) configure(h hypervisor, id, sharePath string, config interface{}) error {\n\treturn nil\n}",
"func TestSetGetConfigBasic(t *testing.T) {\n\tt.Parallel()\n\tctx := pctx.TestContext(t)\n\tenv := realenv.NewRealEnvWithIdentity(ctx, t, dockertestenv.NewTestDBConfig(t))\n\tpeerPort := strconv.Itoa(int(env.ServiceEnv.Config().PeerPort))\n\tc := env.PachClient\n\ttu.ActivateAuthClient(t, c, peerPort)\n\t// Configure OIDC login\n\trequire.NoError(t, tu.ConfigureOIDCProvider(t, c, true))\n\tadminClient := tu.AuthenticateClient(t, c, auth.RootUser)\n\tissuerHost := c.GetAddress().Host\n\tissuerPort := strconv.Itoa(int(env.ServiceEnv.Config().PeerPort + 8))\n\tredirectPort := strconv.Itoa(int(env.ServiceEnv.Config().PeerPort + 7))\n\t// Set a configuration\n\tconf := &auth.OIDCConfig{\n\t\tIssuer: \"http://\" + issuerHost + \":\" + issuerPort + \"/dex\",\n\t\tClientId: \"configtest\",\n\t\tClientSecret: \"newsecret\",\n\t\tRedirectUri: \"http://\" + issuerHost + \":\" + redirectPort + \"/authorization-code/test\",\n\t\tLocalhostIssuer: false,\n\t}\n\t_, err := adminClient.SetConfiguration(adminClient.Ctx(),\n\t\t&auth.SetConfigurationRequest{Configuration: conf})\n\trequire.NoError(t, err)\n\n\t// Read the configuration that was just written\n\tconfigResp, err := adminClient.GetConfiguration(adminClient.Ctx(),\n\t\t&auth.GetConfigurationRequest{})\n\trequire.NoError(t, err)\n\trequire.Equal(t, true, proto.Equal(conf, configResp.Configuration))\n}",
"func TestBaseConfig() BaseConfig {\n\tcfg := DefaultBaseConfig()\n\tcfg.chainID = \"tendermint_test\"\n\tcfg.ProxyApp = \"kvstore\"\n\tcfg.FastSyncMode = false\n\tcfg.DBBackend = \"memdb\"\n\treturn cfg\n}",
"func (m *MockTx) Config() (map[string]string, error) {\n\tret := m.ctrl.Call(m, \"Config\")\n\tret0, _ := ret[0].(map[string]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
IdentityConfig indicates an expected call of IdentityConfig
|
func (mr *MockProvidersMockRecorder) IdentityConfig() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IdentityConfig", reflect.TypeOf((*MockProviders)(nil).IdentityConfig))
}
|
[
"func (mr *MockClientMockRecorder) IdentityConfig() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IdentityConfig\", reflect.TypeOf((*MockClient)(nil).IdentityConfig))\n}",
"func (m *MockProviders) IdentityConfig() msp.IdentityConfig {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IdentityConfig\")\n\tret0, _ := ret[0].(msp.IdentityConfig)\n\treturn ret0\n}",
"func identityConfig(nbits int) (native.Identity, error) {\n\t// TODO guard higher up\n\tident := native.Identity{}\n\tif nbits < 1024 {\n\t\treturn ident, errors.New(\"bitsize less than 1024 is considered unsafe\")\n\t}\n\n\tlog.Infof(\"generating %v-bit RSA keypair...\", nbits)\n\tsk, pk, err := ci.GenerateKeyPair(ci.RSA, nbits)\n\tif err != nil {\n\t\treturn ident, err\n\t}\n\n\t// currently storing key unencrypted. in the future we need to encrypt it.\n\t// TODO(security)\n\tskbytes, err := sk.Bytes()\n\tif err != nil {\n\t\treturn ident, err\n\t}\n\tident.PrivKey = base64.StdEncoding.EncodeToString(skbytes)\n\n\tid, err := peer.IDFromPublicKey(pk)\n\tif err != nil {\n\t\treturn ident, err\n\t}\n\tident.PeerID = id.Pretty()\n\tlog.Infof(\"new peer identity: %s\\n\", ident.PeerID)\n\treturn ident, nil\n}",
"func (m *MockClient) IdentityConfig() msp.IdentityConfig {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IdentityConfig\")\n\tret0, _ := ret[0].(msp.IdentityConfig)\n\treturn ret0\n}",
"func (c *Provider) IdentityConfig() msp.IdentityConfig {\n\treturn c.identityConfig\n}",
"func IdentityConfig(out io.Writer, nbits int, keyType string, importKey string, mnemonic string) (Identity, error) {\n\t// TODO guard higher up\n\tident := Identity{}\n\n\tif nbits < ci.MinRsaKeyBits {\n\t\treturn ident, ci.ErrRsaKeyTooSmall\n\t}\n\n\tvar sk ci.PrivKey\n\tvar pk ci.PubKey\n\tvar err error\n\tif importKey == \"\" {\n\t\tvar key int\n\n\t\tswitch keyType {\n\t\tcase \"RSA\":\n\t\t\tkey = ci.RSA\n\t\tcase \"Ed25519\":\n\t\t\tkey = ci.Ed25519\n\t\tcase \"Secp256k1\":\n\t\t\tkey = ci.Secp256k1\n\t\tcase \"ECDSA\":\n\t\t\tkey = ci.ECDSA\n\t\tdefault:\n\t\t\tkey = ci.Secp256k1\n\t\t\tkeyType = \"Secp256k1\"\n\t\t}\n\n\t\tfmt.Fprintf(out, \"generating %v-bit %s keypair...\", nbits, keyType)\n\t\tsk, pk, err = ci.GenerateKeyPair(key, nbits)\n\t} else {\n\t\tfmt.Fprintf(out, \"generating btfs node keypair with TRON key...\")\n\t\tskBytes, err := hex.DecodeString(importKey)\n\t\tif err != nil {\n\t\t\treturn ident, errors.New(\"cannot decode importKey from a string to byte array\")\n\t\t}\n\t\tsk, err = ci.UnmarshalSecp256k1PrivateKey(skBytes)\n\t\tif err != nil {\n\t\t\treturn ident, err\n\t\t}\n\t\tpk = sk.GetPublic()\n\t}\n\n\tif err != nil {\n\t\treturn ident, err\n\t}\n\tfmt.Fprintf(out, \"done\\n\")\n\n\t// currently storing key unencrypted. in the future we need to encrypt it.\n\t// TODO(security)\n\tskbytes, err := sk.Bytes()\n\tif err != nil {\n\t\treturn ident, err\n\t}\n\tident.PrivKey = base64.StdEncoding.EncodeToString(skbytes)\n\tident.Mnemonic = mnemonic\n\n\tid, err := peer.IDFromPublicKey(pk)\n\tif err != nil {\n\t\treturn ident, err\n\t}\n\tident.PeerID = id.Pretty()\n\tfmt.Fprintf(out, \"peer identity: %s\\n\", ident.PeerID)\n\treturn ident, nil\n}",
"func identityConfig() (string, string, error) {\n\tsk, pk, err := ic.GenerateKeyPair(ic.RSA, 2048)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\t// currently storing key unencrypted. in the future we need to encrypt it.\n\t// TODO(security)\n\tskbytes, err := sk.Bytes()\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tprivKey := base64.StdEncoding.EncodeToString(skbytes)\n\n\tid, err := peer.IDFromPublicKey(pk)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tpeerID := id.Pretty()\n\treturn privKey, peerID, nil\n}",
"func (ref ForbiddenImageReference) PolicyConfigurationIdentity() string {\n\tpanic(\"unexpected call to a mock function\")\n}",
"func (mr *MockAPIMockRecorder) Config(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Config\", reflect.TypeOf((*MockAPI)(nil).Config), arg0)\n}",
"func (o *ConfigDisco) HasIdentityURL() bool {\n\tif o != nil && o.IdentityURL != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}",
"func (mr *MockClientMockRecorder) Config() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Config\", reflect.TypeOf((*MockClient)(nil).Config))\n}",
"func (mr *MockChoriaProviderMockRecorder) Identity() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Identity\", reflect.TypeOf((*MockChoriaProvider)(nil).Identity))\n}",
"func (ident *Identity) ConfigKey() string {\n\treturn configKey\n}",
"func (mr *MockFrameworkMockRecorder) Identity() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Identity\", reflect.TypeOf((*MockFramework)(nil).Identity))\n}",
"func TestSetGetNilConfig(t *testing.T) {\n\tt.Parallel()\n\tctx := pctx.TestContext(t)\n\tenv := realenv.NewRealEnvWithIdentity(ctx, t, dockertestenv.NewTestDBConfig(t))\n\tpeerPort := strconv.Itoa(int(env.ServiceEnv.Config().PeerPort))\n\tc := env.PachClient\n\ttu.ActivateAuthClient(t, c, peerPort)\n\trequire.NoError(t, tu.ConfigureOIDCProvider(t, c, true))\n\tissuerHost := c.GetAddress().Host\n\tissuerPort := strconv.Itoa(int(env.ServiceEnv.Config().PeerPort + 8))\n\tredirectPort := strconv.Itoa(int(env.ServiceEnv.Config().PeerPort + 7))\n\n\tadminClient := tu.AuthenticateClient(t, c, auth.RootUser)\n\n\t// Set a configuration\n\tconf := &auth.OIDCConfig{\n\t\tIssuer: \"http://\" + issuerHost + \":\" + issuerPort + \"/dex\",\n\t\tClientId: \"configtest\",\n\t\tClientSecret: \"newsecret\",\n\t\tRedirectUri: \"http://\" + issuerHost + \":\" + redirectPort + \"/authorization-code/test\",\n\t\tLocalhostIssuer: false,\n\t}\n\t_, err := adminClient.SetConfiguration(adminClient.Ctx(),\n\t\t&auth.SetConfigurationRequest{Configuration: conf})\n\trequire.NoError(t, err)\n\t// config cfg was written\n\tconfigResp, err := adminClient.GetConfiguration(adminClient.Ctx(),\n\t\t&auth.GetConfigurationRequest{})\n\trequire.NoError(t, err)\n\trequire.Equal(t, true, proto.Equal(conf, configResp.Configuration))\n\n\t// Now, set a nil config & make sure that's retrieved correctly\n\t_, err = adminClient.SetConfiguration(adminClient.Ctx(),\n\t\t&auth.SetConfigurationRequest{Configuration: nil})\n\trequire.NoError(t, err)\n\n\t// Read the configuration that was just written\n\tconfigResp, err = adminClient.GetConfiguration(adminClient.Ctx(),\n\t\t&auth.GetConfigurationRequest{})\n\trequire.NoError(t, err)\n\tconf = proto.Clone(&authserver.DefaultOIDCConfig).(*auth.OIDCConfig)\n\trequire.Equal(t, true, proto.Equal(conf, configResp.Configuration))\n}",
"func (mr *MockProvidersMockRecorder) EndpointConfig() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"EndpointConfig\", reflect.TypeOf((*MockProviders)(nil).EndpointConfig))\n}",
"func (config *IDConfig) ExampleConfig() string {\n\treturn `[id.config]\n#####################\n## Required Fields ##\n#####################\n\n# Index of the snapshot to be analyzed.\nSnap = 100\n\n# List of IDs to analyze.\nIDs = 10, 11, 12, 13, 14\n\n#####################\n## Optional Fields ##\n#####################\n\n# IDType indicates what the input IDs correspond to. It can be set to the\n# following modes:\n# halo-id - The numeric IDs given in the halo catalog.\n# m200m - The rank of the halos when sorted by M200m.\n#\n# Defaults to m200m if not set.\n# IDType = m200m\n\n# An alternative way of specifying IDs is to select start and end (inclusive)\n# ID values. If the IDs variable is not set, both of these values must be set.\n#\n# IDStart = 10\n# IDEnd = 15\n\n# Yet another alternative way to select IDs is to specify the starting and\n# ending mass range (units are M_sun/h). IDType, IDs, IDStart, and IDEnd will\n# be ignored if these variables are set.\n#\n# M200mMin = 1e12\n# M200mMax = 1e13\n\n# ExclusionStrategy determines how to exclude IDs from the given set. This is\n# useful because splashback shells are not particularly meaningful for\n# subhalos. It can be set to the following modes:\n# none - No halos are removed\n# subhalo - Halos flagged as subhalos in the catalog are removed (not yet\n# implemented)\n# overlap - Halos which have an R200m shell that overlaps with a larger halo's\n# R200m shell are removed\n# neighbor - Instead of removing halos, all neighboring halos within\n# ExclusionRadiusMult*R200m are added to the list.\n#\n# ExclusionStrategy defaults to overlap if not set.\n#\n# ExclusionStrategy = overlap\n\n# ExclusionRadiusMult is a multiplier of R200m applied for the sake of\n# determining exclusions. ExclusionRadiusMult defaults to 0.8 if not set.\n#\n# ExclusionRadiusMult = 0.8\n\n# Mult is the number of times a given ID should be repeated. This is most useful\n# if you want to estimate the scatter in shell measurements for halos with a\n# given set of shell parameters.\n#\n# Mult defaults to 1 if not set.\n#\n# Mult = 1`\n}",
"func (mr *MockUserAuthenticationMockRecorder) TestConfig() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"TestConfig\", reflect.TypeOf((*MockUserAuthentication)(nil).TestConfig))\n}",
"func (mr *MockMachineMockRecorder) Identity() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Identity\", reflect.TypeOf((*MockMachine)(nil).Identity))\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
IdentityManager mocks base method
|
func (m *MockProviders) IdentityManager(arg0 string) (msp.IdentityManager, bool) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "IdentityManager", arg0)
ret0, _ := ret[0].(msp.IdentityManager)
ret1, _ := ret[1].(bool)
return ret0, ret1
}
|
[
"func (m *MockClient) IdentityManager(arg0 string) (msp.IdentityManager, bool) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IdentityManager\", arg0)\n\tret0, _ := ret[0].(msp.IdentityManager)\n\tret1, _ := ret[1].(bool)\n\treturn ret0, ret1\n}",
"func (m *MockFramework) Identity() string {\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func MockIdentityContext() (sdk.Context, *keeper.Keeper) {\n\t// Codec\n\tinterfaceRegistry := codectypes.NewInterfaceRegistry()\n\tcdc := codec.NewProtoCodec(interfaceRegistry)\n\n\t// Store keys\n\tkeys := sdk.NewKVStoreKeys(types.StoreKey)\n\n\t// Keeper\n\tidentityKeeper := keeper.NewKeeper(cdc, keys[types.StoreKey], keys[types.MemStoreKey])\n\n\t// Create multiStore in memory\n\tdb := dbm.NewMemDB()\n\tcms := store.NewCommitMultiStore(db)\n\n\t// Mount stores\n\tcms.MountStoreWithDB(keys[types.StoreKey], sdk.StoreTypeIAVL, db)\n\tcms.LoadLatestVersion()\n\n\t// Create context\n\tctx := sdk.NewContext(cms, tmproto.Header{}, false, log.NewNopLogger())\n\n\treturn ctx, identityKeeper\n}",
"func (m *MockChoriaProvider) Identity() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func (m *MockSecurityProvider) Identity() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func (m *MockMachine) Identity() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func NewIdentityService(t mockConstructorTestingTNewIdentityService) *IdentityService {\n\tmock := &IdentityService{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}",
"func (m *MockStorage) FindIdentityVerification(arg0 context.Context, arg1 string) (bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"FindIdentityVerification\", arg0, arg1)\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (m *MockStorage) ConsumeIdentityVerification(arg0 context.Context, arg1 string, arg2 model.NullIP) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ConsumeIdentityVerification\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func (u *MockUser) Identity() ([]byte, error) {\n\treturn []byte(\"test\"), nil\n}",
"func TestGetIdentity(t *testing.T) {\n\ttests := []struct {\n\t\tdescription string\n\t\tinARN string\n\t\toutIdentity Identity\n\t\toutName string\n\t\toutAccountID string\n\t\toutPartition string\n\t\toutType string\n\t}{\n\t\t{\n\t\t\tdescription: \"role identity\",\n\t\t\tinARN: \"arn:aws:iam::123456789012:role/custom/path/EC2ReadOnly\",\n\t\t\toutIdentity: Role{},\n\t\t\toutName: \"EC2ReadOnly\",\n\t\t\toutAccountID: \"123456789012\",\n\t\t\toutPartition: \"aws\",\n\t\t\toutType: \"role\",\n\t\t},\n\t\t{\n\t\t\tdescription: \"assumed role identity\",\n\t\t\tinARN: \"arn:aws:sts::123456789012:assumed-role/DatabaseAccess/i-1234567890\",\n\t\t\toutIdentity: Role{},\n\t\t\toutName: \"DatabaseAccess\",\n\t\t\toutAccountID: \"123456789012\",\n\t\t\toutPartition: \"aws\",\n\t\t\toutType: \"assumed-role\",\n\t\t},\n\t\t{\n\t\t\tdescription: \"user identity\",\n\t\t\tinARN: \"arn:aws-us-gov:iam::123456789012:user/custom/path/alice\",\n\t\t\toutIdentity: User{},\n\t\t\toutName: \"alice\",\n\t\t\toutAccountID: \"123456789012\",\n\t\t\toutPartition: \"aws-us-gov\",\n\t\t\toutType: \"user\",\n\t\t},\n\t\t{\n\t\t\tdescription: \"unsupported identity\",\n\t\t\tinARN: \"arn:aws:iam::123456789012:group/readers\",\n\t\t\toutIdentity: Unknown{},\n\t\t\toutName: \"readers\",\n\t\t\toutAccountID: \"123456789012\",\n\t\t\toutPartition: \"aws\",\n\t\t\toutType: \"group\",\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tt.Run(test.description, func(t *testing.T) {\n\t\t\tidentity, err := GetIdentityWithClient(context.Background(), &stsMock{arn: test.inARN})\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.IsType(t, test.outIdentity, identity)\n\t\t\trequire.Equal(t, test.outName, identity.GetName())\n\t\t\trequire.Equal(t, test.outAccountID, identity.GetAccountID())\n\t\t\trequire.Equal(t, test.outPartition, identity.GetPartition())\n\t\t\trequire.Equal(t, test.outType, identity.GetType())\n\t\t})\n\t}\n}",
"func (p *MockProvisionerClient) Identity() client.IdentityInterface {\n\treturn &MockIdentityClient{}\n}",
"func NewIdentityProviderBase()(*IdentityProviderBase) {\n m := &IdentityProviderBase{\n Entity: *NewEntity(),\n }\n return m\n}",
"func (p *identityManagerProvider) IdentityManager(orgName string) (msp.IdentityManager, bool) {\n\treturn p.identityManager, true\n}",
"func (m *MockProviders) IdentityConfig() msp.IdentityConfig {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IdentityConfig\")\n\tret0, _ := ret[0].(msp.IdentityConfig)\n\treturn ret0\n}",
"func (c *Provider) IdentityManager(orgName string) (msp.IdentityManager, bool) {\n\treturn c.idMgmtProvider.IdentityManager(orgName)\n}",
"func createKeycloakInterfaceMock() (keycloakCommon.KeycloakInterface, *mockClientContext) {\n\tcontext := mockClientContext{\n\t\tGroups: []*keycloakCommon.Group{},\n\t\tDefaultGroups: []*keycloakCommon.Group{},\n\t\tClientRoles: map[string][]*keycloak.KeycloakUserRole{},\n\t\tRealmRoles: map[string][]*keycloak.KeycloakUserRole{},\n\t\tAuthenticationFlowsExecutions: map[string][]*keycloak.AuthenticationExecutionInfo{\n\t\t\tfirstBrokerLoginFlowAlias: []*keycloak.AuthenticationExecutionInfo{\n\t\t\t\t&keycloak.AuthenticationExecutionInfo{\n\t\t\t\t\tRequirement: \"REQUIRED\",\n\t\t\t\t\tAlias: reviewProfileExecutionAlias,\n\t\t\t\t},\n\t\t\t\t// dummy ones\n\t\t\t\t&keycloak.AuthenticationExecutionInfo{\n\t\t\t\t\tRequirement: \"REQUIRED\",\n\t\t\t\t\tAlias: \"dummy execution\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tavailableGroupClientRoles := []*keycloak.KeycloakUserRole{\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"create-client\",\n\t\t\tName: \"create-client\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"manage-authorization\",\n\t\t\tName: \"manage-authorization\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"manage-clients\",\n\t\t\tName: \"manage-clients\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"manage-events\",\n\t\t\tName: \"manage-events\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"manage-identity-providers\",\n\t\t\tName: \"manage-identity-providers\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"manage-realm\",\n\t\t\tName: \"manage-realm\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"manage-users\",\n\t\t\tName: \"manage-users\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"query-clients\",\n\t\t\tName: \"query-clients\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"query-groups\",\n\t\t\tName: \"query-groups\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"query-realms\",\n\t\t\tName: \"query-realms\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"query-users\",\n\t\t\tName: \"query-users\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"view-authorization\",\n\t\t\tName: \"view-authorization\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"view-clients\",\n\t\t\tName: \"view-clients\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"view-events\",\n\t\t\tName: \"view-events\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"view-identity-providers\",\n\t\t\tName: \"view-identity-providers\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"view-realm\",\n\t\t\tName: \"view-realm\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"view-users\",\n\t\t\tName: \"view-users\",\n\t\t},\n\t}\n\n\tavailableGroupRealmRoles := []*keycloak.KeycloakUserRole{\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"mock-role-3\",\n\t\t\tName: \"mock-role-3\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"create-realm\",\n\t\t\tName: \"create-realm\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"mock-role-4\",\n\t\t\tName: \"mock-role-4\",\n\t\t},\n\t}\n\n\tlistRealmsFunc := func() ([]*keycloak.KeycloakAPIRealm, error) {\n\t\treturn []*keycloak.KeycloakAPIRealm{\n\t\t\t&keycloak.KeycloakAPIRealm{\n\t\t\t\tRealm: \"master\",\n\t\t\t},\n\t\t\t&keycloak.KeycloakAPIRealm{\n\t\t\t\tRealm: \"test\",\n\t\t\t},\n\t\t}, nil\n\t}\n\n\tfindGroupByNameFunc := func(groupName string, realmName string) (*keycloakCommon.Group, error) {\n\t\tfor _, group := range context.Groups {\n\t\t\tif group.Name == groupName {\n\t\t\t\treturn group, nil\n\t\t\t}\n\t\t}\n\n\t\treturn nil, nil\n\t}\n\n\tcreateGroupFunc := func(groupName string, realmName string) (string, error) {\n\t\tnextID := fmt.Sprintf(\"group-%d\", len(context.Groups))\n\n\t\tnewGroup := &keycloakCommon.Group{\n\t\t\tID: string(nextID),\n\t\t\tName: groupName,\n\t\t}\n\n\t\tcontext.Groups = append(context.Groups, newGroup)\n\n\t\tcontext.ClientRoles[nextID] = []*keycloak.KeycloakUserRole{}\n\t\tcontext.RealmRoles[nextID] = []*keycloak.KeycloakUserRole{}\n\n\t\treturn nextID, nil\n\t}\n\n\tsetGroupChildFunc := func(groupID, realmName string, childGroup *keycloakCommon.Group) error {\n\t\tvar childGroupToAppend *keycloakCommon.Group\n\t\tfor _, group := range context.Groups {\n\t\t\tif group.ID == childGroup.ID {\n\t\t\t\tchildGroupToAppend = group\n\t\t\t}\n\t\t}\n\n\t\tif childGroupToAppend == nil {\n\t\t\tchildGroupToAppend = childGroup\n\t\t}\n\n\t\tfound := false\n\t\tfor _, group := range context.Groups {\n\t\t\tif group.ID == groupID {\n\t\t\t\tgroup.SubGroups = append(group.SubGroups, childGroupToAppend)\n\t\t\t\tfound = true\n\t\t\t}\n\t\t}\n\n\t\tif !found {\n\t\t\treturn fmt.Errorf(\"Group %s not found\", groupID)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tlistUsersInGroupFunc := func(realmName, groupID string) ([]*keycloak.KeycloakAPIUser, error) {\n\t\treturn []*keycloak.KeycloakAPIUser{}, nil\n\t}\n\n\tmakeGroupDefaultFunc := func(groupID string, realmName string) error {\n\t\tvar group *keycloakCommon.Group\n\n\t\tfor _, existingGroup := range context.Groups {\n\t\t\tif existingGroup.ID == groupID {\n\t\t\t\tgroup = existingGroup\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif group == nil {\n\t\t\treturn fmt.Errorf(\"Referenced group not found\")\n\t\t}\n\n\t\tcontext.DefaultGroups = append(context.DefaultGroups, group)\n\t\treturn nil\n\t}\n\n\tlistDefaultGroupsFunc := func(realmName string) ([]*keycloakCommon.Group, error) {\n\t\treturn context.DefaultGroups, nil\n\t}\n\n\tcreateGroupClientRoleFunc := func(role *keycloak.KeycloakUserRole, realmName, clientID, groupID string) (string, error) {\n\t\tgroupClientRoles, ok := context.ClientRoles[groupID]\n\n\t\tif !ok {\n\t\t\treturn \"\", fmt.Errorf(\"Referenced group not found\")\n\t\t}\n\n\t\tcontext.ClientRoles[groupID] = append(groupClientRoles, role)\n\t\treturn \"dummy-group-client-role-id\", nil\n\t}\n\n\tlistGroupClientRolesFunc := func(realmName, clientID, groupID string) ([]*keycloak.KeycloakUserRole, error) {\n\t\tgroupRoles, ok := context.ClientRoles[groupID]\n\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"Referenced group not found\")\n\t\t}\n\n\t\treturn groupRoles, nil\n\t}\n\n\tlistAvailableGroupClientRolesFunc := func(realmName, clientID, groupID string) ([]*keycloak.KeycloakUserRole, error) {\n\t\t_, ok := context.ClientRoles[groupID]\n\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"Referenced group not found\")\n\t\t}\n\n\t\treturn availableGroupClientRoles, nil\n\t}\n\n\tfindGroupClientRoleFunc := func(realmName, clientID, groupID string, predicate func(*keycloak.KeycloakUserRole) bool) (*keycloak.KeycloakUserRole, error) {\n\t\tall, err := listGroupClientRolesFunc(realmName, clientID, groupID)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, role := range all {\n\t\t\tif predicate(role) {\n\t\t\t\treturn role, nil\n\t\t\t}\n\t\t}\n\n\t\treturn nil, nil\n\t}\n\n\tfindAvailableGroupClientRoleFunc := func(realmName, clientID, groupID string, predicate func(*keycloak.KeycloakUserRole) bool) (*keycloak.KeycloakUserRole, error) {\n\t\tall, err := listAvailableGroupClientRolesFunc(realmName, clientID, groupID)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, role := range all {\n\t\t\tif predicate(role) {\n\t\t\t\treturn role, nil\n\t\t\t}\n\t\t}\n\n\t\treturn nil, nil\n\t}\n\n\tlistGroupRealmRolesFunc := func(realmName, groupID string) ([]*keycloak.KeycloakUserRole, error) {\n\t\tgroupRoles, ok := context.RealmRoles[groupID]\n\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"Referenced group not found\")\n\t\t}\n\n\t\treturn groupRoles, nil\n\t}\n\n\tlistAvailableGroupRealmRolesFunc := func(realmName, groupID string) ([]*keycloak.KeycloakUserRole, error) {\n\t\t_, ok := context.RealmRoles[groupID]\n\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"Referenced group not found\")\n\t\t}\n\n\t\treturn availableGroupRealmRoles, nil\n\t}\n\n\tcreateGroupRealmRoleFunc := func(role *keycloak.KeycloakUserRole, realmName, groupID string) (string, error) {\n\t\tgroupRealmRoles, ok := context.RealmRoles[groupID]\n\n\t\tif !ok {\n\t\t\treturn \"\", fmt.Errorf(\"Referenced group not found\")\n\t\t}\n\n\t\tcontext.RealmRoles[groupID] = append(groupRealmRoles, role)\n\t\treturn \"dummy-group-realm-role-id\", nil\n\t}\n\n\tlistClientsFunc := func(realmName string) ([]*keycloak.KeycloakAPIClient, error) {\n\t\treturn []*keycloak.KeycloakAPIClient{\n\t\t\t&keycloak.KeycloakAPIClient{\n\t\t\t\tClientID: \"test-realm\",\n\t\t\t\tID: \"test-realm\",\n\t\t\t\tName: \"test-realm\",\n\t\t\t},\n\t\t\t&keycloak.KeycloakAPIClient{\n\t\t\t\tClientID: \"master-realm\",\n\t\t\t\tID: \"master-realm\",\n\t\t\t\tName: \"master-realm\",\n\t\t\t},\n\t\t}, nil\n\t}\n\n\tlistAuthenticationExecutionsForFlowFunc := func(flowAlias, realmName string) ([]*keycloak.AuthenticationExecutionInfo, error) {\n\t\texecutions, ok := context.AuthenticationFlowsExecutions[flowAlias]\n\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"Authentication flow not found\")\n\t\t}\n\n\t\treturn executions, nil\n\t}\n\n\tfindAuthenticationExecutionForFlowFunc := func(flowAlias, realmName string, predicate func(*keycloak.AuthenticationExecutionInfo) bool) (*keycloak.AuthenticationExecutionInfo, error) {\n\t\texecutions, err := listAuthenticationExecutionsForFlowFunc(flowAlias, realmName)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, execution := range executions {\n\t\t\tif predicate(execution) {\n\t\t\t\treturn execution, nil\n\t\t\t}\n\t\t}\n\n\t\treturn nil, nil\n\t}\n\n\tupdateAuthenticationExecutionForFlowFunc := func(flowAlias, realmName string, execution *keycloak.AuthenticationExecutionInfo) error {\n\t\texecutions, ok := context.AuthenticationFlowsExecutions[flowAlias]\n\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Authentication flow %s not found\", flowAlias)\n\t\t}\n\n\t\tfor i, currentExecution := range executions {\n\t\t\tif currentExecution.Alias != execution.Alias {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tcontext.AuthenticationFlowsExecutions[flowAlias][i] = execution\n\t\t\tbreak\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tlistOfActivesUsersPerRealmFunc := func(realmName, dateFrom string, max int) ([]keycloakCommon.Users, error) {\n\t\tusers := []keycloakCommon.Users{\n\t\t\t{\n\t\t\t\tUserID: \"1\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tUserID: \"2\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tUserID: \"3\",\n\t\t\t},\n\t\t}\n\n\t\treturn users, nil\n\t}\n\n\treturn &keycloakCommon.KeycloakInterfaceMock{\n\t\tListRealmsFunc: listRealmsFunc,\n\t\tFindGroupByNameFunc: findGroupByNameFunc,\n\t\tCreateGroupFunc: createGroupFunc,\n\t\tSetGroupChildFunc: setGroupChildFunc,\n\t\tListUsersInGroupFunc: listUsersInGroupFunc,\n\t\tMakeGroupDefaultFunc: makeGroupDefaultFunc,\n\t\tListDefaultGroupsFunc: listDefaultGroupsFunc,\n\t\tCreateGroupClientRoleFunc: createGroupClientRoleFunc,\n\t\tListGroupClientRolesFunc: listGroupClientRolesFunc,\n\t\tListAvailableGroupClientRolesFunc: listAvailableGroupClientRolesFunc,\n\t\tFindGroupClientRoleFunc: findGroupClientRoleFunc,\n\t\tFindAvailableGroupClientRoleFunc: findAvailableGroupClientRoleFunc,\n\t\tListGroupRealmRolesFunc: listGroupRealmRolesFunc,\n\t\tListAvailableGroupRealmRolesFunc: listAvailableGroupRealmRolesFunc,\n\t\tCreateGroupRealmRoleFunc: createGroupRealmRoleFunc,\n\t\tListAuthenticationExecutionsForFlowFunc: listAuthenticationExecutionsForFlowFunc,\n\t\tFindAuthenticationExecutionForFlowFunc: findAuthenticationExecutionForFlowFunc,\n\t\tUpdateAuthenticationExecutionForFlowFunc: updateAuthenticationExecutionForFlowFunc,\n\t\tListClientsFunc: listClientsFunc,\n\t\tListOfActivesUsersPerRealmFunc: listOfActivesUsersPerRealmFunc,\n\t}, &context\n}",
"func mockGetUserAccessToken() {\r\n\thttpmock.RegisterResponder(http.MethodPost, fmt.Sprintf(\"%s%s\", testHost, getAccessTokenURI),\r\n\t\thttpmock.NewStringResponder(\r\n\t\t\thttp.StatusOK, `{\"code\": 0,\"msg\": \"\",\r\n \"data\": {\r\n \"access_token\": \"`+testUserAccessToken+`\",\r\n \"expires_in\": `+fmt.Sprintf(\"%d\", testExpiresIn)+`,\r\n \"refresh_token\": \"`+testUserRefreshToken+`\",\r\n \"scope\": \"`+testUserScopes+`\",\r\n \"token_type\": \"`+testTokenType+`\"}}`,\r\n\t\t),\r\n\t)\r\n}",
"func TestEmployeeManagerMapGetByID(t *testing.T) {\n\tdb, mock, err := sqlmock.New()\n\tif err != nil {\n\t\tt.Fatalf(\"an error '%s' was not expected when opening a stub database connection\", err)\n\t}\n\tdefer db.Close()\n\n\trows := sqlmock.NewRows([]string{\"employee_name\", \"manager_name\"}).AddRow(\"Nick\", \"Sophie\").AddRow(\"Sophie\", \"Jonas\")\n\tmock.ExpectExec(constants.EmployeeManagerMappingDeleteQuery).WillReturnResult(sqlmock.NewResult(0, 0))\n\tmock.ExpectPrepare(regexp.QuoteMeta(constants.EmployeeManagerMappingInsertQuery)).ExpectExec().WillReturnResult(sqlmock.NewResult(0, 0))\n\tmock.ExpectQuery(constants.EmployeeManagerMappingSelectQuery).WillReturnRows(rows)\n\n\templyManagerMap := NewEmployeeManagerMapHandler(db)\n\n\tw := httptest.NewRecorder()\n\tvar jsonStr = []byte(`{\"Peter\":\"Nick\", \"Barbara\":\"Nick\", \"Nick\":\"Sophie\", \"Sophie\":\"Jonas\"}`)\n\tr := httptest.NewRequest(\"POST\", \"http://localhost:9090/api/v1/emplymgrmap\", bytes.NewBuffer(jsonStr))\n\tr = r.WithContext(context.Background())\n\templyManagerMap.Create(w, r)\n\n\tr = httptest.NewRequest(\"GET\", \"http://localhost:9090/api/v1/emplymgrmap/Nick?supervisor=true&name=Nick\", nil)\n\trctx := chi.NewRouteContext()\n\trctx.URLParams.Add(\"name\", \"Nick\")\n\tr = r.WithContext(context.WithValue(r.Context(), chi.RouteCtxKey, rctx))\n\tw = httptest.NewRecorder()\n\templyManagerMap.GetByID(w, r)\n\texpectedResponse := `{\"supervisor\":\"Sophie\",\"supervisor_of_supervisor\":\"Jonas\"}`\n\tassert.Equal(t, gohttp.StatusOK, w.Code)\n\tassert.Equal(t, expectedResponse, w.Body.String())\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
IdentityManager indicates an expected call of IdentityManager
|
func (mr *MockProvidersMockRecorder) IdentityManager(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IdentityManager", reflect.TypeOf((*MockProviders)(nil).IdentityManager), arg0)
}
|
[
"func (mr *MockClientMockRecorder) IdentityManager(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IdentityManager\", reflect.TypeOf((*MockClient)(nil).IdentityManager), arg0)\n}",
"func (c *Provider) IdentityManager(orgName string) (msp.IdentityManager, bool) {\n\treturn c.idMgmtProvider.IdentityManager(orgName)\n}",
"func (p *identityManagerProvider) IdentityManager(orgName string) (msp.IdentityManager, bool) {\n\treturn p.identityManager, true\n}",
"func (p *MSPProvider) IdentityManager(orgName string) (msp.IdentityManager, bool) {\n\tim, ok := p.identityManager[strings.ToLower(orgName)]\n\tif !ok {\n\t\treturn nil, false\n\t}\n\treturn im, true\n}",
"func (e AuthorizationFailedError) Identity() UserIdentityInfo { return e.identity }",
"func (e AuthorizationDeniedError) Identity() UserIdentityInfo { return e.identity }",
"func (mr *MockFrameworkMockRecorder) Identity() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Identity\", reflect.TypeOf((*MockFramework)(nil).Identity))\n}",
"func (mr *MockChoriaProviderMockRecorder) Identity() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Identity\", reflect.TypeOf((*MockChoriaProvider)(nil).Identity))\n}",
"func (mr *MockMachineMockRecorder) Identity() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Identity\", reflect.TypeOf((*MockMachine)(nil).Identity))\n}",
"func (mr *MockMachineMockRecorder) Identity() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Identity\", reflect.TypeOf((*MockMachine)(nil).Identity))\n}",
"func (m *MockProviders) IdentityManager(arg0 string) (msp.IdentityManager, bool) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IdentityManager\", arg0)\n\tret0, _ := ret[0].(msp.IdentityManager)\n\tret1, _ := ret[1].(bool)\n\treturn ret0, ret1\n}",
"func (m *MockClient) IdentityManager(arg0 string) (msp.IdentityManager, bool) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IdentityManager\", arg0)\n\tret0, _ := ret[0].(msp.IdentityManager)\n\tret1, _ := ret[1].(bool)\n\treturn ret0, ret1\n}",
"func (v *DemoVerifier) VerifyRequestIdentity(jsonToken *bijson.RawMessage) (bool, string, error) {\n\tvar p DemoVerifierParams\n\tif err := bijson.Unmarshal(*jsonToken, &p); err != nil {\n\t\treturn false, \"\", err\n\t}\n\n\tp.IDToken = v.CleanToken(p.IDToken)\n\n\tif p.IDToken != v.ExpectedKey {\n\t\treturn false, \"\", errors.New(\"invalid idtoken\")\n\t}\n\n\tv.Store[p.IDToken] = true\n\treturn true, p.Email, nil\n}",
"func (mr *MockClientMockRecorder) IdentityConfig() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IdentityConfig\", reflect.TypeOf((*MockClient)(nil).IdentityConfig))\n}",
"func (mr *MockProvidersMockRecorder) IdentityConfig() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IdentityConfig\", reflect.TypeOf((*MockProviders)(nil).IdentityConfig))\n}",
"func (mr *MockStorageMockRecorder) FindIdentityVerification(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"FindIdentityVerification\", reflect.TypeOf((*MockStorage)(nil).FindIdentityVerification), arg0, arg1)\n}",
"func TestGenerateIdentity(t *testing.T) {\n\tif _, err := GenerateIdentity(); err != nil {\n\t\tt.Fatalf(\"Failed to generate new identity: %v\", err)\n\t}\n}",
"func (mr *MockStorageMockRecorder) ConsumeIdentityVerification(arg0, arg1, arg2 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ConsumeIdentityVerification\", reflect.TypeOf((*MockStorage)(nil).ConsumeIdentityVerification), arg0, arg1, arg2)\n}",
"func (m *CommunicationsIdentitySet) SetAssertedIdentity(value Identityable)() {\n err := m.GetBackingStore().Set(\"assertedIdentity\", value)\n if err != nil {\n panic(err)\n }\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
InfraProvider mocks base method
|
func (m *MockProviders) InfraProvider() fab.InfraProvider {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "InfraProvider")
ret0, _ := ret[0].(fab.InfraProvider)
return ret0
}
|
[
"func (m *MockClient) InfraProvider() fab.InfraProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"InfraProvider\")\n\tret0, _ := ret[0].(fab.InfraProvider)\n\treturn ret0\n}",
"func newMockProvider() *mockProviderAsync {\n\tprovider := newSyncMockProvider()\n\t// By default notifier is set to a function which is a no-op. In the event we've implemented the PodNotifier interface,\n\t// it will be set, and then we'll call a real underlying implementation.\n\t// This makes it easier in the sense we don't need to wrap each method.\n\treturn &mockProviderAsync{provider}\n}",
"func (m *MockSecurityProvider) Provider() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Provider\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func (m *MockState) StartProvidingExtendedApi() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"StartProvidingExtendedApi\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func (m *MockStateModifier) StartProvidingExtendedApi() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"StartProvidingExtendedApi\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func (m *MockProcessProvider) BootstrapperProvider() BootstrapperProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"BootstrapperProvider\")\n\tret0, _ := ret[0].(BootstrapperProvider)\n\treturn ret0\n}",
"func (m *MockRegistry) OAuth2Provider() fosite.OAuth2Provider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"OAuth2Provider\")\n\tret0, _ := ret[0].(fosite.OAuth2Provider)\n\treturn ret0\n}",
"func (m *MockStateInfo) ProvidesExtendedApi() (bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ProvidesExtendedApi\")\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (m *MockHostEvent) GetInfraEnvId() strfmt.UUID {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetInfraEnvId\")\n\tret0, _ := ret[0].(strfmt.UUID)\n\treturn ret0\n}",
"func (m *MockState) ProvidesExtendedApi() (bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ProvidesExtendedApi\")\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (m *MockChoriaProvider) MainCollective() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"MainCollective\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func TestGetCloudProvider(t *testing.T) {\n\tfakeCredFile := \"fake-cred-file.json\"\n\tfakeKubeConfig := \"fake-kube-config\"\n\temptyKubeConfig := \"empty-kube-config\"\n\tfakeContent := `\napiVersion: v1\nclusters:\n- cluster:\n server: https://localhost:8080\n name: foo-cluster\ncontexts:\n- context:\n cluster: foo-cluster\n user: foo-user\n namespace: bar\n name: foo-context\ncurrent-context: foo-context\nkind: Config\nusers:\n- name: foo-user\n user:\n exec:\n apiVersion: client.authentication.k8s.io/v1alpha1\n args:\n - arg-1\n - arg-2\n command: foo-command\n`\n\n\terr := createTestFile(emptyKubeConfig)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tdefer func() {\n\t\tif err := os.Remove(emptyKubeConfig); err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}()\n\n\ttests := []struct {\n\t\tdesc string\n\t\tcreateFakeCredFile bool\n\t\tcreateFakeKubeConfig bool\n\t\tkubeconfig string\n\t\tnodeID string\n\t\tuserAgent string\n\t\tallowEmptyCloudConfig bool\n\t\texpectedErr error\n\t}{\n\t\t{\n\t\t\tdesc: \"out of cluster, no kubeconfig, no credential file\",\n\t\t\tkubeconfig: \"\",\n\t\t\tnodeID: \"\",\n\t\t\tallowEmptyCloudConfig: true,\n\t\t\texpectedErr: nil,\n\t\t},\n\t\t{\n\t\t\tdesc: \"[failure][disallowEmptyCloudConfig] out of cluster, no kubeconfig, no credential file\",\n\t\t\tkubeconfig: \"\",\n\t\t\tnodeID: \"\",\n\t\t\tallowEmptyCloudConfig: false,\n\t\t\texpectedErr: nil,\n\t\t},\n\t\t{\n\t\t\tdesc: \"[failure] out of cluster & in cluster, specify a non-exist kubeconfig, no credential file\",\n\t\t\tkubeconfig: \"/tmp/non-exist.json\",\n\t\t\tnodeID: \"\",\n\t\t\tallowEmptyCloudConfig: true,\n\t\t\texpectedErr: nil,\n\t\t},\n\t\t{\n\t\t\tdesc: \"[failure] out of cluster & in cluster, specify a empty kubeconfig, no credential file\",\n\t\t\tkubeconfig: emptyKubeConfig,\n\t\t\tnodeID: \"\",\n\t\t\tallowEmptyCloudConfig: true,\n\t\t\texpectedErr: fmt.Errorf(\"failed to get KubeClient: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable\"),\n\t\t},\n\t\t{\n\t\t\tdesc: \"[failure] out of cluster & in cluster, specify a fake kubeconfig, no credential file\",\n\t\t\tcreateFakeKubeConfig: true,\n\t\t\tkubeconfig: fakeKubeConfig,\n\t\t\tnodeID: \"\",\n\t\t\tallowEmptyCloudConfig: true,\n\t\t\texpectedErr: nil,\n\t\t},\n\t\t{\n\t\t\tdesc: \"[success] out of cluster & in cluster, no kubeconfig, a fake credential file\",\n\t\t\tcreateFakeCredFile: true,\n\t\t\tkubeconfig: \"\",\n\t\t\tnodeID: \"\",\n\t\t\tuserAgent: \"useragent\",\n\t\t\tallowEmptyCloudConfig: true,\n\t\t\texpectedErr: nil,\n\t\t},\n\t}\n\n\tfor _, test := range tests {\n\t\tif test.createFakeKubeConfig {\n\t\t\tif err := createTestFile(fakeKubeConfig); err != nil {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\t\t\tdefer func() {\n\t\t\t\tif err := os.Remove(fakeKubeConfig); err != nil {\n\t\t\t\t\tt.Error(err)\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\tif err := os.WriteFile(fakeKubeConfig, []byte(fakeContent), 0666); err != nil {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\t\t}\n\t\tif test.createFakeCredFile {\n\t\t\tif err := createTestFile(fakeCredFile); err != nil {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\t\t\tdefer func() {\n\t\t\t\tif err := os.Remove(fakeCredFile); err != nil {\n\t\t\t\t\tt.Error(err)\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\toriginalCredFile, ok := os.LookupEnv(DefaultAzureCredentialFileEnv)\n\t\t\tif ok {\n\t\t\t\tdefer os.Setenv(DefaultAzureCredentialFileEnv, originalCredFile)\n\t\t\t} else {\n\t\t\t\tdefer os.Unsetenv(DefaultAzureCredentialFileEnv)\n\t\t\t}\n\t\t\tos.Setenv(DefaultAzureCredentialFileEnv, fakeCredFile)\n\t\t}\n\t\tcloud, err := getCloudProvider(test.kubeconfig, test.nodeID, \"\", \"\", test.userAgent, test.allowEmptyCloudConfig, 25.0, 50)\n\t\tif !reflect.DeepEqual(err, test.expectedErr) && test.expectedErr != nil && !strings.Contains(err.Error(), test.expectedErr.Error()) {\n\t\t\tt.Errorf(\"desc: %s,\\n input: %q, GetCloudProvider err: %v, expectedErr: %v\", test.desc, test.kubeconfig, err, test.expectedErr)\n\t\t}\n\t\tif cloud == nil {\n\t\t\tt.Errorf(\"return value of getCloudProvider should not be nil even there is error\")\n\t\t} else {\n\t\t\tassert.Equal(t, cloud.Environment.StorageEndpointSuffix, storage.DefaultBaseURL)\n\t\t\tassert.Equal(t, cloud.UserAgent, test.userAgent)\n\t\t}\n\t}\n}",
"func ProviderTest(initial Initial, observer invoker.Observer, settings Settings) (Configurator, func(), error) {\n\tc, e := NewMockConfigurator(initial, observer, settings)\n\treturn c, func() {}, e\n}",
"func MockedProvider(t *testing.T, c *config.Config, callback string) (*config.Config, goth.Provider) {\n\tconst (\n\t\ttestClientKey = \"provider-test-client-key\"\n\t\ttestSecret = \"provider-test-secret\"\n\t\ttestCallback = \"http://auth.exmaple.com/test/callback\"\n\t)\n\tmp := newMockProvider(t, callback)\n\tp := provider.Name(mp.Name())\n\tprovider.AddExternal(p)\n\tt.Cleanup(func() {\n\t\tdelete(provider.External, p)\n\t})\n\tif callback == \"\" {\n\t\tcallback = testCallback\n\t}\n\tc.Authorization.Providers[p] = config.Provider{\n\t\tClientKey: testClientKey,\n\t\tSecret: testSecret,\n\t\tCallbackURL: callback,\n\t}\n\treturn c, mp\n}",
"func (m *MockInfraEnvEvent) GetInfraEnvId() strfmt.UUID {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetInfraEnvId\")\n\tret0, _ := ret[0].(strfmt.UUID)\n\treturn ret0\n}",
"func (c *Provider) InfraProvider() fab.InfraProvider {\n\treturn c.infraProvider\n}",
"func TestBaseImage(t *testing.T) {\n\tctx, err := controllerPrepare()\n\tif err != nil {\n\t\tt.Fatal(\"Fail in controller prepare: \", err)\n\t}\n\teveBaseRef := os.Getenv(\"EVE_BASE_REF\")\n\tif len(eveBaseRef) == 0 {\n\t\teveBaseRef = \"4.10.0\"\n\t}\n\tzArch := os.Getenv(\"ZARCH\")\n\tif len(eveBaseRef) == 0 {\n\t\tzArch = \"amd64\"\n\t}\n\tHV := os.Getenv(\"HV\")\n\tif HV == \"xen\" {\n\t\tHV = \"\"\n\t}\n\tvar baseImageTests = []struct {\n\t\tdataStoreID string\n\t\timageID string\n\t\tbaseID string\n\t\timageRelativePath string\n\t\timageFormat config.Format\n\t\teveBaseRef string\n\t\tzArch string\n\t\tHV string\n\t}{\n\t\t{eServerDataStoreID,\n\n\t\t\t\"1ab8761b-5f89-4e0b-b757-4b87a9fa93ec\",\n\n\t\t\t\"22b8761b-5f89-4e0b-b757-4b87a9fa93ec\",\n\n\t\t\t\"baseos.qcow2\",\n\t\t\tconfig.Format_QCOW2,\n\t\t\teveBaseRef,\n\t\t\tzArch,\n\t\t\tHV,\n\t\t},\n\t}\n\tfor _, tt := range baseImageTests {\n\t\tbaseOSVersion := fmt.Sprintf(\"%s-%s\", tt.eveBaseRef, tt.zArch)\n\t\tif tt.HV != \"\" {\n\t\t\tbaseOSVersion = fmt.Sprintf(\"%s-%s-%s\", tt.eveBaseRef, tt.zArch, tt.HV)\n\t\t}\n\t\tt.Run(baseOSVersion, func(t *testing.T) {\n\n\t\t\terr = prepareBaseImageLocal(ctx, tt.dataStoreID, tt.imageID, tt.baseID, tt.imageRelativePath, tt.imageFormat, baseOSVersion)\n\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(\"Fail in prepare base image from local file: \", err)\n\t\t\t}\n\t\t\tdeviceCtx, err := ctx.GetDeviceFirst()\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(\"Fail in get first device: \", err)\n\t\t\t}\n\t\t\tdeviceCtx.SetBaseOSConfig([]string{tt.baseID})\n\t\t\tdevUUID := deviceCtx.GetID()\n\t\t\terr = ctx.ConfigSync(deviceCtx)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(\"Fail in sync config with controller: \", err)\n\t\t\t}\n\t\t\tt.Run(\"Started\", func(t *testing.T) {\n\t\t\t\terr := ctx.InfoChecker(devUUID, map[string]string{\"devId\": devUUID.String(), \"shortVersion\": baseOSVersion}, einfo.ZInfoDevSW, 300)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatal(\"Fail in waiting for base image update init: \", err)\n\t\t\t\t}\n\t\t\t})\n\t\t\tt.Run(\"Downloaded\", func(t *testing.T) {\n\t\t\t\terr := ctx.InfoChecker(devUUID, map[string]string{\"devId\": devUUID.String(), \"shortVersion\": baseOSVersion, \"downloadProgress\": \"100\"}, einfo.ZInfoDevSW, 1500)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatal(\"Fail in waiting for base image download progress: \", err)\n\t\t\t\t}\n\t\t\t})\n\t\t\tt.Run(\"Logs\", func(t *testing.T) {\n\t\t\t\tif !checkLogs {\n\t\t\t\t\tt.Skip(\"no LOGS flag set - skipped\")\n\t\t\t\t}\n\t\t\t\terr = ctx.LogChecker(devUUID, map[string]string{\"devId\": devUUID.String(), \"eveVersion\": baseOSVersion}, 1200)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatal(\"Fail in waiting for base image logs: \", err)\n\t\t\t\t}\n\t\t\t})\n\t\t\ttimeout := time.Duration(1200)\n\n\t\t\tif !checkLogs {\n\t\t\t\ttimeout = 2400\n\t\t\t}\n\t\t\tt.Run(\"Active\", func(t *testing.T) {\n\t\t\t\terr = ctx.InfoChecker(devUUID, map[string]string{\"devId\": devUUID.String(), \"shortVersion\": baseOSVersion, \"status\": \"INSTALLED\", \"partitionState\": \"(inprogress|active)\"}, einfo.ZInfoDevSW, timeout)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatal(\"Fail in waiting for base image installed status: \", err)\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\t}\n\n}",
"func NewMockInfra(ctrl *gomock.Controller) *MockInfra {\n\tmock := &MockInfra{ctrl: ctrl}\n\tmock.recorder = &MockInfraMockRecorder{mock}\n\treturn mock\n}",
"func mockChildPackages() {\n\n\t// Fake an AWS credentials file so that the mfile package will nehave as if it is happy\n\tsetFakeCredentials()\n\n\t// Fake out the creds package into using an apparently credentials response from AWS\n\tcreds.SetGetSessionTokenFunc(func(awsService *sts.STS, input *sts.GetSessionTokenInput) (*sts.GetSessionTokenOutput, error) {\n\t\treturn getSessionTokenOutput, nil\n\t})\n\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
InfraProvider indicates an expected call of InfraProvider
|
func (mr *MockProvidersMockRecorder) InfraProvider() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InfraProvider", reflect.TypeOf((*MockProviders)(nil).InfraProvider))
}
|
[
"func (mr *MockClientMockRecorder) InfraProvider() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"InfraProvider\", reflect.TypeOf((*MockClient)(nil).InfraProvider))\n}",
"func (c *Provider) InfraProvider() fab.InfraProvider {\n\treturn c.infraProvider\n}",
"func (m *MockClient) InfraProvider() fab.InfraProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"InfraProvider\")\n\tret0, _ := ret[0].(fab.InfraProvider)\n\treturn ret0\n}",
"func (m *MockProviders) InfraProvider() fab.InfraProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"InfraProvider\")\n\tret0, _ := ret[0].(fab.InfraProvider)\n\treturn ret0\n}",
"func (o *KubernetesNodeGroupProfile) GetInfraProviderOk() (*KubernetesBaseInfrastructureProviderRelationship, bool) {\n\tif o == nil || o.InfraProvider == nil {\n\t\treturn nil, false\n\t}\n\treturn o.InfraProvider, true\n}",
"func (o *KubernetesNodeGroupProfile) HasInfraProvider() bool {\n\tif o != nil && o.InfraProvider != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}",
"func infraFailure(err error) *build.InfraFailure {\n\tfailure := &build.InfraFailure{\n\t\tText: err.Error(),\n\t}\n\tif errors.Unwrap(err) == context.Canceled {\n\t\tfailure.Type = build.InfraFailure_CANCELED\n\t} else {\n\t\tfailure.Type = build.InfraFailure_BOOTSTRAPPER_ERROR\n\t\tfailure.BootstrapperCallStack = errors.RenderStack(err)\n\t}\n\n\treturn failure\n}",
"func IsK8sProvisionerUnknownProvider(err errawr.Error) bool {\n\treturn err != nil && err.Is(K8sProvisionerUnknownProviderCode)\n}",
"func notSupported(sink diag.Sink, prov tfbridge.ProviderInfo) error {\n\tif sink == nil {\n\t\tsink = diag.DefaultSink(os.Stdout, os.Stderr, diag.FormatOptions{\n\t\t\tColor: colors.Always,\n\t\t})\n\t}\n\n\tu := ¬SupportedUtil{sink: sink}\n\n\tskipResource := func(tfToken string) bool { return false }\n\tskipDataSource := func(tfToken string) bool { return false }\n\tmuxedProvider := false\n\tif mixed, ok := prov.P.(*muxer.ProviderShim); ok {\n\t\tnot := func(f func(string) bool) func(string) bool {\n\t\t\treturn func(s string) bool {\n\t\t\t\treturn !f(s)\n\t\t\t}\n\t\t}\n\n\t\tskipResource = not(mixed.ResourceIsPF)\n\t\tskipDataSource = not(mixed.DataSourceIsPF)\n\t\tmuxedProvider = true\n\t} else if _, ok := prov.P.(*schemaShim.SchemaOnlyProvider); !ok {\n\t\twarning := \"Bridged Plugin Framework providers must have ProviderInfo.P be created from\" +\n\t\t\t\" pf/tfbridge.ShimProvider or pf/tfbridge.ShimProviderWithContext.\\nMuxed SDK and\" +\n\t\t\t\" Plugin Framework based providers must have ProviderInfo.P be created from\" +\n\t\t\t\" pf/tfbridge.MuxShimWithPF or pf/tfbridgepf/tfbridge.MuxShimWithDisjointgPF.\"\n\t\tu.warn(warning)\n\t}\n\n\tif prov.Resources != nil {\n\t\tfor path, res := range prov.Resources {\n\t\t\tif skipResource(path) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tu.resource(\"resource:\"+path, res)\n\t\t}\n\t}\n\n\tif prov.DataSources != nil {\n\t\tfor path, ds := range prov.DataSources {\n\t\t\tif skipDataSource(path) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tu.datasource(\"datasource:\"+path, ds)\n\t\t}\n\t}\n\n\t// It might be reasonable to set global values that PF will ignore if this is a\n\t// muxed provider, and the SDK side will pick it up.\n\tif !muxedProvider {\n\t\tif prov.Config != nil {\n\t\t\tfor path, ds := range prov.Config {\n\t\t\t\tu.schema(\"config:\"+path, ds)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}",
"func (External) IsK8sProvisionerUnknownProvider(err errawr.Error) bool {\n\treturn IsK8sProvisionerUnknownProvider(err)\n}",
"func (u *UnknownProvider) GetProviderString() string {\n\treturn \"unknown\"\n}",
"func (me TxsdNodeRoleSimpleContentExtensionCategory) IsInfra() bool { return me.String() == \"infra\" }",
"func (a *Application) RegisterProvider() {\n\n}",
"func (sdk *FabricSDK) FabricProvider() fab.InfraProvider {\n\treturn sdk.fabricProvider\n}",
"func IsProviderImplemented(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\tif err := r.ParseForm(); err != nil {\n\t\twriteErrorResponse(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\tif len(r.Form) == 0 {\n\t\tjson.NewEncoder(w).Encode(providerList())\n\t\treturn\n\t}\n\n\tname := r.Form.Get(\"name\")\n\tif len(name) == 0 {\n\t\twriteErrorResponse(w, http.StatusBadRequest, errors.New(\"missing provider name in the request\"))\n\t\treturn\n\t}\n\n\tres := isProviderImplementedResp{\n\t\tImplemented: name == string(common.Example) || common.KYCProviders[common.KYCProvider(name)],\n\t}\n\n\tjson.NewEncoder(w).Encode(res)\n}",
"func TestOverlayIOPExhaustiveness(t *testing.T) {\n\twellknownProviders := map[string]struct{}{\n\t\t\"prometheus\": {},\n\t\t\"envoy_file_access_log\": {},\n\t\t\"stackdriver\": {},\n\t\t\"envoy_otel_als\": {},\n\t\t\"envoy_ext_authz_http\": {},\n\t\t\"envoy_ext_authz_grpc\": {},\n\t\t\"zipkin\": {},\n\t\t\"lightstep\": {},\n\t\t\"datadog\": {},\n\t\t\"opencensus\": {},\n\t\t\"skywalking\": {},\n\t\t\"envoy_http_als\": {},\n\t\t\"envoy_tcp_als\": {},\n\t\t\"opentelemetry\": {},\n\t}\n\n\tunexpectedProviders := make([]string, 0)\n\n\tmsg := &meshconfig.MeshConfig_ExtensionProvider{}\n\tpb := msg.ProtoReflect()\n\tmd := pb.Descriptor()\n\n\tof := md.Oneofs().Get(0)\n\tfor i := 0; i < of.Fields().Len(); i++ {\n\t\to := of.Fields().Get(i)\n\t\tn := string(o.Name())\n\t\tif _, ok := wellknownProviders[n]; ok {\n\t\t\tdelete(wellknownProviders, n)\n\t\t} else {\n\t\t\tunexpectedProviders = append(unexpectedProviders, n)\n\t\t}\n\t}\n\n\tif len(wellknownProviders) != 0 || len(unexpectedProviders) != 0 {\n\t\tt.Errorf(\"unexpected provider not implemented in OverlayIOP, wellknownProviders: %v unexpectedProviders: %v\", wellknownProviders, unexpectedProviders)\n\t\tt.Fail()\n\t}\n}",
"func (o *KubernetesNodeGroupProfile) SetInfraProvider(v KubernetesBaseInfrastructureProviderRelationship) {\n\to.InfraProvider = &v\n}",
"func (app *App) HandleProvisionTestInfra(w http.ResponseWriter, r *http.Request) {\n\tprojID, err := strconv.ParseUint(chi.URLParam(r, \"project_id\"), 0, 64)\n\n\tif err != nil || projID == 0 {\n\t\tapp.handleErrorFormDecoding(err, ErrProjectDecode, w)\n\t\treturn\n\t}\n\n\tform := &forms.CreateTestInfra{\n\t\tProjectID: uint(projID),\n\t}\n\n\t// decode from JSON to form value\n\tif err := json.NewDecoder(r.Body).Decode(form); err != nil {\n\t\tapp.handleErrorFormDecoding(err, ErrProjectDecode, w)\n\t\treturn\n\t}\n\n\t// convert the form to an aws infra instance\n\tinfra, err := form.ToInfra()\n\n\tif err != nil {\n\t\tapp.handleErrorFormDecoding(err, ErrProjectDecode, w)\n\t\treturn\n\t}\n\n\t// handle write to the database\n\tinfra, err = app.Repo.Infra.CreateInfra(infra)\n\n\tif err != nil {\n\t\tapp.handleErrorDataWrite(err, w)\n\t\treturn\n\t}\n\n\t_, err = app.ProvisionerAgent.ProvisionTest(\n\t\tuint(projID),\n\t\tinfra,\n\t\t*app.Repo,\n\t\tprovisioner.Apply,\n\t\t&app.DBConf,\n\t\tapp.RedisConf,\n\t\tapp.ServerConf.ProvisionerImageTag,\n\t\tapp.ServerConf.ProvisionerImagePullSecret,\n\t)\n\n\tif err != nil {\n\t\tinfra.Status = models.StatusError\n\t\tinfra, _ = app.Repo.Infra.UpdateInfra(infra)\n\n\t\tapp.handleErrorInternal(err, w)\n\t\treturn\n\t}\n\n\tapp.Logger.Info().Msgf(\"New test infra created: %d\", infra.ID)\n\n\tw.WriteHeader(http.StatusCreated)\n\n\tinfraExt := infra.Externalize()\n\n\tif err := json.NewEncoder(w).Encode(infraExt); err != nil {\n\t\tapp.handleErrorFormDecoding(err, ErrProjectDecode, w)\n\t\treturn\n\t}\n}",
"func NewProvider() *ProviderConfig {\n\tproviderConfig := &ProviderConfig{\n\t\tAlibaba: make(map[string]*models.AlibabaCloudSpec),\n\t\tAnexia: make(map[string]*models.AnexiaCloudSpec),\n\t\tAws: make(map[string]*models.AWSCloudSpec),\n\t\tAzure: make(map[string]*models.AzureCloudSpec),\n\t\tDigitalocean: make(map[string]*models.DigitaloceanCloudSpec),\n\t\tFake: make(map[string]*models.FakeCloudSpec),\n\t\tGcp: make(map[string]*models.GCPCloudSpec),\n\t\tHetzner: make(map[string]*models.HetznerCloudSpec),\n\t\tKubevirt: make(map[string]*models.KubevirtCloudSpec),\n\t\tOpenstack: make(map[string]*models.OpenstackCloudSpec),\n\t\tPacket: make(map[string]*models.PacketCloudSpec),\n\t\tVsphere: make(map[string]*models.VSphereCloudSpec),\n\t}\n\n\tproviderConfig.Alibaba[\"Alibaba\"] = newAlibabaCloudSpec()\n\tproviderConfig.Anexia[\"Anexia\"] = newAnexiaCloudSpec()\n\tproviderConfig.Aws[\"Aws\"] = newAWSCloudSpec()\n\tproviderConfig.Azure[\"Azure\"] = newAzureCloudSpec()\n\tproviderConfig.Digitalocean[\"Digitalocean\"] = newDigitaloceanCloudSpec()\n\tproviderConfig.Fake[\"Fake\"] = newFakeCloudSpec()\n\tproviderConfig.Gcp[\"Gcp\"] = newGCPCloudSpec()\n\tproviderConfig.Hetzner[\"Hetzner\"] = newHetznerCloudSpec()\n\tproviderConfig.Kubevirt[\"Kubevirt\"] = newKubevirtCloudSpec()\n\tproviderConfig.Openstack[\"Openstack\"] = newOpenstackCloudSpec()\n\tproviderConfig.Packet[\"Packet\"] = newPacketCloudSpec()\n\tproviderConfig.Vsphere[\"Vsphere\"] = newVSphereCloudSpec()\n\n\treturn providerConfig\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
LocalDiscoveryProvider mocks base method
|
func (m *MockProviders) LocalDiscoveryProvider() fab.LocalDiscoveryProvider {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "LocalDiscoveryProvider")
ret0, _ := ret[0].(fab.LocalDiscoveryProvider)
return ret0
}
|
[
"func (m *MockClient) LocalDiscoveryProvider() fab.LocalDiscoveryProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LocalDiscoveryProvider\")\n\tret0, _ := ret[0].(fab.LocalDiscoveryProvider)\n\treturn ret0\n}",
"func (c *Provider) LocalDiscoveryProvider() fab.LocalDiscoveryProvider {\n\treturn c.localDiscoveryProvider\n}",
"func (m *MockMemberList) LocalNode() discovery.Member {\n\tret := m.ctrl.Call(m, \"LocalNode\")\n\tret0, _ := ret[0].(discovery.Member)\n\treturn ret0\n}",
"func newMockProvider() *mockProviderAsync {\n\tprovider := newSyncMockProvider()\n\t// By default notifier is set to a function which is a no-op. In the event we've implemented the PodNotifier interface,\n\t// it will be set, and then we'll call a real underlying implementation.\n\t// This makes it easier in the sense we don't need to wrap each method.\n\treturn &mockProviderAsync{provider}\n}",
"func NewMockDiscoveryProvider(err error, peers []fab.Peer) (*MockStaticDiscoveryProvider, error) {\n\treturn &MockStaticDiscoveryProvider{Error: err, Peers: peers}, nil\n}",
"func TestSrcMgr(t *testing.T) {\n\n\tgopath := os.Getenv(\"GOPATH\")\n\tos.Setenv(\"CHASSIS_HOME\", gopath+\"/src/github.com/go-chassis/go-chassis/examples/discovery/server/\")\n\t//config.Init()\n\n\terr := config.Init()\n\tassert.NoError(t, err)\n\n\tvar arr = []string{\"127.0.0.1\", \"hgfghfff\"}\n\n\tregistry.SelfInstancesCache = cache.New(0, 0)\n\tregistry.SelfInstancesCache.Set(\"abc\", arr, time.Second*30)\n\t/*a:=func(...transport.Option) transport.Transport{\n\t\t//var t transport.Transport\n\t\ttp :=tcp.NewTransport()\n\t\treturn tp\n\t}\n\n\ttransport.InstallPlugin(\"rest\",a)*/\n\n\t/*f:=func(...server.Option) server.Server{\n\t\tvar s server.Server\n\n\t\treturn s\n\t}\n\tserver.InstallPlugin(\"rest\",f)*/\n\n\ttestRegistryObj := new(mock.RegistratorMock)\n\tregistry.DefaultRegistrator = testRegistryObj\n\ttestRegistryObj.On(\"UnRegisterMicroServiceInstance\", \"microServiceID\", \"microServiceInstanceID\").Return(nil)\n\n\tdefaultChain := make(map[string]string)\n\tdefaultChain[\"default\"] = \"\"\n\tdefaultChain[\"default1\"] = \"\"\n\n\tvar mp model.Protocol\n\t//mp.Listen = \"127.0.0.1:30100\"\n\t// use random port\n\tmp.Listen = \"127.0.0.1:0\"\n\tmp.Advertise = \"127.0.0.1:8080\"\n\tmp.WorkerNumber = 10\n\tmp.Transport = \"tcp\"\n\n\tvar cseproto map[string]model.Protocol = make(map[string]model.Protocol)\n\n\tcseproto[\"rest\"] = mp\n\n\tconfig.GlobalDefinition.Cse.Handler.Chain.Provider = defaultChain\n\tconfig.GlobalDefinition.Cse.Protocols = cseproto\n\n\tserver.Init()\n\n\tsrv := server.GetServers()\n\tassert.NotNil(t, srv)\n\t//fmt.Println(\"SSSSSSSSSss\",srv)\n\terr = server.UnRegistrySelfInstances()\n\tassert.NoError(t, err)\n\t//fmt.Println(\"err\",err)\n\terr = server.StartServer()\n\tassert.NoError(t, err)\n\t//fmt.Println(\"err@@@@@@@\",err)\n\n\tsr, err := server.GetServer(\"rest\")\n\tassert.NotNil(t, sr)\n\tassert.NoError(t, err)\n\t//fmt.Println(\"Sr\",sr)\n\t//fmt.Println(\"err\",err)\n\n\tsrv1, err := server.GetServerFunc(\"abc\")\n\tassert.Nil(t, srv1)\n\tassert.Error(t, err)\n\n\ttestRegistryObj.On(\"UnregisterMicroServiceInstance\", \"microServiceID\", \"microServiceInstanceID\").Return(errors.New(MockError))\n\terr = server.UnRegistrySelfInstances()\n\n}",
"func Mock() Cluster { return mockCluster{} }",
"func (_m *MockPlcDriver) SupportsDiscovery() bool {\n\tret := _m.Called()\n\n\tvar r0 bool\n\tif rf, ok := ret.Get(0).(func() bool); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(bool)\n\t}\n\n\treturn r0\n}",
"func testDiscovery(t *testing.T, suite *integrationTestSuite) {\n\tctx := context.Background()\n\ttr := utils.NewTracer(utils.ThisFunction()).Start()\n\tdefer tr.Stop()\n\n\tusername := suite.Me.Username\n\n\t// create load balancer for main cluster proxies\n\tfrontend := *utils.MustParseAddr(net.JoinHostPort(Loopback, \"0\"))\n\tlb, err := utils.NewLoadBalancer(ctx, frontend)\n\trequire.NoError(t, err)\n\trequire.NoError(t, lb.Listen())\n\tgo lb.Serve()\n\tdefer lb.Close()\n\n\tremote := suite.newNamedTeleportInstance(t, \"cluster-remote\")\n\tmain := suite.newNamedTeleportInstance(t, \"cluster-main\")\n\n\tremote.AddUser(username, []string{username})\n\tmain.AddUser(username, []string{username})\n\n\trequire.NoError(t, main.Create(t, remote.Secrets.AsSlice(), false, nil))\n\tmainSecrets := main.Secrets\n\t// switch listen address of the main cluster to load balancer\n\tmainProxyAddr := *utils.MustParseAddr(mainSecrets.TunnelAddr)\n\tlb.AddBackend(mainProxyAddr)\n\tmainSecrets.TunnelAddr = lb.Addr().String()\n\trequire.NoError(t, remote.Create(t, mainSecrets.AsSlice(), true, nil))\n\n\trequire.NoError(t, main.Start())\n\trequire.NoError(t, remote.Start())\n\n\t// Wait for both cluster to see each other via reverse tunnels.\n\trequire.Eventually(t, helpers.WaitForClusters(main.Tunnel, 1), 10*time.Second, 1*time.Second,\n\t\t\"Two clusters do not see each other: tunnels are not working.\")\n\trequire.Eventually(t, helpers.WaitForClusters(remote.Tunnel, 1), 10*time.Second, 1*time.Second,\n\t\t\"Two clusters do not see each other: tunnels are not working.\")\n\n\t// start second proxy\n\tproxyConfig := helpers.ProxyConfig{\n\t\tName: \"cluster-main-proxy\",\n\t\tDisableWebService: true,\n\t}\n\tproxyConfig.SSHAddr = helpers.NewListenerOn(t, main.Hostname, service.ListenerNodeSSH, &proxyConfig.FileDescriptors)\n\tproxyConfig.WebAddr = helpers.NewListenerOn(t, main.Hostname, service.ListenerProxyWeb, &proxyConfig.FileDescriptors)\n\tproxyConfig.ReverseTunnelAddr = helpers.NewListenerOn(t, main.Hostname, service.ListenerProxyTunnel, &proxyConfig.FileDescriptors)\n\n\tsecondProxy, _, err := main.StartProxy(proxyConfig)\n\trequire.NoError(t, err)\n\n\t// add second proxy as a backend to the load balancer\n\tlb.AddBackend(*utils.MustParseAddr(proxyConfig.ReverseTunnelAddr))\n\n\t// At this point the main cluster should observe two tunnels\n\t// connected to it from remote cluster\n\thelpers.WaitForActiveTunnelConnections(t, main.Tunnel, \"cluster-remote\", 1)\n\thelpers.WaitForActiveTunnelConnections(t, secondProxy, \"cluster-remote\", 1)\n\n\t// execute the connection via first proxy\n\tcfg := helpers.ClientConfig{\n\t\tLogin: username,\n\t\tCluster: \"cluster-remote\",\n\t\tHost: Loopback,\n\t\tPort: helpers.Port(t, remote.SSH),\n\t}\n\toutput, err := runCommand(t, main, []string{\"echo\", \"hello world\"}, cfg, 1)\n\trequire.NoError(t, err)\n\trequire.Equal(t, \"hello world\\n\", output)\n\n\t// Execute the connection via second proxy, should work. This command is\n\t// tried 10 times with 250 millisecond delay between each attempt to allow\n\t// the discovery request to be received and the connection added to the agent\n\t// pool.\n\tcfgProxy := helpers.ClientConfig{\n\t\tLogin: username,\n\t\tCluster: \"cluster-remote\",\n\t\tHost: Loopback,\n\t\tPort: helpers.Port(t, remote.SSH),\n\t\tProxy: &proxyConfig,\n\t}\n\toutput, err = runCommand(t, main, []string{\"echo\", \"hello world\"}, cfgProxy, 10)\n\trequire.NoError(t, err)\n\trequire.Equal(t, \"hello world\\n\", output)\n\n\t// Now disconnect the main proxy and make sure it will reconnect eventually.\n\trequire.NoError(t, lb.RemoveBackend(mainProxyAddr))\n\thelpers.WaitForActiveTunnelConnections(t, secondProxy, \"cluster-remote\", 1)\n\n\t// Requests going via main proxy should fail.\n\t_, err = runCommand(t, main, []string{\"echo\", \"hello world\"}, cfg, 1)\n\trequire.Error(t, err)\n\n\t// Requests going via second proxy should succeed.\n\toutput, err = runCommand(t, main, []string{\"echo\", \"hello world\"}, cfgProxy, 1)\n\trequire.NoError(t, err)\n\trequire.Equal(t, \"hello world\\n\", output)\n\n\t// Connect the main proxy back and make sure agents have reconnected over time.\n\t// This command is tried 10 times with 250 millisecond delay between each\n\t// attempt to allow the discovery request to be received and the connection\n\t// added to the agent pool.\n\tlb.AddBackend(mainProxyAddr)\n\n\t// Once the proxy is added a matching tunnel connection should be created.\n\thelpers.WaitForActiveTunnelConnections(t, main.Tunnel, \"cluster-remote\", 1)\n\thelpers.WaitForActiveTunnelConnections(t, secondProxy, \"cluster-remote\", 1)\n\n\t// Requests going via main proxy should succeed.\n\toutput, err = runCommand(t, main, []string{\"echo\", \"hello world\"}, cfg, 40)\n\trequire.NoError(t, err)\n\trequire.Equal(t, \"hello world\\n\", output)\n\n\t// Stop one of proxies on the main cluster.\n\terr = main.StopProxy()\n\trequire.NoError(t, err)\n\n\t// Wait for the remote cluster to detect the outbound connection is gone.\n\trequire.NoError(t, helpers.WaitForProxyCount(remote, \"cluster-main\", 1))\n\n\t// Stop both clusters and remaining nodes.\n\trequire.NoError(t, remote.StopAll())\n\trequire.NoError(t, main.StopAll())\n}",
"func testDiscoveryRecovers(t *testing.T, suite *integrationTestSuite) {\n\tctx := context.Background()\n\ttr := utils.NewTracer(utils.ThisFunction()).Start()\n\tdefer tr.Stop()\n\n\tusername := suite.Me.Username\n\n\t// create load balancer for main cluster proxies\n\tfrontend := *utils.MustParseAddr(net.JoinHostPort(Loopback, \"0\"))\n\tlb, err := utils.NewLoadBalancer(ctx, frontend)\n\trequire.NoError(t, err)\n\trequire.NoError(t, lb.Listen())\n\tgo lb.Serve()\n\tdefer lb.Close()\n\n\tremote := suite.newNamedTeleportInstance(t, \"cluster-remote\")\n\tmain := suite.newNamedTeleportInstance(t, \"cluster-main\")\n\n\tremote.AddUser(username, []string{username})\n\tmain.AddUser(username, []string{username})\n\n\trequire.NoError(t, main.Create(t, remote.Secrets.AsSlice(), false, nil))\n\tmainSecrets := main.Secrets\n\t// switch listen address of the main cluster to load balancer\n\tmainProxyAddr := *utils.MustParseAddr(mainSecrets.TunnelAddr)\n\tlb.AddBackend(mainProxyAddr)\n\tmainSecrets.TunnelAddr = lb.Addr().String()\n\trequire.NoError(t, remote.Create(t, mainSecrets.AsSlice(), true, nil))\n\n\trequire.NoError(t, main.Start())\n\trequire.NoError(t, remote.Start())\n\n\t// Wait for both cluster to see each other via reverse tunnels.\n\trequire.Eventually(t, helpers.WaitForClusters(main.Tunnel, 1), 10*time.Second, 1*time.Second,\n\t\t\"Two clusters do not see each other: tunnels are not working.\")\n\trequire.Eventually(t, helpers.WaitForClusters(remote.Tunnel, 1), 10*time.Second, 1*time.Second,\n\t\t\"Two clusters do not see each other: tunnels are not working.\")\n\n\tvar reverseTunnelAddr string\n\n\t// Helper function for adding a new proxy to \"main\".\n\taddNewMainProxy := func(name string) (reversetunnelclient.Server, helpers.ProxyConfig) {\n\t\tt.Logf(\"adding main proxy %q...\", name)\n\t\tnewConfig := helpers.ProxyConfig{\n\t\t\tName: name,\n\t\t\tDisableWebService: true,\n\t\t}\n\t\tnewConfig.SSHAddr = helpers.NewListenerOn(t, main.Hostname, service.ListenerNodeSSH, &newConfig.FileDescriptors)\n\t\tnewConfig.WebAddr = helpers.NewListenerOn(t, main.Hostname, service.ListenerProxyWeb, &newConfig.FileDescriptors)\n\t\tnewConfig.ReverseTunnelAddr = helpers.NewListenerOn(t, main.Hostname, service.ListenerProxyTunnel, &newConfig.FileDescriptors)\n\t\treverseTunnelAddr = newConfig.ReverseTunnelAddr\n\n\t\tnewProxy, _, err := main.StartProxy(newConfig)\n\t\trequire.NoError(t, err)\n\n\t\t// add proxy as a backend to the load balancer\n\t\tlb.AddBackend(*utils.MustParseAddr(newConfig.ReverseTunnelAddr))\n\t\treturn newProxy, newConfig\n\t}\n\n\tkillMainProxy := func(name string) {\n\t\tt.Logf(\"killing main proxy %q...\", name)\n\t\tfor _, p := range main.Nodes {\n\t\t\tif !p.Config.Proxy.Enabled {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif p.Config.Hostname == name {\n\t\t\t\trequire.NoError(t, lb.RemoveBackend(*utils.MustParseAddr(reverseTunnelAddr)))\n\t\t\t\trequire.NoError(t, p.Close())\n\t\t\t\trequire.NoError(t, p.Wait())\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tt.Errorf(\"cannot close proxy %q (not found)\", name)\n\t}\n\n\t// Helper function for testing that a proxy in main has been discovered by\n\t// (and is able to use reverse tunnel into) remote. If conf is nil, main's\n\t// first/default proxy will be called.\n\ttestProxyConn := func(conf *helpers.ProxyConfig, shouldFail bool) {\n\t\tclientConf := helpers.ClientConfig{\n\t\t\tLogin: username,\n\t\t\tCluster: \"cluster-remote\",\n\t\t\tHost: Loopback,\n\t\t\tPort: helpers.Port(t, remote.SSH),\n\t\t\tProxy: conf,\n\t\t}\n\t\toutput, err := runCommand(t, main, []string{\"echo\", \"hello world\"}, clientConf, 10)\n\t\tif shouldFail {\n\t\t\trequire.Error(t, err)\n\t\t} else {\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Equal(t, \"hello world\\n\", output)\n\t\t}\n\t}\n\n\t// ensure that initial proxy's tunnel has been established\n\thelpers.WaitForActiveTunnelConnections(t, main.Tunnel, \"cluster-remote\", 1)\n\t// execute the connection via initial proxy; should not fail\n\ttestProxyConn(nil, false)\n\n\t// helper funcion for making numbered proxy names\n\tpname := func(n int) string {\n\t\treturn fmt.Sprintf(\"cluster-main-proxy-%d\", n)\n\t}\n\n\t// create first numbered proxy\n\t_, c0 := addNewMainProxy(pname(0))\n\t// check that we now have two tunnel connections\n\trequire.NoError(t, helpers.WaitForProxyCount(remote, \"cluster-main\", 2))\n\t// check that first numbered proxy is OK.\n\ttestProxyConn(&c0, false)\n\t// remove the initial proxy.\n\trequire.NoError(t, lb.RemoveBackend(mainProxyAddr))\n\trequire.NoError(t, helpers.WaitForProxyCount(remote, \"cluster-main\", 1))\n\n\t// force bad state by iteratively removing previous proxy before\n\t// adding next proxy; this ensures that discovery protocol's list of\n\t// known proxies is all invalid.\n\tfor i := 0; i < 6; i++ {\n\t\tprev, next := pname(i), pname(i+1)\n\t\tkillMainProxy(prev)\n\t\trequire.NoError(t, helpers.WaitForProxyCount(remote, \"cluster-main\", 0))\n\t\t_, cn := addNewMainProxy(next)\n\t\trequire.NoError(t, helpers.WaitForProxyCount(remote, \"cluster-main\", 1))\n\t\ttestProxyConn(&cn, false)\n\t}\n\n\t// Stop both clusters and remaining nodes.\n\trequire.NoError(t, remote.StopAll())\n\trequire.NoError(t, main.StopAll())\n}",
"func (c *Local) LocalDiscoveryService() fab.DiscoveryService {\n\treturn c.localDiscovery\n}",
"func (m *MockInterface) Discovery() discovery.DiscoveryInterface {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Discovery\")\n\tret0, _ := ret[0].(discovery.DiscoveryInterface)\n\treturn ret0\n}",
"func (m *MockService) Discovery() *idp.DiscoveryResponse {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Discovery\")\n\tret0, _ := ret[0].(*idp.DiscoveryResponse)\n\treturn ret0\n}",
"func (m *MockEarlyConnection) LocalAddr() net.Addr {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LocalAddr\")\n\tret0, _ := ret[0].(net.Addr)\n\treturn ret0\n}",
"func NPLTestLocalAccess(t *testing.T) {\n\tr := require.New(t)\n\n\tannotation := make(map[string]string)\n\tannotation[k8s.NPLEnabledAnnotationKey] = \"true\"\n\tipFamily := corev1.IPv4Protocol\n\ttestData.createNginxClusterIPServiceWithAnnotations(false, &ipFamily, annotation)\n\texpectedAnnotations := newExpectedNPLAnnotations(defaultStartPort, defaultEndPort).Add(nil, defaultTargetPort, \"tcp\")\n\n\tnode := nodeName(0)\n\n\ttestPodName := randName(\"test-pod-\")\n\terr := testData.createNginxPodOnNode(testPodName, testNamespace, node, false)\n\tr.NoError(err, \"Error creating test Pod: %v\", err)\n\n\tclientName := randName(\"test-client-\")\n\terr = testData.createBusyboxPodOnNode(clientName, testNamespace, node, true)\n\tr.NoError(err, \"Error creating hostNetwork Pod %s: %v\", clientName)\n\n\terr = testData.podWaitForRunning(defaultTimeout, clientName, testNamespace)\n\tr.NoError(err, \"Error when waiting for Pod %s to be running\", clientName)\n\n\tantreaPod, err := testData.getAntreaPodOnNode(node)\n\tr.NoError(err, \"Error when getting Antrea Agent Pod on Node '%s'\", node)\n\n\tnplAnnotations, testPodIP := getNPLAnnotations(t, testData, r, testPodName)\n\n\tcheckNPLRulesForPod(t, testData, r, nplAnnotations, antreaPod, testPodIP, true)\n\texpectedAnnotations.Check(t, nplAnnotations)\n\tcheckTrafficForNPL(testData, r, nplAnnotations, clientName)\n\n\ttestData.deletePod(testNamespace, testPodName)\n\tcheckNPLRulesForPod(t, testData, r, nplAnnotations, antreaPod, testPodIP, false)\n}",
"func newLocalService(config fab.EndpointConfig, mspID string, opts ...coptions.Opt) *LocalService {\n\tlogger.Debug(\"Creating new local discovery service\")\n\n\ts := &LocalService{mspID: mspID}\n\ts.service = newService(config, s.queryPeers, opts...)\n\treturn s\n}",
"func (m *MockInformation) LocalLocation() *universe.View {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LocalLocation\")\n\tret0, _ := ret[0].(*universe.View)\n\treturn ret0\n}",
"func (m *MockConner) LocalMultiaddr() multiaddr.Multiaddr {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LocalMultiaddr\")\n\tret0, _ := ret[0].(multiaddr.Multiaddr)\n\treturn ret0\n}",
"func (l *Factory) CreateLocalDiscoveryProvider(config fabApi.EndpointConfig) (fabApi.LocalDiscoveryProvider, error) {\n\tlogger.Debug(\"create local Provider Impl\")\n\treturn &impl{config, l.LocalPeer, l.LocalPeerTLSCertPem}, nil\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
SigningManager mocks base method
|
func (m *MockProviders) SigningManager() core.SigningManager {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SigningManager")
ret0, _ := ret[0].(core.SigningManager)
return ret0
}
|
[
"func (m *MockProviders) SigningManager() core.SigningManager {\r\n\tret := m.ctrl.Call(m, \"SigningManager\")\r\n\tret0, _ := ret[0].(core.SigningManager)\r\n\treturn ret0\r\n}",
"func (m *MockClient) SigningManager() core.SigningManager {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SigningManager\")\n\tret0, _ := ret[0].(core.SigningManager)\n\treturn ret0\n}",
"func (pc *MockProviderContext) SigningManager() fab.SigningManager {\n\treturn pc.signingManager\n}",
"func NewMockSigner(kis []KeyInfo) MockSigner {\n\tvar ms MockSigner\n\tms.AddrKeyInfo = make(map[address.Address]KeyInfo)\n\tfor _, k := range kis {\n\t\t// extract public key\n\t\tpub := k.PublicKey()\n\t\tnewAddr, err := address.NewSecp256k1Address(pub)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tms.Addresses = append(ms.Addresses, newAddr)\n\t\tms.AddrKeyInfo[newAddr] = k\n\t\tms.PubKeys = append(ms.PubKeys, pub)\n\t}\n\treturn ms\n}",
"func (m *DeviceHealthAttestationState) SetTestSigning(value *string)() {\n err := m.GetBackingStore().Set(\"testSigning\", value)\n if err != nil {\n panic(err)\n }\n}",
"func TestVerifySignedMessage(t *testing.T) {\n\tfor _, tc := range []struct {\n\t\tdesc string\n\t\tsettings *crypt.PkiSettings\n\t\tsetup func(mdb *mocks.MockDepsBundle, setupDone *bool) error\n\t\tmessageToSign string\n\t\tbase64Signature string\n\t\tPEMPublicKey string\n\t\texpectedError *testtools.ErrorSpec\n\t\texpectedValidity bool\n\t}{\n\t\t{\n\t\t\tdesc: \"invalid base64 signature\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"@#$^&*()_\",\n\t\t\tPEMPublicKey: \"\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"base64.CorruptInputError\",\n\t\t\t\tMessage: \"illegal base64 data at input byte 0\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"empty PEM key\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"abcdefgh\",\n\t\t\tPEMPublicKey: \"\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"*errors.errorString\",\n\t\t\t\tMessage: \"No PEM data was found\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"bad key data\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"abcdefgh\",\n\t\t\tPEMPublicKey: \"-----BEGIN INVALID DATA-----\\n\" +\n\t\t\t\t\"MTIzNDU2Nzg5MGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6\\n\" +\n\t\t\t\t\"-----END INVALID DATA-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"asn1.StructuralError\",\n\t\t\t\tMessage: \"asn1: structure \" +\n\t\t\t\t\t\"error: tags don't match (16 vs {class:0 \" +\n\t\t\t\t\t\"tag:17 \" +\n\t\t\t\t\t\"length:50 \" +\n\t\t\t\t\t\"isCompound:true}) {optional:false \" +\n\t\t\t\t\t\"explicit:false \" +\n\t\t\t\t\t\"application:false \" +\n\t\t\t\t\t\"defaultValue:<nil> \" +\n\t\t\t\t\t\"tag:<nil> \" +\n\t\t\t\t\t\"stringType:0 \" +\n\t\t\t\t\t\"timeType:0 \" +\n\t\t\t\t\t\"set:false \" +\n\t\t\t\t\t\"omitEmpty:false} publicKeyInfo @2\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"invalid signature\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"abcdefgh\",\n\t\t\tPEMPublicKey: \"-----BEGIN ECDSA PUBLIC KEY-----\\n\" +\n\t\t\t\t\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7WzVjtn9Gk+WHr5xbv8XMvooqU25\\n\" +\n\t\t\t\t\"BhgNjZ/vHZLBdVtCOjk4KxjS1UBfQm0c3TRxWBl3hj2AmnJbCrnGofMHBQ==\\n\" +\n\t\t\t\t\"-----END ECDSA PUBLIC KEY-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"asn1.SyntaxError\",\n\t\t\t\tMessage: \"asn1: syntax error: truncated tag or length\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"ecdsa key for rsa mode\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.RSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"N3SuIdWI7XlXDteTmcOZUd2OBacyUWY+/+A8SC4QUBz9rXnldBqXha6YyGwnTuizxuy6quQ2QDFdtW16dj7EQk3lozfngskyhc2r86q3AUbdFDvrQVphMQhzsgBhHVoMjCL/YRfvtzCTWhBxegjVMLraLDCBb8IZTIqcMYafYyeJTvAnjBuntlZ+14TDuTt14Uqz85T04CXxBEqlIXMMKpTc01ST4Jsxz5HLO+At1htXp5eHOUFtQSilm3G7iO8ynhgPcXHDWfMAWu6VySUoHWCG70pJaCq6ehF7223t0UFOCqAyDyyQyP9yeUHj8F75SPSxfJm8iKXGx2LND/qLYw==\",\n\t\t\tPEMPublicKey: \"-----BEGIN RSA PUBLIC KEY-----\\n\" +\n\t\t\t\t\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7WzVjtn9Gk+WHr5xbv8XMvooqU25\\n\" +\n\t\t\t\t\"BhgNjZ/vHZLBdVtCOjk4KxjS1UBfQm0c3TRxWBl3hj2AmnJbCrnGofMHBQ==\\n\" +\n\t\t\t\t\"-----END RSA PUBLIC KEY-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"*errors.errorString\",\n\t\t\t\tMessage: \"Expecting a *rsa.PublicKey, but encountered a *ecdsa.PublicKey instead\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"rsa key for ecdsa mode\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"MEYCIQDPM0fc/PFauoZzpltH3RpWtlaqRnL0gFk5WFiLMrFqrwIhAIDvlBozU6Ky2UC9xOSq3YZ5iFuO356t9RnHOElaaXFJ\",\n\t\t\tPEMPublicKey: \"-----BEGIN RSA PUBLIC KEY-----\\n\" +\n\t\t\t\t\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzCTTFKQBHfTN8jW6q8PT\\n\" +\n\t\t\t\t\"HNZKWnRPxSt9kpgWmyqFaZnEUipgoKGAxSIsVrl2PJSm5OlgkVzx+MY+LWM64VKM\\n\" +\n\t\t\t\t\"bRpUUGJR3zdMNhwZQX0hjOpLpVJvUwD78utVs8vijrU7sH48usFiaZQYjy4m4hQh\\n\" +\n\t\t\t\t\"63/x4h3KVz7YqUnlRMzYJFT43+AwYzYuEpzWRxtW7IObJPtjtmYVoqva98fF6aj5\\n\" +\n\t\t\t\t\"uHAsvaAgZGBalHXmCiPzKiGU/halzXSPvyJ2Cqz2aUqMHgwi/2Ip4z/mrfX+mUTa\\n\" +\n\t\t\t\t\"S+LyBy7GgqJ5vbkGArMagJIc0eARF60r6Uf483xh17oniABdLJy4qlLf6PcEU+ut\\n\" +\n\t\t\t\t\"EwIDAQAB\\n\" +\n\t\t\t\t\"-----END RSA PUBLIC KEY-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"*errors.errorString\",\n\t\t\t\tMessage: \"Expecting a *ecdsa.PublicKey, but encountered a *rsa.PublicKey instead\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t} {\n\t\tt.Run(fmt.Sprintf(\"Subtest: %s\", tc.desc), func(tt *testing.T) {\n\t\t\tmockDepsBundle := mocks.NewDefaultMockDeps(\"\", []string{\"progname\"}, \"/home/user\", nil)\n\t\t\treturnedNormally := false\n\t\t\tvar tooling *crypt.CryptoTooling\n\t\t\tvar actualErr error\n\t\t\tvar actualValidity bool\n\t\t\terr := mockDepsBundle.InvokeCallInMockedEnv(func() error {\n\t\t\t\tsetupComplete := false\n\t\t\t\tinnerErr := tc.setup(mockDepsBundle, &setupComplete)\n\t\t\t\tif innerErr != nil {\n\t\t\t\t\treturn innerErr\n\t\t\t\t}\n\t\t\t\tvar toolingErr error\n\t\t\t\ttooling, toolingErr = crypt.GetCryptoTooling(mockDepsBundle.Deps, tc.settings)\n\t\t\t\tif toolingErr != nil {\n\t\t\t\t\treturn toolingErr\n\t\t\t\t}\n\t\t\t\tsetupComplete = true\n\t\t\t\tactualValidity, actualErr = tooling.VerifySignedMessage(tc.messageToSign, tc.base64Signature, tc.PEMPublicKey)\n\t\t\t\treturnedNormally = true\n\t\t\t\treturn nil\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\ttt.Errorf(\"Unexpected error calling mockDepsBundle.InvokeCallInMockedEnv(): %s\", err.Error())\n\t\t\t}\n\t\t\tif exitStatus := mockDepsBundle.GetExitStatus(); (exitStatus != 0) || !returnedNormally {\n\t\t\t\ttt.Error(\"EncodeAndSaveKey() should not have paniced or called os.Exit.\")\n\t\t\t}\n\t\t\tif (mockDepsBundle.OutBuf.String() != \"\") || (mockDepsBundle.ErrBuf.String() != \"\") {\n\t\t\t\ttt.Errorf(\"EncodeAndSaveKey() should not have output any data. Saw stdout:\\n%s\\nstderr:\\n%s\", mockDepsBundle.OutBuf.String(), mockDepsBundle.ErrBuf.String())\n\t\t\t}\n\t\t\tif err := tc.expectedError.EnsureMatches(actualErr); err != nil {\n\t\t\t\ttt.Error(err.Error())\n\t\t\t}\n\t\t\tif tc.expectedError == nil {\n\t\t\t\tif actualValidity != tc.expectedValidity {\n\t\t\t\t\ttt.Errorf(\"Signature is %#v when %#v expected\", actualValidity, tc.expectedValidity)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif tc.expectedValidity {\n\t\t\t\t\ttt.Error(\"TEST CASE INVALID. Should not expect \\\"valid\\\".\")\n\t\t\t\t}\n\t\t\t\tif actualValidity {\n\t\t\t\t\ttt.Error(\"Error was expected. Should not report \\\"valid\\\".\")\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}",
"func TestCryptoSignerInterfaceBehavior(t *testing.T) {\n\tcs := NewCryptoService(trustmanager.NewKeyMemoryStore(passphraseRetriever))\n\tinterfaces.EmptyCryptoServiceInterfaceBehaviorTests(t, cs)\n\tinterfaces.CreateGetKeyCryptoServiceInterfaceBehaviorTests(t, cs, data.ECDSAKey)\n\n\tcs = NewCryptoService(trustmanager.NewKeyMemoryStore(passphraseRetriever))\n\tinterfaces.CreateListKeyCryptoServiceInterfaceBehaviorTests(t, cs, data.ECDSAKey)\n\n\tcs = NewCryptoService(trustmanager.NewKeyMemoryStore(passphraseRetriever))\n\tinterfaces.AddGetKeyCryptoServiceInterfaceBehaviorTests(t, cs, data.ECDSAKey)\n\n\tcs = NewCryptoService(trustmanager.NewKeyMemoryStore(passphraseRetriever))\n\tinterfaces.AddListKeyCryptoServiceInterfaceBehaviorTests(t, cs, data.ECDSAKey)\n}",
"func MockSign(tpl *txbuilder.Template, hsm *pseudohsm.HSM, password string) (bool, error) {\n\terr := txbuilder.Sign(nil, tpl, password, func(_ context.Context, xpub chainkd.XPub, path [][]byte, data [32]byte, password string) ([]byte, error) {\n\t\treturn hsm.XSign(xpub, path, data[:], password)\n\t})\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn txbuilder.SignProgress(tpl), nil\n}",
"func (c *Provider) SigningManager() core.SigningManager {\n\treturn c.signingManager\n}",
"func (mmSignWith *mDigestHolderMockSignWith) Set(f func(signer DigestSigner) (s1 SignedDigestHolder)) *DigestHolderMock {\n\tif mmSignWith.defaultExpectation != nil {\n\t\tmmSignWith.mock.t.Fatalf(\"Default expectation is already set for the DigestHolder.SignWith method\")\n\t}\n\n\tif len(mmSignWith.expectations) > 0 {\n\t\tmmSignWith.mock.t.Fatalf(\"Some expectations are already set for the DigestHolder.SignWith method\")\n\t}\n\n\tmmSignWith.mock.funcSignWith = f\n\treturn mmSignWith.mock\n}",
"func TestNewSignatureVerifierFromKeyring(t *testing.T) {\n\tc, _ := initSign(t)\n\tv, err := NewSignatureVerifierFromKeyring(c.keyring)\n\tif err != nil {\n\t\tt.Error(\"fail to new signature verifier\")\n\t}\n\tkeys := len(v.pubkeys)\n\t// there should be at least one added in the tests.\n\tif keys == 0 {\n\t\tt.Error(\"expected pubkeys but found none\")\n\t}\n}",
"func (m *MockMachine) SignerKey() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SignerKey\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func (m *MockSecurityKey) SigningKeys() []securitykey.SigningKey {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SigningKeys\")\n\tret0, _ := ret[0].([]securitykey.SigningKey)\n\treturn ret0\n}",
"func (mmSignWith *mDigestHolderMockSignWith) When(signer DigestSigner) *DigestHolderMockSignWithExpectation {\n\tif mmSignWith.mock.funcSignWith != nil {\n\t\tmmSignWith.mock.t.Fatalf(\"DigestHolderMock.SignWith mock is already set by Set\")\n\t}\n\n\texpectation := &DigestHolderMockSignWithExpectation{\n\t\tmock: mmSignWith.mock,\n\t\tparams: &DigestHolderMockSignWithParams{signer},\n\t}\n\tmmSignWith.expectations = append(mmSignWith.expectations, expectation)\n\treturn expectation\n}",
"func (ms *MockSigner) Sign(msg []byte) ([]byte, error) {\n\tif ms.Err != nil {\n\t\treturn nil, ms.Err\n\t}\n\n\treturn ms.MockSignature, nil\n}",
"func (m *MockClient) Sign(arg0 []byte) ([]byte, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Sign\", arg0)\n\tret0, _ := ret[0].([]byte)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (m *mCryptographyServiceMockSign) Set(f func(p []byte) (r *insolar.Signature, r1 error)) *CryptographyServiceMock {\n\tm.mainExpectation = nil\n\tm.expectationSeries = nil\n\n\tm.mock.SignFunc = f\n\treturn m.mock\n}",
"func (m *MockCrypto) SignForKBFS(arg0 context.Context, arg1 []byte) (kbfscrypto.SignatureInfo, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SignForKBFS\", arg0, arg1)\n\tret0, _ := ret[0].(kbfscrypto.SignatureInfo)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func TestReSign(t *testing.T) {\n\ttestKey, _ := pem.Decode([]byte(testKeyPEM1))\n\tk := data.NewPublicKey(data.RSAKey, testKey.Bytes)\n\tmockCryptoService := &MockCryptoService{testKey: k}\n\ttestData := data.Signed{}\n\n\tSign(mockCryptoService, &testData, k)\n\tSign(mockCryptoService, &testData, k)\n\n\tif len(testData.Signatures) != 1 {\n\t\tt.Fatalf(\"Incorrect number of signatures: %d\", len(testData.Signatures))\n\t}\n\n\tif testData.Signatures[0].KeyID != testKeyID1 {\n\t\tt.Fatalf(\"Wrong signature ID returned: %s\", testData.Signatures[0].KeyID)\n\t}\n\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
SigningManager indicates an expected call of SigningManager
|
func (mr *MockProvidersMockRecorder) SigningManager() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SigningManager", reflect.TypeOf((*MockProviders)(nil).SigningManager))
}
|
[
"func (mr *MockClientMockRecorder) SigningManager() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SigningManager\", reflect.TypeOf((*MockClient)(nil).SigningManager))\n}",
"func (mr *MockProvidersMockRecorder) SigningManager() *gomock.Call {\r\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SigningManager\", reflect.TypeOf((*MockProviders)(nil).SigningManager))\r\n}",
"func (pc *MockProviderContext) SigningManager() fab.SigningManager {\n\treturn pc.signingManager\n}",
"func (m *MetricsProvider) SignerSign(value time.Duration) {\n}",
"func (c *Provider) SigningManager() core.SigningManager {\n\treturn c.signingManager\n}",
"func TestSignContractFailure(t *testing.T) {\n\tsignatureHelper(t, true)\n}",
"func setDefaultSignerVerifier(c *conf.Conf) error {\n\tsign, err := CreateSign(c.PublicAddr.IA, c.Store)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.SetSigner(ctrl.NewBasicSigner(sign, c.GetSigningKey()))\n\tc.SetVerifier(&SigVerifier{&ctrl.BasicSigVerifier{}})\n\treturn nil\n}",
"func TestAnteHandlerSigErrors(t *testing.T) {\n\t// setup\n\tinput := setupTestInput()\n\tctx := input.ctx\n\tanteHandler := NewAnteHandler(input.ak, input.sk, DefaultSigVerificationGasConsumer)\n\n\t// keys and addresses\n\tpriv1, _, addr1 := types.KeyTestPubAddr()\n\tpriv2, _, addr2 := types.KeyTestPubAddr()\n\tpriv3, _, addr3 := types.KeyTestPubAddr()\n\n\t// msg and signatures\n\tvar tx sdk.Tx\n\tmsg1 := types.NewTestMsg(addr1, addr2)\n\tmsg2 := types.NewTestMsg(addr1, addr3)\n\tfee := types.NewTestStdFee()\n\n\tmsgs := []sdk.Msg{msg1, msg2}\n\n\t// test no signatures\n\tprivs, accNums, seqs := []crypto.PrivKey{}, []uint64{}, []uint64{}\n\ttx = types.NewTestTx(ctx, msgs, privs, accNums, seqs, fee)\n\n\t// tx.GetSigners returns addresses in correct order: addr1, addr2, addr3\n\texpectedSigners := []sdk.AccAddress{addr1, addr2, addr3}\n\tstdTx := tx.(types.StdTx)\n\trequire.Equal(t, expectedSigners, stdTx.GetSigners())\n\n\t// Check no signatures fails\n\tcheckInvalidTx(t, anteHandler, ctx, tx, false, sdk.CodeNoSignatures)\n\n\t// test num sigs dont match GetSigners\n\tprivs, accNums, seqs = []crypto.PrivKey{priv1}, []uint64{0}, []uint64{0}\n\ttx = types.NewTestTx(ctx, msgs, privs, accNums, seqs, fee)\n\tcheckInvalidTx(t, anteHandler, ctx, tx, false, sdk.CodeUnauthorized)\n\n\t// test an unrecognized account\n\tprivs, accNums, seqs = []crypto.PrivKey{priv1, priv2, priv3}, []uint64{0, 1, 2}, []uint64{0, 0, 0}\n\ttx = types.NewTestTx(ctx, msgs, privs, accNums, seqs, fee)\n\tcheckInvalidTx(t, anteHandler, ctx, tx, false, sdk.CodeUnknownAddress)\n\n\t// save the first account, but second is still unrecognized\n\tacc1 := input.ak.NewAccountWithAddress(ctx, addr1)\n\tacc1.SetCoins(fee.Amount)\n\tinput.ak.SetAccount(ctx, acc1)\n\tcheckInvalidTx(t, anteHandler, ctx, tx, false, sdk.CodeUnknownAddress)\n}",
"func (client ManagementClient) SignSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client,\n\t\treq,\n\t\tautorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}",
"func (m *MockProviders) SigningManager() core.SigningManager {\r\n\tret := m.ctrl.Call(m, \"SigningManager\")\r\n\tret0, _ := ret[0].(core.SigningManager)\r\n\treturn ret0\r\n}",
"func (mr *MockKMSAPIMockRecorder) Sign(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Sign\", reflect.TypeOf((*MockKMSAPI)(nil).Sign), arg0)\n}",
"func TestBadSign(t *testing.T) {\n\tc, _ := initSign(t)\n\ttag := \"1\"\n\tdata := []byte(\"Good\")\n\n\tc.keyring.RemoveAll()\n\tsig, err := c.Sign(tag, data)\n\tif sig != nil || err == nil {\n\t\tt.Error(\"sign succeeded with empty keyring\")\n\t}\n\n\tc.keyring = newBadStubKeyring()\n\tsig, err = c.Sign(tag, nil)\n\tif sig != nil || err == nil {\n\t\tt.Error(\"sign succeeded with bad keyring\")\n\t}\n\n\tc.keyring = nil\n\tsig, err = c.Sign(tag, data)\n\tif sig != nil || err == nil {\n\t\tt.Error(\"sign succeeded with nil keyring\")\n\t}\n}",
"func TestSignatureWrongSignature(t *testing.T) {\n\t// disable some sigs in macOS/OSX\n\tif runtime.GOOS == \"darwin\" {\n\t\tdisabledSigPatterns = []string{\"Rainbow-III\", \"Rainbow-V\"}\n\t}\n\t// disable some sigs in Windows\n\tif runtime.GOOS == \"windows\" {\n\t\tdisabledSigPatterns = []string{\"Rainbow-V\"}\n\t}\n\tmsg := []byte(\"This is our favourite message to sign\")\n\t// first test sigs that belong to noThreadSigPatterns[] in the main\n\t// goroutine, due to issues with stack size being too small in macOS or\n\t// Windows\n\tcnt := 0\n\tfor _, sigName := range oqs.EnabledSigs() {\n\t\tif stringMatchSlice(sigName, disabledSigPatterns) {\n\t\t\tcnt++\n\t\t\tcontinue\n\t\t}\n\t\t// issues with stack size being too small\n\t\tif stringMatchSlice(sigName, noThreadSigPatterns) {\n\t\t\tcnt++\n\t\t\ttestSigWrongSignature(sigName, msg, false, t)\n\t\t}\n\t}\n\t// test the remaining sigs in separate goroutines\n\twgSigWrongSignature.Add(len(oqs.EnabledSigs()) - cnt)\n\tfor _, sigName := range oqs.EnabledSigs() {\n\t\tif stringMatchSlice(sigName, disabledSigPatterns) {\n\t\t\twgSigWrongSignature.Done()\n\t\t\tcontinue\n\t\t}\n\t\tif !stringMatchSlice(sigName, noThreadSigPatterns) {\n\t\t\tgo testSigWrongSignature(sigName, msg, true, t)\n\t\t}\n\t}\n\twgSigWrongSignature.Wait()\n}",
"func (m *DigestHolderMock) MinimockSignWithDone() bool {\n\tfor _, e := range m.SignWithMock.expectations {\n\t\tif mm_atomic.LoadUint64(&e.Counter) < 1 {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// if default expectation was set then invocations count should be greater than zero\n\tif m.SignWithMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterSignWithCounter) < 1 {\n\t\treturn false\n\t}\n\t// if func was set then invocations count should be greater than zero\n\tif m.funcSignWith != nil && mm_atomic.LoadUint64(&m.afterSignWithCounter) < 1 {\n\t\treturn false\n\t}\n\treturn true\n}",
"func setDefaultSignerVerifier(c *conf.Conf) error {\n\tsign, err := trust.CreateSign(c.PublicAddr.IA, c.Store)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.SetSigner(ctrl.NewBasicSigner(sign, c.GetSigningKey()))\n\tc.SetVerifier(ctrl.NewBasicSigVerifier(c.Store))\n\treturn nil\n}",
"func TestNewSignatureVerifierFromKeyring(t *testing.T) {\n\tc, _ := initSign(t)\n\tv, err := NewSignatureVerifierFromKeyring(c.keyring)\n\tif err != nil {\n\t\tt.Error(\"fail to new signature verifier\")\n\t}\n\tkeys := len(v.pubkeys)\n\t// there should be at least one added in the tests.\n\tif keys == 0 {\n\t\tt.Error(\"expected pubkeys but found none\")\n\t}\n}",
"func TestSignContractSuccess(t *testing.T) {\n\tsignatureHelper(t, false)\n}",
"func TestVerifySignedMessage(t *testing.T) {\n\tfor _, tc := range []struct {\n\t\tdesc string\n\t\tsettings *crypt.PkiSettings\n\t\tsetup func(mdb *mocks.MockDepsBundle, setupDone *bool) error\n\t\tmessageToSign string\n\t\tbase64Signature string\n\t\tPEMPublicKey string\n\t\texpectedError *testtools.ErrorSpec\n\t\texpectedValidity bool\n\t}{\n\t\t{\n\t\t\tdesc: \"invalid base64 signature\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"@#$^&*()_\",\n\t\t\tPEMPublicKey: \"\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"base64.CorruptInputError\",\n\t\t\t\tMessage: \"illegal base64 data at input byte 0\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"empty PEM key\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"abcdefgh\",\n\t\t\tPEMPublicKey: \"\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"*errors.errorString\",\n\t\t\t\tMessage: \"No PEM data was found\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"bad key data\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"abcdefgh\",\n\t\t\tPEMPublicKey: \"-----BEGIN INVALID DATA-----\\n\" +\n\t\t\t\t\"MTIzNDU2Nzg5MGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6\\n\" +\n\t\t\t\t\"-----END INVALID DATA-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"asn1.StructuralError\",\n\t\t\t\tMessage: \"asn1: structure \" +\n\t\t\t\t\t\"error: tags don't match (16 vs {class:0 \" +\n\t\t\t\t\t\"tag:17 \" +\n\t\t\t\t\t\"length:50 \" +\n\t\t\t\t\t\"isCompound:true}) {optional:false \" +\n\t\t\t\t\t\"explicit:false \" +\n\t\t\t\t\t\"application:false \" +\n\t\t\t\t\t\"defaultValue:<nil> \" +\n\t\t\t\t\t\"tag:<nil> \" +\n\t\t\t\t\t\"stringType:0 \" +\n\t\t\t\t\t\"timeType:0 \" +\n\t\t\t\t\t\"set:false \" +\n\t\t\t\t\t\"omitEmpty:false} publicKeyInfo @2\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"invalid signature\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"abcdefgh\",\n\t\t\tPEMPublicKey: \"-----BEGIN ECDSA PUBLIC KEY-----\\n\" +\n\t\t\t\t\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7WzVjtn9Gk+WHr5xbv8XMvooqU25\\n\" +\n\t\t\t\t\"BhgNjZ/vHZLBdVtCOjk4KxjS1UBfQm0c3TRxWBl3hj2AmnJbCrnGofMHBQ==\\n\" +\n\t\t\t\t\"-----END ECDSA PUBLIC KEY-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"asn1.SyntaxError\",\n\t\t\t\tMessage: \"asn1: syntax error: truncated tag or length\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"ecdsa key for rsa mode\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.RSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"N3SuIdWI7XlXDteTmcOZUd2OBacyUWY+/+A8SC4QUBz9rXnldBqXha6YyGwnTuizxuy6quQ2QDFdtW16dj7EQk3lozfngskyhc2r86q3AUbdFDvrQVphMQhzsgBhHVoMjCL/YRfvtzCTWhBxegjVMLraLDCBb8IZTIqcMYafYyeJTvAnjBuntlZ+14TDuTt14Uqz85T04CXxBEqlIXMMKpTc01ST4Jsxz5HLO+At1htXp5eHOUFtQSilm3G7iO8ynhgPcXHDWfMAWu6VySUoHWCG70pJaCq6ehF7223t0UFOCqAyDyyQyP9yeUHj8F75SPSxfJm8iKXGx2LND/qLYw==\",\n\t\t\tPEMPublicKey: \"-----BEGIN RSA PUBLIC KEY-----\\n\" +\n\t\t\t\t\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7WzVjtn9Gk+WHr5xbv8XMvooqU25\\n\" +\n\t\t\t\t\"BhgNjZ/vHZLBdVtCOjk4KxjS1UBfQm0c3TRxWBl3hj2AmnJbCrnGofMHBQ==\\n\" +\n\t\t\t\t\"-----END RSA PUBLIC KEY-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"*errors.errorString\",\n\t\t\t\tMessage: \"Expecting a *rsa.PublicKey, but encountered a *ecdsa.PublicKey instead\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"rsa key for ecdsa mode\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"MEYCIQDPM0fc/PFauoZzpltH3RpWtlaqRnL0gFk5WFiLMrFqrwIhAIDvlBozU6Ky2UC9xOSq3YZ5iFuO356t9RnHOElaaXFJ\",\n\t\t\tPEMPublicKey: \"-----BEGIN RSA PUBLIC KEY-----\\n\" +\n\t\t\t\t\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzCTTFKQBHfTN8jW6q8PT\\n\" +\n\t\t\t\t\"HNZKWnRPxSt9kpgWmyqFaZnEUipgoKGAxSIsVrl2PJSm5OlgkVzx+MY+LWM64VKM\\n\" +\n\t\t\t\t\"bRpUUGJR3zdMNhwZQX0hjOpLpVJvUwD78utVs8vijrU7sH48usFiaZQYjy4m4hQh\\n\" +\n\t\t\t\t\"63/x4h3KVz7YqUnlRMzYJFT43+AwYzYuEpzWRxtW7IObJPtjtmYVoqva98fF6aj5\\n\" +\n\t\t\t\t\"uHAsvaAgZGBalHXmCiPzKiGU/halzXSPvyJ2Cqz2aUqMHgwi/2Ip4z/mrfX+mUTa\\n\" +\n\t\t\t\t\"S+LyBy7GgqJ5vbkGArMagJIc0eARF60r6Uf483xh17oniABdLJy4qlLf6PcEU+ut\\n\" +\n\t\t\t\t\"EwIDAQAB\\n\" +\n\t\t\t\t\"-----END RSA PUBLIC KEY-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"*errors.errorString\",\n\t\t\t\tMessage: \"Expecting a *ecdsa.PublicKey, but encountered a *rsa.PublicKey instead\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t} {\n\t\tt.Run(fmt.Sprintf(\"Subtest: %s\", tc.desc), func(tt *testing.T) {\n\t\t\tmockDepsBundle := mocks.NewDefaultMockDeps(\"\", []string{\"progname\"}, \"/home/user\", nil)\n\t\t\treturnedNormally := false\n\t\t\tvar tooling *crypt.CryptoTooling\n\t\t\tvar actualErr error\n\t\t\tvar actualValidity bool\n\t\t\terr := mockDepsBundle.InvokeCallInMockedEnv(func() error {\n\t\t\t\tsetupComplete := false\n\t\t\t\tinnerErr := tc.setup(mockDepsBundle, &setupComplete)\n\t\t\t\tif innerErr != nil {\n\t\t\t\t\treturn innerErr\n\t\t\t\t}\n\t\t\t\tvar toolingErr error\n\t\t\t\ttooling, toolingErr = crypt.GetCryptoTooling(mockDepsBundle.Deps, tc.settings)\n\t\t\t\tif toolingErr != nil {\n\t\t\t\t\treturn toolingErr\n\t\t\t\t}\n\t\t\t\tsetupComplete = true\n\t\t\t\tactualValidity, actualErr = tooling.VerifySignedMessage(tc.messageToSign, tc.base64Signature, tc.PEMPublicKey)\n\t\t\t\treturnedNormally = true\n\t\t\t\treturn nil\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\ttt.Errorf(\"Unexpected error calling mockDepsBundle.InvokeCallInMockedEnv(): %s\", err.Error())\n\t\t\t}\n\t\t\tif exitStatus := mockDepsBundle.GetExitStatus(); (exitStatus != 0) || !returnedNormally {\n\t\t\t\ttt.Error(\"EncodeAndSaveKey() should not have paniced or called os.Exit.\")\n\t\t\t}\n\t\t\tif (mockDepsBundle.OutBuf.String() != \"\") || (mockDepsBundle.ErrBuf.String() != \"\") {\n\t\t\t\ttt.Errorf(\"EncodeAndSaveKey() should not have output any data. Saw stdout:\\n%s\\nstderr:\\n%s\", mockDepsBundle.OutBuf.String(), mockDepsBundle.ErrBuf.String())\n\t\t\t}\n\t\t\tif err := tc.expectedError.EnsureMatches(actualErr); err != nil {\n\t\t\t\ttt.Error(err.Error())\n\t\t\t}\n\t\t\tif tc.expectedError == nil {\n\t\t\t\tif actualValidity != tc.expectedValidity {\n\t\t\t\t\ttt.Errorf(\"Signature is %#v when %#v expected\", actualValidity, tc.expectedValidity)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif tc.expectedValidity {\n\t\t\t\t\ttt.Error(\"TEST CASE INVALID. Should not expect \\\"valid\\\".\")\n\t\t\t\t}\n\t\t\t\tif actualValidity {\n\t\t\t\t\ttt.Error(\"Error was expected. Should not report \\\"valid\\\".\")\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}",
"func (validator *validatorImpl) Sign(msg []byte) ([]byte, error) {\n\treturn validator.signWithEnrollmentKey(msg)\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
UserStore mocks base method
|
func (m *MockProviders) UserStore() msp.UserStore {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "UserStore")
ret0, _ := ret[0].(msp.UserStore)
return ret0
}
|
[
"func (m *MockRepository) Store(arg0 context.Context, arg1 pg.User) (*uuid.UUID, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Store\", arg0, arg1)\n\tret0, _ := ret[0].(*uuid.UUID)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (_m *UsersRepository) Store(users *entities.User) error {\n\tret := _m.Called(users)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(*entities.User) error); ok {\n\t\tr0 = rf(users)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}",
"func (userRepo *mockUserRepo) Initialize(ctx context.Context, db *sql.DB) {}",
"func MockUserItemStorage() *mongoDB.UserItemStorage {\n\treturn &mongoDB.UserItemStorage{\n\t\tUserID: \"Test\",\n\t\tPrices: make(map[string]models.UserPrices),\n\t\tProfits: make(map[string]models.UserProfits),\n\t}\n}",
"func (m *MockStore) GetUser(arg0 context.Context, arg1 int64) (db.User, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetUser\", arg0, arg1)\n\tret0, _ := ret[0].(db.User)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (suite *StoreTestSuite) Test001_User() {\n\tusername := \"foo\"\n\temail := \"bar\"\n\tpw := \"baz\"\n\trole := 1337\n\n\t// Test CreateUser\n\tnewUser := &schema.User{\n\t\tUsername: &username,\n\t\tEmail: &email,\n\t\tPassword: &pw,\n\t\tRole: &role,\n\t}\n\terr := suite.store.CreateUser(newUser)\n\tsuite.Nil(err)\n\n\t// Test GetUserByUsername\n\tuser, err := suite.store.GetUserByUsername(username)\n\tsuite.Nil(err)\n\tsuite.NotNil(user)\n\tsuite.Equal(username, user.Username)\n\tsuite.Equal(email, user.Email)\n\n\tid := user.ID.Hex()\n\n\t// Test GetUserByEmail\n\tuser, err = suite.store.GetUserByEmail(email)\n\tsuite.Nil(err)\n\tsuite.NotNil(user)\n\tsuite.Equal(username, user.Username)\n\tsuite.Equal(email, user.Email)\n\n\t// Test GetUserByPassword\n\tuser, err = suite.store.GetUserByCreds(username, pw)\n\tsuite.Nil(err)\n\tsuite.NotNil(user)\n\tsuite.Equal(username, user.Username)\n\tsuite.Equal(email, user.Email)\n\n\t// Test CreateUser with conflict\n\terr = suite.store.CreateUser(newUser)\n\tsuite.NotNil(err)\n\tsuite.Equal(\"user with username as foo already exists\", err.Error())\n\n\t// Test UpdateUser\n\tnewUsername := \"foobar\"\n\tuserPatch := &schema.User{Username: &newUsername}\n\tuser, err = suite.store.UpdateUser(id, userPatch)\n\tsuite.Nil(err)\n\tsuite.Equal(newUsername, user.Username)\n\tsuite.Equal(email, user.Email)\n\tsuite.Equal(role, user.Role)\n\n\t// Add second user\n\terr = suite.store.CreateUser(newUser)\n\tsuite.Nil(err)\n\n\t// Try to update second user\n\tu, err := suite.store.GetUserByUsername(*newUser.Username)\n\tsuite.Nil(err)\n\n\tuser, err = suite.store.UpdateUser(u.ID.Hex(), userPatch)\n\tsuite.Nil(user)\n\tsuite.True(mgo.IsDup(err))\n\n\t// Test GetAllUsers\n\tusers, err := suite.store.GetAllUsers()\n\tsuite.Nil(err)\n\tsuite.Equal(len(users), 2)\n\n\t// Test DeleteUser\n\tuser, err = suite.store.DeleteUser(id)\n\tsuite.Nil(err)\n\tsuite.NotNil(user)\n\tsuite.Equal(newUsername, user.Username)\n\tsuite.Equal(email, user.Email)\n}",
"func (_m *Repository) Store(ur *models.UserRole) error {\n\tret := _m.Called(ur)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(*models.UserRole) error); ok {\n\t\tr0 = rf(ur)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}",
"func (_e *Repository_Expecter) StoreUser(ctx interface{}, user interface{}) *Repository_StoreUser_Call {\n\treturn &Repository_StoreUser_Call{Call: _e.mock.On(\"StoreUser\", ctx, user)}\n}",
"func TestStore_CreateUser(t *testing.T) {\n\tt.Parallel()\n\ts := MustOpenStore()\n\tdefer s.Close()\n\n\t// Create user.\n\tif ui, err := s.CreateUser(\"susy\", \"pass\", true); err != nil {\n\t\tt.Fatal(err)\n\t} else if ui.Name != \"susy\" || ui.Hash == \"\" || ui.Admin != true {\n\t\tt.Fatalf(\"unexpected user: %#v\", ui)\n\t}\n}",
"func (m *MockRepository) Store(ctx context.Context, data *users.Domain) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Store\", ctx, data)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func TestDbInterfaceMethods(t *testing.T) {\n\ttestUser := models.User{\n\t\tAccount: models.Account{\n\t\t\tType: \"email\",\n\t\t\tAccountID: \"[email protected]\",\n\t\t\tPassword: \"testhashedpassword-youcantreadme\",\n\t\t},\n\t\tRoles: []string{\"TEST\"},\n\t\tTimestamps: models.Timestamps{\n\t\t\tCreatedAt: time.Now().Unix(),\n\t\t},\n\t}\n\n\tt.Run(\"Testing create user\", func(t *testing.T) {\n\t\tid, err := testDBService.AddUser(testInstanceID, testUser)\n\t\tif err != nil {\n\t\t\tt.Errorf(err.Error())\n\t\t\treturn\n\t\t}\n\t\tif len(id) == 0 {\n\t\t\tt.Errorf(\"id is missing\")\n\t\t\treturn\n\t\t}\n\t\t_id, _ := primitive.ObjectIDFromHex(id)\n\t\ttestUser.ID = _id\n\t})\n\n\tt.Run(\"Testing creating existing user\", func(t *testing.T) {\n\t\ttestUser2 := testUser\n\t\ttestUser2.Roles = []string{\"TEST2\"}\n\t\t_, err := testDBService.AddUser(testInstanceID, testUser2)\n\t\tif err == nil {\n\t\t\tt.Errorf(\"user already existed, but created again\")\n\t\t\treturn\n\t\t}\n\t\tu, e := testDBService.GetUserByAccountID(testInstanceID, testUser2.Account.AccountID)\n\t\tif e != nil {\n\t\t\tt.Errorf(e.Error())\n\t\t\treturn\n\t\t}\n\t\tif len(u.Roles) > 0 && u.Roles[0] == \"TEST2\" {\n\t\t\tt.Error(\"user should not be updated\")\n\t\t}\n\t})\n\n\tt.Run(\"Testing find existing user by id\", func(t *testing.T) {\n\t\tuser, err := testDBService.GetUserByID(testInstanceID, testUser.ID.Hex())\n\t\tif err != nil {\n\t\t\tt.Errorf(err.Error())\n\t\t\treturn\n\t\t}\n\t\tif user.Account.AccountID != testUser.Account.AccountID {\n\t\t\tt.Errorf(\"found user is not matching test user\")\n\t\t\treturn\n\t\t}\n\t})\n\n\tt.Run(\"Testing find not existing user by id\", func(t *testing.T) {\n\t\t_, err := testDBService.GetUserByID(testInstanceID, testUser.ID.Hex()+\"1\")\n\t\tif err == nil {\n\t\t\tt.Errorf(\"user should not be found\")\n\t\t\treturn\n\t\t}\n\t})\n\n\tt.Run(\"Testing find existing user by email\", func(t *testing.T) {\n\t\tuser, err := testDBService.GetUserByAccountID(testInstanceID, testUser.Account.AccountID)\n\t\tif err != nil {\n\t\t\tt.Errorf(err.Error())\n\t\t\treturn\n\t\t}\n\t\tif user.Account.AccountID != testUser.Account.AccountID {\n\t\t\tt.Errorf(\"found user is not matching test user\")\n\t\t\treturn\n\t\t}\n\t})\n\n\tt.Run(\"Testing find not existing user by email\", func(t *testing.T) {\n\t\t_, err := testDBService.GetUserByAccountID(testInstanceID, testUser.Account.AccountID+\"1\")\n\t\tif err == nil {\n\t\t\tt.Errorf(\"user should not be found\")\n\t\t\treturn\n\t\t}\n\t})\n\n\tt.Run(\"Testing updating existing user's attributes\", func(t *testing.T) {\n\t\ttestUser.Account.AccountConfirmedAt = time.Now().Unix()\n\t\t_, err := testDBService.UpdateUser(testInstanceID, testUser)\n\t\tif err != nil {\n\t\t\tt.Errorf(err.Error())\n\t\t\treturn\n\t\t}\n\t})\n\n\tt.Run(\"Testing updating not existing user's attributes\", func(t *testing.T) {\n\t\ttestUser.Account.AccountConfirmedAt = time.Now().Unix()\n\t\tcurrentUser := testUser\n\t\twrongID := testUser.ID.Hex()[:len(testUser.ID.Hex())-2] + \"00\"\n\t\tid, err := primitive.ObjectIDFromHex(wrongID)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t\treturn\n\t\t}\n\t\tcurrentUser.ID = id\n\t\t_, err = testDBService.UpdateUser(testInstanceID, currentUser)\n\t\tif err == nil {\n\t\t\tt.Errorf(\"cannot update not existing user\")\n\t\t\treturn\n\t\t}\n\t})\n\n\tt.Run(\"Testing counting recently added users\", func(t *testing.T) {\n\t\tcount, err := testDBService.CountRecentlyCreatedUsers(testInstanceID, 20)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"unexpected error: %v\", err)\n\t\t\treturn\n\n\t\t}\n\t\tlogger.Debug.Println(count)\n\t\tif count < 1 {\n\t\t\tt.Error(\"at least one user should be found\")\n\t\t}\n\t})\n\n\tt.Run(\"Testing deleting existing user\", func(t *testing.T) {\n\t\terr := testDBService.DeleteUser(testInstanceID, testUser.ID.Hex())\n\t\tif err != nil {\n\t\t\tt.Errorf(err.Error())\n\t\t\treturn\n\t\t}\n\t})\n\n\tt.Run(\"Testing deleting not existing user\", func(t *testing.T) {\n\t\terr := testDBService.DeleteUser(testInstanceID, testUser.ID.Hex()+\"1\")\n\t\tif err == nil {\n\t\t\tt.Errorf(\"user should not be found - error expected\")\n\t\t\treturn\n\t\t}\n\t})\n}",
"func TestStore_UserCount(t *testing.T) {\n\tt.Parallel()\n\ts := MustOpenStore()\n\tdefer s.Close()\n\n\tif count, err := s.UserCount(); count != 0 && err != nil {\n\t\tt.Fatalf(\"expected user count to be 0 but was %d\", count)\n\t}\n\n\t// Create users.\n\tif _, err := s.CreateUser(\"susy\", \"pass\", true); err != nil {\n\t\tt.Fatal(err)\n\t} else if _, err := s.CreateUser(\"bob\", \"pass\", true); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif count, err := s.UserCount(); count != 2 && err != nil {\n\t\tt.Fatalf(\"expected user count to be 2 but was %d\", count)\n\t}\n}",
"func (userAfhRepo *mockUserAfhRepo) Initialize(ctx context.Context, db *sql.DB) {}",
"func (m *MockUserHandler) Save(c *gin.Context) {\n\tm.ctrl.Call(m, \"Save\", c)\n}",
"func TestInitAndGetBasics(t *testing.T) {\n\tuserlib.SetDebugStatus(false)\n\tuserlib.DatastoreClear()\n\tuserlib.KeystoreClear()\n\tdatastore := userlib.DatastoreGetMap()\n\tkeystore := userlib.KeystoreGetMap()\n\t_, _ = datastore, keystore\n\n\tbob, err := InitUser(\"bob\", \"fubar\")\n\tif bob == nil || err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\tgetBob, err := GetUser(\"bob\", \"fubar\")\n\tif getBob == nil || err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\n\tbobBytes, _ := json.Marshal(bob)\n\tgetBobBytes, _ := json.Marshal(getBob)\n\tif !reflect.DeepEqual(bobBytes, getBobBytes) {\n\t\tt.Error(\"Init and Get userdata are not the same.\")\n\t\treturn\n\t}\n\n\t_, err = GetUser(\"bob\", \"wrong\")\n\tif err == nil {\n\t\tt.Error(\"Got a user that is suppose to not exist.\")\n\t\treturn\n\t}\n\n\t_, err = GetUser(\"wrong\", \"fubar\")\n\tif err == nil {\n\t\tt.Error(\"Got a user that is suppose to not exist.\")\n\t\treturn\n\t}\n\n\tvar keys []userlib.UUID\n\tvar vals [][]byte\n\tfor k, v := range datastore {\n\t\tkeys = append(keys, k)\n\t\tvals = append(vals, v)\n\t}\n\n\tfor val := range vals {\n\t\tif strings.Contains(\"bob\", string(val)) || strings.Contains(\"alice\", string(val)) {\n\t\t\tt.Error(\"Username is not obscured.\")\n\t\t\treturn\n\t\t}\n\t}\n\n}",
"func (m *MockUserLogic) UserGet(userName string) (*domain.User, string, error) {\n\tret := m.ctrl.Call(m, \"UserGet\", userName)\n\tret0, _ := ret[0].(*domain.User)\n\tret1, _ := ret[1].(string)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}",
"func (m *MockHandler) UserGet(userName string) (*domain.User, string, error) {\n\tret := m.ctrl.Call(m, \"UserGet\", userName)\n\tret0, _ := ret[0].(*domain.User)\n\tret1, _ := ret[1].(string)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}",
"func (m *MockStore) GetUserByUserName(arg0 context.Context, arg1 string) (db.User, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetUserByUserName\", arg0, arg1)\n\tret0, _ := ret[0].(db.User)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func TestPostgresStore(t *testing.T) {\n\t//Preparing a Postgres data abstraction for later use\n\tpsdb, err := sql.Open(\"postgres\", \"user=pgstest dbname=devourpg sslmode=disable\")\n\tif err != nil {\n\t\tt.Errorf(\"error starting db: %v\", err)\n\t}\n\t//Creates the store structure\n\tstore := &PGStore{\n\t\tDB: psdb,\n\t}\n\n\tusrStore := &users.PGStore{\n\t\tDB: psdb,\n\t}\n\t//Pings the DB-- establishes a connection to the db\n\terr = psdb.Ping()\n\tif err != nil {\n\t\tt.Errorf(\"error pinging db %v\", err)\n\t}\n\n\tnewUser := &users.NewUser{\n\t\tEmail: \"[email protected]\",\n\t\tPassword: \"password\",\n\t\tPasswordConf: \"password\",\n\t\tDOB: \"12/12/1990\",\n\t\tFirstName: \"test\",\n\t\tLastName: \"tester\",\n\t}\n\tnu2 := &users.NewUser{\n\t\tEmail: \"[email protected]\",\n\t\tPassword: \"password\",\n\t\tPasswordConf: \"password\",\n\t\tDOB: \"12/20/2000\",\n\t\tFirstName: \"best\",\n\t\tLastName: \"bester\",\n\t}\n\n\t//reset the auto increment counter and clears previous test users in the DB\n\t_, err = psdb.Exec(\"ALTER SEQUENCE users_id_seq RESTART\")\n\t_, err = psdb.Exec(\"ALTER SEQUENCE user_diet_type_id_seq RESTART\")\n\t_, err = psdb.Exec(\"ALTER SEQUENCE user_allergy_type_id_seq RESTART\")\n\t_, err = psdb.Exec(\"ALTER SEQUENCE grocery_list_id_seq RESTART\")\n\t_, err = psdb.Exec(\"ALTER SEQUENCE user_like_list_id_seq RESTART\")\n\t_, err = psdb.Exec(\"ALTER SEQUENCE friends_list_id_seq RESTART\")\n\t_, err = psdb.Exec(\"ALTER SEQUENCE event_attendance_id_seq RESTART\")\n\t_, err = psdb.Exec(\"ALTER SEQUENCE events_id_seq RESTART\")\n\t_, err = psdb.Exec(\"ALTER SEQUENCE recipe_suggestions_id_seq RESTART\")\n\t_, err = psdb.Exec(\"DELETE FROM users\")\n\t_, err = psdb.Exec(\"DELETE FROM user_diet_type\")\n\t_, err = psdb.Exec(\"DELETE FROM user_allergy_type\")\n\t_, err = psdb.Exec(\"DELETE FROM grocery_list\")\n\t_, err = psdb.Exec(\"DELETE FROM user_like_list\")\n\t_, err = psdb.Exec(\"DELETE FROM friends_list\")\n\t_, err = psdb.Exec(\"DELETE FROM event_attendance\")\n\t_, err = psdb.Exec(\"DELETE FROM events\")\n\t_, err = psdb.Exec(\"DELETE FROM recipe_suggestions\")\n\n\t//start of insert\n\tuser, err := usrStore.Insert(newUser)\n\tif err != nil {\n\t\tt.Errorf(\"error inserting user: %v\\n\", err)\n\t}\n\t//means that ToUser() probably was not implemented correctly\n\tif nil == user {\n\t\tt.Fatalf(\"Nil returned from store.Insert()\\n\")\n\t}\n\t//start of insert\n\tuser2, err := usrStore.Insert(nu2)\n\tif err != nil {\n\t\tt.Errorf(\"error inserting user: %v\\n\", err)\n\t}\n\t//means that ToUser() probably was not implemented correctly\n\tif nil == user2 {\n\t\tt.Fatalf(\"Nil returned from store.Insert()\\n\")\n\t}\n\n\tnewEvt := &NewEvent{\n\t\tName: \"testEVENT\",\n\t\tDescription: \"testDescription\",\n\t\tStartTime: \"March 5, 2017 at 4:00pm (PST)\",\n\t\tEndTime: \"March 5, 2017 at 7:00pm (PST)\",\n\t\tEventType: \"Formal\",\n\t\tMoodType: \"Fancy\",\n\t}\n\tnewJuneEvt := &NewEvent{\n\t\tName: \"testFutureEVENT\",\n\t\tDescription: \"testFutureDescription\",\n\t\tStartTime: \"June 5, 2017 at 4:00pm (PST)\",\n\t\tEndTime: \"June 5, 2017 at 7:00pm (PST)\",\n\t\tEventType: \"Formal\",\n\t\tMoodType: \"Fancy\",\n\t}\n\n\t//insert event\n\tevt, err := store.InsertEvent(newEvt, user)\n\tif err != nil {\n\t\tt.Errorf(\"error inserting new event %v\\n\", err)\n\t}\n\tif evt.Name != \"testEVENT\" {\n\t\tt.Errorf(\"error making event expected creator %s but got %s\", \"testEvent\", evt.Name)\n\t}\n\n\tevt2, err := store.InsertEvent(newJuneEvt, user)\n\tif err != nil {\n\t\tt.Errorf(\"error inserting new event %v\\n\", err)\n\t}\n\n\t//invite user to the event\n\tatn, err := store.InviteUserToEvent(user2, evt)\n\tif err != nil {\n\t\tt.Errorf(\"error inviting user to event %v\\n\", err)\n\t}\n\n\t//Getting user attendance status\n\tatnStat, err := store.GetUserAttendanceStatus(user2, evt)\n\tif err != nil {\n\t\tt.Errorf(\"Error getting user's attendance status\")\n\t}\n\n\tif atnStat.AttendanceStatus != \"Pending\" {\n\t\tt.Errorf(\"Error getting the attendance status expected %s but got %s\", \"Pending\", atnStat.AttendanceStatus)\n\t}\n\n\tif atn.StatusID != atnStat.ID {\n\t\tt.Errorf(\"Error getting the correct attendance status ID expected %d but got %d\", atn.StatusID, atnStat.ID)\n\t}\n\n\t//Lets first reject that invite\n\terr = store.RejectInvite(evt, user2)\n\tif err != nil {\n\t\tt.Errorf(\"Error rejecting the invite %v\\n\", err)\n\t}\n\n\t//Now invite the user again\n\tatn, err = store.InviteUserToEvent(user2, evt)\n\tif err != nil {\n\t\tt.Errorf(\"error inviting user to event %v\\n\", err)\n\t}\n\n\t//Updating attendance status\n\terr = store.UpdateAttendanceStatus(user2, evt, \"Attending\")\n\tif err != nil {\n\t\tt.Errorf(\"Error getting an updated attendance status\")\n\t}\n\n\t//Getting the updated attendance status\n\tatnStat, err = store.GetUserAttendanceStatus(user2, evt)\n\tif err != nil {\n\t\tt.Errorf(\"Error getting user's attendance status\")\n\t}\n\tif atnStat.AttendanceStatus != \"Attending\" {\n\t\tt.Errorf(\"Error getting the correct UPDATED status: expected Attending but got %s\", atnStat.AttendanceStatus)\n\t}\n\n\t//Updating attendance status\n\terr = store.UpdateAttendanceStatus(user2, evt, \"Pending\")\n\tif err != nil {\n\t\tt.Errorf(\"Error getting an updated attendance status\")\n\t}\n\n\t//updating event stuff\n\terr = store.UpdateEventName(evt, \"UpdatedTestName\")\n\tif err != nil {\n\t\tt.Errorf(\"Error updating event name %v\", err)\n\t}\n\n\terr = store.UpdateEventDescription(evt, \"UpdatedDescription\")\n\tif err != nil {\n\t\tt.Errorf(\"Error updating event description %v\", err)\n\t}\n\n\terr = store.UpdateEventMood(evt, \"Focused\")\n\tif err != nil {\n\t\tt.Errorf(\"Error updating event mood %v\", err)\n\t}\n\n\terr = store.UpdateEventType(evt, \"Other\")\n\tif err != nil {\n\t\tt.Errorf(\"Error updating event type %v\", err)\n\t}\n\n\terr = store.UpdateEventEnd(evt, \"March 6, 2017 at 12:00pm (PST)\")\n\tif err != nil {\n\t\tt.Errorf(\"Error updating event end %v\", err)\n\t}\n\n\terr = store.UpdateEventStart(evt, \"March 1, 2017 at 2:20pm (PST)\")\n\tif err != nil {\n\t\tt.Errorf(\"Error updating event start %v\", err)\n\t}\n\n\tupEvents, err := store.GetAllHostedEvents(user)\n\tif err != nil {\n\t\tt.Errorf(\"Error getting all of the users store: %v\", err)\n\t}\n\tif upEvents[0].Name != \"UpdatedTestName\" {\n\t\tt.Errorf(\"Error updating stuffs %v\", err)\n\t}\n\n\t//Adding a Recipe to an event, recipes are strings\n\tRecipeName := \"French-Onion-Soup\"\n\n\t//Adding two recipes into event\n\tsugg, err := store.AddRecipeToEvent(evt, user, RecipeName)\n\tif err != nil {\n\t\tt.Errorf(\"Error adding recipe to an event: %v\\n\", err)\n\t}\n\t_, err = store.AddRecipeToEvent(evt, user2, RecipeName)\n\tif err != nil {\n\t\tt.Errorf(\"Error adding recipe to an event: %v\\n\", err)\n\t}\n\n\t//Getting all recipes in event\n\trecipes, err := store.GetAllRecipesInEvent(evt)\n\tif err != nil {\n\t\tt.Errorf(\"Error getting all recipes in an event: %v\\n\", err)\n\t}\n\tif recipes[0] != sugg.Recipe {\n\t\tt.Errorf(\"Error with getting recipes expected %s but got %s\", sugg.Recipe, recipes[0])\n\t}\n\n\t//Removing user2's recipe from the event\n\terr = store.RemoveRecipeFromEvent(evt, user2, RecipeName)\n\tif err != nil {\n\t\tt.Errorf(\"Error deleting recipe from the event: %v\\n\", err)\n\t}\n\n\t//Getting all of the users in the event\n\t_, err = store.GetAllUsersInEvent(evt)\n\tif err != nil {\n\t\tt.Errorf(\"Error getting all users %v\\n\", err)\n\t}\n\n\t//Gets all pending events that a user has\n\tpendingEvts, err := store.GetAllPendingEvents(user2)\n\tif err != nil {\n\t\tt.Errorf(\"Error getting all pending events: %v\\n\", err)\n\t}\n\tif pendingEvts[0].ID != evt.ID {\n\t\tt.Errorf(\"Error getting the correct event: expected %d and got %d\", pendingEvts[0].ID, evt.ID)\n\t}\n\n\t//Getting past and upcoming events\n\tpastEvts, err := store.GetPastEvents(user)\n\tif err != nil {\n\t\tt.Errorf(\"Error getting past events %v\\n\", err)\n\t}\n\tupcomingEvts, err := store.GetUpcomingEvents(user)\n\tif err != nil {\n\t\tt.Errorf(\"Error getting upcoming events %v\\n\", err)\n\t}\n\n\tif pastEvts[0].ID != evt.ID {\n\t\tt.Errorf(\"Error getting the correct Event: expected %d but got %d\", evt.ID, pastEvts[0].ID)\n\t}\n\tif upcomingEvts[0].ID != evt2.ID {\n\t\tt.Errorf(\"Error getting the correct Event: expected %d but got %d\", evt2.ID, pastEvts[0].ID)\n\t}\n\n\t//Getting all of the users events (attending or hosting)\n\t_, err = store.GetAllUserEvents(user)\n\tif err != nil {\n\t\tt.Errorf(\"Error getting all user events %v\\n\", err)\n\t}\n\n\t_, err = usrStore.AddFriend(user, user2)\n\tif err != nil {\n\t\tt.Errorf(\"Error adding friend %v\\n\", err)\n\t}\n\n\t//Getting all the friends of a user of user going to the event\n\t_, err = store.GetAllFriendsInEvent(user, evt)\n\tif err != nil {\n\t\tt.Errorf(\"Error getting friends in the event %v\\n\", err)\n\t}\n\n\t//Finished updated all things and now delete\n\terr = store.DeleteEvent(evt)\n\tif err != nil {\n\t\tt.Errorf(\"error deleting event %v\", err)\n\t}\n\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
UserStore indicates an expected call of UserStore
|
func (mr *MockProvidersMockRecorder) UserStore() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UserStore", reflect.TypeOf((*MockProviders)(nil).UserStore))
}
|
[
"func (mr *MockClientMockRecorder) UserStore() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UserStore\", reflect.TypeOf((*MockClient)(nil).UserStore))\n}",
"func TestStore_CreateUser(t *testing.T) {\n\tt.Parallel()\n\ts := MustOpenStore()\n\tdefer s.Close()\n\n\t// Create user.\n\tif ui, err := s.CreateUser(\"susy\", \"pass\", true); err != nil {\n\t\tt.Fatal(err)\n\t} else if ui.Name != \"susy\" || ui.Hash == \"\" || ui.Admin != true {\n\t\tt.Fatalf(\"unexpected user: %#v\", ui)\n\t}\n}",
"func TestStore_UserCount(t *testing.T) {\n\tt.Parallel()\n\ts := MustOpenStore()\n\tdefer s.Close()\n\n\tif count, err := s.UserCount(); count != 0 && err != nil {\n\t\tt.Fatalf(\"expected user count to be 0 but was %d\", count)\n\t}\n\n\t// Create users.\n\tif _, err := s.CreateUser(\"susy\", \"pass\", true); err != nil {\n\t\tt.Fatal(err)\n\t} else if _, err := s.CreateUser(\"bob\", \"pass\", true); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif count, err := s.UserCount(); count != 2 && err != nil {\n\t\tt.Fatalf(\"expected user count to be 2 but was %d\", count)\n\t}\n}",
"func TestIncorrectUsers(t *testing.T) {\n\tprov := getFakeProvider(\"user1\")\n\tusr, err := prov.GetUser(nil)\n\trequire.NoError(t, err)\n\tassert.Equal(t, 0, len(usr.(*AuthenticatedUser).Rules))\n}",
"func (_e *Repository_Expecter) StoreUser(ctx interface{}, user interface{}) *Repository_StoreUser_Call {\n\treturn &Repository_StoreUser_Call{Call: _e.mock.On(\"StoreUser\", ctx, user)}\n}",
"func (suite *StoreTestSuite) Test001_User() {\n\tusername := \"foo\"\n\temail := \"bar\"\n\tpw := \"baz\"\n\trole := 1337\n\n\t// Test CreateUser\n\tnewUser := &schema.User{\n\t\tUsername: &username,\n\t\tEmail: &email,\n\t\tPassword: &pw,\n\t\tRole: &role,\n\t}\n\terr := suite.store.CreateUser(newUser)\n\tsuite.Nil(err)\n\n\t// Test GetUserByUsername\n\tuser, err := suite.store.GetUserByUsername(username)\n\tsuite.Nil(err)\n\tsuite.NotNil(user)\n\tsuite.Equal(username, user.Username)\n\tsuite.Equal(email, user.Email)\n\n\tid := user.ID.Hex()\n\n\t// Test GetUserByEmail\n\tuser, err = suite.store.GetUserByEmail(email)\n\tsuite.Nil(err)\n\tsuite.NotNil(user)\n\tsuite.Equal(username, user.Username)\n\tsuite.Equal(email, user.Email)\n\n\t// Test GetUserByPassword\n\tuser, err = suite.store.GetUserByCreds(username, pw)\n\tsuite.Nil(err)\n\tsuite.NotNil(user)\n\tsuite.Equal(username, user.Username)\n\tsuite.Equal(email, user.Email)\n\n\t// Test CreateUser with conflict\n\terr = suite.store.CreateUser(newUser)\n\tsuite.NotNil(err)\n\tsuite.Equal(\"user with username as foo already exists\", err.Error())\n\n\t// Test UpdateUser\n\tnewUsername := \"foobar\"\n\tuserPatch := &schema.User{Username: &newUsername}\n\tuser, err = suite.store.UpdateUser(id, userPatch)\n\tsuite.Nil(err)\n\tsuite.Equal(newUsername, user.Username)\n\tsuite.Equal(email, user.Email)\n\tsuite.Equal(role, user.Role)\n\n\t// Add second user\n\terr = suite.store.CreateUser(newUser)\n\tsuite.Nil(err)\n\n\t// Try to update second user\n\tu, err := suite.store.GetUserByUsername(*newUser.Username)\n\tsuite.Nil(err)\n\n\tuser, err = suite.store.UpdateUser(u.ID.Hex(), userPatch)\n\tsuite.Nil(user)\n\tsuite.True(mgo.IsDup(err))\n\n\t// Test GetAllUsers\n\tusers, err := suite.store.GetAllUsers()\n\tsuite.Nil(err)\n\tsuite.Equal(len(users), 2)\n\n\t// Test DeleteUser\n\tuser, err = suite.store.DeleteUser(id)\n\tsuite.Nil(err)\n\tsuite.NotNil(user)\n\tsuite.Equal(newUsername, user.Username)\n\tsuite.Equal(email, user.Email)\n}",
"func TestStore_DropUser(t *testing.T) {\n\tt.Parallel()\n\ts := MustOpenStore()\n\tdefer s.Close()\n\n\t// Create users.\n\tif _, err := s.CreateUser(\"susy\", \"pass\", true); err != nil {\n\t\tt.Fatal(err)\n\t} else if _, err := s.CreateUser(\"bob\", \"pass\", true); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Remove user.\n\tif err := s.DropUser(\"bob\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Verify user was removed.\n\tif a, err := s.Users(); err != nil {\n\t\tt.Fatal(err)\n\t} else if len(a) != 1 {\n\t\tt.Fatalf(\"unexpected user count: %d\", len(a))\n\t} else if a[0].Name != \"susy\" {\n\t\tt.Fatalf(\"unexpected user: %s\", a[0].Name)\n\t}\n}",
"func (m *MockProviders) UserStore() msp.UserStore {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UserStore\")\n\tret0, _ := ret[0].(msp.UserStore)\n\treturn ret0\n}",
"func (uc *userUsecase) Store(c context.Context, m *models.User) error {\n\tctx, cancel := context.WithTimeout(c, uc.contextTimeout)\n\tdefer cancel()\n\n\terr := uc.userRepo.Store(ctx, m)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}",
"func (mr *MockUserStoreMockRecorder) AddUser(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddUser\", reflect.TypeOf((*MockUserStore)(nil).AddUser), arg0)\n}",
"func (c *Provider) UserStore() msp.UserStore {\n\treturn c.userStore\n}",
"func TestCorrectUsers(t *testing.T) {\n\tprov := getFakeProvider(\"usr1\")\n\tusr, err := prov.GetUser(nil)\n\trequire.NoError(t, err)\n\tassert.Equal(t, 1, len(usr.(*AuthenticatedUser).Rules))\n}",
"func TestSync_StoreError(t *testing.T) {\n\tcontroller := gomock.NewController(t)\n\tdefer controller.Finish()\n\n\tuser := &core.User{ID: 1}\n\tuserStore := mock.NewMockUserStore(controller)\n\tuserStore.EXPECT().Update(gomock.Any(), user).Return(nil)\n\tuserStore.EXPECT().Update(gomock.Any(), user).Return(nil)\n\n\trepoService := mock.NewMockRepositoryService(controller)\n\trepoService.EXPECT().List(gomock.Any(), user).Return([]*core.Repository{}, nil)\n\n\trepoStore := mock.NewMockRepositoryStore(controller)\n\trepoStore.EXPECT().List(gomock.Any(), gomock.Any()).Return(nil, sql.ErrNoRows)\n\n\ts := Synchronizer{\n\t\trepoz: repoService,\n\t\tusers: userStore,\n\t\trepos: repoStore,\n\t}\n\t_, err := s.Sync(context.Background(), user)\n\tif got, want := err, sql.ErrNoRows; got != want {\n\t\tt.Errorf(\"Want error %s, got %s\", want, got)\n\t}\n}",
"func UserOwnsStore(userID, storeID int) (bool, error) {\n\tkey := stringutil.Build(\"userid:\", strconv.Itoa(userID), \":storeids\")\n\treturn IsSetMember(key, storeID)\n}",
"func (s *UserSuite) TestUserAttachedToRequestAuthenticatedNoUseridentifierHasBeenRegistered(c *C) {\n\thandler := u.Handler()\n\n\treq, _ := http.NewRequest(\"GET\", \"http://127.0.0.1:8000/auth-status\", nil)\n\tresp := httptest.NewRecorder()\n\thandler(resp, req)\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tc.Assert(err, IsNil)\n\tc.Assert(string(body), Equals, \"false\")\n}",
"func TestUserNotFound(t *testing.T) {\n\tprov := getFakeProvider(\"\")\n\t_, err := prov.GetUser(nil)\n\tassert.Error(t, err)\n}",
"func (mr *MockStoreMockRecorder) GetUserByUserName(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetUserByUserName\", reflect.TypeOf((*MockStore)(nil).GetUserByUserName), arg0, arg1)\n}",
"func (s *StorageTest) TestUser() error {\n\tif err := s.runPreTest(); err != nil {\n\t\treturn err\n\t}\n\tdefer s.runPostTest()\n\n\t// Should be a not-found error at first\n\t_, err := s.LoadUser(\"[email protected]\")\n\tif _, ok := err.(caddytls.ErrNotExist); !ok {\n\t\treturn fmt.Errorf(\"Expected caddytls.ErrNotExist from load, got %T: %v\", err, err)\n\t}\n\n\t// Should store successfully and then load just fine\n\tif err := s.StoreUser(\"[email protected]\", simpleUserData); err != nil {\n\t\treturn err\n\t}\n\tif userData, err := s.LoadUser(\"[email protected]\"); err != nil {\n\t\treturn err\n\t} else if !bytes.Equal(userData.Reg, simpleUserData.Reg) {\n\t\treturn errors.New(\"Unexpected reg returned after store\")\n\t} else if !bytes.Equal(userData.Key, simpleUserData.Key) {\n\t\treturn errors.New(\"Unexpected key returned after store\")\n\t}\n\n\t// Overwrite should work just fine\n\tif err := s.StoreUser(\"[email protected]\", simpleUserDataAlt); err != nil {\n\t\treturn err\n\t}\n\tif userData, err := s.LoadUser(\"[email protected]\"); err != nil {\n\t\treturn err\n\t} else if !bytes.Equal(userData.Reg, simpleUserDataAlt.Reg) {\n\t\treturn errors.New(\"Unexpected reg returned after overwrite\")\n\t}\n\n\treturn nil\n}",
"func (e *Entity) AssertUser() {\n\tif e.data.Kind != member.User {\n\t\tpanic(\"AssertUser\")\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
ChannelProvider mocks base method
|
func (m *MockClient) ChannelProvider() fab.ChannelProvider {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ChannelProvider")
ret0, _ := ret[0].(fab.ChannelProvider)
return ret0
}
|
[
"func (m *MockProviders) ChannelProvider() fab.ChannelProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ChannelProvider\")\n\tret0, _ := ret[0].(fab.ChannelProvider)\n\treturn ret0\n}",
"func (m *MockRConnectionInterface) Channel() (*amqp.Channel, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Channel\")\n\tret0, _ := ret[0].(*amqp.Channel)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func NewMockChannelProvider(ctx fab.Context) (*MockChannelProvider, error) {\n\tchannels := make(map[string]fab.Channel)\n\n\t// Create a mock client with the mock channel\n\tcp := MockChannelProvider{\n\t\tctx,\n\t\tchannels,\n\t}\n\treturn &cp, nil\n}",
"func (m *AMQPConnection) Channel() (*amqp091.Channel, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Channel\")\n\tret0, _ := ret[0].(*amqp091.Channel)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (suite *KeeperTestSuite) TestChanCloseInit() {\n\tvar (\n\t\tpath *ibctesting.Path\n\t\tchannelCap *capabilitytypes.Capability\n\t)\n\n\ttestCases := []testCase{\n\t\t{\"success\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, true},\n\t\t{\"channel doesn't exist\", func() {\n\t\t\t// any non-nil values work for connections\n\t\t\tpath.EndpointA.ConnectionID = ibctesting.FirstConnectionID\n\t\t\tpath.EndpointB.ConnectionID = ibctesting.FirstConnectionID\n\n\t\t\tpath.EndpointA.ChannelID = ibctesting.FirstChannelID\n\t\t\tpath.EndpointB.ChannelID = ibctesting.FirstChannelID\n\n\t\t\t// ensure channel capability check passes\n\t\t\tsuite.chainA.CreateChannelCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, false},\n\t\t{\"channel state is CLOSED\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\n\t\t\t// close channel\n\t\t\terr := path.EndpointA.SetChannelClosed()\n\t\t\tsuite.Require().NoError(err)\n\t\t}, false},\n\t\t{\"connection not found\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\n\t\t\t// set the channel's connection hops to wrong connection ID\n\t\t\tchannel := path.EndpointA.GetChannel()\n\t\t\tchannel.ConnectionHops[0] = \"doesnotexist\"\n\t\t\tsuite.chainA.App.GetIBCKeeper().ChannelKeeper.SetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel)\n\t\t}, false},\n\t\t{\"connection is not OPEN\", func() {\n\t\t\tsuite.coordinator.SetupClients(path)\n\n\t\t\terr := path.EndpointA.ConnOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\t// create channel in init\n\t\t\tpath.SetChannelOrdered()\n\t\t\terr = path.EndpointA.ChanOpenInit()\n\n\t\t\t// ensure channel capability check passes\n\t\t\tsuite.chainA.CreateChannelCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, false},\n\t\t{\"channel capability not found\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = capabilitytypes.NewCapability(3)\n\t\t}, false},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tsuite.Run(fmt.Sprintf(\"Case %s\", tc.msg), func() {\n\t\t\tsuite.SetupTest() // reset\n\t\t\tpath = ibctesting.NewPath(suite.chainA, suite.chainB)\n\n\t\t\ttc.malleate()\n\n\t\t\terr := suite.chainA.App.GetIBCKeeper().ChannelKeeper.ChanCloseInit(\n\t\t\t\tsuite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, ibctesting.FirstChannelID, channelCap,\n\t\t\t)\n\n\t\t\tif tc.expPass {\n\t\t\t\tsuite.Require().NoError(err)\n\t\t\t} else {\n\t\t\t\tsuite.Require().Error(err)\n\t\t\t}\n\t\t})\n\t}\n}",
"func TestChannelStore(t *testing.T) {\n\t// mock Insert function\n\tfn := func(_ context.Context, v are_hub.Archetype) error {\n\t\treturn nil\n\t}\n\n\t// create mock repo and controller\n\trepo := &mock.ChannelRepo{InsertFunc: fn}\n\tcontroller := NewChannel(repo)\n\n\t// create and embed a new channel\n\tmsport := are_hub.Channel{Name: \"Bentley Team M-Sport\", Password: \"abc123\"}\n\n\t// create a mock request\n\treq, e := http.NewRequest(http.MethodPost, \"/channel\", nil)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// update the request's context with the channel\n\treq = req.WithContext(msport.ToCtx(req.Context()))\n\n\t// create a response recorder and run the controller method\n\tw := httptest.NewRecorder()\n\te = controller.Store(w, req)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// check if the repo was hit\n\tif !repo.InsertCalled {\n\t\tt.Error(\"Did not call repo.Insert\")\n\t}\n\n\t// get the response\n\tres := w.Result()\n\n\t// ensure the content type is application/json\n\tcheckCT(res, t)\n\n\t// extract the returned channel\n\tdefer res.Body.Close()\n\tresBody, e := io.ReadAll(res.Body)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// unmarshal the response body\n\treceived := are_hub.Channel{}\n\te = json.Unmarshal(resBody, &received)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// compare the sent and received channels\n\tif msport.Name != received.Name {\n\t\tt.Fatalf(\"Expected: %+v. Actual: %+v\", msport, received)\n\t}\n}",
"func TestConsumerChannel(t *testing.T) {\n\tconsumerTestWithCommits(t, \"Channel Consumer\", 0, true, eventTestChannelConsumer, nil)\n}",
"func (b *BrokerMock) Listen(channel string) {}",
"func (m *MockContext) CM() channel.Manager {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CM\")\n\tret0, _ := ret[0].(channel.Manager)\n\treturn ret0\n}",
"func testChannel(t *testing.T, src, dst *Chain) {\n\tchans, err := src.QueryChannels(1, 1000)\n\trequire.NoError(t, err)\n\trequire.Equal(t, 1, len(chans))\n\trequire.Equal(t, chans[0].GetOrdering().String(), \"ORDERED\")\n\trequire.Equal(t, chans[0].GetState().String(), \"OPEN\")\n\trequire.Equal(t, chans[0].GetCounterparty().GetChannelID(), dst.PathEnd.ChannelID)\n\trequire.Equal(t, chans[0].GetCounterparty().GetPortID(), dst.PathEnd.PortID)\n\n\th, err := src.Client.Status()\n\trequire.NoError(t, err)\n\n\tch, err := src.QueryChannel(h.SyncInfo.LatestBlockHeight)\n\trequire.NoError(t, err)\n\trequire.Equal(t, ch.Channel.GetOrdering().String(), \"ORDERED\")\n\trequire.Equal(t, ch.Channel.GetState().String(), \"OPEN\")\n\trequire.Equal(t, ch.Channel.GetCounterparty().GetChannelID(), dst.PathEnd.ChannelID)\n\trequire.Equal(t, ch.Channel.GetCounterparty().GetPortID(), dst.PathEnd.PortID)\n}",
"func (suite *KeeperTestSuite) TestSetChannel() {\n\t// create client and connections on both chains\n\tpath := ibctesting.NewPath(suite.chainA, suite.chainB)\n\tsuite.coordinator.SetupConnections(path)\n\n\t// check for channel to be created on chainA\n\t_, found := suite.chainA.App.GetIBCKeeper().ChannelKeeper.GetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\tsuite.False(found)\n\n\tpath.SetChannelOrdered()\n\n\t// init channel\n\terr := path.EndpointA.ChanOpenInit()\n\tsuite.NoError(err)\n\n\tstoredChannel, found := suite.chainA.App.GetIBCKeeper().ChannelKeeper.GetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t// counterparty channel id is empty after open init\n\texpectedCounterparty := types.NewCounterparty(path.EndpointB.ChannelConfig.PortID, \"\")\n\n\tsuite.True(found)\n\tsuite.Equal(types.INIT, storedChannel.State)\n\tsuite.Equal(types.ORDERED, storedChannel.Ordering)\n\tsuite.Equal(expectedCounterparty, storedChannel.Counterparty)\n}",
"func (c *Provider) ChannelProvider() fab.ChannelProvider {\n\treturn c.channelProvider\n}",
"func (_m *Knapsack) UpdateChannel() string {\n\tret := _m.Called()\n\n\tvar r0 string\n\tif rf, ok := ret.Get(0).(func() string); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(string)\n\t}\n\n\treturn r0\n}",
"func newMockListener(endpoint net.Conn) *mockListener {\n \n c := make(chan net.Conn, 1)\n c <- endpoint\n listener := &mockListener{\n connChannel: c,\n serverEndpoint: endpoint,\n }\n return listener\n}",
"func (m *MockCallResult) Channel() <-chan *Result {\n\targs := m.MethodCalled(\"Channel\")\n\n\tif resultChan := args.Get(0); resultChan != nil {\n\t\treturn resultChan.(<-chan *Result)\n\t}\n\n\treturn nil\n}",
"func NewMockInterfaceProvider(managedInterfacesRegexp string, autoRefresh bool) (nt.InterfaceProvider,\n\tchan time.Time, error) {\n\tch := make(chan time.Time)\n\tip, err := nt.NewChanInterfaceProvider(ch, &MockInterfaceLister{}, managedInterfacesRegexp,\n\t\tautoRefresh)\n\treturn ip, ch, err\n}",
"func newMockProvider() *mockProviderAsync {\n\tprovider := newSyncMockProvider()\n\t// By default notifier is set to a function which is a no-op. In the event we've implemented the PodNotifier interface,\n\t// it will be set, and then we'll call a real underlying implementation.\n\t// This makes it easier in the sense we don't need to wrap each method.\n\treturn &mockProviderAsync{provider}\n}",
"func TestChannelUpdate(t *testing.T) {\n\t// mock UpdateID function\n\tfn := func(_ context.Context, str string, v are_hub.Archetype) error {\n\t\t_, e := findChannelID(nil, str)\n\n\t\t// the update itself has no bearing on the test so simply return\n\t\t// the error (if there was one)\n\t\treturn e\n\t}\n\n\t// create mock repo and controller\n\trepo := &mock.ChannelRepo{UpdateIDFunc: fn}\n\tcontroller := NewChannel(repo)\n\n\t// mock channel\n\twrt := are_hub.Channel{Name: \"Belgian Audi Club WRT\", Password: \"abc123\"}\n\n\t// create mock request\n\tp := httprouter.Param{Key: \"id\", Value: \"1\"}\n\treq, e := http.NewRequest(http.MethodPut, \"/channel/\"+p.Value, nil)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// embed the updated channel in the request's context\n\treq = req.WithContext(wrt.ToCtx(req.Context()))\n\n\t// embed parameters in the request's context\n\tuf.EmbedParams(req, p)\n\n\t// create a response recorder run the update method\n\tw := httptest.NewRecorder()\n\te = controller.Update(w, req)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\tres := w.Result()\n\n\t// check if repo was hit\n\tif !repo.UpdateIDCalled {\n\t\tt.Error(\"Did not call repo.UpdateID\")\n\t}\n\n\t// ensure the content type is applicaton/json\n\tcheckCT(res, t)\n\n\t// read and unmarshal the body\n\tdefer res.Body.Close()\n\tresBody, e := io.ReadAll(res.Body)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\treceived := are_hub.Channel{}\n\te = json.Unmarshal(resBody, &received)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// compare the sent and received channels\n\tif wrt.Name != received.Name {\n\t\tt.Fatalf(\"Expected: %+v. Actual: %+v\", wrt, received)\n\t}\n\n\t// check if Update returns a 404 error on an invalid ID\n\tp = httprouter.Param{Key: \"id\", Value: \"-1\"}\n\treq, e = http.NewRequest(http.MethodPut, \"/channel/\"+p.Value, nil)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// embed non-existant channel into the request's context\n\tgpx := are_hub.Channel{Name: \"Grand Prix Extreme\", Password: \"porsche\"}\n\treq = req.WithContext(gpx.ToCtx(req.Context()))\n\n\t// embed parameters\n\tuf.EmbedParams(req, p)\n\n\t// create a new response recorder and call the update method\n\tw = httptest.NewRecorder()\n\te = controller.Update(w, req)\n\n\tif e == nil {\n\t\tt.Fatal(\"Expected: 404 Not found error. Actual: nil\")\n\t}\n\n\the, ok := e.(uf.HttpError)\n\n\tif !ok {\n\t\tt.Fatalf(\"Expected: 404 Not Found error. Actual: %+v\", e)\n\t}\n\n\tif he.Code != http.StatusNotFound {\n\t\tt.Fatalf(\"Expected: %d. Actual: %d\", http.StatusNotFound, he.Code)\n\t}\n}",
"func TestChannelIndex(t *testing.T) {\n\t// mock All function\n\tfn := func(_ context.Context) ([]are_hub.Channel, error) {\n\t\treturn channels, nil\n\t}\n\n\t// create the mock repo and controller\n\trepo := &mock.ChannelRepo{AllFunc: fn}\n\tcontroller := NewChannel(repo)\n\n\t// create a mock request\n\treq, e := http.NewRequest(http.MethodGet, \"/channel\", nil)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// create a response recorder and run the controller method\n\tw := httptest.NewRecorder()\n\te = controller.Index(w, req)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// get the response\n\tres := w.Result()\n\n\t// check if the repo was hit\n\tif !repo.AllCalled {\n\t\tt.Error(\"Did not call repo.All\")\n\t}\n\n\t// ensure the content type is application/json\n\tcheckCT(res, t)\n\n\t// extract the body and confirm all data was returned\n\tdefer res.Body.Close()\n\tbody, e := io.ReadAll(res.Body)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\tvar received []are_hub.Channel\n\te = json.Unmarshal(body, &received)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\tlr := len(received)\n\tlc := len(channels)\n\n\t// check that all channels were returned\n\tif lr != lc {\n\t\tt.Fatalf(\"Expected: %d channels. Actual: %d.\", lc, lr)\n\t}\n\n\t// loop and ensure the data is correct\n\tfor i := 0; i < lr; i++ {\n\t\tif received[i].Name != channels[i].Name {\n\t\t\tt.Fatalf(\"Expected: %s. Actual: %s.\", channels[i].Name, received[i].Name)\n\t\t}\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
ChannelProvider indicates an expected call of ChannelProvider
|
func (mr *MockClientMockRecorder) ChannelProvider() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChannelProvider", reflect.TypeOf((*MockClient)(nil).ChannelProvider))
}
|
[
"func (mr *MockProvidersMockRecorder) ChannelProvider() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ChannelProvider\", reflect.TypeOf((*MockProviders)(nil).ChannelProvider))\n}",
"func (m *MockClient) ChannelProvider() fab.ChannelProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ChannelProvider\")\n\tret0, _ := ret[0].(fab.ChannelProvider)\n\treturn ret0\n}",
"func (c *Provider) ChannelProvider() fab.ChannelProvider {\n\treturn c.channelProvider\n}",
"func (m *MockProviders) ChannelProvider() fab.ChannelProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ChannelProvider\")\n\tret0, _ := ret[0].(fab.ChannelProvider)\n\treturn ret0\n}",
"func TestConsumerChannel(t *testing.T) {\n\tconsumerTestWithCommits(t, \"Channel Consumer\", 0, true, eventTestChannelConsumer, nil)\n}",
"func (a *AbstractSSHConnectionHandler) OnUnsupportedChannel(_ uint64, _ string, _ []byte) {}",
"func (s *RingpopOptionsTestSuite) TestChannelRequired() {\n\trp, err := New(\"test\")\n\ts.Nil(rp)\n\ts.Error(err)\n}",
"func (s *ChannelAcceptor) acceptChannel(_ context.Context,\n\treq *lndclient.AcceptorRequest) (*lndclient.AcceptorResponse, error) {\n\n\ts.expectedChansMtx.Lock()\n\tdefer s.expectedChansMtx.Unlock()\n\n\texpectedChanBid, ok := s.expectedChans[req.PendingChanID]\n\n\t// It's not a channel we've registered within the funding manager so we\n\t// just accept it to not interfere with the normal node operation.\n\tif !ok {\n\t\treturn &lndclient.AcceptorResponse{Accept: true}, nil\n\t}\n\n\t// The push amount in the acceptor request is in milli sats, we need to\n\t// convert it first.\n\tpushAmtSat := lnwire.MilliSatoshi(req.PushAmt).ToSatoshis()\n\n\t// Push amount must be exactly what we expect. Otherwise the asker could\n\t// be trying to cheat.\n\tif expectedChanBid.SelfChanBalance != pushAmtSat {\n\t\treturn &lndclient.AcceptorResponse{\n\t\t\tAccept: false,\n\t\t\tError: fmt.Sprintf(\"invalid push amount %v\",\n\t\t\t\treq.PushAmt),\n\t\t}, nil\n\t}\n\n\treturn &lndclient.AcceptorResponse{Accept: true}, nil\n}",
"func (ecm *ErrorConsumerFake) Channel() string {\n\treturn ecm.channel\n}",
"func (m *AMQPConnection) Channel() (*amqp091.Channel, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Channel\")\n\tret0, _ := ret[0].(*amqp091.Channel)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func TestChannelAttachNotMember(t *testing.T) {\n\th := newHelper(t)\n\n\tch := h.repoMakePrivateCh()\n\n\th.apiChAttach(ch, []byte(\"NOPE\")).\n\t\tAssert(helpers.AssertError(\"not allowed to attach files this channel\")).\n\t\tEnd()\n}",
"func (mr *AMQPConnectionMockRecorder) Channel() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Channel\", reflect.TypeOf((*AMQPConnection)(nil).Channel))\n}",
"func (p *peer) hasChannel(chID byte) bool {\r\n\tfor _, ch := range p.channels {\r\n\t\tif ch == chID {\r\n\t\t\treturn true\r\n\t\t}\r\n\t}\r\n\t// NOTE: probably will want to remove this\r\n\t// but could be helpful while the feature is new\r\n\tp.Logger.Debug(\r\n\t\t\"Unknown channel for peer\",\r\n\t\t\"channel\",\r\n\t\tchID,\r\n\t\t\"channels\",\r\n\t\tp.channels,\r\n\t)\r\n\treturn false\r\n}",
"func TestConjur_Provider(t *testing.T) {\n\tvar err error\n\tvar provider plugin_v1.Provider\n\tname := \"conjur\"\n\n\toptions := plugin_v1.ProviderOptions{\n\t\tName: name,\n\t}\n\n\tConvey(\"Can create the Conjur provider\", t, func() {\n\t\tprovider, err = providers.ProviderFactories[name](options)\n\t\tSo(err, ShouldBeNil)\n\t})\n\n\tConvey(\"Has the expected provider name\", t, func() {\n\t\tSo(provider.GetName(), ShouldEqual, \"conjur\")\n\t})\n\n\tConvey(\"Can provide an access token\", t, func() {\n\t\tid := \"accessToken\"\n\t\tvalues, err := provider.GetValues(id)\n\n\t\tSo(err, ShouldBeNil)\n\t\tSo(values[id], ShouldNotBeNil)\n\t\tSo(values[id].Error, ShouldBeNil)\n\t\tSo(values[id].Value, ShouldNotBeNil)\n\n\t\ttoken := make(map[string]string)\n\t\terr = json.Unmarshal(values[id].Value, &token)\n\t\tSo(err, ShouldBeNil)\n\t\tSo(token[\"protected\"], ShouldNotBeNil)\n\t\tSo(token[\"payload\"], ShouldNotBeNil)\n\t})\n\n\tConvey(\n\t\t\"Reports an unknown value\",\n\t\tt,\n\t\ttestutils.Reports(\n\t\t\tprovider,\n\t\t\t\"foobar\",\n\t\t\t\"404 Not Found. Variable 'foobar' not found in account 'dev'.\",\n\t\t),\n\t)\n\n\tConvey(\"Provides\", t, func() {\n\t\tfor _, testCase := range canProvideTestCases {\n\t\t\tConvey(\n\t\t\t\ttestCase.Description,\n\t\t\t\ttestutils.CanProvide(provider, testCase.ID, testCase.ExpectedValue),\n\t\t\t)\n\t\t}\n\t})\n}",
"func (*ProtocolHeader) Channel() uint16 {\n\tpanic(\"Should never be called\")\n}",
"func TestProducerChannel(t *testing.T) {\n\tproducerTest(t, \"Channel producer (without DR)\",\n\t\tnil, producerCtrl{},\n\t\tfunc(p *Producer, m *Message, drChan chan Event) {\n\t\t\tp.ProduceChannel() <- m\n\t\t})\n}",
"func (mr *MockRConnectionInterfaceMockRecorder) Channel() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Channel\", reflect.TypeOf((*MockRConnectionInterface)(nil).Channel))\n}",
"func TestConjur_Provider(t *testing.T) {\n\tvar err error\n\tvar provider plugin_v1.Provider\n\tname := \"conjur\"\n\n\toptions := plugin_v1.ProviderOptions{\n\t\tName: name,\n\t}\n\n\tt.Run(\"Can create the Conjur provider\", func(t *testing.T) {\n\t\tprovider, err = providers.ProviderFactories[name](options)\n\t\tassert.NoError(t, err)\n\t})\n\n\tt.Run(\"Has the expected provider name\", func(t *testing.T) {\n\t\tassert.Equal(t, \"conjur\", provider.GetName())\n\t})\n\n\tt.Run(\"Can provide an access token\", func(t *testing.T) {\n\t\tid := \"accessToken\"\n\t\tvalues, err := provider.GetValues(id)\n\n\t\tassert.NoError(t, err)\n\t\tassert.NotNil(t, values[id])\n\t\tassert.NoError(t, values[id].Error)\n\t\tassert.NotNil(t, values[id].Value)\n\n\t\ttoken := make(map[string]string)\n\t\terr = json.Unmarshal(values[id].Value, &token)\n\t\tassert.NoError(t, err)\n\t\tassert.NotNil(t, token[\"protected\"])\n\t\tassert.NotNil(t, token[\"payload\"])\n\t})\n\n\tt.Run(\"Reports an unknown value\",\n\t\ttestutils.Reports(\n\t\t\tprovider,\n\t\t\t\"foobar\",\n\t\t\t\"404 Not Found. CONJ00076E Variable dev:variable:foobar is empty or not found..\",\n\t\t),\n\t)\n\n\tt.Run(\"Provides\", func(t *testing.T) {\n\t\tfor _, testCase := range canProvideTestCases {\n\t\t\tt.Run(testCase.Description, testutils.CanProvide(provider, testCase.ID, testCase.ExpectedValue))\n\t\t}\n\t})\n}",
"func (a *AbstractSessionChannelHandler) OnUnsupportedChannelRequest(\n\t_ uint64,\n\t_ string,\n\t_ []byte,\n) {\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
CryptoSuite indicates an expected call of CryptoSuite
|
func (mr *MockClientMockRecorder) CryptoSuite() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CryptoSuite", reflect.TypeOf((*MockClient)(nil).CryptoSuite))
}
|
[
"func (mr *MockProvidersMockRecorder) CryptoSuite() *gomock.Call {\r\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CryptoSuite\", reflect.TypeOf((*MockProviders)(nil).CryptoSuite))\r\n}",
"func (mr *MockProvidersMockRecorder) CryptoSuite() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CryptoSuite\", reflect.TypeOf((*MockProviders)(nil).CryptoSuite))\n}",
"func (pc *MockProviderContext) CryptoSuite() apicryptosuite.CryptoSuite {\n\treturn pc.cryptoSuite\n}",
"func (c *Provider) CryptoSuite() core.CryptoSuite {\n\treturn c.cryptoSuite\n}",
"func CipherSuiteName(suite uint16) string {\n\tswitch suite {\n\tcase tls.TLS_RSA_WITH_RC4_128_SHA:\n\t\treturn \"TLS_RSA_WITH_RC4_128_SHA\"\n\tcase tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA:\n\t\treturn \"TLS_RSA_WITH_3DES_EDE_CBC_SHA\"\n\tcase tls.TLS_RSA_WITH_AES_128_CBC_SHA:\n\t\treturn \"TLS_RSA_WITH_AES_128_CBC_SHA\"\n\tcase tls.TLS_RSA_WITH_AES_256_CBC_SHA:\n\t\treturn \"TLS_RSA_WITH_AES_256_CBC_SHA\"\n\tcase tls.TLS_RSA_WITH_AES_128_CBC_SHA256:\n\t\treturn \"TLS_RSA_WITH_AES_128_CBC_SHA256\"\n\tcase tls.TLS_RSA_WITH_AES_128_GCM_SHA256:\n\t\treturn \"TLS_RSA_WITH_AES_128_GCM_SHA256\"\n\tcase tls.TLS_RSA_WITH_AES_256_GCM_SHA384:\n\t\treturn \"TLS_RSA_WITH_AES_256_GCM_SHA384\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA\"\n\tcase tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA:\n\t\treturn \"TLS_ECDHE_RSA_WITH_RC4_128_SHA\"\n\tcase tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA:\n\t\treturn \"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384\"\n\tcase tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:\n\t\treturn \"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256\"\n\tcase tls.TLS_AES_128_GCM_SHA256:\n\t\treturn \"TLS_AES_128_GCM_SHA256\"\n\tcase tls.TLS_AES_256_GCM_SHA384:\n\t\treturn \"TLS_AES_256_GCM_SHA384\"\n\tcase tls.TLS_CHACHA20_POLY1305_SHA256:\n\t\treturn \"TLS_CHACHA20_POLY1305_SHA256\"\n\tcase tls.TLS_FALLBACK_SCSV:\n\t\treturn \"TLS_FALLBACK_SCSV\"\n\t}\n\n\treturn \"Unknown\"\n}",
"func TestHandshake66(t *testing.T) { testHandshake(t, ETH66) }",
"func CompareChainCryptoSuite(chain1, chain2 []*x509.Certificate) int {\n\tcs1 := HashPriority(chain1) + KeyAlgoPriority(chain1)\n\tcs2 := HashPriority(chain2) + KeyAlgoPriority(chain2)\n\treturn cs1 - cs2\n}",
"func testBatchACKSEC(t testing.TB) {\n\tmockBatch := mockBatchACK(t)\n\tmockBatch.Header.StandardEntryClassCode = RCK\n\terr := mockBatch.Validate()\n\tif !base.Match(err, ErrBatchSECType) {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n}",
"func TestECCPasses(t *testing.T) {\n\tassert := assert.New(t)\n\n\tchecks := append(codecs, NoECC{})\n\n\tfor _, check := range checks {\n\t\tfor i := 0; i < 2000; i++ {\n\t\t\tnumBytes := cmn.RandInt()%60 + 1\n\t\t\tdata := cmn.RandBytes(numBytes)\n\n\t\t\tchecked := check.AddECC(data)\n\t\t\tres, err := check.CheckECC(checked)\n\t\t\tif assert.Nil(err, \"%#v: %+v\", check, err) {\n\t\t\t\tassert.Equal(data, res, \"%v\", check)\n\t\t\t}\n\t\t}\n\t}\n}",
"func TestPagarmeEncryptCard(t *testing.T) {\n\t\n\tCard := new(pagarme.Card)\n\tPagarme := pagarme.NewPagarme(\"pt-BR\", ApiKey, CryptoKey)\n Pagarme.SetDebug()\n\n\tpagarmeFillCard(Card)\n\n\tresult, err := Pagarme.EncryptCard(Card)\n\n if err != nil {\n \tt.Errorf(\"Erro ao encrypt card: %v\", err)\n return\n }\n\n if len(result.Hash) == 0 {\n t.Errorf(\"card hash is expected\")\n return\n }\n}",
"func TestInitAessiv(t *testing.T) {\n\tdir := test_helpers.InitFS(t, \"-aessiv\")\n\t_, c, err := configfile.LoadAndDecrypt(dir+\"/\"+configfile.ConfDefaultName, testPw)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !c.IsFeatureFlagSet(configfile.FlagAESSIV) {\n\t\tt.Error(\"AESSIV flag should be set but is not\")\n\t}\n}",
"func TestSignContractFailure(t *testing.T) {\n\tsignatureHelper(t, true)\n}",
"func CipherSuiteString(value uint16) string {\n\tif str, found := tlsCipherSuiteString[value]; found {\n\t\treturn str\n\t}\n\treturn fmt.Sprintf(\"TLS_CIPHER_SUITE_UNKNOWN_%d\", value)\n}",
"func cipherSuiteScan(addr, hostname string) (grade Grade, output Output, err error) {\n\tvar cvList cipherVersionList\n\tallCiphers := allCiphersIDs()\n\n\tvar vers uint16\n\tfor vers = tls.VersionTLS12; vers >= tls.VersionSSL30; vers-- {\n\t\tciphers := make([]uint16, len(allCiphers))\n\t\tcopy(ciphers, allCiphers)\n\t\tfor len(ciphers) > 0 {\n\t\t\tvar cipherIndex int\n\t\t\tcipherIndex, _, _, err = sayHello(addr, hostname, ciphers, nil, vers, nil)\n\t\t\tif err != nil {\n\t\t\t\tif err == errHelloFailed {\n\t\t\t\t\terr = nil\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif vers == tls.VersionSSL30 {\n\t\t\t\tgrade = Warning\n\t\t\t}\n\t\t\tcipherID := ciphers[cipherIndex]\n\n\t\t\t// If this is an EC cipher suite, do a second scan for curve support\n\t\t\tvar supportedCurves []tls.CurveID\n\t\t\tif tls.CipherSuites[cipherID].EllipticCurve {\n\t\t\t\tsupportedCurves, err = doCurveScan(addr, hostname, vers, cipherID, ciphers)\n\t\t\t\tif len(supportedCurves) == 0 {\n\t\t\t\t\terr = errors.New(\"couldn't negotiate any curves\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor i, c := range cvList {\n\t\t\t\tif cipherID == c.cipherID {\n\t\t\t\t\tcvList[i].data = append(c.data, cipherDatum{vers, supportedCurves})\n\t\t\t\t\tgoto exists\n\t\t\t\t}\n\t\t\t}\n\t\t\tcvList = append(cvList, cipherVersions{cipherID, []cipherDatum{{vers, supportedCurves}}})\n\t\texists:\n\t\t\tciphers = append(ciphers[:cipherIndex], ciphers[cipherIndex+1:]...)\n\t\t}\n\t}\n\n\tif len(cvList) == 0 {\n\t\terr = errors.New(\"couldn't negotiate any cipher suites\")\n\t\treturn\n\t}\n\n\tif grade != Warning {\n\t\tgrade = Good\n\t}\n\n\toutput = cvList\n\treturn\n}",
"func TestCV12(t *testing.T) {\n\tstatedb, _ := state.New(common.Hash{}, state.NewDatabase(ethdb.NewMemDatabase()))\n\tmsg := createValidator()\n\t// security contact length: 140 characters\n\tmsg.SecurityContact = \"Helloiwfhwifbwfbcerghveugbviuscbhwiefbcusidbcifwefhgciwefherhbfiwuehfciwiuebfcuyiewfhwieufwiweifhcwefhwefhwidsffevjnononwondqmeofniowfndjowe\"\n\tstatedb.AddBalance(msg.ValidatorAddress, tenK)\n\tif _, err := VerifyAndCreateValidatorFromMsg(\n\t\tstatedb, postStakingEpoch, big.NewInt(0), msg,\n\t); err != nil {\n\t\tt.Error(\"expected\", nil, \"got\", err)\n\t}\n}",
"func TestVigenereCipher(t *testing.T) {\n\tvar vigenere Vigenere\n\n\tcases := []struct {\n\t\tcaseString string\n\t\tcaseKey string\n\t\texpected string\n\t\t// Tells if a case is of success or fail\n\t\tsuccess bool\n\t}{\n\t\t{\n\t\t\tcaseString: \"Deus e bom, o tempo todo\",\n\t\t\tcaseKey: \"UnB\",\n\t\t\texpected: \"Xrvm r ciz, p nrnjb uiqp\",\n\t\t\tsuccess: true,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"Fim de semestre eh assim\",\n\t\t\tcaseKey: \"hard\",\n\t\t\texpected: \"Mid gl svplskul ey dzszp\",\n\t\t\tsuccess: true,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"this year was a tragic year\",\n\t\t\tcaseKey: \"corona\",\n\t\t\texpected: \"vvzg lecf nof a vfruvc asrf\",\n\t\t\tsuccess: true,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"die Kunst des Rechnens\",\n\t\t\tcaseKey: \"GOLANG\",\n\t\t\texpected: \"jwp Khtyh oef Xkqsnrty\",\n\t\t\tsuccess: true,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"a chave de codificacao eh restrita\",\n\t\t\tcaseKey: \"%\",\n\t\t\texpected: \"? a,?:) () a3(-*-a?a?3 ), 6)786-8?\",\n\t\t\tsuccess: false,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"somente caracteres alfabeticos da ascii podem ser utilizados\",\n\t\t\tcaseKey: \"123\",\n\t\t\texpected: \"c@?5?f5 43b25d6d5d 3<7326f94ac 53 1d59: b?57= d7b ff9=;j26?d\",\n\t\t\tsuccess: false,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"Porem, tanto faz Usar MaIUsCUlo ou MINUSculo\",\n\t\t\tcaseKey: \"GOisNice\",\n\t\t\texpected: \"Vczwz, bcrzc nsm Cuex AiAHaEYrc wm ZQPYYqcdb\",\n\t\t\tsuccess: true,\n\t\t},\n\t}\n\tfor _, c := range cases {\n\t\tif c.success {\n\t\t\t// Success cases\n\t\t\tt.Logf(\"Vigenere testing: %s <key: %s> -> %s\", c.caseString, c.caseKey, c.expected)\n\t\t\tresult, err := vigenere.Cipher(c.caseString, c.caseKey)\n\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"Vigenere FAILED: %s <key: %s> -> expected: %s; got ERROR: %s\", c.caseString, c.caseKey, c.expected, err)\n\t\t\t}\n\n\t\t\tif result != c.expected {\n\t\t\t\tt.Errorf(\"Vigenere FAILED: %s <key: %s> -> expected: %s; got: %s\", c.caseString, c.caseKey, c.expected, result)\n\t\t\t}\n\t\t} else {\n\t\t\t// Fail cases\n\t\t\tt.Logf(\"Vigenere testing: %s <key: %s> -> expected err\", c.caseString, c.caseKey)\n\t\t\tresult, err := vigenere.Cipher(c.caseString, c.caseKey)\n\n\t\t\tif err == nil {\n\t\t\t\tt.Errorf(\"Vigenere FAILED: %s <key: %s> -> expected error, but got: %s\", c.caseString, c.caseKey, result)\n\t\t\t}\n\t\t}\n\t}\n}",
"func (mr *MockisCryptoApiRequest_CryptoApiReqMockRecorder) isCryptoApiRequest_CryptoApiReq() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"isCryptoApiRequest_CryptoApiReq\", reflect.TypeOf((*MockisCryptoApiRequest_CryptoApiReq)(nil).isCryptoApiRequest_CryptoApiReq))\n}",
"func InsecureCipherSuites() []*tls.CipherSuite",
"func testMultipleEncryptionsNotEqual(t *testing.T, newHarness HarnessMaker) {\n\tctx := context.Background()\n\tharness, err := newHarness(ctx, t)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer harness.Close()\n\n\tdrv, err := harness.MakeDriver(ctx)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tkeeper := secrets.NewKeeper(drv)\n\n\tmsg := []byte(\"I'm a secret message!\")\n\tencryptedMsg1, err := keeper.Encrypt(ctx, msg)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tencryptedMsg2, err := keeper.Encrypt(ctx, msg)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif cmp.Equal(encryptedMsg1, encryptedMsg2) {\n\t\tt.Errorf(\"Got same encrypted messages from multiple encryptions %v, want them to be different\", string(encryptedMsg1))\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
EndpointConfig mocks base method
|
func (m *MockClient) EndpointConfig() fab.EndpointConfig {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "EndpointConfig")
ret0, _ := ret[0].(fab.EndpointConfig)
return ret0
}
|
[
"func (m *MockProviders) EndpointConfig() fab.EndpointConfig {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"EndpointConfig\")\n\tret0, _ := ret[0].(fab.EndpointConfig)\n\treturn ret0\n}",
"func (m *MockConfiguration) IntrospectionEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IntrospectionEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}",
"func mockGetConfig(profileName string) (config.Configuration, error) {\n\tmockConfig := &mocks.MockClientConfig{}\n\n\tmockConfig.ProfileNameFunc = func() string {\n\t\treturn profileName\n\t}\n\n\tmockConfig.EnvironmentFunc = func() string {\n\t\treturn \"mypurecloud.com\"\n\t}\n\n\tmockConfig.LogFilePathFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.LoggingEnabledFunc = func() bool {\n\t\treturn false\n\t}\n\n\tmockConfig.AutoPaginationEnabledFunc = func() bool {\n\t\treturn false\n\t}\n\n\tmockConfig.ClientIDFunc = func() string {\n\t\treturn utils.GenerateGuid()\n\t}\n\n\tmockConfig.ClientSecretFunc = func() string {\n\t\treturn utils.GenerateGuid()\n\t}\n\n\tmockConfig.RedirectURIFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.OAuthTokenDataFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.AccessTokenFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.ProxyConfigurationFunc = func() *config.ProxyConfiguration {\n\t\treturn &config.ProxyConfiguration{}\n\t}\n\n\treturn mockConfig, nil\n}",
"func (m *MockAPIConfigFromFlags) MakeEndpoint() (http.Endpoint, error) {\n\tret := m.ctrl.Call(m, \"MakeEndpoint\")\n\tret0, _ := ret[0].(http.Endpoint)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (m *MockConfiguration) UserinfoEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UserinfoEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}",
"func (m *MockConfiguration) TokenEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"TokenEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}",
"func (m *MockProvider) ServiceEndpoint() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ServiceEndpoint\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func setupMockEndpoint(url string) http.RoundTripper {\n\ttransport := httpmock.NewMockTransport()\n\ttransport.RegisterResponder(\"POST\", url, randomlySlowResponder)\n\n\treturn transport\n}",
"func TestEndpoint(t *testing.T) {\n\tvar result Endpoint\n\terr := json.NewDecoder(endpointBody).Decode(&result)\n\n\tif err != nil {\n\t\tt.Errorf(\"Error decoding JSON: %s\", err)\n\t}\n\n\tif result.ID != \"Endpoint-1\" {\n\t\tt.Errorf(\"Received invalid ID: %s\", result.ID)\n\t}\n\n\tif result.Name != \"EndpointOne\" {\n\t\tt.Errorf(\"Received invalid name: %s\", result.Name)\n\t}\n\n\tif len(result.ConnectedEntities) != 1 {\n\t\tt.Errorf(\"Expected on connected entity, got: %d\", len(result.ConnectedEntities))\n\t}\n\n\tif result.EndpointProtocol != common.NVMeProtocol {\n\t\tt.Errorf(\"Received endpoint protocol: %s\", result.EndpointProtocol)\n\t}\n\n\tif result.HostReservationMemoryBytes != 8589934592 {\n\t\tt.Errorf(\"Received host reservation memory bytes: %d\", result.HostReservationMemoryBytes)\n\t}\n\n\tif len(result.IPTransportDetails) != 1 {\n\t\tt.Errorf(\"Received %d IP transport details\", len(result.IPTransportDetails))\n\t}\n\n\tif result.IPTransportDetails[0].IPv4Address != \"127.0.0.1\" {\n\t\tt.Errorf(\"Received IP transport IPv4: %s\", result.IPTransportDetails[0].IPv4Address)\n\t}\n\n\tif len(result.Identifiers) != 1 {\n\t\tt.Errorf(\"Received %d identifiers\", len(result.Identifiers))\n\t}\n\n\tif result.Identifiers[0].DurableNameFormat != common.IQNDurableNameFormat {\n\t\tt.Errorf(\"Received durable name format: %s\", result.Identifiers[0].DurableNameFormat)\n\t}\n}",
"func (m *MockConfiguration) AuthorizationEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AuthorizationEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}",
"func Test_setRegInfoExplicitEndpoint(t *testing.T) {\n\tinitMetadata() // Used from metadata_test.go\n\n\tsvc := bridge.Service{\n\t\tAttrs: map[string]string{\n\t\t\t\"eureka_lookup_elbv2_endpoint\": \"false\",\n\t\t\t\"eureka_elbv2_hostname\": \"hostname-i-set\",\n\t\t\t\"eureka_elbv2_port\": \"65535\",\n\t\t\t\"eureka_datacenterinfo_name\": \"AMAZON\",\n\t\t},\n\t\tName: \"app\",\n\t\tOrigin: bridge.ServicePort{\n\t\t\tContainerID: \"123123412\",\n\t\t},\n\t}\n\n\tawsInfo := eureka.AmazonMetadataType{\n\t\tPublicHostname: \"i-should-be-changed\",\n\t\tHostName: \"i-should-be-changed\",\n\t\tInstanceID: \"i-should-be-changed\",\n\t}\n\n\tdcInfo := eureka.DataCenterInfo{\n\t\tName: eureka.Amazon,\n\t\tMetadata: awsInfo,\n\t}\n\n\treg := eureka.Instance{\n\t\tDataCenterInfo: dcInfo,\n\t\tPort: 5001,\n\t\tIPAddr: \"4.3.2.1\",\n\t\tApp: \"app\",\n\t\tVipAddress: \"4.3.2.1\",\n\t\tHostName: \"hostname_identifier\",\n\t\tStatus: eureka.UP,\n\t}\n\n\t// Init LB info cache\n\t// if things are working correctly, this won't be used for this test\n\tlbCache[\"123123412\"] = &LBInfo{\n\t\tDNSName: \"i-should-not-be-used\",\n\t\tPort: 666,\n\t}\n\n\twantedAwsInfo := eureka.AmazonMetadataType{\n\t\tPublicHostname: svc.Attrs[\"eureka_elbv2_hostname\"],\n\t\tHostName: svc.Attrs[\"eureka_elbv2_hostname\"],\n\t\tInstanceID: svc.Attrs[\"eureka_elbv2_hostname\"] + \"_\" + svc.Attrs[\"eureka_elbv2_port\"],\n\t}\n\twantedDCInfo := eureka.DataCenterInfo{\n\t\tName: eureka.Amazon,\n\t\tMetadata: wantedAwsInfo,\n\t}\n\n\texpectedPort, _ := strconv.Atoi(svc.Attrs[\"eureka_elbv2_port\"])\n\twanted := eureka.Instance{\n\t\tDataCenterInfo: wantedDCInfo,\n\t\tPort: expectedPort,\n\t\tApp: svc.Name,\n\t\tIPAddr: \"\",\n\t\tVipAddress: \"\",\n\t\tHostName: svc.Attrs[\"eureka_elbv2_hostname\"],\n\t\tStatus: eureka.UP,\n\t}\n\n\ttype args struct {\n\t\tservice *bridge.Service\n\t\tregistration *eureka.Instance\n\t}\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\twant *eureka.Instance\n\t}{\n\t\t{\n\t\t\tname: \"Should match data\",\n\t\t\targs: args{service: &svc, registration: ®},\n\t\t\twant: &wanted,\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tgot := setRegInfo(tt.args.service, tt.args.registration, true)\n\t\t\tval := got.Metadata.GetMap()[\"has-elbv2\"]\n\t\t\tif val != \"true\" {\n\t\t\t\tt.Errorf(\"setRegInfo() = %+v, \\n Wanted has-elbv2=true in metadata, was %+v\", got, val)\n\t\t\t}\n\t\t\tval2 := got.Metadata.GetMap()[\"elbv2-endpoint\"]\n\t\t\twantVal := svc.Attrs[\"eureka_elbv2_hostname\"] + \"_\" + svc.Attrs[\"eureka_elbv2_port\"]\n\t\t\tif val2 != wantVal {\n\t\t\t\tt.Errorf(\"setRegInfo() = %+v, \\n Wanted elbv2-endpoint=%v in metadata, was %+v\", got, wantVal, val2)\n\t\t\t}\n\t\t\t//Overwrite metadata before comparing data structure - we've directly checked the flag we are looking for\n\t\t\tgot.Metadata = eureka.InstanceMetadata{}\n\t\t\tif !reflect.DeepEqual(got, tt.want) {\n\t\t\t\tt.Errorf(\"setRegInfo() = %+v, \\nwant %+v\\n\", got, tt.want)\n\t\t\t}\n\t\t})\n\t}\n\n}",
"func Endpoint(url string, configureFunc func()) {\n\touterCurrentMockHandler := currentMockHandler\n\tSwitch(extractor.ExtractMethod(), configureFunc)\n\tcurrentMockery.Handle(url, currentMockHandler)\n\tcurrentMockHandler = outerCurrentMockHandler\n}",
"func awsMetadataApiMock(endpoints []*endpoint) func() {\n\tts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\t\tw.Header().Add(\"Server\", \"MockEC2\")\n\t\tlog.Printf(\"[DEBUG] Mocker server received request to %q\", r.RequestURI)\n\t\tfor _, e := range endpoints {\n\t\t\tif r.RequestURI == e.Uri {\n\t\t\t\tfmt.Fprintln(w, e.Body)\n\t\t\t\tw.WriteHeader(200)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tw.WriteHeader(400)\n\t}))\n\n\tos.Setenv(\"AWS_METADATA_URL\", ts.URL+\"/latest\")\n\treturn ts.Close\n}",
"func (c *MockRemoteWriteClient) Endpoint() string { return \"\" }",
"func EndpointForCondition(predicate predicate.Predicate, configFunc func()) {\n\touterCurrentMockHandler := currentMockHandler\n\tconfigFunc()\n\tcurrentMockery.HandleForCondition(DefaultPriority, predicate, currentMockHandler)\n\tcurrentMockHandler = outerCurrentMockHandler\n}",
"func TestEndpointCase20(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tBucket: ptr.String(\"bucketname\"),\n\t\tRegion: ptr.String(\"us-west-2\"),\n\t\tForcePathStyle: ptr.Bool(true),\n\t\tUseFIPS: ptr.Bool(false),\n\t\tAccelerate: ptr.Bool(false),\n\t\tUseDualStack: ptr.Bool(true),\n\t\tEndpoint: ptr.String(\"https://abc.com\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err == nil {\n\t\tt.Fatalf(\"expect error, got none\")\n\t}\n\tif e, a := \"Cannot set dual-stack in combination with a custom endpoint.\", err.Error(); !strings.Contains(a, e) {\n\t\tt.Errorf(\"expect %v error in %v\", e, a)\n\t}\n}",
"func (c *Provider) EndpointConfig() fab.EndpointConfig {\n\treturn c.endpointConfig\n}",
"func (m *MockConfiguration) KeysEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"KeysEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}",
"func TestValidate1(t *testing.T) {\n\tendpoints := make(map[string]map[string]*Endpoint)\n\tendpoints[\"/test\"] = map[string]*Endpoint{\n\t\t\"get\": {\n\t\t\tParams: &Parameters{\n\t\t\t\tQuery: map[string]*ParamEntry{\"test\": {Type: \"string\", Required: true}},\n\t\t\t\tPath: map[string]*ParamEntry{\"test\": {Type: \"boolean\", Required: true}},\n\t\t\t},\n\t\t\tRecieves: &Recieves{\n\t\t\t\tHeaders: map[string]string{\"foo\": \"bar\"},\n\t\t\t\tBody: map[string]string{\"example_array.0.foo\": \"string\"},\n\t\t\t},\n\t\t\tResponses: map[int]*Response{\n\t\t\t\t200: {\n\t\t\t\t\tHeaders: map[string]string{\"foo\": \"bar\"},\n\t\t\t\t\tBody: map[string]interface{}{\"bar\": \"foo\"},\n\t\t\t\t\tWeight: 100,\n\t\t\t\t\tActions: []map[string]interface{}{\n\t\t\t\t\t\t{\"delay\": 10},\n\t\t\t\t\t\t{\"request\": map[interface{}]interface{}{\"target\": \"testService\", \"id\": \"testRequest\"}},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tActions: []map[string]interface{}{\n\t\t\t\t{\"delay\": 10},\n\t\t\t\t{\"request\": map[interface{}]interface{}{\"target\": \"testService\", \"id\": \"testRequest\"}},\n\t\t\t},\n\t\t},\n\t}\n\n\tcfg := &Config{\n\t\tVersion: 1.0,\n\t\tServices: map[string]*Service{\n\t\t\t\"testService\": {Hostname: \"localhost\", Port: 8080},\n\t\t},\n\t\tStartupActions: []map[string]interface{}{\n\t\t\t{\"delay\": 10},\n\t\t\t{\"request\": map[interface{}]interface{}{\"target\": \"testService\", \"id\": \"testRequest\"}},\n\t\t},\n\t\tRequests: map[string]*Request{\n\t\t\t\"testRequest\": {\n\t\t\t\tURL: \"/test\",\n\t\t\t\tProtocol: \"http\",\n\t\t\t\tMethod: \"get\",\n\t\t\t\tHeaders: map[string]string{\"foo\": \"bar\"},\n\t\t\t\tBody: nil,\n\t\t\t\tExpectedResponse: &Response{\n\t\t\t\t\tStatusCode: 200,\n\t\t\t\t\tBody: map[string]interface{}{\"foo.bar\": \"string\"},\n\t\t\t\t\tHeaders: nil,\n\t\t\t\t\tWeight: 100,\n\t\t\t\t\tActions: []map[string]interface{}{\n\t\t\t\t\t\t{\"delay\": 10},\n\t\t\t\t\t\t{\"request\": map[interface{}]interface{}{\"target\": \"testService\", \"id\": \"testRequest\"}},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tEndpoints: endpoints,\n\t}\n\n\tif err := Validate(cfg); err != nil {\n\t\tt.Errorf(\"Validation Failed: %s\", err.Error())\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
EndpointConfig indicates an expected call of EndpointConfig
|
func (mr *MockClientMockRecorder) EndpointConfig() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndpointConfig", reflect.TypeOf((*MockClient)(nil).EndpointConfig))
}
|
[
"func (mr *MockProvidersMockRecorder) EndpointConfig() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"EndpointConfig\", reflect.TypeOf((*MockProviders)(nil).EndpointConfig))\n}",
"func (m *MockClient) EndpointConfig() fab.EndpointConfig {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"EndpointConfig\")\n\tret0, _ := ret[0].(fab.EndpointConfig)\n\treturn ret0\n}",
"func (m *MockProviders) EndpointConfig() fab.EndpointConfig {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"EndpointConfig\")\n\tret0, _ := ret[0].(fab.EndpointConfig)\n\treturn ret0\n}",
"func (c *Provider) EndpointConfig() fab.EndpointConfig {\n\treturn c.endpointConfig\n}",
"func (c *Config) Endpoint() string { return c.ESEndpoint }",
"func TestValidateInvalidEndpoint(t *testing.T) {\n\tendpoint, err := url.Parse(\"https://\")\n\trequire.NoError(t, err)\n\n\tcfg, err := newConfig(WithEndpoint(*endpoint))\n\trequire.NoError(t, err)\n\n\tassert.Equal(t, cfg.endpoint, *endpoint)\n}",
"func checkEndpoint(e string) error {\n\tsplit := strings.Split(e, \":\")\n\tif len(split) != 2 {\n\t\treturn fmt.Errorf(\"malformed endpoint definition: %s\", e)\n\t}\n\tif split[1] == \"eth0\" {\n\t\treturn fmt.Errorf(\"eth0 interface can't be used in the endpoint definition as it is added by docker automatically: '%s'\", e)\n\t}\n\treturn nil\n}",
"func (h Handler) TestEndpoint() error {\n\tr, err := http.Get(h.url)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif r.StatusCode != 200 {\n\t\treturn errors.New(\"Endpoint not replying typical 200 answer on ping\")\n\t}\n\n\treturn nil\n}",
"func TestEndpointCase46(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(true),\n\t\tEndpoint: ptr.String(\"https://example.com\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err == nil {\n\t\tt.Fatalf(\"expect error, got none\")\n\t}\n\tif e, a := \"Invalid Configuration: FIPS and custom endpoint are not supported\", err.Error(); !strings.Contains(a, e) {\n\t\tt.Errorf(\"expect %v error in %v\", e, a)\n\t}\n}",
"func TestEndpoint(t *testing.T) {\n\tvar result Endpoint\n\terr := json.NewDecoder(endpointBody).Decode(&result)\n\n\tif err != nil {\n\t\tt.Errorf(\"Error decoding JSON: %s\", err)\n\t}\n\n\tif result.ID != \"Endpoint-1\" {\n\t\tt.Errorf(\"Received invalid ID: %s\", result.ID)\n\t}\n\n\tif result.Name != \"EndpointOne\" {\n\t\tt.Errorf(\"Received invalid name: %s\", result.Name)\n\t}\n\n\tif len(result.ConnectedEntities) != 1 {\n\t\tt.Errorf(\"Expected on connected entity, got: %d\", len(result.ConnectedEntities))\n\t}\n\n\tif result.EndpointProtocol != common.NVMeProtocol {\n\t\tt.Errorf(\"Received endpoint protocol: %s\", result.EndpointProtocol)\n\t}\n\n\tif result.HostReservationMemoryBytes != 8589934592 {\n\t\tt.Errorf(\"Received host reservation memory bytes: %d\", result.HostReservationMemoryBytes)\n\t}\n\n\tif len(result.IPTransportDetails) != 1 {\n\t\tt.Errorf(\"Received %d IP transport details\", len(result.IPTransportDetails))\n\t}\n\n\tif result.IPTransportDetails[0].IPv4Address != \"127.0.0.1\" {\n\t\tt.Errorf(\"Received IP transport IPv4: %s\", result.IPTransportDetails[0].IPv4Address)\n\t}\n\n\tif len(result.Identifiers) != 1 {\n\t\tt.Errorf(\"Received %d identifiers\", len(result.Identifiers))\n\t}\n\n\tif result.Identifiers[0].DurableNameFormat != common.IQNDurableNameFormat {\n\t\tt.Errorf(\"Received durable name format: %s\", result.Identifiers[0].DurableNameFormat)\n\t}\n}",
"func TestEndpointCase20(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tBucket: ptr.String(\"bucketname\"),\n\t\tRegion: ptr.String(\"us-west-2\"),\n\t\tForcePathStyle: ptr.Bool(true),\n\t\tUseFIPS: ptr.Bool(false),\n\t\tAccelerate: ptr.Bool(false),\n\t\tUseDualStack: ptr.Bool(true),\n\t\tEndpoint: ptr.String(\"https://abc.com\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err == nil {\n\t\tt.Fatalf(\"expect error, got none\")\n\t}\n\tif e, a := \"Cannot set dual-stack in combination with a custom endpoint.\", err.Error(); !strings.Contains(a, e) {\n\t\tt.Errorf(\"expect %v error in %v\", e, a)\n\t}\n}",
"func (c *ServerConfig) getConfigEndpoint() string {\n\tnurl := *c.ParsedEndpoint\n\tnurl.Path = path.Join(nurl.Path, c.APIPaths.Config)\n\treturn nurl.String()\n}",
"func TestEndpointCase47(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-1\"),\n\t\tUseDualStack: ptr.Bool(true),\n\t\tUseFIPS: ptr.Bool(false),\n\t\tEndpoint: ptr.String(\"https://example.com\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err == nil {\n\t\tt.Fatalf(\"expect error, got none\")\n\t}\n\tif e, a := \"Invalid Configuration: Dualstack and custom endpoint are not supported\", err.Error(); !strings.Contains(a, e) {\n\t\tt.Errorf(\"expect %v error in %v\", e, a)\n\t}\n}",
"func ResolveEndpointConfig(sources []interface{}) (value string, found bool, err error) {\n\tfor _, source := range sources {\n\t\tif resolver, ok := source.(EndpointResolver); ok {\n\t\t\tvalue, found, err = resolver.GetEC2IMDSEndpoint()\n\t\t\tif err != nil || found {\n\t\t\t\treturn value, found, err\n\t\t\t}\n\t\t}\n\t}\n\treturn value, found, err\n}",
"func validateAdapterEndpoint(endpoint string, adapterName string, errs []error) []error {\n\tif endpoint == \"\" {\n\t\treturn append(errs, fmt.Errorf(\"There's no default endpoint available for %s. Calls to this bidder/exchange will fail. \"+\n\t\t\t\"Please set adapters.%s.endpoint in your app config\", adapterName, adapterName))\n\t}\n\n\t// Create endpoint template\n\tendpointTemplate, err := template.New(\"endpointTemplate\").Parse(endpoint)\n\tif err != nil {\n\t\treturn append(errs, fmt.Errorf(\"Invalid endpoint template: %s for adapter: %s. %v\", endpoint, adapterName, err))\n\t}\n\t// Resolve macros (if any) in the endpoint URL\n\tresolvedEndpoint, err := macros.ResolveMacros(*endpointTemplate, macros.EndpointTemplateParams{\n\t\tHost: dummyHost,\n\t\tPublisherID: dummyPublisherID,\n\t\tAccountID: dummyAccountID,\n\t})\n\tif err != nil {\n\t\treturn append(errs, fmt.Errorf(\"Unable to resolve endpoint: %s for adapter: %s. %v\", endpoint, adapterName, err))\n\t}\n\t// Validate the resolved endpoint\n\t//\n\t// Validating using both IsURL and IsRequestURL because IsURL allows relative paths\n\t// whereas IsRequestURL requires absolute path but fails to check other valid URL\n\t// format constraints.\n\t//\n\t// For example: IsURL will allow \"abcd.com\" but IsRequestURL won't\n\t// IsRequestURL will allow \"http://http://abcd.com\" but IsURL won't\n\tif !validator.IsURL(resolvedEndpoint) || !validator.IsRequestURL(resolvedEndpoint) {\n\t\terrs = append(errs, fmt.Errorf(\"The endpoint: %s for %s is not a valid URL\", resolvedEndpoint, adapterName))\n\t}\n\treturn errs\n}",
"func (mr *MockConfigurationMockRecorder) IntrospectionEndpoint() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IntrospectionEndpoint\", reflect.TypeOf((*MockConfiguration)(nil).IntrospectionEndpoint))\n}",
"func (m *MockConfiguration) IntrospectionEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IntrospectionEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}",
"func EndpointForCondition(predicate predicate.Predicate, configFunc func()) {\n\touterCurrentMockHandler := currentMockHandler\n\tconfigFunc()\n\tcurrentMockery.HandleForCondition(DefaultPriority, predicate, currentMockHandler)\n\tcurrentMockHandler = outerCurrentMockHandler\n}",
"func TestFailedEndpoint1(t *testing.T) {\n\tisTesting = true\n\tvar request = Request{\n\t\tPath: \"/api/device\",\n\t\tHTTPMethod: \"GET\",\n\t}\n\tvar response, _ = Handler(request)\n\tif response.StatusCode != 404 {\n\t\tt.Errorf(\"response status code has to be 404 but is %d\", response.StatusCode)\n\t}\n\tif response.Body != `{\"message\":\"requested endpoint not found\"}` {\n\t\tt.Errorf(\"body is: %s\", response.Body)\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
EnrollmentCertificate mocks base method
|
func (m *MockClient) EnrollmentCertificate() []byte {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "EnrollmentCertificate")
ret0, _ := ret[0].([]byte)
return ret0
}
|
[
"func (p *MockPeer) EnrollmentCertificate() *pem.Block {\r\n\treturn p.MockCert\r\n}",
"func (p *MockPeer) EnrollmentCertificate() *pem.Block {\n\treturn p.MockCert\n}",
"func (m *MockSecurityKey) AttestationCertificate() (*x509.Certificate, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AttestationCertificate\")\n\tret0, _ := ret[0].(*x509.Certificate)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (p *MockPeer) SetEnrollmentCertificate(pem *pem.Block) {\r\n\tp.MockCert = pem\r\n}",
"func TestCertificate(t *testing.T) {\n\tvar result Certificate\n\n\tif err := json.NewDecoder(certificateBody).Decode(&result); err != nil {\n\t\tt.Errorf(\"Error decoding JSON: %s\", err)\n\t}\n\n\tassertEquals(t, \"1\", result.ID)\n\tassertEquals(t, \"HTTPS Certificate\", result.Name)\n\tassertEquals(t, \"PEM\", string(result.CertificateType))\n\tassertEquals(t, \"Contoso\", result.Issuer.Organization)\n\tassertEquals(t, \"2019-09-07T13:22:05Z\", result.ValidNotAfter)\n\tassertEquals(t, \"TPM_ALG_SHA1\", result.FingerprintHashAlgorithm)\n\tassertEquals(t, \"sha256WithRSAEncryption\", result.SignatureAlgorithm)\n}",
"func (m *MockCAClient) Enroll(arg0 *api.EnrollmentRequest) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Enroll\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func (m *MockContainerServer) UpdateCertificate(arg0 string, arg1 api.CertificatePut, arg2 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateCertificate\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func (m *MockPKIService) SignClientCertificate(arg0 string, arg1 models.AltNames) (*models.PEMCredential, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SignClientCertificate\", arg0, arg1)\n\tret0, _ := ret[0].(*models.PEMCredential)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (p *MockPeer) SetEnrollmentCertificate(pem *pem.Block) {\n\tp.MockCert = pem\n}",
"func TestEnroll(t *testing.T) {\n\n\tfabricCAClient, err := NewFabricCAClient(org1, configImp, cryptoSuiteProvider)\n\tif err != nil {\n\t\tt.Fatalf(\"NewFabricCAClient return error: %v\", err)\n\t}\n\t_, _, err = fabricCAClient.Enroll(\"\", \"user1\")\n\tif err == nil {\n\t\tt.Fatalf(\"Enroll didn't return error\")\n\t}\n\tif err.Error() != \"enrollmentID required\" {\n\t\tt.Fatalf(\"Enroll didn't return right error\")\n\t}\n\t_, _, err = fabricCAClient.Enroll(\"test\", \"\")\n\tif err == nil {\n\t\tt.Fatalf(\"Enroll didn't return error\")\n\t}\n\tif err.Error() != \"enrollmentSecret required\" {\n\t\tt.Fatalf(\"Enroll didn't return right error\")\n\t}\n\t_, _, err = fabricCAClient.Enroll(\"enrollmentID\", \"enrollmentSecret\")\n\tif err != nil {\n\t\tt.Fatalf(\"fabricCAClient Enroll return error %v\", err)\n\t}\n\n\twrongConfigImp := mocks.NewMockConfig(wrongCAServerURL)\n\tfabricCAClient, err = NewFabricCAClient(org1, wrongConfigImp, cryptoSuiteProvider)\n\tif err != nil {\n\t\tt.Fatalf(\"NewFabricCAClient return error: %v\", err)\n\t}\n\t_, _, err = fabricCAClient.Enroll(\"enrollmentID\", \"enrollmentSecret\")\n\tif err == nil {\n\t\tt.Fatalf(\"Enroll didn't return error\")\n\t}\n\tif !strings.Contains(err.Error(), \"enroll failed\") {\n\t\tt.Fatalf(\"Expected error enroll failed. Got: %s\", err)\n\t}\n\n}",
"func (m *MockGateway) Cert() *cert.Info {\n\tret := m.ctrl.Call(m, \"Cert\")\n\tret0, _ := ret[0].(*cert.Info)\n\treturn ret0\n}",
"func TestGenerateCertificate(t *testing.T) {\n\tid, _ := GenerateIdentity()\n\tif !bytes.Equal(id.certificate().Certificate[0], id.certificate().Certificate[0]) {\n\t\tt.Fatalf(\"Secret certificate not deterministic\")\n\t}\n}",
"func (m *MockisCryptoAsymApiReqSetupPrivateKeyEx_Key) isCryptoAsymApiReqSetupPrivateKeyEx_Key() {\n\tm.ctrl.Call(m, \"isCryptoAsymApiReqSetupPrivateKeyEx_Key\")\n}",
"func testCert(t *testing.T, data *TestData, expectedCABundle string, restartPod bool) {\n\tvar antreaController *v1.Pod\n\tvar err error\n\t// We expect the CA to be published very soon after antrea-controller restarts, while it may take up to 2 minutes\n\t// (1 minute kubelet sync period + 1 minute DynamicFileCAContent sync period) to detect the certificate change if\n\t// antrea-controller doesn't restart.\n\ttimeout := 10 * time.Second\n\tif restartPod {\n\t\tantreaController, err = data.restartAntreaControllerPod(defaultTimeout)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Error when restarting antrea-controller Pod: %v\", err)\n\t\t}\n\t} else {\n\t\tantreaController, err = data.getAntreaController()\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Error when getting antrea-controller Pod: %v\", err)\n\t\t}\n\t\ttimeout += 2 * time.Minute\n\t}\n\n\tvar caBundle string\n\tvar configMap *v1.ConfigMap\n\tif err := wait.Poll(2*time.Second, timeout, func() (bool, error) {\n\t\tvar err error\n\t\tconfigMap, err = data.clientset.CoreV1().ConfigMaps(caConfigMapNamespace).Get(context.TODO(), certificate.AntreaCAConfigMapName, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"cannot get ConfigMap antrea-ca\")\n\t\t}\n\t\tvar exists bool\n\t\tcaBundle, exists = configMap.Data[certificate.CAConfigMapKey]\n\t\tif !exists {\n\t\t\tt.Log(\"Missing content for CA bundle, retrying\")\n\t\t\treturn false, nil\n\t\t}\n\n\t\tif expectedCABundle != \"\" && expectedCABundle != caBundle {\n\t\t\tt.Log(\"CA bundle doesn't match the expected one, retrying\")\n\t\t\treturn false, nil\n\t\t}\n\t\treturn true, nil\n\t}); err != nil {\n\t\tt.Fatalf(\"Failed to get CA bundle availability: %v\", err)\n\t}\n\n\t// We create a test Pod which needs access to the CA bundle.\n\t// Because this Pod will be created inside the test Namespace, it will not have direct access to the antrea-ca ConfigMap,\n\t// which is in the kube-system Namespace. Therefore, we make a \"copy\" of the antrea-ca ConfigMap in the test Namespace.\n\tconfigMapCopy := v1.ConfigMap{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"antrea-ca-e2e\",\n\t\t\tNamespace: data.testNamespace,\n\t\t},\n\t\tData: configMap.Data,\n\t}\n\tif _, err := data.clientset.CoreV1().ConfigMaps(data.testNamespace).Create(context.TODO(), &configMapCopy, metav1.CreateOptions{}); err != nil {\n\t\tt.Errorf(\"Error when creating ConfigMap %s: %v\", configMapCopy.Name, err)\n\t}\n\tdefer func() {\n\t\tif err := data.clientset.CoreV1().ConfigMaps(data.testNamespace).Delete(context.TODO(), configMapCopy.Name, metav1.DeleteOptions{}); err != nil {\n\t\t\tt.Errorf(\"Error when deleting ConfigMap %s: %v\", configMapCopy.Name, err)\n\t\t}\n\t}()\n\n\tcaFile := \"/etc/config/ca.crt\"\n\tclientName := \"agnhost\"\n\treqURL := fmt.Sprintf(\"https://%s/readyz\", certificate.GetAntreaServerNames(certificate.AntreaServiceName)[0])\n\tcmd := []string{\"curl\", \"--cacert\", caFile, \"-s\", reqURL}\n\trequire.NoError(t, NewPodBuilder(clientName, data.testNamespace, agnhostImage).WithContainerName(getImageName(agnhostImage)).MountConfigMap(configMapCopy.Name, \"/etc/config/\", \"config-volume\").WithHostNetwork(false).Create(data))\n\tdefer data.DeletePodAndWait(defaultTimeout, clientName, data.testNamespace)\n\trequire.NoError(t, data.podWaitForRunning(defaultTimeout, clientName, data.testNamespace))\n\tif err := wait.Poll(2*time.Second, timeout, func() (bool, error) {\n\t\tstdout, stderr, err := data.RunCommandFromPod(data.testNamespace, clientName, agnhostContainerName, cmd)\n\t\tif err != nil {\n\t\t\tt.Logf(\"error when running cmd: %v , stdout: <%v>, stderr: <%v>\", err, stdout, stderr)\n\t\t\treturn false, err\n\t\t}\n\t\tt.Logf(\"The CABundle in ConfigMap antrea-ca is valid\")\n\t\treturn true, nil\n\t}); err != nil {\n\t\tt.Fatalf(\"Failed to get a valid CA cert from ConfigMap: %v\", err)\n\t}\n\n\tlistOptions := metav1.ListOptions{\n\t\tLabelSelector: \"app=antrea\",\n\t}\n\tapiServices, err := data.aggregatorClient.ApiregistrationV1().APIServices().List(context.TODO(), listOptions)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to list Antrea APIServices: %v\", err)\n\t}\n\tfor _, apiService := range apiServices.Items {\n\t\tif caBundle != string(apiService.Spec.CABundle) {\n\t\t\tt.Logf(\"The CABundle in APIService %s is invalid\", apiService.Name)\n\t\t}\n\t\tt.Logf(\"The CABundle in APIService %s is valid\", apiService.Name)\n\t}\n\n\t// antrea-agents reconnect every 5 seconds, we expect their connections are restored in a few seconds.\n\tif err := wait.Poll(2*time.Second, 30*time.Second, func() (bool, error) {\n\t\tcmds := []string{\"antctl\", \"get\", \"controllerinfo\", \"-o\", \"json\"}\n\t\tstdout, _, err := runAntctl(antreaController.Name, cmds, data)\n\t\tif err != nil {\n\t\t\treturn true, err\n\t\t}\n\t\tvar controllerInfo v1beta1.AntreaControllerInfo\n\t\terr = json.Unmarshal([]byte(stdout), &controllerInfo)\n\t\tif err != nil {\n\t\t\treturn true, err\n\t\t}\n\t\tif clusterInfo.numNodes != int(controllerInfo.ConnectedAgentNum) {\n\t\t\tt.Logf(\"Expected %d connected agents, got %d\", clusterInfo.numNodes, controllerInfo.ConnectedAgentNum)\n\t\t\treturn false, nil\n\t\t}\n\t\tt.Logf(\"Got connections from all %d antrea-agents\", clusterInfo.numNodes)\n\t\treturn true, nil\n\t}); err != nil {\n\t\tt.Fatalf(\"Didn't get connections from all %d antrea-agents: %v\", clusterInfo.numNodes, err)\n\t}\n}",
"func (f *FabricCAClientImpl) Enroll(enrollmentId, password string) (*Identity, []byte, error) {\n\tif len(enrollmentId) < 1 {\n\t\treturn nil, nil, ErrEnrollmentIdMissing\n\t}\n\t// create new cert and send it to CA for signing\n\tkey, err := f.Crypto.GenerateKey()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tcsr, err := f.Crypto.CreateCertificateRequest(enrollmentId, key)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\turl := fmt.Sprintf(\"%s/api/v1/enroll\", f.Url)\n\n\tcrm, err := json.Marshal(CertificateRequest{CR: string(csr)})\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treq, err := http.NewRequest(\"POST\", url, bytes.NewBuffer(crm))\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.SetBasicAuth(enrollmentId, password)\n\tvar tr *http.Transport\n\tif f.Transport == nil {\n\t\ttr = &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: f.SkipTLSVerification},\n\t\t}\n\t} else {\n\t\ttr = f.Transport\n\t}\n\n\thttpClient := &http.Client{Transport: tr}\n\tresp, err := httpClient.Do(req)\n\tif err != nil {\n\n\t\treturn nil, nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\n\t\treturn nil, nil, err\n\t}\n\tenrResp := new(enrollmentResponse)\n\tif err := json.Unmarshal(body, enrResp); err != nil {\n\n\t\treturn nil, nil, err\n\t}\n\tif !enrResp.Success {\n\n\t\treturn nil, nil, ErrEnrollment\n\t}\n\trawCert, err := base64.StdEncoding.DecodeString(enrResp.Result.Cert)\n\tif err != nil {\n\n\t\treturn nil, nil, err\n\t}\n\ta, _ := pem.Decode(rawCert)\n\tcert, err := x509.ParseCertificate(a.Bytes)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn &Identity{Certificate: cert, PrivateKey: key}, csr, nil\n}",
"func (m *MockCertificateManager) AddCertificate(arg0 *p2pcommon.AgentCertificateV1) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"AddCertificate\", arg0)\n}",
"func (m *MockSecurityProvider) Enroll(arg0 context.Context, arg1 time.Duration, arg2 func(string, int)) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Enroll\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func TestGetFunctions(t *testing.T) {\n\taddr := &net.IPAddr{\n\t\tIP: net.ParseIP(\"1.2.3.4\"),\n\t}\n\tprivateKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\tAssertOk(t, err, \"GenerateKey fail\")\n\tcert, err := certs.SelfSign(\"hello\", privateKey, certs.WithValidityDays(1))\n\tAssertOk(t, err, \"Failed to generate certificate\")\n\n\tctx1 := MakeMockContext(addr, nil)\n\tAssert(t, GetPeerAddress(ctx1) == addr.String(), fmt.Sprintf(\"Address mismatch, want: %v, have: %v\", addr.String(), GetPeerAddress(ctx1)))\n\tAssert(t, GetPeerCertificate(ctx1) == nil, \"Context with nil certificate returned non-empty certificate\")\n\tAssert(t, GetPeerID(ctx1) == \"\", \"Context with nil certificate returned non-empty peer ID\")\n\n\tctx2 := MakeMockContext(nil, cert)\n\tAssert(t, GetPeerAddress(ctx2) == \"\", \"Context with nil address returned non-empty peer address\")\n\tAssert(t, GetPeerCertificate(ctx2) == cert, \"Certificate mismatch, want: %+v, have: %+v\", cert, GetPeerCertificate(ctx2))\n\tAssert(t, GetPeerID(ctx2) == \"hello\", fmt.Sprintf(\"PeerID mismatch, want: hello, have: %v\", GetPeerID(ctx2)))\n\n\tctx3 := MakeMockContext(addr, cert)\n\tAssert(t, GetPeerAddress(ctx3) == addr.String(), fmt.Sprintf(\"Address mismatch, want: %v, have: %v\", addr.String(), GetPeerAddress(ctx3)))\n\tAssert(t, GetPeerCertificate(ctx3) == cert, \"Certificate mismatch, want: %+v, have: %+v\", cert, GetPeerCertificate(ctx3))\n\tAssert(t, GetPeerID(ctx3) == \"hello\", fmt.Sprintf(\"PeerID mismatch, want: hello, have: %v\", GetPeerID(ctx3)))\n\n\tctx4 := MakeMockContext(nil, nil)\n\tAssert(t, GetPeerAddress(ctx4) == \"\", \"Context with nil address returned non-empty peer address\")\n\tAssert(t, GetPeerCertificate(ctx4) == nil, \"Context with nil certificate returned non-empty certificate\")\n\tAssert(t, GetPeerID(ctx4) == \"\", \"Context with nil certificate returned non-empty peer ID\")\n}",
"func (m *MockContainerServer) GetCertificate(arg0 string) (*api.Certificate, string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetCertificate\", arg0)\n\tret0, _ := ret[0].(*api.Certificate)\n\tret1, _ := ret[1].(string)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
EnrollmentCertificate indicates an expected call of EnrollmentCertificate
|
func (mr *MockClientMockRecorder) EnrollmentCertificate() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnrollmentCertificate", reflect.TypeOf((*MockClient)(nil).EnrollmentCertificate))
}
|
[
"func (p *MockPeer) EnrollmentCertificate() *pem.Block {\r\n\treturn p.MockCert\r\n}",
"func (p *MockPeer) EnrollmentCertificate() *pem.Block {\n\treturn p.MockCert\n}",
"func (m *MockClient) EnrollmentCertificate() []byte {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"EnrollmentCertificate\")\n\tret0, _ := ret[0].([]byte)\n\treturn ret0\n}",
"func (p *Peer) EnrollmentCertificate() *pem.Block {\n\treturn p.enrollmentCertificate\n}",
"func (mr *MockSecurityKeyMockRecorder) AttestationCertificate() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AttestationCertificate\", reflect.TypeOf((*MockSecurityKey)(nil).AttestationCertificate))\n}",
"func AssertCertificateHasClientAuthUsage(t *testing.T, cert *x509.Certificate) {\n\tfor i := range cert.ExtKeyUsage {\n\t\tif cert.ExtKeyUsage[i] == x509.ExtKeyUsageClientAuth {\n\t\t\treturn\n\t\t}\n\t}\n\tt.Error(\"cert has not ClientAuth usage as expected\")\n}",
"func TestCertificate(t *testing.T) {\n\tvar result Certificate\n\n\tif err := json.NewDecoder(certificateBody).Decode(&result); err != nil {\n\t\tt.Errorf(\"Error decoding JSON: %s\", err)\n\t}\n\n\tassertEquals(t, \"1\", result.ID)\n\tassertEquals(t, \"HTTPS Certificate\", result.Name)\n\tassertEquals(t, \"PEM\", string(result.CertificateType))\n\tassertEquals(t, \"Contoso\", result.Issuer.Organization)\n\tassertEquals(t, \"2019-09-07T13:22:05Z\", result.ValidNotAfter)\n\tassertEquals(t, \"TPM_ALG_SHA1\", result.FingerprintHashAlgorithm)\n\tassertEquals(t, \"sha256WithRSAEncryption\", result.SignatureAlgorithm)\n}",
"func (c *controller) issueCertificate(ctx context.Context, nextRevision int, crt *cmapi.Certificate, req *cmapi.CertificateRequest, pk crypto.Signer) error {\n\tcrt = crt.DeepCopy()\n\tif crt.Spec.PrivateKey == nil {\n\t\tcrt.Spec.PrivateKey = &cmapi.CertificatePrivateKey{}\n\t}\n\n\tpkData, err := utilpki.EncodePrivateKey(pk, crt.Spec.PrivateKey.Encoding)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsecretData := internal.SecretData{\n\t\tPrivateKey: pkData,\n\t\tCertificate: req.Status.Certificate,\n\t\tCA: req.Status.CA,\n\t\tCertificateName: crt.Name,\n\t\tIssuerName: req.Spec.IssuerRef.Name,\n\t\tIssuerKind: req.Spec.IssuerRef.Kind,\n\t\tIssuerGroup: req.Spec.IssuerRef.Group,\n\t}\n\n\tif err := c.secretsUpdateData(ctx, crt, secretData); err != nil {\n\t\treturn err\n\t}\n\n\t//Set status.revision to revision of the CertificateRequest\n\tcrt.Status.Revision = &nextRevision\n\n\t// Remove Issuing status condition\n\t// TODO @joshvanl: Once we move to only server-side apply API calls, this\n\t// should be changed to setting the Issuing condition to False.\n\tapiutil.RemoveCertificateCondition(crt, cmapi.CertificateConditionIssuing)\n\n\t// Clear status.failedIssuanceAttempts (if set)\n\tcrt.Status.FailedIssuanceAttempts = nil\n\n\t// Clear status.lastFailureTime (if set)\n\tcrt.Status.LastFailureTime = nil\n\n\tif err := c.updateOrApplyStatus(ctx, crt, true); err != nil {\n\t\treturn err\n\t}\n\n\tmessage := \"The certificate has been successfully issued\"\n\tc.recorder.Event(crt, corev1.EventTypeNormal, \"Issuing\", message)\n\n\treturn nil\n\n}",
"func (p *MockPeer) SetEnrollmentCertificate(pem *pem.Block) {\r\n\tp.MockCert = pem\r\n}",
"func (c *controller) failIssueCertificate(ctx context.Context, log logr.Logger, crt *cmapi.Certificate, condition *cmapi.CertificateRequestCondition) error {\n\tnowTime := metav1.NewTime(c.clock.Now())\n\tcrt.Status.LastFailureTime = &nowTime\n\n\tfailedIssuanceAttempts := 1\n\tif crt.Status.FailedIssuanceAttempts != nil {\n\t\tfailedIssuanceAttempts = *crt.Status.FailedIssuanceAttempts + 1\n\t}\n\tcrt.Status.FailedIssuanceAttempts = &failedIssuanceAttempts\n\n\tlog.V(logf.DebugLevel).Info(\"CertificateRequest in failed state so retrying issuance later\")\n\n\tvar reason, message string\n\treason = condition.Reason\n\tmessage = fmt.Sprintf(\"The certificate request has failed to complete and will be retried: %s\",\n\t\tcondition.Message)\n\n\tcrt = crt.DeepCopy()\n\tapiutil.SetCertificateCondition(crt, crt.Generation, cmapi.CertificateConditionIssuing, cmmeta.ConditionFalse, reason, message)\n\n\tif err := c.updateOrApplyStatus(ctx, crt, false); err != nil {\n\t\treturn err\n\t}\n\n\tc.recorder.Event(crt, corev1.EventTypeWarning, reason, message)\n\n\treturn nil\n}",
"func ExpectValidCertificate(expiresAfterDays int) HTTPCertificateExpectation {\n\treturn HTTPCertificateExpectation{\n\t\tExpiresAfterDays: expiresAfterDays,\n\t}\n}",
"func ExpectValidCertificate(csr *certificatesv1.CertificateSigningRequest, _ crypto.Signer) error {\n\t_, err := pki.DecodeX509CertificateBytes(csr.Status.Certificate)\n\treturn err\n}",
"func (d Driver) IssueCertificate(config CertRequest) ([]byte, error) {\n\tserial, err := rand.Int(rand.Reader, MaxSerialNumber)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error generating certificate serial number\")\n\t}\n\n\tca, err := d.ca.Load(config.CAName)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error loading CA bundle\")\n\t}\n\n\trootCert, err := x509.ParseCertificate(ca.Certificate[0])\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error parsing CA certificate\")\n\t}\n\n\tnow := time.Now()\n\n\tcert := x509.Certificate{\n\t\tSerialNumber: serial,\n\t\tSubject: pkix.Name{\n\t\t\tCommonName: config.CommonName,\n\t\t\tOrganizationalUnit: rootCert.Subject.OrganizationalUnit,\n\t\t\tOrganization: rootCert.Subject.Organization,\n\t\t\tCountry: rootCert.Subject.Country,\n\t\t\tProvince: rootCert.Subject.Province,\n\t\t\tLocality: rootCert.Subject.Locality,\n\t\t\tStreetAddress: rootCert.Subject.StreetAddress,\n\t\t\tPostalCode: rootCert.Subject.PostalCode,\n\t\t},\n\t\tNotBefore: now,\n\t\tNotAfter: now.Add(config.Lifetime),\n\t\tKeyUsage: x509.KeyUsageDigitalSignature,\n\t\tExtKeyUsage: config.Usage,\n\t}\n\n\tfor _, name := range config.DNSNames {\n\t\tcert.DNSNames = append(cert.DNSNames, name)\n\t}\n\n\tfor _, addr := range config.IPAddrs {\n\t\tcert.IPAddresses = append(cert.IPAddresses, addr)\n\t}\n\n\tkey, err := rsa.GenerateKey(rand.Reader, PrivateKeyLength)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error generating private key\")\n\t}\n\n\tsigned, err := x509.CreateCertificate(rand.Reader, &cert, rootCert, &key.PublicKey, ca.PrivateKey)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error signing certificate\")\n\t}\n\n\tbundle := &bytes.Buffer{}\n\n\tif err := pem.Encode(bundle, &pem.Block{Type: \"RSA PRIVATE KEY\", Bytes: x509.MarshalPKCS1PrivateKey(key)}); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := pem.Encode(bundle, &pem.Block{Type: \"CERTIFICATE\", Bytes: signed}); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, cert := range ca.Certificate {\n\t\tif err := pem.Encode(bundle, &pem.Block{Type: \"CERTIFICATE\", Bytes: cert}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn bundle.Bytes(), nil\n}",
"func TestCertificateNotExpired(t *testing.T) {\n\t// given\n\tvar expiredDate = time.Now().Add(time.Hour * 24 * (30 + 1)) // 31 days.\n\n\tvar fakeCerts = []*x509.Certificate{\n\t\t{\n\t\t\tNotAfter: expiredDate,\n\t\t\tSubject: pkix.Name{\n\t\t\t\tCommonName: \"Test cert\",\n\t\t\t},\n\t\t},\n\t}\n\n\t// when\n\tmsg := getCertificateChainMsg(fakeCerts)\n\n\t// then\n\tif msg != \"\" {\n\t\tt.Fatalf(\"Expected empty message was: %s\", msg)\n\t}\n}",
"func printCertificate(cert *x509.Certificate) bool {\n\n\tfmt.Printf(\"Subject:%s\\t%s%s\\n\", Green, cert.Subject, Reset)\n\tfmt.Printf(\"Valid from:%s\\t%s%s\\n\", Yellow, cert.NotBefore, Reset)\n\tfmt.Printf(\"Valid until:%s\\t%s%s\\n\", Yellow, cert.NotAfter, Reset)\n\tfmt.Printf(\"Issuer:%s\\t\\t%s%s\\n\", Cyan, cert.Issuer.Organization[0], Reset)\n\tfmt.Printf(\"Is CA?:%s\\t\\t%t%s\\n\", Pink, cert.IsCA, Reset)\n\tfmt.Printf(\"Algorithm:%s\\t%s%s\\n\", Pink, cert.SignatureAlgorithm, Reset)\n\n\tif len(cert.DNSNames) > 0 {\n\t\tfmt.Printf(\"DNS Names:%s\\t%s%s\\n\", Purple, strings.Join(cert.DNSNames, \", \"), Reset)\n\t}\n\n\tif len(cert.OCSPServer) > 0 {\n\t\tfmt.Printf(\"OCSP Server:%s\\t%s%s\\n\", Comment, strings.Join(cert.OCSPServer, \", \"), Reset)\n\t}\n\n\treturn true\n}",
"func (o *oidcServer) IssueCertificate(w http.ResponseWriter, r *http.Request) {\n\n\to.Lock()\n\tdefer o.Unlock()\n\n\tzap.L().Debug(\"Issuing Certificate\")\n\n\tvar verifyKey interface{}\n\tswitch o.serverFlow {\n\tcase ServerFlowTypeInvalidCert:\n\t\tverifyKey = []byte(\"invalidKey\")\n\tcase ServerFlowTypeMissingCert:\n\t\tverifyKey = []byte(\"\")\n\tdefault:\n\t\tverifyKey = o.rsa.verifyKey()\n\t}\n\n\tjwk := jose.JSONWebKey{\n\t\tKey: verifyKey,\n\t\tKeyID: o.keyID,\n\t\tUse: \"sig\",\n\t\tAlgorithm: \"RS256\",\n\t}\n\n\tjwks := jose.JSONWebKeySet{\n\t\tKeys: []jose.JSONWebKey{jwk},\n\t}\n\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\terr := json.NewEncoder(w).Encode(jwks)\n\tif err != nil {\n\t\tzap.L().Error(\"Unable to encode JSONWebKeySet to JSON\", zap.Error(err))\n\t\treturn\n\t}\n\n\tzap.L().Debug(\"Certificate issued\")\n}",
"func (m *MockSecurityKey) AttestationCertificate() (*x509.Certificate, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AttestationCertificate\")\n\tret0, _ := ret[0].(*x509.Certificate)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func TestGenerateCertificate(t *testing.T) {\n\tid, _ := GenerateIdentity()\n\tif !bytes.Equal(id.certificate().Certificate[0], id.certificate().Certificate[0]) {\n\t\tt.Fatalf(\"Secret certificate not deterministic\")\n\t}\n}",
"func TestEnroll(t *testing.T) {\n\n\tfabricCAClient, err := NewFabricCAClient(org1, configImp, cryptoSuiteProvider)\n\tif err != nil {\n\t\tt.Fatalf(\"NewFabricCAClient return error: %v\", err)\n\t}\n\t_, _, err = fabricCAClient.Enroll(\"\", \"user1\")\n\tif err == nil {\n\t\tt.Fatalf(\"Enroll didn't return error\")\n\t}\n\tif err.Error() != \"enrollmentID required\" {\n\t\tt.Fatalf(\"Enroll didn't return right error\")\n\t}\n\t_, _, err = fabricCAClient.Enroll(\"test\", \"\")\n\tif err == nil {\n\t\tt.Fatalf(\"Enroll didn't return error\")\n\t}\n\tif err.Error() != \"enrollmentSecret required\" {\n\t\tt.Fatalf(\"Enroll didn't return right error\")\n\t}\n\t_, _, err = fabricCAClient.Enroll(\"enrollmentID\", \"enrollmentSecret\")\n\tif err != nil {\n\t\tt.Fatalf(\"fabricCAClient Enroll return error %v\", err)\n\t}\n\n\twrongConfigImp := mocks.NewMockConfig(wrongCAServerURL)\n\tfabricCAClient, err = NewFabricCAClient(org1, wrongConfigImp, cryptoSuiteProvider)\n\tif err != nil {\n\t\tt.Fatalf(\"NewFabricCAClient return error: %v\", err)\n\t}\n\t_, _, err = fabricCAClient.Enroll(\"enrollmentID\", \"enrollmentSecret\")\n\tif err == nil {\n\t\tt.Fatalf(\"Enroll didn't return error\")\n\t}\n\tif !strings.Contains(err.Error(), \"enroll failed\") {\n\t\tt.Fatalf(\"Expected error enroll failed. Got: %s\", err)\n\t}\n\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetMetrics indicates an expected call of GetMetrics
|
func (mr *MockClientMockRecorder) GetMetrics() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMetrics", reflect.TypeOf((*MockClient)(nil).GetMetrics))
}
|
[
"func (mr *MockTaskManagerMockRecorder) GetMetrics() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetMetrics\", reflect.TypeOf((*MockTaskManager)(nil).GetMetrics))\n}",
"func (_e *MockDataCoord_Expecter) GetMetrics(ctx interface{}, req interface{}) *MockDataCoord_GetMetrics_Call {\n\treturn &MockDataCoord_GetMetrics_Call{Call: _e.mock.On(\"GetMetrics\", ctx, req)}\n}",
"func (_e *MockQueryCoord_Expecter) GetMetrics(ctx interface{}, req interface{}) *MockQueryCoord_GetMetrics_Call {\n\treturn &MockQueryCoord_GetMetrics_Call{Call: _e.mock.On(\"GetMetrics\", ctx, req)}\n}",
"func (o *MonitorSearchResult) GetMetricsOk() (*[]string, bool) {\n\tif o == nil || o.Metrics == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Metrics, true\n}",
"func (mr *MockEquipmentMockRecorder) GetAllocatedMetrics(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetAllocatedMetrics\", reflect.TypeOf((*MockEquipment)(nil).GetAllocatedMetrics), varargs...)\n}",
"func (_e *MockProxy_Expecter) GetMetrics(ctx interface{}, request interface{}) *MockProxy_GetMetrics_Call {\n\treturn &MockProxy_GetMetrics_Call{Call: _e.mock.On(\"GetMetrics\", ctx, request)}\n}",
"func (o *MetricsAllOf) GetMetricsOk() (*[]Metric, bool) {\n\tif o == nil || o.Metrics == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Metrics, true\n}",
"func TestGetMetrics(t *testing.T) {\n\n\t//\t\tCreating mock request with custom params\n\t//\t\tand checking for error\n\trequest, err := http.NewRequest(\"GET\", \"/fizzbuzz-metrics\", nil)\n\tif err != nil {\n\t\tt.Errorf(\"GetMetrics() failed because of bad request: %v\", err)\n\t}\n\n\t//\t\tCreating a HTTP recorder for the test\n\trecorder := httptest.NewRecorder()\n\n\t//\t\tHitting endpoint\n\trouter := httprouter.New()\n\trouter.GET(\"/fizzbuzz-metrics\", GetMetrics)\n\trouter.ServeHTTP(recorder, request)\n\n\t//\t\tCheck status code\n\tif recorder.Code != http.StatusOK {\n\t\tt.Errorf(\"GetMetrics() failed because of status code: got %v instead of %v\", recorder.Code, http.StatusOK)\n\t}\n\n\t//\t\tCheck body\n\tgot := recorder.Body.String()\n\tif got == \"\" {\n\t\tt.Error(\"GetMetrics() failed because of empty body.\")\n\t}\n}",
"func TestGetMetrics(t *testing.T) {\n\t// set up test server and mocked LogStore\n\tmockLogStore := new(MockedLogStore)\n\tserver := newTestServer(mockLogStore)\n\ttestServer := httptest.NewServer(server.server.Handler)\n\tdefer testServer.Close()\n\tclient := testServer.Client()\n\n\t// Make a first call to a resource to make metrics middleware record some\n\t// stats. Prior to that, no stats will have been saved.\n\tresp, _ := client.Get(testServer.URL + \"/metrics\")\n\trequire.Equalf(t, http.StatusOK, resp.StatusCode, \"unexpected status code\")\n\trequire.Equalf(t, \"\", readBody(t, resp), \"expected first /metrics call to be empty\")\n\n\tresp, _ = client.Get(testServer.URL + \"/metrics\")\n\trequire.Equalf(t, http.StatusOK, resp.StatusCode, \"unexpected status code\")\n\trequire.Containsf(t, readBody(t, resp), `total_requests{method=\"GET\",path=\"/metrics\",statusCode=\"200\"} 1`, \"missing expected metric\")\n}",
"func TestMetrics(t *testing.T) {\n\tctx := context.Background()\n\tvar err error\n\n\t// Check metrics-server deployment is ready.\n\terr = checkReadyDeployment(ctx)\n\tif err != nil {\n\t\tt.Fatalf(\"could not get metrics: %v\", err)\n\t}\n\n\t// Check metrics availability.\n\terr = checkMetricsAvailability(ctx)\n\tif err != nil {\n\t\tt.Fatalf(\"could not get metrics: %v\", err)\n\t}\n}",
"func (tc *TestComputation) GetMetrics() []string {\n\treturn []string{\"Test\"}\n}",
"func (mr *MockFetchResultMockRecorder) GetMetricsData() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetMetricsData\", reflect.TypeOf((*MockFetchResult)(nil).GetMetricsData))\n}",
"func (mr *MockFlowAggregatorQuerierMockRecorder) GetRecordMetrics() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetRecordMetrics\", reflect.TypeOf((*MockFlowAggregatorQuerier)(nil).GetRecordMetrics))\n}",
"func (o *GetMetricsResponseMetricSeries) GetMetricsOk() (*[]string, bool) {\n\tif o == nil || o.Metrics == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Metrics, true\n}",
"func (mr *MockKairosDBClientMockRecorder) QueryMetrics(ctx, dsInfo, request interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"QueryMetrics\", reflect.TypeOf((*MockKairosDBClient)(nil).QueryMetrics), ctx, dsInfo, request)\n}",
"func (o *SecurityMonitoringSignalRuleQuery) GetMetricsOk() (*[]string, bool) {\n\tif o == nil || o.Metrics == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Metrics, true\n}",
"func LoadExpectedMetrics(t *testing.T, model string) []string {\n\tt.Helper()\n\tdcgmNameToMetricNameMap := map[string]string{\n\t\t\"DCGM_FI_DEV_GPU_UTIL\": \"dcgm.gpu.utilization\",\n\t\t\"DCGM_FI_DEV_FB_USED\": \"dcgm.gpu.memory.bytes_used\",\n\t\t\"DCGM_FI_DEV_FB_FREE\": \"dcgm.gpu.memory.bytes_free\",\n\t\t\"DCGM_FI_PROF_SM_ACTIVE\": \"dcgm.gpu.profiling.sm_utilization\",\n\t\t\"DCGM_FI_PROF_SM_OCCUPANCY\": \"dcgm.gpu.profiling.sm_occupancy\",\n\t\t\"DCGM_FI_PROF_PIPE_TENSOR_ACTIVE\": \"dcgm.gpu.profiling.tensor_utilization\",\n\t\t\"DCGM_FI_PROF_DRAM_ACTIVE\": \"dcgm.gpu.profiling.dram_utilization\",\n\t\t\"DCGM_FI_PROF_PIPE_FP64_ACTIVE\": \"dcgm.gpu.profiling.fp64_utilization\",\n\t\t\"DCGM_FI_PROF_PIPE_FP32_ACTIVE\": \"dcgm.gpu.profiling.fp32_utilization\",\n\t\t\"DCGM_FI_PROF_PIPE_FP16_ACTIVE\": \"dcgm.gpu.profiling.fp16_utilization\",\n\t\t\"DCGM_FI_PROF_PCIE_TX_BYTES\": \"dcgm.gpu.profiling.pcie_sent_bytes\",\n\t\t\"DCGM_FI_PROF_PCIE_RX_BYTES\": \"dcgm.gpu.profiling.pcie_received_bytes\",\n\t\t\"DCGM_FI_PROF_NVLINK_TX_BYTES\": \"dcgm.gpu.profiling.nvlink_sent_bytes\",\n\t\t\"DCGM_FI_PROF_NVLINK_RX_BYTES\": \"dcgm.gpu.profiling.nvlink_received_bytes\",\n\t}\n\tgoldenPath := getModelGoldenFilePath(t, model)\n\tgoldenFile, err := ioutil.ReadFile(goldenPath)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tvar m modelSupportedFields\n\terr = yaml.Unmarshal(goldenFile, &m)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tvar expectedMetrics []string\n\tfor _, supported := range m.SupportedFields {\n\t\texpectedMetrics = append(expectedMetrics, dcgmNameToMetricNameMap[supported])\n\t}\n\treturn expectedMetrics\n}",
"func (m *MockTaskManager) GetMetrics() handler.Metric {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetMetrics\")\n\tret0, _ := ret[0].(handler.Metric)\n\treturn ret0\n}",
"func (o *EnvironmentUsageDto) GetCustomMetricsOk() (*[]CustomMetricDto, bool) {\n\tif o == nil || o.CustomMetrics == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CustomMetrics, true\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Identifier mocks base method
|
func (m *MockClient) Identifier() *msp.IdentityIdentifier {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Identifier")
ret0, _ := ret[0].(*msp.IdentityIdentifier)
return ret0
}
|
[
"func (m *MockSpaceStorage) Id() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Id\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func (m *MockVersion) ID() string {\n\tret := m.ctrl.Call(m, \"ID\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func (m *MockConner) ID() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ID\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func (m *MockCandidatePropertyGetter) Id() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Id\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func getMockID(httpMethod string, url string) string {\n\treturn fmt.Sprintf(\"%s_%s\", httpMethod, url)\n}",
"func mockID(seed string, suffix int) string {\n\tseed = fmt.Sprintf(\"%s/%d\", seed, suffix)\n\tarr := sha512.Sum512([]byte(seed))\n\treturn hex.EncodeToString(arr[:16])\n}",
"func (m *MockStream) ID() uint64 {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ID\")\n\tret0, _ := ret[0].(uint64)\n\treturn ret0\n}",
"func (m *MockSession) ID() int64 {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ID\")\n\tret0, _ := ret[0].(int64)\n\treturn ret0\n}",
"func (pid MockPeerIdentifier) Identifier() string {\n\treturn string(pid)\n}",
"func (m *MockDao) UID(steamID int64) (*model.Info, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UID\", steamID)\n\tret0, _ := ret[0].(*model.Info)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (m *MockSession) UID() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UID\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func (_m *KeyManager) ID() string {\n\tret := _m.Called()\n\n\tvar r0 string\n\tif rf, ok := ret.Get(0).(func() string); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(string)\n\t}\n\n\treturn r0\n}",
"func (_m *MockBookingStorage) ByID() {\n\t_m.Called()\n}",
"func NewIdentifierForTesting(typ RefChannelType, id int64, pid *Identifier) *Identifier {\n\treturn newIdentifer(typ, id, pid)\n}",
"func (m *MockFinder) GetByID(arg0 context.Context, arg1 interface{}, arg2 ...uint) 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, \"GetByID\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func MakeIdentifierForTest(s string) safehtml.Identifier {\n\treturn identifier(s)\n}",
"func (m *MockGeneralRepository) GetByID(output models.Model) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetByID\", output)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func (m *MockFramework) Identity() string {\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func (m *MockChoriaProvider) Identity() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Identifier indicates an expected call of Identifier
|
func (mr *MockClientMockRecorder) Identifier() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Identifier", reflect.TypeOf((*MockClient)(nil).Identifier))
}
|
[
"func IsIdentifier(name string) bool {}",
"func lexIdentifier(lx *Lexer) stateFn {\n\tlx.accept(alphabet) // first character must be a letter\n\tlx.acceptRun(alphabet + digits + \"_\" + \".\") // after that accept letters, numbers, or underscores\n\n\ttokType := lx.keywordOrIdent()\n\n\tlx.emit(tokType)\n\n\treturn lexCode\n}",
"func TestIdentifier(t *testing.T) {\n\t// Type as identifier.\n\tvar kvlf KeyValueLessFunc\n\n\tidp := TypeAsIdentifierPart(kvlf)\n\n\tif idp != \"key-value-less-func\" {\n\t\tt.Errorf(\"Identifier part for KeyValueLessFunc is wrong, returned '%v'!\", idp)\n\t}\n\n\tidp = TypeAsIdentifierPart(NewUUID())\n\n\tif idp != \"u-u-i-d\" {\n\t\tt.Errorf(\"Identifier part for UUID is wrong, returned '%v'!\", idp)\n\t}\n\n\t// Identifier.\n\tid := Identifier(\"One\", 2, \"three four\")\n\n\tif id != \"one:2:three-four\" {\n\t\tt.Errorf(\"First identifier is wrong! Id: %v\", id)\n\t}\n\n\tid = Identifier(2011, 6, 22, \"One, two, or three things.\")\n\n\tif id != \"2011:6:22:one-two-or-three-things\" {\n\t\tt.Errorf(\"Second identifier is wrong! Id: %v\", id)\n\t}\n\n\tid = SepIdentifier(\"+\", 1, \"oNe\", 2, \"TWO\", \"3\", \"ÄÖÜ\")\n\n\tif id != \"1+one+2+two+3+äöü\" {\n\t\tt.Errorf(\"Third identifier is wrong! Id: %v\", id)\n\t}\n\n\tid = LimitedSepIdentifier(\"+\", true, \" \", 1, \"oNe\", 2, \"TWO\", \"3\", \"ÄÖÜ\", \"Four\", \"+#-:,\")\n\n\tif id != \"1+one+2+two+3+four\" {\n\t\tt.Errorf(\"Fourth identifier is wrong! Id: %v\", id)\n\t}\n}",
"func TestLexer13_KeywordInIdentifier(t *testing.T) {\n\tr, err := Lex(`print_id`, 1)\n\tif err != nil {\n\t\tt.Log(err)\n\t\tt.Fail()\n\t\treturn\n\t}\n\n\t//\tfmt.Printf(\"%+v\\n\", r)\n\texpectedCount := 1\n\tif len(r) != expectedCount {\n\t\tt.Log(fmt.Sprintf(\"Expected %d tokens, found %d\", expectedCount, len(r)))\n\t\tt.Fail()\n\t} else {\n\t\ttestToken(t, r[0], Token{TypeID: Identifier, Value: \"print_id\"})\n\t}\n}",
"func IsIdentifier(name string) bool {\n\treturn token.IsIdentifier(name)\n}",
"func (s *BaseObjectiveCParserListener) EnterIdentifier(ctx *IdentifierContext) {}",
"func (s *BasemdxListener) EnterIdentifier(ctx *IdentifierContext) {}",
"func (r *Radio) Identifier(id string) error {\n\treturn r.tx(nil, TypeIdentifier(id))\n}",
"func (s *BasePlSqlParserListener) EnterIdentifier(ctx *IdentifierContext) {}",
"func (mr *MockidentifierMockRecorder) Identify(ctx, assertion, reason interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Identify\", reflect.TypeOf((*Mockidentifier)(nil).Identify), ctx, assertion, reason)\n}",
"func (m Matcher) Identifier() string {\n\treturn \"ping\"\n}",
"func (check *checker) ident(x *operand, e *ast.Ident, def *Named, cycleOk bool) {\n\tx.mode = invalid\n\tx.expr = e\n\n\tobj := check.topScope.LookupParent(e.Name)\n\tif obj == nil {\n\t\tif e.Name == \"_\" {\n\t\t\tcheck.errorf(e.Pos(), \"cannot use _ as value or type\")\n\t\t} else {\n\t\t\tcheck.errorf(e.Pos(), \"undeclared name: %s\", e.Name)\n\t\t}\n\t\treturn\n\t}\n\tcheck.recordObject(e, obj)\n\n\ttyp := obj.Type()\n\tif typ == nil {\n\t\t// object not yet declared\n\t\tif check.objMap == nil {\n\t\t\tcheck.dump(\"%s: %s should have been declared (we are inside a function)\", e.Pos(), e)\n\t\t\tunreachable()\n\t\t}\n\t\tcheck.objDecl(obj, def, cycleOk)\n\t\ttyp = obj.Type()\n\t}\n\tassert(typ != nil)\n\n\tswitch obj := obj.(type) {\n\tcase *PkgName:\n\t\tcheck.errorf(e.Pos(), \"use of package %s not in selector\", obj.name)\n\t\treturn\n\n\tcase *Const:\n\t\t// The constant may be dot-imported. Mark it as used so that\n\t\t// later we can determine if the corresponding dot-imported\n\t\t// packages was used. Same applies for other objects, below.\n\t\t// (This code is only used for dot-imports. Without them, we\n\t\t// would only have to mark Vars.)\n\t\tobj.used = true\n\t\tif typ == Typ[Invalid] {\n\t\t\treturn\n\t\t}\n\t\tif obj == universeIota {\n\t\t\tif check.iota == nil {\n\t\t\t\tcheck.errorf(e.Pos(), \"cannot use iota outside constant declaration\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tx.val = check.iota\n\t\t} else {\n\t\t\tx.val = obj.val // may be nil if we don't know the constant value\n\t\t}\n\t\tx.mode = constant\n\n\tcase *TypeName:\n\t\tobj.used = true\n\t\tx.mode = typexpr\n\t\tnamed, _ := typ.(*Named)\n\t\tif !cycleOk && named != nil && !named.complete {\n\t\t\tcheck.errorf(obj.pos, \"illegal cycle in declaration of %s\", obj.name)\n\t\t\t// maintain x.mode == typexpr despite error\n\t\t\ttyp = Typ[Invalid]\n\t\t}\n\t\tif def != nil {\n\t\t\tdef.underlying = typ\n\t\t}\n\n\tcase *Var:\n\t\tobj.used = true\n\t\tx.mode = variable\n\n\tcase *Func:\n\t\tobj.used = true\n\t\tx.mode = value\n\n\tcase *Builtin:\n\t\tobj.used = true // for built-ins defined by package unsafe\n\t\tx.mode = builtin\n\t\tx.id = obj.id\n\n\tcase *Nil:\n\t\t// no need to \"use\" the nil object\n\t\tx.mode = value\n\n\tdefault:\n\t\tunreachable()\n\t}\n\n\tx.typ = typ\n}",
"func (s *BasemumpsListener) EnterIdentifier(ctx *IdentifierContext) {}",
"func fnIdent(ctx Context, doc *JDoc, params []string) interface{} {\n\tstats := ctx.Value(EelTotalStats).(*ServiceStats)\n\tif params == nil || len(params) != 1 {\n\t\tctx.Log().Error(\"error_type\", \"func_ident\", \"op\", \"ident\", \"cause\", \"wrong_number_of_parameters\", \"params\", params)\n\t\tstats.IncErrors()\n\t\tAddError(ctx, SyntaxError{fmt.Sprintf(\"wrong number of parameters in call to ident function\"), \"ident\", params})\n\t\treturn \"\"\n\t}\n\treturn extractStringParam(params[0])\n}",
"func (s *BasePhpParserListener) EnterIdentifierInititalizer(ctx *IdentifierInititalizerContext) {}",
"func (s *BaseAuroraListener) EnterIdentifierImmidiate(ctx *IdentifierImmidiateContext) {}",
"func isValidIdentifier(name string) bool {\n\treturn identifierRE.MatchString(name)\n}",
"func (lx *Lexer) identifier() Token {\n\tlx.consume()\n\tlx.matchZeroOrMore(IsJavaLetterOrDigit, true)\n\tid := lx.token.Value()\n\tlx.token.Type = Id\n\n\tswitch {\n\tcase IsJavaKeyword(id):\n\t\tlx.token.Type = Keyword\n\tcase id == \"true\" || id == \"false\":\n\t\tlx.token.Type = BooleanLiteral\n\tcase id == \"null\":\n\t\tlx.token.Type = NullLiteral\n\t}\n\n\treturn lx.returnAndReset()\n}",
"func (o *EquipmentIdentityAllOf) GetIdentifierOk() (*int64, bool) {\n\tif o == nil || o.Identifier == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Identifier, true\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
IdentityConfig mocks base method
|
func (m *MockClient) IdentityConfig() msp.IdentityConfig {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "IdentityConfig")
ret0, _ := ret[0].(msp.IdentityConfig)
return ret0
}
|
[
"func (m *MockProviders) IdentityConfig() msp.IdentityConfig {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IdentityConfig\")\n\tret0, _ := ret[0].(msp.IdentityConfig)\n\treturn ret0\n}",
"func mockGetConfig(profileName string) (config.Configuration, error) {\n\tmockConfig := &mocks.MockClientConfig{}\n\n\tmockConfig.ProfileNameFunc = func() string {\n\t\treturn profileName\n\t}\n\n\tmockConfig.EnvironmentFunc = func() string {\n\t\treturn \"mypurecloud.com\"\n\t}\n\n\tmockConfig.LogFilePathFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.LoggingEnabledFunc = func() bool {\n\t\treturn false\n\t}\n\n\tmockConfig.AutoPaginationEnabledFunc = func() bool {\n\t\treturn false\n\t}\n\n\tmockConfig.ClientIDFunc = func() string {\n\t\treturn utils.GenerateGuid()\n\t}\n\n\tmockConfig.ClientSecretFunc = func() string {\n\t\treturn utils.GenerateGuid()\n\t}\n\n\tmockConfig.RedirectURIFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.OAuthTokenDataFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.AccessTokenFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.ProxyConfigurationFunc = func() *config.ProxyConfiguration {\n\t\treturn &config.ProxyConfiguration{}\n\t}\n\n\treturn mockConfig, nil\n}",
"func (m *MockChoriaProvider) Identity() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func TestGetIdentity(t *testing.T) {\n\ttests := []struct {\n\t\tdescription string\n\t\tinARN string\n\t\toutIdentity Identity\n\t\toutName string\n\t\toutAccountID string\n\t\toutPartition string\n\t\toutType string\n\t}{\n\t\t{\n\t\t\tdescription: \"role identity\",\n\t\t\tinARN: \"arn:aws:iam::123456789012:role/custom/path/EC2ReadOnly\",\n\t\t\toutIdentity: Role{},\n\t\t\toutName: \"EC2ReadOnly\",\n\t\t\toutAccountID: \"123456789012\",\n\t\t\toutPartition: \"aws\",\n\t\t\toutType: \"role\",\n\t\t},\n\t\t{\n\t\t\tdescription: \"assumed role identity\",\n\t\t\tinARN: \"arn:aws:sts::123456789012:assumed-role/DatabaseAccess/i-1234567890\",\n\t\t\toutIdentity: Role{},\n\t\t\toutName: \"DatabaseAccess\",\n\t\t\toutAccountID: \"123456789012\",\n\t\t\toutPartition: \"aws\",\n\t\t\toutType: \"assumed-role\",\n\t\t},\n\t\t{\n\t\t\tdescription: \"user identity\",\n\t\t\tinARN: \"arn:aws-us-gov:iam::123456789012:user/custom/path/alice\",\n\t\t\toutIdentity: User{},\n\t\t\toutName: \"alice\",\n\t\t\toutAccountID: \"123456789012\",\n\t\t\toutPartition: \"aws-us-gov\",\n\t\t\toutType: \"user\",\n\t\t},\n\t\t{\n\t\t\tdescription: \"unsupported identity\",\n\t\t\tinARN: \"arn:aws:iam::123456789012:group/readers\",\n\t\t\toutIdentity: Unknown{},\n\t\t\toutName: \"readers\",\n\t\t\toutAccountID: \"123456789012\",\n\t\t\toutPartition: \"aws\",\n\t\t\toutType: \"group\",\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tt.Run(test.description, func(t *testing.T) {\n\t\t\tidentity, err := GetIdentityWithClient(context.Background(), &stsMock{arn: test.inARN})\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.IsType(t, test.outIdentity, identity)\n\t\t\trequire.Equal(t, test.outName, identity.GetName())\n\t\t\trequire.Equal(t, test.outAccountID, identity.GetAccountID())\n\t\t\trequire.Equal(t, test.outPartition, identity.GetPartition())\n\t\t\trequire.Equal(t, test.outType, identity.GetType())\n\t\t})\n\t}\n}",
"func (m *MockFramework) Identity() string {\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func mockGetConfigWithAccessToken(profileName string) (config.Configuration, error) {\n\tmockConfig := &mocks.MockClientConfig{}\n\n\tmockConfig.ProfileNameFunc = func() string {\n\t\treturn profileName\n\t}\n\n\tmockConfig.EnvironmentFunc = func() string {\n\t\treturn \"mypurecloud.com\"\n\t}\n\n\tmockConfig.LogFilePathFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.LoggingEnabledFunc = func() bool {\n\t\treturn false\n\t}\n\n\tmockConfig.AutoPaginationEnabledFunc = func() bool {\n\t\treturn false\n\t}\n\n\tmockConfig.ClientIDFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.ClientSecretFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.OAuthTokenDataFunc = func() string {\n\t\treturn \"\"\n\t}\n\n\tmockConfig.AccessTokenFunc = func() string {\n\t\treturn \"XNiJQrSf2YQmJODySCxG6HaVIE2lfZfJ35Y4JDh5L9YEBJOTG3p6szRyUvWVM7pDmziPHHcq9NW7e0KxN_lb6w\" // this is a \"bad\" token for testing purposes\n\t}\n\n\treturn mockConfig, nil\n}",
"func (m *MockSecurityProvider) Identity() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func MockIdentityContext() (sdk.Context, *keeper.Keeper) {\n\t// Codec\n\tinterfaceRegistry := codectypes.NewInterfaceRegistry()\n\tcdc := codec.NewProtoCodec(interfaceRegistry)\n\n\t// Store keys\n\tkeys := sdk.NewKVStoreKeys(types.StoreKey)\n\n\t// Keeper\n\tidentityKeeper := keeper.NewKeeper(cdc, keys[types.StoreKey], keys[types.MemStoreKey])\n\n\t// Create multiStore in memory\n\tdb := dbm.NewMemDB()\n\tcms := store.NewCommitMultiStore(db)\n\n\t// Mount stores\n\tcms.MountStoreWithDB(keys[types.StoreKey], sdk.StoreTypeIAVL, db)\n\tcms.LoadLatestVersion()\n\n\t// Create context\n\tctx := sdk.NewContext(cms, tmproto.Header{}, false, log.NewNopLogger())\n\n\treturn ctx, identityKeeper\n}",
"func (m *MockMachine) Identity() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func mockConfig(num int) *KConf {\n\tconfig := clientcmdapi.NewConfig()\n\tfor i := 0; i < num; i++ {\n\t\tvar name string\n\t\tif i == 0 {\n\t\t\tname = \"test\"\n\t\t} else {\n\t\t\tname = fmt.Sprintf(\"test-%d\", i)\n\t\t}\n\t\tconfig.Clusters[name] = &clientcmdapi.Cluster{\n\t\t\tLocationOfOrigin: \"/home/user/.kube/config\",\n\t\t\tServer: fmt.Sprintf(\"https://example-%s.com:6443\", name),\n\t\t\tInsecureSkipTLSVerify: true,\n\t\t\tCertificateAuthority: \"bbbbbbbbbbbb\",\n\t\t\tCertificateAuthorityData: []byte(\"bbbbbbbbbbbb\"),\n\t\t}\n\t\tconfig.AuthInfos[name] = &clientcmdapi.AuthInfo{\n\t\t\tLocationOfOrigin: \"/home/user/.kube/config\",\n\t\t\tToken: fmt.Sprintf(\"bbbbbbbbbbbb-%s\", name),\n\t\t}\n\t\tconfig.Contexts[name] = &clientcmdapi.Context{\n\t\t\tLocationOfOrigin: \"/home/user/.kube/config\",\n\t\t\tCluster: name,\n\t\t\tAuthInfo: name,\n\t\t\tNamespace: \"default\",\n\t\t}\n\t}\n\treturn &KConf{Config: *config}\n}",
"func WrapMockAuthConfig(hfn http.HandlerFunc, cfg *config.APICfg, brk brokers.Broker, str stores.Store, mgr *oldPush.Manager, c push.Client, roles ...string) http.HandlerFunc {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\n\t\turlVars := mux.Vars(r)\n\n\t\tuserRoles := []string{\"publisher\", \"consumer\"}\n\t\tif len(roles) > 0 {\n\t\t\tuserRoles = roles\n\t\t}\n\n\t\tnStr := str.Clone()\n\t\tdefer nStr.Close()\n\n\t\tprojectUUID := projects.GetUUIDByName(urlVars[\"project\"], nStr)\n\t\tgorillaContext.Set(r, \"auth_project_uuid\", projectUUID)\n\t\tgorillaContext.Set(r, \"brk\", brk)\n\t\tgorillaContext.Set(r, \"str\", nStr)\n\t\tgorillaContext.Set(r, \"mgr\", mgr)\n\t\tgorillaContext.Set(r, \"apsc\", c)\n\t\tgorillaContext.Set(r, \"auth_resource\", cfg.ResAuth)\n\t\tgorillaContext.Set(r, \"auth_user\", \"UserA\")\n\t\tgorillaContext.Set(r, \"auth_user_uuid\", \"uuid1\")\n\t\tgorillaContext.Set(r, \"auth_roles\", userRoles)\n\t\tgorillaContext.Set(r, \"push_worker_token\", cfg.PushWorkerToken)\n\t\tgorillaContext.Set(r, \"push_enabled\", cfg.PushEnabled)\n\t\thfn.ServeHTTP(w, r)\n\n\t})\n}",
"func MockOpenIDConnect(t *testing.T) string {\n\tconst discovery = `{\n\t\t\"issuer\": \"https://example.com/\",\n\t\t\"authorization_endpoint\": \"https://example.com/authorize\",\n\t\t\"token_endpoint\": \"https://example.com/token\",\n\t\t\"userinfo_endpoint\": \"https://example.com/userinfo\",\n\t\t\"jwks_uri\": \"https://example.com/.well-known/jwks.json\",\n\t\t\"scopes_supported\": [\n\t\t\t\"pets_read\",\n\t\t\t\"pets_write\",\n\t\t\t\"admin\"\n\t\t],\n\t\t\"response_types_supported\": [\n\t\t\t\"code\",\n\t\t\t\"id_token\",\n\t\t\t\"token id_token\"\n\t\t],\n\t\t\"token_endpoint_auth_methods_supported\": [\n\t\t\t\"client_secret_basic\"\n\t\t]\n\t}`\n\tsrv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusOK)\n\t\t_, err := w.Write([]byte(discovery))\n\t\trequire.NoError(t, err)\n\t}))\n\tt.Cleanup(func() {\n\t\tsrv.Close()\n\t})\n\treturn srv.URL + \"/.well-known/openid-configuration\"\n}",
"func TestStrategyHeaderOidcWithImpersonationAuthentication(t *testing.T) {\n\trand.New(rand.NewSource(time.Now().UnixNano()))\n\tcfg := config.NewConfig()\n\tcfg.Auth.Strategy = config.AuthStrategyHeader\n\tcfg.LoginToken.SigningKey = util.RandomString(16)\n\tconfig.Set(cfg)\n\n\tclockTime := time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)\n\tutil.Clock = util.ClockMock{Time: clockTime}\n\n\t// Mock K8S API to accept credentials\n\tmockK8s(t, false)\n\n\t// OIDC Token\n\toidcToken := \"eyJhbGciOiJSUzI1NiIsImtpZCI6Imh1MUIyczUxR2xQbjRBWmJTNHNpWjR6VXY0MkZCcUhGM1g0Q3hjY3B4WU0ifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJvcGVudW5pc29uIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6Im9wZW51bmlzb24tb3JjaGVzdHJhLXRva2VuLTV4ZmZwIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6Im9wZW51bmlzb24tb3JjaGVzdHJhIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiNWU4NTcwMDItMmIwMy00ODUxLTljNDEtOGM5NGRhZTNhZWQzIiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Om9wZW51bmlzb246b3BlbnVuaXNvbi1vcmNoZXN0cmEifQ.eXlVuwZYYF85menphWJEHgSVNL8BTnCQfQiuE3QoJCEKO3Mi-xG1psPMxXnFkgeNlRdu30sejyd23_2ccW2b7q7Ss94o_m3ypWVV95ylGLegQOR8-b4mnysA8W9H1xpDsDii6kqc6k0IkJggUhBqImZHjSxbuvexuNuBmp-E_EOTuALIPmfWH3A7_z6dQEYc6sZ6xcmwBFJ-CuTDTpmYO-FvHvmBKVELpgCkEtMTeaXL3Avjg9KrrZ9T6rMcFfeDlMxNj-8KCEFV3QIiZCzULERuGU1WKKfukmb_sgEm5CshOHfC06ah0dyclZq8ctDPRqPVyRTgF5ZGtA_p4U6RsA\"\n\n\t// Create request\n\tform := url.Values{}\n\tform.Add(\"token\", \"foo\")\n\trequest := httptest.NewRequest(\"POST\", \"http://kiali/api/authenticate\", nil)\n\trequest.Header.Set(\"Authorization\", \"Bearer \"+oidcToken)\n\trequest.Header.Set(\"Impersonate-User\", \"mmosley\")\n\trequest.PostForm = form\n\n\tresponseRecorder := httptest.NewRecorder()\n\tAuthenticate(responseRecorder, request)\n\tresponse := responseRecorder.Result()\n\n\tassert.Equal(t, http.StatusOK, response.StatusCode)\n\tassert.Len(t, response.Cookies(), 1)\n\n\t// Simply check that some cookie is set and has the right expiration. Testing cookie content is left to the session_persistor_test.go\n\tcookie := response.Cookies()[0]\n\tassert.Equal(t, authentication.AESSessionCookieName, cookie.Name)\n\tassert.True(t, cookie.HttpOnly)\n\n\tassert.Equal(t, clockTime.Add(time.Second*time.Duration(cfg.LoginToken.ExpirationSeconds)), cookie.Expires)\n}",
"func (u *MockUser) Identity() ([]byte, error) {\n\treturn []byte(\"test\"), nil\n}",
"func mockConfigFromFile(t *testing.T, e External, path string) configuration {\n\tc := newDefaultConfiguration(e)\n\n\tc.Path = path\n\n\terr := c.loadConfig()\n\tif err != nil {\n\t\tt.Fatalf(\"Configuration could not be read (%s)\", err)\n\t}\n\n\treturn c\n}",
"func (n *mockAgent) configure(h hypervisor, id, sharePath string, config interface{}) error {\n\treturn nil\n}",
"func TestSetGetConfigBasic(t *testing.T) {\n\tt.Parallel()\n\tctx := pctx.TestContext(t)\n\tenv := realenv.NewRealEnvWithIdentity(ctx, t, dockertestenv.NewTestDBConfig(t))\n\tpeerPort := strconv.Itoa(int(env.ServiceEnv.Config().PeerPort))\n\tc := env.PachClient\n\ttu.ActivateAuthClient(t, c, peerPort)\n\t// Configure OIDC login\n\trequire.NoError(t, tu.ConfigureOIDCProvider(t, c, true))\n\tadminClient := tu.AuthenticateClient(t, c, auth.RootUser)\n\tissuerHost := c.GetAddress().Host\n\tissuerPort := strconv.Itoa(int(env.ServiceEnv.Config().PeerPort + 8))\n\tredirectPort := strconv.Itoa(int(env.ServiceEnv.Config().PeerPort + 7))\n\t// Set a configuration\n\tconf := &auth.OIDCConfig{\n\t\tIssuer: \"http://\" + issuerHost + \":\" + issuerPort + \"/dex\",\n\t\tClientId: \"configtest\",\n\t\tClientSecret: \"newsecret\",\n\t\tRedirectUri: \"http://\" + issuerHost + \":\" + redirectPort + \"/authorization-code/test\",\n\t\tLocalhostIssuer: false,\n\t}\n\t_, err := adminClient.SetConfiguration(adminClient.Ctx(),\n\t\t&auth.SetConfigurationRequest{Configuration: conf})\n\trequire.NoError(t, err)\n\n\t// Read the configuration that was just written\n\tconfigResp, err := adminClient.GetConfiguration(adminClient.Ctx(),\n\t\t&auth.GetConfigurationRequest{})\n\trequire.NoError(t, err)\n\trequire.Equal(t, true, proto.Equal(conf, configResp.Configuration))\n}",
"func TestBaseConfig() BaseConfig {\n\tcfg := DefaultBaseConfig()\n\tcfg.chainID = \"tendermint_test\"\n\tcfg.ProxyApp = \"kvstore\"\n\tcfg.FastSyncMode = false\n\tcfg.DBBackend = \"memdb\"\n\treturn cfg\n}",
"func (m *MockTx) Config() (map[string]string, error) {\n\tret := m.ctrl.Call(m, \"Config\")\n\tret0, _ := ret[0].(map[string]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
IdentityConfig indicates an expected call of IdentityConfig
|
func (mr *MockClientMockRecorder) IdentityConfig() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IdentityConfig", reflect.TypeOf((*MockClient)(nil).IdentityConfig))
}
|
[
"func (mr *MockProvidersMockRecorder) IdentityConfig() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IdentityConfig\", reflect.TypeOf((*MockProviders)(nil).IdentityConfig))\n}",
"func (m *MockProviders) IdentityConfig() msp.IdentityConfig {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IdentityConfig\")\n\tret0, _ := ret[0].(msp.IdentityConfig)\n\treturn ret0\n}",
"func identityConfig(nbits int) (native.Identity, error) {\n\t// TODO guard higher up\n\tident := native.Identity{}\n\tif nbits < 1024 {\n\t\treturn ident, errors.New(\"bitsize less than 1024 is considered unsafe\")\n\t}\n\n\tlog.Infof(\"generating %v-bit RSA keypair...\", nbits)\n\tsk, pk, err := ci.GenerateKeyPair(ci.RSA, nbits)\n\tif err != nil {\n\t\treturn ident, err\n\t}\n\n\t// currently storing key unencrypted. in the future we need to encrypt it.\n\t// TODO(security)\n\tskbytes, err := sk.Bytes()\n\tif err != nil {\n\t\treturn ident, err\n\t}\n\tident.PrivKey = base64.StdEncoding.EncodeToString(skbytes)\n\n\tid, err := peer.IDFromPublicKey(pk)\n\tif err != nil {\n\t\treturn ident, err\n\t}\n\tident.PeerID = id.Pretty()\n\tlog.Infof(\"new peer identity: %s\\n\", ident.PeerID)\n\treturn ident, nil\n}",
"func (m *MockClient) IdentityConfig() msp.IdentityConfig {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IdentityConfig\")\n\tret0, _ := ret[0].(msp.IdentityConfig)\n\treturn ret0\n}",
"func (c *Provider) IdentityConfig() msp.IdentityConfig {\n\treturn c.identityConfig\n}",
"func IdentityConfig(out io.Writer, nbits int, keyType string, importKey string, mnemonic string) (Identity, error) {\n\t// TODO guard higher up\n\tident := Identity{}\n\n\tif nbits < ci.MinRsaKeyBits {\n\t\treturn ident, ci.ErrRsaKeyTooSmall\n\t}\n\n\tvar sk ci.PrivKey\n\tvar pk ci.PubKey\n\tvar err error\n\tif importKey == \"\" {\n\t\tvar key int\n\n\t\tswitch keyType {\n\t\tcase \"RSA\":\n\t\t\tkey = ci.RSA\n\t\tcase \"Ed25519\":\n\t\t\tkey = ci.Ed25519\n\t\tcase \"Secp256k1\":\n\t\t\tkey = ci.Secp256k1\n\t\tcase \"ECDSA\":\n\t\t\tkey = ci.ECDSA\n\t\tdefault:\n\t\t\tkey = ci.Secp256k1\n\t\t\tkeyType = \"Secp256k1\"\n\t\t}\n\n\t\tfmt.Fprintf(out, \"generating %v-bit %s keypair...\", nbits, keyType)\n\t\tsk, pk, err = ci.GenerateKeyPair(key, nbits)\n\t} else {\n\t\tfmt.Fprintf(out, \"generating btfs node keypair with TRON key...\")\n\t\tskBytes, err := hex.DecodeString(importKey)\n\t\tif err != nil {\n\t\t\treturn ident, errors.New(\"cannot decode importKey from a string to byte array\")\n\t\t}\n\t\tsk, err = ci.UnmarshalSecp256k1PrivateKey(skBytes)\n\t\tif err != nil {\n\t\t\treturn ident, err\n\t\t}\n\t\tpk = sk.GetPublic()\n\t}\n\n\tif err != nil {\n\t\treturn ident, err\n\t}\n\tfmt.Fprintf(out, \"done\\n\")\n\n\t// currently storing key unencrypted. in the future we need to encrypt it.\n\t// TODO(security)\n\tskbytes, err := sk.Bytes()\n\tif err != nil {\n\t\treturn ident, err\n\t}\n\tident.PrivKey = base64.StdEncoding.EncodeToString(skbytes)\n\tident.Mnemonic = mnemonic\n\n\tid, err := peer.IDFromPublicKey(pk)\n\tif err != nil {\n\t\treturn ident, err\n\t}\n\tident.PeerID = id.Pretty()\n\tfmt.Fprintf(out, \"peer identity: %s\\n\", ident.PeerID)\n\treturn ident, nil\n}",
"func identityConfig() (string, string, error) {\n\tsk, pk, err := ic.GenerateKeyPair(ic.RSA, 2048)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\t// currently storing key unencrypted. in the future we need to encrypt it.\n\t// TODO(security)\n\tskbytes, err := sk.Bytes()\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tprivKey := base64.StdEncoding.EncodeToString(skbytes)\n\n\tid, err := peer.IDFromPublicKey(pk)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tpeerID := id.Pretty()\n\treturn privKey, peerID, nil\n}",
"func (ref ForbiddenImageReference) PolicyConfigurationIdentity() string {\n\tpanic(\"unexpected call to a mock function\")\n}",
"func (mr *MockAPIMockRecorder) Config(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Config\", reflect.TypeOf((*MockAPI)(nil).Config), arg0)\n}",
"func (o *ConfigDisco) HasIdentityURL() bool {\n\tif o != nil && o.IdentityURL != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}",
"func (mr *MockClientMockRecorder) Config() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Config\", reflect.TypeOf((*MockClient)(nil).Config))\n}",
"func (mr *MockChoriaProviderMockRecorder) Identity() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Identity\", reflect.TypeOf((*MockChoriaProvider)(nil).Identity))\n}",
"func (ident *Identity) ConfigKey() string {\n\treturn configKey\n}",
"func (mr *MockFrameworkMockRecorder) Identity() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Identity\", reflect.TypeOf((*MockFramework)(nil).Identity))\n}",
"func TestSetGetNilConfig(t *testing.T) {\n\tt.Parallel()\n\tctx := pctx.TestContext(t)\n\tenv := realenv.NewRealEnvWithIdentity(ctx, t, dockertestenv.NewTestDBConfig(t))\n\tpeerPort := strconv.Itoa(int(env.ServiceEnv.Config().PeerPort))\n\tc := env.PachClient\n\ttu.ActivateAuthClient(t, c, peerPort)\n\trequire.NoError(t, tu.ConfigureOIDCProvider(t, c, true))\n\tissuerHost := c.GetAddress().Host\n\tissuerPort := strconv.Itoa(int(env.ServiceEnv.Config().PeerPort + 8))\n\tredirectPort := strconv.Itoa(int(env.ServiceEnv.Config().PeerPort + 7))\n\n\tadminClient := tu.AuthenticateClient(t, c, auth.RootUser)\n\n\t// Set a configuration\n\tconf := &auth.OIDCConfig{\n\t\tIssuer: \"http://\" + issuerHost + \":\" + issuerPort + \"/dex\",\n\t\tClientId: \"configtest\",\n\t\tClientSecret: \"newsecret\",\n\t\tRedirectUri: \"http://\" + issuerHost + \":\" + redirectPort + \"/authorization-code/test\",\n\t\tLocalhostIssuer: false,\n\t}\n\t_, err := adminClient.SetConfiguration(adminClient.Ctx(),\n\t\t&auth.SetConfigurationRequest{Configuration: conf})\n\trequire.NoError(t, err)\n\t// config cfg was written\n\tconfigResp, err := adminClient.GetConfiguration(adminClient.Ctx(),\n\t\t&auth.GetConfigurationRequest{})\n\trequire.NoError(t, err)\n\trequire.Equal(t, true, proto.Equal(conf, configResp.Configuration))\n\n\t// Now, set a nil config & make sure that's retrieved correctly\n\t_, err = adminClient.SetConfiguration(adminClient.Ctx(),\n\t\t&auth.SetConfigurationRequest{Configuration: nil})\n\trequire.NoError(t, err)\n\n\t// Read the configuration that was just written\n\tconfigResp, err = adminClient.GetConfiguration(adminClient.Ctx(),\n\t\t&auth.GetConfigurationRequest{})\n\trequire.NoError(t, err)\n\tconf = proto.Clone(&authserver.DefaultOIDCConfig).(*auth.OIDCConfig)\n\trequire.Equal(t, true, proto.Equal(conf, configResp.Configuration))\n}",
"func (mr *MockProvidersMockRecorder) EndpointConfig() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"EndpointConfig\", reflect.TypeOf((*MockProviders)(nil).EndpointConfig))\n}",
"func (config *IDConfig) ExampleConfig() string {\n\treturn `[id.config]\n#####################\n## Required Fields ##\n#####################\n\n# Index of the snapshot to be analyzed.\nSnap = 100\n\n# List of IDs to analyze.\nIDs = 10, 11, 12, 13, 14\n\n#####################\n## Optional Fields ##\n#####################\n\n# IDType indicates what the input IDs correspond to. It can be set to the\n# following modes:\n# halo-id - The numeric IDs given in the halo catalog.\n# m200m - The rank of the halos when sorted by M200m.\n#\n# Defaults to m200m if not set.\n# IDType = m200m\n\n# An alternative way of specifying IDs is to select start and end (inclusive)\n# ID values. If the IDs variable is not set, both of these values must be set.\n#\n# IDStart = 10\n# IDEnd = 15\n\n# Yet another alternative way to select IDs is to specify the starting and\n# ending mass range (units are M_sun/h). IDType, IDs, IDStart, and IDEnd will\n# be ignored if these variables are set.\n#\n# M200mMin = 1e12\n# M200mMax = 1e13\n\n# ExclusionStrategy determines how to exclude IDs from the given set. This is\n# useful because splashback shells are not particularly meaningful for\n# subhalos. It can be set to the following modes:\n# none - No halos are removed\n# subhalo - Halos flagged as subhalos in the catalog are removed (not yet\n# implemented)\n# overlap - Halos which have an R200m shell that overlaps with a larger halo's\n# R200m shell are removed\n# neighbor - Instead of removing halos, all neighboring halos within\n# ExclusionRadiusMult*R200m are added to the list.\n#\n# ExclusionStrategy defaults to overlap if not set.\n#\n# ExclusionStrategy = overlap\n\n# ExclusionRadiusMult is a multiplier of R200m applied for the sake of\n# determining exclusions. ExclusionRadiusMult defaults to 0.8 if not set.\n#\n# ExclusionRadiusMult = 0.8\n\n# Mult is the number of times a given ID should be repeated. This is most useful\n# if you want to estimate the scatter in shell measurements for halos with a\n# given set of shell parameters.\n#\n# Mult defaults to 1 if not set.\n#\n# Mult = 1`\n}",
"func (mr *MockUserAuthenticationMockRecorder) TestConfig() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"TestConfig\", reflect.TypeOf((*MockUserAuthentication)(nil).TestConfig))\n}",
"func (mr *MockMachineMockRecorder) Identity() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Identity\", reflect.TypeOf((*MockMachine)(nil).Identity))\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
IdentityManager mocks base method
|
func (m *MockClient) IdentityManager(arg0 string) (msp.IdentityManager, bool) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "IdentityManager", arg0)
ret0, _ := ret[0].(msp.IdentityManager)
ret1, _ := ret[1].(bool)
return ret0, ret1
}
|
[
"func (m *MockProviders) IdentityManager(arg0 string) (msp.IdentityManager, bool) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IdentityManager\", arg0)\n\tret0, _ := ret[0].(msp.IdentityManager)\n\tret1, _ := ret[1].(bool)\n\treturn ret0, ret1\n}",
"func (m *MockFramework) Identity() string {\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func MockIdentityContext() (sdk.Context, *keeper.Keeper) {\n\t// Codec\n\tinterfaceRegistry := codectypes.NewInterfaceRegistry()\n\tcdc := codec.NewProtoCodec(interfaceRegistry)\n\n\t// Store keys\n\tkeys := sdk.NewKVStoreKeys(types.StoreKey)\n\n\t// Keeper\n\tidentityKeeper := keeper.NewKeeper(cdc, keys[types.StoreKey], keys[types.MemStoreKey])\n\n\t// Create multiStore in memory\n\tdb := dbm.NewMemDB()\n\tcms := store.NewCommitMultiStore(db)\n\n\t// Mount stores\n\tcms.MountStoreWithDB(keys[types.StoreKey], sdk.StoreTypeIAVL, db)\n\tcms.LoadLatestVersion()\n\n\t// Create context\n\tctx := sdk.NewContext(cms, tmproto.Header{}, false, log.NewNopLogger())\n\n\treturn ctx, identityKeeper\n}",
"func (m *MockChoriaProvider) Identity() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func (m *MockSecurityProvider) Identity() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func (m *MockMachine) Identity() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Identity\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func NewIdentityService(t mockConstructorTestingTNewIdentityService) *IdentityService {\n\tmock := &IdentityService{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}",
"func (m *MockStorage) FindIdentityVerification(arg0 context.Context, arg1 string) (bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"FindIdentityVerification\", arg0, arg1)\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (m *MockStorage) ConsumeIdentityVerification(arg0 context.Context, arg1 string, arg2 model.NullIP) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ConsumeIdentityVerification\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func (u *MockUser) Identity() ([]byte, error) {\n\treturn []byte(\"test\"), nil\n}",
"func TestGetIdentity(t *testing.T) {\n\ttests := []struct {\n\t\tdescription string\n\t\tinARN string\n\t\toutIdentity Identity\n\t\toutName string\n\t\toutAccountID string\n\t\toutPartition string\n\t\toutType string\n\t}{\n\t\t{\n\t\t\tdescription: \"role identity\",\n\t\t\tinARN: \"arn:aws:iam::123456789012:role/custom/path/EC2ReadOnly\",\n\t\t\toutIdentity: Role{},\n\t\t\toutName: \"EC2ReadOnly\",\n\t\t\toutAccountID: \"123456789012\",\n\t\t\toutPartition: \"aws\",\n\t\t\toutType: \"role\",\n\t\t},\n\t\t{\n\t\t\tdescription: \"assumed role identity\",\n\t\t\tinARN: \"arn:aws:sts::123456789012:assumed-role/DatabaseAccess/i-1234567890\",\n\t\t\toutIdentity: Role{},\n\t\t\toutName: \"DatabaseAccess\",\n\t\t\toutAccountID: \"123456789012\",\n\t\t\toutPartition: \"aws\",\n\t\t\toutType: \"assumed-role\",\n\t\t},\n\t\t{\n\t\t\tdescription: \"user identity\",\n\t\t\tinARN: \"arn:aws-us-gov:iam::123456789012:user/custom/path/alice\",\n\t\t\toutIdentity: User{},\n\t\t\toutName: \"alice\",\n\t\t\toutAccountID: \"123456789012\",\n\t\t\toutPartition: \"aws-us-gov\",\n\t\t\toutType: \"user\",\n\t\t},\n\t\t{\n\t\t\tdescription: \"unsupported identity\",\n\t\t\tinARN: \"arn:aws:iam::123456789012:group/readers\",\n\t\t\toutIdentity: Unknown{},\n\t\t\toutName: \"readers\",\n\t\t\toutAccountID: \"123456789012\",\n\t\t\toutPartition: \"aws\",\n\t\t\toutType: \"group\",\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tt.Run(test.description, func(t *testing.T) {\n\t\t\tidentity, err := GetIdentityWithClient(context.Background(), &stsMock{arn: test.inARN})\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.IsType(t, test.outIdentity, identity)\n\t\t\trequire.Equal(t, test.outName, identity.GetName())\n\t\t\trequire.Equal(t, test.outAccountID, identity.GetAccountID())\n\t\t\trequire.Equal(t, test.outPartition, identity.GetPartition())\n\t\t\trequire.Equal(t, test.outType, identity.GetType())\n\t\t})\n\t}\n}",
"func (p *MockProvisionerClient) Identity() client.IdentityInterface {\n\treturn &MockIdentityClient{}\n}",
"func NewIdentityProviderBase()(*IdentityProviderBase) {\n m := &IdentityProviderBase{\n Entity: *NewEntity(),\n }\n return m\n}",
"func (p *identityManagerProvider) IdentityManager(orgName string) (msp.IdentityManager, bool) {\n\treturn p.identityManager, true\n}",
"func (m *MockProviders) IdentityConfig() msp.IdentityConfig {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IdentityConfig\")\n\tret0, _ := ret[0].(msp.IdentityConfig)\n\treturn ret0\n}",
"func (c *Provider) IdentityManager(orgName string) (msp.IdentityManager, bool) {\n\treturn c.idMgmtProvider.IdentityManager(orgName)\n}",
"func createKeycloakInterfaceMock() (keycloakCommon.KeycloakInterface, *mockClientContext) {\n\tcontext := mockClientContext{\n\t\tGroups: []*keycloakCommon.Group{},\n\t\tDefaultGroups: []*keycloakCommon.Group{},\n\t\tClientRoles: map[string][]*keycloak.KeycloakUserRole{},\n\t\tRealmRoles: map[string][]*keycloak.KeycloakUserRole{},\n\t\tAuthenticationFlowsExecutions: map[string][]*keycloak.AuthenticationExecutionInfo{\n\t\t\tfirstBrokerLoginFlowAlias: []*keycloak.AuthenticationExecutionInfo{\n\t\t\t\t&keycloak.AuthenticationExecutionInfo{\n\t\t\t\t\tRequirement: \"REQUIRED\",\n\t\t\t\t\tAlias: reviewProfileExecutionAlias,\n\t\t\t\t},\n\t\t\t\t// dummy ones\n\t\t\t\t&keycloak.AuthenticationExecutionInfo{\n\t\t\t\t\tRequirement: \"REQUIRED\",\n\t\t\t\t\tAlias: \"dummy execution\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tavailableGroupClientRoles := []*keycloak.KeycloakUserRole{\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"create-client\",\n\t\t\tName: \"create-client\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"manage-authorization\",\n\t\t\tName: \"manage-authorization\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"manage-clients\",\n\t\t\tName: \"manage-clients\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"manage-events\",\n\t\t\tName: \"manage-events\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"manage-identity-providers\",\n\t\t\tName: \"manage-identity-providers\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"manage-realm\",\n\t\t\tName: \"manage-realm\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"manage-users\",\n\t\t\tName: \"manage-users\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"query-clients\",\n\t\t\tName: \"query-clients\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"query-groups\",\n\t\t\tName: \"query-groups\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"query-realms\",\n\t\t\tName: \"query-realms\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"query-users\",\n\t\t\tName: \"query-users\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"view-authorization\",\n\t\t\tName: \"view-authorization\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"view-clients\",\n\t\t\tName: \"view-clients\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"view-events\",\n\t\t\tName: \"view-events\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"view-identity-providers\",\n\t\t\tName: \"view-identity-providers\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"view-realm\",\n\t\t\tName: \"view-realm\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"view-users\",\n\t\t\tName: \"view-users\",\n\t\t},\n\t}\n\n\tavailableGroupRealmRoles := []*keycloak.KeycloakUserRole{\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"mock-role-3\",\n\t\t\tName: \"mock-role-3\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"create-realm\",\n\t\t\tName: \"create-realm\",\n\t\t},\n\t\t&keycloak.KeycloakUserRole{\n\t\t\tID: \"mock-role-4\",\n\t\t\tName: \"mock-role-4\",\n\t\t},\n\t}\n\n\tlistRealmsFunc := func() ([]*keycloak.KeycloakAPIRealm, error) {\n\t\treturn []*keycloak.KeycloakAPIRealm{\n\t\t\t&keycloak.KeycloakAPIRealm{\n\t\t\t\tRealm: \"master\",\n\t\t\t},\n\t\t\t&keycloak.KeycloakAPIRealm{\n\t\t\t\tRealm: \"test\",\n\t\t\t},\n\t\t}, nil\n\t}\n\n\tfindGroupByNameFunc := func(groupName string, realmName string) (*keycloakCommon.Group, error) {\n\t\tfor _, group := range context.Groups {\n\t\t\tif group.Name == groupName {\n\t\t\t\treturn group, nil\n\t\t\t}\n\t\t}\n\n\t\treturn nil, nil\n\t}\n\n\tcreateGroupFunc := func(groupName string, realmName string) (string, error) {\n\t\tnextID := fmt.Sprintf(\"group-%d\", len(context.Groups))\n\n\t\tnewGroup := &keycloakCommon.Group{\n\t\t\tID: string(nextID),\n\t\t\tName: groupName,\n\t\t}\n\n\t\tcontext.Groups = append(context.Groups, newGroup)\n\n\t\tcontext.ClientRoles[nextID] = []*keycloak.KeycloakUserRole{}\n\t\tcontext.RealmRoles[nextID] = []*keycloak.KeycloakUserRole{}\n\n\t\treturn nextID, nil\n\t}\n\n\tsetGroupChildFunc := func(groupID, realmName string, childGroup *keycloakCommon.Group) error {\n\t\tvar childGroupToAppend *keycloakCommon.Group\n\t\tfor _, group := range context.Groups {\n\t\t\tif group.ID == childGroup.ID {\n\t\t\t\tchildGroupToAppend = group\n\t\t\t}\n\t\t}\n\n\t\tif childGroupToAppend == nil {\n\t\t\tchildGroupToAppend = childGroup\n\t\t}\n\n\t\tfound := false\n\t\tfor _, group := range context.Groups {\n\t\t\tif group.ID == groupID {\n\t\t\t\tgroup.SubGroups = append(group.SubGroups, childGroupToAppend)\n\t\t\t\tfound = true\n\t\t\t}\n\t\t}\n\n\t\tif !found {\n\t\t\treturn fmt.Errorf(\"Group %s not found\", groupID)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tlistUsersInGroupFunc := func(realmName, groupID string) ([]*keycloak.KeycloakAPIUser, error) {\n\t\treturn []*keycloak.KeycloakAPIUser{}, nil\n\t}\n\n\tmakeGroupDefaultFunc := func(groupID string, realmName string) error {\n\t\tvar group *keycloakCommon.Group\n\n\t\tfor _, existingGroup := range context.Groups {\n\t\t\tif existingGroup.ID == groupID {\n\t\t\t\tgroup = existingGroup\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif group == nil {\n\t\t\treturn fmt.Errorf(\"Referenced group not found\")\n\t\t}\n\n\t\tcontext.DefaultGroups = append(context.DefaultGroups, group)\n\t\treturn nil\n\t}\n\n\tlistDefaultGroupsFunc := func(realmName string) ([]*keycloakCommon.Group, error) {\n\t\treturn context.DefaultGroups, nil\n\t}\n\n\tcreateGroupClientRoleFunc := func(role *keycloak.KeycloakUserRole, realmName, clientID, groupID string) (string, error) {\n\t\tgroupClientRoles, ok := context.ClientRoles[groupID]\n\n\t\tif !ok {\n\t\t\treturn \"\", fmt.Errorf(\"Referenced group not found\")\n\t\t}\n\n\t\tcontext.ClientRoles[groupID] = append(groupClientRoles, role)\n\t\treturn \"dummy-group-client-role-id\", nil\n\t}\n\n\tlistGroupClientRolesFunc := func(realmName, clientID, groupID string) ([]*keycloak.KeycloakUserRole, error) {\n\t\tgroupRoles, ok := context.ClientRoles[groupID]\n\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"Referenced group not found\")\n\t\t}\n\n\t\treturn groupRoles, nil\n\t}\n\n\tlistAvailableGroupClientRolesFunc := func(realmName, clientID, groupID string) ([]*keycloak.KeycloakUserRole, error) {\n\t\t_, ok := context.ClientRoles[groupID]\n\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"Referenced group not found\")\n\t\t}\n\n\t\treturn availableGroupClientRoles, nil\n\t}\n\n\tfindGroupClientRoleFunc := func(realmName, clientID, groupID string, predicate func(*keycloak.KeycloakUserRole) bool) (*keycloak.KeycloakUserRole, error) {\n\t\tall, err := listGroupClientRolesFunc(realmName, clientID, groupID)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, role := range all {\n\t\t\tif predicate(role) {\n\t\t\t\treturn role, nil\n\t\t\t}\n\t\t}\n\n\t\treturn nil, nil\n\t}\n\n\tfindAvailableGroupClientRoleFunc := func(realmName, clientID, groupID string, predicate func(*keycloak.KeycloakUserRole) bool) (*keycloak.KeycloakUserRole, error) {\n\t\tall, err := listAvailableGroupClientRolesFunc(realmName, clientID, groupID)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, role := range all {\n\t\t\tif predicate(role) {\n\t\t\t\treturn role, nil\n\t\t\t}\n\t\t}\n\n\t\treturn nil, nil\n\t}\n\n\tlistGroupRealmRolesFunc := func(realmName, groupID string) ([]*keycloak.KeycloakUserRole, error) {\n\t\tgroupRoles, ok := context.RealmRoles[groupID]\n\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"Referenced group not found\")\n\t\t}\n\n\t\treturn groupRoles, nil\n\t}\n\n\tlistAvailableGroupRealmRolesFunc := func(realmName, groupID string) ([]*keycloak.KeycloakUserRole, error) {\n\t\t_, ok := context.RealmRoles[groupID]\n\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"Referenced group not found\")\n\t\t}\n\n\t\treturn availableGroupRealmRoles, nil\n\t}\n\n\tcreateGroupRealmRoleFunc := func(role *keycloak.KeycloakUserRole, realmName, groupID string) (string, error) {\n\t\tgroupRealmRoles, ok := context.RealmRoles[groupID]\n\n\t\tif !ok {\n\t\t\treturn \"\", fmt.Errorf(\"Referenced group not found\")\n\t\t}\n\n\t\tcontext.RealmRoles[groupID] = append(groupRealmRoles, role)\n\t\treturn \"dummy-group-realm-role-id\", nil\n\t}\n\n\tlistClientsFunc := func(realmName string) ([]*keycloak.KeycloakAPIClient, error) {\n\t\treturn []*keycloak.KeycloakAPIClient{\n\t\t\t&keycloak.KeycloakAPIClient{\n\t\t\t\tClientID: \"test-realm\",\n\t\t\t\tID: \"test-realm\",\n\t\t\t\tName: \"test-realm\",\n\t\t\t},\n\t\t\t&keycloak.KeycloakAPIClient{\n\t\t\t\tClientID: \"master-realm\",\n\t\t\t\tID: \"master-realm\",\n\t\t\t\tName: \"master-realm\",\n\t\t\t},\n\t\t}, nil\n\t}\n\n\tlistAuthenticationExecutionsForFlowFunc := func(flowAlias, realmName string) ([]*keycloak.AuthenticationExecutionInfo, error) {\n\t\texecutions, ok := context.AuthenticationFlowsExecutions[flowAlias]\n\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"Authentication flow not found\")\n\t\t}\n\n\t\treturn executions, nil\n\t}\n\n\tfindAuthenticationExecutionForFlowFunc := func(flowAlias, realmName string, predicate func(*keycloak.AuthenticationExecutionInfo) bool) (*keycloak.AuthenticationExecutionInfo, error) {\n\t\texecutions, err := listAuthenticationExecutionsForFlowFunc(flowAlias, realmName)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, execution := range executions {\n\t\t\tif predicate(execution) {\n\t\t\t\treturn execution, nil\n\t\t\t}\n\t\t}\n\n\t\treturn nil, nil\n\t}\n\n\tupdateAuthenticationExecutionForFlowFunc := func(flowAlias, realmName string, execution *keycloak.AuthenticationExecutionInfo) error {\n\t\texecutions, ok := context.AuthenticationFlowsExecutions[flowAlias]\n\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Authentication flow %s not found\", flowAlias)\n\t\t}\n\n\t\tfor i, currentExecution := range executions {\n\t\t\tif currentExecution.Alias != execution.Alias {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tcontext.AuthenticationFlowsExecutions[flowAlias][i] = execution\n\t\t\tbreak\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tlistOfActivesUsersPerRealmFunc := func(realmName, dateFrom string, max int) ([]keycloakCommon.Users, error) {\n\t\tusers := []keycloakCommon.Users{\n\t\t\t{\n\t\t\t\tUserID: \"1\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tUserID: \"2\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tUserID: \"3\",\n\t\t\t},\n\t\t}\n\n\t\treturn users, nil\n\t}\n\n\treturn &keycloakCommon.KeycloakInterfaceMock{\n\t\tListRealmsFunc: listRealmsFunc,\n\t\tFindGroupByNameFunc: findGroupByNameFunc,\n\t\tCreateGroupFunc: createGroupFunc,\n\t\tSetGroupChildFunc: setGroupChildFunc,\n\t\tListUsersInGroupFunc: listUsersInGroupFunc,\n\t\tMakeGroupDefaultFunc: makeGroupDefaultFunc,\n\t\tListDefaultGroupsFunc: listDefaultGroupsFunc,\n\t\tCreateGroupClientRoleFunc: createGroupClientRoleFunc,\n\t\tListGroupClientRolesFunc: listGroupClientRolesFunc,\n\t\tListAvailableGroupClientRolesFunc: listAvailableGroupClientRolesFunc,\n\t\tFindGroupClientRoleFunc: findGroupClientRoleFunc,\n\t\tFindAvailableGroupClientRoleFunc: findAvailableGroupClientRoleFunc,\n\t\tListGroupRealmRolesFunc: listGroupRealmRolesFunc,\n\t\tListAvailableGroupRealmRolesFunc: listAvailableGroupRealmRolesFunc,\n\t\tCreateGroupRealmRoleFunc: createGroupRealmRoleFunc,\n\t\tListAuthenticationExecutionsForFlowFunc: listAuthenticationExecutionsForFlowFunc,\n\t\tFindAuthenticationExecutionForFlowFunc: findAuthenticationExecutionForFlowFunc,\n\t\tUpdateAuthenticationExecutionForFlowFunc: updateAuthenticationExecutionForFlowFunc,\n\t\tListClientsFunc: listClientsFunc,\n\t\tListOfActivesUsersPerRealmFunc: listOfActivesUsersPerRealmFunc,\n\t}, &context\n}",
"func mockGetUserAccessToken() {\r\n\thttpmock.RegisterResponder(http.MethodPost, fmt.Sprintf(\"%s%s\", testHost, getAccessTokenURI),\r\n\t\thttpmock.NewStringResponder(\r\n\t\t\thttp.StatusOK, `{\"code\": 0,\"msg\": \"\",\r\n \"data\": {\r\n \"access_token\": \"`+testUserAccessToken+`\",\r\n \"expires_in\": `+fmt.Sprintf(\"%d\", testExpiresIn)+`,\r\n \"refresh_token\": \"`+testUserRefreshToken+`\",\r\n \"scope\": \"`+testUserScopes+`\",\r\n \"token_type\": \"`+testTokenType+`\"}}`,\r\n\t\t),\r\n\t)\r\n}",
"func TestEmployeeManagerMapGetByID(t *testing.T) {\n\tdb, mock, err := sqlmock.New()\n\tif err != nil {\n\t\tt.Fatalf(\"an error '%s' was not expected when opening a stub database connection\", err)\n\t}\n\tdefer db.Close()\n\n\trows := sqlmock.NewRows([]string{\"employee_name\", \"manager_name\"}).AddRow(\"Nick\", \"Sophie\").AddRow(\"Sophie\", \"Jonas\")\n\tmock.ExpectExec(constants.EmployeeManagerMappingDeleteQuery).WillReturnResult(sqlmock.NewResult(0, 0))\n\tmock.ExpectPrepare(regexp.QuoteMeta(constants.EmployeeManagerMappingInsertQuery)).ExpectExec().WillReturnResult(sqlmock.NewResult(0, 0))\n\tmock.ExpectQuery(constants.EmployeeManagerMappingSelectQuery).WillReturnRows(rows)\n\n\templyManagerMap := NewEmployeeManagerMapHandler(db)\n\n\tw := httptest.NewRecorder()\n\tvar jsonStr = []byte(`{\"Peter\":\"Nick\", \"Barbara\":\"Nick\", \"Nick\":\"Sophie\", \"Sophie\":\"Jonas\"}`)\n\tr := httptest.NewRequest(\"POST\", \"http://localhost:9090/api/v1/emplymgrmap\", bytes.NewBuffer(jsonStr))\n\tr = r.WithContext(context.Background())\n\templyManagerMap.Create(w, r)\n\n\tr = httptest.NewRequest(\"GET\", \"http://localhost:9090/api/v1/emplymgrmap/Nick?supervisor=true&name=Nick\", nil)\n\trctx := chi.NewRouteContext()\n\trctx.URLParams.Add(\"name\", \"Nick\")\n\tr = r.WithContext(context.WithValue(r.Context(), chi.RouteCtxKey, rctx))\n\tw = httptest.NewRecorder()\n\templyManagerMap.GetByID(w, r)\n\texpectedResponse := `{\"supervisor\":\"Sophie\",\"supervisor_of_supervisor\":\"Jonas\"}`\n\tassert.Equal(t, gohttp.StatusOK, w.Code)\n\tassert.Equal(t, expectedResponse, w.Body.String())\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
IdentityManager indicates an expected call of IdentityManager
|
func (mr *MockClientMockRecorder) IdentityManager(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IdentityManager", reflect.TypeOf((*MockClient)(nil).IdentityManager), arg0)
}
|
[
"func (mr *MockProvidersMockRecorder) IdentityManager(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IdentityManager\", reflect.TypeOf((*MockProviders)(nil).IdentityManager), arg0)\n}",
"func (c *Provider) IdentityManager(orgName string) (msp.IdentityManager, bool) {\n\treturn c.idMgmtProvider.IdentityManager(orgName)\n}",
"func (p *identityManagerProvider) IdentityManager(orgName string) (msp.IdentityManager, bool) {\n\treturn p.identityManager, true\n}",
"func (p *MSPProvider) IdentityManager(orgName string) (msp.IdentityManager, bool) {\n\tim, ok := p.identityManager[strings.ToLower(orgName)]\n\tif !ok {\n\t\treturn nil, false\n\t}\n\treturn im, true\n}",
"func (e AuthorizationFailedError) Identity() UserIdentityInfo { return e.identity }",
"func (e AuthorizationDeniedError) Identity() UserIdentityInfo { return e.identity }",
"func (mr *MockFrameworkMockRecorder) Identity() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Identity\", reflect.TypeOf((*MockFramework)(nil).Identity))\n}",
"func (mr *MockChoriaProviderMockRecorder) Identity() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Identity\", reflect.TypeOf((*MockChoriaProvider)(nil).Identity))\n}",
"func (mr *MockMachineMockRecorder) Identity() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Identity\", reflect.TypeOf((*MockMachine)(nil).Identity))\n}",
"func (mr *MockMachineMockRecorder) Identity() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Identity\", reflect.TypeOf((*MockMachine)(nil).Identity))\n}",
"func (m *MockProviders) IdentityManager(arg0 string) (msp.IdentityManager, bool) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IdentityManager\", arg0)\n\tret0, _ := ret[0].(msp.IdentityManager)\n\tret1, _ := ret[1].(bool)\n\treturn ret0, ret1\n}",
"func (m *MockClient) IdentityManager(arg0 string) (msp.IdentityManager, bool) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IdentityManager\", arg0)\n\tret0, _ := ret[0].(msp.IdentityManager)\n\tret1, _ := ret[1].(bool)\n\treturn ret0, ret1\n}",
"func (v *DemoVerifier) VerifyRequestIdentity(jsonToken *bijson.RawMessage) (bool, string, error) {\n\tvar p DemoVerifierParams\n\tif err := bijson.Unmarshal(*jsonToken, &p); err != nil {\n\t\treturn false, \"\", err\n\t}\n\n\tp.IDToken = v.CleanToken(p.IDToken)\n\n\tif p.IDToken != v.ExpectedKey {\n\t\treturn false, \"\", errors.New(\"invalid idtoken\")\n\t}\n\n\tv.Store[p.IDToken] = true\n\treturn true, p.Email, nil\n}",
"func (mr *MockClientMockRecorder) IdentityConfig() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IdentityConfig\", reflect.TypeOf((*MockClient)(nil).IdentityConfig))\n}",
"func (mr *MockProvidersMockRecorder) IdentityConfig() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IdentityConfig\", reflect.TypeOf((*MockProviders)(nil).IdentityConfig))\n}",
"func (mr *MockStorageMockRecorder) FindIdentityVerification(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"FindIdentityVerification\", reflect.TypeOf((*MockStorage)(nil).FindIdentityVerification), arg0, arg1)\n}",
"func TestGenerateIdentity(t *testing.T) {\n\tif _, err := GenerateIdentity(); err != nil {\n\t\tt.Fatalf(\"Failed to generate new identity: %v\", err)\n\t}\n}",
"func (mr *MockStorageMockRecorder) ConsumeIdentityVerification(arg0, arg1, arg2 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ConsumeIdentityVerification\", reflect.TypeOf((*MockStorage)(nil).ConsumeIdentityVerification), arg0, arg1, arg2)\n}",
"func (m *CommunicationsIdentitySet) SetAssertedIdentity(value Identityable)() {\n err := m.GetBackingStore().Set(\"assertedIdentity\", value)\n if err != nil {\n panic(err)\n }\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
InfraProvider mocks base method
|
func (m *MockClient) InfraProvider() fab.InfraProvider {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "InfraProvider")
ret0, _ := ret[0].(fab.InfraProvider)
return ret0
}
|
[
"func (m *MockProviders) InfraProvider() fab.InfraProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"InfraProvider\")\n\tret0, _ := ret[0].(fab.InfraProvider)\n\treturn ret0\n}",
"func newMockProvider() *mockProviderAsync {\n\tprovider := newSyncMockProvider()\n\t// By default notifier is set to a function which is a no-op. In the event we've implemented the PodNotifier interface,\n\t// it will be set, and then we'll call a real underlying implementation.\n\t// This makes it easier in the sense we don't need to wrap each method.\n\treturn &mockProviderAsync{provider}\n}",
"func (m *MockSecurityProvider) Provider() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Provider\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func (m *MockState) StartProvidingExtendedApi() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"StartProvidingExtendedApi\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func (m *MockStateModifier) StartProvidingExtendedApi() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"StartProvidingExtendedApi\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func (m *MockProcessProvider) BootstrapperProvider() BootstrapperProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"BootstrapperProvider\")\n\tret0, _ := ret[0].(BootstrapperProvider)\n\treturn ret0\n}",
"func (m *MockRegistry) OAuth2Provider() fosite.OAuth2Provider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"OAuth2Provider\")\n\tret0, _ := ret[0].(fosite.OAuth2Provider)\n\treturn ret0\n}",
"func (m *MockStateInfo) ProvidesExtendedApi() (bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ProvidesExtendedApi\")\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (m *MockHostEvent) GetInfraEnvId() strfmt.UUID {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetInfraEnvId\")\n\tret0, _ := ret[0].(strfmt.UUID)\n\treturn ret0\n}",
"func (m *MockState) ProvidesExtendedApi() (bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ProvidesExtendedApi\")\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (m *MockChoriaProvider) MainCollective() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"MainCollective\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func TestGetCloudProvider(t *testing.T) {\n\tfakeCredFile := \"fake-cred-file.json\"\n\tfakeKubeConfig := \"fake-kube-config\"\n\temptyKubeConfig := \"empty-kube-config\"\n\tfakeContent := `\napiVersion: v1\nclusters:\n- cluster:\n server: https://localhost:8080\n name: foo-cluster\ncontexts:\n- context:\n cluster: foo-cluster\n user: foo-user\n namespace: bar\n name: foo-context\ncurrent-context: foo-context\nkind: Config\nusers:\n- name: foo-user\n user:\n exec:\n apiVersion: client.authentication.k8s.io/v1alpha1\n args:\n - arg-1\n - arg-2\n command: foo-command\n`\n\n\terr := createTestFile(emptyKubeConfig)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tdefer func() {\n\t\tif err := os.Remove(emptyKubeConfig); err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t}()\n\n\ttests := []struct {\n\t\tdesc string\n\t\tcreateFakeCredFile bool\n\t\tcreateFakeKubeConfig bool\n\t\tkubeconfig string\n\t\tnodeID string\n\t\tuserAgent string\n\t\tallowEmptyCloudConfig bool\n\t\texpectedErr error\n\t}{\n\t\t{\n\t\t\tdesc: \"out of cluster, no kubeconfig, no credential file\",\n\t\t\tkubeconfig: \"\",\n\t\t\tnodeID: \"\",\n\t\t\tallowEmptyCloudConfig: true,\n\t\t\texpectedErr: nil,\n\t\t},\n\t\t{\n\t\t\tdesc: \"[failure][disallowEmptyCloudConfig] out of cluster, no kubeconfig, no credential file\",\n\t\t\tkubeconfig: \"\",\n\t\t\tnodeID: \"\",\n\t\t\tallowEmptyCloudConfig: false,\n\t\t\texpectedErr: nil,\n\t\t},\n\t\t{\n\t\t\tdesc: \"[failure] out of cluster & in cluster, specify a non-exist kubeconfig, no credential file\",\n\t\t\tkubeconfig: \"/tmp/non-exist.json\",\n\t\t\tnodeID: \"\",\n\t\t\tallowEmptyCloudConfig: true,\n\t\t\texpectedErr: nil,\n\t\t},\n\t\t{\n\t\t\tdesc: \"[failure] out of cluster & in cluster, specify a empty kubeconfig, no credential file\",\n\t\t\tkubeconfig: emptyKubeConfig,\n\t\t\tnodeID: \"\",\n\t\t\tallowEmptyCloudConfig: true,\n\t\t\texpectedErr: fmt.Errorf(\"failed to get KubeClient: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable\"),\n\t\t},\n\t\t{\n\t\t\tdesc: \"[failure] out of cluster & in cluster, specify a fake kubeconfig, no credential file\",\n\t\t\tcreateFakeKubeConfig: true,\n\t\t\tkubeconfig: fakeKubeConfig,\n\t\t\tnodeID: \"\",\n\t\t\tallowEmptyCloudConfig: true,\n\t\t\texpectedErr: nil,\n\t\t},\n\t\t{\n\t\t\tdesc: \"[success] out of cluster & in cluster, no kubeconfig, a fake credential file\",\n\t\t\tcreateFakeCredFile: true,\n\t\t\tkubeconfig: \"\",\n\t\t\tnodeID: \"\",\n\t\t\tuserAgent: \"useragent\",\n\t\t\tallowEmptyCloudConfig: true,\n\t\t\texpectedErr: nil,\n\t\t},\n\t}\n\n\tfor _, test := range tests {\n\t\tif test.createFakeKubeConfig {\n\t\t\tif err := createTestFile(fakeKubeConfig); err != nil {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\t\t\tdefer func() {\n\t\t\t\tif err := os.Remove(fakeKubeConfig); err != nil {\n\t\t\t\t\tt.Error(err)\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\tif err := os.WriteFile(fakeKubeConfig, []byte(fakeContent), 0666); err != nil {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\t\t}\n\t\tif test.createFakeCredFile {\n\t\t\tif err := createTestFile(fakeCredFile); err != nil {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\t\t\tdefer func() {\n\t\t\t\tif err := os.Remove(fakeCredFile); err != nil {\n\t\t\t\t\tt.Error(err)\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\toriginalCredFile, ok := os.LookupEnv(DefaultAzureCredentialFileEnv)\n\t\t\tif ok {\n\t\t\t\tdefer os.Setenv(DefaultAzureCredentialFileEnv, originalCredFile)\n\t\t\t} else {\n\t\t\t\tdefer os.Unsetenv(DefaultAzureCredentialFileEnv)\n\t\t\t}\n\t\t\tos.Setenv(DefaultAzureCredentialFileEnv, fakeCredFile)\n\t\t}\n\t\tcloud, err := getCloudProvider(test.kubeconfig, test.nodeID, \"\", \"\", test.userAgent, test.allowEmptyCloudConfig, 25.0, 50)\n\t\tif !reflect.DeepEqual(err, test.expectedErr) && test.expectedErr != nil && !strings.Contains(err.Error(), test.expectedErr.Error()) {\n\t\t\tt.Errorf(\"desc: %s,\\n input: %q, GetCloudProvider err: %v, expectedErr: %v\", test.desc, test.kubeconfig, err, test.expectedErr)\n\t\t}\n\t\tif cloud == nil {\n\t\t\tt.Errorf(\"return value of getCloudProvider should not be nil even there is error\")\n\t\t} else {\n\t\t\tassert.Equal(t, cloud.Environment.StorageEndpointSuffix, storage.DefaultBaseURL)\n\t\t\tassert.Equal(t, cloud.UserAgent, test.userAgent)\n\t\t}\n\t}\n}",
"func ProviderTest(initial Initial, observer invoker.Observer, settings Settings) (Configurator, func(), error) {\n\tc, e := NewMockConfigurator(initial, observer, settings)\n\treturn c, func() {}, e\n}",
"func MockedProvider(t *testing.T, c *config.Config, callback string) (*config.Config, goth.Provider) {\n\tconst (\n\t\ttestClientKey = \"provider-test-client-key\"\n\t\ttestSecret = \"provider-test-secret\"\n\t\ttestCallback = \"http://auth.exmaple.com/test/callback\"\n\t)\n\tmp := newMockProvider(t, callback)\n\tp := provider.Name(mp.Name())\n\tprovider.AddExternal(p)\n\tt.Cleanup(func() {\n\t\tdelete(provider.External, p)\n\t})\n\tif callback == \"\" {\n\t\tcallback = testCallback\n\t}\n\tc.Authorization.Providers[p] = config.Provider{\n\t\tClientKey: testClientKey,\n\t\tSecret: testSecret,\n\t\tCallbackURL: callback,\n\t}\n\treturn c, mp\n}",
"func (m *MockInfraEnvEvent) GetInfraEnvId() strfmt.UUID {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetInfraEnvId\")\n\tret0, _ := ret[0].(strfmt.UUID)\n\treturn ret0\n}",
"func (c *Provider) InfraProvider() fab.InfraProvider {\n\treturn c.infraProvider\n}",
"func TestBaseImage(t *testing.T) {\n\tctx, err := controllerPrepare()\n\tif err != nil {\n\t\tt.Fatal(\"Fail in controller prepare: \", err)\n\t}\n\teveBaseRef := os.Getenv(\"EVE_BASE_REF\")\n\tif len(eveBaseRef) == 0 {\n\t\teveBaseRef = \"4.10.0\"\n\t}\n\tzArch := os.Getenv(\"ZARCH\")\n\tif len(eveBaseRef) == 0 {\n\t\tzArch = \"amd64\"\n\t}\n\tHV := os.Getenv(\"HV\")\n\tif HV == \"xen\" {\n\t\tHV = \"\"\n\t}\n\tvar baseImageTests = []struct {\n\t\tdataStoreID string\n\t\timageID string\n\t\tbaseID string\n\t\timageRelativePath string\n\t\timageFormat config.Format\n\t\teveBaseRef string\n\t\tzArch string\n\t\tHV string\n\t}{\n\t\t{eServerDataStoreID,\n\n\t\t\t\"1ab8761b-5f89-4e0b-b757-4b87a9fa93ec\",\n\n\t\t\t\"22b8761b-5f89-4e0b-b757-4b87a9fa93ec\",\n\n\t\t\t\"baseos.qcow2\",\n\t\t\tconfig.Format_QCOW2,\n\t\t\teveBaseRef,\n\t\t\tzArch,\n\t\t\tHV,\n\t\t},\n\t}\n\tfor _, tt := range baseImageTests {\n\t\tbaseOSVersion := fmt.Sprintf(\"%s-%s\", tt.eveBaseRef, tt.zArch)\n\t\tif tt.HV != \"\" {\n\t\t\tbaseOSVersion = fmt.Sprintf(\"%s-%s-%s\", tt.eveBaseRef, tt.zArch, tt.HV)\n\t\t}\n\t\tt.Run(baseOSVersion, func(t *testing.T) {\n\n\t\t\terr = prepareBaseImageLocal(ctx, tt.dataStoreID, tt.imageID, tt.baseID, tt.imageRelativePath, tt.imageFormat, baseOSVersion)\n\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(\"Fail in prepare base image from local file: \", err)\n\t\t\t}\n\t\t\tdeviceCtx, err := ctx.GetDeviceFirst()\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(\"Fail in get first device: \", err)\n\t\t\t}\n\t\t\tdeviceCtx.SetBaseOSConfig([]string{tt.baseID})\n\t\t\tdevUUID := deviceCtx.GetID()\n\t\t\terr = ctx.ConfigSync(deviceCtx)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(\"Fail in sync config with controller: \", err)\n\t\t\t}\n\t\t\tt.Run(\"Started\", func(t *testing.T) {\n\t\t\t\terr := ctx.InfoChecker(devUUID, map[string]string{\"devId\": devUUID.String(), \"shortVersion\": baseOSVersion}, einfo.ZInfoDevSW, 300)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatal(\"Fail in waiting for base image update init: \", err)\n\t\t\t\t}\n\t\t\t})\n\t\t\tt.Run(\"Downloaded\", func(t *testing.T) {\n\t\t\t\terr := ctx.InfoChecker(devUUID, map[string]string{\"devId\": devUUID.String(), \"shortVersion\": baseOSVersion, \"downloadProgress\": \"100\"}, einfo.ZInfoDevSW, 1500)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatal(\"Fail in waiting for base image download progress: \", err)\n\t\t\t\t}\n\t\t\t})\n\t\t\tt.Run(\"Logs\", func(t *testing.T) {\n\t\t\t\tif !checkLogs {\n\t\t\t\t\tt.Skip(\"no LOGS flag set - skipped\")\n\t\t\t\t}\n\t\t\t\terr = ctx.LogChecker(devUUID, map[string]string{\"devId\": devUUID.String(), \"eveVersion\": baseOSVersion}, 1200)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatal(\"Fail in waiting for base image logs: \", err)\n\t\t\t\t}\n\t\t\t})\n\t\t\ttimeout := time.Duration(1200)\n\n\t\t\tif !checkLogs {\n\t\t\t\ttimeout = 2400\n\t\t\t}\n\t\t\tt.Run(\"Active\", func(t *testing.T) {\n\t\t\t\terr = ctx.InfoChecker(devUUID, map[string]string{\"devId\": devUUID.String(), \"shortVersion\": baseOSVersion, \"status\": \"INSTALLED\", \"partitionState\": \"(inprogress|active)\"}, einfo.ZInfoDevSW, timeout)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatal(\"Fail in waiting for base image installed status: \", err)\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\t}\n\n}",
"func NewMockInfra(ctrl *gomock.Controller) *MockInfra {\n\tmock := &MockInfra{ctrl: ctrl}\n\tmock.recorder = &MockInfraMockRecorder{mock}\n\treturn mock\n}",
"func mockChildPackages() {\n\n\t// Fake an AWS credentials file so that the mfile package will nehave as if it is happy\n\tsetFakeCredentials()\n\n\t// Fake out the creds package into using an apparently credentials response from AWS\n\tcreds.SetGetSessionTokenFunc(func(awsService *sts.STS, input *sts.GetSessionTokenInput) (*sts.GetSessionTokenOutput, error) {\n\t\treturn getSessionTokenOutput, nil\n\t})\n\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
InfraProvider indicates an expected call of InfraProvider
|
func (mr *MockClientMockRecorder) InfraProvider() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InfraProvider", reflect.TypeOf((*MockClient)(nil).InfraProvider))
}
|
[
"func (mr *MockProvidersMockRecorder) InfraProvider() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"InfraProvider\", reflect.TypeOf((*MockProviders)(nil).InfraProvider))\n}",
"func (c *Provider) InfraProvider() fab.InfraProvider {\n\treturn c.infraProvider\n}",
"func (m *MockClient) InfraProvider() fab.InfraProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"InfraProvider\")\n\tret0, _ := ret[0].(fab.InfraProvider)\n\treturn ret0\n}",
"func (m *MockProviders) InfraProvider() fab.InfraProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"InfraProvider\")\n\tret0, _ := ret[0].(fab.InfraProvider)\n\treturn ret0\n}",
"func (o *KubernetesNodeGroupProfile) GetInfraProviderOk() (*KubernetesBaseInfrastructureProviderRelationship, bool) {\n\tif o == nil || o.InfraProvider == nil {\n\t\treturn nil, false\n\t}\n\treturn o.InfraProvider, true\n}",
"func (o *KubernetesNodeGroupProfile) HasInfraProvider() bool {\n\tif o != nil && o.InfraProvider != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}",
"func infraFailure(err error) *build.InfraFailure {\n\tfailure := &build.InfraFailure{\n\t\tText: err.Error(),\n\t}\n\tif errors.Unwrap(err) == context.Canceled {\n\t\tfailure.Type = build.InfraFailure_CANCELED\n\t} else {\n\t\tfailure.Type = build.InfraFailure_BOOTSTRAPPER_ERROR\n\t\tfailure.BootstrapperCallStack = errors.RenderStack(err)\n\t}\n\n\treturn failure\n}",
"func IsK8sProvisionerUnknownProvider(err errawr.Error) bool {\n\treturn err != nil && err.Is(K8sProvisionerUnknownProviderCode)\n}",
"func notSupported(sink diag.Sink, prov tfbridge.ProviderInfo) error {\n\tif sink == nil {\n\t\tsink = diag.DefaultSink(os.Stdout, os.Stderr, diag.FormatOptions{\n\t\t\tColor: colors.Always,\n\t\t})\n\t}\n\n\tu := ¬SupportedUtil{sink: sink}\n\n\tskipResource := func(tfToken string) bool { return false }\n\tskipDataSource := func(tfToken string) bool { return false }\n\tmuxedProvider := false\n\tif mixed, ok := prov.P.(*muxer.ProviderShim); ok {\n\t\tnot := func(f func(string) bool) func(string) bool {\n\t\t\treturn func(s string) bool {\n\t\t\t\treturn !f(s)\n\t\t\t}\n\t\t}\n\n\t\tskipResource = not(mixed.ResourceIsPF)\n\t\tskipDataSource = not(mixed.DataSourceIsPF)\n\t\tmuxedProvider = true\n\t} else if _, ok := prov.P.(*schemaShim.SchemaOnlyProvider); !ok {\n\t\twarning := \"Bridged Plugin Framework providers must have ProviderInfo.P be created from\" +\n\t\t\t\" pf/tfbridge.ShimProvider or pf/tfbridge.ShimProviderWithContext.\\nMuxed SDK and\" +\n\t\t\t\" Plugin Framework based providers must have ProviderInfo.P be created from\" +\n\t\t\t\" pf/tfbridge.MuxShimWithPF or pf/tfbridgepf/tfbridge.MuxShimWithDisjointgPF.\"\n\t\tu.warn(warning)\n\t}\n\n\tif prov.Resources != nil {\n\t\tfor path, res := range prov.Resources {\n\t\t\tif skipResource(path) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tu.resource(\"resource:\"+path, res)\n\t\t}\n\t}\n\n\tif prov.DataSources != nil {\n\t\tfor path, ds := range prov.DataSources {\n\t\t\tif skipDataSource(path) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tu.datasource(\"datasource:\"+path, ds)\n\t\t}\n\t}\n\n\t// It might be reasonable to set global values that PF will ignore if this is a\n\t// muxed provider, and the SDK side will pick it up.\n\tif !muxedProvider {\n\t\tif prov.Config != nil {\n\t\t\tfor path, ds := range prov.Config {\n\t\t\t\tu.schema(\"config:\"+path, ds)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}",
"func (External) IsK8sProvisionerUnknownProvider(err errawr.Error) bool {\n\treturn IsK8sProvisionerUnknownProvider(err)\n}",
"func (u *UnknownProvider) GetProviderString() string {\n\treturn \"unknown\"\n}",
"func (me TxsdNodeRoleSimpleContentExtensionCategory) IsInfra() bool { return me.String() == \"infra\" }",
"func (a *Application) RegisterProvider() {\n\n}",
"func (sdk *FabricSDK) FabricProvider() fab.InfraProvider {\n\treturn sdk.fabricProvider\n}",
"func IsProviderImplemented(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\tif err := r.ParseForm(); err != nil {\n\t\twriteErrorResponse(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\tif len(r.Form) == 0 {\n\t\tjson.NewEncoder(w).Encode(providerList())\n\t\treturn\n\t}\n\n\tname := r.Form.Get(\"name\")\n\tif len(name) == 0 {\n\t\twriteErrorResponse(w, http.StatusBadRequest, errors.New(\"missing provider name in the request\"))\n\t\treturn\n\t}\n\n\tres := isProviderImplementedResp{\n\t\tImplemented: name == string(common.Example) || common.KYCProviders[common.KYCProvider(name)],\n\t}\n\n\tjson.NewEncoder(w).Encode(res)\n}",
"func TestOverlayIOPExhaustiveness(t *testing.T) {\n\twellknownProviders := map[string]struct{}{\n\t\t\"prometheus\": {},\n\t\t\"envoy_file_access_log\": {},\n\t\t\"stackdriver\": {},\n\t\t\"envoy_otel_als\": {},\n\t\t\"envoy_ext_authz_http\": {},\n\t\t\"envoy_ext_authz_grpc\": {},\n\t\t\"zipkin\": {},\n\t\t\"lightstep\": {},\n\t\t\"datadog\": {},\n\t\t\"opencensus\": {},\n\t\t\"skywalking\": {},\n\t\t\"envoy_http_als\": {},\n\t\t\"envoy_tcp_als\": {},\n\t\t\"opentelemetry\": {},\n\t}\n\n\tunexpectedProviders := make([]string, 0)\n\n\tmsg := &meshconfig.MeshConfig_ExtensionProvider{}\n\tpb := msg.ProtoReflect()\n\tmd := pb.Descriptor()\n\n\tof := md.Oneofs().Get(0)\n\tfor i := 0; i < of.Fields().Len(); i++ {\n\t\to := of.Fields().Get(i)\n\t\tn := string(o.Name())\n\t\tif _, ok := wellknownProviders[n]; ok {\n\t\t\tdelete(wellknownProviders, n)\n\t\t} else {\n\t\t\tunexpectedProviders = append(unexpectedProviders, n)\n\t\t}\n\t}\n\n\tif len(wellknownProviders) != 0 || len(unexpectedProviders) != 0 {\n\t\tt.Errorf(\"unexpected provider not implemented in OverlayIOP, wellknownProviders: %v unexpectedProviders: %v\", wellknownProviders, unexpectedProviders)\n\t\tt.Fail()\n\t}\n}",
"func (o *KubernetesNodeGroupProfile) SetInfraProvider(v KubernetesBaseInfrastructureProviderRelationship) {\n\to.InfraProvider = &v\n}",
"func (app *App) HandleProvisionTestInfra(w http.ResponseWriter, r *http.Request) {\n\tprojID, err := strconv.ParseUint(chi.URLParam(r, \"project_id\"), 0, 64)\n\n\tif err != nil || projID == 0 {\n\t\tapp.handleErrorFormDecoding(err, ErrProjectDecode, w)\n\t\treturn\n\t}\n\n\tform := &forms.CreateTestInfra{\n\t\tProjectID: uint(projID),\n\t}\n\n\t// decode from JSON to form value\n\tif err := json.NewDecoder(r.Body).Decode(form); err != nil {\n\t\tapp.handleErrorFormDecoding(err, ErrProjectDecode, w)\n\t\treturn\n\t}\n\n\t// convert the form to an aws infra instance\n\tinfra, err := form.ToInfra()\n\n\tif err != nil {\n\t\tapp.handleErrorFormDecoding(err, ErrProjectDecode, w)\n\t\treturn\n\t}\n\n\t// handle write to the database\n\tinfra, err = app.Repo.Infra.CreateInfra(infra)\n\n\tif err != nil {\n\t\tapp.handleErrorDataWrite(err, w)\n\t\treturn\n\t}\n\n\t_, err = app.ProvisionerAgent.ProvisionTest(\n\t\tuint(projID),\n\t\tinfra,\n\t\t*app.Repo,\n\t\tprovisioner.Apply,\n\t\t&app.DBConf,\n\t\tapp.RedisConf,\n\t\tapp.ServerConf.ProvisionerImageTag,\n\t\tapp.ServerConf.ProvisionerImagePullSecret,\n\t)\n\n\tif err != nil {\n\t\tinfra.Status = models.StatusError\n\t\tinfra, _ = app.Repo.Infra.UpdateInfra(infra)\n\n\t\tapp.handleErrorInternal(err, w)\n\t\treturn\n\t}\n\n\tapp.Logger.Info().Msgf(\"New test infra created: %d\", infra.ID)\n\n\tw.WriteHeader(http.StatusCreated)\n\n\tinfraExt := infra.Externalize()\n\n\tif err := json.NewEncoder(w).Encode(infraExt); err != nil {\n\t\tapp.handleErrorFormDecoding(err, ErrProjectDecode, w)\n\t\treturn\n\t}\n}",
"func NewProvider() *ProviderConfig {\n\tproviderConfig := &ProviderConfig{\n\t\tAlibaba: make(map[string]*models.AlibabaCloudSpec),\n\t\tAnexia: make(map[string]*models.AnexiaCloudSpec),\n\t\tAws: make(map[string]*models.AWSCloudSpec),\n\t\tAzure: make(map[string]*models.AzureCloudSpec),\n\t\tDigitalocean: make(map[string]*models.DigitaloceanCloudSpec),\n\t\tFake: make(map[string]*models.FakeCloudSpec),\n\t\tGcp: make(map[string]*models.GCPCloudSpec),\n\t\tHetzner: make(map[string]*models.HetznerCloudSpec),\n\t\tKubevirt: make(map[string]*models.KubevirtCloudSpec),\n\t\tOpenstack: make(map[string]*models.OpenstackCloudSpec),\n\t\tPacket: make(map[string]*models.PacketCloudSpec),\n\t\tVsphere: make(map[string]*models.VSphereCloudSpec),\n\t}\n\n\tproviderConfig.Alibaba[\"Alibaba\"] = newAlibabaCloudSpec()\n\tproviderConfig.Anexia[\"Anexia\"] = newAnexiaCloudSpec()\n\tproviderConfig.Aws[\"Aws\"] = newAWSCloudSpec()\n\tproviderConfig.Azure[\"Azure\"] = newAzureCloudSpec()\n\tproviderConfig.Digitalocean[\"Digitalocean\"] = newDigitaloceanCloudSpec()\n\tproviderConfig.Fake[\"Fake\"] = newFakeCloudSpec()\n\tproviderConfig.Gcp[\"Gcp\"] = newGCPCloudSpec()\n\tproviderConfig.Hetzner[\"Hetzner\"] = newHetznerCloudSpec()\n\tproviderConfig.Kubevirt[\"Kubevirt\"] = newKubevirtCloudSpec()\n\tproviderConfig.Openstack[\"Openstack\"] = newOpenstackCloudSpec()\n\tproviderConfig.Packet[\"Packet\"] = newPacketCloudSpec()\n\tproviderConfig.Vsphere[\"Vsphere\"] = newVSphereCloudSpec()\n\n\treturn providerConfig\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
LocalDiscoveryProvider mocks base method
|
func (m *MockClient) LocalDiscoveryProvider() fab.LocalDiscoveryProvider {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "LocalDiscoveryProvider")
ret0, _ := ret[0].(fab.LocalDiscoveryProvider)
return ret0
}
|
[
"func (m *MockProviders) LocalDiscoveryProvider() fab.LocalDiscoveryProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LocalDiscoveryProvider\")\n\tret0, _ := ret[0].(fab.LocalDiscoveryProvider)\n\treturn ret0\n}",
"func (c *Provider) LocalDiscoveryProvider() fab.LocalDiscoveryProvider {\n\treturn c.localDiscoveryProvider\n}",
"func (m *MockMemberList) LocalNode() discovery.Member {\n\tret := m.ctrl.Call(m, \"LocalNode\")\n\tret0, _ := ret[0].(discovery.Member)\n\treturn ret0\n}",
"func newMockProvider() *mockProviderAsync {\n\tprovider := newSyncMockProvider()\n\t// By default notifier is set to a function which is a no-op. In the event we've implemented the PodNotifier interface,\n\t// it will be set, and then we'll call a real underlying implementation.\n\t// This makes it easier in the sense we don't need to wrap each method.\n\treturn &mockProviderAsync{provider}\n}",
"func NewMockDiscoveryProvider(err error, peers []fab.Peer) (*MockStaticDiscoveryProvider, error) {\n\treturn &MockStaticDiscoveryProvider{Error: err, Peers: peers}, nil\n}",
"func TestSrcMgr(t *testing.T) {\n\n\tgopath := os.Getenv(\"GOPATH\")\n\tos.Setenv(\"CHASSIS_HOME\", gopath+\"/src/github.com/go-chassis/go-chassis/examples/discovery/server/\")\n\t//config.Init()\n\n\terr := config.Init()\n\tassert.NoError(t, err)\n\n\tvar arr = []string{\"127.0.0.1\", \"hgfghfff\"}\n\n\tregistry.SelfInstancesCache = cache.New(0, 0)\n\tregistry.SelfInstancesCache.Set(\"abc\", arr, time.Second*30)\n\t/*a:=func(...transport.Option) transport.Transport{\n\t\t//var t transport.Transport\n\t\ttp :=tcp.NewTransport()\n\t\treturn tp\n\t}\n\n\ttransport.InstallPlugin(\"rest\",a)*/\n\n\t/*f:=func(...server.Option) server.Server{\n\t\tvar s server.Server\n\n\t\treturn s\n\t}\n\tserver.InstallPlugin(\"rest\",f)*/\n\n\ttestRegistryObj := new(mock.RegistratorMock)\n\tregistry.DefaultRegistrator = testRegistryObj\n\ttestRegistryObj.On(\"UnRegisterMicroServiceInstance\", \"microServiceID\", \"microServiceInstanceID\").Return(nil)\n\n\tdefaultChain := make(map[string]string)\n\tdefaultChain[\"default\"] = \"\"\n\tdefaultChain[\"default1\"] = \"\"\n\n\tvar mp model.Protocol\n\t//mp.Listen = \"127.0.0.1:30100\"\n\t// use random port\n\tmp.Listen = \"127.0.0.1:0\"\n\tmp.Advertise = \"127.0.0.1:8080\"\n\tmp.WorkerNumber = 10\n\tmp.Transport = \"tcp\"\n\n\tvar cseproto map[string]model.Protocol = make(map[string]model.Protocol)\n\n\tcseproto[\"rest\"] = mp\n\n\tconfig.GlobalDefinition.Cse.Handler.Chain.Provider = defaultChain\n\tconfig.GlobalDefinition.Cse.Protocols = cseproto\n\n\tserver.Init()\n\n\tsrv := server.GetServers()\n\tassert.NotNil(t, srv)\n\t//fmt.Println(\"SSSSSSSSSss\",srv)\n\terr = server.UnRegistrySelfInstances()\n\tassert.NoError(t, err)\n\t//fmt.Println(\"err\",err)\n\terr = server.StartServer()\n\tassert.NoError(t, err)\n\t//fmt.Println(\"err@@@@@@@\",err)\n\n\tsr, err := server.GetServer(\"rest\")\n\tassert.NotNil(t, sr)\n\tassert.NoError(t, err)\n\t//fmt.Println(\"Sr\",sr)\n\t//fmt.Println(\"err\",err)\n\n\tsrv1, err := server.GetServerFunc(\"abc\")\n\tassert.Nil(t, srv1)\n\tassert.Error(t, err)\n\n\ttestRegistryObj.On(\"UnregisterMicroServiceInstance\", \"microServiceID\", \"microServiceInstanceID\").Return(errors.New(MockError))\n\terr = server.UnRegistrySelfInstances()\n\n}",
"func Mock() Cluster { return mockCluster{} }",
"func (_m *MockPlcDriver) SupportsDiscovery() bool {\n\tret := _m.Called()\n\n\tvar r0 bool\n\tif rf, ok := ret.Get(0).(func() bool); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(bool)\n\t}\n\n\treturn r0\n}",
"func testDiscovery(t *testing.T, suite *integrationTestSuite) {\n\tctx := context.Background()\n\ttr := utils.NewTracer(utils.ThisFunction()).Start()\n\tdefer tr.Stop()\n\n\tusername := suite.Me.Username\n\n\t// create load balancer for main cluster proxies\n\tfrontend := *utils.MustParseAddr(net.JoinHostPort(Loopback, \"0\"))\n\tlb, err := utils.NewLoadBalancer(ctx, frontend)\n\trequire.NoError(t, err)\n\trequire.NoError(t, lb.Listen())\n\tgo lb.Serve()\n\tdefer lb.Close()\n\n\tremote := suite.newNamedTeleportInstance(t, \"cluster-remote\")\n\tmain := suite.newNamedTeleportInstance(t, \"cluster-main\")\n\n\tremote.AddUser(username, []string{username})\n\tmain.AddUser(username, []string{username})\n\n\trequire.NoError(t, main.Create(t, remote.Secrets.AsSlice(), false, nil))\n\tmainSecrets := main.Secrets\n\t// switch listen address of the main cluster to load balancer\n\tmainProxyAddr := *utils.MustParseAddr(mainSecrets.TunnelAddr)\n\tlb.AddBackend(mainProxyAddr)\n\tmainSecrets.TunnelAddr = lb.Addr().String()\n\trequire.NoError(t, remote.Create(t, mainSecrets.AsSlice(), true, nil))\n\n\trequire.NoError(t, main.Start())\n\trequire.NoError(t, remote.Start())\n\n\t// Wait for both cluster to see each other via reverse tunnels.\n\trequire.Eventually(t, helpers.WaitForClusters(main.Tunnel, 1), 10*time.Second, 1*time.Second,\n\t\t\"Two clusters do not see each other: tunnels are not working.\")\n\trequire.Eventually(t, helpers.WaitForClusters(remote.Tunnel, 1), 10*time.Second, 1*time.Second,\n\t\t\"Two clusters do not see each other: tunnels are not working.\")\n\n\t// start second proxy\n\tproxyConfig := helpers.ProxyConfig{\n\t\tName: \"cluster-main-proxy\",\n\t\tDisableWebService: true,\n\t}\n\tproxyConfig.SSHAddr = helpers.NewListenerOn(t, main.Hostname, service.ListenerNodeSSH, &proxyConfig.FileDescriptors)\n\tproxyConfig.WebAddr = helpers.NewListenerOn(t, main.Hostname, service.ListenerProxyWeb, &proxyConfig.FileDescriptors)\n\tproxyConfig.ReverseTunnelAddr = helpers.NewListenerOn(t, main.Hostname, service.ListenerProxyTunnel, &proxyConfig.FileDescriptors)\n\n\tsecondProxy, _, err := main.StartProxy(proxyConfig)\n\trequire.NoError(t, err)\n\n\t// add second proxy as a backend to the load balancer\n\tlb.AddBackend(*utils.MustParseAddr(proxyConfig.ReverseTunnelAddr))\n\n\t// At this point the main cluster should observe two tunnels\n\t// connected to it from remote cluster\n\thelpers.WaitForActiveTunnelConnections(t, main.Tunnel, \"cluster-remote\", 1)\n\thelpers.WaitForActiveTunnelConnections(t, secondProxy, \"cluster-remote\", 1)\n\n\t// execute the connection via first proxy\n\tcfg := helpers.ClientConfig{\n\t\tLogin: username,\n\t\tCluster: \"cluster-remote\",\n\t\tHost: Loopback,\n\t\tPort: helpers.Port(t, remote.SSH),\n\t}\n\toutput, err := runCommand(t, main, []string{\"echo\", \"hello world\"}, cfg, 1)\n\trequire.NoError(t, err)\n\trequire.Equal(t, \"hello world\\n\", output)\n\n\t// Execute the connection via second proxy, should work. This command is\n\t// tried 10 times with 250 millisecond delay between each attempt to allow\n\t// the discovery request to be received and the connection added to the agent\n\t// pool.\n\tcfgProxy := helpers.ClientConfig{\n\t\tLogin: username,\n\t\tCluster: \"cluster-remote\",\n\t\tHost: Loopback,\n\t\tPort: helpers.Port(t, remote.SSH),\n\t\tProxy: &proxyConfig,\n\t}\n\toutput, err = runCommand(t, main, []string{\"echo\", \"hello world\"}, cfgProxy, 10)\n\trequire.NoError(t, err)\n\trequire.Equal(t, \"hello world\\n\", output)\n\n\t// Now disconnect the main proxy and make sure it will reconnect eventually.\n\trequire.NoError(t, lb.RemoveBackend(mainProxyAddr))\n\thelpers.WaitForActiveTunnelConnections(t, secondProxy, \"cluster-remote\", 1)\n\n\t// Requests going via main proxy should fail.\n\t_, err = runCommand(t, main, []string{\"echo\", \"hello world\"}, cfg, 1)\n\trequire.Error(t, err)\n\n\t// Requests going via second proxy should succeed.\n\toutput, err = runCommand(t, main, []string{\"echo\", \"hello world\"}, cfgProxy, 1)\n\trequire.NoError(t, err)\n\trequire.Equal(t, \"hello world\\n\", output)\n\n\t// Connect the main proxy back and make sure agents have reconnected over time.\n\t// This command is tried 10 times with 250 millisecond delay between each\n\t// attempt to allow the discovery request to be received and the connection\n\t// added to the agent pool.\n\tlb.AddBackend(mainProxyAddr)\n\n\t// Once the proxy is added a matching tunnel connection should be created.\n\thelpers.WaitForActiveTunnelConnections(t, main.Tunnel, \"cluster-remote\", 1)\n\thelpers.WaitForActiveTunnelConnections(t, secondProxy, \"cluster-remote\", 1)\n\n\t// Requests going via main proxy should succeed.\n\toutput, err = runCommand(t, main, []string{\"echo\", \"hello world\"}, cfg, 40)\n\trequire.NoError(t, err)\n\trequire.Equal(t, \"hello world\\n\", output)\n\n\t// Stop one of proxies on the main cluster.\n\terr = main.StopProxy()\n\trequire.NoError(t, err)\n\n\t// Wait for the remote cluster to detect the outbound connection is gone.\n\trequire.NoError(t, helpers.WaitForProxyCount(remote, \"cluster-main\", 1))\n\n\t// Stop both clusters and remaining nodes.\n\trequire.NoError(t, remote.StopAll())\n\trequire.NoError(t, main.StopAll())\n}",
"func testDiscoveryRecovers(t *testing.T, suite *integrationTestSuite) {\n\tctx := context.Background()\n\ttr := utils.NewTracer(utils.ThisFunction()).Start()\n\tdefer tr.Stop()\n\n\tusername := suite.Me.Username\n\n\t// create load balancer for main cluster proxies\n\tfrontend := *utils.MustParseAddr(net.JoinHostPort(Loopback, \"0\"))\n\tlb, err := utils.NewLoadBalancer(ctx, frontend)\n\trequire.NoError(t, err)\n\trequire.NoError(t, lb.Listen())\n\tgo lb.Serve()\n\tdefer lb.Close()\n\n\tremote := suite.newNamedTeleportInstance(t, \"cluster-remote\")\n\tmain := suite.newNamedTeleportInstance(t, \"cluster-main\")\n\n\tremote.AddUser(username, []string{username})\n\tmain.AddUser(username, []string{username})\n\n\trequire.NoError(t, main.Create(t, remote.Secrets.AsSlice(), false, nil))\n\tmainSecrets := main.Secrets\n\t// switch listen address of the main cluster to load balancer\n\tmainProxyAddr := *utils.MustParseAddr(mainSecrets.TunnelAddr)\n\tlb.AddBackend(mainProxyAddr)\n\tmainSecrets.TunnelAddr = lb.Addr().String()\n\trequire.NoError(t, remote.Create(t, mainSecrets.AsSlice(), true, nil))\n\n\trequire.NoError(t, main.Start())\n\trequire.NoError(t, remote.Start())\n\n\t// Wait for both cluster to see each other via reverse tunnels.\n\trequire.Eventually(t, helpers.WaitForClusters(main.Tunnel, 1), 10*time.Second, 1*time.Second,\n\t\t\"Two clusters do not see each other: tunnels are not working.\")\n\trequire.Eventually(t, helpers.WaitForClusters(remote.Tunnel, 1), 10*time.Second, 1*time.Second,\n\t\t\"Two clusters do not see each other: tunnels are not working.\")\n\n\tvar reverseTunnelAddr string\n\n\t// Helper function for adding a new proxy to \"main\".\n\taddNewMainProxy := func(name string) (reversetunnelclient.Server, helpers.ProxyConfig) {\n\t\tt.Logf(\"adding main proxy %q...\", name)\n\t\tnewConfig := helpers.ProxyConfig{\n\t\t\tName: name,\n\t\t\tDisableWebService: true,\n\t\t}\n\t\tnewConfig.SSHAddr = helpers.NewListenerOn(t, main.Hostname, service.ListenerNodeSSH, &newConfig.FileDescriptors)\n\t\tnewConfig.WebAddr = helpers.NewListenerOn(t, main.Hostname, service.ListenerProxyWeb, &newConfig.FileDescriptors)\n\t\tnewConfig.ReverseTunnelAddr = helpers.NewListenerOn(t, main.Hostname, service.ListenerProxyTunnel, &newConfig.FileDescriptors)\n\t\treverseTunnelAddr = newConfig.ReverseTunnelAddr\n\n\t\tnewProxy, _, err := main.StartProxy(newConfig)\n\t\trequire.NoError(t, err)\n\n\t\t// add proxy as a backend to the load balancer\n\t\tlb.AddBackend(*utils.MustParseAddr(newConfig.ReverseTunnelAddr))\n\t\treturn newProxy, newConfig\n\t}\n\n\tkillMainProxy := func(name string) {\n\t\tt.Logf(\"killing main proxy %q...\", name)\n\t\tfor _, p := range main.Nodes {\n\t\t\tif !p.Config.Proxy.Enabled {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif p.Config.Hostname == name {\n\t\t\t\trequire.NoError(t, lb.RemoveBackend(*utils.MustParseAddr(reverseTunnelAddr)))\n\t\t\t\trequire.NoError(t, p.Close())\n\t\t\t\trequire.NoError(t, p.Wait())\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tt.Errorf(\"cannot close proxy %q (not found)\", name)\n\t}\n\n\t// Helper function for testing that a proxy in main has been discovered by\n\t// (and is able to use reverse tunnel into) remote. If conf is nil, main's\n\t// first/default proxy will be called.\n\ttestProxyConn := func(conf *helpers.ProxyConfig, shouldFail bool) {\n\t\tclientConf := helpers.ClientConfig{\n\t\t\tLogin: username,\n\t\t\tCluster: \"cluster-remote\",\n\t\t\tHost: Loopback,\n\t\t\tPort: helpers.Port(t, remote.SSH),\n\t\t\tProxy: conf,\n\t\t}\n\t\toutput, err := runCommand(t, main, []string{\"echo\", \"hello world\"}, clientConf, 10)\n\t\tif shouldFail {\n\t\t\trequire.Error(t, err)\n\t\t} else {\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Equal(t, \"hello world\\n\", output)\n\t\t}\n\t}\n\n\t// ensure that initial proxy's tunnel has been established\n\thelpers.WaitForActiveTunnelConnections(t, main.Tunnel, \"cluster-remote\", 1)\n\t// execute the connection via initial proxy; should not fail\n\ttestProxyConn(nil, false)\n\n\t// helper funcion for making numbered proxy names\n\tpname := func(n int) string {\n\t\treturn fmt.Sprintf(\"cluster-main-proxy-%d\", n)\n\t}\n\n\t// create first numbered proxy\n\t_, c0 := addNewMainProxy(pname(0))\n\t// check that we now have two tunnel connections\n\trequire.NoError(t, helpers.WaitForProxyCount(remote, \"cluster-main\", 2))\n\t// check that first numbered proxy is OK.\n\ttestProxyConn(&c0, false)\n\t// remove the initial proxy.\n\trequire.NoError(t, lb.RemoveBackend(mainProxyAddr))\n\trequire.NoError(t, helpers.WaitForProxyCount(remote, \"cluster-main\", 1))\n\n\t// force bad state by iteratively removing previous proxy before\n\t// adding next proxy; this ensures that discovery protocol's list of\n\t// known proxies is all invalid.\n\tfor i := 0; i < 6; i++ {\n\t\tprev, next := pname(i), pname(i+1)\n\t\tkillMainProxy(prev)\n\t\trequire.NoError(t, helpers.WaitForProxyCount(remote, \"cluster-main\", 0))\n\t\t_, cn := addNewMainProxy(next)\n\t\trequire.NoError(t, helpers.WaitForProxyCount(remote, \"cluster-main\", 1))\n\t\ttestProxyConn(&cn, false)\n\t}\n\n\t// Stop both clusters and remaining nodes.\n\trequire.NoError(t, remote.StopAll())\n\trequire.NoError(t, main.StopAll())\n}",
"func (c *Local) LocalDiscoveryService() fab.DiscoveryService {\n\treturn c.localDiscovery\n}",
"func (m *MockInterface) Discovery() discovery.DiscoveryInterface {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Discovery\")\n\tret0, _ := ret[0].(discovery.DiscoveryInterface)\n\treturn ret0\n}",
"func (m *MockService) Discovery() *idp.DiscoveryResponse {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Discovery\")\n\tret0, _ := ret[0].(*idp.DiscoveryResponse)\n\treturn ret0\n}",
"func (m *MockEarlyConnection) LocalAddr() net.Addr {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LocalAddr\")\n\tret0, _ := ret[0].(net.Addr)\n\treturn ret0\n}",
"func NPLTestLocalAccess(t *testing.T) {\n\tr := require.New(t)\n\n\tannotation := make(map[string]string)\n\tannotation[k8s.NPLEnabledAnnotationKey] = \"true\"\n\tipFamily := corev1.IPv4Protocol\n\ttestData.createNginxClusterIPServiceWithAnnotations(false, &ipFamily, annotation)\n\texpectedAnnotations := newExpectedNPLAnnotations(defaultStartPort, defaultEndPort).Add(nil, defaultTargetPort, \"tcp\")\n\n\tnode := nodeName(0)\n\n\ttestPodName := randName(\"test-pod-\")\n\terr := testData.createNginxPodOnNode(testPodName, testNamespace, node, false)\n\tr.NoError(err, \"Error creating test Pod: %v\", err)\n\n\tclientName := randName(\"test-client-\")\n\terr = testData.createBusyboxPodOnNode(clientName, testNamespace, node, true)\n\tr.NoError(err, \"Error creating hostNetwork Pod %s: %v\", clientName)\n\n\terr = testData.podWaitForRunning(defaultTimeout, clientName, testNamespace)\n\tr.NoError(err, \"Error when waiting for Pod %s to be running\", clientName)\n\n\tantreaPod, err := testData.getAntreaPodOnNode(node)\n\tr.NoError(err, \"Error when getting Antrea Agent Pod on Node '%s'\", node)\n\n\tnplAnnotations, testPodIP := getNPLAnnotations(t, testData, r, testPodName)\n\n\tcheckNPLRulesForPod(t, testData, r, nplAnnotations, antreaPod, testPodIP, true)\n\texpectedAnnotations.Check(t, nplAnnotations)\n\tcheckTrafficForNPL(testData, r, nplAnnotations, clientName)\n\n\ttestData.deletePod(testNamespace, testPodName)\n\tcheckNPLRulesForPod(t, testData, r, nplAnnotations, antreaPod, testPodIP, false)\n}",
"func newLocalService(config fab.EndpointConfig, mspID string, opts ...coptions.Opt) *LocalService {\n\tlogger.Debug(\"Creating new local discovery service\")\n\n\ts := &LocalService{mspID: mspID}\n\ts.service = newService(config, s.queryPeers, opts...)\n\treturn s\n}",
"func (m *MockInformation) LocalLocation() *universe.View {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LocalLocation\")\n\tret0, _ := ret[0].(*universe.View)\n\treturn ret0\n}",
"func (m *MockConner) LocalMultiaddr() multiaddr.Multiaddr {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LocalMultiaddr\")\n\tret0, _ := ret[0].(multiaddr.Multiaddr)\n\treturn ret0\n}",
"func (l *Factory) CreateLocalDiscoveryProvider(config fabApi.EndpointConfig) (fabApi.LocalDiscoveryProvider, error) {\n\tlogger.Debug(\"create local Provider Impl\")\n\treturn &impl{config, l.LocalPeer, l.LocalPeerTLSCertPem}, nil\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
LocalDiscoveryProvider indicates an expected call of LocalDiscoveryProvider
|
func (mr *MockClientMockRecorder) LocalDiscoveryProvider() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LocalDiscoveryProvider", reflect.TypeOf((*MockClient)(nil).LocalDiscoveryProvider))
}
|
[
"func (c *Provider) LocalDiscoveryProvider() fab.LocalDiscoveryProvider {\n\treturn c.localDiscoveryProvider\n}",
"func (m *MockClient) LocalDiscoveryProvider() fab.LocalDiscoveryProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LocalDiscoveryProvider\")\n\tret0, _ := ret[0].(fab.LocalDiscoveryProvider)\n\treturn ret0\n}",
"func (m *MockProviders) LocalDiscoveryProvider() fab.LocalDiscoveryProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LocalDiscoveryProvider\")\n\tret0, _ := ret[0].(fab.LocalDiscoveryProvider)\n\treturn ret0\n}",
"func (c *Local) LocalDiscoveryService() fab.DiscoveryService {\n\treturn c.localDiscovery\n}",
"func (_e *MockPlcDriver_Expecter) SupportsDiscovery() *MockPlcDriver_SupportsDiscovery_Call {\n\treturn &MockPlcDriver_SupportsDiscovery_Call{Call: _e.mock.On(\"SupportsDiscovery\")}\n}",
"func (sc *ShamClient) fallbackDiscovery() {\n\tif len(sc.localRegistry) == 0 {\n\t\tsc.setLocalRegistry(sc.serviceRegistry.Fallback)\n\t\tsc.logger.Infof(\"using Fallback registry for service %s: %+v\", sc.serviceName, sc.localRegistry)\n\t} else {\n\t\tsc.logger.Infof(\"continue using local registry for service %s: %+v\", sc.serviceName, sc.localRegistry)\n\t}\n}",
"func (m *Module) gatherProviderLocalNames() {\n\tproviders := make(map[addrs.Provider]string)\n\tfor k, v := range m.ProviderRequirements.RequiredProviders {\n\t\tproviders[v.Type] = k\n\t}\n\tm.ProviderLocalNames = providers\n}",
"func (l *Factory) CreateLocalDiscoveryProvider(config fabApi.EndpointConfig) (fabApi.LocalDiscoveryProvider, error) {\n\tlogger.Debug(\"create local Provider Impl\")\n\treturn &impl{config, l.LocalPeer, l.LocalPeerTLSCertPem}, nil\n}",
"func (p *providerVerifier) DiscoveryEnabled() bool {\n\treturn p.discoveryEnabled\n}",
"func WithLocalDiscoveryProvider(discoveryProvider fab.LocalDiscoveryProvider) SDKContextParams {\n\treturn func(ctx *Provider) {\n\t\tctx.localDiscoveryProvider = discoveryProvider\n\t}\n}",
"func (s *gossipServiceDiscovery) LocalDiscovery(ctx context.Context) (*localPeersDTO, error) {\n\treq := discClient.\n\t\tNewRequest().AddLocalPeersQuery()\n\n\tres, err := s.client.Send(ctx, req, s.getAuthInfo())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpeers, err := res.ForLocal().Peers()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdc := newLocalPeersDTO()\n\n\treturn s.parseDiscoverLocalPeers(dc, peers), nil\n}",
"func (m *MockMemberList) LocalNode() discovery.Member {\n\tret := m.ctrl.Call(m, \"LocalNode\")\n\tret0, _ := ret[0].(discovery.Member)\n\treturn ret0\n}",
"func (p *providerVerifier) Provider() DiscoveryProvider {\n\treturn p.provider\n}",
"func NPLTestLocalAccess(t *testing.T) {\n\tr := require.New(t)\n\n\tannotation := make(map[string]string)\n\tannotation[k8s.NPLEnabledAnnotationKey] = \"true\"\n\tipFamily := corev1.IPv4Protocol\n\ttestData.createNginxClusterIPServiceWithAnnotations(false, &ipFamily, annotation)\n\texpectedAnnotations := newExpectedNPLAnnotations(defaultStartPort, defaultEndPort).Add(nil, defaultTargetPort, \"tcp\")\n\n\tnode := nodeName(0)\n\n\ttestPodName := randName(\"test-pod-\")\n\terr := testData.createNginxPodOnNode(testPodName, testNamespace, node, false)\n\tr.NoError(err, \"Error creating test Pod: %v\", err)\n\n\tclientName := randName(\"test-client-\")\n\terr = testData.createBusyboxPodOnNode(clientName, testNamespace, node, true)\n\tr.NoError(err, \"Error creating hostNetwork Pod %s: %v\", clientName)\n\n\terr = testData.podWaitForRunning(defaultTimeout, clientName, testNamespace)\n\tr.NoError(err, \"Error when waiting for Pod %s to be running\", clientName)\n\n\tantreaPod, err := testData.getAntreaPodOnNode(node)\n\tr.NoError(err, \"Error when getting Antrea Agent Pod on Node '%s'\", node)\n\n\tnplAnnotations, testPodIP := getNPLAnnotations(t, testData, r, testPodName)\n\n\tcheckNPLRulesForPod(t, testData, r, nplAnnotations, antreaPod, testPodIP, true)\n\texpectedAnnotations.Check(t, nplAnnotations)\n\tcheckTrafficForNPL(testData, r, nplAnnotations, clientName)\n\n\ttestData.deletePod(testNamespace, testPodName)\n\tcheckNPLRulesForPod(t, testData, r, nplAnnotations, antreaPod, testPodIP, false)\n}",
"func MissingProviderSuggestion(ctx context.Context, addr addrs.Provider, source Source, reqs Requirements) addrs.Provider {\n\tif !addr.IsDefault() {\n\t\treturn addr\n\t}\n\n\t// Before possibly looking up legacy naming, see if the user has another provider\n\t// named in their requirements that is of the same type, and offer that\n\t// as a suggestion\n\tfor req := range reqs {\n\t\tif req != addr && req.Type == addr.Type {\n\t\t\treturn req\n\t\t}\n\t}\n\n\t// Our strategy here, for a default provider, is to use the default\n\t// registry's special API for looking up \"legacy\" providers and try looking\n\t// for a legacy provider whose type name matches the type of the given\n\t// provider. This should then find a suitable answer for any provider\n\t// that was originally auto-installable in v0.12 and earlier but moved\n\t// into a non-default namespace as part of introducing the hierarchical\n\t// provider namespace.\n\t//\n\t// To achieve that, we need to find the direct registry client in\n\t// particular from the given source, because that is the only Source\n\t// implementation that can actually handle a legacy provider lookup.\n\tregSource := findLegacyProviderLookupSource(addr.Hostname, source)\n\tif regSource == nil {\n\t\t// If there's no direct registry source in the installation config\n\t\t// then we can't provide a renaming suggestion.\n\t\treturn addr\n\t}\n\n\tdefaultNS, redirectNS, err := regSource.lookupLegacyProviderNamespace(ctx, addr.Hostname, addr.Type)\n\tif err != nil {\n\t\treturn addr\n\t}\n\n\tswitch {\n\tcase redirectNS != \"\":\n\t\treturn addrs.Provider{\n\t\t\tHostname: addr.Hostname,\n\t\t\tNamespace: redirectNS,\n\t\t\tType: addr.Type,\n\t\t}\n\tdefault:\n\t\treturn addrs.Provider{\n\t\t\tHostname: addr.Hostname,\n\t\t\tNamespace: defaultNS,\n\t\t\tType: addr.Type,\n\t\t}\n\t}\n}",
"func checkLocalAddr(addr string) error {\n\tifaces, err := systeminfo.NetworkInterfaces()\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tif len(ifaces) == 0 {\n\t\treturn trace.NotFound(\"no network interfaces detected\")\n\t}\n\tavailableAddrs := make([]string, 0, len(ifaces))\n\tfor _, iface := range ifaces {\n\t\tif iface.IPv4 == addr {\n\t\t\treturn nil\n\t\t}\n\t\tavailableAddrs = append(availableAddrs, iface.IPv4)\n\t}\n\treturn trace.BadParameter(\n\t\t\"%v matches none of the available addresses %v\",\n\t\taddr, strings.Join(availableAddrs, \", \"))\n}",
"func NewLocalProvider(t []string) Provider {\n\treturn newLocalProviderWithClock(t, clock.New())\n}",
"func Discovery(*DiscoveryRequest, *DiscoveryResponse) {}",
"func TestLogConfigInLocal(t *testing.T) {\n\t// Check if\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PrivateKey mocks base method
|
func (m *MockClient) PrivateKey() core.Key {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "PrivateKey")
ret0, _ := ret[0].(core.Key)
return ret0
}
|
[
"func (pk MockPrivKeyLedgerEd25519) AssertIsPrivKeyInner() {}",
"func TestPrivateKey(t *testing.T) {\n\tt.Parallel()\n\t// First generate a valid private key content\n\tpriv, err := rsa.GenerateKey(rand.Reader, 1024)\n\tbArray := pem.EncodeToMemory(&pem.Block{Type: \"RSA PRIVATE KEY\",\n\t\tHeaders: nil,\n\t\tBytes: x509.MarshalPKCS1PrivateKey(priv)})\n\tprivateKeyContent := string(bArray)\n\n\t// Config to test\n\tlocationProps := config.DynamicMap{\n\t\t\"user_name\": \"jdoe\",\n\t\t\"url\": \"127.0.0.1\",\n\t\t\"port\": 22,\n\t\t\"private_key\": privateKeyContent,\n\t}\n\tcfg := config.Configuration{\n\t\tSSHConnectionTimeout: 10 * time.Second,\n\t}\n\terr = checkLocationUserConfig(locationProps)\n\tassert.NoError(t, err, \"Unexpected error parsing a configuration with private key\")\n\t_, err = getSSHClient(cfg, &types.Credential{User: \"jdoe\", Keys: map[string]string{\"0\": privateKeyContent}}, locationProps)\n\tassert.NoError(t, err, \"Unexpected error getting a ssh client using provided properties with private key\")\n\n\t// Remove the private key.\n\t// As there is no password defined either, check an error is returned\n\tlocationProps.Set(\"private_key\", \"\")\n\terr = checkLocationUserConfig(locationProps)\n\tassert.Error(t, err, \"Expected an error parsing a wrong configuration with no private key and no password defined\")\n\t_, err = getSSHClient(cfg, &types.Credential{}, locationProps)\n\tassert.Error(t, err, \"Expected an error getting a ssh client using a configuration with no private key and no password defined\")\n\t_, err = getSSHClient(cfg, &types.Credential{User: \"jdoe\"}, locationProps)\n\tassert.Error(t, err, \"Expected an error getting a ssh client using a provided user name property but no private key and no password provided\")\n\n\t// Setting a wrong private key path\n\t// Check the attempt to use this key for the authentication method is failing\n\tlocationProps.Set(\"private_key\", \"invalid_path_to_key.pem\")\n\terr = checkLocationUserConfig(locationProps)\n\tassert.NoError(t, err, \"Unexpected error parsing a configuration with private key\")\n\t_, err = getSSHClient(cfg, &types.Credential{}, locationProps)\n\tassert.Error(t, err, \"Expected an error getting a ssh client using a configuration with bad private key and no password defined\")\n\t_, err = getSSHClient(cfg, &types.Credential{User: \"jdoe\", Keys: map[string]string{\"0\": \"invalid_path_to_key.pem\"}}, locationProps)\n\tassert.Error(t, err, \"Expected an error getting a ssh client using provided credentials with bad private key and no password defined\")\n\n\t// Slurm Configuration with no private key but a password, the config should be valid\n\tlocationProps = config.DynamicMap{\n\t\t\"user_name\": \"jdoe\",\n\t\t\"url\": \"127.0.0.1\",\n\t\t\"port\": 22,\n\t\t\"password\": \"test\",\n\t}\n\n\terr = checkLocationUserConfig(locationProps)\n\tassert.NoError(t, err, \"Unexpected error parsing a configuration with password\")\n\t_, err = getSSHClient(cfg, &types.Credential{User: \"jdoe\", Token: \"test\"}, locationProps)\n\tassert.NoError(t, err, \"Unexpected error getting a ssh client using provided credentials with password\")\n}",
"func (m *MockisCryptoAsymApiReqSetupPrivateKeyEx_Key) isCryptoAsymApiReqSetupPrivateKeyEx_Key() {\n\tm.ctrl.Call(m, \"isCryptoAsymApiReqSetupPrivateKeyEx_Key\")\n}",
"func (c *HTTPClientMock) APIKeyPrivate() string {\n\treturn c.apiKeyPrivate\n}",
"func (c CryptoServiceTester) TestGetPrivateKeyMultipleKeystores(t *testing.T) {\n\tcryptoService := c.cryptoServiceFactory()\n\tcryptoService.keyStores = append(cryptoService.keyStores,\n\t\ttrustmanager.NewKeyMemoryStore(passphraseRetriever))\n\n\tprivKey, err := utils.GenerateECDSAKey(rand.Reader)\n\trequire.NoError(t, err, c.errorMsg(\"error creating key\"))\n\n\tfor _, store := range cryptoService.keyStores {\n\t\terr := store.AddKey(trustmanager.KeyInfo{Role: c.role, Gun: c.gun}, privKey)\n\t\trequire.NoError(t, err)\n\t}\n\n\tfoundKey, role, err := cryptoService.GetPrivateKey(privKey.ID())\n\trequire.NoError(t, err, c.errorMsg(\"failed to get private key\"))\n\trequire.Equal(t, c.role, role)\n\trequire.Equal(t, privKey.ID(), foundKey.ID())\n}",
"func (m *MockSecurityKey) PrivateKey(arg0 *securitykey.CryptoKey) (crypto.PrivateKey, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"PrivateKey\", arg0)\n\tret0, _ := ret[0].(crypto.PrivateKey)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (m *MockisCryptoAsymApiRespSetupPrivateKey_KeyInfo) isCryptoAsymApiRespSetupPrivateKey_KeyInfo() {\n\tm.ctrl.Call(m, \"isCryptoAsymApiRespSetupPrivateKey_KeyInfo\")\n}",
"func TestPrivateKey(t *testing.T) {\n\tconst jsonKey = `{\"keys\":\n [\n {\"kty\":\"EC\",\n \"crv\":\"P-256\",\n \"x\":\"MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4\",\n \"y\":\"4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM\",\n \"d\":\"870MB6gfuTJ4HtUnUvYMyJpr5eUZNP4Bk43bVdj3eAE\",\n \"use\":\"enc\",\n \"kid\":\"1\"},\n\n {\"kty\":\"RSA\",\n \"n\":\"0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx4cbbfAAtVT86zwu1RK7aPFFxuhDR1L6tSoc_BJECPebWKRXjBZCiFV4n3oknjhMstn64tZ_2W-5JsGY4Hc5n9yBXArwl93lqt7_RN5w6Cf0h4QyQ5v-65YGjQR0_FDW2QvzqY368QQMicAtaSqzs8KJZgnYb9c7d0zgdAZHzu6qMQvRL5hajrn1n91CbOpbISD08qNLyrdkt-bFTWhAI4vMQFh6WeZu0fM4lFd2NcRwr3XPksINHaQ-G_xBniIqbw0Ls1jF44-csFCur-kEgU8awapJzKnqDKgw\",\n \"e\":\"AQAB\",\n \"d\":\"X4cTteJY_gn4FYPsXB8rdXix5vwsg1FLN5E3EaG6RJoVH-HLLKD9M7dx5oo7GURknchnrRweUkC7hT5fJLM0WbFAKNLWY2vv7B6NqXSzUvxT0_YSfqijwp3RTzlBaCxWp4doFk5N2o8Gy_nHNKroADIkJ46pRUohsXywbReAdYaMwFs9tv8d_cPVY3i07a3t8MN6TNwm0dSawm9v47UiCl3Sk5ZiG7xojPLu4sbg1U2jx4IBTNBznbJSzFHK66jT8bgkuqsk0GjskDJk19Z4qwjwbsnn4j2WBii3RL-Us2lGVkY8fkFzme1z0HbIkfz0Y6mqnOYtqc0X4jfcKoAC8Q\",\n \"p\":\"83i-7IvMGXoMXCskv73TKr8637FiO7Z27zv8oj6pbWUQyLPQBQxtPVnwD20R-60eTDmD2ujnMt5PoqMrm8RfmNhVWDtjjMmCMjOpSXicFHj7XOuVIYQyqVWlWEh6dN36GVZYk93N8Bc9vY41xy8B9RzzOGVQzXvNEvn7O0nVbfs\",\n \"q\":\"3dfOR9cuYq-0S-mkFLzgItgMEfFzB2q3hWehMuG0oCuqnb3vobLyumqjVZQO1dIrdwgTnCdpYzBcOfW5r370AFXjiWft_NGEiovonizhKpo9VVS78TzFgxkIdrecRezsZ-1kYd_s1qDbxtkDEgfAITAG9LUnADun4vIcb6yelxk\",\n \"dp\":\"G4sPXkc6Ya9y8oJW9_ILj4xuppu0lzi_H7VTkS8xj5SdX3coE0oimYwxIi2emTAue0UOa5dpgFGyBJ4c8tQ2VF402XRugKDTP8akYhFo5tAA77Qe_NmtuYZc3C3m3I24G2GvR5sSDxUyAN2zq8Lfn9EUms6rY3Ob8YeiKkTiBj0\",\n \"dq\":\"s9lAH9fggBsoFR8Oac2R_E2gw282rT2kGOAhvIllETE1efrA6huUUvMfBcMpn8lqeW6vzznYY5SSQF7pMdC_agI3nG8Ibp1BUb0JUiraRNqUfLhcQb_d9GF4Dh7e74WbRsobRonujTYN1xCaP6TO61jvWrX-L18txXw494Q_cgk\",\n \"qi\":\"GyM_p6JrXySiz1toFgKbWV-JdI3jQ4ypu9rbMWx3rQJBfmt0FoYzgUIZEVFEcOqwemRN81zoDAaa-Bk0KWNGDjJHZDdDmFhW3AN7lI-puxk_mHZGJ11rxyR8O55XLSe3SPmRfKwZI6yU24ZxvQKFYItdldUKGzO6Ia6zTKhAVRU\",\n \"alg\":\"RS256\",\n \"kid\":\"2011-04-29\"}\n ]\n }`\n\n\tjwt, err := Unmarshal([]byte(jsonKey))\n\tif err != nil {\n\t\tt.Fatal(\"Unmarshal: \", err)\n\t} else if len(jwt.Keys) != 2 {\n\t\tt.Fatalf(\"Expected 2 keys, got %d\", len(jwt.Keys))\n\t}\n\n\tkeys := make([]crypto.PrivateKey, len(jwt.Keys))\n\tfor ii, jwt := range jwt.Keys {\n\t\tkeys[ii], err = jwt.DecodePrivateKey()\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Failed to decode key %d: %v\", ii, err)\n\t\t}\n\t}\n\n\tif key0, ok := keys[0].(*ecdsa.PrivateKey); !ok {\n\t\tt.Fatalf(\"Expected ECDSA key[0], got %T\", keys[0])\n\t} else if key1, ok := keys[1].(*rsa.PrivateKey); !ok {\n\t\tt.Fatalf(\"Expected RSA key[1], got %T\", keys[1])\n\t} else if key0.Curve != elliptic.P256() {\n\t\tt.Fatalf(\"Key[0] is not using P-256 curve\")\n\t} else if !bytes.Equal(key0.X.Bytes(), []byte{0x30, 0xa0, 0x42, 0x4c, 0xd2,\n\t\t0x1c, 0x29, 0x44, 0x83, 0x8a, 0x2d, 0x75, 0xc9, 0x2b, 0x37, 0xe7, 0x6e, 0xa2,\n\t\t0xd, 0x9f, 0x0, 0x89, 0x3a, 0x3b, 0x4e, 0xee, 0x8a, 0x3c, 0xa, 0xaf, 0xec, 0x3e}) {\n\t\tt.Fatalf(\"Bad key[0].X, got %v\", key0.X.Bytes())\n\t} else if !bytes.Equal(key0.Y.Bytes(), []byte{0xe0, 0x4b, 0x65, 0xe9, 0x24,\n\t\t0x56, 0xd9, 0x88, 0x8b, 0x52, 0xb3, 0x79, 0xbd, 0xfb, 0xd5, 0x1e, 0xe8,\n\t\t0x69, 0xef, 0x1f, 0xf, 0xc6, 0x5b, 0x66, 0x59, 0x69, 0x5b, 0x6c, 0xce,\n\t\t0x8, 0x17, 0x23}) {\n\t\tt.Fatalf(\"Bad key[0].Y, got %v\", key0.Y.Bytes())\n\t} else if !bytes.Equal(key0.D.Bytes(), []byte{0xf3, 0xbd, 0xc, 0x7, 0xa8,\n\t\t0x1f, 0xb9, 0x32, 0x78, 0x1e, 0xd5, 0x27, 0x52, 0xf6, 0xc, 0xc8, 0x9a,\n\t\t0x6b, 0xe5, 0xe5, 0x19, 0x34, 0xfe, 0x1, 0x93, 0x8d, 0xdb, 0x55, 0xd8,\n\t\t0xf7, 0x78, 0x1}) {\n\t\tt.Fatalf(\"Bad key[0].D, got %v\", key0.D.Bytes())\n\t} else if key1.E != 0x10001 {\n\t\tt.Fatalf(\"Bad key[1].E: %d\", key1.E)\n\t} else if !bytes.Equal(key1.N.Bytes(), []byte{0xd2, 0xfc, 0x7b, 0x6a, 0xa, 0x1e,\n\t\t0x6c, 0x67, 0x10, 0x4a, 0xeb, 0x8f, 0x88, 0xb2, 0x57, 0x66, 0x9b, 0x4d, 0xf6,\n\t\t0x79, 0xdd, 0xad, 0x9, 0x9b, 0x5c, 0x4a, 0x6c, 0xd9, 0xa8, 0x80, 0x15, 0xb5,\n\t\t0xa1, 0x33, 0xbf, 0xb, 0x85, 0x6c, 0x78, 0x71, 0xb6, 0xdf, 0x0, 0xb, 0x55,\n\t\t0x4f, 0xce, 0xb3, 0xc2, 0xed, 0x51, 0x2b, 0xb6, 0x8f, 0x14, 0x5c, 0x6e, 0x84,\n\t\t0x34, 0x75, 0x2f, 0xab, 0x52, 0xa1, 0xcf, 0xc1, 0x24, 0x40, 0x8f, 0x79, 0xb5,\n\t\t0x8a, 0x45, 0x78, 0xc1, 0x64, 0x28, 0x85, 0x57, 0x89, 0xf7, 0xa2, 0x49, 0xe3,\n\t\t0x84, 0xcb, 0x2d, 0x9f, 0xae, 0x2d, 0x67, 0xfd, 0x96, 0xfb, 0x92, 0x6c, 0x19,\n\t\t0x8e, 0x7, 0x73, 0x99, 0xfd, 0xc8, 0x15, 0xc0, 0xaf, 0x9, 0x7d, 0xde, 0x5a,\n\t\t0xad, 0xef, 0xf4, 0x4d, 0xe7, 0xe, 0x82, 0x7f, 0x48, 0x78, 0x43, 0x24, 0x39,\n\t\t0xbf, 0xee, 0xb9, 0x60, 0x68, 0xd0, 0x47, 0x4f, 0xc5, 0xd, 0x6d, 0x90, 0xbf,\n\t\t0x3a, 0x98, 0xdf, 0xaf, 0x10, 0x40, 0xc8, 0x9c, 0x2, 0xd6, 0x92, 0xab, 0x3b,\n\t\t0x3c, 0x28, 0x96, 0x60, 0x9d, 0x86, 0xfd, 0x73, 0xb7, 0x74, 0xce, 0x7, 0x40,\n\t\t0x64, 0x7c, 0xee, 0xea, 0xa3, 0x10, 0xbd, 0x12, 0xf9, 0x85, 0xa8, 0xeb, 0x9f,\n\t\t0x59, 0xfd, 0xd4, 0x26, 0xce, 0xa5, 0xb2, 0x12, 0xf, 0x4f, 0x2a, 0x34, 0xbc,\n\t\t0xab, 0x76, 0x4b, 0x7e, 0x6c, 0x54, 0xd6, 0x84, 0x2, 0x38, 0xbc, 0xc4, 0x5, 0x87,\n\t\t0xa5, 0x9e, 0x66, 0xed, 0x1f, 0x33, 0x89, 0x45, 0x77, 0x63, 0x5c, 0x47, 0xa,\n\t\t0xf7, 0x5c, 0xf9, 0x2c, 0x20, 0xd1, 0xda, 0x43, 0xe1, 0xbf, 0xc4, 0x19, 0xe2,\n\t\t0x22, 0xa6, 0xf0, 0xd0, 0xbb, 0x35, 0x8c, 0x5e, 0x38, 0xf9, 0xcb, 0x5, 0xa, 0xea,\n\t\t0xfe, 0x90, 0x48, 0x14, 0xf1, 0xac, 0x1a, 0xa4, 0x9c, 0xca, 0x9e, 0xa0, 0xca, 0x83}) {\n\t\tt.Fatalf(\"Bad key[1].N, got %v\", key1.N.Bytes())\n\t} else if !bytes.Equal(key1.D.Bytes(), []byte{0x5f, 0x87, 0x13, 0xb5, 0xe2, 0x58,\n\t\t0xfe, 0x9, 0xf8, 0x15, 0x83, 0xec, 0x5c, 0x1f, 0x2b, 0x75, 0x78, 0xb1, 0xe6,\n\t\t0xfc, 0x2c, 0x83, 0x51, 0x4b, 0x37, 0x91, 0x37, 0x11, 0xa1, 0xba, 0x44, 0x9a,\n\t\t0x15, 0x1f, 0xe1, 0xcb, 0x2c, 0xa0, 0xfd, 0x33, 0xb7, 0x71, 0xe6, 0x8a, 0x3b,\n\t\t0x19, 0x44, 0x64, 0x9d, 0xc8, 0x67, 0xad, 0x1c, 0x1e, 0x52, 0x40, 0xbb, 0x85,\n\t\t0x3e, 0x5f, 0x24, 0xb3, 0x34, 0x59, 0xb1, 0x40, 0x28, 0xd2, 0xd6, 0x63, 0x6b,\n\t\t0xef, 0xec, 0x1e, 0x8d, 0xa9, 0x74, 0xb3, 0x52, 0xfc, 0x53, 0xd3, 0xf6, 0x12,\n\t\t0x7e, 0xa8, 0xa3, 0xc2, 0x9d, 0xd1, 0x4f, 0x39, 0x41, 0x68, 0x2c, 0x56, 0xa7,\n\t\t0x87, 0x68, 0x16, 0x4e, 0x4d, 0xda, 0x8f, 0x6, 0xcb, 0xf9, 0xc7, 0x34, 0xaa,\n\t\t0xe8, 0x0, 0x32, 0x24, 0x27, 0x8e, 0xa9, 0x45, 0x4a, 0x21, 0xb1, 0x7c, 0xb0,\n\t\t0x6d, 0x17, 0x80, 0x75, 0x86, 0x8c, 0xc0, 0x5b, 0x3d, 0xb6, 0xff, 0x1d, 0xfd,\n\t\t0xc3, 0xd5, 0x63, 0x78, 0xb4, 0xed, 0xad, 0xed, 0xf0, 0xc3, 0x7a, 0x4c, 0xdc,\n\t\t0x26, 0xd1, 0xd4, 0x9a, 0xc2, 0x6f, 0x6f, 0xe3, 0xb5, 0x22, 0xa, 0x5d, 0xd2,\n\t\t0x93, 0x96, 0x62, 0x1b, 0xbc, 0x68, 0x8c, 0xf2, 0xee, 0xe2, 0xc6, 0xe0, 0xd5,\n\t\t0x4d, 0xa3, 0xc7, 0x82, 0x1, 0x4c, 0xd0, 0x73, 0x9d, 0xb2, 0x52, 0xcc, 0x51,\n\t\t0xca, 0xeb, 0xa8, 0xd3, 0xf1, 0xb8, 0x24, 0xba, 0xab, 0x24, 0xd0, 0x68, 0xec,\n\t\t0x90, 0x32, 0x64, 0xd7, 0xd6, 0x78, 0xab, 0x8, 0xf0, 0x6e, 0xc9, 0xe7, 0xe2,\n\t\t0x3d, 0x96, 0x6, 0x28, 0xb7, 0x44, 0xbf, 0x94, 0xb3, 0x69, 0x46, 0x56, 0x46,\n\t\t0x3c, 0x7e, 0x41, 0x73, 0x99, 0xed, 0x73, 0xd0, 0x76, 0xc8, 0x91, 0xfc, 0xf4,\n\t\t0x63, 0xa9, 0xaa, 0x9c, 0xe6, 0x2d, 0xa9, 0xcd, 0x17, 0xe2, 0x37, 0xdc, 0x2a,\n\t\t0x80, 0x2, 0xf1}) {\n\t\tt.Fatalf(\"Bad key[1].D, got %v\", key1.D.Bytes())\n\t}\n}",
"func (okp OctetKeyPairBase) PrivateKey() []byte { return okp.privateKey }",
"func (m *MockConner) LocalPrivateKey() crypto.PrivKey {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LocalPrivateKey\")\n\tret0, _ := ret[0].(crypto.PrivKey)\n\treturn ret0\n}",
"func generatePrivateKey(bitSize int) (*rsa.PrivateKey, error) {\n // Private Key generation\n privateKey, err := rsa.GenerateKey(rand.Reader, bitSize)\n if err != nil {\n return nil, err\n }\n\n // Validate Private Key\n err = privateKey.Validate()\n if err != nil {\n return nil, err\n }\n\n log.Println(\"Private Key generated\")\n return privateKey, nil\n}",
"func testImportPrivateKey(tc *testContext, ns walletdb.ReadWriteBucket) {\n\tif !tc.create {\n\t\treturn\n\t}\n\n\t// The manager cannot be unlocked to import a private key in watching-only\n\t// mode.\n\tif tc.watchingOnly {\n\t\treturn\n\t}\n\n\ttests := []struct {\n\t\tname string\n\t\tin string\n\t\texpected expectedAddr\n\t}{\n\t\t{\n\t\t\tname: \"wif for compressed pubkey address\",\n\t\t\tin: \"PtWUqkS3apLoZUevFtG3Bwt6uyX8LQfYttycGkt2XCzgxquPATQgG\",\n\t\t\texpected: expectedAddr{\n\t\t\t\taddress: \"TsSYVKf24LcrxyWHBqj4oBcU542PcjH1iA2\",\n\t\t\t\taddressHash: hexToBytes(\"10b601a41d2320527c95eb4cdae2c75b45ae45e1\"),\n\t\t\t\tinternal: false,\n\t\t\t\timported: true,\n\t\t\t\tcompressed: true,\n\t\t\t\tpubKey: hexToBytes(\"03df8852b90ce8da7de6bcbacd26b78534ad9e46dc1b62a01dcf43f5837d7f9f5e\"),\n\t\t\t\tprivKey: hexToBytes(\"ac4cb1a53c4f04a71fffbff26d4500c8a95443936deefd1b6ed89727a6858e08\"),\n\t\t\t\t// privKeyWIF is set to the in field during tests\n\t\t\t},\n\t\t},\n\t}\n\n\tif err := tc.manager.Unlock(ns, privPassphrase); err != nil {\n\t\ttc.t.Fatalf(\"Unlock: unexpected error: %v\", err)\n\t}\n\ttc.unlocked = true\n\n\t// Only import the private keys when in the create phase of testing.\n\ttc.account = ImportedAddrAccount\n\tprefix := testNamePrefix(tc) + \" testImportPrivateKey\"\n\tchainParams := tc.manager.ChainParams()\n\tfor i, test := range tests {\n\t\ttest.expected.privKeyWIF = test.in\n\t\twif, err := dcrutil.DecodeWIF(test.in, chainParams.PrivateKeyID)\n\t\tif err != nil {\n\t\t\ttc.t.Errorf(\"%s DecodeWIF #%d (%s) (%s): unexpected \"+\n\t\t\t\t\"error: %v\", prefix, i, test.in, test.name, err)\n\t\t\tcontinue\n\t\t}\n\t\taddr, err := tc.manager.ImportPrivateKey(ns, wif)\n\t\tif err != nil {\n\t\t\ttc.t.Fatalf(\"%s ImportPrivateKey #%d (%s): \"+\n\t\t\t\t\"unexpected error: %v\", prefix, i,\n\t\t\t\ttest.name, err)\n\t\t}\n\t\tif !testAddress(tc, prefix+\" ImportPrivateKey\", addr, &test.expected) {\n\t\t\tcontinue\n\t\t}\n\t}\n\n\t// Setup a closure to test the results since the same tests need to be\n\t// repeated with the manager unlocked and locked.\n\ttestResults := func() {\n\t\tfor i, test := range tests {\n\t\t\ttest.expected.privKeyWIF = test.in\n\n\t\t\t// Use the Address API to retrieve each of the expected\n\t\t\t// new addresses and ensure they're accurate.\n\t\t\tutilAddr, err := stdaddr.NewAddressPubKeyHashEcdsaSecp256k1(0,\n\t\t\t\ttest.expected.addressHash, chainParams)\n\t\t\tif err != nil {\n\t\t\t\ttc.t.Fatalf(\"%s NewAddressPubKeyHash #%d (%s): \"+\n\t\t\t\t\t\"unexpected error: %v\", prefix, i, test.name, err)\n\t\t\t}\n\t\t\ttaPrefix := fmt.Sprintf(\"%s Address #%d (%s)\", prefix,\n\t\t\t\ti, test.name)\n\t\t\tma, err := tc.manager.Address(ns, utilAddr)\n\t\t\tif err != nil {\n\t\t\t\ttc.t.Fatalf(\"%s: unexpected error: %v\", taPrefix, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !testAddress(tc, taPrefix, ma, &test.expected) {\n\t\t\t\ttc.t.Fatalf(\"testAddress for %v failed\", ma.Address())\n\t\t\t}\n\t\t}\n\t}\n\n\t// The address manager could either be locked or unlocked here depending\n\t// on whether or not it's a watching-only manager. When it's unlocked,\n\t// this will test both the public and private address data are accurate.\n\t// When it's locked, it must be watching-only, so only the public\n\t// address nformation is tested and the private functions are checked\n\t// to ensure they return the expected ErrWatchingOnly error.\n\ttestResults()\n\n\t// Lock the manager and retest all of the addresses to ensure the\n\t// private information returns the expected error.\n\tif err := tc.manager.Lock(); err != nil {\n\t\ttc.t.Fatalf(\"Lock: unexpected error: %v\", err)\n\t}\n\ttc.unlocked = false\n\n\ttestResults()\n}",
"func TestGetPrivKey(t *testing.T) {\n\tet := testutil.GetETH()\n\n\ttype args struct {\n\t\taddr string\n\t}\n\ttype want struct {\n\t\tisErr bool\n\t}\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\twant want\n\t}{\n\t\t{\n\t\t\tname: \"happy path\",\n\t\t\targs: args{\n\t\t\t\taddr: \"0xd4EC46122b3f0afc0287144Adcca5d65B22B799c\",\n\t\t\t},\n\t\t\twant: want{false},\n\t\t},\n\t\t{\n\t\t\tname: \"wrong address\",\n\t\t\targs: args{\n\t\t\t\taddr: \"0x5357135e0D3CbBD37cFCeb9F06257Bb133548Exx\",\n\t\t\t},\n\t\t\twant: want{true},\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tprikey, err := et.GetPrivKey(tt.args.addr, eth.Password)\n\t\t\tif (err == nil) == tt.want.isErr {\n\t\t\t\tt.Errorf(\"readPrivKey() = %v, want error = %v\", err, tt.want.isErr)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err == nil && prikey == nil {\n\t\t\t\tt.Error(\"prikey is nil\")\n\t\t\t}\n\t\t})\n\t}\n}",
"func (pk *PrivKeyLedgerEd25519) AssertIsPrivKeyInner() {}",
"func (m *MockisKey_KeyInfo) isKey_KeyInfo() {\n\tm.ctrl.Call(m, \"isKey_KeyInfo\")\n}",
"func test_generateEthAddrFromPrivateKey(t *testing.T) {\n\t//services.RunOnTestNet()\n\t// generate eth address using gateway\n\toriginalAddr, originalPrivateKey, err := eth_gateway.EthWrapper.GenerateEthAddr()\n\tif err != nil {\n\t\tt.Fatalf(\"error creating ethereum network address\")\n\t}\n\n\tgeneratedAddress := eth_gateway.EthWrapper.GenerateEthAddrFromPrivateKey(originalPrivateKey)\n\n\t// ensure address is what we expected\n\tif originalAddr != generatedAddress {\n\t\tt.Fatalf(\"generated address was %s but we expected %s\", generatedAddress, originalAddr)\n\t}\n\tt.Logf(\"generated address :%v\", generatedAddress.Hex())\n}",
"func TestPrivateData(t *testing.T) {\n\tsdk := mainSDK\n\n\torgsContext := setupMultiOrgContext(t, sdk)\n\terr := integration.EnsureChannelCreatedAndPeersJoined(t, sdk, orgChannelID, \"orgchannel.tx\", orgsContext)\n\trequire.NoError(t, err)\n\n\tcoll1 := \"collection1\"\n\tccID := integration.GenerateExamplePvtID(true)\n\tcollConfig, err := newCollectionConfig(coll1, \"OR('Org2MSP.member')\", 0, 2, 1000)\n\trequire.NoError(t, err)\n\n\terr = integration.InstallExamplePvtChaincode(orgsContext, ccID)\n\trequire.NoError(t, err)\n\terr = integration.InstantiateExamplePvtChaincode(orgsContext, orgChannelID, ccID, \"OR('Org1MSP.member','Org2MSP.member')\", collConfig)\n\trequire.NoError(t, err)\n\n\tctxProvider := sdk.ChannelContext(orgChannelID, fabsdk.WithUser(org1User), fabsdk.WithOrg(org1Name))\n\n\tchClient, err := channel.New(ctxProvider)\n\trequire.NoError(t, err)\n\n\tt.Run(\"Specified Invocation Chain\", func(t *testing.T) {\n\t\tresponse, err := chClient.Execute(\n\t\t\tchannel.Request{\n\t\t\t\tChaincodeID: ccID,\n\t\t\t\tFcn: \"putprivate\",\n\t\t\t\tArgs: [][]byte{[]byte(coll1), []byte(\"key\"), []byte(\"value\")},\n\t\t\t\tInvocationChain: []*fab.ChaincodeCall{\n\t\t\t\t\t{ID: ccID, Collections: []string{coll1}},\n\t\t\t\t},\n\t\t\t},\n\t\t\tchannel.WithRetry(retry.TestRetryOpts),\n\t\t)\n\t\trequire.NoError(t, err)\n\t\tt.Logf(\"Got %d response(s)\", len(response.Responses))\n\t\trequire.NotEmptyf(t, response.Responses, \"expecting at least one response\")\n\t})\n\n\tt.Run(\"Auto-detect Invocation Chain\", func(t *testing.T) {\n\t\tresponse, err := chClient.Execute(\n\t\t\tchannel.Request{\n\t\t\t\tChaincodeID: ccID,\n\t\t\t\tFcn: \"putprivate\",\n\t\t\t\tArgs: [][]byte{[]byte(coll1), []byte(\"key\"), []byte(\"value\")},\n\t\t\t},\n\t\t\tchannel.WithRetry(retry.TestRetryOpts),\n\t\t)\n\t\trequire.NoError(t, err)\n\t\tt.Logf(\"Got %d response(s)\", len(response.Responses))\n\t\trequire.NotEmptyf(t, response.Responses, \"expecting at least one response\")\n\t})\n}",
"func GeneratePrivateKey() *PrivateKey {\n\tpriv := new(PrivateKey)\n\tseckey := NewSeckey()\n\tpriv.seckey = seckey\n\treturn priv\n}",
"func (c *Client) APIKeyPrivate() string {\n return c.client.APIKeyPrivate()\n \n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PrivateKey indicates an expected call of PrivateKey
|
func (mr *MockClientMockRecorder) PrivateKey() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PrivateKey", reflect.TypeOf((*MockClient)(nil).PrivateKey))
}
|
[
"func PrivateKeyValidate(priv *rsa.PrivateKey,) error",
"func (okp OctetKeyPairBase) PrivateKey() []byte { return okp.privateKey }",
"func (o *PipelineSshKeyPairAllOf) GetPrivateKeyOk() (*string, bool) {\n\tif o == nil || o.PrivateKey == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PrivateKey, true\n}",
"func (mr *MockSecurityKeyMockRecorder) PrivateKey(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"PrivateKey\", reflect.TypeOf((*MockSecurityKey)(nil).PrivateKey), arg0)\n}",
"func (pk *PrivKeyLedgerEd25519) AssertIsPrivKeyInner() {}",
"func (pk MockPrivKeyLedgerEd25519) AssertIsPrivKeyInner() {}",
"func (o *TppCertificateParams) GetPrivateKeyOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.PrivateKey, true\n}",
"func validatePrivateKey(k *ecdsa.PrivateKey) bool {\n\tif k == nil || k.D == nil || k.D.Sign() == 0 {\n\t\treturn false\n\t}\n\treturn ValidatePublicKey(&k.PublicKey)\n}",
"func (o *PipelineSshKeyPairAllOf) HasPrivateKey() bool {\n\tif o != nil && o.PrivateKey != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}",
"func (c *HTTPClientMock) APIKeyPrivate() string {\n\treturn c.apiKeyPrivate\n}",
"func CheckPrivateKey(s *string) bool {\n\t_, err := strkey.Decode(strkey.VersionByteSeed, *s)\n\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn true\n\n}",
"func (k *Key) IsPrivate() bool {\n\treturn k.Key.IsPrivate()\n}",
"func (o SslCertOutput) PrivateKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SslCert) pulumi.StringOutput { return v.PrivateKey }).(pulumi.StringOutput)\n}",
"func generatePrivateKey(bitSize int) (*rsa.PrivateKey, error) {\n // Private Key generation\n privateKey, err := rsa.GenerateKey(rand.Reader, bitSize)\n if err != nil {\n return nil, err\n }\n\n // Validate Private Key\n err = privateKey.Validate()\n if err != nil {\n return nil, err\n }\n\n log.Println(\"Private Key generated\")\n return privateKey, nil\n}",
"func (dtk *DcmTagKey) IsPrivate() bool {\n\treturn ((dtk.group & 1) != 0) && dtk.HasValidGroup()\n}",
"func (mr *MockClientMockRecorder) DecryptPrivateKey(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DecryptPrivateKey\", reflect.TypeOf((*MockClient)(nil).DecryptPrivateKey), arg0, arg1)\n}",
"func (a *Account)HasPrivateKey() bool {\n\tswitch a.accountType {\n\tcase AccountTypeSEP0005:\n\t\treturn true\n\tcase AccountTypeRandom:\n\t\treturn true\n\t}\n\n\treturn false\n}",
"func ExpectValidPrivateKeyData(csr *certificatesv1.CertificateSigningRequest, key crypto.Signer) error {\n\tcert, err := pki.DecodeX509CertificateBytes(csr.Status.Certificate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tequal := func() (bool, error) {\n\t\tswitch pub := key.Public().(type) {\n\t\tcase *rsa.PublicKey:\n\t\t\treturn pub.Equal(cert.PublicKey), nil\n\t\tcase *ecdsa.PublicKey:\n\t\t\treturn pub.Equal(cert.PublicKey), nil\n\t\tcase ed25519.PublicKey:\n\t\t\treturn pub.Equal(cert.PublicKey), nil\n\t\tdefault:\n\t\t\treturn false, fmt.Errorf(\"Unrecognised public key type: %T\", key)\n\t\t}\n\t}\n\n\tok, err := equal()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !ok {\n\t\treturn errors.New(\"Expected signed certificate's public key to match requester's private key\")\n\t}\n\n\treturn nil\n}",
"func isPrivate(this js.Value, args []js.Value) interface{} {\n\tgo func(args []js.Value) {\n\t\tlogDebug(\"isPrivate\")\n\t\t// clean args\n\t\tcallback, remainder, err := handleArgs(args, 1, \"isPrivate\")\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tk := &keyaddr.Key{\n\t\t\tKey: remainder[0].String(),\n\t\t}\n\n\t\t// do work\n\t\tisPrivateResult, err := k.IsPrivate()\n\t\tif err != nil {\n\t\t\tjsLogReject(callback, \"error testing key type: %s\", err)\n\t\t\treturn\n\t\t}\n\n\t\t// return result\n\t\tcallback.Invoke(nil, isPrivateResult)\n\n\t\treturn\n\t}(args)\n\treturn nil\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PublicVersion mocks base method
|
func (m *MockClient) PublicVersion() msp.Identity {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "PublicVersion")
ret0, _ := ret[0].(msp.Identity)
return ret0
}
|
[
"func TestVersion(t *testing.T) {\n\t//fmt.Println(\"EliteProvision [\" + Version() + \"]\")\n}",
"func newVersionCheckerMock(version string, tags []string) *VersionChecker {\n\n\tfixedAppVersion := fixVersion(version)\n\n\treturn &VersionChecker{\n\t\tfixedAppVersion: fixedAppVersion,\n\t\tversionSource: &versionCheckerMock{\n\t\t\ttags: tags,\n\t\t\tfixVersionStrFunc: fixVersion,\n\t\t\ttagFilterFunc: versionFilterFunc(fixedAppVersion),\n\t\t},\n\t}\n}",
"func TestGetVersions4A(t *testing.T) {\n}",
"func (m *MockShootClients) Version() *version.Info {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Version\")\n\tret0, _ := ret[0].(*version.Info)\n\treturn ret0\n}",
"func (m *MockTree) Version() int64 {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Version\")\n\tret0, _ := ret[0].(int64)\n\treturn ret0\n}",
"func (m *MockEventLogger) Version() uint64 {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Version\")\n\tret0, _ := ret[0].(uint64)\n\treturn ret0\n}",
"func (_m *MockAggregate) incrementVersion() {\n\t_m.Called()\n}",
"func (_m *MockAggregate) setVersion(_a0 int) {\n\t_m.Called(_a0)\n}",
"func (m *MockManager) UpdateVersion() {\n\tm.ctrl.Call(m, \"UpdateVersion\")\n}",
"func (m *MockRegistry) BuildVersion() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"BuildVersion\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func TestVersion(t *testing.T) {\n\t// Get Vault client\n\tvaultClientConfig := vault.DefaultConfig()\n\tvaultClientConfig.Address = vaultAddress\n\tv, err := vault.NewClient(vaultClientConfig)\n\tif err != nil {\n\t\tt.Fatalf(err.Error())\n\t}\n\tv.SetToken(\"root\")\n\tvl := v.Logical()\n\n\t// Get Pachyderm version from plugin\n\tsecret, err := vl.Read(\"/pachyderm/version\")\n\tif err != nil {\n\t\tt.Fatalf(err.Error())\n\t}\n\tif _, ok := secret.Data[\"client-version\"]; !ok {\n\t\tt.Fatalf(\"could not get client version from Pachyderm plugin\")\n\t}\n\tif _, ok := secret.Data[\"server-version\"]; !ok {\n\t\tt.Fatalf(\"could not get server version from Pachyderm plugin\")\n\t}\n\n\t// Test client-only endpoint\n\tsecret, err = vl.Read(\"/pachyderm/version/client-only\")\n\tif _, ok := secret.Data[\"client-version\"]; !ok {\n\t\tt.Fatalf(\"could not get client version from Pachyderm plugin (client-only)\")\n\t}\n\tif _, ok := secret.Data[\"server-version\"]; ok {\n\t\tt.Fatalf(\"got unexpected server version from Pachyderm plugin (client-only)\")\n\t}\n}",
"func (m *MockqueueTaskInfo) GetVersion() int64 {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetVersion\")\n\tret0, _ := ret[0].(int64)\n\treturn ret0\n}",
"func (m *MockqueueTask) GetVersion() int64 {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetVersion\")\n\tret0, _ := ret[0].(int64)\n\treturn ret0\n}",
"func TestGetVersion(t *testing.T) {\n\tassert := assert.New(t)\n\n\tmockedTpmProvider := new(tpmprovider.MockedTpmProvider)\n\tmockedTpmProvider.On(\"Close\").Return(nil)\n\tmockedTpmProvider.On(\"NvIndexExists\", mock.Anything).Return(false, nil)\n\tmockedTpmProvider.On(\"NvRelease\", mock.Anything, mock.Anything).Return(nil)\n\tmockedTpmProvider.On(\"NvDefine\", mock.Anything, mock.Anything, mock.Anything).Return(nil)\n\tmockedTpmProvider.On(\"NvWrite\", mock.Anything, mock.Anything, mock.Anything).Return(nil)\n\n\tmockedTpmFactory := tpmprovider.MockedTpmFactory{TpmProvider: mockedTpmProvider}\n\n\ttrustAgentService, err := CreateTrustAgentService(CreateTestConfig(), mockedTpmFactory)\n\n\ttrustAgentService.router.HandleFunc(\"/version\", errorHandler(getVersion())).Methods(\"GET\")\n\n\t// test request\n\trequest, err := http.NewRequest(\"GET\", \"/version\", nil)\n\tassert.NoError(err)\n\n\trecorder := httptest.NewRecorder()\n\tresponse := recorder.Result()\n\ttrustAgentService.router.ServeHTTP(recorder, request)\n\tassert.Equal(http.StatusOK, response.StatusCode)\n\tfmt.Printf(\"Version: %s\\n\", recorder.Body.String())\n\tassert.NotEmpty(recorder.Body.String())\n}",
"func (m *Mock) Version() string {\n\treturn defaultMockVersion\n}",
"func (m *MockModelsRepository) PrimaryVersion(arg0 int64) (*ModelVersion, error) {\n\tret := m.ctrl.Call(m, \"PrimaryVersion\", arg0)\n\tret0, _ := ret[0].(*ModelVersion)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func TestGetVersion(t *testing.T) {\n\ttests := []struct {\n\t\tversion string\n\t\tcommit string\n\t\tdate string\n\t\texpect string\n\t\tshortOutput bool\n\t}{\n\t\t{\n\t\t\t\"a\",\n\t\t\t\"b\",\n\t\t\t\"c\",\n\t\t\t\"waver version: a from commit b built on c\",\n\t\t\tfalse,\n\t\t}, {\n\t\t\t\"v0.12.4\",\n\t\t\t\"5b1a61f9b58e3778986c99b1282840ce64329614\",\n\t\t\t\"Thu May 21 16:48:18 PDT 2020\",\n\t\t\t\"waver version: v0.12.4 from commit 5b1a61f9b58e3778986c99b1282840ce64329614 built on Thu May 21 16:48:18 PDT 2020\",\n\t\t\tfalse,\n\t\t}, {\n\t\t\t\"v0.12.4-rc5\",\n\t\t\t\"5b1a61f9b58\",\n\t\t\t\"1590105848\",\n\t\t\t\"waver version: v0.12.4-rc5 from commit 5b1a61f9b58 built on 1590105848\",\n\t\t\tfalse,\n\t\t}, {\n\t\t\t\"v0.12.4-rc5\",\n\t\t\t\"5b1a61f9b58\",\n\t\t\t\"1590105848\",\n\t\t\t\"5b1a61f9b58\",\n\t\t\ttrue,\n\t\t},\n\t}\n\n\t// save the current global variables so they can be set back after testing\n\toldVal := version\n\toldCommit := commit\n\toldDate := date\n\n\tfor _, test := range tests {\n\t\t// run through each test, should not be run in parallel.\n\t\tversion = test.version\n\t\tcommit = test.commit\n\t\tdate = test.date\n\n\t\t// build the new Cobra command and configure stdout and args\n\t\tv := Get(test.shortOutput)\n\n\t\t// assert output string matches expectations\n\t\tassert.Equal(t, test.expect, v)\n\t}\n\n\t// put the original build values back after tests have run\n\tversion = oldVal\n\tcommit = oldCommit\n\tdate = oldDate\n}",
"func (m *MockEventLogger) VersionInitial() uint64 {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"VersionInitial\")\n\tret0, _ := ret[0].(uint64)\n\treturn ret0\n}",
"func (m *MockModelsRepository) CreateVersion(arg0 *ModelVersion) (int64, error) {\n\tret := m.ctrl.Call(m, \"CreateVersion\", arg0)\n\tret0, _ := ret[0].(int64)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PublicVersion indicates an expected call of PublicVersion
|
func (mr *MockClientMockRecorder) PublicVersion() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PublicVersion", reflect.TypeOf((*MockClient)(nil).PublicVersion))
}
|
[
"func isBadVersion(version int) bool{\n return false\n}",
"func isBadVersion(i int) bool{\n\t return true;\n }",
"func (m *MockClient) PublicVersion() msp.Identity {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"PublicVersion\")\n\tret0, _ := ret[0].(msp.Identity)\n\treturn ret0\n}",
"func TestVersion(t *testing.T) {\n\t//fmt.Println(\"EliteProvision [\" + Version() + \"]\")\n}",
"func (o *CvesResponseCveList) GetPublicDateOk() (*string, bool) {\n\tif o == nil || o.PublicDate == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PublicDate, true\n}",
"func StableVersion() Version { \n return Version{\n major: 0,\n minor: 1,\n fix: 5,\n }\n}",
"func NewPublicContractAPI(hmy *hmy.Harmony, version Version) rpc.API {\n\treturn rpc.API{\n\t\tNamespace: version.Namespace(),\n\t\tVersion: APIVersion,\n\t\tService: &PublicContractService{hmy, version},\n\t\tPublic: true,\n\t}\n}",
"func MyFunc() {\n\tfmt.Println(\"Checking package public func\")\n}",
"func isBadVersion(version int) bool{\n\treturn true\n}",
"func (c *StubCheck) Version() string { return \"\" }",
"func (b *GroupsEditBuilder) PublicDate(v string) *GroupsEditBuilder {\n\tb.Params[\"public_date\"] = v\n\treturn b\n}",
"func isValidVersion(v string) bool { return v == Version }",
"func (mr *MockSignerDecrypterMockRecorder) Public() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Public\", reflect.TypeOf((*MockSignerDecrypter)(nil).Public))\n}",
"func (u *walletIdentity) PublicVersion() msp.Identity {\n\treturn u\n}",
"func (e *Error) IsPublic() bool {\n\tswitch e.code {\n\tcase codes.PermissionDenied:\n\t\treturn true\n\tcase codes.NotFound:\n\t\treturn true\n\tcase codes.InvalidArgument:\n\t\treturn true\n\tcase codes.FailedPrecondition:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}",
"func NewPublic(msg string) error {\n\treturn &publicError{publicMessage: msg}\n}",
"func (o *Anchor) GetPublicOk() (*bool, bool) {\n\tif o == nil || o.Public == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Public, true\n}",
"func PublicWrap(err error, publicMsg string) error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\treturn &publicError{cause: err, publicMessage: publicMsg}\n}",
"func UnmarshalPublicCertificateVersion(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(PublicCertificateVersion)\n\terr = core.UnmarshalPrimitive(m, \"auto_rotated\", &obj.AutoRotated)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"created_by\", &obj.CreatedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"created_at\", &obj.CreatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"downloaded\", &obj.Downloaded)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"id\", &obj.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"secret_name\", &obj.SecretName)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"secret_type\", &obj.SecretType)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"secret_group_id\", &obj.SecretGroupID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"payload_available\", &obj.PayloadAvailable)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"alias\", &obj.Alias)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"version_custom_metadata\", &obj.VersionCustomMetadata)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"secret_id\", &obj.SecretID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"expiration_date\", &obj.ExpirationDate)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"serial_number\", &obj.SerialNumber)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"validity\", &obj.Validity, UnmarshalCertificateValidity)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"certificate\", &obj.Certificate)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"intermediate\", &obj.Intermediate)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"private_key\", &obj.PrivateKey)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Serialize mocks base method
|
func (m *MockClient) Serialize() ([]byte, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Serialize")
ret0, _ := ret[0].([]byte)
ret1, _ := ret[1].(error)
return ret0, ret1
}
|
[
"func (_e *MockSerializable_Expecter) Serialize() *MockSerializable_Serialize_Call {\n\treturn &MockSerializable_Serialize_Call{Call: _e.mock.On(\"Serialize\")}\n}",
"func (_m *MockSerializable) Serialize() ([]byte, error) {\n\tret := _m.Called()\n\n\tvar r0 []byte\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func() ([]byte, error)); ok {\n\t\treturn rf()\n\t}\n\tif rf, ok := ret.Get(0).(func() []byte); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]byte)\n\t\t}\n\t}\n\n\tif rf, ok := ret.Get(1).(func() error); ok {\n\t\tr1 = rf()\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}",
"func (m *MockManager) SerializeUpstream(arg0 string) error {\n\tret := m.ctrl.Call(m, \"SerializeUpstream\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func (m *MockManager) SerializeNamespace(arg0 string) error {\n\tret := m.ctrl.Call(m, \"SerializeNamespace\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func (m *MockManager) SerializeUpstreamContents(arg0 *state.UpstreamContents) error {\n\tret := m.ctrl.Call(m, \"SerializeUpstreamContents\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func (_m *JSONSerializable) ToJson() string {\n\tret := _m.Called()\n\n\tvar r0 string\n\tif rf, ok := ret.Get(0).(func() string); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(string)\n\t}\n\n\treturn r0\n}",
"func (m *MockManager) SerializeShipMetadata(arg0 api.ShipAppMetadata, arg1 string) error {\n\tret := m.ctrl.Call(m, \"SerializeShipMetadata\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func (_m *MockWriteBufferJsonBased) WriteSerializable(ctx context.Context, serializable Serializable) error {\n\tret := _m.Called(ctx, serializable)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, Serializable) error); ok {\n\t\tr0 = rf(ctx, serializable)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}",
"func NewMockSerializable(t interface {\n\tmock.TestingT\n\tCleanup(func())\n}) *MockSerializable {\n\tmock := &MockSerializable{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}",
"func TestMsgSerialize(t *testing.T) {\n handler := new(CmdMsgHandler)\n cmd := new(CmdMsg)\n cmd.Cmd = CMD_ENV\n cmd.Data = \"\"\n\n b, err := handler.SerializeMsg(cmd)\n if err != nil {\n t.Fatal(err)\n }\n\n obj, err := handler.DeserializeMsg(b, 255)\n if err != nil {\n t.Fatal(err)\n }\n\n newCmd, ok := obj.(*CmdMsg)\n if !ok {\n t.Fatal(\"Invalid type received %T\", obj)\n }\n\n if cmd.Cmd != newCmd.Cmd {\n t.Fatalf(\n \"Cmd mismatch: %s vs %s\", \n cmd.Cmd, \n newCmd.Cmd,\n )\n }\n\n if cmd.Data != newCmd.Data {\n t.Fatalf(\n \"Data mismatch: %s vs %s\", \n cmd.Data, \n newCmd.Data,\n ) }\n\n log.Printf(\"TestMsgSerialize: passed\")\n}",
"func TestTxSerialize(t *testing.T) {\n\tnoTx := NewNativeMsgTx(1, nil, nil)\n\tnoTxEncoded := []byte{\n\t\t0x01, 0x00, 0x00, 0x00, // Version\n\t\t0x00, // Varint for number of input transactions\n\t\t0x00, // Varint for number of output transactions\n\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Lock time\n\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n\t\t0x00, 0x00, 0x00, 0x00, // Sub Network ID\n\t}\n\n\tregistryTx := NewRegistryMsgTx(1, nil, nil, 16)\n\tregistryTxEncoded := []byte{\n\t\t0x01, 0x00, 0x00, 0x00, // Version\n\t\t0x00, // Varint for number of input transactions\n\t\t0x00, // Varint for number of output transactions\n\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Lock time\n\t\t0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n\t\t0x00, 0x00, 0x00, 0x00, // Sub Network ID\n\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Gas\n\t\t0x77, 0x56, 0x36, 0xb4, 0x89, 0x32, 0xe9, 0xa8,\n\t\t0xbb, 0x67, 0xe6, 0x54, 0x84, 0x36, 0x93, 0x8d,\n\t\t0x9f, 0xc5, 0x62, 0x49, 0x79, 0x5c, 0x0d, 0x0a,\n\t\t0x86, 0xaf, 0x7c, 0x5d, 0x54, 0x45, 0x4c, 0x4b, // Payload hash\n\t\t0x08, // Payload length varint\n\t\t0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Payload / Gas limit\n\t}\n\n\tsubnetworkTx := NewSubnetworkMsgTx(1, nil, nil, &subnetworkid.SubnetworkID{0xff}, 5, []byte{0, 1, 2})\n\n\tsubnetworkTxEncoded := []byte{\n\t\t0x01, 0x00, 0x00, 0x00, // Version\n\t\t0x00, // Varint for number of input transactions\n\t\t0x00, // Varint for number of output transactions\n\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Lock time\n\t\t0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n\t\t0x00, 0x00, 0x00, 0x00, // Sub Network ID\n\t\t0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Gas\n\t\t0x35, 0xf9, 0xf2, 0x93, 0x0e, 0xa3, 0x44, 0x61,\n\t\t0x88, 0x22, 0x79, 0x5e, 0xee, 0xc5, 0x68, 0xae,\n\t\t0x67, 0xab, 0x29, 0x87, 0xd8, 0xb1, 0x9e, 0x45,\n\t\t0x91, 0xe1, 0x05, 0x27, 0xba, 0xa1, 0xdf, 0x3d, // Payload hash\n\t\t0x03, // Payload length varint\n\t\t0x00, 0x01, 0x02, // Payload\n\t}\n\n\ttests := []struct {\n\t\tname string\n\t\tin *MsgTx // Message to encode\n\t\tout *MsgTx // Expected decoded message\n\t\tbuf []byte // Serialized data\n\t\tscriptPubKeyLocs []int // Expected output script locations\n\t}{\n\t\t// No transactions.\n\t\t{\n\t\t\t\"noTx\",\n\t\t\tnoTx,\n\t\t\tnoTx,\n\t\t\tnoTxEncoded,\n\t\t\tnil,\n\t\t},\n\n\t\t// Registry Transaction.\n\t\t{\n\t\t\t\"registryTx\",\n\t\t\tregistryTx,\n\t\t\tregistryTx,\n\t\t\tregistryTxEncoded,\n\t\t\tnil,\n\t\t},\n\n\t\t// Sub Network Transaction.\n\t\t{\n\t\t\t\"subnetworkTx\",\n\t\t\tsubnetworkTx,\n\t\t\tsubnetworkTx,\n\t\t\tsubnetworkTxEncoded,\n\t\t\tnil,\n\t\t},\n\n\t\t// Multiple transactions.\n\t\t{\n\t\t\t\"multiTx\",\n\t\t\tmultiTx,\n\t\t\tmultiTx,\n\t\t\tmultiTxEncoded,\n\t\t\tmultiTxScriptPubKeyLocs,\n\t\t},\n\t}\n\n\tt.Logf(\"Running %d tests\", len(tests))\n\tfor i, test := range tests {\n\t\t// Serialize the transaction.\n\t\tvar buf bytes.Buffer\n\t\terr := test.in.Serialize(&buf)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Serialize %s: error %v\", test.name, err)\n\t\t\tcontinue\n\t\t}\n\t\tif !bytes.Equal(buf.Bytes(), test.buf) {\n\t\t\tt.Errorf(\"Serialize %s:\\n got: %s want: %s\", test.name,\n\t\t\t\tspew.Sdump(buf.Bytes()), spew.Sdump(test.buf))\n\t\t\tcontinue\n\t\t}\n\n\t\t// Deserialize the transaction.\n\t\tvar tx MsgTx\n\t\trbuf := bytes.NewReader(test.buf)\n\t\terr = tx.Deserialize(rbuf)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Deserialize #%d error %v\", i, err)\n\t\t\tcontinue\n\t\t}\n\t\tif !reflect.DeepEqual(&tx, test.out) {\n\t\t\tt.Errorf(\"Deserialize #%d\\n got: %s want: %s\", i,\n\t\t\t\tspew.Sdump(&tx), spew.Sdump(test.out))\n\t\t\tcontinue\n\t\t}\n\n\t\t// Ensure the public key script locations are accurate.\n\t\tscriptPubKeyLocs := test.in.ScriptPubKeyLocs()\n\t\tif !reflect.DeepEqual(scriptPubKeyLocs, test.scriptPubKeyLocs) {\n\t\t\tt.Errorf(\"ScriptPubKeyLocs #%d\\n got: %s want: %s\", i,\n\t\t\t\tspew.Sdump(scriptPubKeyLocs),\n\t\t\t\tspew.Sdump(test.scriptPubKeyLocs))\n\t\t\tcontinue\n\t\t}\n\t\tfor j, loc := range scriptPubKeyLocs {\n\t\t\twantScriptPubKey := test.in.TxOut[j].ScriptPubKey\n\t\t\tgotScriptPubKey := test.buf[loc : loc+len(wantScriptPubKey)]\n\t\t\tif !bytes.Equal(gotScriptPubKey, wantScriptPubKey) {\n\t\t\t\tt.Errorf(\"ScriptPubKeyLocs #%d:%d\\n unexpected \"+\n\t\t\t\t\t\"script got: %s want: %s\", i, j,\n\t\t\t\t\tspew.Sdump(gotScriptPubKey),\n\t\t\t\t\tspew.Sdump(wantScriptPubKey))\n\t\t\t}\n\t\t}\n\t}\n}",
"func (_m *wsConnection) WriteJSON(v interface{}) error {\n\tret := _m.Called(v)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(interface{}) error); ok {\n\t\tr0 = rf(v)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}",
"func (m *MockManager) SerializeConfig(arg0 []api.Asset, arg1 api.ReleaseMetadata, arg2 map[string]interface{}) error {\n\tret := m.ctrl.Call(m, \"SerializeConfig\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func AssertSerialize(t *testing.T, dialect jet.Dialect, serializer jet.Serializer, query string, args ...interface{}) {\n\tout := jet.SQLBuilder{Dialect: dialect}\n\tjet.Serialize(serializer, jet.SelectStatementType, &out)\n\n\t//fmt.Println(out.Buff.String())\n\n\tAssertDeepEqual(t, out.Buff.String(), query)\n\n\tif len(args) > 0 {\n\t\tAssertDeepEqual(t, out.Args, args)\n\t}\n}",
"func (suite *clientSuite) TestCustomMarshaler() {\n\tmarshaling.Register(\n\t\t\"application/bulls--t\",\n\t\tfunc() tmsg.Marshaler { return bsMarshaler{} },\n\t\tfunc(_ interface{}) tmsg.Unmarshaler { return bsMarshaler{} },\n\t)\n\n\tcl := NewClient().\n\t\tAdd(Call{\n\t\t\tUid: \"foo\",\n\t\t\tService: testServiceName,\n\t\t\tEndpoint: \"bulls--t\",\n\t\t\tBody: map[string]string{},\n\t\t\tResponse: map[string]string{},\n\t\t\tHeaders: map[string]string{\n\t\t\t\tmarshaling.ContentTypeHeader: \"application/bulls--t\",\n\t\t\t\tmarshaling.AcceptHeader: \"application/bulls--t\"}}).\n\t\tSetTransport(suite.trans).\n\t\tSetTimeout(time.Second)\n\n\tsuite.Require().NoError(cl.Execute().Errors().Combined())\n\trsp := cl.Response(\"foo\")\n\tsuite.Require().NotNil(rsp)\n\tsuite.Require().IsType(map[string]string{}, rsp.Body())\n\tsuite.Require().Equal(map[string]string{\n\t\t\"1\": \"2\",\n\t}, rsp.Body().(map[string]string))\n}",
"func (m *MocknetData) SerializeRequest(request exchange.ClientRequest) []byte {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SerializeRequest\", request)\n\tret0, _ := ret[0].([]byte)\n\treturn ret0\n}",
"func (instance *Shielded) Serialize() (_ []byte, ferr fail.Error) {\n\tdefer fail.OnPanic(&ferr)\n\n\tif instance == nil {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\n\tvar jsoned []byte\n\txerr := instance.Inspect(func(clonable data.Clonable) fail.Error {\n\t\tvar innerErr error\n\t\tjsoned, innerErr = json.Marshal(clonable)\n\t\tif innerErr != nil {\n\t\t\treturn fail.SyntaxError(\"failed to marshal: %s\", innerErr.Error())\n\t\t}\n\n\t\treturn nil\n\t})\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\treturn jsoned, nil\n}",
"func (_m *MockWriteBuffer) WriteSerializable(ctx context.Context, serializable Serializable) error {\n\tret := _m.Called(ctx, serializable)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, Serializable) error); ok {\n\t\tr0 = rf(ctx, serializable)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}",
"func TestJsonEncode(t *testing.T) {\n\tt.Parallel()\n\n\t// Set up a mock struct for testing\n\ttype TestStruct struct {\n\t\tTestKey string `json:\"test_key\"`\n\t\tTestKeyTwo string `json:\"test_key_two\"`\n\t\tnotAllowed string\n\t}\n\n\t// Base model and test model\n\tvar model = new(TestStruct)\n\tvar modelTest = new(TestStruct)\n\tvar allowedFields = []string{\"test_key\", \"test_key_two\"} // notice omitted: notAllowed\n\n\t// Set the testing data\n\tmodel.TestKey = \"TestValue1\"\n\tmodel.TestKeyTwo = \"TestValue2\"\n\tmodel.notAllowed = \"PrivateValue\"\n\n\t// Set the buffer and encoder\n\tvar b bytes.Buffer\n\tenc := json.NewEncoder(&b)\n\n\t// Run the encoder\n\terr := JSONEncode(enc, model, allowedFields)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Now unmarshal and test\n\tif err = json.Unmarshal(b.Bytes(), &modelTest); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Test for our fields and values now\n\tif modelTest.TestKey != \"TestValue1\" {\n\t\tt.Fatal(\"TestKey does not have the right value! Encoding failed.\", modelTest.TestKey)\n\t} else if modelTest.TestKeyTwo != \"TestValue2\" {\n\t\tt.Fatal(\"TestKeyTwo does not have the right value! Encoding failed.\", modelTest.TestKeyTwo)\n\t} else if modelTest.notAllowed == \"PrivateValue\" {\n\t\tt.Fatal(\"Field not removed! notAllowed does not have the right value! Encoding failed.\", modelTest.notAllowed)\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Serialize indicates an expected call of Serialize
|
func (mr *MockClientMockRecorder) Serialize() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Serialize", reflect.TypeOf((*MockClient)(nil).Serialize))
}
|
[
"func (_e *MockSerializable_Expecter) Serialize() *MockSerializable_Serialize_Call {\n\treturn &MockSerializable_Serialize_Call{Call: _e.mock.On(\"Serialize\")}\n}",
"func (f *failingSerializer) Serialize(_ *rangedb.Record) ([]byte, error) {\n\treturn nil, fmt.Errorf(\"failingSerializer.Serialize\")\n}",
"func (mr *MocknetDataMockRecorder) SerializeRespond(respond interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SerializeRespond\", reflect.TypeOf((*MocknetData)(nil).SerializeRespond), respond)\n}",
"func (mr *MockManagerMockRecorder) SerializeNamespace(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SerializeNamespace\", reflect.TypeOf((*MockManager)(nil).SerializeNamespace), arg0)\n}",
"func (d *DummySignature) Serialize() []byte {\n\treturn []byte{}\n}",
"func (e *Event) IsSerialized() bool {\n\treturn int32(e.GetType())&int32(EVENT_TYPE_SERIALIZED) != 0\n}",
"func (mr *MockManagerMockRecorder) SerializeConfig(arg0, arg1, arg2 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SerializeConfig\", reflect.TypeOf((*MockManager)(nil).SerializeConfig), arg0, arg1, arg2)\n}",
"func (mr *MockManagerMockRecorder) SerializeUpstream(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SerializeUpstream\", reflect.TypeOf((*MockManager)(nil).SerializeUpstream), arg0)\n}",
"func (mr *MockManagerMockRecorder) SerializeAppMetadata(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SerializeAppMetadata\", reflect.TypeOf((*MockManager)(nil).SerializeAppMetadata), arg0)\n}",
"func (mr *MockManagerMockRecorder) SerializeShipMetadata(arg0, arg1 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SerializeShipMetadata\", reflect.TypeOf((*MockManager)(nil).SerializeShipMetadata), arg0, arg1)\n}",
"func (mr *MocknetDataMockRecorder) SerializeRequest(request interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SerializeRequest\", reflect.TypeOf((*MocknetData)(nil).SerializeRequest), request)\n}",
"func (_mr *MockEncoderMockRecorder) Encode(arg0, arg1, arg2 interface{}) *gomock.Call {\n\treturn _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, \"Encode\", reflect.TypeOf((*MockEncoder)(nil).Encode), arg0, arg1, arg2)\n}",
"func AssertSerialize(t *testing.T, dialect jet.Dialect, serializer jet.Serializer, query string, args ...interface{}) {\n\tout := jet.SQLBuilder{Dialect: dialect}\n\tjet.Serialize(serializer, jet.SelectStatementType, &out)\n\n\t//fmt.Println(out.Buff.String())\n\n\tAssertDeepEqual(t, out.Buff.String(), query)\n\n\tif len(args) > 0 {\n\t\tAssertDeepEqual(t, out.Args, args)\n\t}\n}",
"func (mr *MockEncoderMockRecorder) Encode(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Encode\", reflect.TypeOf((*MockEncoder)(nil).Encode), arg0)\n}",
"func (mr *MockManagerMockRecorder) SerializeReleaseName(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SerializeReleaseName\", reflect.TypeOf((*MockManager)(nil).SerializeReleaseName), arg0)\n}",
"func (instance *Shielded) Serialize() (_ []byte, ferr fail.Error) {\n\tdefer fail.OnPanic(&ferr)\n\n\tif instance == nil {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\n\tvar jsoned []byte\n\txerr := instance.Inspect(func(clonable data.Clonable) fail.Error {\n\t\tvar innerErr error\n\t\tjsoned, innerErr = json.Marshal(clonable)\n\t\tif innerErr != nil {\n\t\t\treturn fail.SyntaxError(\"failed to marshal: %s\", innerErr.Error())\n\t\t}\n\n\t\treturn nil\n\t})\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\treturn jsoned, nil\n}",
"func (mr *MockEncoderMockRecorder) Encode(value, writer interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Encode\", reflect.TypeOf((*MockEncoder)(nil).Encode), value, writer)\n}",
"func (_m *MockSerializable) Serialize() ([]byte, error) {\n\tret := _m.Called()\n\n\tvar r0 []byte\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func() ([]byte, error)); ok {\n\t\treturn rf()\n\t}\n\tif rf, ok := ret.Get(0).(func() []byte); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]byte)\n\t\t}\n\t}\n\n\tif rf, ok := ret.Get(1).(func() error); ok {\n\t\tr1 = rf()\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}",
"func (mr *MockSerialInterfaceMockRecorder) Marshal(v interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Marshal\", reflect.TypeOf((*MockSerialInterface)(nil).Marshal), v)\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Sign mocks base method
|
func (m *MockClient) Sign(arg0 []byte) ([]byte, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Sign", arg0)
ret0, _ := ret[0].([]byte)
ret1, _ := ret[1].(error)
return ret0, ret1
}
|
[
"func MockSign(tpl *txbuilder.Template, hsm *pseudohsm.HSM, password string) (bool, error) {\n\terr := txbuilder.Sign(nil, tpl, password, func(_ context.Context, xpub chainkd.XPub, path [][]byte, data [32]byte, password string) ([]byte, error) {\n\t\treturn hsm.XSign(xpub, path, data[:], password)\n\t})\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn txbuilder.SignProgress(tpl), nil\n}",
"func (ms *MockSigner) Sign(msg []byte) ([]byte, error) {\n\tif ms.Err != nil {\n\t\treturn nil, ms.Err\n\t}\n\n\treturn ms.MockSignature, nil\n}",
"func (m *MockSecurityProvider) SignBytes(arg0 []byte) ([]byte, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SignBytes\", arg0)\n\tret0, _ := ret[0].([]byte)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func TestSign(t *testing.T) {\n\tmsg := \"HelloWorld\"\n\ts, _ := sign(msg, privateKey)\n\n\tif len(s) == 0 {\n\t\tt.Error(\"RSA SHA1 signature failed\")\n\t}\n}",
"func TestSign(t *testing.T) {\n\tc, _ := initSign(t)\n\ttag := \"1\"\n\tdata := []byte(\"Good\")\n\n\texpectedSig, err := c.keyring.Sign(testPublicKeys[\"rsa\"], data)\n\tif err != nil {\n\t\tt.Error(\"Sign:\", err)\n\t}\n\n\tsig, err := c.Sign(tag, data)\n\tif err != nil {\n\t\tt.Error(\"sign failed:\", err)\n\t}\n\n\tif sig.Tag != tag {\n\t\tt.Error(\"expected tag %v instead of %v\", tag, sig.Tag)\n\t}\n\n\tif len(sig.Signs) == 0 {\n\t\tt.Error(\"expected signatures for data 'Good'\")\n\t}\n\n\tif bytes.Compare(sig.Signs[0].Blob, expectedSig.Blob) != 0 {\n\t\tt.Error(\"wrong signature for data 'Good'\")\n\t}\n}",
"func (pk MockPrivKeyLedgerEd25519) Sign(msg []byte) crypto.Signature {\n\tif !bytes.Equal(pk.Msg, msg) {\n\t\tpanic(\"Mock key is for different msg\")\n\t}\n\treturn crypto.SignatureEd25519(pk.Sig).Wrap()\n}",
"func (client *Client) AssertSignCall(expectedCalls int, arguments ...interface{}) *Client {\n\tif expectedCalls > 0 {\n\t\tclient.AssertCalled(client.t, SignMethod, arguments...)\n\t}\n\tclient.AssertNumberOfCalls(client.t, SignMethod, expectedCalls)\n\treturn client\n}",
"func TestSign(w http.ResponseWriter, r *http.Request) {\n\tconf := ConfLoad()\n\n\t// Returns a Public / Private Key Pair\n\t// Read JSON config from app.yaml\n\tif v := os.Getenv(\"PRIV_KEY\"); v != \"\" {\n\t\terr := json.Unmarshal([]byte(v), &conf)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"%#v\", conf)\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\t// Get the public key\n\tvar pubkey ecdsa.PublicKey\n\tpubkey = conf.PublicKey\n\n\t// Try signing a message\n\tmessage := []byte(\"99999999\")\n\tsig1, sig2, err := ecdsa.Sign(rand.Reader, &conf.PrivateKey, message)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Try verifying the signature\n\tresult := ecdsa.Verify(&pubkey, message, sig1, sig2)\n\tif result != true {\n\t\tpanic(\"Unable to verify signature\")\n\t}\n\n\tfmt.Fprintf(w, \"message: %#v\\n\\nsig1: %#v\\nsig2: %#v\", string(message[:]), sig1, sig2)\n\n}",
"func (_Ethdkg *EthdkgCaller) Sign(opts *bind.CallOpts, message []byte, privK *big.Int) ([2]*big.Int, error) {\n\tvar (\n\t\tret0 = new([2]*big.Int)\n\t)\n\tout := ret0\n\terr := _Ethdkg.contract.Call(opts, out, \"Sign\", message, privK)\n\treturn *ret0, err\n}",
"func (m *MockTransactionApi) SignWithPrivkey(tx *types.Transaction, outpoint *types.OutPoint, privkey *types.Privkey, sighashType types.SigHashType, utxoList *[]types.UtxoData) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SignWithPrivkey\", tx, outpoint, privkey, sighashType, utxoList)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"func (m *MockFullNode) WalletSign(arg0 context.Context, arg1 address.Address, arg2 []byte, arg3 types0.MsgMeta) (*crypto.Signature, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"WalletSign\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].(*crypto.Signature)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (_m *MockProvider) Sign(_a0 *x509.CertificateRequest) (string, error) {\n\tret := _m.Called(_a0)\n\n\tvar r0 string\n\tif rf, ok := ret.Get(0).(func(*x509.CertificateRequest) string); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tr0 = ret.Get(0).(string)\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*x509.CertificateRequest) error); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}",
"func (_BondedECDSAKeep *BondedECDSAKeepTransactor) Sign(opts *bind.TransactOpts, _digest [32]byte) (*types.Transaction, error) {\n\treturn _BondedECDSAKeep.contract.Transact(opts, \"sign\", _digest)\n}",
"func TestReSign(t *testing.T) {\n\ttestKey, _ := pem.Decode([]byte(testKeyPEM1))\n\tk := data.NewPublicKey(data.RSAKey, testKey.Bytes)\n\tmockCryptoService := &MockCryptoService{testKey: k}\n\ttestData := data.Signed{}\n\n\tSign(mockCryptoService, &testData, k)\n\tSign(mockCryptoService, &testData, k)\n\n\tif len(testData.Signatures) != 1 {\n\t\tt.Fatalf(\"Incorrect number of signatures: %d\", len(testData.Signatures))\n\t}\n\n\tif testData.Signatures[0].KeyID != testKeyID1 {\n\t\tt.Fatalf(\"Wrong signature ID returned: %s\", testData.Signatures[0].KeyID)\n\t}\n\n}",
"func (pv *ParamsVerification) Sign(p []byte) string {\n\t// Generate hash code\n\tmac := hmac.New(sha256.New, []byte(pv.ClientSecret))\n\t_, _ = mac.Write(p)\n\texpectedMAC := mac.Sum(nil)\n\n\t// Generate base64\n\tbase64Sign := base64.StdEncoding.EncodeToString(expectedMAC)\n\tbase64Sign = strings.ReplaceAll(base64Sign, \"+\", \"-\")\n\tbase64Sign = strings.ReplaceAll(base64Sign, \"/\", \"_\")\n\tbase64Sign = strings.TrimRight(base64Sign, \"=\")\n\n\treturn base64Sign\n}",
"func (validator *validatorImpl) Sign(msg []byte) ([]byte, error) {\n\treturn validator.signWithEnrollmentKey(msg)\n}",
"func TestBadSign(t *testing.T) {\n\tc, _ := initSign(t)\n\ttag := \"1\"\n\tdata := []byte(\"Good\")\n\n\tc.keyring.RemoveAll()\n\tsig, err := c.Sign(tag, data)\n\tif sig != nil || err == nil {\n\t\tt.Error(\"sign succeeded with empty keyring\")\n\t}\n\n\tc.keyring = newBadStubKeyring()\n\tsig, err = c.Sign(tag, nil)\n\tif sig != nil || err == nil {\n\t\tt.Error(\"sign succeeded with bad keyring\")\n\t}\n\n\tc.keyring = nil\n\tsig, err = c.Sign(tag, data)\n\tif sig != nil || err == nil {\n\t\tt.Error(\"sign succeeded with nil keyring\")\n\t}\n}",
"func TestSignContractSuccess(t *testing.T) {\n\tsignatureHelper(t, false)\n}",
"func (_m *Keychain) Sign(_a0 []byte) ([]byte, error) {\n\tret := _m.Called(_a0)\n\n\tvar r0 []byte\n\tif rf, ok := ret.Get(0).(func([]byte) []byte); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]byte)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func([]byte) error); ok {\n\t\tr1 = rf(_a0)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Sign indicates an expected call of Sign
|
func (mr *MockClientMockRecorder) Sign(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sign", reflect.TypeOf((*MockClient)(nil).Sign), arg0)
}
|
[
"func (mr *MockKMSAPIMockRecorder) Sign(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Sign\", reflect.TypeOf((*MockKMSAPI)(nil).Sign), arg0)\n}",
"func (m EncMessage) Sign(k []byte) error {\n\treturn errors.New(\"Sign method must be overridden\")\n}",
"func (client *Client) AssertSignCall(expectedCalls int, arguments ...interface{}) *Client {\n\tif expectedCalls > 0 {\n\t\tclient.AssertCalled(client.t, SignMethod, arguments...)\n\t}\n\tclient.AssertNumberOfCalls(client.t, SignMethod, expectedCalls)\n\treturn client\n}",
"func Sign(x int) int {\n\tif x < 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}",
"func (validator *validatorImpl) Sign(msg []byte) ([]byte, error) {\n\treturn validator.signWithEnrollmentKey(msg)\n}",
"func (_Ethdkg *EthdkgCaller) Sign(opts *bind.CallOpts, message []byte, privK *big.Int) ([2]*big.Int, error) {\n\tvar (\n\t\tret0 = new([2]*big.Int)\n\t)\n\tout := ret0\n\terr := _Ethdkg.contract.Call(opts, out, \"Sign\", message, privK)\n\treturn *ret0, err\n}",
"func (handler *ContractHandler) Sign(params UpdateContractParams, success *bool) error {\r\n\t*success = false\r\n\tcontract, err := handler.getContract(params.ContractID)\r\n\tif contract.Status > ContractStatusConfirmation {\r\n\t\treturn errors.New(\"contract already confirmed\")\r\n\t}\r\n\tbalanceR, err := handler.GetBalance(contract.Reporter, true)\r\n\tif balanceR < contract.Reward {\r\n\t\treturn errors.New(\"insufficient reporter funds\")\r\n\t}\r\n\tacc, err := handler.Accounts.getAccountByAddress(contract.Assignee)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\terr = checkUserSignature(acc, params.Signature, params.ContractID)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\terr = handler.updateStatus(params.ContractID, ContractStatusOpen)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\terr = handler.setBalance(contract.Reporter, balanceR-contract.Reward, true)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\t*success = true\r\n\treturn nil\r\n}",
"func (m *Money) Sign() int {\n\tif m.M < 0 {\n\t\treturn -1\n\t}\n\treturn 1\n}",
"func TestSign(t *testing.T) {\n\tc, _ := initSign(t)\n\ttag := \"1\"\n\tdata := []byte(\"Good\")\n\n\texpectedSig, err := c.keyring.Sign(testPublicKeys[\"rsa\"], data)\n\tif err != nil {\n\t\tt.Error(\"Sign:\", err)\n\t}\n\n\tsig, err := c.Sign(tag, data)\n\tif err != nil {\n\t\tt.Error(\"sign failed:\", err)\n\t}\n\n\tif sig.Tag != tag {\n\t\tt.Error(\"expected tag %v instead of %v\", tag, sig.Tag)\n\t}\n\n\tif len(sig.Signs) == 0 {\n\t\tt.Error(\"expected signatures for data 'Good'\")\n\t}\n\n\tif bytes.Compare(sig.Signs[0].Blob, expectedSig.Blob) != 0 {\n\t\tt.Error(\"wrong signature for data 'Good'\")\n\t}\n}",
"func (_BondedECDSAKeep *BondedECDSAKeepTransactor) Sign(opts *bind.TransactOpts, _digest [32]byte) (*types.Transaction, error) {\n\treturn _BondedECDSAKeep.contract.Transact(opts, \"sign\", _digest)\n}",
"func Sign(a int) int {\n\tswitch {\n\tcase a > 0:\n\t\treturn 1\n\tcase a < 0:\n\t\treturn -1\n\t}\n\treturn 0\n}",
"func Sign(x float64) float64 {\n\tif x < 0 {\n\t\treturn -1\n\t}\n\tif x > 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}",
"func (adr *Address) Sign(tr *tx.Transaction) error {\n\treturn tr.Sign(adr.Address)\n}",
"func (m *MetricsProvider) SignerSign(value time.Duration) {\n}",
"func (_Ethdkg *EthdkgCallerSession) Sign(message []byte, privK *big.Int) ([2]*big.Int, error) {\n\treturn _Ethdkg.Contract.Sign(&_Ethdkg.CallOpts, message, privK)\n}",
"func TestBadSign(t *testing.T) {\n\tc, _ := initSign(t)\n\ttag := \"1\"\n\tdata := []byte(\"Good\")\n\n\tc.keyring.RemoveAll()\n\tsig, err := c.Sign(tag, data)\n\tif sig != nil || err == nil {\n\t\tt.Error(\"sign succeeded with empty keyring\")\n\t}\n\n\tc.keyring = newBadStubKeyring()\n\tsig, err = c.Sign(tag, nil)\n\tif sig != nil || err == nil {\n\t\tt.Error(\"sign succeeded with bad keyring\")\n\t}\n\n\tc.keyring = nil\n\tsig, err = c.Sign(tag, data)\n\tif sig != nil || err == nil {\n\t\tt.Error(\"sign succeeded with nil keyring\")\n\t}\n}",
"func (q *Quantity) Sign() int {\n\tif q.d.Dec != nil {\n\t\treturn q.d.Dec.Sign()\n\t}\n\treturn q.i.Sign()\n}",
"func TestSign(t *testing.T) {\n\tmsg := \"HelloWorld\"\n\ts, _ := sign(msg, privateKey)\n\n\tif len(s) == 0 {\n\t\tt.Error(\"RSA SHA1 signature failed\")\n\t}\n}",
"func (i Int) Sign() int {\n\treturn i.i.Sign()\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
SigningManager mocks base method
|
func (m *MockClient) SigningManager() core.SigningManager {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SigningManager")
ret0, _ := ret[0].(core.SigningManager)
return ret0
}
|
[
"func (m *MockProviders) SigningManager() core.SigningManager {\r\n\tret := m.ctrl.Call(m, \"SigningManager\")\r\n\tret0, _ := ret[0].(core.SigningManager)\r\n\treturn ret0\r\n}",
"func (m *MockProviders) SigningManager() core.SigningManager {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SigningManager\")\n\tret0, _ := ret[0].(core.SigningManager)\n\treturn ret0\n}",
"func (pc *MockProviderContext) SigningManager() fab.SigningManager {\n\treturn pc.signingManager\n}",
"func NewMockSigner(kis []KeyInfo) MockSigner {\n\tvar ms MockSigner\n\tms.AddrKeyInfo = make(map[address.Address]KeyInfo)\n\tfor _, k := range kis {\n\t\t// extract public key\n\t\tpub := k.PublicKey()\n\t\tnewAddr, err := address.NewSecp256k1Address(pub)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tms.Addresses = append(ms.Addresses, newAddr)\n\t\tms.AddrKeyInfo[newAddr] = k\n\t\tms.PubKeys = append(ms.PubKeys, pub)\n\t}\n\treturn ms\n}",
"func (m *DeviceHealthAttestationState) SetTestSigning(value *string)() {\n err := m.GetBackingStore().Set(\"testSigning\", value)\n if err != nil {\n panic(err)\n }\n}",
"func TestVerifySignedMessage(t *testing.T) {\n\tfor _, tc := range []struct {\n\t\tdesc string\n\t\tsettings *crypt.PkiSettings\n\t\tsetup func(mdb *mocks.MockDepsBundle, setupDone *bool) error\n\t\tmessageToSign string\n\t\tbase64Signature string\n\t\tPEMPublicKey string\n\t\texpectedError *testtools.ErrorSpec\n\t\texpectedValidity bool\n\t}{\n\t\t{\n\t\t\tdesc: \"invalid base64 signature\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"@#$^&*()_\",\n\t\t\tPEMPublicKey: \"\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"base64.CorruptInputError\",\n\t\t\t\tMessage: \"illegal base64 data at input byte 0\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"empty PEM key\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"abcdefgh\",\n\t\t\tPEMPublicKey: \"\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"*errors.errorString\",\n\t\t\t\tMessage: \"No PEM data was found\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"bad key data\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"abcdefgh\",\n\t\t\tPEMPublicKey: \"-----BEGIN INVALID DATA-----\\n\" +\n\t\t\t\t\"MTIzNDU2Nzg5MGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6\\n\" +\n\t\t\t\t\"-----END INVALID DATA-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"asn1.StructuralError\",\n\t\t\t\tMessage: \"asn1: structure \" +\n\t\t\t\t\t\"error: tags don't match (16 vs {class:0 \" +\n\t\t\t\t\t\"tag:17 \" +\n\t\t\t\t\t\"length:50 \" +\n\t\t\t\t\t\"isCompound:true}) {optional:false \" +\n\t\t\t\t\t\"explicit:false \" +\n\t\t\t\t\t\"application:false \" +\n\t\t\t\t\t\"defaultValue:<nil> \" +\n\t\t\t\t\t\"tag:<nil> \" +\n\t\t\t\t\t\"stringType:0 \" +\n\t\t\t\t\t\"timeType:0 \" +\n\t\t\t\t\t\"set:false \" +\n\t\t\t\t\t\"omitEmpty:false} publicKeyInfo @2\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"invalid signature\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"abcdefgh\",\n\t\t\tPEMPublicKey: \"-----BEGIN ECDSA PUBLIC KEY-----\\n\" +\n\t\t\t\t\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7WzVjtn9Gk+WHr5xbv8XMvooqU25\\n\" +\n\t\t\t\t\"BhgNjZ/vHZLBdVtCOjk4KxjS1UBfQm0c3TRxWBl3hj2AmnJbCrnGofMHBQ==\\n\" +\n\t\t\t\t\"-----END ECDSA PUBLIC KEY-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"asn1.SyntaxError\",\n\t\t\t\tMessage: \"asn1: syntax error: truncated tag or length\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"ecdsa key for rsa mode\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.RSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"N3SuIdWI7XlXDteTmcOZUd2OBacyUWY+/+A8SC4QUBz9rXnldBqXha6YyGwnTuizxuy6quQ2QDFdtW16dj7EQk3lozfngskyhc2r86q3AUbdFDvrQVphMQhzsgBhHVoMjCL/YRfvtzCTWhBxegjVMLraLDCBb8IZTIqcMYafYyeJTvAnjBuntlZ+14TDuTt14Uqz85T04CXxBEqlIXMMKpTc01ST4Jsxz5HLO+At1htXp5eHOUFtQSilm3G7iO8ynhgPcXHDWfMAWu6VySUoHWCG70pJaCq6ehF7223t0UFOCqAyDyyQyP9yeUHj8F75SPSxfJm8iKXGx2LND/qLYw==\",\n\t\t\tPEMPublicKey: \"-----BEGIN RSA PUBLIC KEY-----\\n\" +\n\t\t\t\t\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7WzVjtn9Gk+WHr5xbv8XMvooqU25\\n\" +\n\t\t\t\t\"BhgNjZ/vHZLBdVtCOjk4KxjS1UBfQm0c3TRxWBl3hj2AmnJbCrnGofMHBQ==\\n\" +\n\t\t\t\t\"-----END RSA PUBLIC KEY-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"*errors.errorString\",\n\t\t\t\tMessage: \"Expecting a *rsa.PublicKey, but encountered a *ecdsa.PublicKey instead\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"rsa key for ecdsa mode\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"MEYCIQDPM0fc/PFauoZzpltH3RpWtlaqRnL0gFk5WFiLMrFqrwIhAIDvlBozU6Ky2UC9xOSq3YZ5iFuO356t9RnHOElaaXFJ\",\n\t\t\tPEMPublicKey: \"-----BEGIN RSA PUBLIC KEY-----\\n\" +\n\t\t\t\t\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzCTTFKQBHfTN8jW6q8PT\\n\" +\n\t\t\t\t\"HNZKWnRPxSt9kpgWmyqFaZnEUipgoKGAxSIsVrl2PJSm5OlgkVzx+MY+LWM64VKM\\n\" +\n\t\t\t\t\"bRpUUGJR3zdMNhwZQX0hjOpLpVJvUwD78utVs8vijrU7sH48usFiaZQYjy4m4hQh\\n\" +\n\t\t\t\t\"63/x4h3KVz7YqUnlRMzYJFT43+AwYzYuEpzWRxtW7IObJPtjtmYVoqva98fF6aj5\\n\" +\n\t\t\t\t\"uHAsvaAgZGBalHXmCiPzKiGU/halzXSPvyJ2Cqz2aUqMHgwi/2Ip4z/mrfX+mUTa\\n\" +\n\t\t\t\t\"S+LyBy7GgqJ5vbkGArMagJIc0eARF60r6Uf483xh17oniABdLJy4qlLf6PcEU+ut\\n\" +\n\t\t\t\t\"EwIDAQAB\\n\" +\n\t\t\t\t\"-----END RSA PUBLIC KEY-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"*errors.errorString\",\n\t\t\t\tMessage: \"Expecting a *ecdsa.PublicKey, but encountered a *rsa.PublicKey instead\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t} {\n\t\tt.Run(fmt.Sprintf(\"Subtest: %s\", tc.desc), func(tt *testing.T) {\n\t\t\tmockDepsBundle := mocks.NewDefaultMockDeps(\"\", []string{\"progname\"}, \"/home/user\", nil)\n\t\t\treturnedNormally := false\n\t\t\tvar tooling *crypt.CryptoTooling\n\t\t\tvar actualErr error\n\t\t\tvar actualValidity bool\n\t\t\terr := mockDepsBundle.InvokeCallInMockedEnv(func() error {\n\t\t\t\tsetupComplete := false\n\t\t\t\tinnerErr := tc.setup(mockDepsBundle, &setupComplete)\n\t\t\t\tif innerErr != nil {\n\t\t\t\t\treturn innerErr\n\t\t\t\t}\n\t\t\t\tvar toolingErr error\n\t\t\t\ttooling, toolingErr = crypt.GetCryptoTooling(mockDepsBundle.Deps, tc.settings)\n\t\t\t\tif toolingErr != nil {\n\t\t\t\t\treturn toolingErr\n\t\t\t\t}\n\t\t\t\tsetupComplete = true\n\t\t\t\tactualValidity, actualErr = tooling.VerifySignedMessage(tc.messageToSign, tc.base64Signature, tc.PEMPublicKey)\n\t\t\t\treturnedNormally = true\n\t\t\t\treturn nil\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\ttt.Errorf(\"Unexpected error calling mockDepsBundle.InvokeCallInMockedEnv(): %s\", err.Error())\n\t\t\t}\n\t\t\tif exitStatus := mockDepsBundle.GetExitStatus(); (exitStatus != 0) || !returnedNormally {\n\t\t\t\ttt.Error(\"EncodeAndSaveKey() should not have paniced or called os.Exit.\")\n\t\t\t}\n\t\t\tif (mockDepsBundle.OutBuf.String() != \"\") || (mockDepsBundle.ErrBuf.String() != \"\") {\n\t\t\t\ttt.Errorf(\"EncodeAndSaveKey() should not have output any data. Saw stdout:\\n%s\\nstderr:\\n%s\", mockDepsBundle.OutBuf.String(), mockDepsBundle.ErrBuf.String())\n\t\t\t}\n\t\t\tif err := tc.expectedError.EnsureMatches(actualErr); err != nil {\n\t\t\t\ttt.Error(err.Error())\n\t\t\t}\n\t\t\tif tc.expectedError == nil {\n\t\t\t\tif actualValidity != tc.expectedValidity {\n\t\t\t\t\ttt.Errorf(\"Signature is %#v when %#v expected\", actualValidity, tc.expectedValidity)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif tc.expectedValidity {\n\t\t\t\t\ttt.Error(\"TEST CASE INVALID. Should not expect \\\"valid\\\".\")\n\t\t\t\t}\n\t\t\t\tif actualValidity {\n\t\t\t\t\ttt.Error(\"Error was expected. Should not report \\\"valid\\\".\")\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}",
"func TestCryptoSignerInterfaceBehavior(t *testing.T) {\n\tcs := NewCryptoService(trustmanager.NewKeyMemoryStore(passphraseRetriever))\n\tinterfaces.EmptyCryptoServiceInterfaceBehaviorTests(t, cs)\n\tinterfaces.CreateGetKeyCryptoServiceInterfaceBehaviorTests(t, cs, data.ECDSAKey)\n\n\tcs = NewCryptoService(trustmanager.NewKeyMemoryStore(passphraseRetriever))\n\tinterfaces.CreateListKeyCryptoServiceInterfaceBehaviorTests(t, cs, data.ECDSAKey)\n\n\tcs = NewCryptoService(trustmanager.NewKeyMemoryStore(passphraseRetriever))\n\tinterfaces.AddGetKeyCryptoServiceInterfaceBehaviorTests(t, cs, data.ECDSAKey)\n\n\tcs = NewCryptoService(trustmanager.NewKeyMemoryStore(passphraseRetriever))\n\tinterfaces.AddListKeyCryptoServiceInterfaceBehaviorTests(t, cs, data.ECDSAKey)\n}",
"func MockSign(tpl *txbuilder.Template, hsm *pseudohsm.HSM, password string) (bool, error) {\n\terr := txbuilder.Sign(nil, tpl, password, func(_ context.Context, xpub chainkd.XPub, path [][]byte, data [32]byte, password string) ([]byte, error) {\n\t\treturn hsm.XSign(xpub, path, data[:], password)\n\t})\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn txbuilder.SignProgress(tpl), nil\n}",
"func (c *Provider) SigningManager() core.SigningManager {\n\treturn c.signingManager\n}",
"func (mmSignWith *mDigestHolderMockSignWith) Set(f func(signer DigestSigner) (s1 SignedDigestHolder)) *DigestHolderMock {\n\tif mmSignWith.defaultExpectation != nil {\n\t\tmmSignWith.mock.t.Fatalf(\"Default expectation is already set for the DigestHolder.SignWith method\")\n\t}\n\n\tif len(mmSignWith.expectations) > 0 {\n\t\tmmSignWith.mock.t.Fatalf(\"Some expectations are already set for the DigestHolder.SignWith method\")\n\t}\n\n\tmmSignWith.mock.funcSignWith = f\n\treturn mmSignWith.mock\n}",
"func TestNewSignatureVerifierFromKeyring(t *testing.T) {\n\tc, _ := initSign(t)\n\tv, err := NewSignatureVerifierFromKeyring(c.keyring)\n\tif err != nil {\n\t\tt.Error(\"fail to new signature verifier\")\n\t}\n\tkeys := len(v.pubkeys)\n\t// there should be at least one added in the tests.\n\tif keys == 0 {\n\t\tt.Error(\"expected pubkeys but found none\")\n\t}\n}",
"func (m *MockMachine) SignerKey() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SignerKey\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}",
"func (m *MockSecurityKey) SigningKeys() []securitykey.SigningKey {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SigningKeys\")\n\tret0, _ := ret[0].([]securitykey.SigningKey)\n\treturn ret0\n}",
"func (mmSignWith *mDigestHolderMockSignWith) When(signer DigestSigner) *DigestHolderMockSignWithExpectation {\n\tif mmSignWith.mock.funcSignWith != nil {\n\t\tmmSignWith.mock.t.Fatalf(\"DigestHolderMock.SignWith mock is already set by Set\")\n\t}\n\n\texpectation := &DigestHolderMockSignWithExpectation{\n\t\tmock: mmSignWith.mock,\n\t\tparams: &DigestHolderMockSignWithParams{signer},\n\t}\n\tmmSignWith.expectations = append(mmSignWith.expectations, expectation)\n\treturn expectation\n}",
"func (ms *MockSigner) Sign(msg []byte) ([]byte, error) {\n\tif ms.Err != nil {\n\t\treturn nil, ms.Err\n\t}\n\n\treturn ms.MockSignature, nil\n}",
"func (m *MockClient) Sign(arg0 []byte) ([]byte, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Sign\", arg0)\n\tret0, _ := ret[0].([]byte)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (m *mCryptographyServiceMockSign) Set(f func(p []byte) (r *insolar.Signature, r1 error)) *CryptographyServiceMock {\n\tm.mainExpectation = nil\n\tm.expectationSeries = nil\n\n\tm.mock.SignFunc = f\n\treturn m.mock\n}",
"func (m *MockCrypto) SignForKBFS(arg0 context.Context, arg1 []byte) (kbfscrypto.SignatureInfo, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SignForKBFS\", arg0, arg1)\n\tret0, _ := ret[0].(kbfscrypto.SignatureInfo)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func TestReSign(t *testing.T) {\n\ttestKey, _ := pem.Decode([]byte(testKeyPEM1))\n\tk := data.NewPublicKey(data.RSAKey, testKey.Bytes)\n\tmockCryptoService := &MockCryptoService{testKey: k}\n\ttestData := data.Signed{}\n\n\tSign(mockCryptoService, &testData, k)\n\tSign(mockCryptoService, &testData, k)\n\n\tif len(testData.Signatures) != 1 {\n\t\tt.Fatalf(\"Incorrect number of signatures: %d\", len(testData.Signatures))\n\t}\n\n\tif testData.Signatures[0].KeyID != testKeyID1 {\n\t\tt.Fatalf(\"Wrong signature ID returned: %s\", testData.Signatures[0].KeyID)\n\t}\n\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
SigningManager indicates an expected call of SigningManager
|
func (mr *MockClientMockRecorder) SigningManager() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SigningManager", reflect.TypeOf((*MockClient)(nil).SigningManager))
}
|
[
"func (mr *MockProvidersMockRecorder) SigningManager() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SigningManager\", reflect.TypeOf((*MockProviders)(nil).SigningManager))\n}",
"func (mr *MockProvidersMockRecorder) SigningManager() *gomock.Call {\r\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SigningManager\", reflect.TypeOf((*MockProviders)(nil).SigningManager))\r\n}",
"func (pc *MockProviderContext) SigningManager() fab.SigningManager {\n\treturn pc.signingManager\n}",
"func (m *MetricsProvider) SignerSign(value time.Duration) {\n}",
"func (c *Provider) SigningManager() core.SigningManager {\n\treturn c.signingManager\n}",
"func TestSignContractFailure(t *testing.T) {\n\tsignatureHelper(t, true)\n}",
"func setDefaultSignerVerifier(c *conf.Conf) error {\n\tsign, err := CreateSign(c.PublicAddr.IA, c.Store)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.SetSigner(ctrl.NewBasicSigner(sign, c.GetSigningKey()))\n\tc.SetVerifier(&SigVerifier{&ctrl.BasicSigVerifier{}})\n\treturn nil\n}",
"func TestAnteHandlerSigErrors(t *testing.T) {\n\t// setup\n\tinput := setupTestInput()\n\tctx := input.ctx\n\tanteHandler := NewAnteHandler(input.ak, input.sk, DefaultSigVerificationGasConsumer)\n\n\t// keys and addresses\n\tpriv1, _, addr1 := types.KeyTestPubAddr()\n\tpriv2, _, addr2 := types.KeyTestPubAddr()\n\tpriv3, _, addr3 := types.KeyTestPubAddr()\n\n\t// msg and signatures\n\tvar tx sdk.Tx\n\tmsg1 := types.NewTestMsg(addr1, addr2)\n\tmsg2 := types.NewTestMsg(addr1, addr3)\n\tfee := types.NewTestStdFee()\n\n\tmsgs := []sdk.Msg{msg1, msg2}\n\n\t// test no signatures\n\tprivs, accNums, seqs := []crypto.PrivKey{}, []uint64{}, []uint64{}\n\ttx = types.NewTestTx(ctx, msgs, privs, accNums, seqs, fee)\n\n\t// tx.GetSigners returns addresses in correct order: addr1, addr2, addr3\n\texpectedSigners := []sdk.AccAddress{addr1, addr2, addr3}\n\tstdTx := tx.(types.StdTx)\n\trequire.Equal(t, expectedSigners, stdTx.GetSigners())\n\n\t// Check no signatures fails\n\tcheckInvalidTx(t, anteHandler, ctx, tx, false, sdk.CodeNoSignatures)\n\n\t// test num sigs dont match GetSigners\n\tprivs, accNums, seqs = []crypto.PrivKey{priv1}, []uint64{0}, []uint64{0}\n\ttx = types.NewTestTx(ctx, msgs, privs, accNums, seqs, fee)\n\tcheckInvalidTx(t, anteHandler, ctx, tx, false, sdk.CodeUnauthorized)\n\n\t// test an unrecognized account\n\tprivs, accNums, seqs = []crypto.PrivKey{priv1, priv2, priv3}, []uint64{0, 1, 2}, []uint64{0, 0, 0}\n\ttx = types.NewTestTx(ctx, msgs, privs, accNums, seqs, fee)\n\tcheckInvalidTx(t, anteHandler, ctx, tx, false, sdk.CodeUnknownAddress)\n\n\t// save the first account, but second is still unrecognized\n\tacc1 := input.ak.NewAccountWithAddress(ctx, addr1)\n\tacc1.SetCoins(fee.Amount)\n\tinput.ak.SetAccount(ctx, acc1)\n\tcheckInvalidTx(t, anteHandler, ctx, tx, false, sdk.CodeUnknownAddress)\n}",
"func (client ManagementClient) SignSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client,\n\t\treq,\n\t\tautorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}",
"func (m *MockProviders) SigningManager() core.SigningManager {\r\n\tret := m.ctrl.Call(m, \"SigningManager\")\r\n\tret0, _ := ret[0].(core.SigningManager)\r\n\treturn ret0\r\n}",
"func (mr *MockKMSAPIMockRecorder) Sign(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Sign\", reflect.TypeOf((*MockKMSAPI)(nil).Sign), arg0)\n}",
"func TestBadSign(t *testing.T) {\n\tc, _ := initSign(t)\n\ttag := \"1\"\n\tdata := []byte(\"Good\")\n\n\tc.keyring.RemoveAll()\n\tsig, err := c.Sign(tag, data)\n\tif sig != nil || err == nil {\n\t\tt.Error(\"sign succeeded with empty keyring\")\n\t}\n\n\tc.keyring = newBadStubKeyring()\n\tsig, err = c.Sign(tag, nil)\n\tif sig != nil || err == nil {\n\t\tt.Error(\"sign succeeded with bad keyring\")\n\t}\n\n\tc.keyring = nil\n\tsig, err = c.Sign(tag, data)\n\tif sig != nil || err == nil {\n\t\tt.Error(\"sign succeeded with nil keyring\")\n\t}\n}",
"func TestSignatureWrongSignature(t *testing.T) {\n\t// disable some sigs in macOS/OSX\n\tif runtime.GOOS == \"darwin\" {\n\t\tdisabledSigPatterns = []string{\"Rainbow-III\", \"Rainbow-V\"}\n\t}\n\t// disable some sigs in Windows\n\tif runtime.GOOS == \"windows\" {\n\t\tdisabledSigPatterns = []string{\"Rainbow-V\"}\n\t}\n\tmsg := []byte(\"This is our favourite message to sign\")\n\t// first test sigs that belong to noThreadSigPatterns[] in the main\n\t// goroutine, due to issues with stack size being too small in macOS or\n\t// Windows\n\tcnt := 0\n\tfor _, sigName := range oqs.EnabledSigs() {\n\t\tif stringMatchSlice(sigName, disabledSigPatterns) {\n\t\t\tcnt++\n\t\t\tcontinue\n\t\t}\n\t\t// issues with stack size being too small\n\t\tif stringMatchSlice(sigName, noThreadSigPatterns) {\n\t\t\tcnt++\n\t\t\ttestSigWrongSignature(sigName, msg, false, t)\n\t\t}\n\t}\n\t// test the remaining sigs in separate goroutines\n\twgSigWrongSignature.Add(len(oqs.EnabledSigs()) - cnt)\n\tfor _, sigName := range oqs.EnabledSigs() {\n\t\tif stringMatchSlice(sigName, disabledSigPatterns) {\n\t\t\twgSigWrongSignature.Done()\n\t\t\tcontinue\n\t\t}\n\t\tif !stringMatchSlice(sigName, noThreadSigPatterns) {\n\t\t\tgo testSigWrongSignature(sigName, msg, true, t)\n\t\t}\n\t}\n\twgSigWrongSignature.Wait()\n}",
"func (m *DigestHolderMock) MinimockSignWithDone() bool {\n\tfor _, e := range m.SignWithMock.expectations {\n\t\tif mm_atomic.LoadUint64(&e.Counter) < 1 {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// if default expectation was set then invocations count should be greater than zero\n\tif m.SignWithMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterSignWithCounter) < 1 {\n\t\treturn false\n\t}\n\t// if func was set then invocations count should be greater than zero\n\tif m.funcSignWith != nil && mm_atomic.LoadUint64(&m.afterSignWithCounter) < 1 {\n\t\treturn false\n\t}\n\treturn true\n}",
"func setDefaultSignerVerifier(c *conf.Conf) error {\n\tsign, err := trust.CreateSign(c.PublicAddr.IA, c.Store)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.SetSigner(ctrl.NewBasicSigner(sign, c.GetSigningKey()))\n\tc.SetVerifier(ctrl.NewBasicSigVerifier(c.Store))\n\treturn nil\n}",
"func TestNewSignatureVerifierFromKeyring(t *testing.T) {\n\tc, _ := initSign(t)\n\tv, err := NewSignatureVerifierFromKeyring(c.keyring)\n\tif err != nil {\n\t\tt.Error(\"fail to new signature verifier\")\n\t}\n\tkeys := len(v.pubkeys)\n\t// there should be at least one added in the tests.\n\tif keys == 0 {\n\t\tt.Error(\"expected pubkeys but found none\")\n\t}\n}",
"func TestSignContractSuccess(t *testing.T) {\n\tsignatureHelper(t, false)\n}",
"func TestVerifySignedMessage(t *testing.T) {\n\tfor _, tc := range []struct {\n\t\tdesc string\n\t\tsettings *crypt.PkiSettings\n\t\tsetup func(mdb *mocks.MockDepsBundle, setupDone *bool) error\n\t\tmessageToSign string\n\t\tbase64Signature string\n\t\tPEMPublicKey string\n\t\texpectedError *testtools.ErrorSpec\n\t\texpectedValidity bool\n\t}{\n\t\t{\n\t\t\tdesc: \"invalid base64 signature\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"@#$^&*()_\",\n\t\t\tPEMPublicKey: \"\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"base64.CorruptInputError\",\n\t\t\t\tMessage: \"illegal base64 data at input byte 0\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"empty PEM key\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"abcdefgh\",\n\t\t\tPEMPublicKey: \"\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"*errors.errorString\",\n\t\t\t\tMessage: \"No PEM data was found\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"bad key data\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"abcdefgh\",\n\t\t\tPEMPublicKey: \"-----BEGIN INVALID DATA-----\\n\" +\n\t\t\t\t\"MTIzNDU2Nzg5MGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6\\n\" +\n\t\t\t\t\"-----END INVALID DATA-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"asn1.StructuralError\",\n\t\t\t\tMessage: \"asn1: structure \" +\n\t\t\t\t\t\"error: tags don't match (16 vs {class:0 \" +\n\t\t\t\t\t\"tag:17 \" +\n\t\t\t\t\t\"length:50 \" +\n\t\t\t\t\t\"isCompound:true}) {optional:false \" +\n\t\t\t\t\t\"explicit:false \" +\n\t\t\t\t\t\"application:false \" +\n\t\t\t\t\t\"defaultValue:<nil> \" +\n\t\t\t\t\t\"tag:<nil> \" +\n\t\t\t\t\t\"stringType:0 \" +\n\t\t\t\t\t\"timeType:0 \" +\n\t\t\t\t\t\"set:false \" +\n\t\t\t\t\t\"omitEmpty:false} publicKeyInfo @2\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"invalid signature\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"abcdefgh\",\n\t\t\tPEMPublicKey: \"-----BEGIN ECDSA PUBLIC KEY-----\\n\" +\n\t\t\t\t\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7WzVjtn9Gk+WHr5xbv8XMvooqU25\\n\" +\n\t\t\t\t\"BhgNjZ/vHZLBdVtCOjk4KxjS1UBfQm0c3TRxWBl3hj2AmnJbCrnGofMHBQ==\\n\" +\n\t\t\t\t\"-----END ECDSA PUBLIC KEY-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"asn1.SyntaxError\",\n\t\t\t\tMessage: \"asn1: syntax error: truncated tag or length\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"ecdsa key for rsa mode\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.RSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"N3SuIdWI7XlXDteTmcOZUd2OBacyUWY+/+A8SC4QUBz9rXnldBqXha6YyGwnTuizxuy6quQ2QDFdtW16dj7EQk3lozfngskyhc2r86q3AUbdFDvrQVphMQhzsgBhHVoMjCL/YRfvtzCTWhBxegjVMLraLDCBb8IZTIqcMYafYyeJTvAnjBuntlZ+14TDuTt14Uqz85T04CXxBEqlIXMMKpTc01ST4Jsxz5HLO+At1htXp5eHOUFtQSilm3G7iO8ynhgPcXHDWfMAWu6VySUoHWCG70pJaCq6ehF7223t0UFOCqAyDyyQyP9yeUHj8F75SPSxfJm8iKXGx2LND/qLYw==\",\n\t\t\tPEMPublicKey: \"-----BEGIN RSA PUBLIC KEY-----\\n\" +\n\t\t\t\t\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7WzVjtn9Gk+WHr5xbv8XMvooqU25\\n\" +\n\t\t\t\t\"BhgNjZ/vHZLBdVtCOjk4KxjS1UBfQm0c3TRxWBl3hj2AmnJbCrnGofMHBQ==\\n\" +\n\t\t\t\t\"-----END RSA PUBLIC KEY-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"*errors.errorString\",\n\t\t\t\tMessage: \"Expecting a *rsa.PublicKey, but encountered a *ecdsa.PublicKey instead\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"rsa key for ecdsa mode\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"MEYCIQDPM0fc/PFauoZzpltH3RpWtlaqRnL0gFk5WFiLMrFqrwIhAIDvlBozU6Ky2UC9xOSq3YZ5iFuO356t9RnHOElaaXFJ\",\n\t\t\tPEMPublicKey: \"-----BEGIN RSA PUBLIC KEY-----\\n\" +\n\t\t\t\t\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzCTTFKQBHfTN8jW6q8PT\\n\" +\n\t\t\t\t\"HNZKWnRPxSt9kpgWmyqFaZnEUipgoKGAxSIsVrl2PJSm5OlgkVzx+MY+LWM64VKM\\n\" +\n\t\t\t\t\"bRpUUGJR3zdMNhwZQX0hjOpLpVJvUwD78utVs8vijrU7sH48usFiaZQYjy4m4hQh\\n\" +\n\t\t\t\t\"63/x4h3KVz7YqUnlRMzYJFT43+AwYzYuEpzWRxtW7IObJPtjtmYVoqva98fF6aj5\\n\" +\n\t\t\t\t\"uHAsvaAgZGBalHXmCiPzKiGU/halzXSPvyJ2Cqz2aUqMHgwi/2Ip4z/mrfX+mUTa\\n\" +\n\t\t\t\t\"S+LyBy7GgqJ5vbkGArMagJIc0eARF60r6Uf483xh17oniABdLJy4qlLf6PcEU+ut\\n\" +\n\t\t\t\t\"EwIDAQAB\\n\" +\n\t\t\t\t\"-----END RSA PUBLIC KEY-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"*errors.errorString\",\n\t\t\t\tMessage: \"Expecting a *ecdsa.PublicKey, but encountered a *rsa.PublicKey instead\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t} {\n\t\tt.Run(fmt.Sprintf(\"Subtest: %s\", tc.desc), func(tt *testing.T) {\n\t\t\tmockDepsBundle := mocks.NewDefaultMockDeps(\"\", []string{\"progname\"}, \"/home/user\", nil)\n\t\t\treturnedNormally := false\n\t\t\tvar tooling *crypt.CryptoTooling\n\t\t\tvar actualErr error\n\t\t\tvar actualValidity bool\n\t\t\terr := mockDepsBundle.InvokeCallInMockedEnv(func() error {\n\t\t\t\tsetupComplete := false\n\t\t\t\tinnerErr := tc.setup(mockDepsBundle, &setupComplete)\n\t\t\t\tif innerErr != nil {\n\t\t\t\t\treturn innerErr\n\t\t\t\t}\n\t\t\t\tvar toolingErr error\n\t\t\t\ttooling, toolingErr = crypt.GetCryptoTooling(mockDepsBundle.Deps, tc.settings)\n\t\t\t\tif toolingErr != nil {\n\t\t\t\t\treturn toolingErr\n\t\t\t\t}\n\t\t\t\tsetupComplete = true\n\t\t\t\tactualValidity, actualErr = tooling.VerifySignedMessage(tc.messageToSign, tc.base64Signature, tc.PEMPublicKey)\n\t\t\t\treturnedNormally = true\n\t\t\t\treturn nil\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\ttt.Errorf(\"Unexpected error calling mockDepsBundle.InvokeCallInMockedEnv(): %s\", err.Error())\n\t\t\t}\n\t\t\tif exitStatus := mockDepsBundle.GetExitStatus(); (exitStatus != 0) || !returnedNormally {\n\t\t\t\ttt.Error(\"EncodeAndSaveKey() should not have paniced or called os.Exit.\")\n\t\t\t}\n\t\t\tif (mockDepsBundle.OutBuf.String() != \"\") || (mockDepsBundle.ErrBuf.String() != \"\") {\n\t\t\t\ttt.Errorf(\"EncodeAndSaveKey() should not have output any data. Saw stdout:\\n%s\\nstderr:\\n%s\", mockDepsBundle.OutBuf.String(), mockDepsBundle.ErrBuf.String())\n\t\t\t}\n\t\t\tif err := tc.expectedError.EnsureMatches(actualErr); err != nil {\n\t\t\t\ttt.Error(err.Error())\n\t\t\t}\n\t\t\tif tc.expectedError == nil {\n\t\t\t\tif actualValidity != tc.expectedValidity {\n\t\t\t\t\ttt.Errorf(\"Signature is %#v when %#v expected\", actualValidity, tc.expectedValidity)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif tc.expectedValidity {\n\t\t\t\t\ttt.Error(\"TEST CASE INVALID. Should not expect \\\"valid\\\".\")\n\t\t\t\t}\n\t\t\t\tif actualValidity {\n\t\t\t\t\ttt.Error(\"Error was expected. Should not report \\\"valid\\\".\")\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}",
"func (validator *validatorImpl) Sign(msg []byte) ([]byte, error) {\n\treturn validator.signWithEnrollmentKey(msg)\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
UserStore indicates an expected call of UserStore
|
func (mr *MockClientMockRecorder) UserStore() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UserStore", reflect.TypeOf((*MockClient)(nil).UserStore))
}
|
[
"func (mr *MockProvidersMockRecorder) UserStore() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UserStore\", reflect.TypeOf((*MockProviders)(nil).UserStore))\n}",
"func TestStore_CreateUser(t *testing.T) {\n\tt.Parallel()\n\ts := MustOpenStore()\n\tdefer s.Close()\n\n\t// Create user.\n\tif ui, err := s.CreateUser(\"susy\", \"pass\", true); err != nil {\n\t\tt.Fatal(err)\n\t} else if ui.Name != \"susy\" || ui.Hash == \"\" || ui.Admin != true {\n\t\tt.Fatalf(\"unexpected user: %#v\", ui)\n\t}\n}",
"func TestStore_UserCount(t *testing.T) {\n\tt.Parallel()\n\ts := MustOpenStore()\n\tdefer s.Close()\n\n\tif count, err := s.UserCount(); count != 0 && err != nil {\n\t\tt.Fatalf(\"expected user count to be 0 but was %d\", count)\n\t}\n\n\t// Create users.\n\tif _, err := s.CreateUser(\"susy\", \"pass\", true); err != nil {\n\t\tt.Fatal(err)\n\t} else if _, err := s.CreateUser(\"bob\", \"pass\", true); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif count, err := s.UserCount(); count != 2 && err != nil {\n\t\tt.Fatalf(\"expected user count to be 2 but was %d\", count)\n\t}\n}",
"func TestIncorrectUsers(t *testing.T) {\n\tprov := getFakeProvider(\"user1\")\n\tusr, err := prov.GetUser(nil)\n\trequire.NoError(t, err)\n\tassert.Equal(t, 0, len(usr.(*AuthenticatedUser).Rules))\n}",
"func (_e *Repository_Expecter) StoreUser(ctx interface{}, user interface{}) *Repository_StoreUser_Call {\n\treturn &Repository_StoreUser_Call{Call: _e.mock.On(\"StoreUser\", ctx, user)}\n}",
"func (suite *StoreTestSuite) Test001_User() {\n\tusername := \"foo\"\n\temail := \"bar\"\n\tpw := \"baz\"\n\trole := 1337\n\n\t// Test CreateUser\n\tnewUser := &schema.User{\n\t\tUsername: &username,\n\t\tEmail: &email,\n\t\tPassword: &pw,\n\t\tRole: &role,\n\t}\n\terr := suite.store.CreateUser(newUser)\n\tsuite.Nil(err)\n\n\t// Test GetUserByUsername\n\tuser, err := suite.store.GetUserByUsername(username)\n\tsuite.Nil(err)\n\tsuite.NotNil(user)\n\tsuite.Equal(username, user.Username)\n\tsuite.Equal(email, user.Email)\n\n\tid := user.ID.Hex()\n\n\t// Test GetUserByEmail\n\tuser, err = suite.store.GetUserByEmail(email)\n\tsuite.Nil(err)\n\tsuite.NotNil(user)\n\tsuite.Equal(username, user.Username)\n\tsuite.Equal(email, user.Email)\n\n\t// Test GetUserByPassword\n\tuser, err = suite.store.GetUserByCreds(username, pw)\n\tsuite.Nil(err)\n\tsuite.NotNil(user)\n\tsuite.Equal(username, user.Username)\n\tsuite.Equal(email, user.Email)\n\n\t// Test CreateUser with conflict\n\terr = suite.store.CreateUser(newUser)\n\tsuite.NotNil(err)\n\tsuite.Equal(\"user with username as foo already exists\", err.Error())\n\n\t// Test UpdateUser\n\tnewUsername := \"foobar\"\n\tuserPatch := &schema.User{Username: &newUsername}\n\tuser, err = suite.store.UpdateUser(id, userPatch)\n\tsuite.Nil(err)\n\tsuite.Equal(newUsername, user.Username)\n\tsuite.Equal(email, user.Email)\n\tsuite.Equal(role, user.Role)\n\n\t// Add second user\n\terr = suite.store.CreateUser(newUser)\n\tsuite.Nil(err)\n\n\t// Try to update second user\n\tu, err := suite.store.GetUserByUsername(*newUser.Username)\n\tsuite.Nil(err)\n\n\tuser, err = suite.store.UpdateUser(u.ID.Hex(), userPatch)\n\tsuite.Nil(user)\n\tsuite.True(mgo.IsDup(err))\n\n\t// Test GetAllUsers\n\tusers, err := suite.store.GetAllUsers()\n\tsuite.Nil(err)\n\tsuite.Equal(len(users), 2)\n\n\t// Test DeleteUser\n\tuser, err = suite.store.DeleteUser(id)\n\tsuite.Nil(err)\n\tsuite.NotNil(user)\n\tsuite.Equal(newUsername, user.Username)\n\tsuite.Equal(email, user.Email)\n}",
"func TestStore_DropUser(t *testing.T) {\n\tt.Parallel()\n\ts := MustOpenStore()\n\tdefer s.Close()\n\n\t// Create users.\n\tif _, err := s.CreateUser(\"susy\", \"pass\", true); err != nil {\n\t\tt.Fatal(err)\n\t} else if _, err := s.CreateUser(\"bob\", \"pass\", true); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Remove user.\n\tif err := s.DropUser(\"bob\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Verify user was removed.\n\tif a, err := s.Users(); err != nil {\n\t\tt.Fatal(err)\n\t} else if len(a) != 1 {\n\t\tt.Fatalf(\"unexpected user count: %d\", len(a))\n\t} else if a[0].Name != \"susy\" {\n\t\tt.Fatalf(\"unexpected user: %s\", a[0].Name)\n\t}\n}",
"func (m *MockProviders) UserStore() msp.UserStore {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UserStore\")\n\tret0, _ := ret[0].(msp.UserStore)\n\treturn ret0\n}",
"func (uc *userUsecase) Store(c context.Context, m *models.User) error {\n\tctx, cancel := context.WithTimeout(c, uc.contextTimeout)\n\tdefer cancel()\n\n\terr := uc.userRepo.Store(ctx, m)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}",
"func (mr *MockUserStoreMockRecorder) AddUser(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddUser\", reflect.TypeOf((*MockUserStore)(nil).AddUser), arg0)\n}",
"func (c *Provider) UserStore() msp.UserStore {\n\treturn c.userStore\n}",
"func TestCorrectUsers(t *testing.T) {\n\tprov := getFakeProvider(\"usr1\")\n\tusr, err := prov.GetUser(nil)\n\trequire.NoError(t, err)\n\tassert.Equal(t, 1, len(usr.(*AuthenticatedUser).Rules))\n}",
"func TestSync_StoreError(t *testing.T) {\n\tcontroller := gomock.NewController(t)\n\tdefer controller.Finish()\n\n\tuser := &core.User{ID: 1}\n\tuserStore := mock.NewMockUserStore(controller)\n\tuserStore.EXPECT().Update(gomock.Any(), user).Return(nil)\n\tuserStore.EXPECT().Update(gomock.Any(), user).Return(nil)\n\n\trepoService := mock.NewMockRepositoryService(controller)\n\trepoService.EXPECT().List(gomock.Any(), user).Return([]*core.Repository{}, nil)\n\n\trepoStore := mock.NewMockRepositoryStore(controller)\n\trepoStore.EXPECT().List(gomock.Any(), gomock.Any()).Return(nil, sql.ErrNoRows)\n\n\ts := Synchronizer{\n\t\trepoz: repoService,\n\t\tusers: userStore,\n\t\trepos: repoStore,\n\t}\n\t_, err := s.Sync(context.Background(), user)\n\tif got, want := err, sql.ErrNoRows; got != want {\n\t\tt.Errorf(\"Want error %s, got %s\", want, got)\n\t}\n}",
"func UserOwnsStore(userID, storeID int) (bool, error) {\n\tkey := stringutil.Build(\"userid:\", strconv.Itoa(userID), \":storeids\")\n\treturn IsSetMember(key, storeID)\n}",
"func (s *UserSuite) TestUserAttachedToRequestAuthenticatedNoUseridentifierHasBeenRegistered(c *C) {\n\thandler := u.Handler()\n\n\treq, _ := http.NewRequest(\"GET\", \"http://127.0.0.1:8000/auth-status\", nil)\n\tresp := httptest.NewRecorder()\n\thandler(resp, req)\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tc.Assert(err, IsNil)\n\tc.Assert(string(body), Equals, \"false\")\n}",
"func TestUserNotFound(t *testing.T) {\n\tprov := getFakeProvider(\"\")\n\t_, err := prov.GetUser(nil)\n\tassert.Error(t, err)\n}",
"func (mr *MockStoreMockRecorder) GetUserByUserName(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetUserByUserName\", reflect.TypeOf((*MockStore)(nil).GetUserByUserName), arg0, arg1)\n}",
"func (s *StorageTest) TestUser() error {\n\tif err := s.runPreTest(); err != nil {\n\t\treturn err\n\t}\n\tdefer s.runPostTest()\n\n\t// Should be a not-found error at first\n\t_, err := s.LoadUser(\"[email protected]\")\n\tif _, ok := err.(caddytls.ErrNotExist); !ok {\n\t\treturn fmt.Errorf(\"Expected caddytls.ErrNotExist from load, got %T: %v\", err, err)\n\t}\n\n\t// Should store successfully and then load just fine\n\tif err := s.StoreUser(\"[email protected]\", simpleUserData); err != nil {\n\t\treturn err\n\t}\n\tif userData, err := s.LoadUser(\"[email protected]\"); err != nil {\n\t\treturn err\n\t} else if !bytes.Equal(userData.Reg, simpleUserData.Reg) {\n\t\treturn errors.New(\"Unexpected reg returned after store\")\n\t} else if !bytes.Equal(userData.Key, simpleUserData.Key) {\n\t\treturn errors.New(\"Unexpected key returned after store\")\n\t}\n\n\t// Overwrite should work just fine\n\tif err := s.StoreUser(\"[email protected]\", simpleUserDataAlt); err != nil {\n\t\treturn err\n\t}\n\tif userData, err := s.LoadUser(\"[email protected]\"); err != nil {\n\t\treturn err\n\t} else if !bytes.Equal(userData.Reg, simpleUserDataAlt.Reg) {\n\t\treturn errors.New(\"Unexpected reg returned after overwrite\")\n\t}\n\n\treturn nil\n}",
"func (e *Entity) AssertUser() {\n\tif e.data.Kind != member.User {\n\t\tpanic(\"AssertUser\")\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
/ polymorph Destiny.Definitions.Items.DestinyItemTierTypeInfusionBlock baseQualityTransferRatio false / polymorph Destiny.Definitions.Items.DestinyItemTierTypeInfusionBlock minimumQualityIncrement false Validate validates this destiny definitions items destiny item tier type infusion block
|
func (m *DestinyDefinitionsItemsDestinyItemTierTypeInfusionBlock) Validate(formats strfmt.Registry) error {
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
|
[
"func (b BaseShip) GetFuelConsumption(techs IResearches, fleetDeutSaveFactor float64, isGeneral bool) int64 {\n\tfuelConsumption := b.FuelConsumption\n\tif b.ID == SmallCargoID && techs.GetImpulseDrive() >= 5 {\n\t\tfuelConsumption *= 2\n\t} else if b.ID == RecyclerID && techs.GetHyperspaceDrive() >= 15 {\n\t\tfuelConsumption *= 3\n\t} else if b.ID == RecyclerID && techs.GetImpulseDrive() >= 17 {\n\t\tfuelConsumption *= 2\n\t}\n\tfuelConsumption = int64(fleetDeutSaveFactor * float64(fuelConsumption))\n\tif isGeneral {\n\t\tfuelConsumption = int64(float64(fuelConsumption) / 2)\n\t}\n\treturn fuelConsumption\n}",
"func (me TCompetencyWeightType) IsLevelOfInterest() bool { return me.String() == \"levelOfInterest\" }",
"func (me TxsdTextPathTypeMethod) IsStretch() bool { return me.String() == \"stretch\" }",
"func minSizeEffective(item LayoutItem) Size {\n\tgeometry := item.Geometry()\n\n\tvar s Size\n\tif msh, ok := item.(MinSizer); ok {\n\t\ts = msh.MinSize()\n\t} else if is, ok := item.(IdealSizer); ok {\n\t\ts = is.IdealSize()\n\t}\n\n\tsize := maxSize(geometry.MinSize, s)\n\n\tmax := geometry.MaxSize\n\tif max.Width > 0 && size.Width > max.Width {\n\t\tsize.Width = max.Width\n\t}\n\tif max.Height > 0 && size.Height > max.Height {\n\t\tsize.Height = max.Height\n\t}\n\n\treturn size\n}",
"func (DiscriminatorIntField) dILexicalBlockFileFieldNode() {}",
"func (me TxsdConfidenceRating) IsMedium() bool { return me.String() == \"medium\" }",
"func TestNormalItemQualityIsNeverNegative(t *testing.T) {\n\ttestUpdateQuality(t, \"normal item\", 10, 0, 0)\n}",
"func (_Univ2 *Univ2Caller) MINIMUMLIQUIDITY(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Univ2.contract.Call(opts, &out, \"MINIMUM_LIQUIDITY\")\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}",
"func (m *StoragepoolTierUsage) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAvailBytes(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateAvailSsdBytes(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateBalanced(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateFreeBytes(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateFreeSsdBytes(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTotalBytes(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTotalSsdBytes(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateVirtualHotSpareBytes(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}",
"func (b BaseShip) GetFuelConsumption() int64 {\n\treturn b.FuelConsumption\n}",
"func (o QuotaLimitResponseOutput) FreeTier() pulumi.StringOutput {\n\treturn o.ApplyT(func(v QuotaLimitResponse) string { return v.FreeTier }).(pulumi.StringOutput)\n}",
"func PossibleSkuTierValues() []SkuTier {\n return []SkuTier{Burstable,GeneralPurpose,MemoryOptimized}\n }",
"func storageRemainingAdjustments(entry modules.HostDBEntry) float64 {\n\tbase := float64(1)\n\tif entry.RemainingStorage < 100*requiredStorage {\n\t\tbase = base / 2 // 2x total penalty\n\t}\n\tif entry.RemainingStorage < 80*requiredStorage {\n\t\tbase = base / 2 // 4x total penalty\n\t}\n\tif entry.RemainingStorage < 40*requiredStorage {\n\t\tbase = base / 2 // 8x total penalty\n\t}\n\tif entry.RemainingStorage < 20*requiredStorage {\n\t\tbase = base / 2 // 16x total penalty\n\t}\n\tif entry.RemainingStorage < 15*requiredStorage {\n\t\tbase = base / 2 // 32x total penalty\n\t}\n\tif entry.RemainingStorage < 10*requiredStorage {\n\t\tbase = base / 2 // 64x total penalty\n\t}\n\tif entry.RemainingStorage < 5*requiredStorage {\n\t\tbase = base / 2 // 128x total penalty\n\t}\n\tif entry.RemainingStorage < 3*requiredStorage {\n\t\tbase = base / 2 // 256x total penalty\n\t}\n\tif entry.RemainingStorage < 2*requiredStorage {\n\t\tbase = base / 2 // 512x total penalty\n\t}\n\tif entry.RemainingStorage < requiredStorage {\n\t\tbase = base / 2 // 1024x total penalty\n\t}\n\treturn base\n}",
"func (_IPancakePair *IPancakePairCaller) MINIMUMLIQUIDITY(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _IPancakePair.contract.Call(opts, &out, \"MINIMUM_LIQUIDITY\")\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}",
"func (i *ImageGIF) Quality(o *QualityOperation) error {\n\ti.QualityOp = true\n\n\t// Quality can be between 1 and 100. We need to conver thtat into colors\n\t// which can be anywhere between 2 and 256.\n\ti.Colors = int64((float64(o.NewQuality) * 2.56))\n\n\treturn nil\n}",
"func (bsn *SubBasin) baseflow(g float64) float64 {\n\t// note: no bypass flow; no partioning to deep aquifer (pg.173)\n\td1 := math.Exp(-1. / bsn.dgw)\n\tbsn.psto += g\n\tbsn.wrch = (1.-d1)*g + d1*bsn.wrch // recharge entering aquifer (pg.172)\n\tbsn.psto -= bsn.wrch // water in \"percolation\" storage\n\tif bsn.aq > bsn.aqt {\n\t\te1 := math.Exp(-bsn.agw) // only applicable for daily simulations\n\t\tbsn.qbf = bsn.qbf*e1 + bsn.wrch*(1.-e1) // pg.174\n\t} else {\n\t\tbsn.qbf = 0.\n\t}\n\tbsn.aq += bsn.wrch - bsn.qbf\n\treturn bsn.qbf // [mm]\n}",
"func (m *Monster) BaseDamage() int {\n\tswitch m.id {\n\tcase Bat: // bats deal a base of 1 always\n\t\treturn 1\n\tdefault:\n\t\td := m.Info.Dmg\n\t\tif d < 1 {\n\t\t\td++\n\t\t} else {\n\t\t\td += rand.Intn(d)\n\t\t}\n\t\td += m.Info.Lvl\n\t\treturn d\n\t}\n}",
"func CalculateFuelRequired(mass int) int {\n\treturn (mass / 3) - 2\n}",
"func TestAgedBrieQualityIsNeverMoreThanFifty(t *testing.T) {\n\ttestUpdateQuality(t, \"Aged Brie\", 2, 50, 50)\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Base Vesting Account NewBaseVestingAccount creates a new BaseVestingAccount object. It is the callers responsibility to ensure the base account has sufficient funds with regards to the original vesting amount.
|
func NewBaseVestingAccount(baseAccount *authtypes.BaseAccount, originalVesting sdk.Coins, endTime int64) *BaseVestingAccount {
return &BaseVestingAccount{
BaseAccount: baseAccount,
OriginalVesting: originalVesting,
DelegatedFree: sdk.NewCoins(),
DelegatedVesting: sdk.NewCoins(),
EndTime: endTime,
}
}
|
[
"func NewBaseVestingAccount(baseAccount *BaseAccount, originalVesting sdk.Coins,\n\tdelegatedFree sdk.Coins, delegatedVesting sdk.Coins, endTime int64) *BaseVestingAccount {\n\n\treturn &BaseVestingAccount{\n\t\tBaseAccount: baseAccount,\n\t\tOriginalVesting: originalVesting,\n\t\tDelegatedFree: delegatedFree,\n\t\tDelegatedVesting: delegatedVesting,\n\t\tEndTime: endTime,\n\t}\n}",
"func NewBase() Base {\r\n\treturn Base{\r\n\t\tActive: \"\",\r\n\t\tTitle: \"Lemonade Stand Supply\",\r\n\t}\r\n}",
"func NewClawbackVestingAccount(baseAcc *authtypes.BaseAccount, funder sdk.AccAddress, originalVesting sdk.Coins, startTime int64, lockupPeriods, vestingPeriods Periods) *ClawbackVestingAccount {\n\t// copy and align schedules to avoid mutating inputs\n\tlp := make(Periods, len(lockupPeriods))\n\tcopy(lp, lockupPeriods)\n\tvp := make(Periods, len(vestingPeriods))\n\tcopy(vp, vestingPeriods)\n\t_, endTime := AlignSchedules(startTime, startTime, lp, vp)\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ClawbackVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tFunderAddress: funder.String(),\n\t\tStartTime: startTime,\n\t\tLockupPeriods: lp,\n\t\tVestingPeriods: vp,\n\t}\n}",
"func NewBaseAccount(address sdk.AccAddress, coins sdk.Coins,\n\tpubKey crypto.PubKey, accountNumber uint64, sequence uint64) *BaseAccount {\n\n\treturn &BaseAccount{\n\t\tAddress: address,\n\t\tCoins: coins,\n\t\tPubKey: pubKey,\n\t\tAccountNumber: accountNumber,\n\t\tSequence: sequence,\n\t}\n}",
"func NewPeriodicVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime int64, periods Periods) *PeriodicVestingAccount {\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func NewValidatorVestingAccount(baseAcc *authtypes.BaseAccount, startTime int64, periods vestingtypes.Periods, validatorAddress sdk.ConsAddress, returnAddress sdk.AccAddress, signingThreshold int64) *ValidatorVestingAccount {\n\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &vestingtypes.BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\tpva := &vestingtypes.PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n\tvar vestingPeriodProgress []VestingProgress\n\tfor i := 0; i < len(periods); i++ {\n\t\tvestingPeriodProgress = append(vestingPeriodProgress, VestingProgress{false, false})\n\t}\n\n\treturn &ValidatorVestingAccount{\n\t\tPeriodicVestingAccount: pva,\n\t\tValidatorAddress: validatorAddress,\n\t\tReturnAddress: returnAddress,\n\t\tSigningThreshold: signingThreshold,\n\t\tCurrentPeriodProgress: CurrentPeriodProgress{0, 0},\n\t\tVestingPeriodProgress: vestingPeriodProgress,\n\t\tDebtAfterFailedVesting: sdk.NewCoins(),\n\t}\n}",
"func NewBaseViewKeeper(am auth.AccountKeeper) BaseViewKeeper {\n\treturn BaseViewKeeper{am: am}\n}",
"func NewBase(name string) *Base {\n\treturn &Base{name}\n}",
"func NewBaseKeeper(am auth.AccountKeeper) BaseKeeper {\n\treturn BaseKeeper{am: am}\n}",
"func newPeriodicVestingAccount(address sdk.AccAddress, periods vestingtypes.Periods, firstPeriodStartTimestamp int64) *vestingtypes.PeriodicVestingAccount {\n\tbaseAccount := authtypes.NewBaseAccount(address, nil, 0, 0)\n\n\toriginalVesting := sdk.NewCoins()\n\tfor _, p := range periods {\n\t\toriginalVesting = originalVesting.Add(p.Amount...)\n\t}\n\n\tvar totalPeriods int64\n\tfor _, p := range periods {\n\t\ttotalPeriods += p.Length\n\t}\n\tendTime := firstPeriodStartTimestamp + totalPeriods\n\n\tbaseVestingAccount := vestingtypes.NewBaseVestingAccount(baseAccount, originalVesting, endTime)\n\treturn vestingtypes.NewPeriodicVestingAccountRaw(baseVestingAccount, firstPeriodStartTimestamp, periods)\n}",
"func NewBase(name string) Base {\n\treturn Base{Name: name}\n}",
"func (suite *KeeperTestSuite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) authtypes.AccountI {\n\tif vestingBalance.IsAnyGT(initialBalance) {\n\t\tpanic(\"vesting balance must be less than initial balance\")\n\t}\n\tacc := suite.CreateAccountWithAddress(addr, initialBalance)\n\tbacc := acc.(*authtypes.BaseAccount)\n\n\tperiods := vestingtypes.Periods{\n\t\tvestingtypes.Period{\n\t\t\tLength: 31556952,\n\t\t\tAmount: vestingBalance,\n\t\t},\n\t}\n\tvacc := vestingtypes.NewPeriodicVestingAccount(bacc, vestingBalance, suite.Ctx.BlockTime().Unix(), periods)\n\tsuite.App.GetAccountKeeper().SetAccount(suite.Ctx, vacc)\n\treturn vacc\n}",
"func NewDelayedVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, endTime int64) *DelayedVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &DelayedVestingAccount{baseVestingAcc}\n}",
"func NewKeybase(validatorMoniker, mnemonic, password string) (keyring.Keyring, keyring.Info, error) {\n\tkr := keyring.NewInMemory()\n\thdpath := *hd.NewFundraiserParams(0, sdk.CoinType, 0)\n\tinfo, err := kr.NewAccount(validatorMoniker, mnemonic, password, hdpath.String(), hd.Secp256k1)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn kr, info, nil\n}",
"func newAccount() *Account {\n\taccount := &Account{}\n\taccount.NativeBalance = Balance{NativeAsset, \"0\", \"\"}\n\taccount.Signers = []Signer{\n\t\tSigner{},\n\t}\n\taccount.Balances = []Balance{}\n\n\treturn account\n}",
"func NewDelayedVestingAccount(baseAcc *BaseAccount, endTime int64) *DelayedVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &DelayedVestingAccount{baseVestingAcc}\n}",
"func NewBase(path string, hashName string) (*Base, error) {\n\tfor _, p := range []string{\"blobs/\" + hashName, \"state\", \"tmp\"} {\n\t\tif err := os.MkdirAll(filepath.Join(path, p), 0755); err != nil && !os.IsExist(err) {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn &Base{Path: path, HashName: hashName, Hash: cryptomap.DetermineHash(hashName)}, nil\n}",
"func NewValidatorVestingAccountRaw(bva *vestingtypes.BaseVestingAccount,\n\tstartTime int64, periods vestingtypes.Periods, validatorAddress sdk.ConsAddress, returnAddress sdk.AccAddress, signingThreshold int64) *ValidatorVestingAccount {\n\n\tpva := &vestingtypes.PeriodicVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n\tvar vestingPeriodProgress []VestingProgress\n\tfor i := 0; i < len(periods); i++ {\n\t\tvestingPeriodProgress = append(vestingPeriodProgress, VestingProgress{false, false})\n\t}\n\n\treturn &ValidatorVestingAccount{\n\t\tPeriodicVestingAccount: pva,\n\t\tValidatorAddress: validatorAddress,\n\t\tReturnAddress: returnAddress,\n\t\tSigningThreshold: signingThreshold,\n\t\tCurrentPeriodProgress: CurrentPeriodProgress{0, 0},\n\t\tVestingPeriodProgress: vestingPeriodProgress,\n\t\tDebtAfterFailedVesting: sdk.NewCoins(),\n\t}\n}",
"func NewContinuousVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime, endTime int64) *ContinuousVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ContinuousVestingAccount{\n\t\tStartTime: startTime,\n\t\tBaseVestingAccount: baseVestingAcc,\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
LockedCoinsFromVesting returns all the coins that are not spendable (i.e. locked) for a vesting account given the current vesting coins. If no coins are locked, an empty slice of Coins is returned. CONTRACT: Delegated vesting coins and vestingCoins must be sorted.
|
func (bva BaseVestingAccount) LockedCoinsFromVesting(vestingCoins sdk.Coins) sdk.Coins {
lockedCoins := vestingCoins.Sub(vestingCoins.Min(bva.DelegatedVesting))
if lockedCoins == nil {
return sdk.Coins{}
}
return lockedCoins
}
|
[
"func (pva PeriodicVestingAccount) LockedCoins(ctx sdk.Context) sdk.Coins {\n\treturn pva.BaseVestingAccount.LockedCoinsFromVesting(pva.GetVestingCoins(ctx.BlockTime()))\n}",
"func (dva DelayedVestingAccount) LockedCoins(ctx sdk.Context) sdk.Coins {\n\treturn dva.BaseVestingAccount.LockedCoinsFromVesting(dva.GetVestingCoins(ctx.BlockTime()))\n}",
"func (plva PermanentLockedAccount) GetVestingCoins(_ time.Time) sdk.Coins {\n\treturn plva.OriginalVesting\n}",
"func (vva ValidatorVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn vva.OriginalVesting.Sub(vva.GetVestedCoins(blockTime))\n}",
"func (dva DelayedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn dva.OriginalVesting.Sub(dva.GetVestedCoins(blockTime))\n}",
"func (va ClawbackVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn va.OriginalVesting.Sub(va.GetVestedCoins(blockTime))\n}",
"func (plva PermanentLockedAccount) GetVestedCoins(_ time.Time) sdk.Coins {\n\treturn nil\n}",
"func (cva ContinuousVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn cva.OriginalVesting.Sub(cva.GetVestedCoins(blockTime))\n}",
"func (bva BaseVestingAccount) spendableCoins(vestingCoins sdk.Coins) sdk.Coins {\n\tvar spendableCoins sdk.Coins\n\tbc := bva.GetCoins()\n\n\tfor _, coin := range bc {\n\t\t// zip/lineup all coins by their denomination to provide O(n) time\n\t\tbaseAmt := coin.Amount\n\t\tvestingAmt := vestingCoins.AmountOf(coin.Denom)\n\t\tdelVestingAmt := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// compute min((BC + DV) - V, BC) per the specification\n\t\tmin := sdk.MinInt(baseAmt.Add(delVestingAmt).Sub(vestingAmt), baseAmt)\n\t\tspendableCoin := sdk.NewCoin(coin.Denom, min)\n\n\t\tif !spendableCoin.IsZero() {\n\t\t\tspendableCoins = spendableCoins.Add(sdk.Coins{spendableCoin})\n\t\t}\n\t}\n\n\treturn spendableCoins\n}",
"func (cva ContinuousVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tvar vestedCoins sdk.Coins\n\n\t// We must handle the case where the start time for a vesting account has\n\t// been set into the future or when the start of the chain is not exactly\n\t// known.\n\tif blockTime.Unix() <= cva.StartTime {\n\t\treturn vestedCoins\n\t} else if blockTime.Unix() >= cva.EndTime {\n\t\treturn cva.OriginalVesting\n\t}\n\n\t// calculate the vesting scalar\n\tx := blockTime.Unix() - cva.StartTime\n\ty := cva.EndTime - cva.StartTime\n\ts := sdk.NewDec(x).Quo(sdk.NewDec(y))\n\n\tfor _, ovc := range cva.OriginalVesting {\n\t\tvestedAmt := ovc.Amount.ToDec().Mul(s).RoundInt()\n\t\tvestedCoins = append(vestedCoins, sdk.NewCoin(ovc.Denom, vestedAmt))\n\t}\n\n\treturn vestedCoins\n}",
"func (dva DelayedVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tif blockTime.Unix() >= dva.EndTime {\n\t\treturn dva.OriginalVesting\n\t}\n\n\treturn nil\n}",
"func (pva PeriodicVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tcoins := ReadSchedule(pva.StartTime, pva.EndTime, pva.VestingPeriods, pva.OriginalVesting, blockTime.Unix())\n\tif coins.IsZero() {\n\t\treturn nil\n\t}\n\treturn coins\n}",
"func (va ClawbackVestingAccount) GetVestedOnly(blockTime time.Time) sdk.Coins {\n\treturn ReadSchedule(va.StartTime, va.EndTime, va.VestingPeriods, va.OriginalVesting, blockTime.Unix())\n}",
"func (vva ValidatorVestingAccount) GetFailedVestedCoins() sdk.Coins {\n\tvar failedVestedCoins sdk.Coins\n\tnumberPeriods := len(vva.VestingPeriods)\n\tfor i := 0; i < numberPeriods; i++ {\n\t\tif vva.VestingPeriodProgress[i].PeriodComplete {\n\t\t\tif !vva.VestingPeriodProgress[i].VestingSuccessful {\n\t\t\t\tfailedVestedCoins = failedVestedCoins.Add(vva.VestingPeriods[i].Amount)\n\t\t\t}\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn failedVestedCoins\n}",
"func (vva ValidatorVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins {\n\treturn vva.BaseVestingAccount.SpendableCoinsVestingAccount(vva.GetVestingCoins(blockTime))\n}",
"func (wallet *Wallet) GetUnspentCells(ctx context.Context, needCap uint64) ([]ckbtypes.CellOutputWithOutPoint, error) {\n\tcollector := cellcollector.NewCellCollector(wallet.Client, wallet.SkipDataAndType)\n\tcells, _, err := collector.GetUnspentCells(ctx, wallet.lockHashHex.Hex(), needCap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn cells, nil\n}",
"func (dcr *ExchangeWallet) FundingCoins(ids []dex.Bytes) (asset.Coins, error) {\n\t// First check if we have the coins in cache.\n\tcoins := make(asset.Coins, 0, len(ids))\n\tnotFound := make(map[outPoint]bool)\n\tdcr.fundingMtx.Lock()\n\tdefer dcr.fundingMtx.Unlock() // stay locked until we update the map and lock them in the wallet\n\tfor _, id := range ids {\n\t\ttxHash, vout, err := decodeCoinID(id)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpt := newOutPoint(txHash, vout)\n\t\tfundingCoin, found := dcr.fundingCoins[pt]\n\t\tif found {\n\t\t\tcoins = append(coins, fundingCoin.op)\n\t\t\tcontinue\n\t\t}\n\t\tnotFound[pt] = true\n\t}\n\tif len(notFound) == 0 {\n\t\treturn coins, nil\n\t}\n\n\t// Check locked outputs for not found coins.\n\tlockedOutputs, err := dcr.lockedOutputs()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, output := range lockedOutputs {\n\t\ttxHash, err := chainhash.NewHashFromStr(output.Txid)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error decoding txid from rpc server %s: %w\", output.Txid, err)\n\t\t}\n\t\tpt := newOutPoint(txHash, output.Vout)\n\t\tif !notFound[pt] {\n\t\t\tcontinue\n\t\t}\n\t\ttxOut, err := dcr.node.GetTxOut(dcr.ctx, txHash, output.Vout, true)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"gettxout error for locked output %v: %w\", pt.String(), translateRPCCancelErr(err))\n\t\t}\n\t\tvar address string\n\t\tif len(txOut.ScriptPubKey.Addresses) > 0 {\n\t\t\taddress = txOut.ScriptPubKey.Addresses[0]\n\t\t}\n\t\tcoin := newOutput(txHash, output.Vout, toAtoms(output.Amount), output.Tree)\n\t\tcoins = append(coins, coin)\n\t\tdcr.fundingCoins[pt] = &fundingCoin{\n\t\t\top: coin,\n\t\t\taddr: address,\n\t\t}\n\t\tdelete(notFound, pt)\n\t\tif len(notFound) == 0 {\n\t\t\treturn coins, nil\n\t\t}\n\t}\n\n\t// Some funding coins still not found after checking locked outputs.\n\t// Check wallet unspent outputs as last resort. Lock the coins if found.\n\tunspents, err := dcr.unspents()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcoinsToLock := make([]*wire.OutPoint, 0, len(notFound))\n\tfor _, txout := range unspents {\n\t\ttxHash, err := chainhash.NewHashFromStr(txout.TxID)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error decoding txid from rpc server %s: %w\", txout.TxID, err)\n\t\t}\n\t\tpt := newOutPoint(txHash, txout.Vout)\n\t\tif !notFound[pt] {\n\t\t\tcontinue\n\t\t}\n\t\tcoinsToLock = append(coinsToLock, wire.NewOutPoint(txHash, txout.Vout, txout.Tree))\n\t\tcoin := newOutput(txHash, txout.Vout, toAtoms(txout.Amount), txout.Tree)\n\t\tcoins = append(coins, coin)\n\t\tdcr.fundingCoins[pt] = &fundingCoin{\n\t\t\top: coin,\n\t\t\taddr: txout.Address,\n\t\t}\n\t\tdelete(notFound, pt)\n\t\tif len(notFound) == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\tif len(notFound) != 0 {\n\t\tids := make([]string, 0, len(notFound))\n\t\tfor pt := range notFound {\n\t\t\tids = append(ids, pt.String())\n\t\t}\n\t\treturn nil, fmt.Errorf(\"funding coins not found: %s\", strings.Join(ids, \", \"))\n\t}\n\tdcr.log.Debugf(\"Locking funding coins that were unlocked %v\", coinsToLock)\n\terr = dcr.node.LockUnspent(dcr.ctx, false, coinsToLock)\n\tif err != nil {\n\t\treturn nil, translateRPCCancelErr(err)\n\t}\n\n\treturn coins, nil\n}",
"func (dva DelayedVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins {\n\treturn dva.spendableCoins(dva.GetVestingCoins(blockTime))\n}",
"func (w *Wallet) LockedOutpoints() []btcjson.TransactionInput {\n\tlocked := make([]btcjson.TransactionInput, len(w.lockedOutpoints))\n\ti := 0\n\tfor op := range w.lockedOutpoints {\n\t\tlocked[i] = btcjson.TransactionInput{\n\t\t\tTxid: op.Hash.String(),\n\t\t\tVout: op.Index,\n\t\t}\n\t\ti++\n\t}\n\treturn locked\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
TrackDelegation tracks a delegation amount for any given vesting account type given the amount of coins currently vesting and the current account balance of the delegation denominations. CONTRACT: The account's coins, delegation coins, vesting coins, and delegated vesting coins must be sorted.
|
func (bva *BaseVestingAccount) TrackDelegation(balance, vestingCoins, amount sdk.Coins) {
for _, coin := range amount {
baseAmt := balance.AmountOf(coin.Denom)
vestingAmt := vestingCoins.AmountOf(coin.Denom)
delVestingAmt := bva.DelegatedVesting.AmountOf(coin.Denom)
// Panic if the delegation amount is zero or if the base coins does not
// exceed the desired delegation amount.
if coin.Amount.IsZero() || baseAmt.LT(coin.Amount) {
panic("delegation attempt with zero coins or insufficient funds")
}
// compute x and y per the specification, where:
// X := min(max(V - DV, 0), D)
// Y := D - X
x := sdk.MinInt(sdk.MaxInt(vestingAmt.Sub(delVestingAmt), sdk.ZeroInt()), coin.Amount)
y := coin.Amount.Sub(x)
if !x.IsZero() {
xCoin := sdk.NewCoin(coin.Denom, x)
bva.DelegatedVesting = bva.DelegatedVesting.Add(xCoin)
}
if !y.IsZero() {
yCoin := sdk.NewCoin(coin.Denom, y)
bva.DelegatedFree = bva.DelegatedFree.Add(yCoin)
}
}
}
|
[
"func (bva *BaseVestingAccount) trackDelegation(vestingCoins, amount sdk.Coins) {\n\tbc := bva.GetCoins()\n\n\tfor _, coin := range amount {\n\t\t// zip/lineup all coins by their denomination to provide O(n) time\n\n\t\tbaseAmt := bc.AmountOf(coin.Denom)\n\t\tvestingAmt := vestingCoins.AmountOf(coin.Denom)\n\t\tdelVestingAmt := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// Panic if the delegation amount is zero or if the base coins does not\n\t\t// exceed the desired delegation amount.\n\t\tif coin.Amount.IsZero() || baseAmt.LT(coin.Amount) {\n\t\t\tpanic(\"delegation attempt with zero coins or insufficient funds\")\n\t\t}\n\n\t\t// compute modules and y per the specification, where:\n\t\t// X := min(max(V - DV, 0), D)\n\t\t// Y := D - X\n\t\tx := sdk.MinInt(sdk.MaxInt(vestingAmt.Sub(delVestingAmt), sdk.ZeroInt()), coin.Amount)\n\t\ty := coin.Amount.Sub(x)\n\n\t\tif !x.IsZero() {\n\t\t\txCoin := sdk.NewCoin(coin.Denom, x)\n\t\t\tbva.DelegatedVesting = bva.DelegatedVesting.Add(sdk.Coins{xCoin})\n\t\t}\n\n\t\tif !y.IsZero() {\n\t\t\tyCoin := sdk.NewCoin(coin.Denom, y)\n\t\t\tbva.DelegatedFree = bva.DelegatedFree.Add(sdk.Coins{yCoin})\n\t\t}\n\n\t\tbva.Coins = bva.Coins.Sub(sdk.Coins{coin})\n\t}\n}",
"func (dva *DelayedVestingAccount) TrackDelegation(blockTime time.Time, balance, amount sdk.Coins) {\n\tdva.BaseVestingAccount.TrackDelegation(balance, dva.GetVestingCoins(blockTime), amount)\n}",
"func (dva *DelayedVestingAccount) TrackDelegation(blockTime time.Time, amount sdk.Coins) {\n\tdva.trackDelegation(dva.GetVestingCoins(blockTime), amount)\n}",
"func (bva *BaseVestingAccount) TrackUndelegation(amount sdk.Coins) {\n\tfor _, coin := range amount {\n\t\t// panic if the undelegation amount is zero\n\t\tif coin.Amount.IsZero() {\n\t\t\tpanic(\"undelegation attempt with zero coins\")\n\t\t}\n\t\tdelegatedFree := bva.DelegatedFree.AmountOf(coin.Denom)\n\t\tdelegatedVesting := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// compute modules and y per the specification, where:\n\t\t// X := min(DF, D)\n\t\t// Y := min(DV, D - X)\n\t\tx := sdk.MinInt(delegatedFree, coin.Amount)\n\t\ty := sdk.MinInt(delegatedVesting, coin.Amount.Sub(x))\n\n\t\tif !x.IsZero() {\n\t\t\txCoin := sdk.NewCoin(coin.Denom, x)\n\t\t\tbva.DelegatedFree = bva.DelegatedFree.Sub(sdk.Coins{xCoin})\n\t\t}\n\n\t\tif !y.IsZero() {\n\t\t\tyCoin := sdk.NewCoin(coin.Denom, y)\n\t\t\tbva.DelegatedVesting = bva.DelegatedVesting.Sub(sdk.Coins{yCoin})\n\t\t}\n\n\t\tbva.Coins = bva.Coins.Add(sdk.Coins{coin})\n\t}\n}",
"func (bva *BaseVestingAccount) TrackUndelegation(amount sdk.Coins) {\n\tfor _, coin := range amount {\n\t\t// panic if the undelegation amount is zero\n\t\tif coin.Amount.IsZero() {\n\t\t\tpanic(\"undelegation attempt with zero coins\")\n\t\t}\n\t\tdelegatedFree := bva.DelegatedFree.AmountOf(coin.Denom)\n\t\tdelegatedVesting := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// compute x and y per the specification, where:\n\t\t// X := min(DF, D)\n\t\t// Y := min(DV, D - X)\n\t\tx := sdk.MinInt(delegatedFree, coin.Amount)\n\t\ty := sdk.MinInt(delegatedVesting, coin.Amount.Sub(x))\n\n\t\tif !x.IsZero() {\n\t\t\txCoin := sdk.NewCoin(coin.Denom, x)\n\t\t\tbva.DelegatedFree = bva.DelegatedFree.Sub(sdk.Coins{xCoin})\n\t\t}\n\n\t\tif !y.IsZero() {\n\t\t\tyCoin := sdk.NewCoin(coin.Denom, y)\n\t\t\tbva.DelegatedVesting = bva.DelegatedVesting.Sub(sdk.Coins{yCoin})\n\t\t}\n\t}\n}",
"func (va *ClawbackVestingAccount) updateDelegation(encumbered, toClawBack, bonded, unbonding, unbonded sdk.Coins) sdk.Coins {\n\tdelegated := bonded.Add(unbonding...)\n\toldDelegated := va.DelegatedVesting.Add(va.DelegatedFree...)\n\tslashed := oldDelegated.Sub(coinsMin(delegated, oldDelegated))\n\ttotal := delegated.Add(unbonded...)\n\ttoClawBack = coinsMin(toClawBack, total) // might have been slashed\n\tnewDelegated := coinsMin(delegated, total.Sub(toClawBack)).Add(slashed...)\n\tva.DelegatedVesting = coinsMin(encumbered, newDelegated)\n\tva.DelegatedFree = newDelegated.Sub(va.DelegatedVesting)\n\treturn toClawBack\n}",
"func (k msgServer) Delegate(goCtx context.Context, msg *types.MsgDelegate) (*types.MsgDelegateResponse, error) {\n\tctx := sdk.UnwrapSDKContext(goCtx)\n\tvalAddr, valErr := sdk.ValAddressFromBech32(msg.ValidatorAddress)\n\tif valErr != nil {\n\t\treturn nil, valErr\n\t}\n\n\tvalidator, found := k.GetValidator(ctx, valAddr)\n\tif !found {\n\t\treturn nil, types.ErrNoValidatorFound\n\t}\n\n\tdelegatorAddress, err := sdk.AccAddressFromBech32(msg.DelegatorAddress)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbondDenom := k.BondDenom(ctx)\n\tif msg.Amount.Denom != bondDenom {\n\t\treturn nil, sdkerrors.Wrapf(\n\t\t\tsdkerrors.ErrInvalidRequest, \"invalid coin denomination: got %s, expected %s\", msg.Amount.Denom, bondDenom,\n\t\t)\n\t}\n\n\ttokens := msg.Amount.Amount\n\n\t// if this delegation is from a liquid staking provider (identified if the delegator\n\t// is an ICA account), it cannot exceed the global or validator bond cap\n\tif k.DelegatorIsLiquidStaker(delegatorAddress) {\n\t\tshares, err := validator.SharesFromTokens(tokens)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif err := k.SafelyIncreaseTotalLiquidStakedTokens(ctx, tokens, false); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif err := k.SafelyIncreaseValidatorLiquidShares(ctx, &validator, shares); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// NOTE: source funds are always unbonded\n\tnewShares, err := k.Keeper.Delegate(ctx, delegatorAddress, tokens, types.Unbonded, validator, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif tokens.IsInt64() {\n\t\tdefer func() {\n\t\t\ttelemetry.IncrCounter(1, types.ModuleName, \"delegate\")\n\t\t\ttelemetry.SetGaugeWithLabels(\n\t\t\t\t[]string{\"tx\", \"msg\", msg.Type()},\n\t\t\t\tfloat32(tokens.Int64()),\n\t\t\t\t[]metrics.Label{telemetry.NewLabel(\"denom\", msg.Amount.Denom)},\n\t\t\t)\n\t\t}()\n\t}\n\n\tctx.EventManager().EmitEvents(sdk.Events{\n\t\tsdk.NewEvent(\n\t\t\ttypes.EventTypeDelegate,\n\t\t\tsdk.NewAttribute(types.AttributeKeyValidator, msg.ValidatorAddress),\n\t\t\tsdk.NewAttribute(sdk.AttributeKeyAmount, msg.Amount.String()),\n\t\t\tsdk.NewAttribute(types.AttributeKeyNewShares, newShares.String()),\n\t\t),\n\t})\n\n\treturn &types.MsgDelegateResponse{}, nil\n}",
"func (k Keeper) TransferDelegation(ctx sdk.Context, valAddr sdk.ValAddress, fromDelegator, toDelegator sdk.AccAddress, shares sdk.Dec) (sdk.Dec, error) {\n\t// Redelegations link a delegation to it's previous validator so slashes are propagated to the new validator.\n\t// If the delegation is transferred to a new owner, the redelegation object must be updated.\n\t// For expediency all transfers with redelegations are blocked.\n\tif k.stakingKeeper.HasReceivingRedelegation(ctx, fromDelegator, valAddr) {\n\t\treturn sdk.Dec{}, types.ErrRedelegationsNotCompleted\n\t}\n\n\tif shares.IsNil() || shares.LT(sdk.ZeroDec()) {\n\t\treturn sdk.Dec{}, errorsmod.Wrap(types.ErrUntransferableShares, \"nil or negative shares\")\n\t}\n\tif shares.Equal(sdk.ZeroDec()) {\n\t\t// Block 0 transfers to reduce edge cases.\n\t\treturn sdk.Dec{}, errorsmod.Wrap(types.ErrUntransferableShares, \"zero shares\")\n\t}\n\n\tfromDelegation, found := k.stakingKeeper.GetDelegation(ctx, fromDelegator, valAddr)\n\tif !found {\n\t\treturn sdk.Dec{}, types.ErrNoDelegatorForAddress\n\t}\n\tvalidator, found := k.stakingKeeper.GetValidator(ctx, valAddr)\n\tif !found {\n\t\treturn sdk.Dec{}, types.ErrNoValidatorFound\n\t}\n\t// Prevent validators from reducing their self delegation below the min.\n\tisValidatorOperator := fromDelegator.Equals(valAddr)\n\tif isValidatorOperator {\n\t\tif isBelowMinSelfDelegation(validator, fromDelegation.Shares.Sub(shares)) {\n\t\t\treturn sdk.Dec{}, types.ErrSelfDelegationBelowMinimum\n\t\t}\n\t}\n\n\treturnAmount, err := k.fastUndelegate(ctx, valAddr, fromDelegator, shares)\n\tif err != nil {\n\t\treturn sdk.Dec{}, err\n\t}\n\treturnCoins := sdk.NewCoins(sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), returnAmount))\n\n\tif err := k.bankKeeper.SendCoins(ctx, fromDelegator, toDelegator, returnCoins); err != nil {\n\t\treturn sdk.Dec{}, err\n\t}\n\treceivedShares, err := k.delegateFromAccount(ctx, valAddr, toDelegator, returnAmount)\n\tif err != nil {\n\t\treturn sdk.Dec{}, err\n\t}\n\n\treturn receivedShares, nil\n}",
"func (suite *KeeperTestSuite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdk.Dec {\n\tstakingDenom := suite.StakingKeeper.BondDenom(suite.Ctx)\n\tmsg := stakingtypes.NewMsgDelegate(\n\t\tdelegator,\n\t\tvalAddr,\n\t\tsdk.NewCoin(stakingDenom, amount),\n\t)\n\n\tmsgServer := stakingkeeper.NewMsgServerImpl(suite.StakingKeeper)\n\t_, err := msgServer.Delegate(sdk.WrapSDKContext(suite.Ctx), msg)\n\tsuite.Require().NoError(err)\n\n\tdel, found := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr)\n\tsuite.Require().True(found)\n\treturn del.Shares\n}",
"func sendDelegation() {\n\t// get the address\n\taddress := getTestAddress()\n\t// get the keyname and password\n\tkeyname, password := getKeynameAndPassword()\n\n\taddrFrom, err := sdk.AccAddressFromBech32(address) // validator\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// helper methods for transactions\n\tcdc := app.MakeCodec() // make codec for the app\n\n\t// get the keybase\n\tkeybase := getKeybase()\n\n\t// get the validator address for delegation\n\tvalAddr, err := sdk.ValAddressFromBech32(\"jpyvaloper1ffv7nhd3z6sych2qpqkk03ec6hzkmufyz4scd0\") // **FAUCET**\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// create delegation amount\n\tdelAmount := sdk.NewInt64Coin(sdk.DefaultBondDenom, 1000000)\n\tdelegation := staking.NewMsgDelegate(addrFrom, valAddr, delAmount)\n\tdelegationToSend := []sdk.Msg{delegation}\n\n\t// send the delegation to the blockchain\n\tsendMsgToBlockchain(cdc, address, keyname, password, delegationToSend, keybase)\n}",
"func (b *rpcVestingBalance) delegated() (sdk.Coins, sdk.Coins, error) {\n\tdelegatedCoins, err := b.totalDelegated()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tunbondingCoins, err := b.totalUnbondingDelegations()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tdelegated := delegatedCoins.AmountOf(stakingDenom)\n\tunbonding := unbondingCoins.AmountOf(stakingDenom)\n\ttotalStaked := delegated.Add(unbonding)\n\tdelegatedFree := b.vacc.GetDelegatedFree().AmountOf(stakingDenom)\n\n\t// total number of staked and unbonding tokens considered to be liquid\n\ttotalFree := sdk.MinInt(totalStaked, delegatedFree)\n\t// any coins that are not considered liquid, are vesting up to a maximum of delegated\n\tstakedVesting := sdk.MinInt(totalStaked.Sub(totalFree), delegated)\n\t// staked free coins are left over\n\tstakedFree := delegated.Sub(stakedVesting)\n\n\tliquidCoins := sdk.NewCoins(newKavaCoin(stakedFree))\n\tvestingCoins := sdk.NewCoins(newKavaCoin(stakedVesting))\n\treturn liquidCoins, vestingCoins, nil\n}",
"func SendBonusPayment(iAmount int, txDesc string) {\n\n\tdbtx := beginTx()\n\tpayrec := createPaymentRecord()\n\tdbtx.Save(&payrec)\n\tlog.Info(\"Starting payments calculation. Active peer for voter information: \", arkclient.GetActivePeer())\n\n\tpubKey := viper.GetString(\"delegate.pubkey\")\n\tif core.EnvironmentParams.Network.Type == core.DEVNET {\n\t\tpubKey = viper.GetString(\"delegate.Dpubkey\")\n\t}\n\n\tvar p1, p2 string\n\tvar key1 *arkcoin.PrivateKey\n\tif _, err := os.Stat(\"assembly.ark\"); err == nil {\n\t\tlog.Info(\"Linked account data found. Using saved account information.\")\n\n\t\tp1, p2 = read()\n\n\t\tkey1 = arkcoin.NewPrivateKeyFromPassword(p1, arkcoin.ActiveCoinConfig)\n\t\tpubKey = hex.EncodeToString(key1.PublicKey.Serialize())\n\n\t} else {\n\t\tp1, p2 = readAccountData()\n\t\tkey1 = arkcoin.NewPrivateKeyFromPassword(p1, arkcoin.ActiveCoinConfig)\n\t}\n\n\t//TODO JARUNIK TEST\n\t//pubKey = \"02c7455bebeadde04728441e0f57f82f972155c088252bf7c1365eb0dc84fbf5de\"\n\t//pubKey = \"027acdf24b004a7b1e6be2adf746e3233ce034dbb7e83d4a900f367efc4abd0f21\"\n\tparams := core.DelegateQueryParams{PublicKey: pubKey}\n\tvar payload core.TransactionPayload\n\n\tvoters, _, err := arkclient.GetDelegateVoters(params)\n\tif !voters.Success {\n\t\trollbackTx(dbtx)\n\t\tlog.Error(\"Failed getting delegate voters\", err.Error())\n\t\tfmt.Println(\"Failed getting delegate voters\", err.Error())\n\t\tpause()\n\t\treturn\n\t}\n\n\tclearScreen()\n\n\ttxAmount2Send := int64(iAmount * core.SATOSHI)\n\n\t//creating tx\n\tfor _, element := range voters.Accounts {\n\t\t//no bonuses for blocked addresses\n\t\tif isBlockedAddress(viper.GetString(\"voters.blocklist\"), element.Address) {\n\t\t\tlog.Info(\"Skipping bonus payment for \", element.Address)\n\t\t\tcontinue\n\t\t}\n\t\t//transaction parameters\n\t\ttx := core.CreateTransaction(element.Address, txAmount2Send, txDesc, p1, p2, 0)\n\t\tpayload.Transactions = append(payload.Transactions, tx)\n\t\t//Logging history to DB\n\t\tsavebonus2db(dbtx, element.Address, tx, payrec.Pk)\n\t}\n\n\tlog.Info(\"*******************************************************************************************************************\")\n\tlog.Info(\" DELEGATE BONUS PAYOUT\")\n\tlog.Info(\"Number of voters:\", len(voters.Accounts))\n\tlog.Info(\"*******************************************************************************************************************\")\n\n\tdbtx.Update(&payrec)\n\n\tcolor.Set(color.FgHiGreen)\n\tfmt.Println(\"--------------------------------------------------------------------------------------------------------------\")\n\tfmt.Println(\"Transactions to be sent from:\")\n\tcolor.Set(color.FgHiYellow)\n\tfmt.Println(\"\\tDelegate address:\", key1.PublicKey.Address())\n\n\tcolor.Set(color.FgHiGreen)\n\tfmt.Println(\"--------------------------------------------------------------------------------------------------------------\")\n\tcolor.Set(color.FgHiCyan)\n\tfor ix, el := range payload.Transactions {\n\t\ts := fmt.Sprintf(\"%3d.|%s|%15d| %-40s|\", ix+1, el.RecipientID, el.Amount, el.VendorField)\n\t\tfmt.Println(s)\n\t\tlog.Info(s)\n\t}\n\n\tcolor.Set(color.FgHiYellow)\n\tfmt.Println(\"\")\n\tfmt.Println(\"--------------------------------------------------------------------------------------------------------------\")\n\n\tvar c byte\n\tfmt.Print(\"Send BONUS PAYMENT transactions and complete reward payments [Y/N]: \")\n\tc, _ = reader.ReadByte()\n\n\tif c == []byte(\"Y\")[0] || c == []byte(\"y\")[0] {\n\n\t\tfmt.Println(\"Sending BONUS to VOTERS.............\")\n\t\tlog.Info(\"Starting automated payment... \")\n\n\t\tsplitAndDeliverPayload(payload)\n\t\tcommitTx(dbtx)\n\n\t\tfmt.Println(\"Automated Payment complete. Please check the logs folder... \")\n\t\tlog.Info(\"Automated Payment complete. Please check the logs folder... \")\n\n\t\treader.ReadString('\\n')\n\t} else {\n\t\trollbackTx(dbtx)\n\t}\n}",
"func (a *account) managedTrackDeposit(amount types.Currency) {\n\ta.mu.Lock()\n\tdefer a.mu.Unlock()\n\ta.pendingDeposits = a.pendingDeposits.Add(amount)\n}",
"func (_DelegationController *DelegationControllerSession) Delegate(validatorId *big.Int, amount *big.Int, delegationPeriod *big.Int, info string) (*types.Transaction, error) {\n\treturn _DelegationController.Contract.Delegate(&_DelegationController.TransactOpts, validatorId, amount, delegationPeriod, info)\n}",
"func (_DelegationController *DelegationControllerTransactorSession) Delegate(validatorId *big.Int, amount *big.Int, delegationPeriod *big.Int, info string) (*types.Transaction, error) {\n\treturn _DelegationController.Contract.Delegate(&_DelegationController.TransactOpts, validatorId, amount, delegationPeriod, info)\n}",
"func CalculateDelegateNetPayout(delegatedContracts []DelegatedContract) []DelegatedContract{\n var delegateIndex int\n\n for index, delegate := range delegatedContracts{\n if (delegate.Delegate){\n delegateIndex = index\n }\n }\n\n for _, delegate := range delegatedContracts{\n if (!delegate.Delegate){\n delegatedContracts[delegateIndex].TotalPayout = delegatedContracts[delegateIndex].TotalPayout + delegate.Fee\n }\n }\n return delegatedContracts\n}",
"func (a *Account) Track() {\n\t// Request notifications for transactions sending to all wallet\n\t// addresses.\n\taddrs := a.ActiveAddresses()\n\taddrstrs := make([]string, len(addrs))\n\ti := 0\n\tfor addr := range addrs {\n\t\taddrstrs[i] = addr.EncodeAddress()\n\t\ti++\n\t}\n\n\terr := NotifyNewTXs(CurrentServerConn(), addrstrs)\n\tif err != nil {\n\t\tlog.Error(\"Unable to request transaction updates for address.\")\n\t}\n\n\tfor _, txout := range a.TxStore.UnspentOutputs() {\n\t\tReqSpentUtxoNtfn(txout)\n\t}\n}",
"func (_TokensNetwork *TokensNetworkTransactor) UpdateBalanceProofDelegate(opts *bind.TransactOpts, token common.Address, partner common.Address, participant common.Address, transferred_amount *big.Int, locksroot [32]byte, nonce uint64, additional_hash [32]byte, partner_signature []byte, participant_signature []byte) (*types.Transaction, error) {\n\treturn _TokensNetwork.contract.Transact(opts, \"updateBalanceProofDelegate\", token, partner, participant, transferred_amount, locksroot, nonce, additional_hash, partner_signature, participant_signature)\n}",
"func Delegate(stub shim.ChaincodeStubInterface, args []string) error {\n\tvar vote entities.Vote\n\terr := json.Unmarshal([]byte(args[0]), &vote)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpoll, err := validateDelegate(stub, vote)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = addVoteToPoll(stub, poll, vote)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(\"saving delegate vote\")\n\tutil.UpdateObjectInChain(stub, vote.ID(), util.VotesIndexName, []byte(args[0]))\n\n\tfmt.Println(\"successfully delegated vote to \" + vote.Delegate + \"!\")\n\treturn nil\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
TrackUndelegation tracks an undelegation amount by setting the necessary values by which delegated vesting and delegated vesting need to decrease and by which amount the base coins need to increase. NOTE: The undelegation (bond refund) amount may exceed the delegated vesting (bond) amount due to the way undelegation truncates the bond refund, which can increase the validator's exchange rate (tokens/shares) slightly if the undelegated tokens are nonintegral. CONTRACT: The account's coins and undelegation coins must be sorted.
|
func (bva *BaseVestingAccount) TrackUndelegation(amount sdk.Coins) {
for _, coin := range amount {
// panic if the undelegation amount is zero
if coin.Amount.IsZero() {
panic("undelegation attempt with zero coins")
}
delegatedFree := bva.DelegatedFree.AmountOf(coin.Denom)
delegatedVesting := bva.DelegatedVesting.AmountOf(coin.Denom)
// compute x and y per the specification, where:
// X := min(DF, D)
// Y := min(DV, D - X)
x := sdk.MinInt(delegatedFree, coin.Amount)
y := sdk.MinInt(delegatedVesting, coin.Amount.Sub(x))
if !x.IsZero() {
xCoin := sdk.NewCoin(coin.Denom, x)
bva.DelegatedFree = bva.DelegatedFree.Sub(sdk.Coins{xCoin})
}
if !y.IsZero() {
yCoin := sdk.NewCoin(coin.Denom, y)
bva.DelegatedVesting = bva.DelegatedVesting.Sub(sdk.Coins{yCoin})
}
}
}
|
[
"func (bva *BaseVestingAccount) TrackUndelegation(amount sdk.Coins) {\n\tfor _, coin := range amount {\n\t\t// panic if the undelegation amount is zero\n\t\tif coin.Amount.IsZero() {\n\t\t\tpanic(\"undelegation attempt with zero coins\")\n\t\t}\n\t\tdelegatedFree := bva.DelegatedFree.AmountOf(coin.Denom)\n\t\tdelegatedVesting := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// compute modules and y per the specification, where:\n\t\t// X := min(DF, D)\n\t\t// Y := min(DV, D - X)\n\t\tx := sdk.MinInt(delegatedFree, coin.Amount)\n\t\ty := sdk.MinInt(delegatedVesting, coin.Amount.Sub(x))\n\n\t\tif !x.IsZero() {\n\t\t\txCoin := sdk.NewCoin(coin.Denom, x)\n\t\t\tbva.DelegatedFree = bva.DelegatedFree.Sub(sdk.Coins{xCoin})\n\t\t}\n\n\t\tif !y.IsZero() {\n\t\t\tyCoin := sdk.NewCoin(coin.Denom, y)\n\t\t\tbva.DelegatedVesting = bva.DelegatedVesting.Sub(sdk.Coins{yCoin})\n\t\t}\n\n\t\tbva.Coins = bva.Coins.Add(sdk.Coins{coin})\n\t}\n}",
"func (bva *BaseVestingAccount) TrackDelegation(balance, vestingCoins, amount sdk.Coins) {\n\tfor _, coin := range amount {\n\t\tbaseAmt := balance.AmountOf(coin.Denom)\n\t\tvestingAmt := vestingCoins.AmountOf(coin.Denom)\n\t\tdelVestingAmt := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// Panic if the delegation amount is zero or if the base coins does not\n\t\t// exceed the desired delegation amount.\n\t\tif coin.Amount.IsZero() || baseAmt.LT(coin.Amount) {\n\t\t\tpanic(\"delegation attempt with zero coins or insufficient funds\")\n\t\t}\n\n\t\t// compute x and y per the specification, where:\n\t\t// X := min(max(V - DV, 0), D)\n\t\t// Y := D - X\n\t\tx := sdk.MinInt(sdk.MaxInt(vestingAmt.Sub(delVestingAmt), sdk.ZeroInt()), coin.Amount)\n\t\ty := coin.Amount.Sub(x)\n\n\t\tif !x.IsZero() {\n\t\t\txCoin := sdk.NewCoin(coin.Denom, x)\n\t\t\tbva.DelegatedVesting = bva.DelegatedVesting.Add(xCoin)\n\t\t}\n\n\t\tif !y.IsZero() {\n\t\t\tyCoin := sdk.NewCoin(coin.Denom, y)\n\t\t\tbva.DelegatedFree = bva.DelegatedFree.Add(yCoin)\n\t\t}\n\t}\n}",
"func (bva *BaseVestingAccount) trackDelegation(vestingCoins, amount sdk.Coins) {\n\tbc := bva.GetCoins()\n\n\tfor _, coin := range amount {\n\t\t// zip/lineup all coins by their denomination to provide O(n) time\n\n\t\tbaseAmt := bc.AmountOf(coin.Denom)\n\t\tvestingAmt := vestingCoins.AmountOf(coin.Denom)\n\t\tdelVestingAmt := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// Panic if the delegation amount is zero or if the base coins does not\n\t\t// exceed the desired delegation amount.\n\t\tif coin.Amount.IsZero() || baseAmt.LT(coin.Amount) {\n\t\t\tpanic(\"delegation attempt with zero coins or insufficient funds\")\n\t\t}\n\n\t\t// compute modules and y per the specification, where:\n\t\t// X := min(max(V - DV, 0), D)\n\t\t// Y := D - X\n\t\tx := sdk.MinInt(sdk.MaxInt(vestingAmt.Sub(delVestingAmt), sdk.ZeroInt()), coin.Amount)\n\t\ty := coin.Amount.Sub(x)\n\n\t\tif !x.IsZero() {\n\t\t\txCoin := sdk.NewCoin(coin.Denom, x)\n\t\t\tbva.DelegatedVesting = bva.DelegatedVesting.Add(sdk.Coins{xCoin})\n\t\t}\n\n\t\tif !y.IsZero() {\n\t\t\tyCoin := sdk.NewCoin(coin.Denom, y)\n\t\t\tbva.DelegatedFree = bva.DelegatedFree.Add(sdk.Coins{yCoin})\n\t\t}\n\n\t\tbva.Coins = bva.Coins.Sub(sdk.Coins{coin})\n\t}\n}",
"func (_BondingManager *BondingManagerCaller) DelegatorUnbondedAmount(opts *bind.CallOpts, _delegator common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _BondingManager.contract.Call(opts, out, \"delegatorUnbondedAmount\", _delegator)\n\treturn *ret0, err\n}",
"func (k msgServer) Undelegate(ctx context.Context, msg *types.MsgUndelegate) (*types.MsgUndelegateResponse, error) {\n\taddr, err := k.validatorAddressCodec.StringToBytes(msg.ValidatorAddress)\n\tif err != nil {\n\t\treturn nil, sdkerrors.ErrInvalidAddress.Wrapf(\"invalid validator address: %s\", err)\n\t}\n\n\tdelegatorAddress, err := k.authKeeper.AddressCodec().StringToBytes(msg.DelegatorAddress)\n\tif err != nil {\n\t\treturn nil, sdkerrors.ErrInvalidAddress.Wrapf(\"invalid delegator address: %s\", err)\n\t}\n\n\tif !msg.Amount.IsValid() || !msg.Amount.Amount.IsPositive() {\n\t\treturn nil, errorsmod.Wrap(\n\t\t\tsdkerrors.ErrInvalidRequest,\n\t\t\t\"invalid shares amount\",\n\t\t)\n\t}\n\n\tshares, err := k.ValidateUnbondAmount(\n\t\tctx, delegatorAddress, addr, msg.Amount.Amount,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbondDenom, err := k.BondDenom(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif msg.Amount.Denom != bondDenom {\n\t\treturn nil, errorsmod.Wrapf(\n\t\t\tsdkerrors.ErrInvalidRequest, \"invalid coin denomination: got %s, expected %s\", msg.Amount.Denom, bondDenom,\n\t\t)\n\t}\n\n\tcompletionTime, undelegatedAmt, err := k.Keeper.Undelegate(ctx, delegatorAddress, addr, shares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tundelegatedCoin := sdk.NewCoin(msg.Amount.Denom, undelegatedAmt)\n\n\tif msg.Amount.Amount.IsInt64() {\n\t\tdefer func() {\n\t\t\ttelemetry.IncrCounter(1, types.ModuleName, \"undelegate\")\n\t\t\ttelemetry.SetGaugeWithLabels(\n\t\t\t\t[]string{\"tx\", \"msg\", sdk.MsgTypeURL(msg)},\n\t\t\t\tfloat32(msg.Amount.Amount.Int64()),\n\t\t\t\t[]metrics.Label{telemetry.NewLabel(\"denom\", msg.Amount.Denom)},\n\t\t\t)\n\t\t}()\n\t}\n\n\tsdkCtx := sdk.UnwrapSDKContext(ctx)\n\tsdkCtx.EventManager().EmitEvents(sdk.Events{\n\t\tsdk.NewEvent(\n\t\t\ttypes.EventTypeUnbond,\n\t\t\tsdk.NewAttribute(types.AttributeKeyValidator, msg.ValidatorAddress),\n\t\t\tsdk.NewAttribute(sdk.AttributeKeyAmount, undelegatedCoin.String()),\n\t\t\tsdk.NewAttribute(types.AttributeKeyCompletionTime, completionTime.Format(time.RFC3339)),\n\t\t),\n\t})\n\n\treturn &types.MsgUndelegateResponse{\n\t\tCompletionTime: completionTime,\n\t\tAmount: undelegatedCoin,\n\t}, nil\n}",
"func (_BondingManager *BondingManagerCallerSession) DelegatorUnbondedAmount(_delegator common.Address) (*big.Int, error) {\n\treturn _BondingManager.Contract.DelegatorUnbondedAmount(&_BondingManager.CallOpts, _delegator)\n}",
"func (k msgServer) Undelegate(goCtx context.Context, msg *types.MsgUndelegate) (*types.MsgUndelegateResponse, error) {\n\tctx := sdk.UnwrapSDKContext(goCtx)\n\n\taddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdelegatorAddress, err := sdk.AccAddressFromBech32(msg.DelegatorAddress)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttokens := msg.Amount.Amount\n\tshares, err := k.ValidateUnbondAmount(\n\t\tctx, delegatorAddress, addr, tokens,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvalidator, found := k.GetValidator(ctx, addr)\n\tif !found {\n\t\treturn nil, types.ErrNoValidatorFound\n\t}\n\n\tdelegation, found := k.GetDelegation(ctx, delegatorAddress, addr)\n\tif !found {\n\t\treturn nil, status.Errorf(\n\t\t\tcodes.NotFound,\n\t\t\t\"delegation with delegator %s not found for validator %s\",\n\t\t\tmsg.DelegatorAddress, msg.ValidatorAddress,\n\t\t)\n\t}\n\n\t// if this is a validator self-bond, the new liquid delegation cannot fall below the self-bond * bond factor\n\tif delegation.ValidatorBond {\n\t\tif err := k.SafelyDecreaseValidatorBond(ctx, &validator, shares); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// if this delegation is from a liquid staking provider (identified if the delegator\n\t// is an ICA account), the global and validator liquid totals should be decremented\n\tif k.DelegatorIsLiquidStaker(delegatorAddress) {\n\t\tif err := k.DecreaseTotalLiquidStakedTokens(ctx, tokens); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif err := k.DecreaseValidatorLiquidShares(ctx, &validator, shares); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tbondDenom := k.BondDenom(ctx)\n\tif msg.Amount.Denom != bondDenom {\n\t\treturn nil, sdkerrors.Wrapf(\n\t\t\tsdkerrors.ErrInvalidRequest, \"invalid coin denomination: got %s, expected %s\", msg.Amount.Denom, bondDenom,\n\t\t)\n\t}\n\n\tcompletionTime, err := k.Keeper.Undelegate(ctx, delegatorAddress, addr, shares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif tokens.IsInt64() {\n\t\tdefer func() {\n\t\t\ttelemetry.IncrCounter(1, types.ModuleName, \"undelegate\")\n\t\t\ttelemetry.SetGaugeWithLabels(\n\t\t\t\t[]string{\"tx\", \"msg\", msg.Type()},\n\t\t\t\tfloat32(tokens.Int64()),\n\t\t\t\t[]metrics.Label{telemetry.NewLabel(\"denom\", msg.Amount.Denom)},\n\t\t\t)\n\t\t}()\n\t}\n\n\tctx.EventManager().EmitEvents(sdk.Events{\n\t\tsdk.NewEvent(\n\t\t\ttypes.EventTypeUnbond,\n\t\t\tsdk.NewAttribute(types.AttributeKeyValidator, msg.ValidatorAddress),\n\t\t\tsdk.NewAttribute(sdk.AttributeKeyAmount, msg.Amount.String()),\n\t\t\tsdk.NewAttribute(types.AttributeKeyCompletionTime, completionTime.Format(time.RFC3339)),\n\t\t),\n\t})\n\n\treturn &types.MsgUndelegateResponse{\n\t\tCompletionTime: completionTime,\n\t}, nil\n}",
"func (dva *DelayedVestingAccount) TrackDelegation(blockTime time.Time, balance, amount sdk.Coins) {\n\tdva.BaseVestingAccount.TrackDelegation(balance, dva.GetVestingCoins(blockTime), amount)\n}",
"func (dva *DelayedVestingAccount) TrackDelegation(blockTime time.Time, amount sdk.Coins) {\n\tdva.trackDelegation(dva.GetVestingCoins(blockTime), amount)\n}",
"func (k msgServer) CancelUnbondingDelegation(goCtx context.Context, msg *types.MsgCancelUnbondingDelegation) (*types.MsgCancelUnbondingDelegationResponse, error) {\n\tctx := sdk.UnwrapSDKContext(goCtx)\n\n\tvalAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdelegatorAddress, err := sdk.AccAddressFromBech32(msg.DelegatorAddress)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbondDenom := k.BondDenom(ctx)\n\tif msg.Amount.Denom != bondDenom {\n\t\treturn nil, sdkerrors.Wrapf(\n\t\t\tsdkerrors.ErrInvalidRequest, \"invalid coin denomination: got %s, expected %s\", msg.Amount.Denom, bondDenom,\n\t\t)\n\t}\n\n\tvalidator, found := k.GetValidator(ctx, valAddr)\n\tif !found {\n\t\treturn nil, types.ErrNoValidatorFound\n\t}\n\n\t// In some situations, the exchange rate becomes invalid, e.g. if\n\t// Validator loses all tokens due to slashing. In this case,\n\t// make all future delegations invalid.\n\tif validator.InvalidExRate() {\n\t\treturn nil, types.ErrDelegatorShareExRateInvalid\n\t}\n\n\tif validator.IsJailed() {\n\t\treturn nil, types.ErrValidatorJailed\n\t}\n\n\tubd, found := k.GetUnbondingDelegation(ctx, delegatorAddress, valAddr)\n\tif !found {\n\t\treturn nil, status.Errorf(\n\t\t\tcodes.NotFound,\n\t\t\t\"unbonding delegation with delegator %s not found for validator %s\",\n\t\t\tmsg.DelegatorAddress, msg.ValidatorAddress,\n\t\t)\n\t}\n\n\t// if this undelegation was from a liquid staking provider (identified if the delegator\n\t// is an ICA account), the global and validator liquid totals should be incremented\n\ttokens := msg.Amount.Amount\n\tshares, err := validator.SharesFromTokens(tokens)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif k.DelegatorIsLiquidStaker(delegatorAddress) {\n\t\tif err := k.SafelyIncreaseTotalLiquidStakedTokens(ctx, tokens, false); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif err := k.SafelyIncreaseValidatorLiquidShares(ctx, &validator, shares); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tvar (\n\t\tunbondEntry types.UnbondingDelegationEntry\n\t\tunbondEntryIndex int64 = -1\n\t)\n\n\tfor i, entry := range ubd.Entries {\n\t\tif entry.CreationHeight == msg.CreationHeight {\n\t\t\tunbondEntry = entry\n\t\t\tunbondEntryIndex = int64(i)\n\t\t\tbreak\n\t\t}\n\t}\n\tif unbondEntryIndex == -1 {\n\t\treturn nil, sdkerrors.ErrNotFound.Wrapf(\"unbonding delegation entry is not found at block height %d\", msg.CreationHeight)\n\t}\n\n\tif unbondEntry.Balance.LT(msg.Amount.Amount) {\n\t\treturn nil, sdkerrors.ErrInvalidRequest.Wrap(\"amount is greater than the unbonding delegation entry balance\")\n\t}\n\n\tif unbondEntry.CompletionTime.Before(ctx.BlockTime()) {\n\t\treturn nil, sdkerrors.ErrInvalidRequest.Wrap(\"unbonding delegation is already processed\")\n\t}\n\n\t// delegate back the unbonding delegation amount to the validator\n\t_, err = k.Keeper.Delegate(ctx, delegatorAddress, msg.Amount.Amount, types.Unbonding, validator, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tamount := unbondEntry.Balance.Sub(msg.Amount.Amount)\n\tif amount.IsZero() {\n\t\tubd.RemoveEntry(unbondEntryIndex)\n\t} else {\n\t\t// update the unbondingDelegationEntryBalance and InitialBalance for ubd entry\n\t\tunbondEntry.Balance = amount\n\t\tunbondEntry.InitialBalance = unbondEntry.InitialBalance.Sub(msg.Amount.Amount)\n\t\tubd.Entries[unbondEntryIndex] = unbondEntry\n\t}\n\n\t// set the unbonding delegation or remove it if there are no more entries\n\tif len(ubd.Entries) == 0 {\n\t\tk.RemoveUnbondingDelegation(ctx, ubd)\n\t} else {\n\t\tk.SetUnbondingDelegation(ctx, ubd)\n\t}\n\n\tctx.EventManager().EmitEvent(\n\t\tsdk.NewEvent(\n\t\t\ttypes.EventTypeCancelUnbondingDelegation,\n\t\t\tsdk.NewAttribute(sdk.AttributeKeyAmount, msg.Amount.String()),\n\t\t\tsdk.NewAttribute(types.AttributeKeyValidator, msg.ValidatorAddress),\n\t\t\tsdk.NewAttribute(types.AttributeKeyDelegator, msg.DelegatorAddress),\n\t\t\tsdk.NewAttribute(types.AttributeKeyCreationHeight, strconv.FormatInt(msg.CreationHeight, 10)),\n\t\t),\n\t)\n\n\treturn &types.MsgCancelUnbondingDelegationResponse{}, nil\n}",
"func (va *ClawbackVestingAccount) updateDelegation(encumbered, toClawBack, bonded, unbonding, unbonded sdk.Coins) sdk.Coins {\n\tdelegated := bonded.Add(unbonding...)\n\toldDelegated := va.DelegatedVesting.Add(va.DelegatedFree...)\n\tslashed := oldDelegated.Sub(coinsMin(delegated, oldDelegated))\n\ttotal := delegated.Add(unbonded...)\n\ttoClawBack = coinsMin(toClawBack, total) // might have been slashed\n\tnewDelegated := coinsMin(delegated, total.Sub(toClawBack)).Add(slashed...)\n\tva.DelegatedVesting = coinsMin(encumbered, newDelegated)\n\tva.DelegatedFree = newDelegated.Sub(va.DelegatedVesting)\n\treturn toClawBack\n}",
"func (k Querier) DelegatorUnbondingDelegations(ctx context.Context, req *types.QueryDelegatorUnbondingDelegationsRequest) (*types.QueryDelegatorUnbondingDelegationsResponse, error) {\n\tif req == nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"empty request\")\n\t}\n\n\tif req.DelegatorAddr == \"\" {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"delegator address cannot be empty\")\n\t}\n\tvar unbondingDelegations types.UnbondingDelegations\n\n\tdelAddr, err := k.authKeeper.AddressCodec().StringToBytes(req.DelegatorAddr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, pageRes, err := query.CollectionPaginate(\n\t\tctx,\n\t\tk.UnbondingDelegations,\n\t\treq.Pagination,\n\t\tfunc(key collections.Pair[[]byte, []byte], value types.UnbondingDelegation) (types.UnbondingDelegation, error) {\n\t\t\tunbondingDelegations = append(unbondingDelegations, value)\n\t\t\treturn value, nil\n\t\t},\n\t\tquery.WithCollectionPaginationPairPrefix[[]byte, []byte](delAddr),\n\t)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\treturn &types.QueryDelegatorUnbondingDelegationsResponse{\n\t\tUnbondingResponses: unbondingDelegations, Pagination: pageRes,\n\t}, nil\n}",
"func (_SfcContract *SfcContractFilterer) WatchUndelegated(opts *bind.WatchOpts, sink chan<- *SfcContractUndelegated, delegator []common.Address, toValidatorID []*big.Int, wrID []*big.Int) (event.Subscription, error) {\n\n\tvar delegatorRule []interface{}\n\tfor _, delegatorItem := range delegator {\n\t\tdelegatorRule = append(delegatorRule, delegatorItem)\n\t}\n\tvar toValidatorIDRule []interface{}\n\tfor _, toValidatorIDItem := range toValidatorID {\n\t\ttoValidatorIDRule = append(toValidatorIDRule, toValidatorIDItem)\n\t}\n\tvar wrIDRule []interface{}\n\tfor _, wrIDItem := range wrID {\n\t\twrIDRule = append(wrIDRule, wrIDItem)\n\t}\n\n\tlogs, sub, err := _SfcContract.contract.WatchLogs(opts, \"Undelegated\", delegatorRule, toValidatorIDRule, wrIDRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(SfcContractUndelegated)\n\t\t\t\tif err := _SfcContract.contract.UnpackLog(event, \"Undelegated\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}",
"func (k Keeper) unbond(ctx sdk.Context, delegatorAddr, validatorAddr sdk.AccAddress,\n\tshares sdk.Rat) (amount sdk.Rat, err sdk.Error) {\n\n\t// check if delegation has any shares in it unbond\n\tdelegation, found := k.GetDelegation(ctx, delegatorAddr, validatorAddr)\n\tif !found {\n\t\terr = types.ErrNoDelegatorForAddress(k.Codespace())\n\t\treturn\n\t}\n\n\t// retrieve the amount to remove\n\tif delegation.Shares.LT(shares) {\n\t\terr = types.ErrNotEnoughDelegationShares(k.Codespace(), delegation.Shares.String())\n\t\treturn\n\t}\n\n\t// get validator\n\tvalidator, found := k.GetValidator(ctx, validatorAddr)\n\tif !found {\n\t\terr = types.ErrNoValidatorFound(k.Codespace())\n\t\treturn\n\t}\n\n\t// subtract shares from delegator\n\tdelegation.Shares = delegation.Shares.Sub(shares)\n\n\t// remove the delegation\n\tif delegation.Shares.IsZero() {\n\n\t\t// if the delegation is the owner of the validator then\n\t\t// trigger a revoke validator\n\t\tif bytes.Equal(delegation.DelegatorAddr, validator.Owner) && validator.Revoked == false {\n\t\t\tvalidator.Revoked = true\n\t\t}\n\t\tk.RemoveDelegation(ctx, delegation)\n\t} else {\n\t\t// Update height\n\t\tdelegation.Height = ctx.BlockHeight()\n\t\tk.SetDelegation(ctx, delegation)\n\t}\n\n\t// remove the coins from the validator\n\tpool := k.GetPool(ctx)\n\tvalidator, pool, amount = validator.RemoveDelShares(pool, shares)\n\n\tk.SetPool(ctx, pool)\n\n\t// update then remove validator if necessary\n\tvalidator = k.UpdateValidator(ctx, validator)\n\tif validator.DelegatorShares.IsZero() {\n\t\tk.RemoveValidator(ctx, validator.Owner)\n\t}\n\n\treturn\n}",
"func (_Staking *StakingTransactorSession) DelegatorUnbond(_tokenAmount *big.Int, _nodeAddr common.Address) (*types.Transaction, error) {\n\treturn _Staking.Contract.DelegatorUnbond(&_Staking.TransactOpts, _tokenAmount, _nodeAddr)\n}",
"func (_Staking *StakingSession) DelegatorUnbond(_tokenAmount *big.Int, _nodeAddr common.Address) (*types.Transaction, error) {\n\treturn _Staking.Contract.DelegatorUnbond(&_Staking.TransactOpts, _tokenAmount, _nodeAddr)\n}",
"func (_SfcContract *SfcContractTransactor) Undelegate(opts *bind.TransactOpts, toValidatorID *big.Int, wrID *big.Int, amount *big.Int) (*types.Transaction, error) {\n\treturn _SfcContract.contract.Transact(opts, \"undelegate\", toValidatorID, wrID, amount)\n}",
"func (k Querier) ValidatorUnbondingDelegations(ctx context.Context, req *types.QueryValidatorUnbondingDelegationsRequest) (*types.QueryValidatorUnbondingDelegationsResponse, error) {\n\tif req == nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"empty request\")\n\t}\n\n\tif req.ValidatorAddr == \"\" {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"validator address cannot be empty\")\n\t}\n\n\tvalAddr, err := k.validatorAddressCodec.StringToBytes(req.ValidatorAddr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstore := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))\n\tkeys, pageRes, err := query.CollectionPaginate(\n\t\tctx,\n\t\tk.UnbondingDelegationByValIndex,\n\t\treq.Pagination,\n\t\tfunc(key collections.Pair[[]byte, []byte], value []byte) (collections.Pair[[]byte, []byte], error) {\n\t\t\treturn key, nil\n\t\t},\n\t\tquery.WithCollectionPaginationPairPrefix[[]byte, []byte](valAddr),\n\t)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\t// loop over the collected keys and fetch unbonding delegations\n\tvar ubds []types.UnbondingDelegation\n\tfor _, key := range keys {\n\t\tvalAddr := key.K1()\n\t\tdelAddr := key.K2()\n\t\tubdKey := types.GetUBDKey(delAddr, valAddr)\n\t\tstoreValue := store.Get(ubdKey)\n\n\t\tubd, err := types.UnmarshalUBD(k.cdc, storeValue)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tubds = append(ubds, ubd)\n\t}\n\n\treturn &types.QueryValidatorUnbondingDelegationsResponse{\n\t\tUnbondingResponses: ubds,\n\t\tPagination: pageRes,\n\t}, nil\n}",
"func (k Querier) UnbondingDelegation(ctx context.Context, req *types.QueryUnbondingDelegationRequest) (*types.QueryUnbondingDelegationResponse, error) {\n\tif req == nil {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"empty request\")\n\t}\n\n\tif req.DelegatorAddr == \"\" {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"delegator address cannot be empty\")\n\t}\n\tif req.ValidatorAddr == \"\" {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"validator address cannot be empty\")\n\t}\n\n\tdelAddr, err := k.authKeeper.AddressCodec().StringToBytes(req.DelegatorAddr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvalAddr, err := k.validatorAddressCodec.StringToBytes(req.ValidatorAddr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tunbond, err := k.GetUnbondingDelegation(ctx, delAddr, valAddr)\n\tif err != nil {\n\t\treturn nil, status.Errorf(\n\t\t\tcodes.NotFound,\n\t\t\t\"unbonding delegation with delegator %s not found for validator %s\",\n\t\t\treq.DelegatorAddr, req.ValidatorAddr)\n\t}\n\n\treturn &types.QueryUnbondingDelegationResponse{Unbond: unbond}, nil\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetOriginalVesting returns a vesting account's original vesting amount
|
func (bva BaseVestingAccount) GetOriginalVesting() sdk.Coins {
return bva.OriginalVesting
}
|
[
"func (o *Transaction) GetOriginalAmount() float64 {\n\tif o == nil || o.OriginalAmount.Get() == nil {\n\t\tvar ret float64\n\t\treturn ret\n\t}\n\n\treturn *o.OriginalAmount.Get()\n}",
"func (plva PermanentLockedAccount) GetVestingCoins(_ time.Time) sdk.Coins {\n\treturn plva.OriginalVesting\n}",
"func (va ClawbackVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn va.OriginalVesting.Sub(va.GetVestedCoins(blockTime))\n}",
"func (dva DelayedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn dva.OriginalVesting.Sub(dva.GetVestedCoins(blockTime))\n}",
"func (vva ValidatorVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn vva.OriginalVesting.Sub(vva.GetVestedCoins(blockTime))\n}",
"func (o *Transaction) SetOriginalAmount(v float64) {\n\to.OriginalAmount.Set(&v)\n}",
"func (_TokenVesting *TokenVestingCaller) VestedAmount(opts *bind.CallOpts, _token common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _TokenVesting.contract.Call(opts, out, \"vestedAmount\", _token)\n\treturn *ret0, err\n}",
"func (_TokenVesting *TokenVestingCallerSession) VestedAmount(_token common.Address) (*big.Int, error) {\n\treturn _TokenVesting.Contract.VestedAmount(&_TokenVesting.CallOpts, _token)\n}",
"func (bva BaseVestingAccount) GetDelegatedVesting() sdk.Coins {\n\treturn bva.DelegatedVesting\n}",
"func (cva ContinuousVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn cva.OriginalVesting.Sub(cva.GetVestedCoins(blockTime))\n}",
"func (o *GetRecipeInformation200ResponseExtendedIngredientsInner) GetOriginal() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Original\n}",
"func (dva DelayedVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tif blockTime.Unix() >= dva.EndTime {\n\t\treturn dva.OriginalVesting\n\t}\n\n\treturn nil\n}",
"func (m *AgedAccountsPayable) GetCurrentAmount()(*float64) {\n val, err := m.GetBackingStore().Get(\"currentAmount\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*float64)\n }\n return nil\n}",
"func (va ClawbackVestingAccount) GetVestedOnly(blockTime time.Time) sdk.Coins {\n\treturn ReadSchedule(va.StartTime, va.EndTime, va.VestingPeriods, va.OriginalVesting, blockTime.Unix())\n}",
"func (v *Version) Original() string {\n\treturn v.original\n}",
"func (ds *DepositToStake) Amount() *big.Int { return ds.amount }",
"func (m *PurchaseInvoiceLine) GetAmountIncludingTax()(*float64) {\n val, err := m.GetBackingStore().Get(\"amountIncludingTax\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*float64)\n }\n return nil\n}",
"func (o GoogleCloudRetailV2alphaPriceInfoResponseOutput) OriginalPrice() pulumi.Float64Output {\n\treturn o.ApplyT(func(v GoogleCloudRetailV2alphaPriceInfoResponse) float64 { return v.OriginalPrice }).(pulumi.Float64Output)\n}",
"func (m *PurchaseInvoiceLine) GetNetAmountIncludingTax()(*float64) {\n val, err := m.GetBackingStore().Get(\"netAmountIncludingTax\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*float64)\n }\n return nil\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetDelegatedFree returns a vesting account's delegation amount that is not vesting.
|
func (bva BaseVestingAccount) GetDelegatedFree() sdk.Coins {
return bva.DelegatedFree
}
|
[
"func (del Delegation) AmountDelegated() hexutil.Big {\n\tif del.Delegation.AmountDelegated == nil {\n\t\treturn hexutil.Big{}\n\t}\n\treturn *del.Delegation.AmountDelegated\n}",
"func (_BondingManager *BondingManagerCaller) DelegatorUnbondedAmount(opts *bind.CallOpts, _delegator common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _BondingManager.contract.Call(opts, out, \"delegatorUnbondedAmount\", _delegator)\n\treturn *ret0, err\n}",
"func (_BondingManager *BondingManagerCallerSession) DelegatorUnbondedAmount(_delegator common.Address) (*big.Int, error) {\n\treturn _BondingManager.Contract.DelegatorUnbondedAmount(&_BondingManager.CallOpts, _delegator)\n}",
"func (bva BaseVestingAccount) GetDelegatedVesting() sdk.Coins {\n\treturn bva.DelegatedVesting\n}",
"func (b *rpcVestingBalance) delegated() (sdk.Coins, sdk.Coins, error) {\n\tdelegatedCoins, err := b.totalDelegated()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tunbondingCoins, err := b.totalUnbondingDelegations()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tdelegated := delegatedCoins.AmountOf(stakingDenom)\n\tunbonding := unbondingCoins.AmountOf(stakingDenom)\n\ttotalStaked := delegated.Add(unbonding)\n\tdelegatedFree := b.vacc.GetDelegatedFree().AmountOf(stakingDenom)\n\n\t// total number of staked and unbonding tokens considered to be liquid\n\ttotalFree := sdk.MinInt(totalStaked, delegatedFree)\n\t// any coins that are not considered liquid, are vesting up to a maximum of delegated\n\tstakedVesting := sdk.MinInt(totalStaked.Sub(totalFree), delegated)\n\t// staked free coins are left over\n\tstakedFree := delegated.Sub(stakedVesting)\n\n\tliquidCoins := sdk.NewCoins(newKavaCoin(stakedFree))\n\tvestingCoins := sdk.NewCoins(newKavaCoin(stakedVesting))\n\treturn liquidCoins, vestingCoins, nil\n}",
"func (_Staking *StakingCaller) DelegatorWithdrawAble(opts *bind.CallOpts, _owner common.Address, _nodeAddr common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Staking.contract.Call(opts, out, \"delegatorWithdrawAble\", _owner, _nodeAddr)\n\treturn *ret0, err\n}",
"func (_BondingManager *BondingManagerSession) GetDelegator(_delegator common.Address) (struct {\n\tBondedAmount *big.Int\n\tUnbondedAmount *big.Int\n\tDelegateAddress common.Address\n\tDelegatedAmount *big.Int\n\tStartRound *big.Int\n\tWithdrawRound *big.Int\n\tLastClaimTokenPoolsSharesRound *big.Int\n}, error) {\n\treturn _BondingManager.Contract.GetDelegator(&_BondingManager.CallOpts, _delegator)\n}",
"func (_BondingManager *BondingManagerCallerSession) GetDelegator(_delegator common.Address) (struct {\n\tBondedAmount *big.Int\n\tUnbondedAmount *big.Int\n\tDelegateAddress common.Address\n\tDelegatedAmount *big.Int\n\tStartRound *big.Int\n\tWithdrawRound *big.Int\n\tLastClaimTokenPoolsSharesRound *big.Int\n}, error) {\n\treturn _BondingManager.Contract.GetDelegator(&_BondingManager.CallOpts, _delegator)\n}",
"func (_DelegationController *DelegationControllerTransactor) GetAndUpdateDelegatedAmount(opts *bind.TransactOpts, holder common.Address) (*types.Transaction, error) {\n\treturn _DelegationController.contract.Transact(opts, \"getAndUpdateDelegatedAmount\", holder)\n}",
"func (_DelegationController *DelegationControllerTransactor) GetAndUpdateForbiddenForDelegationAmount(opts *bind.TransactOpts, wallet common.Address) (*types.Transaction, error) {\n\treturn _DelegationController.contract.Transact(opts, \"getAndUpdateForbiddenForDelegationAmount\", wallet)\n}",
"func (del Delegation) Amount() (hexutil.Big, error) {\n\t// get the base amount delegated\n\tbase, err := repository.R().DelegationAmountStaked(&del.Address, del.Delegation.ToStakerId)\n\tif err != nil {\n\t\treturn hexutil.Big{}, err\n\t}\n\n\t// get the sum of all pending withdrawals\n\twd, err := del.pendingWithdrawalsValue()\n\tif err != nil {\n\t\treturn hexutil.Big{}, err\n\t}\n\tval := new(big.Int).Add(base, wd)\n\treturn (hexutil.Big)(*val), nil\n}",
"func (_DelegationController *DelegationControllerTransactorSession) GetAndUpdateDelegatedAmount(holder common.Address) (*types.Transaction, error) {\n\treturn _DelegationController.Contract.GetAndUpdateDelegatedAmount(&_DelegationController.TransactOpts, holder)\n}",
"func (_DelegationController *DelegationControllerTransactorSession) GetAndUpdateForbiddenForDelegationAmount(wallet common.Address) (*types.Transaction, error) {\n\treturn _DelegationController.Contract.GetAndUpdateForbiddenForDelegationAmount(&_DelegationController.TransactOpts, wallet)\n}",
"func (_Genesis *GenesisCallerSession) DelegationAmountLimit() (*big.Int, error) {\n\treturn _Genesis.Contract.DelegationAmountLimit(&_Genesis.CallOpts)\n}",
"func (_Genesis *GenesisSession) DelegationAmountLimit() (*big.Int, error) {\n\treturn _Genesis.Contract.DelegationAmountLimit(&_Genesis.CallOpts)\n}",
"func (_Staking *StakingCallerSession) DelegatorWithdrawAble(_owner common.Address, _nodeAddr common.Address) (*big.Int, error) {\n\treturn _Staking.Contract.DelegatorWithdrawAble(&_Staking.CallOpts, _owner, _nodeAddr)\n}",
"func (acc *Account) delegationsTotal() (amount *big.Int, inWithdraw *big.Int, rewards *big.Int, err error) {\n\t// pull all the delegations of the account\n\tlist, err := repository.R().DelegationsByAddressAll(&acc.Address)\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\n\t// prep containers for calculation and loop all delegations found\n\tamount = new(big.Int)\n\trewards = new(big.Int)\n\tinWithdraw = new(big.Int)\n\tfor _, dlg := range list {\n\t\t// any active delegated amount?\n\t\tif 0 < dlg.AmountDelegated.ToInt().Uint64() {\n\t\t\tamount = new(big.Int).Add(amount, dlg.AmountDelegated.ToInt())\n\t\t}\n\n\t\t// get pending rewards for this delegation (can be stashed)\n\t\trw, err := repository.R().PendingRewards(&acc.Address, dlg.ToStakerId)\n\t\tif err != nil {\n\t\t\treturn nil, nil, nil, err\n\t\t}\n\n\t\t// any rewards?\n\t\tif 0 < rw.Amount.ToInt().Uint64() {\n\t\t\trewards = new(big.Int).Add(rewards, rw.Amount.ToInt())\n\t\t}\n\n\t\t// get pending withdrawals\n\t\twd, err := repository.R().WithdrawRequestsPendingTotal(&acc.Address, dlg.ToStakerId)\n\t\tif err != nil {\n\t\t\treturn nil, nil, nil, err\n\t\t}\n\n\t\t// add pending withdrawals value\n\t\tif 0 < wd.Uint64() {\n\t\t\tinWithdraw = new(big.Int).Add(inWithdraw, wd)\n\t\t}\n\t}\n\n\treturn amount, rewards, inWithdraw, nil\n}",
"func (pr *ProvenAccountResource) GetDelegatedWithdrawalCapability() bool {\n\tif !pr.proven {\n\t\tpanic(\"not valid proven account resource\")\n\t}\n\treturn pr.accountResource.DelegatedWithdrawalCapability\n}",
"func (del Delegation) UnlockedAmount() (hexutil.Big, error) {\n\treturn repository.R().DelegationAmountUnlocked(&del.Address, (*big.Int)(del.Delegation.ToStakerId))\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetDelegatedVesting returns a vesting account's delegation amount that is still vesting.
|
func (bva BaseVestingAccount) GetDelegatedVesting() sdk.Coins {
return bva.DelegatedVesting
}
|
[
"func (b *rpcVestingBalance) delegated() (sdk.Coins, sdk.Coins, error) {\n\tdelegatedCoins, err := b.totalDelegated()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tunbondingCoins, err := b.totalUnbondingDelegations()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tdelegated := delegatedCoins.AmountOf(stakingDenom)\n\tunbonding := unbondingCoins.AmountOf(stakingDenom)\n\ttotalStaked := delegated.Add(unbonding)\n\tdelegatedFree := b.vacc.GetDelegatedFree().AmountOf(stakingDenom)\n\n\t// total number of staked and unbonding tokens considered to be liquid\n\ttotalFree := sdk.MinInt(totalStaked, delegatedFree)\n\t// any coins that are not considered liquid, are vesting up to a maximum of delegated\n\tstakedVesting := sdk.MinInt(totalStaked.Sub(totalFree), delegated)\n\t// staked free coins are left over\n\tstakedFree := delegated.Sub(stakedVesting)\n\n\tliquidCoins := sdk.NewCoins(newKavaCoin(stakedFree))\n\tvestingCoins := sdk.NewCoins(newKavaCoin(stakedVesting))\n\treturn liquidCoins, vestingCoins, nil\n}",
"func (bva BaseVestingAccount) GetDelegatedFree() sdk.Coins {\n\treturn bva.DelegatedFree\n}",
"func (del Delegation) AmountDelegated() hexutil.Big {\n\tif del.Delegation.AmountDelegated == nil {\n\t\treturn hexutil.Big{}\n\t}\n\treturn *del.Delegation.AmountDelegated\n}",
"func (api *API) GetVestingDelegations(account, from string, limit uint32) (*json.RawMessage, error) {\n\tvar resp json.RawMessage\n\terr := api.call(\"get_vesting_delegations\", []interface{}{account, from, limit}, &resp)\n\treturn &resp, err\n}",
"func (_DelegationController *DelegationControllerTransactor) GetAndUpdateDelegatedAmount(opts *bind.TransactOpts, holder common.Address) (*types.Transaction, error) {\n\treturn _DelegationController.contract.Transact(opts, \"getAndUpdateDelegatedAmount\", holder)\n}",
"func (_DelegationController *DelegationControllerTransactorSession) GetAndUpdateDelegatedAmount(holder common.Address) (*types.Transaction, error) {\n\treturn _DelegationController.Contract.GetAndUpdateDelegatedAmount(&_DelegationController.TransactOpts, holder)\n}",
"func (bva *BaseVestingAccount) TrackDelegation(balance, vestingCoins, amount sdk.Coins) {\n\tfor _, coin := range amount {\n\t\tbaseAmt := balance.AmountOf(coin.Denom)\n\t\tvestingAmt := vestingCoins.AmountOf(coin.Denom)\n\t\tdelVestingAmt := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// Panic if the delegation amount is zero or if the base coins does not\n\t\t// exceed the desired delegation amount.\n\t\tif coin.Amount.IsZero() || baseAmt.LT(coin.Amount) {\n\t\t\tpanic(\"delegation attempt with zero coins or insufficient funds\")\n\t\t}\n\n\t\t// compute x and y per the specification, where:\n\t\t// X := min(max(V - DV, 0), D)\n\t\t// Y := D - X\n\t\tx := sdk.MinInt(sdk.MaxInt(vestingAmt.Sub(delVestingAmt), sdk.ZeroInt()), coin.Amount)\n\t\ty := coin.Amount.Sub(x)\n\n\t\tif !x.IsZero() {\n\t\t\txCoin := sdk.NewCoin(coin.Denom, x)\n\t\t\tbva.DelegatedVesting = bva.DelegatedVesting.Add(xCoin)\n\t\t}\n\n\t\tif !y.IsZero() {\n\t\t\tyCoin := sdk.NewCoin(coin.Denom, y)\n\t\t\tbva.DelegatedFree = bva.DelegatedFree.Add(yCoin)\n\t\t}\n\t}\n}",
"func (bva *BaseVestingAccount) trackDelegation(vestingCoins, amount sdk.Coins) {\n\tbc := bva.GetCoins()\n\n\tfor _, coin := range amount {\n\t\t// zip/lineup all coins by their denomination to provide O(n) time\n\n\t\tbaseAmt := bc.AmountOf(coin.Denom)\n\t\tvestingAmt := vestingCoins.AmountOf(coin.Denom)\n\t\tdelVestingAmt := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// Panic if the delegation amount is zero or if the base coins does not\n\t\t// exceed the desired delegation amount.\n\t\tif coin.Amount.IsZero() || baseAmt.LT(coin.Amount) {\n\t\t\tpanic(\"delegation attempt with zero coins or insufficient funds\")\n\t\t}\n\n\t\t// compute modules and y per the specification, where:\n\t\t// X := min(max(V - DV, 0), D)\n\t\t// Y := D - X\n\t\tx := sdk.MinInt(sdk.MaxInt(vestingAmt.Sub(delVestingAmt), sdk.ZeroInt()), coin.Amount)\n\t\ty := coin.Amount.Sub(x)\n\n\t\tif !x.IsZero() {\n\t\t\txCoin := sdk.NewCoin(coin.Denom, x)\n\t\t\tbva.DelegatedVesting = bva.DelegatedVesting.Add(sdk.Coins{xCoin})\n\t\t}\n\n\t\tif !y.IsZero() {\n\t\t\tyCoin := sdk.NewCoin(coin.Denom, y)\n\t\t\tbva.DelegatedFree = bva.DelegatedFree.Add(sdk.Coins{yCoin})\n\t\t}\n\n\t\tbva.Coins = bva.Coins.Sub(sdk.Coins{coin})\n\t}\n}",
"func (_Genesis *GenesisCallerSession) DelegationAmountLimit() (*big.Int, error) {\n\treturn _Genesis.Contract.DelegationAmountLimit(&_Genesis.CallOpts)\n}",
"func (del Delegation) Amount() (hexutil.Big, error) {\n\t// get the base amount delegated\n\tbase, err := repository.R().DelegationAmountStaked(&del.Address, del.Delegation.ToStakerId)\n\tif err != nil {\n\t\treturn hexutil.Big{}, err\n\t}\n\n\t// get the sum of all pending withdrawals\n\twd, err := del.pendingWithdrawalsValue()\n\tif err != nil {\n\t\treturn hexutil.Big{}, err\n\t}\n\tval := new(big.Int).Add(base, wd)\n\treturn (hexutil.Big)(*val), nil\n}",
"func (_Genesis *GenesisSession) DelegationAmountLimit() (*big.Int, error) {\n\treturn _Genesis.Contract.DelegationAmountLimit(&_Genesis.CallOpts)\n}",
"func (_BondingManager *BondingManagerSession) GetDelegator(_delegator common.Address) (struct {\n\tBondedAmount *big.Int\n\tUnbondedAmount *big.Int\n\tDelegateAddress common.Address\n\tDelegatedAmount *big.Int\n\tStartRound *big.Int\n\tWithdrawRound *big.Int\n\tLastClaimTokenPoolsSharesRound *big.Int\n}, error) {\n\treturn _BondingManager.Contract.GetDelegator(&_BondingManager.CallOpts, _delegator)\n}",
"func (_BondingManager *BondingManagerCallerSession) GetDelegator(_delegator common.Address) (struct {\n\tBondedAmount *big.Int\n\tUnbondedAmount *big.Int\n\tDelegateAddress common.Address\n\tDelegatedAmount *big.Int\n\tStartRound *big.Int\n\tWithdrawRound *big.Int\n\tLastClaimTokenPoolsSharesRound *big.Int\n}, error) {\n\treturn _BondingManager.Contract.GetDelegator(&_BondingManager.CallOpts, _delegator)\n}",
"func (del Delegation) LockedAmount() (hexutil.Big, error) {\n\tlock, err := del.DelegationLock()\n\tif err != nil {\n\t\treturn hexutil.Big{}, err\n\t}\n\treturn lock.LockedAmount, nil\n}",
"func (n *node) DelegatorStakedAmount(ctx context.Context, validatorSMCAddress, delegatorAddress string) (*big.Int, error) {\n\tpayload, err := n.validatorSMC.Abi.Pack(\"delegationByAddr\", common.HexToAddress(delegatorAddress))\n\tif err != nil {\n\t\tn.lgr.Error(\"Error packing delegator staked amount payload: \", zap.Error(err))\n\t\treturn nil, err\n\t}\n\tres, err := n.KardiaCall(ctx, ConstructCallArgs(validatorSMCAddress, payload))\n\tif err != nil {\n\t\tn.lgr.Error(\"DelegatorStakedAmount KardiaCall error: \", zap.Error(err))\n\t\treturn nil, err\n\t}\n\n\tvar result struct {\n\t\tStake *big.Int\n\t\tPreviousPeriod *big.Int\n\t\tHeight *big.Int\n\t\tShares *big.Int\n\t\tOwner common.Address\n\t}\n\t// unpack result\n\terr = n.validatorSMC.Abi.UnpackIntoInterface(&result, \"delegationByAddr\", res)\n\tif err != nil {\n\t\tn.lgr.Error(\"Error unpacking delegator's staked amount: \", zap.Error(err))\n\t\treturn nil, err\n\t}\n\treturn result.Stake, nil\n}",
"func (_Genesis *GenesisCaller) CurrentTotalDelegated(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Genesis.contract.Call(opts, out, \"currentTotalDelegated\")\n\treturn *ret0, err\n}",
"func (_TokenStakingEscrow *TokenStakingEscrowSession) DepositRedelegatedAmount(operator common.Address) (*big.Int, error) {\n\treturn _TokenStakingEscrow.Contract.DepositRedelegatedAmount(&_TokenStakingEscrow.CallOpts, operator)\n}",
"func (del Delegation) AmountInWithdraw() (hexutil.Big, error) {\n\t// lazy load data\n\tif del.extendedAmountInWithdraw == nil {\n\t\tvar err error\n\n\t\t// try to load the data\n\t\tdel.extendedAmount, del.extendedAmountInWithdraw, err = del.repo.DelegatedAmountExtended(&del.Delegation)\n\t\tif err != nil {\n\t\t\treturn hexutil.Big{}, err\n\t\t}\n\t}\n\n\treturn (hexutil.Big)(*del.extendedAmountInWithdraw), nil\n}",
"func (_BondingManager *BondingManagerCallerSession) DelegatorUnbondedAmount(_delegator common.Address) (*big.Int, error) {\n\treturn _BondingManager.Contract.DelegatorUnbondedAmount(&_BondingManager.CallOpts, _delegator)\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetEndTime returns a vesting account's end time
|
func (bva BaseVestingAccount) GetEndTime() int64 {
return bva.EndTime
}
|
[
"func (dva *DelayedVestingAccount) GetEndTime() int64 {\n\treturn dva.EndTime\n}",
"func (cva *ContinuousVestingAccount) GetEndTime() int64 {\n\treturn cva.EndTime\n}",
"func (plva PermanentLockedAccount) GetEndTime() int64 {\n\treturn 0\n}",
"func (o *ApplianceSetupInfo) GetEndTime() time.Time {\n\tif o == nil || o.EndTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.EndTime\n}",
"func (m *TimeRange) GetEndTime()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly) {\n return m.endTime\n}",
"func (o *ApplianceSetupInfoAllOf) GetEndTime() time.Time {\n\tif o == nil || o.EndTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.EndTime\n}",
"func (m *TimeRange) GetEndTime()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly) {\n val, err := m.GetBackingStore().Get(\"endTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly)\n }\n return nil\n}",
"func GetEndTime(days int) time.Time {\n\tvar result time.Time\n\n\tloc := GetLocation()\n\tn := time.Now().In(loc)\n\tresult = time.Date(n.Year(), n.Month(), n.Day(), 23, 59, 0, 0, loc)\n\tresult = result.Add((4 * 24) * time.Hour)\n\n\treturn result\n}",
"func (m *SimulationAutomationRun) GetEndDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n return m.endDateTime\n}",
"func (req *StartWFSRequest) GetEndTime() time.Time {\n\treturn req.EndTime\n}",
"func (o *WorkflowWorkflowInfoAllOf) GetEndTime() time.Time {\n\tif o == nil || o.EndTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.EndTime\n}",
"func (v *Validator) EndTime() time.Time {\n\treturn time.Unix(int64(v.End), 0)\n}",
"func (r Reservation) EndTime() string {\n\thr := r.End / 60\n\tmin := r.End % 60\n\tvar ampm string\n\tif ampm = \"AM\"; hr >= 12 {\n\t\tampm = \"PM\"\n\t}\n\tif hr > 12 {\n\t\thr = hr - 12\n\t}\n\tif hr == 0 {\n\t\thr = 12\n\t}\n\treturn fmt.Sprintf(\"%02d:%02d %s\", hr, min, ampm)\n}",
"func (m *SimulationAutomationRun) GetEndDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"endDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}",
"func (m *UnifiedRoleAssignmentScheduleInstance) GetEndDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"endDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}",
"func (m *BookingWorkTimeSlot) GetEnd()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly) {\n val, err := m.GetBackingStore().Get(\"end\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly)\n }\n return nil\n}",
"func (m *MeetingAttendanceReport) GetMeetingEndDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n return m.meetingEndDateTime\n}",
"func (o *Job) GetExpectedEndTime(ctx context.Context) (expectedEndTime uint64, err error) {\n\terr = o.object.CallWithContext(ctx, \"org.freedesktop.DBus.Properties.Get\", 0, InterfaceJob, \"ExpectedEndTime\").Store(&expectedEndTime)\n\treturn\n}",
"func (ts TimeSpan) End() time.Time { return ts.end }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
MarshalYAML returns the YAML representation of a BaseVestingAccount.
|
func (bva BaseVestingAccount) MarshalYAML() (interface{}, error) {
accAddr, err := sdk.AccAddressFromBech32(bva.Address)
if err != nil {
return nil, err
}
out := vestingAccountYAML{
Address: accAddr,
AccountNumber: bva.AccountNumber,
PubKey: getPKString(bva),
Sequence: bva.Sequence,
OriginalVesting: bva.OriginalVesting,
DelegatedFree: bva.DelegatedFree,
DelegatedVesting: bva.DelegatedVesting,
EndTime: bva.EndTime,
}
return marshalYaml(out)
}
|
[
"func (va ClawbackVestingAccount) MarshalYAML() (interface{}, error) {\n\taccAddr, err := sdk.AccAddressFromBech32(va.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := vestingAccountYAML{\n\t\tAddress: accAddr,\n\t\tAccountNumber: va.AccountNumber,\n\t\tPubKey: getPKString(va),\n\t\tSequence: va.Sequence,\n\t\tOriginalVesting: va.OriginalVesting,\n\t\tDelegatedFree: va.DelegatedFree,\n\t\tDelegatedVesting: va.DelegatedVesting,\n\t\tEndTime: va.EndTime,\n\t\tStartTime: va.StartTime,\n\t\tVestingPeriods: va.VestingPeriods,\n\t}\n\treturn marshalYaml(out)\n}",
"func (cva ContinuousVestingAccount) MarshalYAML() (interface{}, error) {\n\taccAddr, err := sdk.AccAddressFromBech32(cva.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := vestingAccountYAML{\n\t\tAddress: accAddr,\n\t\tAccountNumber: cva.AccountNumber,\n\t\tPubKey: getPKString(cva),\n\t\tSequence: cva.Sequence,\n\t\tOriginalVesting: cva.OriginalVesting,\n\t\tDelegatedFree: cva.DelegatedFree,\n\t\tDelegatedVesting: cva.DelegatedVesting,\n\t\tEndTime: cva.EndTime,\n\t\tStartTime: cva.StartTime,\n\t}\n\treturn marshalYaml(out)\n}",
"func (pva PeriodicVestingAccount) MarshalYAML() (interface{}, error) {\n\taccAddr, err := sdk.AccAddressFromBech32(pva.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := vestingAccountYAML{\n\t\tAddress: accAddr,\n\t\tAccountNumber: pva.AccountNumber,\n\t\tPubKey: getPKString(pva),\n\t\tSequence: pva.Sequence,\n\t\tOriginalVesting: pva.OriginalVesting,\n\t\tDelegatedFree: pva.DelegatedFree,\n\t\tDelegatedVesting: pva.DelegatedVesting,\n\t\tEndTime: pva.EndTime,\n\t\tStartTime: pva.StartTime,\n\t\tVestingPeriods: pva.VestingPeriods,\n\t}\n\treturn marshalYaml(out)\n}",
"func (acc BaseAccount) MarshalYAML() (interface{}, error) {\n\tvar bs []byte\n\tvar err error\n\tvar pubkey string\n\n\tif acc.PubKey != nil {\n\t\tpubkey, err = sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, acc.PubKey)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tbs, err = yaml.Marshal(struct {\n\t\tAddress sdk.AccAddress\n\t\tCoins sdk.Coins\n\t\tPubKey string\n\t\tAccountNumber uint64\n\t\tSequence uint64\n\t}{\n\t\tAddress: acc.Address,\n\t\tCoins: acc.Coins,\n\t\tPubKey: pubkey,\n\t\tAccountNumber: acc.AccountNumber,\n\t\tSequence: acc.Sequence,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn string(bs), err\n}",
"func (i Instance) MarshalYAML() (interface{}, error) {\n\treturn i.Vars, nil\n}",
"func (b *Backend) MarshalYAML() (interface{}, error) {\n\tb.mu.RLock()\n\tdefer b.mu.RUnlock()\n\n\tpayload := struct {\n\t\tAddress string\n\t\tDisabledUntil time.Time `yaml:\"disabledUntil\"`\n\t\tForcePromotionsAfter time.Duration `yaml:\"forcePromotionsAfter\"`\n\t\tLatency time.Duration `yaml:\"latency\"`\n\t\tMaxConnections int `yaml:\"maxConnections\"`\n\t\tTier int `yaml:\"tier\"`\n\t}{\n\t\tAddress: b.addr.String(),\n\t\tDisabledUntil: b.mu.disabledUntil,\n\t\tForcePromotionsAfter: b.mu.forcePromotionAfter,\n\t\tLatency: b.mu.lastLatency,\n\t\tMaxConnections: b.mu.maxConnections,\n\t\tTier: b.mu.tier,\n\t}\n\treturn payload, nil\n}",
"func (o *OAuthFlow) MarshalYAML() (interface{}, error) {\n\tnb := high.NewNodeBuilder(o, o.low)\n\treturn nb.Render(), nil\n}",
"func (a Authentication) MarshalYAML() (interface{}, error) {\n\tvalues := make(map[string]interface{})\n\n\tif a.AccessToken != \"\" {\n\t\tvalues[accessToken] = a.AccessToken\n\t}\n\tif a.APIKey != \"\" {\n\t\tvalues[apiKey] = a.APIKey\n\t}\n\tif a.ClientId != \"\" {\n\t\tvalues[clientID] = a.ClientId\n\t}\n\tif a.ClientSecret != \"\" {\n\t\tvalues[clientSecret] = a.ClientSecret\n\t}\n\tif a.IdentityProvider != nil {\n\t\tif a.IdentityProvider.TokenURL != \"\" {\n\t\t\tvalues[idPTokenURL] = a.IdentityProvider.TokenURL\n\t\t}\n\t\tif a.IdentityProvider.Audience != \"\" {\n\t\t\tvalues[idPAudience] = a.IdentityProvider.Audience\n\t\t}\n\t\t//values[idP] = a.IdentityProvider\n\t}\n\tif a.RefreshToken != \"\" {\n\t\tvalues[refreshToken] = a.RefreshToken\n\t}\n\tif a.P12Task != \"\" {\n\t\tvalues[p12Task] = a.P12Task\n\t}\n\tif a.Scope != \"\" {\n\t\tvalues[scope] = a.Scope\n\t}\n\n\treturn values, nil\n}",
"func (s *Secret) MarshalYAML() (interface{}, error) {\n\treturn \"<secret>\", nil\n}",
"func (i UserGroupAccess) MarshalYAML() (interface{}, error) {\n\treturn i.String(), nil\n}",
"func (key PrivateKey) MarshalYAML() (interface{}, error) {\n\treturn key.String(), nil\n}",
"func (r WeekdayRange) MarshalYAML() (interface{}, error) {\n\tbytes, err := r.MarshalText()\n\treturn string(bytes), err\n}",
"func (key PublicKey) MarshalYAML() (interface{}, error) {\n\treturn key.String(), nil\n}",
"func (i SecVerb) MarshalYAML() (interface{}, error) {\n\treturn i.String(), nil\n}",
"func (tz Location) MarshalYAML() (interface{}, error) {\n\tbytes, err := tz.MarshalText()\n\treturn string(bytes), err\n}",
"func MarshalYaml(v interface{}) []byte {\n\tdata, err := yaml.Marshal(v)\n\tPanicIf(err)\n\treturn data\n}",
"func (in PluginConfig) MarshalYAML() (interface{}, error) {\n\traw := map[string]interface{}{\n\t\t\"name\": in.Name,\n\t\t\"plugin\": in.PluginSubKey,\n\t}\n\t// Don't add the config for unmarshal unless something is defined\n\tif len(in.Config.Raw) != 0 {\n\t\tvar rawCfg = map[string]interface{}{}\n\t\traw[\"config\"] = rawCfg\n\t\tif err := json.Unmarshal(in.Config.Raw, &rawCfg); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"could not marshal the plugin config to json\")\n\t\t}\n\t}\n\n\treturn raw, nil\n}",
"func (k PrivateKey) MarshalYAML() (interface{}, error) {\n\treturn k.Path, nil\n}",
"func (k Key) MarshalYAML() (interface{}, error) {\n\treturn k.String(), nil\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
NewContinuousVestingAccountRaw creates a new ContinuousVestingAccount object from BaseVestingAccount
|
func NewContinuousVestingAccountRaw(bva *BaseVestingAccount, startTime int64) *ContinuousVestingAccount {
return &ContinuousVestingAccount{
BaseVestingAccount: bva,
StartTime: startTime,
}
}
|
[
"func NewContinuousVestingAccountRaw(bva *BaseVestingAccount,\n\tstartTime int64) *ContinuousVestingAccount {\n\n\treturn &ContinuousVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t}\n}",
"func NewContinuousVestingAccount(baseAcc *BaseAccount, startTime, endTime int64) *ContinuousVestingAccount {\n\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ContinuousVestingAccount{\n\t\tStartTime: startTime,\n\t\tBaseVestingAccount: baseVestingAcc,\n\t}\n}",
"func NewContinuousVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime, endTime int64) *ContinuousVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ContinuousVestingAccount{\n\t\tStartTime: startTime,\n\t\tBaseVestingAccount: baseVestingAcc,\n\t}\n}",
"func NewPeriodicVestingAccountRaw(bva *BaseVestingAccount, startTime int64, periods Periods) *PeriodicVestingAccount {\n\treturn &PeriodicVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func NewBaseVestingAccount(baseAccount *authtypes.BaseAccount, originalVesting sdk.Coins, endTime int64) *BaseVestingAccount {\n\treturn &BaseVestingAccount{\n\t\tBaseAccount: baseAccount,\n\t\tOriginalVesting: originalVesting,\n\t\tDelegatedFree: sdk.NewCoins(),\n\t\tDelegatedVesting: sdk.NewCoins(),\n\t\tEndTime: endTime,\n\t}\n}",
"func NewValidatorVestingAccountRaw(bva *vestingtypes.BaseVestingAccount,\n\tstartTime int64, periods vestingtypes.Periods, validatorAddress sdk.ConsAddress, returnAddress sdk.AccAddress, signingThreshold int64) *ValidatorVestingAccount {\n\n\tpva := &vestingtypes.PeriodicVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n\tvar vestingPeriodProgress []VestingProgress\n\tfor i := 0; i < len(periods); i++ {\n\t\tvestingPeriodProgress = append(vestingPeriodProgress, VestingProgress{false, false})\n\t}\n\n\treturn &ValidatorVestingAccount{\n\t\tPeriodicVestingAccount: pva,\n\t\tValidatorAddress: validatorAddress,\n\t\tReturnAddress: returnAddress,\n\t\tSigningThreshold: signingThreshold,\n\t\tCurrentPeriodProgress: CurrentPeriodProgress{0, 0},\n\t\tVestingPeriodProgress: vestingPeriodProgress,\n\t\tDebtAfterFailedVesting: sdk.NewCoins(),\n\t}\n}",
"func NewDelayedVestingAccountRaw(bva *BaseVestingAccount) *DelayedVestingAccount {\n\treturn &DelayedVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t}\n}",
"func NewBaseVestingAccount(baseAccount *BaseAccount, originalVesting sdk.Coins,\n\tdelegatedFree sdk.Coins, delegatedVesting sdk.Coins, endTime int64) *BaseVestingAccount {\n\n\treturn &BaseVestingAccount{\n\t\tBaseAccount: baseAccount,\n\t\tOriginalVesting: originalVesting,\n\t\tDelegatedFree: delegatedFree,\n\t\tDelegatedVesting: delegatedVesting,\n\t\tEndTime: endTime,\n\t}\n}",
"func NewPeriodicVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime int64, periods Periods) *PeriodicVestingAccount {\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func newPeriodicVestingAccount(address sdk.AccAddress, periods vestingtypes.Periods, firstPeriodStartTimestamp int64) *vestingtypes.PeriodicVestingAccount {\n\tbaseAccount := authtypes.NewBaseAccount(address, nil, 0, 0)\n\n\toriginalVesting := sdk.NewCoins()\n\tfor _, p := range periods {\n\t\toriginalVesting = originalVesting.Add(p.Amount...)\n\t}\n\n\tvar totalPeriods int64\n\tfor _, p := range periods {\n\t\ttotalPeriods += p.Length\n\t}\n\tendTime := firstPeriodStartTimestamp + totalPeriods\n\n\tbaseVestingAccount := vestingtypes.NewBaseVestingAccount(baseAccount, originalVesting, endTime)\n\treturn vestingtypes.NewPeriodicVestingAccountRaw(baseVestingAccount, firstPeriodStartTimestamp, periods)\n}",
"func NewGenesisAccountRaw(address sdk.AccAddress, coins sdk.Coins, moduleName string) GenesisAccount {\n\tacc := auth.NewBaseAccount(address, coins, nil, 0, 0)\n\n\treturn GenesisAccount{\n\t\tBaseAccount: *acc,\n\t\tModuleName: moduleName,\n\t}\n}",
"func newAccount() *Account {\n\taccount := &Account{}\n\taccount.NativeBalance = Balance{NativeAsset, \"0\", \"\"}\n\taccount.Signers = []Signer{\n\t\tSigner{},\n\t}\n\taccount.Balances = []Balance{}\n\n\treturn account\n}",
"func NewClawbackVestingAccount(baseAcc *authtypes.BaseAccount, funder sdk.AccAddress, originalVesting sdk.Coins, startTime int64, lockupPeriods, vestingPeriods Periods) *ClawbackVestingAccount {\n\t// copy and align schedules to avoid mutating inputs\n\tlp := make(Periods, len(lockupPeriods))\n\tcopy(lp, lockupPeriods)\n\tvp := make(Periods, len(vestingPeriods))\n\tcopy(vp, vestingPeriods)\n\t_, endTime := AlignSchedules(startTime, startTime, lp, vp)\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ClawbackVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tFunderAddress: funder.String(),\n\t\tStartTime: startTime,\n\t\tLockupPeriods: lp,\n\t\tVestingPeriods: vp,\n\t}\n}",
"func NewRawTx(txType byte) *RawTx {\n\treturn &RawTx{\n\t\tType: txType,\n\t\tVersion: 0,\n\t}\n}",
"func NewValidatorVestingAccount(baseAcc *authtypes.BaseAccount, startTime int64, periods vestingtypes.Periods, validatorAddress sdk.ConsAddress, returnAddress sdk.AccAddress, signingThreshold int64) *ValidatorVestingAccount {\n\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &vestingtypes.BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\tpva := &vestingtypes.PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n\tvar vestingPeriodProgress []VestingProgress\n\tfor i := 0; i < len(periods); i++ {\n\t\tvestingPeriodProgress = append(vestingPeriodProgress, VestingProgress{false, false})\n\t}\n\n\treturn &ValidatorVestingAccount{\n\t\tPeriodicVestingAccount: pva,\n\t\tValidatorAddress: validatorAddress,\n\t\tReturnAddress: returnAddress,\n\t\tSigningThreshold: signingThreshold,\n\t\tCurrentPeriodProgress: CurrentPeriodProgress{0, 0},\n\t\tVestingPeriodProgress: vestingPeriodProgress,\n\t\tDebtAfterFailedVesting: sdk.NewCoins(),\n\t}\n}",
"func NewCoinbase(proof, score, R []byte) *Coinbase {\n\treturn &Coinbase{\n\t\tProof: proof,\n\t\tScore: score,\n\t\tR: R,\n\t}\n}",
"func NewDelayedVestingAccount(baseAcc *BaseAccount, endTime int64) *DelayedVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &DelayedVestingAccount{baseVestingAcc}\n}",
"func (c *Jrpc) CreateRawTransaction(in *pty.ReqCreatePrivacyTx, result *interface{}) error {\n\treply, err := c.cli.CreateRawTransaction(context.Background(), in)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*result = hex.EncodeToString(types.Encode(reply))\n\treturn err\n}",
"func NewDelayedVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, endTime int64) *DelayedVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &DelayedVestingAccount{baseVestingAcc}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
NewContinuousVestingAccount returns a new ContinuousVestingAccount
|
func NewContinuousVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime, endTime int64) *ContinuousVestingAccount {
baseVestingAcc := &BaseVestingAccount{
BaseAccount: baseAcc,
OriginalVesting: originalVesting,
EndTime: endTime,
}
return &ContinuousVestingAccount{
StartTime: startTime,
BaseVestingAccount: baseVestingAcc,
}
}
|
[
"func NewContinuousVestingAccount(baseAcc *BaseAccount, startTime, endTime int64) *ContinuousVestingAccount {\n\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ContinuousVestingAccount{\n\t\tStartTime: startTime,\n\t\tBaseVestingAccount: baseVestingAcc,\n\t}\n}",
"func NewContinuousVestingAccountRaw(bva *BaseVestingAccount,\n\tstartTime int64) *ContinuousVestingAccount {\n\n\treturn &ContinuousVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t}\n}",
"func NewContinuousVestingAccountRaw(bva *BaseVestingAccount, startTime int64) *ContinuousVestingAccount {\n\treturn &ContinuousVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t}\n}",
"func NewPeriodicVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime int64, periods Periods) *PeriodicVestingAccount {\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func newPeriodicVestingAccount(address sdk.AccAddress, periods vestingtypes.Periods, firstPeriodStartTimestamp int64) *vestingtypes.PeriodicVestingAccount {\n\tbaseAccount := authtypes.NewBaseAccount(address, nil, 0, 0)\n\n\toriginalVesting := sdk.NewCoins()\n\tfor _, p := range periods {\n\t\toriginalVesting = originalVesting.Add(p.Amount...)\n\t}\n\n\tvar totalPeriods int64\n\tfor _, p := range periods {\n\t\ttotalPeriods += p.Length\n\t}\n\tendTime := firstPeriodStartTimestamp + totalPeriods\n\n\tbaseVestingAccount := vestingtypes.NewBaseVestingAccount(baseAccount, originalVesting, endTime)\n\treturn vestingtypes.NewPeriodicVestingAccountRaw(baseVestingAccount, firstPeriodStartTimestamp, periods)\n}",
"func NewBaseVestingAccount(baseAccount *authtypes.BaseAccount, originalVesting sdk.Coins, endTime int64) *BaseVestingAccount {\n\treturn &BaseVestingAccount{\n\t\tBaseAccount: baseAccount,\n\t\tOriginalVesting: originalVesting,\n\t\tDelegatedFree: sdk.NewCoins(),\n\t\tDelegatedVesting: sdk.NewCoins(),\n\t\tEndTime: endTime,\n\t}\n}",
"func NewClawbackVestingAccount(baseAcc *authtypes.BaseAccount, funder sdk.AccAddress, originalVesting sdk.Coins, startTime int64, lockupPeriods, vestingPeriods Periods) *ClawbackVestingAccount {\n\t// copy and align schedules to avoid mutating inputs\n\tlp := make(Periods, len(lockupPeriods))\n\tcopy(lp, lockupPeriods)\n\tvp := make(Periods, len(vestingPeriods))\n\tcopy(vp, vestingPeriods)\n\t_, endTime := AlignSchedules(startTime, startTime, lp, vp)\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ClawbackVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tFunderAddress: funder.String(),\n\t\tStartTime: startTime,\n\t\tLockupPeriods: lp,\n\t\tVestingPeriods: vp,\n\t}\n}",
"func NewBaseVestingAccount(baseAccount *BaseAccount, originalVesting sdk.Coins,\n\tdelegatedFree sdk.Coins, delegatedVesting sdk.Coins, endTime int64) *BaseVestingAccount {\n\n\treturn &BaseVestingAccount{\n\t\tBaseAccount: baseAccount,\n\t\tOriginalVesting: originalVesting,\n\t\tDelegatedFree: delegatedFree,\n\t\tDelegatedVesting: delegatedVesting,\n\t\tEndTime: endTime,\n\t}\n}",
"func NewDelayedVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, endTime int64) *DelayedVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &DelayedVestingAccount{baseVestingAcc}\n}",
"func (suite *KeeperTestSuite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) authtypes.AccountI {\n\tif vestingBalance.IsAnyGT(initialBalance) {\n\t\tpanic(\"vesting balance must be less than initial balance\")\n\t}\n\tacc := suite.CreateAccountWithAddress(addr, initialBalance)\n\tbacc := acc.(*authtypes.BaseAccount)\n\n\tperiods := vestingtypes.Periods{\n\t\tvestingtypes.Period{\n\t\t\tLength: 31556952,\n\t\t\tAmount: vestingBalance,\n\t\t},\n\t}\n\tvacc := vestingtypes.NewPeriodicVestingAccount(bacc, vestingBalance, suite.Ctx.BlockTime().Unix(), periods)\n\tsuite.App.GetAccountKeeper().SetAccount(suite.Ctx, vacc)\n\treturn vacc\n}",
"func NewValidatorVestingAccount(baseAcc *authtypes.BaseAccount, startTime int64, periods vestingtypes.Periods, validatorAddress sdk.ConsAddress, returnAddress sdk.AccAddress, signingThreshold int64) *ValidatorVestingAccount {\n\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &vestingtypes.BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\tpva := &vestingtypes.PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n\tvar vestingPeriodProgress []VestingProgress\n\tfor i := 0; i < len(periods); i++ {\n\t\tvestingPeriodProgress = append(vestingPeriodProgress, VestingProgress{false, false})\n\t}\n\n\treturn &ValidatorVestingAccount{\n\t\tPeriodicVestingAccount: pva,\n\t\tValidatorAddress: validatorAddress,\n\t\tReturnAddress: returnAddress,\n\t\tSigningThreshold: signingThreshold,\n\t\tCurrentPeriodProgress: CurrentPeriodProgress{0, 0},\n\t\tVestingPeriodProgress: vestingPeriodProgress,\n\t\tDebtAfterFailedVesting: sdk.NewCoins(),\n\t}\n}",
"func newAccount() *Account {\n\taccount := &Account{}\n\taccount.NativeBalance = Balance{NativeAsset, \"0\", \"\"}\n\taccount.Signers = []Signer{\n\t\tSigner{},\n\t}\n\taccount.Balances = []Balance{}\n\n\treturn account\n}",
"func NewDelayedVestingAccount(baseAcc *BaseAccount, endTime int64) *DelayedVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &DelayedVestingAccount{baseVestingAcc}\n}",
"func MakeNewAccount(name string) (*MyAccount, error) {\n\tkeys, err := NewKeypair()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &MyAccount{\n\t\tFields: make(map[string]string),\n\t\tKeys: keys,\n\t\tName: name,\n\t}, nil\n}",
"func NewPeriodicVestingAccountRaw(bva *BaseVestingAccount, startTime int64, periods Periods) *PeriodicVestingAccount {\n\treturn &PeriodicVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func newAccountForUser(userID string) *account {\n\tvar ac = account{userID: userID}\n\tac.portfolio = make(portfolio)\n\tac.summary = ring.New(summarySize)\n\n\tac.AddSummaryItem(\"Created\")\n\n\treturn &ac\n}",
"func NewTrainCar() TrainCar {\n c := TrainCar{name: \"TrainCar\", vehicle: \"TrainCar\", speed: 30, capacity: 30, railway: \"CNR\"}\n return c\n}",
"func NewAccount(custID string) *Account {\n\treturn &Account{\n\t\tCustID: custID,\n\t}\n}",
"func (e Account) EntNew() ent.Ent { return &Account{} }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetStartTime returns the time when vesting starts for a continuous vesting account.
|
func (cva ContinuousVestingAccount) GetStartTime() int64 {
return cva.StartTime
}
|
[
"func (cva *ContinuousVestingAccount) GetStartTime() int64 {\n\treturn cva.StartTime\n}",
"func (dva DelayedVestingAccount) GetStartTime() int64 {\n\treturn 0\n}",
"func (dva *DelayedVestingAccount) GetStartTime() int64 {\n\treturn 0\n}",
"func (pva PeriodicVestingAccount) GetStartTime() int64 {\n\treturn pva.StartTime\n}",
"func (_Vesting *VestingCallerSession) StartTime() (*big.Int, error) {\n\treturn _Vesting.Contract.StartTime(&_Vesting.CallOpts)\n}",
"func GetStartTime() time.Time {\n\treturn startAtTime\n}",
"func (txn TxnProbe) GetStartTime() time.Time {\n\treturn txn.startTime\n}",
"func GetStartTime() time.Time {\n\treturn session.startTime\n}",
"func (_Vesting *VestingCaller) StartTime(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Vesting.contract.Call(opts, &out, \"startTime\")\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}",
"func (req *StartWFSRequest) GetStartTime() time.Time {\n\treturn req.StartTime\n}",
"func (o *ApplianceSetupInfoAllOf) GetStartTime() time.Time {\n\tif o == nil || o.StartTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.StartTime\n}",
"func (o *ApplianceSetupInfo) GetStartTime() time.Time {\n\tif o == nil || o.StartTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.StartTime\n}",
"func (plva PermanentLockedAccount) GetStartTime() int64 {\n\treturn 0\n}",
"func (r *tektonRun) GetStartTime() *metav1.Time {\n\treturn r.tektonTaskRun.Status.StartTime\n}",
"func (m *TimeRange) GetStartTime()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly) {\n return m.startTime\n}",
"func (m *TimeRange) GetStartTime()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly) {\n val, err := m.GetBackingStore().Get(\"startTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly)\n }\n return nil\n}",
"func (s *Session) GetStartTime() time.Time {\n\treturn s.started\n}",
"func (o *Campaign) GetStartTime() time.Time {\n\tif o == nil || o.StartTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.StartTime\n}",
"func (gm GlobalManager) GetChainStartTime(ctx sdk.Context) (int64, sdk.Error) {\n\tglobalTime, err := gm.storage.GetGlobalTime(ctx)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn globalTime.ChainStartTime, nil\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
MarshalYAML returns the YAML representation of a ContinuousVestingAccount.
|
func (cva ContinuousVestingAccount) MarshalYAML() (interface{}, error) {
accAddr, err := sdk.AccAddressFromBech32(cva.Address)
if err != nil {
return nil, err
}
out := vestingAccountYAML{
Address: accAddr,
AccountNumber: cva.AccountNumber,
PubKey: getPKString(cva),
Sequence: cva.Sequence,
OriginalVesting: cva.OriginalVesting,
DelegatedFree: cva.DelegatedFree,
DelegatedVesting: cva.DelegatedVesting,
EndTime: cva.EndTime,
StartTime: cva.StartTime,
}
return marshalYaml(out)
}
|
[
"func (va ClawbackVestingAccount) MarshalYAML() (interface{}, error) {\n\taccAddr, err := sdk.AccAddressFromBech32(va.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := vestingAccountYAML{\n\t\tAddress: accAddr,\n\t\tAccountNumber: va.AccountNumber,\n\t\tPubKey: getPKString(va),\n\t\tSequence: va.Sequence,\n\t\tOriginalVesting: va.OriginalVesting,\n\t\tDelegatedFree: va.DelegatedFree,\n\t\tDelegatedVesting: va.DelegatedVesting,\n\t\tEndTime: va.EndTime,\n\t\tStartTime: va.StartTime,\n\t\tVestingPeriods: va.VestingPeriods,\n\t}\n\treturn marshalYaml(out)\n}",
"func (bva BaseVestingAccount) MarshalYAML() (interface{}, error) {\n\taccAddr, err := sdk.AccAddressFromBech32(bva.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := vestingAccountYAML{\n\t\tAddress: accAddr,\n\t\tAccountNumber: bva.AccountNumber,\n\t\tPubKey: getPKString(bva),\n\t\tSequence: bva.Sequence,\n\t\tOriginalVesting: bva.OriginalVesting,\n\t\tDelegatedFree: bva.DelegatedFree,\n\t\tDelegatedVesting: bva.DelegatedVesting,\n\t\tEndTime: bva.EndTime,\n\t}\n\treturn marshalYaml(out)\n}",
"func (pva PeriodicVestingAccount) MarshalYAML() (interface{}, error) {\n\taccAddr, err := sdk.AccAddressFromBech32(pva.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := vestingAccountYAML{\n\t\tAddress: accAddr,\n\t\tAccountNumber: pva.AccountNumber,\n\t\tPubKey: getPKString(pva),\n\t\tSequence: pva.Sequence,\n\t\tOriginalVesting: pva.OriginalVesting,\n\t\tDelegatedFree: pva.DelegatedFree,\n\t\tDelegatedVesting: pva.DelegatedVesting,\n\t\tEndTime: pva.EndTime,\n\t\tStartTime: pva.StartTime,\n\t\tVestingPeriods: pva.VestingPeriods,\n\t}\n\treturn marshalYaml(out)\n}",
"func (acc BaseAccount) MarshalYAML() (interface{}, error) {\n\tvar bs []byte\n\tvar err error\n\tvar pubkey string\n\n\tif acc.PubKey != nil {\n\t\tpubkey, err = sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, acc.PubKey)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tbs, err = yaml.Marshal(struct {\n\t\tAddress sdk.AccAddress\n\t\tCoins sdk.Coins\n\t\tPubKey string\n\t\tAccountNumber uint64\n\t\tSequence uint64\n\t}{\n\t\tAddress: acc.Address,\n\t\tCoins: acc.Coins,\n\t\tPubKey: pubkey,\n\t\tAccountNumber: acc.AccountNumber,\n\t\tSequence: acc.Sequence,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn string(bs), err\n}",
"func (o *OAuthFlow) MarshalYAML() (interface{}, error) {\n\tnb := high.NewNodeBuilder(o, o.low)\n\treturn nb.Render(), nil\n}",
"func (i Instance) MarshalYAML() (interface{}, error) {\n\treturn i.Vars, nil\n}",
"func (s *Secret) MarshalYAML() (interface{}, error) {\n\treturn \"<secret>\", nil\n}",
"func (b *Backend) MarshalYAML() (interface{}, error) {\n\tb.mu.RLock()\n\tdefer b.mu.RUnlock()\n\n\tpayload := struct {\n\t\tAddress string\n\t\tDisabledUntil time.Time `yaml:\"disabledUntil\"`\n\t\tForcePromotionsAfter time.Duration `yaml:\"forcePromotionsAfter\"`\n\t\tLatency time.Duration `yaml:\"latency\"`\n\t\tMaxConnections int `yaml:\"maxConnections\"`\n\t\tTier int `yaml:\"tier\"`\n\t}{\n\t\tAddress: b.addr.String(),\n\t\tDisabledUntil: b.mu.disabledUntil,\n\t\tForcePromotionsAfter: b.mu.forcePromotionAfter,\n\t\tLatency: b.mu.lastLatency,\n\t\tMaxConnections: b.mu.maxConnections,\n\t\tTier: b.mu.tier,\n\t}\n\treturn payload, nil\n}",
"func (key PrivateKey) MarshalYAML() (interface{}, error) {\n\treturn key.String(), nil\n}",
"func (r WeekdayRange) MarshalYAML() (interface{}, error) {\n\tbytes, err := r.MarshalText()\n\treturn string(bytes), err\n}",
"func (key PublicKey) MarshalYAML() (interface{}, error) {\n\treturn key.String(), nil\n}",
"func (a Authentication) MarshalYAML() (interface{}, error) {\n\tvalues := make(map[string]interface{})\n\n\tif a.AccessToken != \"\" {\n\t\tvalues[accessToken] = a.AccessToken\n\t}\n\tif a.APIKey != \"\" {\n\t\tvalues[apiKey] = a.APIKey\n\t}\n\tif a.ClientId != \"\" {\n\t\tvalues[clientID] = a.ClientId\n\t}\n\tif a.ClientSecret != \"\" {\n\t\tvalues[clientSecret] = a.ClientSecret\n\t}\n\tif a.IdentityProvider != nil {\n\t\tif a.IdentityProvider.TokenURL != \"\" {\n\t\t\tvalues[idPTokenURL] = a.IdentityProvider.TokenURL\n\t\t}\n\t\tif a.IdentityProvider.Audience != \"\" {\n\t\t\tvalues[idPAudience] = a.IdentityProvider.Audience\n\t\t}\n\t\t//values[idP] = a.IdentityProvider\n\t}\n\tif a.RefreshToken != \"\" {\n\t\tvalues[refreshToken] = a.RefreshToken\n\t}\n\tif a.P12Task != \"\" {\n\t\tvalues[p12Task] = a.P12Task\n\t}\n\tif a.Scope != \"\" {\n\t\tvalues[scope] = a.Scope\n\t}\n\n\treturn values, nil\n}",
"func (i UserGroupAccess) MarshalYAML() (interface{}, error) {\n\treturn i.String(), nil\n}",
"func (ir InclusiveRange) MarshalYAML() (interface{}, error) {\n\tbytes, err := ir.MarshalText()\n\treturn string(bytes), err\n}",
"func (i ChannelName) MarshalYAML() (interface{}, error) {\n\treturn i.String(), nil\n}",
"func (i SecVerb) MarshalYAML() (interface{}, error) {\n\treturn i.String(), nil\n}",
"func (in PluginConfig) MarshalYAML() (interface{}, error) {\n\traw := map[string]interface{}{\n\t\t\"name\": in.Name,\n\t\t\"plugin\": in.PluginSubKey,\n\t}\n\t// Don't add the config for unmarshal unless something is defined\n\tif len(in.Config.Raw) != 0 {\n\t\tvar rawCfg = map[string]interface{}{}\n\t\traw[\"config\"] = rawCfg\n\t\tif err := json.Unmarshal(in.Config.Raw, &rawCfg); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"could not marshal the plugin config to json\")\n\t\t}\n\t}\n\n\treturn raw, nil\n}",
"func (tz Location) MarshalYAML() (interface{}, error) {\n\tbytes, err := tz.MarshalText()\n\treturn string(bytes), err\n}",
"func (k Key) MarshalYAML() (interface{}, error) {\n\treturn k.String(), nil\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
NewPeriodicVestingAccountRaw creates a new PeriodicVestingAccount object from BaseVestingAccount
|
func NewPeriodicVestingAccountRaw(bva *BaseVestingAccount, startTime int64, periods Periods) *PeriodicVestingAccount {
return &PeriodicVestingAccount{
BaseVestingAccount: bva,
StartTime: startTime,
VestingPeriods: periods,
}
}
|
[
"func newPeriodicVestingAccount(address sdk.AccAddress, periods vestingtypes.Periods, firstPeriodStartTimestamp int64) *vestingtypes.PeriodicVestingAccount {\n\tbaseAccount := authtypes.NewBaseAccount(address, nil, 0, 0)\n\n\toriginalVesting := sdk.NewCoins()\n\tfor _, p := range periods {\n\t\toriginalVesting = originalVesting.Add(p.Amount...)\n\t}\n\n\tvar totalPeriods int64\n\tfor _, p := range periods {\n\t\ttotalPeriods += p.Length\n\t}\n\tendTime := firstPeriodStartTimestamp + totalPeriods\n\n\tbaseVestingAccount := vestingtypes.NewBaseVestingAccount(baseAccount, originalVesting, endTime)\n\treturn vestingtypes.NewPeriodicVestingAccountRaw(baseVestingAccount, firstPeriodStartTimestamp, periods)\n}",
"func NewPeriodicVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime int64, periods Periods) *PeriodicVestingAccount {\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func NewValidatorVestingAccountRaw(bva *vestingtypes.BaseVestingAccount,\n\tstartTime int64, periods vestingtypes.Periods, validatorAddress sdk.ConsAddress, returnAddress sdk.AccAddress, signingThreshold int64) *ValidatorVestingAccount {\n\n\tpva := &vestingtypes.PeriodicVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n\tvar vestingPeriodProgress []VestingProgress\n\tfor i := 0; i < len(periods); i++ {\n\t\tvestingPeriodProgress = append(vestingPeriodProgress, VestingProgress{false, false})\n\t}\n\n\treturn &ValidatorVestingAccount{\n\t\tPeriodicVestingAccount: pva,\n\t\tValidatorAddress: validatorAddress,\n\t\tReturnAddress: returnAddress,\n\t\tSigningThreshold: signingThreshold,\n\t\tCurrentPeriodProgress: CurrentPeriodProgress{0, 0},\n\t\tVestingPeriodProgress: vestingPeriodProgress,\n\t\tDebtAfterFailedVesting: sdk.NewCoins(),\n\t}\n}",
"func NewDelayedVestingAccountRaw(bva *BaseVestingAccount) *DelayedVestingAccount {\n\treturn &DelayedVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t}\n}",
"func NewContinuousVestingAccountRaw(bva *BaseVestingAccount,\n\tstartTime int64) *ContinuousVestingAccount {\n\n\treturn &ContinuousVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t}\n}",
"func NewContinuousVestingAccountRaw(bva *BaseVestingAccount, startTime int64) *ContinuousVestingAccount {\n\treturn &ContinuousVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t}\n}",
"func NewBaseVestingAccount(baseAccount *authtypes.BaseAccount, originalVesting sdk.Coins, endTime int64) *BaseVestingAccount {\n\treturn &BaseVestingAccount{\n\t\tBaseAccount: baseAccount,\n\t\tOriginalVesting: originalVesting,\n\t\tDelegatedFree: sdk.NewCoins(),\n\t\tDelegatedVesting: sdk.NewCoins(),\n\t\tEndTime: endTime,\n\t}\n}",
"func NewBaseVestingAccount(baseAccount *BaseAccount, originalVesting sdk.Coins,\n\tdelegatedFree sdk.Coins, delegatedVesting sdk.Coins, endTime int64) *BaseVestingAccount {\n\n\treturn &BaseVestingAccount{\n\t\tBaseAccount: baseAccount,\n\t\tOriginalVesting: originalVesting,\n\t\tDelegatedFree: delegatedFree,\n\t\tDelegatedVesting: delegatedVesting,\n\t\tEndTime: endTime,\n\t}\n}",
"func NewValidatorVestingAccount(baseAcc *authtypes.BaseAccount, startTime int64, periods vestingtypes.Periods, validatorAddress sdk.ConsAddress, returnAddress sdk.AccAddress, signingThreshold int64) *ValidatorVestingAccount {\n\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &vestingtypes.BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\tpva := &vestingtypes.PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n\tvar vestingPeriodProgress []VestingProgress\n\tfor i := 0; i < len(periods); i++ {\n\t\tvestingPeriodProgress = append(vestingPeriodProgress, VestingProgress{false, false})\n\t}\n\n\treturn &ValidatorVestingAccount{\n\t\tPeriodicVestingAccount: pva,\n\t\tValidatorAddress: validatorAddress,\n\t\tReturnAddress: returnAddress,\n\t\tSigningThreshold: signingThreshold,\n\t\tCurrentPeriodProgress: CurrentPeriodProgress{0, 0},\n\t\tVestingPeriodProgress: vestingPeriodProgress,\n\t\tDebtAfterFailedVesting: sdk.NewCoins(),\n\t}\n}",
"func NewContinuousVestingAccount(baseAcc *BaseAccount, startTime, endTime int64) *ContinuousVestingAccount {\n\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ContinuousVestingAccount{\n\t\tStartTime: startTime,\n\t\tBaseVestingAccount: baseVestingAcc,\n\t}\n}",
"func NewContinuousVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime, endTime int64) *ContinuousVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ContinuousVestingAccount{\n\t\tStartTime: startTime,\n\t\tBaseVestingAccount: baseVestingAcc,\n\t}\n}",
"func newAccount() *Account {\n\taccount := &Account{}\n\taccount.NativeBalance = Balance{NativeAsset, \"0\", \"\"}\n\taccount.Signers = []Signer{\n\t\tSigner{},\n\t}\n\taccount.Balances = []Balance{}\n\n\treturn account\n}",
"func NewDelayedVestingAccount(baseAcc *BaseAccount, endTime int64) *DelayedVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &DelayedVestingAccount{baseVestingAcc}\n}",
"func NewDelayedVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, endTime int64) *DelayedVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &DelayedVestingAccount{baseVestingAcc}\n}",
"func NewMsgCreatePeriodicVestingAccount(fromAddr, toAddr sdk.AccAddress, startTime int64, periods []Period) *MsgCreatePeriodicVestingAccount {\n\treturn &MsgCreatePeriodicVestingAccount{\n\t\tFromAddress: fromAddr.String(),\n\t\tToAddress: toAddr.String(),\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func NewGenesisAccountRaw(address sdk.AccAddress, coins sdk.Coins, moduleName string) GenesisAccount {\n\tacc := auth.NewBaseAccount(address, coins, nil, 0, 0)\n\n\treturn GenesisAccount{\n\t\tBaseAccount: *acc,\n\t\tModuleName: moduleName,\n\t}\n}",
"func NewRawTx(txType byte) *RawTx {\n\treturn &RawTx{\n\t\tType: txType,\n\t\tVersion: 0,\n\t}\n}",
"func NewClawbackVestingAccount(baseAcc *authtypes.BaseAccount, funder sdk.AccAddress, originalVesting sdk.Coins, startTime int64, lockupPeriods, vestingPeriods Periods) *ClawbackVestingAccount {\n\t// copy and align schedules to avoid mutating inputs\n\tlp := make(Periods, len(lockupPeriods))\n\tcopy(lp, lockupPeriods)\n\tvp := make(Periods, len(vestingPeriods))\n\tcopy(vp, vestingPeriods)\n\t_, endTime := AlignSchedules(startTime, startTime, lp, vp)\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ClawbackVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tFunderAddress: funder.String(),\n\t\tStartTime: startTime,\n\t\tLockupPeriods: lp,\n\t\tVestingPeriods: vp,\n\t}\n}",
"func newDummyCR(namespace string) runtime.Object {\n\treturn &v1.Pod{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: crKind,\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: crName,\n\t\t\tNamespace: namespace,\n\t\t},\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
NewPeriodicVestingAccount returns a new PeriodicVestingAccount
|
func NewPeriodicVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime int64, periods Periods) *PeriodicVestingAccount {
endTime := startTime
for _, p := range periods {
endTime += p.Length
}
baseVestingAcc := &BaseVestingAccount{
BaseAccount: baseAcc,
OriginalVesting: originalVesting,
EndTime: endTime,
}
return &PeriodicVestingAccount{
BaseVestingAccount: baseVestingAcc,
StartTime: startTime,
VestingPeriods: periods,
}
}
|
[
"func newPeriodicVestingAccount(address sdk.AccAddress, periods vestingtypes.Periods, firstPeriodStartTimestamp int64) *vestingtypes.PeriodicVestingAccount {\n\tbaseAccount := authtypes.NewBaseAccount(address, nil, 0, 0)\n\n\toriginalVesting := sdk.NewCoins()\n\tfor _, p := range periods {\n\t\toriginalVesting = originalVesting.Add(p.Amount...)\n\t}\n\n\tvar totalPeriods int64\n\tfor _, p := range periods {\n\t\ttotalPeriods += p.Length\n\t}\n\tendTime := firstPeriodStartTimestamp + totalPeriods\n\n\tbaseVestingAccount := vestingtypes.NewBaseVestingAccount(baseAccount, originalVesting, endTime)\n\treturn vestingtypes.NewPeriodicVestingAccountRaw(baseVestingAccount, firstPeriodStartTimestamp, periods)\n}",
"func NewPeriodicVestingAccountRaw(bva *BaseVestingAccount, startTime int64, periods Periods) *PeriodicVestingAccount {\n\treturn &PeriodicVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func NewValidatorVestingAccount(baseAcc *authtypes.BaseAccount, startTime int64, periods vestingtypes.Periods, validatorAddress sdk.ConsAddress, returnAddress sdk.AccAddress, signingThreshold int64) *ValidatorVestingAccount {\n\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &vestingtypes.BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\tpva := &vestingtypes.PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n\tvar vestingPeriodProgress []VestingProgress\n\tfor i := 0; i < len(periods); i++ {\n\t\tvestingPeriodProgress = append(vestingPeriodProgress, VestingProgress{false, false})\n\t}\n\n\treturn &ValidatorVestingAccount{\n\t\tPeriodicVestingAccount: pva,\n\t\tValidatorAddress: validatorAddress,\n\t\tReturnAddress: returnAddress,\n\t\tSigningThreshold: signingThreshold,\n\t\tCurrentPeriodProgress: CurrentPeriodProgress{0, 0},\n\t\tVestingPeriodProgress: vestingPeriodProgress,\n\t\tDebtAfterFailedVesting: sdk.NewCoins(),\n\t}\n}",
"func NewDelayedVestingAccount(baseAcc *BaseAccount, endTime int64) *DelayedVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &DelayedVestingAccount{baseVestingAcc}\n}",
"func NewDelayedVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, endTime int64) *DelayedVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &DelayedVestingAccount{baseVestingAcc}\n}",
"func NewMsgCreatePeriodicVestingAccount(fromAddr, toAddr sdk.AccAddress, startTime int64, periods []Period) *MsgCreatePeriodicVestingAccount {\n\treturn &MsgCreatePeriodicVestingAccount{\n\t\tFromAddress: fromAddr.String(),\n\t\tToAddress: toAddr.String(),\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func NewBaseVestingAccount(baseAccount *authtypes.BaseAccount, originalVesting sdk.Coins, endTime int64) *BaseVestingAccount {\n\treturn &BaseVestingAccount{\n\t\tBaseAccount: baseAccount,\n\t\tOriginalVesting: originalVesting,\n\t\tDelegatedFree: sdk.NewCoins(),\n\t\tDelegatedVesting: sdk.NewCoins(),\n\t\tEndTime: endTime,\n\t}\n}",
"func NewContinuousVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime, endTime int64) *ContinuousVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ContinuousVestingAccount{\n\t\tStartTime: startTime,\n\t\tBaseVestingAccount: baseVestingAcc,\n\t}\n}",
"func NewContinuousVestingAccount(baseAcc *BaseAccount, startTime, endTime int64) *ContinuousVestingAccount {\n\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ContinuousVestingAccount{\n\t\tStartTime: startTime,\n\t\tBaseVestingAccount: baseVestingAcc,\n\t}\n}",
"func NewBaseVestingAccount(baseAccount *BaseAccount, originalVesting sdk.Coins,\n\tdelegatedFree sdk.Coins, delegatedVesting sdk.Coins, endTime int64) *BaseVestingAccount {\n\n\treturn &BaseVestingAccount{\n\t\tBaseAccount: baseAccount,\n\t\tOriginalVesting: originalVesting,\n\t\tDelegatedFree: delegatedFree,\n\t\tDelegatedVesting: delegatedVesting,\n\t\tEndTime: endTime,\n\t}\n}",
"func newAccount() *Account {\n\taccount := &Account{}\n\taccount.NativeBalance = Balance{NativeAsset, \"0\", \"\"}\n\taccount.Signers = []Signer{\n\t\tSigner{},\n\t}\n\taccount.Balances = []Balance{}\n\n\treturn account\n}",
"func newAccountForUser(userID string) *account {\n\tvar ac = account{userID: userID}\n\tac.portfolio = make(portfolio)\n\tac.summary = ring.New(summarySize)\n\n\tac.AddSummaryItem(\"Created\")\n\n\treturn &ac\n}",
"func NewPeriod(amount sdk.Coins, length int64) vestingtypes.Period {\n\treturn vestingtypes.Period{Amount: amount, Length: length}\n}",
"func (msg MsgCreatePeriodicVestingAccount) Type() string { return TypeMsgCreatePeriodicVestingAccount }",
"func NewValidatorVestingAccountRaw(bva *vestingtypes.BaseVestingAccount,\n\tstartTime int64, periods vestingtypes.Periods, validatorAddress sdk.ConsAddress, returnAddress sdk.AccAddress, signingThreshold int64) *ValidatorVestingAccount {\n\n\tpva := &vestingtypes.PeriodicVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n\tvar vestingPeriodProgress []VestingProgress\n\tfor i := 0; i < len(periods); i++ {\n\t\tvestingPeriodProgress = append(vestingPeriodProgress, VestingProgress{false, false})\n\t}\n\n\treturn &ValidatorVestingAccount{\n\t\tPeriodicVestingAccount: pva,\n\t\tValidatorAddress: validatorAddress,\n\t\tReturnAddress: returnAddress,\n\t\tSigningThreshold: signingThreshold,\n\t\tCurrentPeriodProgress: CurrentPeriodProgress{0, 0},\n\t\tVestingPeriodProgress: vestingPeriodProgress,\n\t\tDebtAfterFailedVesting: sdk.NewCoins(),\n\t}\n}",
"func NewFundedAccount() *keypair.Full {\n\tkp, err := keypair.Random()\n\tif err != nil {\n\t\tlog.Fatal(err, \"generating random keypair\")\n\t}\n\terr = FundAccount(kp.Address())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Printf(\"successfully funded %s\", kp.Address())\n\treturn kp\n}",
"func (suite *KeeperTestSuite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) authtypes.AccountI {\n\tif vestingBalance.IsAnyGT(initialBalance) {\n\t\tpanic(\"vesting balance must be less than initial balance\")\n\t}\n\tacc := suite.CreateAccountWithAddress(addr, initialBalance)\n\tbacc := acc.(*authtypes.BaseAccount)\n\n\tperiods := vestingtypes.Periods{\n\t\tvestingtypes.Period{\n\t\t\tLength: 31556952,\n\t\t\tAmount: vestingBalance,\n\t\t},\n\t}\n\tvacc := vestingtypes.NewPeriodicVestingAccount(bacc, vestingBalance, suite.Ctx.BlockTime().Unix(), periods)\n\tsuite.App.GetAccountKeeper().SetAccount(suite.Ctx, vacc)\n\treturn vacc\n}",
"func NewDelayedVestingAccountRaw(bva *BaseVestingAccount) *DelayedVestingAccount {\n\treturn &DelayedVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t}\n}",
"func (e Account) EntNew() ent.Ent { return &Account{} }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetVestedCoins returns the total number of vested coins. If no coins are vested, nil is returned.
|
func (pva PeriodicVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {
coins := ReadSchedule(pva.StartTime, pva.EndTime, pva.VestingPeriods, pva.OriginalVesting, blockTime.Unix())
if coins.IsZero() {
return nil
}
return coins
}
|
[
"func (plva PermanentLockedAccount) GetVestedCoins(_ time.Time) sdk.Coins {\n\treturn nil\n}",
"func (dva DelayedVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tif blockTime.Unix() >= dva.EndTime {\n\t\treturn dva.OriginalVesting\n\t}\n\n\treturn nil\n}",
"func (cva ContinuousVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tvar vestedCoins sdk.Coins\n\n\t// We must handle the case where the start time for a vesting account has\n\t// been set into the future or when the start of the chain is not exactly\n\t// known.\n\tif blockTime.Unix() <= cva.StartTime {\n\t\treturn vestedCoins\n\t} else if blockTime.Unix() >= cva.EndTime {\n\t\treturn cva.OriginalVesting\n\t}\n\n\t// calculate the vesting scalar\n\tx := blockTime.Unix() - cva.StartTime\n\ty := cva.EndTime - cva.StartTime\n\ts := sdk.NewDec(x).Quo(sdk.NewDec(y))\n\n\tfor _, ovc := range cva.OriginalVesting {\n\t\tvestedAmt := ovc.Amount.ToDec().Mul(s).RoundInt()\n\t\tvestedCoins = append(vestedCoins, sdk.NewCoin(ovc.Denom, vestedAmt))\n\t}\n\n\treturn vestedCoins\n}",
"func (cva ContinuousVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn cva.OriginalVesting.Sub(cva.GetVestedCoins(blockTime))\n}",
"func (vva ValidatorVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn vva.OriginalVesting.Sub(vva.GetVestedCoins(blockTime))\n}",
"func (va ClawbackVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn va.OriginalVesting.Sub(va.GetVestedCoins(blockTime))\n}",
"func (dva DelayedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn dva.OriginalVesting.Sub(dva.GetVestedCoins(blockTime))\n}",
"func (plva PermanentLockedAccount) GetVestingCoins(_ time.Time) sdk.Coins {\n\treturn plva.OriginalVesting\n}",
"func (vva ValidatorVestingAccount) GetFailedVestedCoins() sdk.Coins {\n\tvar failedVestedCoins sdk.Coins\n\tnumberPeriods := len(vva.VestingPeriods)\n\tfor i := 0; i < numberPeriods; i++ {\n\t\tif vva.VestingPeriodProgress[i].PeriodComplete {\n\t\t\tif !vva.VestingPeriodProgress[i].VestingSuccessful {\n\t\t\t\tfailedVestedCoins = failedVestedCoins.Add(vva.VestingPeriods[i].Amount)\n\t\t\t}\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn failedVestedCoins\n}",
"func (keeper ViewKeeper) GetCoins(ctx sdk.Context, addr sdk.Address) sdk.Coins {\n\treturn getCoins(ctx, keeper.am, addr)\n}",
"func GetCoins() (coins []Coin, error error) {\n\tvar c = []Coin{}\n\tvar d struct {\n\t\tCrypto []Coin `json:\"crypto\"`\n\t}\n\tjsonData, err := doTauRequest(1, \"GET\", \"data/coins\", nil)\n\tif err != nil {\n\t\treturn c, err\n\t}\n\tif err := json.Unmarshal(jsonData, &d); err != nil {\n\t\treturn c, err\n\t}\n\treturn d.Crypto, nil\n}",
"func (bva BaseVestingAccount) spendableCoins(vestingCoins sdk.Coins) sdk.Coins {\n\tvar spendableCoins sdk.Coins\n\tbc := bva.GetCoins()\n\n\tfor _, coin := range bc {\n\t\t// zip/lineup all coins by their denomination to provide O(n) time\n\t\tbaseAmt := coin.Amount\n\t\tvestingAmt := vestingCoins.AmountOf(coin.Denom)\n\t\tdelVestingAmt := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// compute min((BC + DV) - V, BC) per the specification\n\t\tmin := sdk.MinInt(baseAmt.Add(delVestingAmt).Sub(vestingAmt), baseAmt)\n\t\tspendableCoin := sdk.NewCoin(coin.Denom, min)\n\n\t\tif !spendableCoin.IsZero() {\n\t\t\tspendableCoins = spendableCoins.Add(sdk.Coins{spendableCoin})\n\t\t}\n\t}\n\n\treturn spendableCoins\n}",
"func (f *FTX) GetCoins(ctx context.Context) ([]WalletCoinsData, error) {\n\tresp := struct {\n\t\tData []WalletCoinsData `json:\"result\"`\n\t}{}\n\treturn resp.Data, f.SendAuthHTTPRequest(ctx, exchange.RestSpot, http.MethodGet, getCoins, nil, &resp)\n}",
"func (keeper Keeper) GetCoins(ctx sdk.Context, addr sdk.Address) sdk.Coins {\n\treturn getCoins(ctx, keeper.am, addr)\n}",
"func (cva ContinuousVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins {\n\treturn cva.spendableCoins(cva.GetVestingCoins(blockTime))\n}",
"func (repository *Repository) GetCoins() []models.Coin {\n\tvar coins []models.Coin\n\n\terr := repository.DB.Model(&coins).\n\t\tColumn(\"crr\", \"volume\", \"reserve_balance\", \"name\", \"symbol\").\n\t\tWhere(\"deleted_at IS NULL\").\n\t\tOrder(\"reserve_balance DESC\").\n\t\tSelect()\n\n\thelpers.CheckErr(err)\n\n\treturn coins\n}",
"func (vva ValidatorVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins {\n\treturn vva.BaseVestingAccount.SpendableCoinsVestingAccount(vva.GetVestingCoins(blockTime))\n}",
"func (t *TauAPI) GetCoins() (coins []Coin, error error) {\n\tvar c = []Coin{}\n\tvar d struct {\n\t\tCrypto []Coin `json:\"cryto\"` //typo from api\n\t\tFiat []Coin `json:\"fiat\"`\n\t}\n\tjsonData, err := t.doTauRequest(&TauReq{\n\t\tVersion: 2,\n\t\tMethod: \"GET\",\n\t\tPath: \"coins\",\n\t})\n\tif err != nil {\n\t\treturn c, err\n\t}\n\tif err := json.Unmarshal(jsonData, &d); err != nil {\n\t\treturn c, err\n\t}\n\tc = append(d.Crypto, d.Fiat...)\n\treturn c, nil\n}",
"func (pva PeriodicVestingAccount) LockedCoins(ctx sdk.Context) sdk.Coins {\n\treturn pva.BaseVestingAccount.LockedCoinsFromVesting(pva.GetVestingCoins(ctx.BlockTime()))\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
LockedCoins returns the set of coins that are not spendable (i.e. locked), defined as the vesting coins that are not delegated.
|
func (pva PeriodicVestingAccount) LockedCoins(ctx sdk.Context) sdk.Coins {
return pva.BaseVestingAccount.LockedCoinsFromVesting(pva.GetVestingCoins(ctx.BlockTime()))
}
|
[
"func (dva DelayedVestingAccount) LockedCoins(ctx sdk.Context) sdk.Coins {\n\treturn dva.BaseVestingAccount.LockedCoinsFromVesting(dva.GetVestingCoins(ctx.BlockTime()))\n}",
"func (bva BaseVestingAccount) LockedCoinsFromVesting(vestingCoins sdk.Coins) sdk.Coins {\n\tlockedCoins := vestingCoins.Sub(vestingCoins.Min(bva.DelegatedVesting))\n\tif lockedCoins == nil {\n\t\treturn sdk.Coins{}\n\t}\n\treturn lockedCoins\n}",
"func (plva PermanentLockedAccount) GetVestingCoins(_ time.Time) sdk.Coins {\n\treturn plva.OriginalVesting\n}",
"func (bva BaseVestingAccount) spendableCoins(vestingCoins sdk.Coins) sdk.Coins {\n\tvar spendableCoins sdk.Coins\n\tbc := bva.GetCoins()\n\n\tfor _, coin := range bc {\n\t\t// zip/lineup all coins by their denomination to provide O(n) time\n\t\tbaseAmt := coin.Amount\n\t\tvestingAmt := vestingCoins.AmountOf(coin.Denom)\n\t\tdelVestingAmt := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// compute min((BC + DV) - V, BC) per the specification\n\t\tmin := sdk.MinInt(baseAmt.Add(delVestingAmt).Sub(vestingAmt), baseAmt)\n\t\tspendableCoin := sdk.NewCoin(coin.Denom, min)\n\n\t\tif !spendableCoin.IsZero() {\n\t\t\tspendableCoins = spendableCoins.Add(sdk.Coins{spendableCoin})\n\t\t}\n\t}\n\n\treturn spendableCoins\n}",
"func (plva PermanentLockedAccount) GetVestedCoins(_ time.Time) sdk.Coins {\n\treturn nil\n}",
"func (dcr *ExchangeWallet) lockedOutputs() ([]chainjson.TransactionInput, error) {\n\tvar locked []chainjson.TransactionInput\n\terr := dcr.nodeRawRequest(methodListLockUnspent, anylist{dcr.acct}, &locked)\n\treturn locked, err\n}",
"func (w *rpcWallet) LockedOutputs(ctx context.Context, account string) ([]chainjson.TransactionInput, error) {\n\tvar locked []chainjson.TransactionInput\n\terr := w.rpcClientRawRequest(ctx, methodListLockUnspent, anylist{account}, &locked)\n\treturn locked, translateRPCCancelErr(err)\n}",
"func (w *rpcWallet) LockedOutputs(ctx context.Context, acctName string) ([]chainjson.TransactionInput, error) {\n\tvar locked []chainjson.TransactionInput\n\terr := w.rpcClientRawRequest(ctx, methodListLockUnspent, anylist{acctName}, &locked)\n\treturn locked, translateRPCCancelErr(err)\n}",
"func (w *Wallet) LockedOutpoints() []btcjson.TransactionInput {\n\tlocked := make([]btcjson.TransactionInput, len(w.lockedOutpoints))\n\ti := 0\n\tfor op := range w.lockedOutpoints {\n\t\tlocked[i] = btcjson.TransactionInput{\n\t\t\tTxid: op.Hash.String(),\n\t\t\tVout: op.Index,\n\t\t}\n\t\ti++\n\t}\n\treturn locked\n}",
"func (a *Account) LockedOutpoints() []btcjson.TransactionInput {\n\tlocked := make([]btcjson.TransactionInput, len(a.lockedOutpoints))\n\ti := 0\n\tfor op := range a.lockedOutpoints {\n\t\tlocked[i] = btcjson.TransactionInput{\n\t\t\tTxid: op.Hash.String(),\n\t\t\tVout: op.Index,\n\t\t}\n\t\ti++\n\t}\n\treturn locked\n}",
"func (b *Bitcoind) ListLockUnspent() (unspendableOutputs []UnspendableOutput, err error) {\n\tr, err := b.client.call(\"listlockunspent\", nil)\n\tif err = handleError(err, &r); err != nil {\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(r.Result, &unspendableOutputs)\n\treturn\n}",
"func (btc *ExchangeWallet) lockedSats() (uint64, error) {\n\tlockedOutpoints, err := btc.wallet.ListLockUnspent()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tvar sum uint64\n\tbtc.fundingMtx.Lock()\n\tdefer btc.fundingMtx.Unlock()\n\tfor _, outPoint := range lockedOutpoints {\n\t\topID := outpointID(outPoint.TxID, outPoint.Vout)\n\t\tutxo, found := btc.fundingCoins[opID]\n\t\tif found {\n\t\t\tsum += utxo.amount\n\t\t\tcontinue\n\t\t}\n\t\ttxHash, err := chainhash.NewHashFromStr(outPoint.TxID)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\ttxOut, err := btc.node.GetTxOut(txHash, outPoint.Vout, true)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tif txOut == nil {\n\t\t\t// Must be spent now?\n\t\t\tbtc.log.Debugf(\"ignoring output from listlockunspent that wasn't found with gettxout. %s\", opID)\n\t\t\tcontinue\n\t\t}\n\t\tsum += toSatoshi(txOut.Value)\n\t}\n\treturn sum, nil\n}",
"func (dva DelayedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn dva.OriginalVesting.Sub(dva.GetVestedCoins(blockTime))\n}",
"func (dcr *ExchangeWallet) FundingCoins(ids []dex.Bytes) (asset.Coins, error) {\n\t// First check if we have the coins in cache.\n\tcoins := make(asset.Coins, 0, len(ids))\n\tnotFound := make(map[outPoint]bool)\n\tdcr.fundingMtx.Lock()\n\tdefer dcr.fundingMtx.Unlock() // stay locked until we update the map and lock them in the wallet\n\tfor _, id := range ids {\n\t\ttxHash, vout, err := decodeCoinID(id)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpt := newOutPoint(txHash, vout)\n\t\tfundingCoin, found := dcr.fundingCoins[pt]\n\t\tif found {\n\t\t\tcoins = append(coins, fundingCoin.op)\n\t\t\tcontinue\n\t\t}\n\t\tnotFound[pt] = true\n\t}\n\tif len(notFound) == 0 {\n\t\treturn coins, nil\n\t}\n\n\t// Check locked outputs for not found coins.\n\tlockedOutputs, err := dcr.lockedOutputs()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, output := range lockedOutputs {\n\t\ttxHash, err := chainhash.NewHashFromStr(output.Txid)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error decoding txid from rpc server %s: %w\", output.Txid, err)\n\t\t}\n\t\tpt := newOutPoint(txHash, output.Vout)\n\t\tif !notFound[pt] {\n\t\t\tcontinue\n\t\t}\n\t\ttxOut, err := dcr.node.GetTxOut(dcr.ctx, txHash, output.Vout, true)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"gettxout error for locked output %v: %w\", pt.String(), translateRPCCancelErr(err))\n\t\t}\n\t\tvar address string\n\t\tif len(txOut.ScriptPubKey.Addresses) > 0 {\n\t\t\taddress = txOut.ScriptPubKey.Addresses[0]\n\t\t}\n\t\tcoin := newOutput(txHash, output.Vout, toAtoms(output.Amount), output.Tree)\n\t\tcoins = append(coins, coin)\n\t\tdcr.fundingCoins[pt] = &fundingCoin{\n\t\t\top: coin,\n\t\t\taddr: address,\n\t\t}\n\t\tdelete(notFound, pt)\n\t\tif len(notFound) == 0 {\n\t\t\treturn coins, nil\n\t\t}\n\t}\n\n\t// Some funding coins still not found after checking locked outputs.\n\t// Check wallet unspent outputs as last resort. Lock the coins if found.\n\tunspents, err := dcr.unspents()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcoinsToLock := make([]*wire.OutPoint, 0, len(notFound))\n\tfor _, txout := range unspents {\n\t\ttxHash, err := chainhash.NewHashFromStr(txout.TxID)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error decoding txid from rpc server %s: %w\", txout.TxID, err)\n\t\t}\n\t\tpt := newOutPoint(txHash, txout.Vout)\n\t\tif !notFound[pt] {\n\t\t\tcontinue\n\t\t}\n\t\tcoinsToLock = append(coinsToLock, wire.NewOutPoint(txHash, txout.Vout, txout.Tree))\n\t\tcoin := newOutput(txHash, txout.Vout, toAtoms(txout.Amount), txout.Tree)\n\t\tcoins = append(coins, coin)\n\t\tdcr.fundingCoins[pt] = &fundingCoin{\n\t\t\top: coin,\n\t\t\taddr: txout.Address,\n\t\t}\n\t\tdelete(notFound, pt)\n\t\tif len(notFound) == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\tif len(notFound) != 0 {\n\t\tids := make([]string, 0, len(notFound))\n\t\tfor pt := range notFound {\n\t\t\tids = append(ids, pt.String())\n\t\t}\n\t\treturn nil, fmt.Errorf(\"funding coins not found: %s\", strings.Join(ids, \", \"))\n\t}\n\tdcr.log.Debugf(\"Locking funding coins that were unlocked %v\", coinsToLock)\n\terr = dcr.node.LockUnspent(dcr.ctx, false, coinsToLock)\n\tif err != nil {\n\t\treturn nil, translateRPCCancelErr(err)\n\t}\n\n\treturn coins, nil\n}",
"func (bc *BlockChain) FindUnspentTransactions(addr string) []Transaction {\n\tvar unspentTXs []Transaction\n\tspentTXOutputs := make(map[string][]int)\n\titerator := bc.Iterator()\n\n\tfor {\n\t\t_block := iterator.Next()\n\n\t\tfor _, tx := range _block.Transactions {\n\t\t\ttxID := hex.EncodeToString(tx.ID)\n\n\t\tOutputs:\n\t\t\tfor outIdx, out := range tx.VOut {\n\t\t\t\tif spentTXOutputs[txID] != nil {\n\t\t\t\t\tfor _, spentOut := range spentTXOutputs[txID] {\n\t\t\t\t\t\tif spentOut == outIdx {\n\t\t\t\t\t\t\tcontinue Outputs\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif out.CanBeUnlockedWith(addr) {\n\t\t\t\t\tunspentTXs = append(unspentTXs, *tx)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !tx.isCoinBaseTx() {\n\t\t\t\tfor _, in := range tx.VIn {\n\t\t\t\t\tif in.CanUnlockOutputWith(addr) {\n\t\t\t\t\t\tinTxID := hex.EncodeToString(in.TxID)\n\t\t\t\t\t\tspentTXOutputs[inTxID] = append(spentTXOutputs[inTxID], in.VOut)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif len(_block.Prev) == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn unspentTXs\n}",
"func (wallet *Wallet) GetUnspentCells(ctx context.Context, needCap uint64) ([]ckbtypes.CellOutputWithOutPoint, error) {\n\tcollector := cellcollector.NewCellCollector(wallet.Client, wallet.SkipDataAndType)\n\tcells, _, err := collector.GetUnspentCells(ctx, wallet.lockHashHex.Hex(), needCap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn cells, nil\n}",
"func (vva ValidatorVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn vva.OriginalVesting.Sub(vva.GetVestedCoins(blockTime))\n}",
"func (va ClawbackVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn va.OriginalVesting.Sub(va.GetVestedCoins(blockTime))\n}",
"func (dva DelayedVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tif blockTime.Unix() >= dva.EndTime {\n\t\treturn dva.OriginalVesting\n\t}\n\n\treturn nil\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetStartTime returns the time when vesting starts for a periodic vesting account.
|
func (pva PeriodicVestingAccount) GetStartTime() int64 {
return pva.StartTime
}
|
[
"func (dva *DelayedVestingAccount) GetStartTime() int64 {\n\treturn 0\n}",
"func (dva DelayedVestingAccount) GetStartTime() int64 {\n\treturn 0\n}",
"func (cva ContinuousVestingAccount) GetStartTime() int64 {\n\treturn cva.StartTime\n}",
"func GetStartTime() time.Time {\n\treturn startAtTime\n}",
"func (_Vesting *VestingCallerSession) StartTime() (*big.Int, error) {\n\treturn _Vesting.Contract.StartTime(&_Vesting.CallOpts)\n}",
"func (cva *ContinuousVestingAccount) GetStartTime() int64 {\n\treturn cva.StartTime\n}",
"func (txn TxnProbe) GetStartTime() time.Time {\n\treturn txn.startTime\n}",
"func (plva PermanentLockedAccount) GetStartTime() int64 {\n\treturn 0\n}",
"func GetStartTime() time.Time {\n\treturn session.startTime\n}",
"func (o *ApplianceSetupInfoAllOf) GetStartTime() time.Time {\n\tif o == nil || o.StartTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.StartTime\n}",
"func (m *TimeRange) GetStartTime()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly) {\n val, err := m.GetBackingStore().Get(\"startTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly)\n }\n return nil\n}",
"func (o *ApplianceSetupInfo) GetStartTime() time.Time {\n\tif o == nil || o.StartTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.StartTime\n}",
"func (req *StartWFSRequest) GetStartTime() time.Time {\n\treturn req.StartTime\n}",
"func (r *tektonRun) GetStartTime() *metav1.Time {\n\treturn r.tektonTaskRun.Status.StartTime\n}",
"func (m *TimeRange) GetStartTime()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly) {\n return m.startTime\n}",
"func (_Vesting *VestingCaller) StartTime(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Vesting.contract.Call(opts, &out, \"startTime\")\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}",
"func StartTime() time.Time {\n\treturn time.Now()\n}",
"func (f *Filler) StartTime() time.Time {\n\treturn f.tp\n}",
"func (m *SimulationAutomationRun) GetStartDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n return m.startDateTime\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetVestingPeriods returns vesting periods associated with periodic vesting account.
|
func (pva PeriodicVestingAccount) GetVestingPeriods() Periods {
return pva.VestingPeriods
}
|
[
"func (va ClawbackVestingAccount) GetVestingPeriods() Periods {\n\treturn va.VestingPeriods\n}",
"func Periods() (periods []Periodo, err error) {\n var period Periodo\n stq := \"SELECT id, inicio, final, created_at, updated_at FROM periods order by inicio desc\"\n\trows, err := Db.Query(stq)\n\tif err != nil {\n\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tif err = rows.Scan(&period.Id, &period.Inicio, &period.Final, &period.CreatedAt, &period.UpdatedAt); err != nil {\n\t\treturn\n\t\t}\n\t\tperiods = append(periods, period)\n\t}\n\treturn\n }",
"func NewPeriodicVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime int64, periods Periods) *PeriodicVestingAccount {\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func newPeriodicVestingAccount(address sdk.AccAddress, periods vestingtypes.Periods, firstPeriodStartTimestamp int64) *vestingtypes.PeriodicVestingAccount {\n\tbaseAccount := authtypes.NewBaseAccount(address, nil, 0, 0)\n\n\toriginalVesting := sdk.NewCoins()\n\tfor _, p := range periods {\n\t\toriginalVesting = originalVesting.Add(p.Amount...)\n\t}\n\n\tvar totalPeriods int64\n\tfor _, p := range periods {\n\t\ttotalPeriods += p.Length\n\t}\n\tendTime := firstPeriodStartTimestamp + totalPeriods\n\n\tbaseVestingAccount := vestingtypes.NewBaseVestingAccount(baseAccount, originalVesting, endTime)\n\treturn vestingtypes.NewPeriodicVestingAccountRaw(baseVestingAccount, firstPeriodStartTimestamp, periods)\n}",
"func (n Network) VestingAccounts(ctx context.Context, launchID uint64) (vestingAccs []networktypes.VestingAccount, err error) {\n\tn.ev.Send(events.New(events.StatusOngoing, \"Fetching genesis vesting accounts\"))\n\tres, err := n.launchQuery.\n\t\tVestingAccountAll(ctx,\n\t\t\t&launchtypes.QueryAllVestingAccountRequest{\n\t\t\t\tLaunchID: launchID,\n\t\t\t},\n\t\t)\n\tif err != nil {\n\t\treturn vestingAccs, err\n\t}\n\n\tfor i, acc := range res.VestingAccount {\n\t\tparsedAcc, err := networktypes.ToVestingAccount(acc)\n\t\tif err != nil {\n\t\t\treturn vestingAccs, errors.Wrapf(err, \"error parsing vesting account %d\", i)\n\t\t}\n\n\t\tvestingAccs = append(vestingAccs, parsedAcc)\n\t}\n\n\treturn vestingAccs, nil\n}",
"func (db *DB) GetAllPeriods() ([]string, error) {\n\tvar allPeriods []string\n\n\tconn, err := redishelper.GetRedisConn(db.RedisServer, db.RedisPassword)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\tdefer conn.Close()\n\n\tk := \"ming:campuses\"\n\tcampuses, err := redis.Strings(conn.Do(\"ZRANGE\", k, 0, -1))\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\n\tfor _, campus := range campuses {\n\t\tk = fmt.Sprintf(\"ming:%v:categories\", campus)\n\t\tcategories, err := redis.Strings(conn.Do(\"ZRANGE\", k, 0, -1))\n\t\tif err != nil {\n\t\t\treturn []string{}, err\n\t\t}\n\n\t\tfor _, category := range categories {\n\t\t\tk = fmt.Sprintf(\"ming:%v:%v:periods\", campus, category)\n\t\t\tperiods, err := redis.Strings(conn.Do(\"ZRANGE\", k, 0, -1))\n\t\t\tif err != nil {\n\t\t\t\treturn []string{}, err\n\t\t\t}\n\n\t\t\tfor _, period := range periods {\n\t\t\t\tallPeriods = append(allPeriods, fmt.Sprintf(\"%v:%v:%v\", campus, category, period))\n\t\t\t}\n\n\t\t}\n\t}\n\treturn allPeriods, nil\n}",
"func (vp Periods) String() string {\n\tperiodsListString := make([]string, len(vp))\n\tfor _, period := range vp {\n\t\tperiodsListString = append(periodsListString, period.String())\n\t}\n\n\treturn strings.TrimSpace(fmt.Sprintf(`Vesting Periods:\n\t\t%s`, strings.Join(periodsListString, \", \")))\n}",
"func (_VestedPayment *VestedPaymentCallerSession) TotalPeriods() (*big.Int, error) {\n\treturn _VestedPayment.Contract.TotalPeriods(&_VestedPayment.CallOpts)\n}",
"func (keeper Keeper) GetVotingPeriod(ctx sdk.Context, content govtypes.Content) (votingPeriod time.Duration) {\n\tswitch content.(type) {\n\tcase types.ParameterChangeProposal:\n\t\tvotingPeriod = keeper.GetParams(ctx).VotingPeriod\n\t}\n\n\treturn\n}",
"func PeriodGET(w http.ResponseWriter, r *http.Request) {\n\tsess := model.Instance(r)\n lisPeriods, _ := model.Periods()\n\tv := view.New(r)\n\tv.Name = \"periodo/period\"\n\tv.Vars[\"token\"] = csrfbanana.Token(w, r, sess)\n v.Vars[\"LisPeriods\"] = lisPeriods\n// Refill any form fields\n// view.Repopulate([]string{\"name\"}, r.Form, v.Vars)\n\tv.Render(w)\n }",
"func NewValidatorVestingAccount(baseAcc *authtypes.BaseAccount, startTime int64, periods vestingtypes.Periods, validatorAddress sdk.ConsAddress, returnAddress sdk.AccAddress, signingThreshold int64) *ValidatorVestingAccount {\n\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &vestingtypes.BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\tpva := &vestingtypes.PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n\tvar vestingPeriodProgress []VestingProgress\n\tfor i := 0; i < len(periods); i++ {\n\t\tvestingPeriodProgress = append(vestingPeriodProgress, VestingProgress{false, false})\n\t}\n\n\treturn &ValidatorVestingAccount{\n\t\tPeriodicVestingAccount: pva,\n\t\tValidatorAddress: validatorAddress,\n\t\tReturnAddress: returnAddress,\n\t\tSigningThreshold: signingThreshold,\n\t\tCurrentPeriodProgress: CurrentPeriodProgress{0, 0},\n\t\tVestingPeriodProgress: vestingPeriodProgress,\n\t\tDebtAfterFailedVesting: sdk.NewCoins(),\n\t}\n}",
"func (_VestedPayment *VestedPaymentCaller) TotalPeriods(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _VestedPayment.contract.Call(opts, out, \"totalPeriods\")\n\treturn *ret0, err\n}",
"func (c *UptimeCommand) GetPeriodOptions() []string {\n\treturn []string{\n\t\t\"Today\",\n\t\t\"Yesterday\",\n\t\t\"ThisWeek\",\n\t\t\"LastWeek\",\n\t\t\"ThisMonth\",\n\t\t\"LastMonth\",\n\t\t\"ThisYear\",\n\t\t\"LastYear\",\n\t}\n}",
"func LoadPeriods(api *eos.API, includePast, includeFuture bool) []Period {\n\n\tvar periods []Period\n\tvar periodRequest eos.GetTableRowsRequest\n\tperiodRequest.Code = \"dao.hypha\"\n\tperiodRequest.Scope = \"dao.hypha\"\n\tperiodRequest.Table = \"periods\"\n\tperiodRequest.Limit = 1000\n\tperiodRequest.JSON = true\n\n\tperiodResponse, err := api.GetTableRows(context.Background(), periodRequest)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tperiodResponse.JSONToStructs(&periods)\n\n\tvar returnPeriods []Period\n\tcurrentPeriod, err := CurrentPeriod(&periods)\n\tif (includePast || includeFuture) && err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor _, period := range periods {\n\t\tif includePast || includeFuture {\n\t\t\tif includePast && period.PeriodID <= uint64(currentPeriod) {\n\t\t\t\treturnPeriods = append(returnPeriods, period)\n\t\t\t} else if includeFuture && period.PeriodID >= uint64(currentPeriod) {\n\t\t\t\treturnPeriods = append(returnPeriods, period)\n\t\t\t}\n\t\t}\n\t}\n\treturn returnPeriods\n}",
"func NewPeriodicVestingAccountRaw(bva *BaseVestingAccount, startTime int64, periods Periods) *PeriodicVestingAccount {\n\treturn &PeriodicVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func vestingDataToEvents(data cli.VestingData) ([]event, error) {\n\tstartTime := time.Unix(data.StartTime, 0)\n\tevents := []event{}\n\tlastTime := startTime\n\tfor _, p := range data.Periods {\n\t\tcoins, err := sdk.ParseCoinsNormalized(p.Coins)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnewTime := lastTime.Add(time.Duration(p.Length) * time.Second)\n\t\te := event{\n\t\t\tTime: newTime,\n\t\t\tCoins: coins,\n\t\t}\n\t\tevents = append(events, e)\n\t\tlastTime = newTime\n\t}\n\treturn events, nil\n}",
"func GetTotalVestingPeriodLength(periods vestingtypes.Periods) int64 {\n\tlength := int64(0)\n\tfor _, period := range periods {\n\t\tlength += period.Length\n\t}\n\treturn length\n}",
"func (o *GetOutagesParams) WithPeriod(period *float64) *GetOutagesParams {\n\to.SetPeriod(period)\n\treturn o\n}",
"func GetTotalVestingPeriodLength(periods vesting.Periods) int64 {\n\tlength := int64(0)\n\tfor _, period := range periods {\n\t\tlength += period.Length\n\t}\n\treturn length\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
MarshalYAML returns the YAML representation of a PeriodicVestingAccount.
|
func (pva PeriodicVestingAccount) MarshalYAML() (interface{}, error) {
accAddr, err := sdk.AccAddressFromBech32(pva.Address)
if err != nil {
return nil, err
}
out := vestingAccountYAML{
Address: accAddr,
AccountNumber: pva.AccountNumber,
PubKey: getPKString(pva),
Sequence: pva.Sequence,
OriginalVesting: pva.OriginalVesting,
DelegatedFree: pva.DelegatedFree,
DelegatedVesting: pva.DelegatedVesting,
EndTime: pva.EndTime,
StartTime: pva.StartTime,
VestingPeriods: pva.VestingPeriods,
}
return marshalYaml(out)
}
|
[
"func (bva BaseVestingAccount) MarshalYAML() (interface{}, error) {\n\taccAddr, err := sdk.AccAddressFromBech32(bva.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := vestingAccountYAML{\n\t\tAddress: accAddr,\n\t\tAccountNumber: bva.AccountNumber,\n\t\tPubKey: getPKString(bva),\n\t\tSequence: bva.Sequence,\n\t\tOriginalVesting: bva.OriginalVesting,\n\t\tDelegatedFree: bva.DelegatedFree,\n\t\tDelegatedVesting: bva.DelegatedVesting,\n\t\tEndTime: bva.EndTime,\n\t}\n\treturn marshalYaml(out)\n}",
"func (va ClawbackVestingAccount) MarshalYAML() (interface{}, error) {\n\taccAddr, err := sdk.AccAddressFromBech32(va.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := vestingAccountYAML{\n\t\tAddress: accAddr,\n\t\tAccountNumber: va.AccountNumber,\n\t\tPubKey: getPKString(va),\n\t\tSequence: va.Sequence,\n\t\tOriginalVesting: va.OriginalVesting,\n\t\tDelegatedFree: va.DelegatedFree,\n\t\tDelegatedVesting: va.DelegatedVesting,\n\t\tEndTime: va.EndTime,\n\t\tStartTime: va.StartTime,\n\t\tVestingPeriods: va.VestingPeriods,\n\t}\n\treturn marshalYaml(out)\n}",
"func (cva ContinuousVestingAccount) MarshalYAML() (interface{}, error) {\n\taccAddr, err := sdk.AccAddressFromBech32(cva.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := vestingAccountYAML{\n\t\tAddress: accAddr,\n\t\tAccountNumber: cva.AccountNumber,\n\t\tPubKey: getPKString(cva),\n\t\tSequence: cva.Sequence,\n\t\tOriginalVesting: cva.OriginalVesting,\n\t\tDelegatedFree: cva.DelegatedFree,\n\t\tDelegatedVesting: cva.DelegatedVesting,\n\t\tEndTime: cva.EndTime,\n\t\tStartTime: cva.StartTime,\n\t}\n\treturn marshalYaml(out)\n}",
"func (acc BaseAccount) MarshalYAML() (interface{}, error) {\n\tvar bs []byte\n\tvar err error\n\tvar pubkey string\n\n\tif acc.PubKey != nil {\n\t\tpubkey, err = sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, acc.PubKey)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tbs, err = yaml.Marshal(struct {\n\t\tAddress sdk.AccAddress\n\t\tCoins sdk.Coins\n\t\tPubKey string\n\t\tAccountNumber uint64\n\t\tSequence uint64\n\t}{\n\t\tAddress: acc.Address,\n\t\tCoins: acc.Coins,\n\t\tPubKey: pubkey,\n\t\tAccountNumber: acc.AccountNumber,\n\t\tSequence: acc.Sequence,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn string(bs), err\n}",
"func (b *Backend) MarshalYAML() (interface{}, error) {\n\tb.mu.RLock()\n\tdefer b.mu.RUnlock()\n\n\tpayload := struct {\n\t\tAddress string\n\t\tDisabledUntil time.Time `yaml:\"disabledUntil\"`\n\t\tForcePromotionsAfter time.Duration `yaml:\"forcePromotionsAfter\"`\n\t\tLatency time.Duration `yaml:\"latency\"`\n\t\tMaxConnections int `yaml:\"maxConnections\"`\n\t\tTier int `yaml:\"tier\"`\n\t}{\n\t\tAddress: b.addr.String(),\n\t\tDisabledUntil: b.mu.disabledUntil,\n\t\tForcePromotionsAfter: b.mu.forcePromotionAfter,\n\t\tLatency: b.mu.lastLatency,\n\t\tMaxConnections: b.mu.maxConnections,\n\t\tTier: b.mu.tier,\n\t}\n\treturn payload, nil\n}",
"func (r WeekdayRange) MarshalYAML() (interface{}, error) {\n\tbytes, err := r.MarshalText()\n\treturn string(bytes), err\n}",
"func (s *Secret) MarshalYAML() (interface{}, error) {\n\treturn \"<secret>\", nil\n}",
"func (o *OAuthFlow) MarshalYAML() (interface{}, error) {\n\tnb := high.NewNodeBuilder(o, o.low)\n\treturn nb.Render(), nil\n}",
"func (i Instance) MarshalYAML() (interface{}, error) {\n\treturn i.Vars, nil\n}",
"func (tr TimeRange) MarshalYAML() (out interface{}, err error) {\n\tstartHr := tr.StartMinute / 60\n\tendHr := tr.EndMinute / 60\n\tstartMin := tr.StartMinute % 60\n\tendMin := tr.EndMinute % 60\n\n\tstartStr := fmt.Sprintf(\"%02d:%02d\", startHr, startMin)\n\tendStr := fmt.Sprintf(\"%02d:%02d\", endHr, endMin)\n\n\tyTr := yamlTimeRange{startStr, endStr}\n\treturn interface{}(yTr), err\n}",
"func (a Authentication) MarshalYAML() (interface{}, error) {\n\tvalues := make(map[string]interface{})\n\n\tif a.AccessToken != \"\" {\n\t\tvalues[accessToken] = a.AccessToken\n\t}\n\tif a.APIKey != \"\" {\n\t\tvalues[apiKey] = a.APIKey\n\t}\n\tif a.ClientId != \"\" {\n\t\tvalues[clientID] = a.ClientId\n\t}\n\tif a.ClientSecret != \"\" {\n\t\tvalues[clientSecret] = a.ClientSecret\n\t}\n\tif a.IdentityProvider != nil {\n\t\tif a.IdentityProvider.TokenURL != \"\" {\n\t\t\tvalues[idPTokenURL] = a.IdentityProvider.TokenURL\n\t\t}\n\t\tif a.IdentityProvider.Audience != \"\" {\n\t\t\tvalues[idPAudience] = a.IdentityProvider.Audience\n\t\t}\n\t\t//values[idP] = a.IdentityProvider\n\t}\n\tif a.RefreshToken != \"\" {\n\t\tvalues[refreshToken] = a.RefreshToken\n\t}\n\tif a.P12Task != \"\" {\n\t\tvalues[p12Task] = a.P12Task\n\t}\n\tif a.Scope != \"\" {\n\t\tvalues[scope] = a.Scope\n\t}\n\n\treturn values, nil\n}",
"func (tz Location) MarshalYAML() (interface{}, error) {\n\tbytes, err := tz.MarshalText()\n\treturn string(bytes), err\n}",
"func (key PrivateKey) MarshalYAML() (interface{}, error) {\n\treturn key.String(), nil\n}",
"func (in PluginConfig) MarshalYAML() (interface{}, error) {\n\traw := map[string]interface{}{\n\t\t\"name\": in.Name,\n\t\t\"plugin\": in.PluginSubKey,\n\t}\n\t// Don't add the config for unmarshal unless something is defined\n\tif len(in.Config.Raw) != 0 {\n\t\tvar rawCfg = map[string]interface{}{}\n\t\traw[\"config\"] = rawCfg\n\t\tif err := json.Unmarshal(in.Config.Raw, &rawCfg); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"could not marshal the plugin config to json\")\n\t\t}\n\t}\n\n\treturn raw, nil\n}",
"func (i SecVerb) MarshalYAML() (interface{}, error) {\n\treturn i.String(), nil\n}",
"func (key PublicKey) MarshalYAML() (interface{}, error) {\n\treturn key.String(), nil\n}",
"func (i UserGroupAccess) MarshalYAML() (interface{}, error) {\n\treturn i.String(), nil\n}",
"func (k PrivateKey) MarshalYAML() (interface{}, error) {\n\treturn k.Path, nil\n}",
"func (h Hz) MarshalYAML() (interface{}, error) {\n\treturn h.String(), nil\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
NewPeriodicGrantAction returns an AddGrantAction for a PeriodicVestingAccount
|
func NewPeriodicGrantAction(
sk StakingKeeper,
grantStartTime int64,
grantVestingPeriods []Period,
grantCoins sdk.Coins,
) exported.AddGrantAction {
return periodicGrantAction{
sk: sk,
grantStartTime: grantStartTime,
grantVestingPeriods: grantVestingPeriods,
grantCoins: grantCoins,
}
}
|
[
"func (pva *PeriodicVestingAccount) AddGrant(ctx sdk.Context, action exported.AddGrantAction) error {\n\treturn action.AddToAccount(ctx, pva)\n}",
"func (pva *PeriodicVestingAccount) addGrant(ctx sdk.Context, sk StakingKeeper, grantStartTime int64, grantVestingPeriods []Period, grantCoins sdk.Coins) {\n\t// how much is really delegated?\n\tbondedAmt := sk.GetDelegatorBonded(ctx, pva.GetAddress())\n\tunbondingAmt := sk.GetDelegatorUnbonding(ctx, pva.GetAddress())\n\tdelegatedAmt := bondedAmt.Add(unbondingAmt)\n\tdelegated := sdk.NewCoins(sdk.NewCoin(sk.BondDenom(ctx), delegatedAmt))\n\n\t// discover what has been slashed\n\toldDelegated := pva.DelegatedVesting.Add(pva.DelegatedFree...)\n\tslashed := oldDelegated.Sub(coinsMin(oldDelegated, delegated))\n\n\t// rebase the DV+DF by capping slashed at the current unvested amount\n\tunvested := pva.GetVestingCoins(ctx.BlockTime())\n\tnewSlashed := coinsMin(unvested, slashed)\n\tnewTotalDelegated := delegated.Add(newSlashed...)\n\n\t// modify vesting schedule for the new grant\n\tnewStart, newEnd, newPeriods := DisjunctPeriods(pva.StartTime, grantStartTime,\n\t\tpva.GetVestingPeriods(), grantVestingPeriods)\n\tpva.StartTime = newStart\n\tpva.EndTime = newEnd\n\tpva.VestingPeriods = newPeriods\n\tpva.OriginalVesting = pva.OriginalVesting.Add(grantCoins...)\n\n\t// cap DV at the current unvested amount, DF rounds out to newTotalDelegated\n\tunvested2 := pva.GetVestingCoins(ctx.BlockTime())\n\tpva.DelegatedVesting = coinsMin(newTotalDelegated, unvested2)\n\tpva.DelegatedFree = newTotalDelegated.Sub(pva.DelegatedVesting)\n}",
"func newPeriodicVestingAccount(address sdk.AccAddress, periods vestingtypes.Periods, firstPeriodStartTimestamp int64) *vestingtypes.PeriodicVestingAccount {\n\tbaseAccount := authtypes.NewBaseAccount(address, nil, 0, 0)\n\n\toriginalVesting := sdk.NewCoins()\n\tfor _, p := range periods {\n\t\toriginalVesting = originalVesting.Add(p.Amount...)\n\t}\n\n\tvar totalPeriods int64\n\tfor _, p := range periods {\n\t\ttotalPeriods += p.Length\n\t}\n\tendTime := firstPeriodStartTimestamp + totalPeriods\n\n\tbaseVestingAccount := vestingtypes.NewBaseVestingAccount(baseAccount, originalVesting, endTime)\n\treturn vestingtypes.NewPeriodicVestingAccountRaw(baseVestingAccount, firstPeriodStartTimestamp, periods)\n}",
"func (r *refreshTokenGranter) Grant(_ context.Context, requestedScopes []string) grants.Grant {\n\treturn grants.Grant{\n\t\tSourceType: \"refresh_token\",\n\t\tSourceID: r.token.ID,\n\t\tScopes: requestedScopes,\n\t\tAccountID: r.token.AccountID,\n\t\tProfileID: r.token.ProfileID,\n\t\tClientID: r.token.ClientID,\n\t\tUsed: false,\n\t}\n}",
"func (va *ClawbackVestingAccount) addGrant(ctx sdk.Context, sk StakingKeeper, grantStartTime int64, grantLockupPeriods, grantVestingPeriods []Period, grantCoins sdk.Coins) {\n\t// how much is really delegated?\n\tbondedAmt := sk.GetDelegatorBonded(ctx, va.GetAddress())\n\tunbondingAmt := sk.GetDelegatorUnbonding(ctx, va.GetAddress())\n\tdelegatedAmt := bondedAmt.Add(unbondingAmt)\n\tdelegated := sdk.NewCoins(sdk.NewCoin(sk.BondDenom(ctx), delegatedAmt))\n\n\t// discover what has been slashed\n\toldDelegated := va.DelegatedVesting.Add(va.DelegatedFree...)\n\tslashed := oldDelegated.Sub(coinsMin(oldDelegated, delegated))\n\n\t// rebase the DV + DF by capping slashed at the current unvested amount\n\tunvested := va.OriginalVesting.Sub(va.GetVestedOnly(ctx.BlockTime()))\n\tnewSlashed := coinsMin(slashed, unvested)\n\tnewDelegated := delegated.Add(newSlashed...)\n\n\t// modify schedules for the new grant\n\tnewLockupStart, newLockupEnd, newLockupPeriods := DisjunctPeriods(va.StartTime, grantStartTime, va.LockupPeriods, grantLockupPeriods)\n\tnewVestingStart, newVestingEnd, newVestingPeriods := DisjunctPeriods(va.StartTime, grantStartTime,\n\t\tva.GetVestingPeriods(), grantVestingPeriods)\n\tif newLockupStart != newVestingStart {\n\t\tpanic(\"bad start time calculation\")\n\t}\n\tva.StartTime = newLockupStart\n\tva.EndTime = max64(newLockupEnd, newVestingEnd)\n\tva.LockupPeriods = newLockupPeriods\n\tva.VestingPeriods = newVestingPeriods\n\tva.OriginalVesting = va.OriginalVesting.Add(grantCoins...)\n\n\t// cap DV at the current unvested amount, DF rounds out to newDelegated\n\tunvested2 := va.GetVestingCoins(ctx.BlockTime())\n\tva.DelegatedVesting = coinsMin(newDelegated, unvested2)\n\tva.DelegatedFree = newDelegated.Sub(va.DelegatedVesting)\n}",
"func (s *CLITestSuite) createGrant(granter, grantee sdk.Address) {\n\tcommonFlags := []string{\n\t\tfmt.Sprintf(\"--%s=%s\", flags.FlagBroadcastMode, flags.BroadcastSync),\n\t\tfmt.Sprintf(\"--%s=true\", flags.FlagSkipConfirmation),\n\t\tfmt.Sprintf(\"--%s=%s\", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(\"stake\", sdkmath.NewInt(100))).String()),\n\t}\n\n\tfee := sdk.NewCoin(\"stake\", sdkmath.NewInt(100))\n\n\targs := append(\n\t\t[]string{\n\t\t\tgranter.String(),\n\t\t\tgrantee.String(),\n\t\t\tfmt.Sprintf(\"--%s=%s\", cli.FlagSpendLimit, fee.String()),\n\t\t\tfmt.Sprintf(\"--%s=%s\", flags.FlagFrom, granter),\n\t\t\tfmt.Sprintf(\"--%s=%s\", cli.FlagExpiration, getFormattedExpiration(oneYear)),\n\t\t},\n\t\tcommonFlags...,\n\t)\n\n\tcmd := cli.NewCmdFeeGrant(addresscodec.NewBech32Codec(\"cosmos\"))\n\tout, err := clitestutil.ExecTestCLICmd(s.clientCtx, cmd, args)\n\ts.Require().NoError(err)\n\n\tvar resp sdk.TxResponse\n\ts.Require().NoError(s.clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String())\n\ts.Require().Equal(resp.Code, uint32(0))\n}",
"func (pga periodicGrantAction) AddToAccount(ctx sdk.Context, rawAccount exported.VestingAccount) error {\n\tpva, ok := rawAccount.(*PeriodicVestingAccount)\n\tif !ok {\n\t\treturn sdkerrors.Wrapf(sdkerrors.ErrNotSupported,\n\t\t\t\"account %s must be a PeriodicVestingAccount, got %T\",\n\t\t\trawAccount.GetAddress(), rawAccount)\n\t}\n\tpva.addGrant(ctx, pga.sk, pga.grantStartTime, pga.grantVestingPeriods, pga.grantCoins)\n\treturn nil\n}",
"func NewPeriodicVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime int64, periods Periods) *PeriodicVestingAccount {\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func AccountGrant() GrantBuilder {\n\treturn &CurrentGrantBuilder{\n\t\tgrantType: accountType,\n\t}\n}",
"func Grant(ctx context.Context, i grantRequest) error {\n\tclient, err := New(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn client.Grant(ctx, i)\n}",
"func (ge *CurrentGrantExecutable) Grant(p string) string {\n\tvar template string\n\tif p == `OWNERSHIP` {\n\t\ttemplate = `GRANT %v ON %v %v TO %v \"%v\" COPY CURRENT GRANTS`\n\t} else {\n\t\ttemplate = `GRANT %v ON %v %v TO %v \"%v\"`\n\t}\n\treturn fmt.Sprintf(template,\n\t\tp, ge.grantType, ge.grantName, ge.granteeType, ge.granteeName)\n}",
"func NewTenantAllowOrBlockListAction()(*TenantAllowOrBlockListAction) {\n m := &TenantAllowOrBlockListAction{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}",
"func NewAutoGrant() GrantHandler {\n\treturn &autoGrant{}\n}",
"func AccountGrant() *TerraformGrantResource {\n\treturn &TerraformGrantResource{\n\t\tResource: &schema.Resource{\n\t\t\tCreate: CreateAccountGrant,\n\t\t\tRead: ReadAccountGrant,\n\t\t\tDelete: DeleteAccountGrant,\n\t\t\tUpdate: UpdateAccountGrant,\n\n\t\t\tSchema: accountGrantSchema,\n\t\t\tImporter: &schema.ResourceImporter{\n\t\t\t\tStateContext: schema.ImportStatePassthroughContext,\n\t\t\t},\n\t\t},\n\t\tValidPrivs: validAccountPrivileges,\n\t}\n}",
"func (r *jsiiProxy_RepositoryBase) Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant {\n\targs := []interface{}{grantee}\n\tfor _, a := range actions {\n\t\targs = append(args, a)\n\t}\n\n\tvar returns awsiam.Grant\n\n\t_jsii_.Invoke(\n\t\tr,\n\t\t\"grant\",\n\t\targs,\n\t\t&returns,\n\t)\n\n\treturn returns\n}",
"func (r *jsiiProxy_Repository) Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant {\n\targs := []interface{}{grantee}\n\tfor _, a := range actions {\n\t\targs = append(args, a)\n\t}\n\n\tvar returns awsiam.Grant\n\n\t_jsii_.Invoke(\n\t\tr,\n\t\t\"grant\",\n\t\targs,\n\t\t&returns,\n\t)\n\n\treturn returns\n}",
"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}",
"func CreateCreateVpdGrantRuleRequest() (request *CreateVpdGrantRuleRequest) {\n\trequest = &CreateVpdGrantRuleRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"eflo\", \"2022-05-30\", \"CreateVpdGrantRule\", \"eflo\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}",
"func NewApprove(proposer uos.AccountName, proposalName uos.Name, level uos.PermissionLevel) *uos.Action {\n\treturn &uos.Action{\n\t\tAccount: uos.AccountName(\"wxbio.msig\"),\n\t\tName: uos.ActionName(\"approve\"),\n\t\tAuthorization: []uos.PermissionLevel{level},\n\t\tActionData: uos.NewActionData(Approve{proposer, proposalName, level}),\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
AddToAccount implements the exported.AddGrantAction interface. It checks that rawAccount is a PeriodicVestingAccount, then adds the described grant to it.
|
func (pga periodicGrantAction) AddToAccount(ctx sdk.Context, rawAccount exported.VestingAccount) error {
pva, ok := rawAccount.(*PeriodicVestingAccount)
if !ok {
return sdkerrors.Wrapf(sdkerrors.ErrNotSupported,
"account %s must be a PeriodicVestingAccount, got %T",
rawAccount.GetAddress(), rawAccount)
}
pva.addGrant(ctx, pga.sk, pga.grantStartTime, pga.grantVestingPeriods, pga.grantCoins)
return nil
}
|
[
"func (cga clawbackGrantAction) AddToAccount(ctx sdk.Context, rawAccount exported.VestingAccount) error {\n\tcva, ok := rawAccount.(*ClawbackVestingAccount)\n\tif !ok {\n\t\treturn sdkerrors.Wrapf(sdkerrors.ErrNotSupported,\n\t\t\t\"account %s must be a ClawbackVestingAccount, got %T\",\n\t\t\trawAccount.GetAddress(), rawAccount)\n\t}\n\tif cga.funderAddress != cva.FunderAddress {\n\t\treturn sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, \"account %s can only accept grants from account %s\",\n\t\t\trawAccount.GetAddress(), cva.FunderAddress)\n\t}\n\tcva.addGrant(ctx, cga.sk, cga.grantStartTime, cga.grantLockupPeriods, cga.grantVestingPeriods, cga.grantCoins)\n\treturn nil\n}",
"func (pva *PeriodicVestingAccount) AddGrant(ctx sdk.Context, action exported.AddGrantAction) error {\n\treturn action.AddToAccount(ctx, pva)\n}",
"func (_Storage *StorageTransactor) AddAccount(opts *bind.TransactOpts, addr common.Address, kind uint8, isFrozen bool, parent common.Address) (*types.Transaction, error) {\n\treturn _Storage.contract.Transact(opts, \"addAccount\", addr, kind, isFrozen, parent)\n}",
"func (_Storage *StorageTransactorSession) AddAccount(addr common.Address, kind uint8, isFrozen bool, parent common.Address) (*types.Transaction, error) {\n\treturn _Storage.Contract.AddAccount(&_Storage.TransactOpts, addr, kind, isFrozen, parent)\n}",
"func (pva *PeriodicVestingAccount) addGrant(ctx sdk.Context, sk StakingKeeper, grantStartTime int64, grantVestingPeriods []Period, grantCoins sdk.Coins) {\n\t// how much is really delegated?\n\tbondedAmt := sk.GetDelegatorBonded(ctx, pva.GetAddress())\n\tunbondingAmt := sk.GetDelegatorUnbonding(ctx, pva.GetAddress())\n\tdelegatedAmt := bondedAmt.Add(unbondingAmt)\n\tdelegated := sdk.NewCoins(sdk.NewCoin(sk.BondDenom(ctx), delegatedAmt))\n\n\t// discover what has been slashed\n\toldDelegated := pva.DelegatedVesting.Add(pva.DelegatedFree...)\n\tslashed := oldDelegated.Sub(coinsMin(oldDelegated, delegated))\n\n\t// rebase the DV+DF by capping slashed at the current unvested amount\n\tunvested := pva.GetVestingCoins(ctx.BlockTime())\n\tnewSlashed := coinsMin(unvested, slashed)\n\tnewTotalDelegated := delegated.Add(newSlashed...)\n\n\t// modify vesting schedule for the new grant\n\tnewStart, newEnd, newPeriods := DisjunctPeriods(pva.StartTime, grantStartTime,\n\t\tpva.GetVestingPeriods(), grantVestingPeriods)\n\tpva.StartTime = newStart\n\tpva.EndTime = newEnd\n\tpva.VestingPeriods = newPeriods\n\tpva.OriginalVesting = pva.OriginalVesting.Add(grantCoins...)\n\n\t// cap DV at the current unvested amount, DF rounds out to newTotalDelegated\n\tunvested2 := pva.GetVestingCoins(ctx.BlockTime())\n\tpva.DelegatedVesting = coinsMin(newTotalDelegated, unvested2)\n\tpva.DelegatedFree = newTotalDelegated.Sub(pva.DelegatedVesting)\n}",
"func (trd *trxDispatcher) pushAccount(at string, adr *common.Address, blk *types.Block, trx *types.Transaction, wg *sync.WaitGroup) bool {\n\twg.Add(1)\n\tselect {\n\tcase trd.outAccount <- &eventAcc{\n\t\twatchDog: wg,\n\t\taddr: adr,\n\t\tact: at,\n\t\tblk: blk,\n\t\ttrx: trx,\n\t\tdeploy: nil,\n\t}:\n\tcase <-trd.sigStop:\n\t\treturn false\n\t}\n\treturn true\n}",
"func (_Store *StoreTransactor) InsertAccount(opts *bind.TransactOpts, id string, A string, B string, money *big.Int) (*types.RawTransaction, error) {\n\treturn _Store.contract.Transact(opts, \"insertAccount\", id, A, B, money)\n}",
"func (va *ClawbackVestingAccount) addGrant(ctx sdk.Context, sk StakingKeeper, grantStartTime int64, grantLockupPeriods, grantVestingPeriods []Period, grantCoins sdk.Coins) {\n\t// how much is really delegated?\n\tbondedAmt := sk.GetDelegatorBonded(ctx, va.GetAddress())\n\tunbondingAmt := sk.GetDelegatorUnbonding(ctx, va.GetAddress())\n\tdelegatedAmt := bondedAmt.Add(unbondingAmt)\n\tdelegated := sdk.NewCoins(sdk.NewCoin(sk.BondDenom(ctx), delegatedAmt))\n\n\t// discover what has been slashed\n\toldDelegated := va.DelegatedVesting.Add(va.DelegatedFree...)\n\tslashed := oldDelegated.Sub(coinsMin(oldDelegated, delegated))\n\n\t// rebase the DV + DF by capping slashed at the current unvested amount\n\tunvested := va.OriginalVesting.Sub(va.GetVestedOnly(ctx.BlockTime()))\n\tnewSlashed := coinsMin(slashed, unvested)\n\tnewDelegated := delegated.Add(newSlashed...)\n\n\t// modify schedules for the new grant\n\tnewLockupStart, newLockupEnd, newLockupPeriods := DisjunctPeriods(va.StartTime, grantStartTime, va.LockupPeriods, grantLockupPeriods)\n\tnewVestingStart, newVestingEnd, newVestingPeriods := DisjunctPeriods(va.StartTime, grantStartTime,\n\t\tva.GetVestingPeriods(), grantVestingPeriods)\n\tif newLockupStart != newVestingStart {\n\t\tpanic(\"bad start time calculation\")\n\t}\n\tva.StartTime = newLockupStart\n\tva.EndTime = max64(newLockupEnd, newVestingEnd)\n\tva.LockupPeriods = newLockupPeriods\n\tva.VestingPeriods = newVestingPeriods\n\tva.OriginalVesting = va.OriginalVesting.Add(grantCoins...)\n\n\t// cap DV at the current unvested amount, DF rounds out to newDelegated\n\tunvested2 := va.GetVestingCoins(ctx.BlockTime())\n\tva.DelegatedVesting = coinsMin(newDelegated, unvested2)\n\tva.DelegatedFree = newDelegated.Sub(va.DelegatedVesting)\n}",
"func (api *API) AccountCreate(account, fee, owner, active, posting, memo string) error {\n\tvar ops []types.Operation\n\n\t// construct operation\n\top := &types.AccountCreateOperation{\n\t\tFee: fee,\n\t\tCreator: api.account,\n\t\tNewAccountName: account,\n\t\tOwner: authorityFromKey(owner),\n\t\tActive: authorityFromKey(active),\n\t\tPosting: authorityFromKey(posting),\n\t\tMemoKey: memo,\n\t\tJsonMetadata: \"{}\",\n\t}\n\n\tops = append(ops, op)\n\n\tresp, err := api.client.SendTrx(api.account, ops)\n\n\tlog.Printf(\"Response: %s\", resp)\n\n\treturn err\n}",
"func NewPeriodicVestingAccountRaw(bva *BaseVestingAccount, startTime int64, periods Periods) *PeriodicVestingAccount {\n\treturn &PeriodicVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func (am *AccountManager) AddAccount(a *Account) {\n\tam.cmdChan <- &addAccountCmd{\n\t\ta: a,\n\t}\n}",
"func (am *AccountManager) AddAccount(a *Account) {\n\tam.add <- a\n}",
"func (service *AccountService) AddAccount(ctx context.Context, req *protoAccount.NewAccountRequest, res *protoAccount.AccountResponse) error {\n\t// supported exchange keys check\n\tif !supportedExchange(req.Exchange) {\n\t\tres.Status = constRes.Fail\n\t\tres.Message = fmt.Sprintf(\"%s is not supported\", req.Exchange)\n\t\treturn nil\n\t}\n\tif !supportedType(req.AccountType) {\n\t\tres.Status = constRes.Fail\n\t\tres.Message = fmt.Sprintf(\"accountType must be paper or real\")\n\t\treturn nil\n\t}\n\n\taccountID := uuid.New().String()\n\tnow := string(pq.FormatTimestamp(time.Now().UTC()))\n\tbalances := make([]*protoBalance.Balance, 0, len(req.Balances))\n\n\t// user specified balances will be ignored if a\n\t// valid public/secret is send in with request\n\tfor _, b := range req.Balances {\n\t\tbalance := protoBalance.Balance{\n\t\t\tUserID: req.UserID,\n\t\t\tAccountID: accountID,\n\t\t\tCurrencySymbol: b.CurrencySymbol,\n\t\t\tAvailable: b.Available,\n\t\t\tLocked: 0,\n\t\t\tCreatedOn: now,\n\t\t\tUpdatedOn: now,\n\t\t}\n\t\tbalances = append(balances, &balance)\n\t}\n\n\t// assume account valid\n\taccount := protoAccount.Account{\n\t\tAccountID: accountID,\n\t\tAccountType: req.AccountType,\n\t\tUserID: req.UserID,\n\t\tExchange: req.Exchange,\n\t\tKeyPublic: req.KeyPublic,\n\t\tKeySecret: util.Rot32768(req.KeySecret),\n\t\tTitle: req.Title,\n\t\tColor: req.Color,\n\t\tDescription: req.Description,\n\t\tStatus: constAccount.AccountValid,\n\t\tCreatedOn: now,\n\t\tUpdatedOn: now,\n\t\tBalances: balances,\n\t}\n\n\t// validate account request when keys are present\n\tswitch {\n\tcase account.KeyPublic != \"\" && account.KeySecret == \"\":\n\t\tres.Status = constRes.Fail\n\t\tres.Message = \"keySecret required with keyPublic!\"\n\t\treturn nil\n\tcase account.KeyPublic == \"\" && account.KeySecret != \"\":\n\t\tres.Status = constRes.Fail\n\t\tres.Message = \"keyPublic required with keySecret!\"\n\t\treturn nil\n\tcase account.Color == \"\":\n\t\tres.Status = constRes.Fail\n\t\tres.Message = \"color required\"\n\t\treturn nil\n\t}\n\n\tswitch {\n\tcase account.Exchange == constExch.Binance && account.AccountType == constAccount.AccountReal:\n\t\t// if api key ask exchange for balances\n\t\tif account.KeyPublic == \"\" || account.KeySecret == \"\" {\n\t\t\tres.Status = constRes.Fail\n\t\t\tres.Message = \"keyPublic and keySecret required!\"\n\t\t\treturn nil\n\t\t}\n\t\treqBal := protoBinanceBal.BalanceRequest{\n\t\t\tUserID: account.UserID,\n\t\t\tKeyPublic: account.KeyPublic,\n\t\t\tKeySecret: util.Rot32768(account.KeySecret),\n\t\t}\n\t\tresBal, _ := service.BinanceClient.GetBalances(ctx, &reqBal)\n\n\t\t// reponse to client on invalid key\n\t\tif resBal.Status != constRes.Success {\n\t\t\tres.Status = resBal.Status\n\t\t\tres.Message = resBal.Message\n\t\t\treturn nil\n\t\t}\n\n\t\texBalances := make([]*protoBalance.Balance, 0)\n\t\tfor _, b := range resBal.Data.Balances {\n\t\t\ttotal := b.Free + b.Locked\n\n\t\t\t// only add non-zero balances\n\t\t\tif total > 0 {\n\t\t\t\tbalance := protoBalance.Balance{\n\t\t\t\t\tUserID: account.UserID,\n\t\t\t\t\tAccountID: account.AccountID,\n\t\t\t\t\tCurrencySymbol: b.CurrencySymbol,\n\t\t\t\t\tAvailable: b.Free,\n\t\t\t\t\tLocked: 0.0,\n\t\t\t\t\tExchangeTotal: total,\n\t\t\t\t\tExchangeAvailable: b.Free,\n\t\t\t\t\tExchangeLocked: b.Locked,\n\t\t\t\t\tCreatedOn: now,\n\t\t\t\t\tUpdatedOn: now,\n\t\t\t\t}\n\n\t\t\t\texBalances = append(exBalances, &balance)\n\t\t\t}\n\t\t}\n\t\taccount.Balances = exBalances\n\t}\n\n\tif err := repoAccount.InsertAccount(service.DB, &account); err != nil {\n\t\tmsg := fmt.Sprintf(\"insert account failed %s\", err.Error())\n\t\tlog.Println(msg)\n\n\t\tres.Status = constRes.Error\n\t\tres.Message = msg\n\t}\n\n\tres.Status = constRes.Success\n\tres.Data = &protoAccount.UserAccount{Account: &account}\n\n\treturn nil\n}",
"func (auth Authenticate) RegisterAccount(session *types.Session, newAccount *types.Account) (string, error) {\n\taccount, err := auth.CheckAccountSession(session)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t//Get Account Roles\n\taccount = account.GetAccountPermissions()\n\n\t//Only Accounts with ADMIN privliges can make this request\n\tif !utils.Contains(\"ADMIN\", account.Roles) {\n\t\treturn \"\", errors.New(\"Invalid Privilges: \" + account.Name)\n\t}\n\n\t//Get newAccount Roles\n\tnewAccount = newAccount.GetAccountPermissions()\n\n\tres, err := manager.AccountManager{}.CreateAccount(newAccount, account, auth.DB)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn res, nil\n}",
"func (_ChpRegistry *ChpRegistryTransactor) AddPauser(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) {\n\treturn _ChpRegistry.contract.Transact(opts, \"addPauser\", account)\n}",
"func (policy *ticketPolicy) OnCreateNewAccount(acc *types.Account) {\n}",
"func (_PermInterface *PermInterfaceTransactor) AddAdminAccount(opts *bind.TransactOpts, _acct common.Address) (*types.Transaction, error) {\n\treturn _PermInterface.contract.Transact(opts, \"addAdminAccount\", _acct)\n}",
"func (_Store *StoreTransactorSession) InsertAccount(id string, A string, B string, money *big.Int) (*types.RawTransaction, error) {\n\treturn _Store.Contract.InsertAccount(&_Store.TransactOpts, id, A, B, money)\n}",
"func (e *copyS2SMigrationFileEnumerator) addTransferFromAccount(ctx context.Context,\n\tsrcServiceURL azfile.ServiceURL, destBaseURL url.URL,\n\tsharePrefix, fileOrDirectoryPrefix, fileNamePattern string, cca *cookedCopyCmdArgs) error {\n\treturn enumerateSharesInAccount(\n\t\tctx,\n\t\tsrcServiceURL,\n\t\tsharePrefix,\n\t\tfunc(shareItem azfile.ShareItem) error {\n\t\t\t// Whatever the destination type is, it should be equivalent to account level,\n\t\t\t// so directly append share name to it.\n\t\t\ttmpDestURL := urlExtension{URL: destBaseURL}.generateObjectPath(shareItem.Name)\n\t\t\t// create bucket for destination, in case bucket doesn't exist.\n\t\t\tif err := e.createDestBucket(ctx, tmpDestURL, nil); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Two cases for exclude/include which need to match share names in account:\n\t\t\t// a. https://<fileservice>/share*/file*.vhd\n\t\t\t// b. https://<fileservice>/ which equals to https://<fileservice>/*\n\t\t\treturn e.addTransfersFromDirectory(\n\t\t\t\tctx,\n\t\t\t\tsrcServiceURL.NewShareURL(shareItem.Name).NewRootDirectoryURL(),\n\t\t\t\ttmpDestURL,\n\t\t\t\tfileOrDirectoryPrefix,\n\t\t\t\tfileNamePattern,\n\t\t\t\t\"\",\n\t\t\t\ttrue,\n\t\t\t\ttrue,\n\t\t\t\tcca)\n\t\t})\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
AddGrant implements the exported.GrantAccount interface.
|
func (pva *PeriodicVestingAccount) AddGrant(ctx sdk.Context, action exported.AddGrantAction) error {
return action.AddToAccount(ctx, pva)
}
|
[
"func (v *Vserver) AddAccessGrant(a *AccessGrant) error {\n\tkey := a.Key()\n\tif _, ok := v.AccessGrants[key]; ok {\n\t\treturn fmt.Errorf(\"Vserver %q already has AccessGrant %q\", v.Name, key)\n\t}\n\tv.AccessGrants[key] = a\n\treturn nil\n}",
"func (pva *PeriodicVestingAccount) addGrant(ctx sdk.Context, sk StakingKeeper, grantStartTime int64, grantVestingPeriods []Period, grantCoins sdk.Coins) {\n\t// how much is really delegated?\n\tbondedAmt := sk.GetDelegatorBonded(ctx, pva.GetAddress())\n\tunbondingAmt := sk.GetDelegatorUnbonding(ctx, pva.GetAddress())\n\tdelegatedAmt := bondedAmt.Add(unbondingAmt)\n\tdelegated := sdk.NewCoins(sdk.NewCoin(sk.BondDenom(ctx), delegatedAmt))\n\n\t// discover what has been slashed\n\toldDelegated := pva.DelegatedVesting.Add(pva.DelegatedFree...)\n\tslashed := oldDelegated.Sub(coinsMin(oldDelegated, delegated))\n\n\t// rebase the DV+DF by capping slashed at the current unvested amount\n\tunvested := pva.GetVestingCoins(ctx.BlockTime())\n\tnewSlashed := coinsMin(unvested, slashed)\n\tnewTotalDelegated := delegated.Add(newSlashed...)\n\n\t// modify vesting schedule for the new grant\n\tnewStart, newEnd, newPeriods := DisjunctPeriods(pva.StartTime, grantStartTime,\n\t\tpva.GetVestingPeriods(), grantVestingPeriods)\n\tpva.StartTime = newStart\n\tpva.EndTime = newEnd\n\tpva.VestingPeriods = newPeriods\n\tpva.OriginalVesting = pva.OriginalVesting.Add(grantCoins...)\n\n\t// cap DV at the current unvested amount, DF rounds out to newTotalDelegated\n\tunvested2 := pva.GetVestingCoins(ctx.BlockTime())\n\tpva.DelegatedVesting = coinsMin(newTotalDelegated, unvested2)\n\tpva.DelegatedFree = newTotalDelegated.Sub(pva.DelegatedVesting)\n}",
"func (va *ClawbackVestingAccount) addGrant(ctx sdk.Context, sk StakingKeeper, grantStartTime int64, grantLockupPeriods, grantVestingPeriods []Period, grantCoins sdk.Coins) {\n\t// how much is really delegated?\n\tbondedAmt := sk.GetDelegatorBonded(ctx, va.GetAddress())\n\tunbondingAmt := sk.GetDelegatorUnbonding(ctx, va.GetAddress())\n\tdelegatedAmt := bondedAmt.Add(unbondingAmt)\n\tdelegated := sdk.NewCoins(sdk.NewCoin(sk.BondDenom(ctx), delegatedAmt))\n\n\t// discover what has been slashed\n\toldDelegated := va.DelegatedVesting.Add(va.DelegatedFree...)\n\tslashed := oldDelegated.Sub(coinsMin(oldDelegated, delegated))\n\n\t// rebase the DV + DF by capping slashed at the current unvested amount\n\tunvested := va.OriginalVesting.Sub(va.GetVestedOnly(ctx.BlockTime()))\n\tnewSlashed := coinsMin(slashed, unvested)\n\tnewDelegated := delegated.Add(newSlashed...)\n\n\t// modify schedules for the new grant\n\tnewLockupStart, newLockupEnd, newLockupPeriods := DisjunctPeriods(va.StartTime, grantStartTime, va.LockupPeriods, grantLockupPeriods)\n\tnewVestingStart, newVestingEnd, newVestingPeriods := DisjunctPeriods(va.StartTime, grantStartTime,\n\t\tva.GetVestingPeriods(), grantVestingPeriods)\n\tif newLockupStart != newVestingStart {\n\t\tpanic(\"bad start time calculation\")\n\t}\n\tva.StartTime = newLockupStart\n\tva.EndTime = max64(newLockupEnd, newVestingEnd)\n\tva.LockupPeriods = newLockupPeriods\n\tva.VestingPeriods = newVestingPeriods\n\tva.OriginalVesting = va.OriginalVesting.Add(grantCoins...)\n\n\t// cap DV at the current unvested amount, DF rounds out to newDelegated\n\tunvested2 := va.GetVestingCoins(ctx.BlockTime())\n\tva.DelegatedVesting = coinsMin(newDelegated, unvested2)\n\tva.DelegatedFree = newDelegated.Sub(va.DelegatedVesting)\n}",
"func (ge *CurrentGrantExecutable) Grant(p string) string {\n\tvar template string\n\tif p == `OWNERSHIP` {\n\t\ttemplate = `GRANT %v ON %v %v TO %v \"%v\" COPY CURRENT GRANTS`\n\t} else {\n\t\ttemplate = `GRANT %v ON %v %v TO %v \"%v\"`\n\t}\n\treturn fmt.Sprintf(template,\n\t\tp, ge.grantType, ge.grantName, ge.granteeType, ge.granteeName)\n}",
"func AccountGrant() GrantBuilder {\n\treturn &CurrentGrantBuilder{\n\t\tgrantType: accountType,\n\t}\n}",
"func Grant(ctx context.Context, i grantRequest) error {\n\tclient, err := New(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn client.Grant(ctx, i)\n}",
"func (p *AchievementsPlugin) Grant(nick, emojy string) (Award, error) {\n\tempty := Award{}\n\tq := `insert into awards (emojy,holder) values (?, ?)`\n\ttx, err := p.db.Beginx()\n\tif err != nil {\n\t\treturn empty, err\n\t}\n\tif _, err := tx.Exec(q, emojy, nick); err != nil {\n\t\ttx.Rollback()\n\t\treturn empty, err\n\t}\n\tif err := tx.Commit(); err != nil {\n\t\treturn empty, err\n\t}\n\treturn p.FindAward(emojy)\n}",
"func (_LvRecording *LvRecordingTransactor) RunGrant(opts *bind.TransactOpts, arg0 *big.Int, arg1 bool) (*types.Transaction, error) {\n\treturn _LvRecording.contract.Transact(opts, \"runGrant\", arg0, arg1)\n}",
"func AccountGrant() *TerraformGrantResource {\n\treturn &TerraformGrantResource{\n\t\tResource: &schema.Resource{\n\t\t\tCreate: CreateAccountGrant,\n\t\t\tRead: ReadAccountGrant,\n\t\t\tDelete: DeleteAccountGrant,\n\t\t\tUpdate: UpdateAccountGrant,\n\n\t\t\tSchema: accountGrantSchema,\n\t\t\tImporter: &schema.ResourceImporter{\n\t\t\t\tStateContext: schema.ImportStatePassthroughContext,\n\t\t\t},\n\t\t},\n\t\tValidPrivs: validAccountPrivileges,\n\t}\n}",
"func (r *jsiiProxy_RepositoryBase) Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant {\n\targs := []interface{}{grantee}\n\tfor _, a := range actions {\n\t\targs = append(args, a)\n\t}\n\n\tvar returns awsiam.Grant\n\n\t_jsii_.Invoke(\n\t\tr,\n\t\t\"grant\",\n\t\targs,\n\t\t&returns,\n\t)\n\n\treturn returns\n}",
"func (r *jsiiProxy_Repository) Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant {\n\targs := []interface{}{grantee}\n\tfor _, a := range actions {\n\t\targs = append(args, a)\n\t}\n\n\tvar returns awsiam.Grant\n\n\t_jsii_.Invoke(\n\t\tr,\n\t\t\"grant\",\n\t\targs,\n\t\t&returns,\n\t)\n\n\treturn returns\n}",
"func (_Content *ContentTransactor) RunGrant(opts *bind.TransactOpts, arg0 *big.Int, arg1 bool) (*types.Transaction, error) {\n\treturn _Content.contract.Transact(opts, \"runGrant\", arg0, arg1)\n}",
"func (r *refreshTokenGranter) Grant(_ context.Context, requestedScopes []string) grants.Grant {\n\treturn grants.Grant{\n\t\tSourceType: \"refresh_token\",\n\t\tSourceID: r.token.ID,\n\t\tScopes: requestedScopes,\n\t\tAccountID: r.token.AccountID,\n\t\tProfileID: r.token.ProfileID,\n\t\tClientID: r.token.ClientID,\n\t\tUsed: false,\n\t}\n}",
"func (ag *AccessGrant) MergeAdd(other AccessGrant) error {\n\tif err := other.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif other.Address != ag.Address {\n\t\treturn fmt.Errorf(\"cannot merge in AccessGrant for different address\")\n\t}\n\tfor _, p := range other.GetAccessList() {\n\t\tif !ag.HasAccess(p) {\n\t\t\tag.Permissions = append(ag.Permissions, p)\n\t\t}\n\t}\n\treturn nil\n}",
"func (_TokenStakingEscrow *TokenStakingEscrowCaller) TokenGrant(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _TokenStakingEscrow.contract.Call(opts, out, \"tokenGrant\")\n\treturn *ret0, err\n}",
"func (u *user) grant(ctx context.Context, db Database, access string) error {\n\tescapedDbName := pathEscape(db.Name())\n\treq, err := u.conn.NewRequest(\"PUT\", path.Join(u.relPath(), \"database\", escapedDbName))\n\tif err != nil {\n\t\treturn WithStack(err)\n\t}\n\tinput := struct {\n\t\tGrant string `arangodb:\"grant\" json:\"grant\"`\n\t}{\n\t\tGrant: access,\n\t}\n\tif _, err := req.SetBody(input); err != nil {\n\t\treturn WithStack(err)\n\t}\n\tresp, err := u.conn.Do(ctx, req)\n\tif err != nil {\n\t\treturn WithStack(err)\n\t}\n\tif err := resp.CheckStatus(200); err != nil {\n\t\treturn WithStack(err)\n\t}\n\treturn nil\n}",
"func (_PermInterface *PermInterfaceTransactor) AddOrg(opts *bind.TransactOpts, _orgId string, _enodeId string, _ip string, _port uint16, _raftport uint16, _account common.Address) (*types.Transaction, error) {\n\treturn _PermInterface.contract.Transact(opts, \"addOrg\", _orgId, _enodeId, _ip, _port, _raftport, _account)\n}",
"func (s *Session) GrantDB(database, user, grant string) error {\n\tok, err := s.client.UserExists(context.Background(), user)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error in finding user %s\", err)\n\t}\n\tif !ok {\n\t\treturn fmt.Errorf(\"user %s does not exist\", user)\n\t}\n\tdbuser, err := s.client.User(context.Background(), user)\n\tif err != nil {\n\t\treturn fmt.Errorf(\n\t\t\t\"error in getting user %s from database %s\",\n\t\t\tuser,\n\t\t\terr,\n\t\t)\n\t}\n\tdbh, err := s.client.Database(context.Background(), database)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot get a database instance %s\", err)\n\t}\n\terr = dbuser.SetDatabaseAccess(context.Background(), dbh, getGrant(grant))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error in setting database access %s\", err)\n\t}\n\n\treturn nil\n}",
"func (opID OperationID) AddPerm(gid GoogleID, teamID TeamID, perm string, zone Zone) error {\n\tif !opID.IsOwner(gid) {\n\t\terr := fmt.Errorf(ErrNotOpOwner)\n\t\tlog.Errorw(err.Error(), \"GID\", gid, \"resource\", opID)\n\t\treturn err\n\t}\n\n\tinteam, err := gid.AgentInTeam(teamID)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn err\n\t}\n\tif !inteam {\n\t\terr := fmt.Errorf(ErrNotOnTeamAddPerm)\n\t\tlog.Errorw(err.Error(), \"GID\", gid, \"team\", teamID, \"resource\", opID)\n\t\treturn err\n\t}\n\n\topp := OpPermRole(perm)\n\tif !opp.Valid() {\n\t\terr := fmt.Errorf(ErrUnknownPermType)\n\t\tlog.Errorw(err.Error(), \"GID\", gid, \"resource\", opID, \"perm\", perm)\n\t\treturn err\n\t}\n\n\t// zone only applies to read access for now\n\tif opp != opPermRoleRead {\n\t\tzone = ZoneAll\n\t}\n\tif _, err = db.Exec(\"INSERT INTO permissions VALUES (?,?,?,?)\", teamID, opID, opp, zone); err != nil {\n\t\tlog.Error(err)\n\t\treturn err\n\t}\n\treturn nil\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
addGrant merges a new periodic vesting grant into an existing PeriodicVestingAccount.
|
func (pva *PeriodicVestingAccount) addGrant(ctx sdk.Context, sk StakingKeeper, grantStartTime int64, grantVestingPeriods []Period, grantCoins sdk.Coins) {
// how much is really delegated?
bondedAmt := sk.GetDelegatorBonded(ctx, pva.GetAddress())
unbondingAmt := sk.GetDelegatorUnbonding(ctx, pva.GetAddress())
delegatedAmt := bondedAmt.Add(unbondingAmt)
delegated := sdk.NewCoins(sdk.NewCoin(sk.BondDenom(ctx), delegatedAmt))
// discover what has been slashed
oldDelegated := pva.DelegatedVesting.Add(pva.DelegatedFree...)
slashed := oldDelegated.Sub(coinsMin(oldDelegated, delegated))
// rebase the DV+DF by capping slashed at the current unvested amount
unvested := pva.GetVestingCoins(ctx.BlockTime())
newSlashed := coinsMin(unvested, slashed)
newTotalDelegated := delegated.Add(newSlashed...)
// modify vesting schedule for the new grant
newStart, newEnd, newPeriods := DisjunctPeriods(pva.StartTime, grantStartTime,
pva.GetVestingPeriods(), grantVestingPeriods)
pva.StartTime = newStart
pva.EndTime = newEnd
pva.VestingPeriods = newPeriods
pva.OriginalVesting = pva.OriginalVesting.Add(grantCoins...)
// cap DV at the current unvested amount, DF rounds out to newTotalDelegated
unvested2 := pva.GetVestingCoins(ctx.BlockTime())
pva.DelegatedVesting = coinsMin(newTotalDelegated, unvested2)
pva.DelegatedFree = newTotalDelegated.Sub(pva.DelegatedVesting)
}
|
[
"func (pva *PeriodicVestingAccount) AddGrant(ctx sdk.Context, action exported.AddGrantAction) error {\n\treturn action.AddToAccount(ctx, pva)\n}",
"func (va *ClawbackVestingAccount) addGrant(ctx sdk.Context, sk StakingKeeper, grantStartTime int64, grantLockupPeriods, grantVestingPeriods []Period, grantCoins sdk.Coins) {\n\t// how much is really delegated?\n\tbondedAmt := sk.GetDelegatorBonded(ctx, va.GetAddress())\n\tunbondingAmt := sk.GetDelegatorUnbonding(ctx, va.GetAddress())\n\tdelegatedAmt := bondedAmt.Add(unbondingAmt)\n\tdelegated := sdk.NewCoins(sdk.NewCoin(sk.BondDenom(ctx), delegatedAmt))\n\n\t// discover what has been slashed\n\toldDelegated := va.DelegatedVesting.Add(va.DelegatedFree...)\n\tslashed := oldDelegated.Sub(coinsMin(oldDelegated, delegated))\n\n\t// rebase the DV + DF by capping slashed at the current unvested amount\n\tunvested := va.OriginalVesting.Sub(va.GetVestedOnly(ctx.BlockTime()))\n\tnewSlashed := coinsMin(slashed, unvested)\n\tnewDelegated := delegated.Add(newSlashed...)\n\n\t// modify schedules for the new grant\n\tnewLockupStart, newLockupEnd, newLockupPeriods := DisjunctPeriods(va.StartTime, grantStartTime, va.LockupPeriods, grantLockupPeriods)\n\tnewVestingStart, newVestingEnd, newVestingPeriods := DisjunctPeriods(va.StartTime, grantStartTime,\n\t\tva.GetVestingPeriods(), grantVestingPeriods)\n\tif newLockupStart != newVestingStart {\n\t\tpanic(\"bad start time calculation\")\n\t}\n\tva.StartTime = newLockupStart\n\tva.EndTime = max64(newLockupEnd, newVestingEnd)\n\tva.LockupPeriods = newLockupPeriods\n\tva.VestingPeriods = newVestingPeriods\n\tva.OriginalVesting = va.OriginalVesting.Add(grantCoins...)\n\n\t// cap DV at the current unvested amount, DF rounds out to newDelegated\n\tunvested2 := va.GetVestingCoins(ctx.BlockTime())\n\tva.DelegatedVesting = coinsMin(newDelegated, unvested2)\n\tva.DelegatedFree = newDelegated.Sub(va.DelegatedVesting)\n}",
"func NewPeriodicGrantAction(\n\tsk StakingKeeper,\n\tgrantStartTime int64,\n\tgrantVestingPeriods []Period,\n\tgrantCoins sdk.Coins,\n) exported.AddGrantAction {\n\treturn periodicGrantAction{\n\t\tsk: sk,\n\t\tgrantStartTime: grantStartTime,\n\t\tgrantVestingPeriods: grantVestingPeriods,\n\t\tgrantCoins: grantCoins,\n\t}\n}",
"func (v *Vserver) AddAccessGrant(a *AccessGrant) error {\n\tkey := a.Key()\n\tif _, ok := v.AccessGrants[key]; ok {\n\t\treturn fmt.Errorf(\"Vserver %q already has AccessGrant %q\", v.Name, key)\n\t}\n\tv.AccessGrants[key] = a\n\treturn nil\n}",
"func (ag *AccessGrant) MergeAdd(other AccessGrant) error {\n\tif err := other.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif other.Address != ag.Address {\n\t\treturn fmt.Errorf(\"cannot merge in AccessGrant for different address\")\n\t}\n\tfor _, p := range other.GetAccessList() {\n\t\tif !ag.HasAccess(p) {\n\t\t\tag.Permissions = append(ag.Permissions, p)\n\t\t}\n\t}\n\treturn nil\n}",
"func (pga periodicGrantAction) AddToAccount(ctx sdk.Context, rawAccount exported.VestingAccount) error {\n\tpva, ok := rawAccount.(*PeriodicVestingAccount)\n\tif !ok {\n\t\treturn sdkerrors.Wrapf(sdkerrors.ErrNotSupported,\n\t\t\t\"account %s must be a PeriodicVestingAccount, got %T\",\n\t\t\trawAccount.GetAddress(), rawAccount)\n\t}\n\tpva.addGrant(ctx, pga.sk, pga.grantStartTime, pga.grantVestingPeriods, pga.grantCoins)\n\treturn nil\n}",
"func (ge *CurrentGrantExecutable) Grant(p string) string {\n\tvar template string\n\tif p == `OWNERSHIP` {\n\t\ttemplate = `GRANT %v ON %v %v TO %v \"%v\" COPY CURRENT GRANTS`\n\t} else {\n\t\ttemplate = `GRANT %v ON %v %v TO %v \"%v\"`\n\t}\n\treturn fmt.Sprintf(template,\n\t\tp, ge.grantType, ge.grantName, ge.granteeType, ge.granteeName)\n}",
"func StageGrant(db, schema, stage string) GrantBuilder {\n\treturn &CurrentGrantBuilder{\n\t\tname: stage,\n\t\tqualifiedName: fmt.Sprintf(`\"%v\".\"%v\".\"%v\"`, db, schema, stage),\n\t\tgrantType: stageType,\n\t}\n}",
"func AccountGrant() GrantBuilder {\n\treturn &CurrentGrantBuilder{\n\t\tgrantType: accountType,\n\t}\n}",
"func (_LvRecording *LvRecordingTransactor) RunGrant(opts *bind.TransactOpts, arg0 *big.Int, arg1 bool) (*types.Transaction, error) {\n\treturn _LvRecording.contract.Transact(opts, \"runGrant\", arg0, arg1)\n}",
"func (s *Session) GrantDB(database, user, grant string) error {\n\tok, err := s.client.UserExists(context.Background(), user)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error in finding user %s\", err)\n\t}\n\tif !ok {\n\t\treturn fmt.Errorf(\"user %s does not exist\", user)\n\t}\n\tdbuser, err := s.client.User(context.Background(), user)\n\tif err != nil {\n\t\treturn fmt.Errorf(\n\t\t\t\"error in getting user %s from database %s\",\n\t\t\tuser,\n\t\t\terr,\n\t\t)\n\t}\n\tdbh, err := s.client.Database(context.Background(), database)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot get a database instance %s\", err)\n\t}\n\terr = dbuser.SetDatabaseAccess(context.Background(), dbh, getGrant(grant))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error in setting database access %s\", err)\n\t}\n\n\treturn nil\n}",
"func (r *refreshTokenGranter) Grant(_ context.Context, requestedScopes []string) grants.Grant {\n\treturn grants.Grant{\n\t\tSourceType: \"refresh_token\",\n\t\tSourceID: r.token.ID,\n\t\tScopes: requestedScopes,\n\t\tAccountID: r.token.AccountID,\n\t\tProfileID: r.token.ProfileID,\n\t\tClientID: r.token.ClientID,\n\t\tUsed: false,\n\t}\n}",
"func ResourceMonitorGrant(w string) GrantBuilder {\n\treturn &CurrentGrantBuilder{\n\t\tname: w,\n\t\tqualifiedName: fmt.Sprintf(`\"%v\"`, w),\n\t\tgrantType: resourceMonitorType,\n\t}\n}",
"func (u *user) grant(ctx context.Context, db Database, access string) error {\n\tescapedDbName := pathEscape(db.Name())\n\treq, err := u.conn.NewRequest(\"PUT\", path.Join(u.relPath(), \"database\", escapedDbName))\n\tif err != nil {\n\t\treturn WithStack(err)\n\t}\n\tinput := struct {\n\t\tGrant string `arangodb:\"grant\" json:\"grant\"`\n\t}{\n\t\tGrant: access,\n\t}\n\tif _, err := req.SetBody(input); err != nil {\n\t\treturn WithStack(err)\n\t}\n\tresp, err := u.conn.Do(ctx, req)\n\tif err != nil {\n\t\treturn WithStack(err)\n\t}\n\tif err := resp.CheckStatus(200); err != nil {\n\t\treturn WithStack(err)\n\t}\n\treturn nil\n}",
"func (s *CLITestSuite) createGrant(granter, grantee sdk.Address) {\n\tcommonFlags := []string{\n\t\tfmt.Sprintf(\"--%s=%s\", flags.FlagBroadcastMode, flags.BroadcastSync),\n\t\tfmt.Sprintf(\"--%s=true\", flags.FlagSkipConfirmation),\n\t\tfmt.Sprintf(\"--%s=%s\", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(\"stake\", sdkmath.NewInt(100))).String()),\n\t}\n\n\tfee := sdk.NewCoin(\"stake\", sdkmath.NewInt(100))\n\n\targs := append(\n\t\t[]string{\n\t\t\tgranter.String(),\n\t\t\tgrantee.String(),\n\t\t\tfmt.Sprintf(\"--%s=%s\", cli.FlagSpendLimit, fee.String()),\n\t\t\tfmt.Sprintf(\"--%s=%s\", flags.FlagFrom, granter),\n\t\t\tfmt.Sprintf(\"--%s=%s\", cli.FlagExpiration, getFormattedExpiration(oneYear)),\n\t\t},\n\t\tcommonFlags...,\n\t)\n\n\tcmd := cli.NewCmdFeeGrant(addresscodec.NewBech32Codec(\"cosmos\"))\n\tout, err := clitestutil.ExecTestCLICmd(s.clientCtx, cmd, args)\n\ts.Require().NoError(err)\n\n\tvar resp sdk.TxResponse\n\ts.Require().NoError(s.clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String())\n\ts.Require().Equal(resp.Code, uint32(0))\n}",
"func Grant(ctx context.Context, i grantRequest) error {\n\tclient, err := New(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn client.Grant(ctx, i)\n}",
"func (_Content *ContentTransactor) RunGrant(opts *bind.TransactOpts, arg0 *big.Int, arg1 bool) (*types.Transaction, error) {\n\treturn _Content.contract.Transact(opts, \"runGrant\", arg0, arg1)\n}",
"func (s *BasePlSqlParserListener) EnterGrant_statement(ctx *Grant_statementContext) {}",
"func (_TokenStakingEscrow *TokenStakingEscrowCaller) TokenGrant(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _TokenStakingEscrow.contract.Call(opts, out, \"tokenGrant\")\n\treturn *ret0, err\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
NewDelayedVestingAccountRaw creates a new DelayedVestingAccount object from BaseVestingAccount
|
func NewDelayedVestingAccountRaw(bva *BaseVestingAccount) *DelayedVestingAccount {
return &DelayedVestingAccount{
BaseVestingAccount: bva,
}
}
|
[
"func NewDelayedVestingAccount(baseAcc *BaseAccount, endTime int64) *DelayedVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &DelayedVestingAccount{baseVestingAcc}\n}",
"func NewPeriodicVestingAccountRaw(bva *BaseVestingAccount, startTime int64, periods Periods) *PeriodicVestingAccount {\n\treturn &PeriodicVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func NewDelayedVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, endTime int64) *DelayedVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &DelayedVestingAccount{baseVestingAcc}\n}",
"func NewValidatorVestingAccountRaw(bva *vestingtypes.BaseVestingAccount,\n\tstartTime int64, periods vestingtypes.Periods, validatorAddress sdk.ConsAddress, returnAddress sdk.AccAddress, signingThreshold int64) *ValidatorVestingAccount {\n\n\tpva := &vestingtypes.PeriodicVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n\tvar vestingPeriodProgress []VestingProgress\n\tfor i := 0; i < len(periods); i++ {\n\t\tvestingPeriodProgress = append(vestingPeriodProgress, VestingProgress{false, false})\n\t}\n\n\treturn &ValidatorVestingAccount{\n\t\tPeriodicVestingAccount: pva,\n\t\tValidatorAddress: validatorAddress,\n\t\tReturnAddress: returnAddress,\n\t\tSigningThreshold: signingThreshold,\n\t\tCurrentPeriodProgress: CurrentPeriodProgress{0, 0},\n\t\tVestingPeriodProgress: vestingPeriodProgress,\n\t\tDebtAfterFailedVesting: sdk.NewCoins(),\n\t}\n}",
"func NewBaseVestingAccount(baseAccount *authtypes.BaseAccount, originalVesting sdk.Coins, endTime int64) *BaseVestingAccount {\n\treturn &BaseVestingAccount{\n\t\tBaseAccount: baseAccount,\n\t\tOriginalVesting: originalVesting,\n\t\tDelegatedFree: sdk.NewCoins(),\n\t\tDelegatedVesting: sdk.NewCoins(),\n\t\tEndTime: endTime,\n\t}\n}",
"func NewContinuousVestingAccountRaw(bva *BaseVestingAccount,\n\tstartTime int64) *ContinuousVestingAccount {\n\n\treturn &ContinuousVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t}\n}",
"func NewContinuousVestingAccountRaw(bva *BaseVestingAccount, startTime int64) *ContinuousVestingAccount {\n\treturn &ContinuousVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t}\n}",
"func NewBaseVestingAccount(baseAccount *BaseAccount, originalVesting sdk.Coins,\n\tdelegatedFree sdk.Coins, delegatedVesting sdk.Coins, endTime int64) *BaseVestingAccount {\n\n\treturn &BaseVestingAccount{\n\t\tBaseAccount: baseAccount,\n\t\tOriginalVesting: originalVesting,\n\t\tDelegatedFree: delegatedFree,\n\t\tDelegatedVesting: delegatedVesting,\n\t\tEndTime: endTime,\n\t}\n}",
"func newPeriodicVestingAccount(address sdk.AccAddress, periods vestingtypes.Periods, firstPeriodStartTimestamp int64) *vestingtypes.PeriodicVestingAccount {\n\tbaseAccount := authtypes.NewBaseAccount(address, nil, 0, 0)\n\n\toriginalVesting := sdk.NewCoins()\n\tfor _, p := range periods {\n\t\toriginalVesting = originalVesting.Add(p.Amount...)\n\t}\n\n\tvar totalPeriods int64\n\tfor _, p := range periods {\n\t\ttotalPeriods += p.Length\n\t}\n\tendTime := firstPeriodStartTimestamp + totalPeriods\n\n\tbaseVestingAccount := vestingtypes.NewBaseVestingAccount(baseAccount, originalVesting, endTime)\n\treturn vestingtypes.NewPeriodicVestingAccountRaw(baseVestingAccount, firstPeriodStartTimestamp, periods)\n}",
"func NewPeriodicVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime int64, periods Periods) *PeriodicVestingAccount {\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func newAccount() *Account {\n\taccount := &Account{}\n\taccount.NativeBalance = Balance{NativeAsset, \"0\", \"\"}\n\taccount.Signers = []Signer{\n\t\tSigner{},\n\t}\n\taccount.Balances = []Balance{}\n\n\treturn account\n}",
"func NewValidatorVestingAccount(baseAcc *authtypes.BaseAccount, startTime int64, periods vestingtypes.Periods, validatorAddress sdk.ConsAddress, returnAddress sdk.AccAddress, signingThreshold int64) *ValidatorVestingAccount {\n\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &vestingtypes.BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\tpva := &vestingtypes.PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n\tvar vestingPeriodProgress []VestingProgress\n\tfor i := 0; i < len(periods); i++ {\n\t\tvestingPeriodProgress = append(vestingPeriodProgress, VestingProgress{false, false})\n\t}\n\n\treturn &ValidatorVestingAccount{\n\t\tPeriodicVestingAccount: pva,\n\t\tValidatorAddress: validatorAddress,\n\t\tReturnAddress: returnAddress,\n\t\tSigningThreshold: signingThreshold,\n\t\tCurrentPeriodProgress: CurrentPeriodProgress{0, 0},\n\t\tVestingPeriodProgress: vestingPeriodProgress,\n\t\tDebtAfterFailedVesting: sdk.NewCoins(),\n\t}\n}",
"func NewContinuousVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime, endTime int64) *ContinuousVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ContinuousVestingAccount{\n\t\tStartTime: startTime,\n\t\tBaseVestingAccount: baseVestingAcc,\n\t}\n}",
"func NewContinuousVestingAccount(baseAcc *BaseAccount, startTime, endTime int64) *ContinuousVestingAccount {\n\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ContinuousVestingAccount{\n\t\tStartTime: startTime,\n\t\tBaseVestingAccount: baseVestingAcc,\n\t}\n}",
"func NewAccount(val string) AccountField {\n\treturn AccountField{quickfix.FIXString(val)}\n}",
"func NewClawbackVestingAccount(baseAcc *authtypes.BaseAccount, funder sdk.AccAddress, originalVesting sdk.Coins, startTime int64, lockupPeriods, vestingPeriods Periods) *ClawbackVestingAccount {\n\t// copy and align schedules to avoid mutating inputs\n\tlp := make(Periods, len(lockupPeriods))\n\tcopy(lp, lockupPeriods)\n\tvp := make(Periods, len(vestingPeriods))\n\tcopy(vp, vestingPeriods)\n\t_, endTime := AlignSchedules(startTime, startTime, lp, vp)\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ClawbackVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tFunderAddress: funder.String(),\n\t\tStartTime: startTime,\n\t\tLockupPeriods: lp,\n\t\tVestingPeriods: vp,\n\t}\n}",
"func NewRawTx(txType byte) *RawTx {\n\treturn &RawTx{\n\t\tType: txType,\n\t\tVersion: 0,\n\t}\n}",
"func NewGenesisAccountRaw(address sdk.AccAddress, coins sdk.Coins, moduleName string) GenesisAccount {\n\tacc := auth.NewBaseAccount(address, coins, nil, 0, 0)\n\n\treturn GenesisAccount{\n\t\tBaseAccount: *acc,\n\t\tModuleName: moduleName,\n\t}\n}",
"func New(call transactions.ContractCall, height uint64, direction Direction) *TxRecord {\n\treturn &TxRecord{\n\t\tTransaction: call,\n\t\tTxMeta: TxMeta{\n\t\t\tDirection: direction,\n\t\t\tTimestamp: time.Now().Unix(),\n\t\t\tHeight: height,\n\t\t},\n\t}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
NewDelayedVestingAccount returns a DelayedVestingAccount
|
func NewDelayedVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, endTime int64) *DelayedVestingAccount {
baseVestingAcc := &BaseVestingAccount{
BaseAccount: baseAcc,
OriginalVesting: originalVesting,
EndTime: endTime,
}
return &DelayedVestingAccount{baseVestingAcc}
}
|
[
"func NewDelayedVestingAccount(baseAcc *BaseAccount, endTime int64) *DelayedVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &DelayedVestingAccount{baseVestingAcc}\n}",
"func NewDelayedVestingAccountRaw(bva *BaseVestingAccount) *DelayedVestingAccount {\n\treturn &DelayedVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t}\n}",
"func newPeriodicVestingAccount(address sdk.AccAddress, periods vestingtypes.Periods, firstPeriodStartTimestamp int64) *vestingtypes.PeriodicVestingAccount {\n\tbaseAccount := authtypes.NewBaseAccount(address, nil, 0, 0)\n\n\toriginalVesting := sdk.NewCoins()\n\tfor _, p := range periods {\n\t\toriginalVesting = originalVesting.Add(p.Amount...)\n\t}\n\n\tvar totalPeriods int64\n\tfor _, p := range periods {\n\t\ttotalPeriods += p.Length\n\t}\n\tendTime := firstPeriodStartTimestamp + totalPeriods\n\n\tbaseVestingAccount := vestingtypes.NewBaseVestingAccount(baseAccount, originalVesting, endTime)\n\treturn vestingtypes.NewPeriodicVestingAccountRaw(baseVestingAccount, firstPeriodStartTimestamp, periods)\n}",
"func NewPeriodicVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime int64, periods Periods) *PeriodicVestingAccount {\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func NewBaseVestingAccount(baseAccount *authtypes.BaseAccount, originalVesting sdk.Coins, endTime int64) *BaseVestingAccount {\n\treturn &BaseVestingAccount{\n\t\tBaseAccount: baseAccount,\n\t\tOriginalVesting: originalVesting,\n\t\tDelegatedFree: sdk.NewCoins(),\n\t\tDelegatedVesting: sdk.NewCoins(),\n\t\tEndTime: endTime,\n\t}\n}",
"func (e Account) EntNew() ent.Ent { return &Account{} }",
"func NewBaseVestingAccount(baseAccount *BaseAccount, originalVesting sdk.Coins,\n\tdelegatedFree sdk.Coins, delegatedVesting sdk.Coins, endTime int64) *BaseVestingAccount {\n\n\treturn &BaseVestingAccount{\n\t\tBaseAccount: baseAccount,\n\t\tOriginalVesting: originalVesting,\n\t\tDelegatedFree: delegatedFree,\n\t\tDelegatedVesting: delegatedVesting,\n\t\tEndTime: endTime,\n\t}\n}",
"func NewValidatorVestingAccount(baseAcc *authtypes.BaseAccount, startTime int64, periods vestingtypes.Periods, validatorAddress sdk.ConsAddress, returnAddress sdk.AccAddress, signingThreshold int64) *ValidatorVestingAccount {\n\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &vestingtypes.BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\tpva := &vestingtypes.PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n\tvar vestingPeriodProgress []VestingProgress\n\tfor i := 0; i < len(periods); i++ {\n\t\tvestingPeriodProgress = append(vestingPeriodProgress, VestingProgress{false, false})\n\t}\n\n\treturn &ValidatorVestingAccount{\n\t\tPeriodicVestingAccount: pva,\n\t\tValidatorAddress: validatorAddress,\n\t\tReturnAddress: returnAddress,\n\t\tSigningThreshold: signingThreshold,\n\t\tCurrentPeriodProgress: CurrentPeriodProgress{0, 0},\n\t\tVestingPeriodProgress: vestingPeriodProgress,\n\t\tDebtAfterFailedVesting: sdk.NewCoins(),\n\t}\n}",
"func newAccountForUser(userID string) *account {\n\tvar ac = account{userID: userID}\n\tac.portfolio = make(portfolio)\n\tac.summary = ring.New(summarySize)\n\n\tac.AddSummaryItem(\"Created\")\n\n\treturn &ac\n}",
"func (suite *KeeperTestSuite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) authtypes.AccountI {\n\tif vestingBalance.IsAnyGT(initialBalance) {\n\t\tpanic(\"vesting balance must be less than initial balance\")\n\t}\n\tacc := suite.CreateAccountWithAddress(addr, initialBalance)\n\tbacc := acc.(*authtypes.BaseAccount)\n\n\tperiods := vestingtypes.Periods{\n\t\tvestingtypes.Period{\n\t\t\tLength: 31556952,\n\t\t\tAmount: vestingBalance,\n\t\t},\n\t}\n\tvacc := vestingtypes.NewPeriodicVestingAccount(bacc, vestingBalance, suite.Ctx.BlockTime().Unix(), periods)\n\tsuite.App.GetAccountKeeper().SetAccount(suite.Ctx, vacc)\n\treturn vacc\n}",
"func (wallet *Walletd) CreateDelayedTransaction(\n\taddresses []string,\n\ttransfers []map[string]interface{},\n\tfee int,\n\tunlockTime int,\n\textra string,\n\tpaymentID string,\n\tchangeAddress string) (map[string]interface{}, error) {\n\terr := wallet.check()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tparams := make(map[string]interface{})\n\tparams[\"addresses\"] = addresses\n\tparams[\"transfers\"] = transfers\n\tparams[\"fee\"] = fee\n\tparams[\"unlockTime\"] = unlockTime\n\tparams[\"changeAddress\"] = changeAddress\n\n\tif extra != \"\" && paymentID != \"\" {\n\t\treturn nil, errors.New(\"Can't set paymentID and extra together.. either or both should be empty\")\n\t} else if extra != \"\" {\n\t\tparams[\"extra\"] = extra\n\t} else {\n\t\tparams[\"paymentId\"] = paymentID\n\t}\n\n\tresp, err := wallet.makePostRequest(\"createDelayedTransaction\", params)\n\tif resp != nil {\n\t\treturn resp.(map[string]interface{}), err\n\t}\n\n\treturn nil, err\n}",
"func NewContinuousVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime, endTime int64) *ContinuousVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ContinuousVestingAccount{\n\t\tStartTime: startTime,\n\t\tBaseVestingAccount: baseVestingAcc,\n\t}\n}",
"func newAccount() *Account {\n\taccount := &Account{}\n\taccount.NativeBalance = Balance{NativeAsset, \"0\", \"\"}\n\taccount.Signers = []Signer{\n\t\tSigner{},\n\t}\n\taccount.Balances = []Balance{}\n\n\treturn account\n}",
"func NewClawbackVestingAccount(baseAcc *authtypes.BaseAccount, funder sdk.AccAddress, originalVesting sdk.Coins, startTime int64, lockupPeriods, vestingPeriods Periods) *ClawbackVestingAccount {\n\t// copy and align schedules to avoid mutating inputs\n\tlp := make(Periods, len(lockupPeriods))\n\tcopy(lp, lockupPeriods)\n\tvp := make(Periods, len(vestingPeriods))\n\tcopy(vp, vestingPeriods)\n\t_, endTime := AlignSchedules(startTime, startTime, lp, vp)\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ClawbackVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tFunderAddress: funder.String(),\n\t\tStartTime: startTime,\n\t\tLockupPeriods: lp,\n\t\tVestingPeriods: vp,\n\t}\n}",
"func NewDelayedWithdrawal(address common.Address, backend bind.ContractBackend) (*DelayedWithdrawal, error) {\n\tcontract, err := bindDelayedWithdrawal(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &DelayedWithdrawal{DelayedWithdrawalCaller: DelayedWithdrawalCaller{contract: contract}, DelayedWithdrawalTransactor: DelayedWithdrawalTransactor{contract: contract}, DelayedWithdrawalFilterer: DelayedWithdrawalFilterer{contract: contract}}, nil\n}",
"func NewMsgCreateVestingAccount(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins, endTime int64, delayed bool) *MsgCreateVestingAccount {\n\treturn &MsgCreateVestingAccount{\n\t\tFromAddress: fromAddr.String(),\n\t\tToAddress: toAddr.String(),\n\t\tAmount: amount,\n\t\tEndTime: endTime,\n\t\tDelayed: delayed,\n\t}\n}",
"func NewAccount(val string) AccountField {\n\treturn AccountField{quickfix.FIXString(val)}\n}",
"func NewMsgCreatePeriodicVestingAccount(fromAddr, toAddr sdk.AccAddress, startTime int64, periods []Period) *MsgCreatePeriodicVestingAccount {\n\treturn &MsgCreatePeriodicVestingAccount{\n\t\tFromAddress: fromAddr.String(),\n\t\tToAddress: toAddr.String(),\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func NewAllocAccount(val string) AllocAccountField {\n\treturn AllocAccountField{quickfix.FIXString(val)}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetVestedCoins returns the total amount of vested coins for a delayed vesting account. All coins are only vested once the schedule has elapsed.
|
func (dva DelayedVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {
if blockTime.Unix() >= dva.EndTime {
return dva.OriginalVesting
}
return nil
}
|
[
"func (pva PeriodicVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tcoins := ReadSchedule(pva.StartTime, pva.EndTime, pva.VestingPeriods, pva.OriginalVesting, blockTime.Unix())\n\tif coins.IsZero() {\n\t\treturn nil\n\t}\n\treturn coins\n}",
"func (plva PermanentLockedAccount) GetVestedCoins(_ time.Time) sdk.Coins {\n\treturn nil\n}",
"func (dva DelayedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn dva.OriginalVesting.Sub(dva.GetVestedCoins(blockTime))\n}",
"func (cva ContinuousVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tvar vestedCoins sdk.Coins\n\n\t// We must handle the case where the start time for a vesting account has\n\t// been set into the future or when the start of the chain is not exactly\n\t// known.\n\tif blockTime.Unix() <= cva.StartTime {\n\t\treturn vestedCoins\n\t} else if blockTime.Unix() >= cva.EndTime {\n\t\treturn cva.OriginalVesting\n\t}\n\n\t// calculate the vesting scalar\n\tx := blockTime.Unix() - cva.StartTime\n\ty := cva.EndTime - cva.StartTime\n\ts := sdk.NewDec(x).Quo(sdk.NewDec(y))\n\n\tfor _, ovc := range cva.OriginalVesting {\n\t\tvestedAmt := ovc.Amount.ToDec().Mul(s).RoundInt()\n\t\tvestedCoins = append(vestedCoins, sdk.NewCoin(ovc.Denom, vestedAmt))\n\t}\n\n\treturn vestedCoins\n}",
"func (cva ContinuousVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn cva.OriginalVesting.Sub(cva.GetVestedCoins(blockTime))\n}",
"func (va ClawbackVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn va.OriginalVesting.Sub(va.GetVestedCoins(blockTime))\n}",
"func (vva ValidatorVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn vva.OriginalVesting.Sub(vva.GetVestedCoins(blockTime))\n}",
"func (plva PermanentLockedAccount) GetVestingCoins(_ time.Time) sdk.Coins {\n\treturn plva.OriginalVesting\n}",
"func (vva ValidatorVestingAccount) GetFailedVestedCoins() sdk.Coins {\n\tvar failedVestedCoins sdk.Coins\n\tnumberPeriods := len(vva.VestingPeriods)\n\tfor i := 0; i < numberPeriods; i++ {\n\t\tif vva.VestingPeriodProgress[i].PeriodComplete {\n\t\t\tif !vva.VestingPeriodProgress[i].VestingSuccessful {\n\t\t\t\tfailedVestedCoins = failedVestedCoins.Add(vva.VestingPeriods[i].Amount)\n\t\t\t}\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn failedVestedCoins\n}",
"func (dva DelayedVestingAccount) LockedCoins(ctx sdk.Context) sdk.Coins {\n\treturn dva.BaseVestingAccount.LockedCoinsFromVesting(dva.GetVestingCoins(ctx.BlockTime()))\n}",
"func (va ClawbackVestingAccount) GetVestedOnly(blockTime time.Time) sdk.Coins {\n\treturn ReadSchedule(va.StartTime, va.EndTime, va.VestingPeriods, va.OriginalVesting, blockTime.Unix())\n}",
"func (pva PeriodicVestingAccount) LockedCoins(ctx sdk.Context) sdk.Coins {\n\treturn pva.BaseVestingAccount.LockedCoinsFromVesting(pva.GetVestingCoins(ctx.BlockTime()))\n}",
"func (cva ContinuousVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins {\n\treturn cva.spendableCoins(cva.GetVestingCoins(blockTime))\n}",
"func (dva DelayedVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins {\n\treturn dva.spendableCoins(dva.GetVestingCoins(blockTime))\n}",
"func (vva ValidatorVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins {\n\treturn vva.BaseVestingAccount.SpendableCoinsVestingAccount(vva.GetVestingCoins(blockTime))\n}",
"func (bva BaseVestingAccount) LockedCoinsFromVesting(vestingCoins sdk.Coins) sdk.Coins {\n\tlockedCoins := vestingCoins.Sub(vestingCoins.Min(bva.DelegatedVesting))\n\tif lockedCoins == nil {\n\t\treturn sdk.Coins{}\n\t}\n\treturn lockedCoins\n}",
"func (bva BaseVestingAccount) spendableCoins(vestingCoins sdk.Coins) sdk.Coins {\n\tvar spendableCoins sdk.Coins\n\tbc := bva.GetCoins()\n\n\tfor _, coin := range bc {\n\t\t// zip/lineup all coins by their denomination to provide O(n) time\n\t\tbaseAmt := coin.Amount\n\t\tvestingAmt := vestingCoins.AmountOf(coin.Denom)\n\t\tdelVestingAmt := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// compute min((BC + DV) - V, BC) per the specification\n\t\tmin := sdk.MinInt(baseAmt.Add(delVestingAmt).Sub(vestingAmt), baseAmt)\n\t\tspendableCoin := sdk.NewCoin(coin.Denom, min)\n\n\t\tif !spendableCoin.IsZero() {\n\t\t\tspendableCoins = spendableCoins.Add(sdk.Coins{spendableCoin})\n\t\t}\n\t}\n\n\treturn spendableCoins\n}",
"func (keeper ViewKeeper) GetCoins(ctx sdk.Context, addr sdk.Address) sdk.Coins {\n\treturn getCoins(ctx, keeper.am, addr)\n}",
"func (keeper Keeper) GetCoins(ctx sdk.Context, addr sdk.Address) sdk.Coins {\n\treturn getCoins(ctx, keeper.am, addr)\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetVestingCoins returns the total number of vesting coins for a delayed vesting account.
|
func (dva DelayedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {
return dva.OriginalVesting.Sub(dva.GetVestedCoins(blockTime))
}
|
[
"func (vva ValidatorVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn vva.OriginalVesting.Sub(vva.GetVestedCoins(blockTime))\n}",
"func (va ClawbackVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn va.OriginalVesting.Sub(va.GetVestedCoins(blockTime))\n}",
"func (cva ContinuousVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn cva.OriginalVesting.Sub(cva.GetVestedCoins(blockTime))\n}",
"func (plva PermanentLockedAccount) GetVestingCoins(_ time.Time) sdk.Coins {\n\treturn plva.OriginalVesting\n}",
"func (dva DelayedVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tif blockTime.Unix() >= dva.EndTime {\n\t\treturn dva.OriginalVesting\n\t}\n\n\treturn nil\n}",
"func (cva ContinuousVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tvar vestedCoins sdk.Coins\n\n\t// We must handle the case where the start time for a vesting account has\n\t// been set into the future or when the start of the chain is not exactly\n\t// known.\n\tif blockTime.Unix() <= cva.StartTime {\n\t\treturn vestedCoins\n\t} else if blockTime.Unix() >= cva.EndTime {\n\t\treturn cva.OriginalVesting\n\t}\n\n\t// calculate the vesting scalar\n\tx := blockTime.Unix() - cva.StartTime\n\ty := cva.EndTime - cva.StartTime\n\ts := sdk.NewDec(x).Quo(sdk.NewDec(y))\n\n\tfor _, ovc := range cva.OriginalVesting {\n\t\tvestedAmt := ovc.Amount.ToDec().Mul(s).RoundInt()\n\t\tvestedCoins = append(vestedCoins, sdk.NewCoin(ovc.Denom, vestedAmt))\n\t}\n\n\treturn vestedCoins\n}",
"func (pva PeriodicVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tcoins := ReadSchedule(pva.StartTime, pva.EndTime, pva.VestingPeriods, pva.OriginalVesting, blockTime.Unix())\n\tif coins.IsZero() {\n\t\treturn nil\n\t}\n\treturn coins\n}",
"func (plva PermanentLockedAccount) GetVestedCoins(_ time.Time) sdk.Coins {\n\treturn nil\n}",
"func (dva DelayedVestingAccount) LockedCoins(ctx sdk.Context) sdk.Coins {\n\treturn dva.BaseVestingAccount.LockedCoinsFromVesting(dva.GetVestingCoins(ctx.BlockTime()))\n}",
"func (bva BaseVestingAccount) LockedCoinsFromVesting(vestingCoins sdk.Coins) sdk.Coins {\n\tlockedCoins := vestingCoins.Sub(vestingCoins.Min(bva.DelegatedVesting))\n\tif lockedCoins == nil {\n\t\treturn sdk.Coins{}\n\t}\n\treturn lockedCoins\n}",
"func (vva ValidatorVestingAccount) GetFailedVestedCoins() sdk.Coins {\n\tvar failedVestedCoins sdk.Coins\n\tnumberPeriods := len(vva.VestingPeriods)\n\tfor i := 0; i < numberPeriods; i++ {\n\t\tif vva.VestingPeriodProgress[i].PeriodComplete {\n\t\t\tif !vva.VestingPeriodProgress[i].VestingSuccessful {\n\t\t\t\tfailedVestedCoins = failedVestedCoins.Add(vva.VestingPeriods[i].Amount)\n\t\t\t}\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn failedVestedCoins\n}",
"func (pva PeriodicVestingAccount) LockedCoins(ctx sdk.Context) sdk.Coins {\n\treturn pva.BaseVestingAccount.LockedCoinsFromVesting(pva.GetVestingCoins(ctx.BlockTime()))\n}",
"func (bva BaseVestingAccount) spendableCoins(vestingCoins sdk.Coins) sdk.Coins {\n\tvar spendableCoins sdk.Coins\n\tbc := bva.GetCoins()\n\n\tfor _, coin := range bc {\n\t\t// zip/lineup all coins by their denomination to provide O(n) time\n\t\tbaseAmt := coin.Amount\n\t\tvestingAmt := vestingCoins.AmountOf(coin.Denom)\n\t\tdelVestingAmt := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// compute min((BC + DV) - V, BC) per the specification\n\t\tmin := sdk.MinInt(baseAmt.Add(delVestingAmt).Sub(vestingAmt), baseAmt)\n\t\tspendableCoin := sdk.NewCoin(coin.Denom, min)\n\n\t\tif !spendableCoin.IsZero() {\n\t\t\tspendableCoins = spendableCoins.Add(sdk.Coins{spendableCoin})\n\t\t}\n\t}\n\n\treturn spendableCoins\n}",
"func (dva DelayedVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins {\n\treturn dva.spendableCoins(dva.GetVestingCoins(blockTime))\n}",
"func (vva ValidatorVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins {\n\treturn vva.BaseVestingAccount.SpendableCoinsVestingAccount(vva.GetVestingCoins(blockTime))\n}",
"func (cva ContinuousVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins {\n\treturn cva.spendableCoins(cva.GetVestingCoins(blockTime))\n}",
"func (keeper ViewKeeper) GetCoins(ctx sdk.Context, addr sdk.Address) sdk.Coins {\n\treturn getCoins(ctx, keeper.am, addr)\n}",
"func (va ClawbackVestingAccount) GetVestedOnly(blockTime time.Time) sdk.Coins {\n\treturn ReadSchedule(va.StartTime, va.EndTime, va.VestingPeriods, va.OriginalVesting, blockTime.Unix())\n}",
"func GetCoins() (coins []Coin, error error) {\n\tvar c = []Coin{}\n\tvar d struct {\n\t\tCrypto []Coin `json:\"crypto\"`\n\t}\n\tjsonData, err := doTauRequest(1, \"GET\", \"data/coins\", nil)\n\tif err != nil {\n\t\treturn c, err\n\t}\n\tif err := json.Unmarshal(jsonData, &d); err != nil {\n\t\treturn c, err\n\t}\n\treturn d.Crypto, nil\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
LockedCoins returns the set of coins that are not spendable (i.e. locked), defined as the vesting coins that are not delegated.
|
func (dva DelayedVestingAccount) LockedCoins(ctx sdk.Context) sdk.Coins {
return dva.BaseVestingAccount.LockedCoinsFromVesting(dva.GetVestingCoins(ctx.BlockTime()))
}
|
[
"func (pva PeriodicVestingAccount) LockedCoins(ctx sdk.Context) sdk.Coins {\n\treturn pva.BaseVestingAccount.LockedCoinsFromVesting(pva.GetVestingCoins(ctx.BlockTime()))\n}",
"func (bva BaseVestingAccount) LockedCoinsFromVesting(vestingCoins sdk.Coins) sdk.Coins {\n\tlockedCoins := vestingCoins.Sub(vestingCoins.Min(bva.DelegatedVesting))\n\tif lockedCoins == nil {\n\t\treturn sdk.Coins{}\n\t}\n\treturn lockedCoins\n}",
"func (plva PermanentLockedAccount) GetVestingCoins(_ time.Time) sdk.Coins {\n\treturn plva.OriginalVesting\n}",
"func (bva BaseVestingAccount) spendableCoins(vestingCoins sdk.Coins) sdk.Coins {\n\tvar spendableCoins sdk.Coins\n\tbc := bva.GetCoins()\n\n\tfor _, coin := range bc {\n\t\t// zip/lineup all coins by their denomination to provide O(n) time\n\t\tbaseAmt := coin.Amount\n\t\tvestingAmt := vestingCoins.AmountOf(coin.Denom)\n\t\tdelVestingAmt := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// compute min((BC + DV) - V, BC) per the specification\n\t\tmin := sdk.MinInt(baseAmt.Add(delVestingAmt).Sub(vestingAmt), baseAmt)\n\t\tspendableCoin := sdk.NewCoin(coin.Denom, min)\n\n\t\tif !spendableCoin.IsZero() {\n\t\t\tspendableCoins = spendableCoins.Add(sdk.Coins{spendableCoin})\n\t\t}\n\t}\n\n\treturn spendableCoins\n}",
"func (plva PermanentLockedAccount) GetVestedCoins(_ time.Time) sdk.Coins {\n\treturn nil\n}",
"func (dcr *ExchangeWallet) lockedOutputs() ([]chainjson.TransactionInput, error) {\n\tvar locked []chainjson.TransactionInput\n\terr := dcr.nodeRawRequest(methodListLockUnspent, anylist{dcr.acct}, &locked)\n\treturn locked, err\n}",
"func (w *rpcWallet) LockedOutputs(ctx context.Context, account string) ([]chainjson.TransactionInput, error) {\n\tvar locked []chainjson.TransactionInput\n\terr := w.rpcClientRawRequest(ctx, methodListLockUnspent, anylist{account}, &locked)\n\treturn locked, translateRPCCancelErr(err)\n}",
"func (w *rpcWallet) LockedOutputs(ctx context.Context, acctName string) ([]chainjson.TransactionInput, error) {\n\tvar locked []chainjson.TransactionInput\n\terr := w.rpcClientRawRequest(ctx, methodListLockUnspent, anylist{acctName}, &locked)\n\treturn locked, translateRPCCancelErr(err)\n}",
"func (w *Wallet) LockedOutpoints() []btcjson.TransactionInput {\n\tlocked := make([]btcjson.TransactionInput, len(w.lockedOutpoints))\n\ti := 0\n\tfor op := range w.lockedOutpoints {\n\t\tlocked[i] = btcjson.TransactionInput{\n\t\t\tTxid: op.Hash.String(),\n\t\t\tVout: op.Index,\n\t\t}\n\t\ti++\n\t}\n\treturn locked\n}",
"func (a *Account) LockedOutpoints() []btcjson.TransactionInput {\n\tlocked := make([]btcjson.TransactionInput, len(a.lockedOutpoints))\n\ti := 0\n\tfor op := range a.lockedOutpoints {\n\t\tlocked[i] = btcjson.TransactionInput{\n\t\t\tTxid: op.Hash.String(),\n\t\t\tVout: op.Index,\n\t\t}\n\t\ti++\n\t}\n\treturn locked\n}",
"func (b *Bitcoind) ListLockUnspent() (unspendableOutputs []UnspendableOutput, err error) {\n\tr, err := b.client.call(\"listlockunspent\", nil)\n\tif err = handleError(err, &r); err != nil {\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(r.Result, &unspendableOutputs)\n\treturn\n}",
"func (btc *ExchangeWallet) lockedSats() (uint64, error) {\n\tlockedOutpoints, err := btc.wallet.ListLockUnspent()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tvar sum uint64\n\tbtc.fundingMtx.Lock()\n\tdefer btc.fundingMtx.Unlock()\n\tfor _, outPoint := range lockedOutpoints {\n\t\topID := outpointID(outPoint.TxID, outPoint.Vout)\n\t\tutxo, found := btc.fundingCoins[opID]\n\t\tif found {\n\t\t\tsum += utxo.amount\n\t\t\tcontinue\n\t\t}\n\t\ttxHash, err := chainhash.NewHashFromStr(outPoint.TxID)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\ttxOut, err := btc.node.GetTxOut(txHash, outPoint.Vout, true)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tif txOut == nil {\n\t\t\t// Must be spent now?\n\t\t\tbtc.log.Debugf(\"ignoring output from listlockunspent that wasn't found with gettxout. %s\", opID)\n\t\t\tcontinue\n\t\t}\n\t\tsum += toSatoshi(txOut.Value)\n\t}\n\treturn sum, nil\n}",
"func (dva DelayedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn dva.OriginalVesting.Sub(dva.GetVestedCoins(blockTime))\n}",
"func (dcr *ExchangeWallet) FundingCoins(ids []dex.Bytes) (asset.Coins, error) {\n\t// First check if we have the coins in cache.\n\tcoins := make(asset.Coins, 0, len(ids))\n\tnotFound := make(map[outPoint]bool)\n\tdcr.fundingMtx.Lock()\n\tdefer dcr.fundingMtx.Unlock() // stay locked until we update the map and lock them in the wallet\n\tfor _, id := range ids {\n\t\ttxHash, vout, err := decodeCoinID(id)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpt := newOutPoint(txHash, vout)\n\t\tfundingCoin, found := dcr.fundingCoins[pt]\n\t\tif found {\n\t\t\tcoins = append(coins, fundingCoin.op)\n\t\t\tcontinue\n\t\t}\n\t\tnotFound[pt] = true\n\t}\n\tif len(notFound) == 0 {\n\t\treturn coins, nil\n\t}\n\n\t// Check locked outputs for not found coins.\n\tlockedOutputs, err := dcr.lockedOutputs()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, output := range lockedOutputs {\n\t\ttxHash, err := chainhash.NewHashFromStr(output.Txid)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error decoding txid from rpc server %s: %w\", output.Txid, err)\n\t\t}\n\t\tpt := newOutPoint(txHash, output.Vout)\n\t\tif !notFound[pt] {\n\t\t\tcontinue\n\t\t}\n\t\ttxOut, err := dcr.node.GetTxOut(dcr.ctx, txHash, output.Vout, true)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"gettxout error for locked output %v: %w\", pt.String(), translateRPCCancelErr(err))\n\t\t}\n\t\tvar address string\n\t\tif len(txOut.ScriptPubKey.Addresses) > 0 {\n\t\t\taddress = txOut.ScriptPubKey.Addresses[0]\n\t\t}\n\t\tcoin := newOutput(txHash, output.Vout, toAtoms(output.Amount), output.Tree)\n\t\tcoins = append(coins, coin)\n\t\tdcr.fundingCoins[pt] = &fundingCoin{\n\t\t\top: coin,\n\t\t\taddr: address,\n\t\t}\n\t\tdelete(notFound, pt)\n\t\tif len(notFound) == 0 {\n\t\t\treturn coins, nil\n\t\t}\n\t}\n\n\t// Some funding coins still not found after checking locked outputs.\n\t// Check wallet unspent outputs as last resort. Lock the coins if found.\n\tunspents, err := dcr.unspents()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcoinsToLock := make([]*wire.OutPoint, 0, len(notFound))\n\tfor _, txout := range unspents {\n\t\ttxHash, err := chainhash.NewHashFromStr(txout.TxID)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error decoding txid from rpc server %s: %w\", txout.TxID, err)\n\t\t}\n\t\tpt := newOutPoint(txHash, txout.Vout)\n\t\tif !notFound[pt] {\n\t\t\tcontinue\n\t\t}\n\t\tcoinsToLock = append(coinsToLock, wire.NewOutPoint(txHash, txout.Vout, txout.Tree))\n\t\tcoin := newOutput(txHash, txout.Vout, toAtoms(txout.Amount), txout.Tree)\n\t\tcoins = append(coins, coin)\n\t\tdcr.fundingCoins[pt] = &fundingCoin{\n\t\t\top: coin,\n\t\t\taddr: txout.Address,\n\t\t}\n\t\tdelete(notFound, pt)\n\t\tif len(notFound) == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\tif len(notFound) != 0 {\n\t\tids := make([]string, 0, len(notFound))\n\t\tfor pt := range notFound {\n\t\t\tids = append(ids, pt.String())\n\t\t}\n\t\treturn nil, fmt.Errorf(\"funding coins not found: %s\", strings.Join(ids, \", \"))\n\t}\n\tdcr.log.Debugf(\"Locking funding coins that were unlocked %v\", coinsToLock)\n\terr = dcr.node.LockUnspent(dcr.ctx, false, coinsToLock)\n\tif err != nil {\n\t\treturn nil, translateRPCCancelErr(err)\n\t}\n\n\treturn coins, nil\n}",
"func (bc *BlockChain) FindUnspentTransactions(addr string) []Transaction {\n\tvar unspentTXs []Transaction\n\tspentTXOutputs := make(map[string][]int)\n\titerator := bc.Iterator()\n\n\tfor {\n\t\t_block := iterator.Next()\n\n\t\tfor _, tx := range _block.Transactions {\n\t\t\ttxID := hex.EncodeToString(tx.ID)\n\n\t\tOutputs:\n\t\t\tfor outIdx, out := range tx.VOut {\n\t\t\t\tif spentTXOutputs[txID] != nil {\n\t\t\t\t\tfor _, spentOut := range spentTXOutputs[txID] {\n\t\t\t\t\t\tif spentOut == outIdx {\n\t\t\t\t\t\t\tcontinue Outputs\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif out.CanBeUnlockedWith(addr) {\n\t\t\t\t\tunspentTXs = append(unspentTXs, *tx)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !tx.isCoinBaseTx() {\n\t\t\t\tfor _, in := range tx.VIn {\n\t\t\t\t\tif in.CanUnlockOutputWith(addr) {\n\t\t\t\t\t\tinTxID := hex.EncodeToString(in.TxID)\n\t\t\t\t\t\tspentTXOutputs[inTxID] = append(spentTXOutputs[inTxID], in.VOut)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif len(_block.Prev) == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn unspentTXs\n}",
"func (wallet *Wallet) GetUnspentCells(ctx context.Context, needCap uint64) ([]ckbtypes.CellOutputWithOutPoint, error) {\n\tcollector := cellcollector.NewCellCollector(wallet.Client, wallet.SkipDataAndType)\n\tcells, _, err := collector.GetUnspentCells(ctx, wallet.lockHashHex.Hex(), needCap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn cells, nil\n}",
"func (vva ValidatorVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn vva.OriginalVesting.Sub(vva.GetVestedCoins(blockTime))\n}",
"func (va ClawbackVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn va.OriginalVesting.Sub(va.GetVestedCoins(blockTime))\n}",
"func (dva DelayedVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tif blockTime.Unix() >= dva.EndTime {\n\t\treturn dva.OriginalVesting\n\t}\n\n\treturn nil\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
TrackDelegation tracks a desired delegation amount by setting the appropriate values for the amount of delegated vesting, delegated free, and reducing the overall amount of base coins.
|
func (dva *DelayedVestingAccount) TrackDelegation(blockTime time.Time, balance, amount sdk.Coins) {
dva.BaseVestingAccount.TrackDelegation(balance, dva.GetVestingCoins(blockTime), amount)
}
|
[
"func (bva *BaseVestingAccount) TrackDelegation(balance, vestingCoins, amount sdk.Coins) {\n\tfor _, coin := range amount {\n\t\tbaseAmt := balance.AmountOf(coin.Denom)\n\t\tvestingAmt := vestingCoins.AmountOf(coin.Denom)\n\t\tdelVestingAmt := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// Panic if the delegation amount is zero or if the base coins does not\n\t\t// exceed the desired delegation amount.\n\t\tif coin.Amount.IsZero() || baseAmt.LT(coin.Amount) {\n\t\t\tpanic(\"delegation attempt with zero coins or insufficient funds\")\n\t\t}\n\n\t\t// compute x and y per the specification, where:\n\t\t// X := min(max(V - DV, 0), D)\n\t\t// Y := D - X\n\t\tx := sdk.MinInt(sdk.MaxInt(vestingAmt.Sub(delVestingAmt), sdk.ZeroInt()), coin.Amount)\n\t\ty := coin.Amount.Sub(x)\n\n\t\tif !x.IsZero() {\n\t\t\txCoin := sdk.NewCoin(coin.Denom, x)\n\t\t\tbva.DelegatedVesting = bva.DelegatedVesting.Add(xCoin)\n\t\t}\n\n\t\tif !y.IsZero() {\n\t\t\tyCoin := sdk.NewCoin(coin.Denom, y)\n\t\t\tbva.DelegatedFree = bva.DelegatedFree.Add(yCoin)\n\t\t}\n\t}\n}",
"func (bva *BaseVestingAccount) trackDelegation(vestingCoins, amount sdk.Coins) {\n\tbc := bva.GetCoins()\n\n\tfor _, coin := range amount {\n\t\t// zip/lineup all coins by their denomination to provide O(n) time\n\n\t\tbaseAmt := bc.AmountOf(coin.Denom)\n\t\tvestingAmt := vestingCoins.AmountOf(coin.Denom)\n\t\tdelVestingAmt := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// Panic if the delegation amount is zero or if the base coins does not\n\t\t// exceed the desired delegation amount.\n\t\tif coin.Amount.IsZero() || baseAmt.LT(coin.Amount) {\n\t\t\tpanic(\"delegation attempt with zero coins or insufficient funds\")\n\t\t}\n\n\t\t// compute modules and y per the specification, where:\n\t\t// X := min(max(V - DV, 0), D)\n\t\t// Y := D - X\n\t\tx := sdk.MinInt(sdk.MaxInt(vestingAmt.Sub(delVestingAmt), sdk.ZeroInt()), coin.Amount)\n\t\ty := coin.Amount.Sub(x)\n\n\t\tif !x.IsZero() {\n\t\t\txCoin := sdk.NewCoin(coin.Denom, x)\n\t\t\tbva.DelegatedVesting = bva.DelegatedVesting.Add(sdk.Coins{xCoin})\n\t\t}\n\n\t\tif !y.IsZero() {\n\t\t\tyCoin := sdk.NewCoin(coin.Denom, y)\n\t\t\tbva.DelegatedFree = bva.DelegatedFree.Add(sdk.Coins{yCoin})\n\t\t}\n\n\t\tbva.Coins = bva.Coins.Sub(sdk.Coins{coin})\n\t}\n}",
"func (dva *DelayedVestingAccount) TrackDelegation(blockTime time.Time, amount sdk.Coins) {\n\tdva.trackDelegation(dva.GetVestingCoins(blockTime), amount)\n}",
"func (bva *BaseVestingAccount) TrackUndelegation(amount sdk.Coins) {\n\tfor _, coin := range amount {\n\t\t// panic if the undelegation amount is zero\n\t\tif coin.Amount.IsZero() {\n\t\t\tpanic(\"undelegation attempt with zero coins\")\n\t\t}\n\t\tdelegatedFree := bva.DelegatedFree.AmountOf(coin.Denom)\n\t\tdelegatedVesting := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// compute modules and y per the specification, where:\n\t\t// X := min(DF, D)\n\t\t// Y := min(DV, D - X)\n\t\tx := sdk.MinInt(delegatedFree, coin.Amount)\n\t\ty := sdk.MinInt(delegatedVesting, coin.Amount.Sub(x))\n\n\t\tif !x.IsZero() {\n\t\t\txCoin := sdk.NewCoin(coin.Denom, x)\n\t\t\tbva.DelegatedFree = bva.DelegatedFree.Sub(sdk.Coins{xCoin})\n\t\t}\n\n\t\tif !y.IsZero() {\n\t\t\tyCoin := sdk.NewCoin(coin.Denom, y)\n\t\t\tbva.DelegatedVesting = bva.DelegatedVesting.Sub(sdk.Coins{yCoin})\n\t\t}\n\n\t\tbva.Coins = bva.Coins.Add(sdk.Coins{coin})\n\t}\n}",
"func (bva *BaseVestingAccount) TrackUndelegation(amount sdk.Coins) {\n\tfor _, coin := range amount {\n\t\t// panic if the undelegation amount is zero\n\t\tif coin.Amount.IsZero() {\n\t\t\tpanic(\"undelegation attempt with zero coins\")\n\t\t}\n\t\tdelegatedFree := bva.DelegatedFree.AmountOf(coin.Denom)\n\t\tdelegatedVesting := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// compute x and y per the specification, where:\n\t\t// X := min(DF, D)\n\t\t// Y := min(DV, D - X)\n\t\tx := sdk.MinInt(delegatedFree, coin.Amount)\n\t\ty := sdk.MinInt(delegatedVesting, coin.Amount.Sub(x))\n\n\t\tif !x.IsZero() {\n\t\t\txCoin := sdk.NewCoin(coin.Denom, x)\n\t\t\tbva.DelegatedFree = bva.DelegatedFree.Sub(sdk.Coins{xCoin})\n\t\t}\n\n\t\tif !y.IsZero() {\n\t\t\tyCoin := sdk.NewCoin(coin.Denom, y)\n\t\t\tbva.DelegatedVesting = bva.DelegatedVesting.Sub(sdk.Coins{yCoin})\n\t\t}\n\t}\n}",
"func (va *ClawbackVestingAccount) updateDelegation(encumbered, toClawBack, bonded, unbonding, unbonded sdk.Coins) sdk.Coins {\n\tdelegated := bonded.Add(unbonding...)\n\toldDelegated := va.DelegatedVesting.Add(va.DelegatedFree...)\n\tslashed := oldDelegated.Sub(coinsMin(delegated, oldDelegated))\n\ttotal := delegated.Add(unbonded...)\n\ttoClawBack = coinsMin(toClawBack, total) // might have been slashed\n\tnewDelegated := coinsMin(delegated, total.Sub(toClawBack)).Add(slashed...)\n\tva.DelegatedVesting = coinsMin(encumbered, newDelegated)\n\tva.DelegatedFree = newDelegated.Sub(va.DelegatedVesting)\n\treturn toClawBack\n}",
"func sendDelegation() {\n\t// get the address\n\taddress := getTestAddress()\n\t// get the keyname and password\n\tkeyname, password := getKeynameAndPassword()\n\n\taddrFrom, err := sdk.AccAddressFromBech32(address) // validator\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// helper methods for transactions\n\tcdc := app.MakeCodec() // make codec for the app\n\n\t// get the keybase\n\tkeybase := getKeybase()\n\n\t// get the validator address for delegation\n\tvalAddr, err := sdk.ValAddressFromBech32(\"jpyvaloper1ffv7nhd3z6sych2qpqkk03ec6hzkmufyz4scd0\") // **FAUCET**\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// create delegation amount\n\tdelAmount := sdk.NewInt64Coin(sdk.DefaultBondDenom, 1000000)\n\tdelegation := staking.NewMsgDelegate(addrFrom, valAddr, delAmount)\n\tdelegationToSend := []sdk.Msg{delegation}\n\n\t// send the delegation to the blockchain\n\tsendMsgToBlockchain(cdc, address, keyname, password, delegationToSend, keybase)\n}",
"func (k msgServer) Delegate(goCtx context.Context, msg *types.MsgDelegate) (*types.MsgDelegateResponse, error) {\n\tctx := sdk.UnwrapSDKContext(goCtx)\n\tvalAddr, valErr := sdk.ValAddressFromBech32(msg.ValidatorAddress)\n\tif valErr != nil {\n\t\treturn nil, valErr\n\t}\n\n\tvalidator, found := k.GetValidator(ctx, valAddr)\n\tif !found {\n\t\treturn nil, types.ErrNoValidatorFound\n\t}\n\n\tdelegatorAddress, err := sdk.AccAddressFromBech32(msg.DelegatorAddress)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbondDenom := k.BondDenom(ctx)\n\tif msg.Amount.Denom != bondDenom {\n\t\treturn nil, sdkerrors.Wrapf(\n\t\t\tsdkerrors.ErrInvalidRequest, \"invalid coin denomination: got %s, expected %s\", msg.Amount.Denom, bondDenom,\n\t\t)\n\t}\n\n\ttokens := msg.Amount.Amount\n\n\t// if this delegation is from a liquid staking provider (identified if the delegator\n\t// is an ICA account), it cannot exceed the global or validator bond cap\n\tif k.DelegatorIsLiquidStaker(delegatorAddress) {\n\t\tshares, err := validator.SharesFromTokens(tokens)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif err := k.SafelyIncreaseTotalLiquidStakedTokens(ctx, tokens, false); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif err := k.SafelyIncreaseValidatorLiquidShares(ctx, &validator, shares); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// NOTE: source funds are always unbonded\n\tnewShares, err := k.Keeper.Delegate(ctx, delegatorAddress, tokens, types.Unbonded, validator, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif tokens.IsInt64() {\n\t\tdefer func() {\n\t\t\ttelemetry.IncrCounter(1, types.ModuleName, \"delegate\")\n\t\t\ttelemetry.SetGaugeWithLabels(\n\t\t\t\t[]string{\"tx\", \"msg\", msg.Type()},\n\t\t\t\tfloat32(tokens.Int64()),\n\t\t\t\t[]metrics.Label{telemetry.NewLabel(\"denom\", msg.Amount.Denom)},\n\t\t\t)\n\t\t}()\n\t}\n\n\tctx.EventManager().EmitEvents(sdk.Events{\n\t\tsdk.NewEvent(\n\t\t\ttypes.EventTypeDelegate,\n\t\t\tsdk.NewAttribute(types.AttributeKeyValidator, msg.ValidatorAddress),\n\t\t\tsdk.NewAttribute(sdk.AttributeKeyAmount, msg.Amount.String()),\n\t\t\tsdk.NewAttribute(types.AttributeKeyNewShares, newShares.String()),\n\t\t),\n\t})\n\n\treturn &types.MsgDelegateResponse{}, nil\n}",
"func (k Keeper) TransferDelegation(ctx sdk.Context, valAddr sdk.ValAddress, fromDelegator, toDelegator sdk.AccAddress, shares sdk.Dec) (sdk.Dec, error) {\n\t// Redelegations link a delegation to it's previous validator so slashes are propagated to the new validator.\n\t// If the delegation is transferred to a new owner, the redelegation object must be updated.\n\t// For expediency all transfers with redelegations are blocked.\n\tif k.stakingKeeper.HasReceivingRedelegation(ctx, fromDelegator, valAddr) {\n\t\treturn sdk.Dec{}, types.ErrRedelegationsNotCompleted\n\t}\n\n\tif shares.IsNil() || shares.LT(sdk.ZeroDec()) {\n\t\treturn sdk.Dec{}, errorsmod.Wrap(types.ErrUntransferableShares, \"nil or negative shares\")\n\t}\n\tif shares.Equal(sdk.ZeroDec()) {\n\t\t// Block 0 transfers to reduce edge cases.\n\t\treturn sdk.Dec{}, errorsmod.Wrap(types.ErrUntransferableShares, \"zero shares\")\n\t}\n\n\tfromDelegation, found := k.stakingKeeper.GetDelegation(ctx, fromDelegator, valAddr)\n\tif !found {\n\t\treturn sdk.Dec{}, types.ErrNoDelegatorForAddress\n\t}\n\tvalidator, found := k.stakingKeeper.GetValidator(ctx, valAddr)\n\tif !found {\n\t\treturn sdk.Dec{}, types.ErrNoValidatorFound\n\t}\n\t// Prevent validators from reducing their self delegation below the min.\n\tisValidatorOperator := fromDelegator.Equals(valAddr)\n\tif isValidatorOperator {\n\t\tif isBelowMinSelfDelegation(validator, fromDelegation.Shares.Sub(shares)) {\n\t\t\treturn sdk.Dec{}, types.ErrSelfDelegationBelowMinimum\n\t\t}\n\t}\n\n\treturnAmount, err := k.fastUndelegate(ctx, valAddr, fromDelegator, shares)\n\tif err != nil {\n\t\treturn sdk.Dec{}, err\n\t}\n\treturnCoins := sdk.NewCoins(sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), returnAmount))\n\n\tif err := k.bankKeeper.SendCoins(ctx, fromDelegator, toDelegator, returnCoins); err != nil {\n\t\treturn sdk.Dec{}, err\n\t}\n\treceivedShares, err := k.delegateFromAccount(ctx, valAddr, toDelegator, returnAmount)\n\tif err != nil {\n\t\treturn sdk.Dec{}, err\n\t}\n\n\treturn receivedShares, nil\n}",
"func (vs VoteStorage) SetDelegation(ctx sdk.Context, voter types.AccountKey, delegator types.AccountKey, delegation *Delegation) sdk.Error {\n\tstore := ctx.KVStore(vs.key)\n\tdelegationByte, err := vs.cdc.MarshalBinaryLengthPrefixed(*delegation)\n\tif err != nil {\n\t\treturn ErrFailedToMarshalDelegation(err)\n\t}\n\tstore.Set(GetDelegationKey(voter, delegator), delegationByte)\n\tstore.Set(getDelegateeKey(delegator, voter), delegationByte)\n\treturn nil\n}",
"func (suite *KeeperTestSuite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdk.Dec {\n\tstakingDenom := suite.StakingKeeper.BondDenom(suite.Ctx)\n\tmsg := stakingtypes.NewMsgDelegate(\n\t\tdelegator,\n\t\tvalAddr,\n\t\tsdk.NewCoin(stakingDenom, amount),\n\t)\n\n\tmsgServer := stakingkeeper.NewMsgServerImpl(suite.StakingKeeper)\n\t_, err := msgServer.Delegate(sdk.WrapSDKContext(suite.Ctx), msg)\n\tsuite.Require().NoError(err)\n\n\tdel, found := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr)\n\tsuite.Require().True(found)\n\treturn del.Shares\n}",
"func (_DelegationController *DelegationControllerSession) Delegate(validatorId *big.Int, amount *big.Int, delegationPeriod *big.Int, info string) (*types.Transaction, error) {\n\treturn _DelegationController.Contract.Delegate(&_DelegationController.TransactOpts, validatorId, amount, delegationPeriod, info)\n}",
"func (_DelegationController *DelegationControllerTransactorSession) Delegate(validatorId *big.Int, amount *big.Int, delegationPeriod *big.Int, info string) (*types.Transaction, error) {\n\treturn _DelegationController.Contract.Delegate(&_DelegationController.TransactOpts, validatorId, amount, delegationPeriod, info)\n}",
"func (broadcast *Broadcast) Delegate(ctx context.Context, delegator, voter, amount,\n\tprivKeyHex string, seq int64) (*model.BroadcastResponse, error) {\n\tmsg := model.DelegateMsg{\n\t\tDelegator: delegator,\n\t\tVoter: voter,\n\t\tAmount: amount,\n\t}\n\treturn broadcast.broadcastTransaction(ctx, msg, privKeyHex, seq, \"\", false)\n}",
"func (o OfflineNotaryRepository) AddDelegation(data.RoleName, []data.PublicKey, []string) error {\n\treturn nil\n}",
"func (c *Client) AddDelegator(\n\tuser api.UserPass,\n\tfrom []string,\n\tchangeAddr string,\n\trewardAddress,\n\tnodeID string,\n\tstakeAmount,\n\tstartTime,\n\tendTime uint64,\n) (ids.ID, error) {\n\tres := &api.JSONTxID{}\n\tjsonStakeAmount := cjson.Uint64(stakeAmount)\n\terr := c.requester.SendRequest(\"addDelegator\", &AddDelegatorArgs{\n\t\tJSONSpendHeader: api.JSONSpendHeader{\n\t\t\tUserPass: user,\n\t\t\tJSONFromAddrs: api.JSONFromAddrs{From: from},\n\t\t\tJSONChangeAddr: api.JSONChangeAddr{ChangeAddr: changeAddr},\n\t\t}, APIStaker: APIStaker{\n\t\t\tNodeID: nodeID,\n\t\t\tStakeAmount: &jsonStakeAmount,\n\t\t\tStartTime: cjson.Uint64(startTime),\n\t\t\tEndTime: cjson.Uint64(endTime),\n\t\t},\n\t\tRewardAddress: rewardAddress,\n\t}, res)\n\treturn res.TxID, err\n}",
"func Delegate(stub shim.ChaincodeStubInterface, args []string) error {\n\tvar vote entities.Vote\n\terr := json.Unmarshal([]byte(args[0]), &vote)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpoll, err := validateDelegate(stub, vote)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = addVoteToPoll(stub, poll, vote)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(\"saving delegate vote\")\n\tutil.UpdateObjectInChain(stub, vote.ID(), util.VotesIndexName, []byte(args[0]))\n\n\tfmt.Println(\"successfully delegated vote to \" + vote.Delegate + \"!\")\n\treturn nil\n}",
"func (ls *LocalStore) SetDelegation(varname string, owner string, perm Permission, targetUser string) error {\n\t//check that target and owner user exist\n\tif !ls.userExists(targetUser) || !ls.userExists(owner) {\n\t\treturn ErrFailed\n\t}\n\t// Handle special case\n\t// When <tgt> is the keyword all then q delegates <right> to p for all\n\t// variables on which q (currently) has delegate permission.\n\tif varname == allVars {\n\t\t//Check permissions to do this operation\n\t\tif !ls.IsAdmin() && ls.currUserName != owner {\n\t\t\treturn ErrDenied\n\t\t}\n\t\t// Find all varname where owner has DelegatePermission and issue add delegate cmd for this varname\n\t\t// We don't check return value since we already pass all checks and afaik we have delegate Permission\n\t\tfor v, _ := range ls.assertions {\n\t\t\tif ls.HasPermission(v, owner, PermissionDelegate) {\n\t\t\t\tls.SetDelegation(v, owner, perm, targetUser)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\t//do not allow set delegation on local vars\n\tif !ls.isGlobalVarExist(varname) {\n\t\treturn ErrFailed\n\t}\n\t//Check permissions to do this operation\n\tif !ls.IsAdmin() {\n\t\tif ls.currUserName != owner || !ls.HasPermission(varname, owner, PermissionDelegate) {\n\t\t\treturn ErrDenied\n\t\t}\n\t}\n\tls.addAssertion(varname, owner, perm, targetUser)\n\t//invalidate permission cache\n\tls.permissionCache = make(map[PermCacheKey]bool)\n\treturn nil\n}",
"func (_Genesis *GenesisSession) DelegationAmountLimit() (*big.Int, error) {\n\treturn _Genesis.Contract.DelegationAmountLimit(&_Genesis.CallOpts)\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetStartTime returns zero since a delayed vesting account has no start time.
|
func (dva DelayedVestingAccount) GetStartTime() int64 {
return 0
}
|
[
"func (dva *DelayedVestingAccount) GetStartTime() int64 {\n\treturn 0\n}",
"func (cva ContinuousVestingAccount) GetStartTime() int64 {\n\treturn cva.StartTime\n}",
"func (plva PermanentLockedAccount) GetStartTime() int64 {\n\treturn 0\n}",
"func (pva PeriodicVestingAccount) GetStartTime() int64 {\n\treturn pva.StartTime\n}",
"func (cva *ContinuousVestingAccount) GetStartTime() int64 {\n\treturn cva.StartTime\n}",
"func GetStartTime() time.Time {\n\treturn startAtTime\n}",
"func (o *ApplianceSetupInfo) GetStartTime() time.Time {\n\tif o == nil || o.StartTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.StartTime\n}",
"func (_Vesting *VestingCallerSession) StartTime() (*big.Int, error) {\n\treturn _Vesting.Contract.StartTime(&_Vesting.CallOpts)\n}",
"func (txn TxnProbe) GetStartTime() time.Time {\n\treturn txn.startTime\n}",
"func (o *ApplianceSetupInfoAllOf) GetStartTime() time.Time {\n\tif o == nil || o.StartTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.StartTime\n}",
"func (req *StartWFSRequest) GetStartTime() time.Time {\n\treturn req.StartTime\n}",
"func (m *TimeRange) GetStartTime()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly) {\n val, err := m.GetBackingStore().Get(\"startTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly)\n }\n return nil\n}",
"func (r *tektonRun) GetStartTime() *metav1.Time {\n\treturn r.tektonTaskRun.Status.StartTime\n}",
"func (o *Campaign) GetStartTime() time.Time {\n\tif o == nil || o.StartTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.StartTime\n}",
"func (m *TimeRange) GetStartTime()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly) {\n return m.startTime\n}",
"func GetStartTime() time.Time {\n\treturn session.startTime\n}",
"func (_Vesting *VestingCaller) StartTime(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Vesting.contract.Call(opts, &out, \"startTime\")\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}",
"func (v *Validator) StartTime() time.Time {\n\treturn time.Unix(int64(v.Start), 0)\n}",
"func (f *Filler) StartTime() time.Time {\n\treturn f.tp\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
NewPermanentLockedAccount returns a PermanentLockedAccount
|
func NewPermanentLockedAccount(baseAcc *authtypes.BaseAccount, coins sdk.Coins) *PermanentLockedAccount {
baseVestingAcc := &BaseVestingAccount{
BaseAccount: baseAcc,
OriginalVesting: coins,
EndTime: 0, // ensure EndTime is set to 0, as PermanentLockedAccount's do not have an EndTime
}
return &PermanentLockedAccount{baseVestingAcc}
}
|
[
"func (msg MsgCreatePermanentLockedAccount) Type() string { return TypeMsgCreatePermanentLockedAccount }",
"func NewMsgCreatePermanentLockedAccount(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins) *MsgCreatePermanentLockedAccount {\n\treturn &MsgCreatePermanentLockedAccount{\n\t\tFromAddress: fromAddr.String(),\n\t\tToAddress: toAddr.String(),\n\t\tAmount: amount,\n\t}\n}",
"func NewPermanent(err error) error {\n\treturn permanent{err: err}\n}",
"func newAccountManager() *AccountManager {\r\n\taccountManager := new(AccountManager)\r\n\treturn accountManager\r\n}",
"func (e Account) EntNew() ent.Ent { return &Account{} }",
"func newLogin() (Login, error) {\n\tp, err := hash(\"admin\")\n\tif err != nil {\n\t\treturn Login{}, err\n\t}\n\treturn Login{Username: \"admin\", Password: p}, nil\n}",
"func NewLock(session cassandra.Session, tenantID string) *Lock {\n\treturn &Lock{\n\t\tsession: session,\n\t\ttenantID: tenantID,\n\t}\n}",
"func newUserAccountModified(\n\tappCtx appcontext.AppContext,\n\tsysAdminEmail string,\n\taction string,\n\tmodifiedUserID uuid.UUID,\n\tmodifiedAt time.Time,\n) (*UserAccountModified, error) {\n\tsession := appCtx.Session()\n\tif session == nil {\n\t\treturn nil, apperror.NewContextError(\"Unable to find Session in Context\")\n\t}\n\tresponsibleUserID := session.UserID\n\thost := session.Hostname\n\n\treturn &UserAccountModified{\n\t\tsysAdminEmail: sysAdminEmail,\n\t\thost: host,\n\t\taction: action,\n\t\tmodifiedUserID: modifiedUserID,\n\t\tresponsibleUserID: responsibleUserID,\n\t\tmodifiedAt: modifiedAt,\n\t\thtmlTemplate: userAccountModifiedHTMLTemplate,\n\t\ttextTemplate: userAccountModifiedTextTemplate,\n\t}, nil\n}",
"func NewAgedAccountsPayable()(*AgedAccountsPayable) {\n m := &AgedAccountsPayable{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}",
"func tNewUser(lbl string) *tUser {\n\tintBytes := make([]byte, 4)\n\tbinary.BigEndian.PutUint32(intBytes, acctCounter)\n\tacctID := account.AccountID{}\n\tcopy(acctID[:], acctTemplate[:])\n\tcopy(acctID[account.HashSize-4:], intBytes)\n\taddr := strconv.Itoa(int(acctCounter))\n\tsig := []byte{0xab} // Just to differentiate from the addr.\n\tsig = append(sig, intBytes...)\n\tsigHex := hex.EncodeToString(sig)\n\tacctCounter++\n\treturn &tUser{\n\t\tsig: sig,\n\t\tsigHex: sigHex,\n\t\tacct: acctID,\n\t\taddr: addr,\n\t\tlbl: lbl,\n\t}\n}",
"func newAccount() *Account {\n\taccount := &Account{}\n\taccount.NativeBalance = Balance{NativeAsset, \"0\", \"\"}\n\taccount.Signers = []Signer{\n\t\tSigner{},\n\t}\n\taccount.Balances = []Balance{}\n\n\treturn account\n}",
"func newRandomAccountPersistence() accountPersistence {\n\taid, sk := modules.NewAccountID()\n\treturn accountPersistence{\n\t\tAccountID: aid,\n\t\tBalance: types.NewCurrency64(fastrand.Uint64n(1e3)),\n\t\tHostKey: types.SiaPublicKey{},\n\t\tSecretKey: sk,\n\t}\n}",
"func (ak AccountKeeper) NewAccount(ctx sdk.Context, acc exported.Account) exported.Account {\n\t// FIXME: update account number\n\treturn acc\n}",
"func NewLockedJob(j *Job, success func() error, error func(string) error) *LockedJob {\n\treturn &LockedJob{\n\t\tJob: j,\n\t\tsuccess: success,\n\t\terror: error,\n\t}\n}",
"func (c *clientImpl) newAuthorityLocked(config *bootstrap.ServerConfig) (_ *authority, retErr error) {\n\t// First check if there's already an authority for this config. If found, it\n\t// means this authority is used by other watches (could be the same\n\t// authority name, or a different authority name but the same server\n\t// config). Return it.\n\tconfigStr := config.String()\n\tif a, ok := c.authorities[configStr]; ok {\n\t\treturn a, nil\n\t}\n\t// Second check if there's an authority in the idle cache. If found, it\n\t// means this authority was created, but moved to the idle cache because the\n\t// watch was canceled. Move it from idle cache to the authority cache, and\n\t// return.\n\tif old, ok := c.idleAuthorities.Remove(configStr); ok {\n\t\toldA, _ := old.(*authority)\n\t\tif oldA != nil {\n\t\t\tc.authorities[configStr] = oldA\n\t\t\treturn oldA, nil\n\t\t}\n\t}\n\n\t// Make a new authority since there's no existing authority for this config.\n\tret, err := newAuthority(authorityArgs{\n\t\tserverCfg: config,\n\t\tbootstrapCfg: c.config,\n\t\tserializer: c.serializer,\n\t\tresourceTypeGetter: c.resourceTypes.get,\n\t\twatchExpiryTimeout: c.watchExpiryTimeout,\n\t\tlogger: grpclog.NewPrefixLogger(logger, authorityPrefix(c, config.ServerURI)),\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating new authority for config %q: %v\", config.String(), err)\n\t}\n\t// Add it to the cache, so it will be reused.\n\tc.authorities[configStr] = ret\n\treturn ret, nil\n}",
"func newAccountForUser(userID string) *account {\n\tvar ac = account{userID: userID}\n\tac.portfolio = make(portfolio)\n\tac.summary = ring.New(summarySize)\n\n\tac.AddSummaryItem(\"Created\")\n\n\treturn &ac\n}",
"func New(dirname string, resolution time.Duration) (*LockFile, error) {\n\tl := LockFile{\n\t\tdirname: dirname,\n\t\tresolution: resolution,\n\t}\n\n\terr := os.Mkdir(dirname, 0600)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = os.Remove(dirname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &l, nil\n}",
"func (i *Inotify) newWatchLocked(d *Dentry, ws *Watches, mask uint32) *Watch {\n\tw := &Watch{\n\t\towner: i,\n\t\twd: i.nextWatchIDLocked(),\n\t\ttarget: d,\n\t\tmask: atomicbitops.FromUint32(mask),\n\t}\n\n\t// Hold the watch in this inotify instance as well as the watch set on the\n\t// target.\n\ti.watches[w.wd] = w\n\tws.Add(w)\n\treturn w\n}",
"func (a *ActStatus) updateLocked(address arry.Address) types.IAccount {\n\tact := a.db.Account(address)\n\tact.UpdateLocked(a.confirmed)\n\treturn act\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetVestedCoins returns the total amount of vested coins for a permanent locked vesting account. All coins are only vested once the schedule has elapsed.
|
func (plva PermanentLockedAccount) GetVestedCoins(_ time.Time) sdk.Coins {
return nil
}
|
[
"func (pva PeriodicVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tcoins := ReadSchedule(pva.StartTime, pva.EndTime, pva.VestingPeriods, pva.OriginalVesting, blockTime.Unix())\n\tif coins.IsZero() {\n\t\treturn nil\n\t}\n\treturn coins\n}",
"func (dva DelayedVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tif blockTime.Unix() >= dva.EndTime {\n\t\treturn dva.OriginalVesting\n\t}\n\n\treturn nil\n}",
"func (cva ContinuousVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tvar vestedCoins sdk.Coins\n\n\t// We must handle the case where the start time for a vesting account has\n\t// been set into the future or when the start of the chain is not exactly\n\t// known.\n\tif blockTime.Unix() <= cva.StartTime {\n\t\treturn vestedCoins\n\t} else if blockTime.Unix() >= cva.EndTime {\n\t\treturn cva.OriginalVesting\n\t}\n\n\t// calculate the vesting scalar\n\tx := blockTime.Unix() - cva.StartTime\n\ty := cva.EndTime - cva.StartTime\n\ts := sdk.NewDec(x).Quo(sdk.NewDec(y))\n\n\tfor _, ovc := range cva.OriginalVesting {\n\t\tvestedAmt := ovc.Amount.ToDec().Mul(s).RoundInt()\n\t\tvestedCoins = append(vestedCoins, sdk.NewCoin(ovc.Denom, vestedAmt))\n\t}\n\n\treturn vestedCoins\n}",
"func (plva PermanentLockedAccount) GetVestingCoins(_ time.Time) sdk.Coins {\n\treturn plva.OriginalVesting\n}",
"func (cva ContinuousVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn cva.OriginalVesting.Sub(cva.GetVestedCoins(blockTime))\n}",
"func (dva DelayedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn dva.OriginalVesting.Sub(dva.GetVestedCoins(blockTime))\n}",
"func (va ClawbackVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn va.OriginalVesting.Sub(va.GetVestedCoins(blockTime))\n}",
"func (vva ValidatorVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn vva.OriginalVesting.Sub(vva.GetVestedCoins(blockTime))\n}",
"func (va ClawbackVestingAccount) GetVestedOnly(blockTime time.Time) sdk.Coins {\n\treturn ReadSchedule(va.StartTime, va.EndTime, va.VestingPeriods, va.OriginalVesting, blockTime.Unix())\n}",
"func (pva PeriodicVestingAccount) LockedCoins(ctx sdk.Context) sdk.Coins {\n\treturn pva.BaseVestingAccount.LockedCoinsFromVesting(pva.GetVestingCoins(ctx.BlockTime()))\n}",
"func (dva DelayedVestingAccount) LockedCoins(ctx sdk.Context) sdk.Coins {\n\treturn dva.BaseVestingAccount.LockedCoinsFromVesting(dva.GetVestingCoins(ctx.BlockTime()))\n}",
"func (cva ContinuousVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins {\n\treturn cva.spendableCoins(cva.GetVestingCoins(blockTime))\n}",
"func (vva ValidatorVestingAccount) GetFailedVestedCoins() sdk.Coins {\n\tvar failedVestedCoins sdk.Coins\n\tnumberPeriods := len(vva.VestingPeriods)\n\tfor i := 0; i < numberPeriods; i++ {\n\t\tif vva.VestingPeriodProgress[i].PeriodComplete {\n\t\t\tif !vva.VestingPeriodProgress[i].VestingSuccessful {\n\t\t\t\tfailedVestedCoins = failedVestedCoins.Add(vva.VestingPeriods[i].Amount)\n\t\t\t}\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn failedVestedCoins\n}",
"func (bva BaseVestingAccount) LockedCoinsFromVesting(vestingCoins sdk.Coins) sdk.Coins {\n\tlockedCoins := vestingCoins.Sub(vestingCoins.Min(bva.DelegatedVesting))\n\tif lockedCoins == nil {\n\t\treturn sdk.Coins{}\n\t}\n\treturn lockedCoins\n}",
"func (vva ValidatorVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins {\n\treturn vva.BaseVestingAccount.SpendableCoinsVestingAccount(vva.GetVestingCoins(blockTime))\n}",
"func (dva DelayedVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins {\n\treturn dva.spendableCoins(dva.GetVestingCoins(blockTime))\n}",
"func (keeper ViewKeeper) GetCoins(ctx sdk.Context, addr sdk.Address) sdk.Coins {\n\treturn getCoins(ctx, keeper.am, addr)\n}",
"func (bva BaseVestingAccount) spendableCoins(vestingCoins sdk.Coins) sdk.Coins {\n\tvar spendableCoins sdk.Coins\n\tbc := bva.GetCoins()\n\n\tfor _, coin := range bc {\n\t\t// zip/lineup all coins by their denomination to provide O(n) time\n\t\tbaseAmt := coin.Amount\n\t\tvestingAmt := vestingCoins.AmountOf(coin.Denom)\n\t\tdelVestingAmt := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// compute min((BC + DV) - V, BC) per the specification\n\t\tmin := sdk.MinInt(baseAmt.Add(delVestingAmt).Sub(vestingAmt), baseAmt)\n\t\tspendableCoin := sdk.NewCoin(coin.Denom, min)\n\n\t\tif !spendableCoin.IsZero() {\n\t\t\tspendableCoins = spendableCoins.Add(sdk.Coins{spendableCoin})\n\t\t}\n\t}\n\n\treturn spendableCoins\n}",
"func (keeper Keeper) GetCoins(ctx sdk.Context, addr sdk.Address) sdk.Coins {\n\treturn getCoins(ctx, keeper.am, addr)\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetVestingCoins returns the total number of vesting coins for a permanent locked vesting account.
|
func (plva PermanentLockedAccount) GetVestingCoins(_ time.Time) sdk.Coins {
return plva.OriginalVesting
}
|
[
"func (vva ValidatorVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn vva.OriginalVesting.Sub(vva.GetVestedCoins(blockTime))\n}",
"func (va ClawbackVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn va.OriginalVesting.Sub(va.GetVestedCoins(blockTime))\n}",
"func (dva DelayedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn dva.OriginalVesting.Sub(dva.GetVestedCoins(blockTime))\n}",
"func (cva ContinuousVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn cva.OriginalVesting.Sub(cva.GetVestedCoins(blockTime))\n}",
"func (plva PermanentLockedAccount) GetVestedCoins(_ time.Time) sdk.Coins {\n\treturn nil\n}",
"func (pva PeriodicVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tcoins := ReadSchedule(pva.StartTime, pva.EndTime, pva.VestingPeriods, pva.OriginalVesting, blockTime.Unix())\n\tif coins.IsZero() {\n\t\treturn nil\n\t}\n\treturn coins\n}",
"func (cva ContinuousVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tvar vestedCoins sdk.Coins\n\n\t// We must handle the case where the start time for a vesting account has\n\t// been set into the future or when the start of the chain is not exactly\n\t// known.\n\tif blockTime.Unix() <= cva.StartTime {\n\t\treturn vestedCoins\n\t} else if blockTime.Unix() >= cva.EndTime {\n\t\treturn cva.OriginalVesting\n\t}\n\n\t// calculate the vesting scalar\n\tx := blockTime.Unix() - cva.StartTime\n\ty := cva.EndTime - cva.StartTime\n\ts := sdk.NewDec(x).Quo(sdk.NewDec(y))\n\n\tfor _, ovc := range cva.OriginalVesting {\n\t\tvestedAmt := ovc.Amount.ToDec().Mul(s).RoundInt()\n\t\tvestedCoins = append(vestedCoins, sdk.NewCoin(ovc.Denom, vestedAmt))\n\t}\n\n\treturn vestedCoins\n}",
"func (dva DelayedVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tif blockTime.Unix() >= dva.EndTime {\n\t\treturn dva.OriginalVesting\n\t}\n\n\treturn nil\n}",
"func (bva BaseVestingAccount) LockedCoinsFromVesting(vestingCoins sdk.Coins) sdk.Coins {\n\tlockedCoins := vestingCoins.Sub(vestingCoins.Min(bva.DelegatedVesting))\n\tif lockedCoins == nil {\n\t\treturn sdk.Coins{}\n\t}\n\treturn lockedCoins\n}",
"func (pva PeriodicVestingAccount) LockedCoins(ctx sdk.Context) sdk.Coins {\n\treturn pva.BaseVestingAccount.LockedCoinsFromVesting(pva.GetVestingCoins(ctx.BlockTime()))\n}",
"func (dva DelayedVestingAccount) LockedCoins(ctx sdk.Context) sdk.Coins {\n\treturn dva.BaseVestingAccount.LockedCoinsFromVesting(dva.GetVestingCoins(ctx.BlockTime()))\n}",
"func (bva BaseVestingAccount) spendableCoins(vestingCoins sdk.Coins) sdk.Coins {\n\tvar spendableCoins sdk.Coins\n\tbc := bva.GetCoins()\n\n\tfor _, coin := range bc {\n\t\t// zip/lineup all coins by their denomination to provide O(n) time\n\t\tbaseAmt := coin.Amount\n\t\tvestingAmt := vestingCoins.AmountOf(coin.Denom)\n\t\tdelVestingAmt := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// compute min((BC + DV) - V, BC) per the specification\n\t\tmin := sdk.MinInt(baseAmt.Add(delVestingAmt).Sub(vestingAmt), baseAmt)\n\t\tspendableCoin := sdk.NewCoin(coin.Denom, min)\n\n\t\tif !spendableCoin.IsZero() {\n\t\t\tspendableCoins = spendableCoins.Add(sdk.Coins{spendableCoin})\n\t\t}\n\t}\n\n\treturn spendableCoins\n}",
"func (vva ValidatorVestingAccount) GetFailedVestedCoins() sdk.Coins {\n\tvar failedVestedCoins sdk.Coins\n\tnumberPeriods := len(vva.VestingPeriods)\n\tfor i := 0; i < numberPeriods; i++ {\n\t\tif vva.VestingPeriodProgress[i].PeriodComplete {\n\t\t\tif !vva.VestingPeriodProgress[i].VestingSuccessful {\n\t\t\t\tfailedVestedCoins = failedVestedCoins.Add(vva.VestingPeriods[i].Amount)\n\t\t\t}\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn failedVestedCoins\n}",
"func (vva ValidatorVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins {\n\treturn vva.BaseVestingAccount.SpendableCoinsVestingAccount(vva.GetVestingCoins(blockTime))\n}",
"func (keeper ViewKeeper) GetCoins(ctx sdk.Context, addr sdk.Address) sdk.Coins {\n\treturn getCoins(ctx, keeper.am, addr)\n}",
"func (va ClawbackVestingAccount) GetVestedOnly(blockTime time.Time) sdk.Coins {\n\treturn ReadSchedule(va.StartTime, va.EndTime, va.VestingPeriods, va.OriginalVesting, blockTime.Unix())\n}",
"func (cva ContinuousVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins {\n\treturn cva.spendableCoins(cva.GetVestingCoins(blockTime))\n}",
"func (keeper Keeper) GetCoins(ctx sdk.Context, addr sdk.Address) sdk.Coins {\n\treturn getCoins(ctx, keeper.am, addr)\n}",
"func (dva DelayedVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins {\n\treturn dva.spendableCoins(dva.GetVestingCoins(blockTime))\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetStartTime returns zero since a permanent locked vesting account has no start time.
|
func (plva PermanentLockedAccount) GetStartTime() int64 {
return 0
}
|
[
"func (dva *DelayedVestingAccount) GetStartTime() int64 {\n\treturn 0\n}",
"func (dva DelayedVestingAccount) GetStartTime() int64 {\n\treturn 0\n}",
"func (cva ContinuousVestingAccount) GetStartTime() int64 {\n\treturn cva.StartTime\n}",
"func (pva PeriodicVestingAccount) GetStartTime() int64 {\n\treturn pva.StartTime\n}",
"func (cva *ContinuousVestingAccount) GetStartTime() int64 {\n\treturn cva.StartTime\n}",
"func GetStartTime() time.Time {\n\treturn startAtTime\n}",
"func (_Vesting *VestingCallerSession) StartTime() (*big.Int, error) {\n\treturn _Vesting.Contract.StartTime(&_Vesting.CallOpts)\n}",
"func (m *TimeRange) GetStartTime()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly) {\n val, err := m.GetBackingStore().Get(\"startTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly)\n }\n return nil\n}",
"func (o *ApplianceSetupInfo) GetStartTime() time.Time {\n\tif o == nil || o.StartTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.StartTime\n}",
"func GetStartTime() time.Time {\n\treturn session.startTime\n}",
"func (o *ApplianceSetupInfoAllOf) GetStartTime() time.Time {\n\tif o == nil || o.StartTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.StartTime\n}",
"func (req *StartWFSRequest) GetStartTime() time.Time {\n\treturn req.StartTime\n}",
"func (txn TxnProbe) GetStartTime() time.Time {\n\treturn txn.startTime\n}",
"func (m *TimeRange) GetStartTime()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly) {\n return m.startTime\n}",
"func (v *Validator) StartTime() time.Time {\n\treturn time.Unix(int64(v.Start), 0)\n}",
"func (mgr *Manager) StartTime() time.Time {\n\treturn mgr.startTime\n}",
"func StartTime() time.Time {\n\treturn processStartTime\n}",
"func (r *tektonRun) GetStartTime() *metav1.Time {\n\treturn r.tektonTaskRun.Status.StartTime\n}",
"func (s *Session) GetStartTime() time.Time {\n\treturn s.started\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetEndTime returns a vesting account's end time, we return 0 to denote that a permanently locked vesting account has no end time.
|
func (plva PermanentLockedAccount) GetEndTime() int64 {
return 0
}
|
[
"func (bva BaseVestingAccount) GetEndTime() int64 {\n\treturn bva.EndTime\n}",
"func (dva *DelayedVestingAccount) GetEndTime() int64 {\n\treturn dva.EndTime\n}",
"func (cva *ContinuousVestingAccount) GetEndTime() int64 {\n\treturn cva.EndTime\n}",
"func (o *ApplianceSetupInfo) GetEndTime() time.Time {\n\tif o == nil || o.EndTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.EndTime\n}",
"func (o *ApplianceSetupInfoAllOf) GetEndTime() time.Time {\n\tif o == nil || o.EndTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.EndTime\n}",
"func (m *TimeRange) GetEndTime()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly) {\n val, err := m.GetBackingStore().Get(\"endTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly)\n }\n return nil\n}",
"func (m *TimeRange) GetEndTime()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly) {\n return m.endTime\n}",
"func (o *WorkflowWorkflowInfoAllOf) GetEndTime() time.Time {\n\tif o == nil || o.EndTime == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.EndTime\n}",
"func (req *StartWFSRequest) GetEndTime() time.Time {\n\treturn req.EndTime\n}",
"func (m *BookingWorkTimeSlot) GetEnd()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly) {\n val, err := m.GetBackingStore().Get(\"end\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly)\n }\n return nil\n}",
"func GetEndTime(days int) time.Time {\n\tvar result time.Time\n\n\tloc := GetLocation()\n\tn := time.Now().In(loc)\n\tresult = time.Date(n.Year(), n.Month(), n.Day(), 23, 59, 0, 0, loc)\n\tresult = result.Add((4 * 24) * time.Hour)\n\n\treturn result\n}",
"func (v *Validator) EndTime() time.Time {\n\treturn time.Unix(int64(v.End), 0)\n}",
"func (m *SimulationAutomationRun) GetEndDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"endDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}",
"func (m *UnifiedRoleAssignmentScheduleInstance) GetEndDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"endDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}",
"func (m *SimulationAutomationRun) GetEndDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n return m.endDateTime\n}",
"func (o *Job) GetExpectedEndTime(ctx context.Context) (expectedEndTime uint64, err error) {\n\terr = o.object.CallWithContext(ctx, \"org.freedesktop.DBus.Properties.Get\", 0, InterfaceJob, \"ExpectedEndTime\").Store(&expectedEndTime)\n\treturn\n}",
"func (r Reservation) EndTime() string {\n\thr := r.End / 60\n\tmin := r.End % 60\n\tvar ampm string\n\tif ampm = \"AM\"; hr >= 12 {\n\t\tampm = \"PM\"\n\t}\n\tif hr > 12 {\n\t\thr = hr - 12\n\t}\n\tif hr == 0 {\n\t\thr = 12\n\t}\n\treturn fmt.Sprintf(\"%02d:%02d %s\", hr, min, ampm)\n}",
"func (m *MeetingAttendanceReport) GetMeetingEndDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n return m.meetingEndDateTime\n}",
"func (m *Reminder) GetEventEndTime()(DateTimeTimeZoneable) {\n val, err := m.GetBackingStore().Get(\"eventEndTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(DateTimeTimeZoneable)\n }\n return nil\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
NewClawbackVestingAccount returns a new ClawbackVestingAccount
|
func NewClawbackVestingAccount(baseAcc *authtypes.BaseAccount, funder sdk.AccAddress, originalVesting sdk.Coins, startTime int64, lockupPeriods, vestingPeriods Periods) *ClawbackVestingAccount {
// copy and align schedules to avoid mutating inputs
lp := make(Periods, len(lockupPeriods))
copy(lp, lockupPeriods)
vp := make(Periods, len(vestingPeriods))
copy(vp, vestingPeriods)
_, endTime := AlignSchedules(startTime, startTime, lp, vp)
baseVestingAcc := &BaseVestingAccount{
BaseAccount: baseAcc,
OriginalVesting: originalVesting,
EndTime: endTime,
}
return &ClawbackVestingAccount{
BaseVestingAccount: baseVestingAcc,
FunderAddress: funder.String(),
StartTime: startTime,
LockupPeriods: lp,
VestingPeriods: vp,
}
}
|
[
"func MakeNewAccount(name string) (*MyAccount, error) {\n\tkeys, err := NewKeypair()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &MyAccount{\n\t\tFields: make(map[string]string),\n\t\tKeys: keys,\n\t\tName: name,\n\t}, nil\n}",
"func newAccount() *Account {\n\taccount := &Account{}\n\taccount.NativeBalance = Balance{NativeAsset, \"0\", \"\"}\n\taccount.Signers = []Signer{\n\t\tSigner{},\n\t}\n\taccount.Balances = []Balance{}\n\n\treturn account\n}",
"func (ak AccountKeeper) NewAccount(ctx sdk.Context, acc exported.Account) exported.Account {\n\t// FIXME: update account number\n\treturn acc\n}",
"func NewBaseVestingAccount(baseAccount *authtypes.BaseAccount, originalVesting sdk.Coins, endTime int64) *BaseVestingAccount {\n\treturn &BaseVestingAccount{\n\t\tBaseAccount: baseAccount,\n\t\tOriginalVesting: originalVesting,\n\t\tDelegatedFree: sdk.NewCoins(),\n\t\tDelegatedVesting: sdk.NewCoins(),\n\t\tEndTime: endTime,\n\t}\n}",
"func NewFund(initialBalance int) *Fund {\n return &Fund{\n balance: initialBalance,\n }\n}",
"func (suite *KeeperTestSuite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) authtypes.AccountI {\n\tif vestingBalance.IsAnyGT(initialBalance) {\n\t\tpanic(\"vesting balance must be less than initial balance\")\n\t}\n\tacc := suite.CreateAccountWithAddress(addr, initialBalance)\n\tbacc := acc.(*authtypes.BaseAccount)\n\n\tperiods := vestingtypes.Periods{\n\t\tvestingtypes.Period{\n\t\t\tLength: 31556952,\n\t\t\tAmount: vestingBalance,\n\t\t},\n\t}\n\tvacc := vestingtypes.NewPeriodicVestingAccount(bacc, vestingBalance, suite.Ctx.BlockTime().Unix(), periods)\n\tsuite.App.GetAccountKeeper().SetAccount(suite.Ctx, vacc)\n\treturn vacc\n}",
"func NewFundedAccount() *keypair.Full {\n\tkp, err := keypair.Random()\n\tif err != nil {\n\t\tlog.Fatal(err, \"generating random keypair\")\n\t}\n\terr = FundAccount(kp.Address())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Printf(\"successfully funded %s\", kp.Address())\n\treturn kp\n}",
"func (e Account) EntNew() ent.Ent { return &Account{} }",
"func NewBaseVestingAccount(baseAccount *BaseAccount, originalVesting sdk.Coins,\n\tdelegatedFree sdk.Coins, delegatedVesting sdk.Coins, endTime int64) *BaseVestingAccount {\n\n\treturn &BaseVestingAccount{\n\t\tBaseAccount: baseAccount,\n\t\tOriginalVesting: originalVesting,\n\t\tDelegatedFree: delegatedFree,\n\t\tDelegatedVesting: delegatedVesting,\n\t\tEndTime: endTime,\n\t}\n}",
"func (wallet *Wallet) CreateNewAccount(accountName string, shardID *byte) (*AccountWallet, error) {\n\tif accountName != \"\" {\n\t\tfor _, acc := range wallet.MasterAccount.Child {\n\t\t\tif acc.Name == accountName {\n\t\t\t\treturn nil, NewWalletError(ExistedAccountNameErr, nil)\n\t\t\t}\n\t\t}\n\t}\n\n\tif shardID != nil {\n\t\t// only create account for specific Shard\n\t\tnewIndex := uint64(0)\n\t\t// loop to get newest index of childs\n\t\tfor j := len(wallet.MasterAccount.Child) - 1; j >= 0; j-- {\n\t\t\ttemp := wallet.MasterAccount.Child[j]\n\t\t\tif !temp.IsImported {\n\t\t\t\tchildNumber := temp.Key.ChildNumber\n\t\t\t\tchildNumberInt32, err := common.BytesToInt32(childNumber)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, NewWalletError(UnexpectedErr, err)\n\t\t\t\t}\n\t\t\t\tnewIndex = uint64(childNumberInt32 + 1)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// loop to get create a new child which can be equal shardID param\n\t\tvar childKey *KeyWallet\n\t\tfor true {\n\t\t\tchildKey, _ = wallet.MasterAccount.Key.NewChildKey(uint32(newIndex))\n\t\t\tlastByte := childKey.KeySet.PaymentAddress.Pk[len(childKey.KeySet.PaymentAddress.Pk)-1]\n\t\t\tif common.GetShardIDFromLastByte(lastByte) == *shardID {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tnewIndex += 1\n\t\t}\n\t\t// use chosen childKey tp create an child account for wallet\n\t\tif accountName == \"\" {\n\t\t\taccountName = fmt.Sprintf(\"AccountWallet %d\", len(wallet.MasterAccount.Child))\n\t\t}\n\n\t\taccount := AccountWallet{\n\t\t\tKey: *childKey,\n\t\t\tChild: make([]AccountWallet, 0),\n\t\t\tName: accountName,\n\t\t}\n\t\twallet.MasterAccount.Child = append(wallet.MasterAccount.Child, account)\n\t\terr := wallet.Save(wallet.PassPhrase)\n\t\tif err != nil {\n\t\t\tLogger.log.Error(err)\n\t\t}\n\t\treturn &account, nil\n\n\t} else {\n\t\tnewIndex := uint32(len(wallet.MasterAccount.Child))\n\t\tchildKey, _ := wallet.MasterAccount.Key.NewChildKey(newIndex)\n\t\tif accountName == \"\" {\n\t\t\taccountName = fmt.Sprintf(\"AccountWallet %d\", len(wallet.MasterAccount.Child))\n\t\t}\n\t\taccount := AccountWallet{\n\t\t\tKey: *childKey,\n\t\t\tChild: make([]AccountWallet, 0),\n\t\t\tName: accountName,\n\t\t}\n\t\twallet.MasterAccount.Child = append(wallet.MasterAccount.Child, account)\n\t\terr := wallet.Save(wallet.PassPhrase)\n\t\tif err != nil {\n\t\t\tLogger.log.Error(err)\n\t\t}\n\t\treturn &account, nil\n\t}\n}",
"func (nuke mockNukeService) NewAccount(creds awsutil.Credentials) (\n\t*awsutil.Account, error) {\n\t// Failure case\n\tif creds.SessionToken == \"DCENukeTestNewAccountError\" {\n\t\treturn nil, errors.New(\"Error: Failed to create a New Account\")\n\t}\n\n\taccount := awsutil.Account{\n\t\tCredentials: creds,\n\t}\n\treturn &account, nil\n}",
"func newAccountForUser(userID string) *account {\n\tvar ac = account{userID: userID}\n\tac.portfolio = make(portfolio)\n\tac.summary = ring.New(summarySize)\n\n\tac.AddSummaryItem(\"Created\")\n\n\treturn &ac\n}",
"func NewDelayedVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, endTime int64) *DelayedVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &DelayedVestingAccount{baseVestingAcc}\n}",
"func testNewAccount(tc *testContext, wb walletdb.ReadWriteBucket) {\n\tif !tc.create {\n\t\treturn\n\t}\n\n\tif tc.watchingOnly {\n\t\t// Creating new accounts in watching-only mode should return ErrWatchingOnly\n\t\t_, err := tc.manager.NewAccount(wb, \"test\")\n\t\tif !errors.Is(err, errors.WatchingOnly) {\n\t\t\ttc.t.Fatalf(\"NewAccount: expected ErrWatchingOnly, got %v\", err)\n\t\t}\n\t}\n\n\t// Creating new accounts when wallet is locked should return ErrLocked\n\t_, err := tc.manager.NewAccount(wb, \"test\")\n\tif !errors.Is(err, errors.Locked) {\n\t\ttc.t.Fatalf(\"NewAccount: expected ErrLocked, got %v\", err)\n\t}\n\n\trb := wb.(walletdb.ReadBucket)\n\n\t// Unlock the wallet to decrypt cointype keys required to derive\n\t// account keys\n\tif err := tc.manager.Unlock(rb, privPassphrase); err != nil {\n\t\ttc.t.Fatalf(\"Unlock: unexpected error: %v\", err)\n\t}\n\ttc.unlocked = true\n\n\ttestName := \"acct-create\"\n\texpectedAccount := tc.account + 1\n\taccount, err := tc.manager.NewAccount(wb, testName)\n\tif err != nil {\n\t\ttc.t.Fatalf(\"NewAccount: unexpected error: %v\", err)\n\t}\n\tif account != expectedAccount {\n\t\ttc.t.Fatalf(\"NewAccount account mismatch -- got %d, want %d\",\n\t\t\taccount, expectedAccount)\n\t}\n\n\t// Test duplicate account name error\n\t_, err = tc.manager.NewAccount(wb, testName)\n\tif !errors.Is(err, errors.Exist) {\n\t\ttc.t.Fatalf(\"NewAccount: expected ErrExist, got %v\", err)\n\t}\n\t// Test account name validation\n\ttestName = \"\" // Empty account names are not allowed\n\t_, err = tc.manager.NewAccount(wb, testName)\n\tif !errors.Is(err, errors.Invalid) {\n\t\ttc.t.Fatalf(\"NewAccount: expected ErrInvalid, got %v\", err)\n\t}\n\ttestName = \"imported\" // A reserved account name\n\t_, err = tc.manager.NewAccount(wb, testName)\n\tif !errors.Is(err, errors.Invalid) {\n\t\ttc.t.Fatalf(\"NewAccount: expected ErrInvalid, got %v\", err)\n\t}\n}",
"func NewDelayedVestingAccount(baseAcc *BaseAccount, endTime int64) *DelayedVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &DelayedVestingAccount{baseVestingAcc}\n}",
"func (*ACMEIssuer) newAccount(email string) (acme.Account, error) {\n\tvar acct acme.Account\n\tif email != \"\" {\n\t\tacct.Contact = []string{\"mailto:\" + email} // TODO: should we abstract the contact scheme?\n\t}\n\tprivateKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\tif err != nil {\n\t\treturn acct, fmt.Errorf(\"generating private key: %v\", err)\n\t}\n\tacct.PrivateKey = privateKey\n\treturn acct, nil\n}",
"func CreateNewAccount(w http.ResponseWriter, r *http.Request) {\n\tAccounts, err := ReadAccounts()\n\tif err != nil {\n\t\thttp.Error(w, \"データベースの参照に失敗しました。\\n\", http.StatusInternalServerError)\n\t\tlog.Printf(\"データベースの参照に失敗しました。\\n%v\\n\", err)\n\t\treturn\n\t}\n\n\tCookieData, err := GetCookieValue(r)\n\tif err != nil {\n\t\thttp.Error(w, \"Cookieの取得に失敗しました。\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\terr = r.ParseForm()\n\tif err != nil {\n\t\tfmt.Printf(\"Parse form error\\n%v\\n\", err)\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\tnickname := r.Form.Get(\"nickname\")\n\tif nickname == \"\" {\n\t\tnickname = Accounts[CookieData[\"id\"]].Name\n\t}\n\n\tAccounts[CookieData[\"id\"]] = AccountList{Name: nickname}\n\n\tif err = ExportAccounts(Accounts); err != nil {\n\t\thttp.Error(w, \"データの書き出しに失敗しました。\\n\", http.StatusInternalServerError)\n\t\tlog.Printf(\"データの書き出しに失敗しました。\\n%v\\n\", err)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Location\", \"/\")\n\tw.WriteHeader(http.StatusTemporaryRedirect)\n}",
"func NewContinuousVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime, endTime int64) *ContinuousVestingAccount {\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ContinuousVestingAccount{\n\t\tStartTime: startTime,\n\t\tBaseVestingAccount: baseVestingAcc,\n\t}\n}",
"func NewAccount(val string) AccountField {\n\treturn AccountField{quickfix.FIXString(val)}\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetVestingCoins returns the total number of vesting coins. If no coins are vesting, nil is returned.
|
func (va ClawbackVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {
return va.OriginalVesting.Sub(va.GetVestedCoins(blockTime))
}
|
[
"func (vva ValidatorVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn vva.OriginalVesting.Sub(vva.GetVestedCoins(blockTime))\n}",
"func (cva ContinuousVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn cva.OriginalVesting.Sub(cva.GetVestedCoins(blockTime))\n}",
"func (dva DelayedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {\n\treturn dva.OriginalVesting.Sub(dva.GetVestedCoins(blockTime))\n}",
"func (plva PermanentLockedAccount) GetVestingCoins(_ time.Time) sdk.Coins {\n\treturn plva.OriginalVesting\n}",
"func (cva ContinuousVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tvar vestedCoins sdk.Coins\n\n\t// We must handle the case where the start time for a vesting account has\n\t// been set into the future or when the start of the chain is not exactly\n\t// known.\n\tif blockTime.Unix() <= cva.StartTime {\n\t\treturn vestedCoins\n\t} else if blockTime.Unix() >= cva.EndTime {\n\t\treturn cva.OriginalVesting\n\t}\n\n\t// calculate the vesting scalar\n\tx := blockTime.Unix() - cva.StartTime\n\ty := cva.EndTime - cva.StartTime\n\ts := sdk.NewDec(x).Quo(sdk.NewDec(y))\n\n\tfor _, ovc := range cva.OriginalVesting {\n\t\tvestedAmt := ovc.Amount.ToDec().Mul(s).RoundInt()\n\t\tvestedCoins = append(vestedCoins, sdk.NewCoin(ovc.Denom, vestedAmt))\n\t}\n\n\treturn vestedCoins\n}",
"func (dva DelayedVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tif blockTime.Unix() >= dva.EndTime {\n\t\treturn dva.OriginalVesting\n\t}\n\n\treturn nil\n}",
"func (pva PeriodicVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins {\n\tcoins := ReadSchedule(pva.StartTime, pva.EndTime, pva.VestingPeriods, pva.OriginalVesting, blockTime.Unix())\n\tif coins.IsZero() {\n\t\treturn nil\n\t}\n\treturn coins\n}",
"func (plva PermanentLockedAccount) GetVestedCoins(_ time.Time) sdk.Coins {\n\treturn nil\n}",
"func GetCoins() (coins []Coin, error error) {\n\tvar c = []Coin{}\n\tvar d struct {\n\t\tCrypto []Coin `json:\"crypto\"`\n\t}\n\tjsonData, err := doTauRequest(1, \"GET\", \"data/coins\", nil)\n\tif err != nil {\n\t\treturn c, err\n\t}\n\tif err := json.Unmarshal(jsonData, &d); err != nil {\n\t\treturn c, err\n\t}\n\treturn d.Crypto, nil\n}",
"func (bva BaseVestingAccount) spendableCoins(vestingCoins sdk.Coins) sdk.Coins {\n\tvar spendableCoins sdk.Coins\n\tbc := bva.GetCoins()\n\n\tfor _, coin := range bc {\n\t\t// zip/lineup all coins by their denomination to provide O(n) time\n\t\tbaseAmt := coin.Amount\n\t\tvestingAmt := vestingCoins.AmountOf(coin.Denom)\n\t\tdelVestingAmt := bva.DelegatedVesting.AmountOf(coin.Denom)\n\n\t\t// compute min((BC + DV) - V, BC) per the specification\n\t\tmin := sdk.MinInt(baseAmt.Add(delVestingAmt).Sub(vestingAmt), baseAmt)\n\t\tspendableCoin := sdk.NewCoin(coin.Denom, min)\n\n\t\tif !spendableCoin.IsZero() {\n\t\t\tspendableCoins = spendableCoins.Add(sdk.Coins{spendableCoin})\n\t\t}\n\t}\n\n\treturn spendableCoins\n}",
"func (keeper ViewKeeper) GetCoins(ctx sdk.Context, addr sdk.Address) sdk.Coins {\n\treturn getCoins(ctx, keeper.am, addr)\n}",
"func (bva BaseVestingAccount) LockedCoinsFromVesting(vestingCoins sdk.Coins) sdk.Coins {\n\tlockedCoins := vestingCoins.Sub(vestingCoins.Min(bva.DelegatedVesting))\n\tif lockedCoins == nil {\n\t\treturn sdk.Coins{}\n\t}\n\treturn lockedCoins\n}",
"func (vva ValidatorVestingAccount) GetFailedVestedCoins() sdk.Coins {\n\tvar failedVestedCoins sdk.Coins\n\tnumberPeriods := len(vva.VestingPeriods)\n\tfor i := 0; i < numberPeriods; i++ {\n\t\tif vva.VestingPeriodProgress[i].PeriodComplete {\n\t\t\tif !vva.VestingPeriodProgress[i].VestingSuccessful {\n\t\t\t\tfailedVestedCoins = failedVestedCoins.Add(vva.VestingPeriods[i].Amount)\n\t\t\t}\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn failedVestedCoins\n}",
"func (t *TauAPI) GetCoins() (coins []Coin, error error) {\n\tvar c = []Coin{}\n\tvar d struct {\n\t\tCrypto []Coin `json:\"cryto\"` //typo from api\n\t\tFiat []Coin `json:\"fiat\"`\n\t}\n\tjsonData, err := t.doTauRequest(&TauReq{\n\t\tVersion: 2,\n\t\tMethod: \"GET\",\n\t\tPath: \"coins\",\n\t})\n\tif err != nil {\n\t\treturn c, err\n\t}\n\tif err := json.Unmarshal(jsonData, &d); err != nil {\n\t\treturn c, err\n\t}\n\tc = append(d.Crypto, d.Fiat...)\n\treturn c, nil\n}",
"func (keeper Keeper) GetCoins(ctx sdk.Context, addr sdk.Address) sdk.Coins {\n\treturn getCoins(ctx, keeper.am, addr)\n}",
"func coins(a int) int {\n\tif a == 0 {\n\t\treturn 0\n\t}\n\treturn doCoins(a, 25)\n}",
"func (vva ValidatorVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins {\n\treturn vva.BaseVestingAccount.SpendableCoinsVestingAccount(vva.GetVestingCoins(blockTime))\n}",
"func (repository *Repository) GetCoins() []models.Coin {\n\tvar coins []models.Coin\n\n\terr := repository.DB.Model(&coins).\n\t\tColumn(\"crr\", \"volume\", \"reserve_balance\", \"name\", \"symbol\").\n\t\tWhere(\"deleted_at IS NULL\").\n\t\tOrder(\"reserve_balance DESC\").\n\t\tSelect()\n\n\thelpers.CheckErr(err)\n\n\treturn coins\n}",
"func (f *FTX) GetCoins(ctx context.Context) ([]WalletCoinsData, error) {\n\tresp := struct {\n\t\tData []WalletCoinsData `json:\"result\"`\n\t}{}\n\treturn resp.Data, f.SendAuthHTTPRequest(ctx, exchange.RestSpot, http.MethodGet, getCoins, nil, &resp)\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetVestingPeriods returns vesting periods associated with periodic vesting account.
|
func (va ClawbackVestingAccount) GetVestingPeriods() Periods {
return va.VestingPeriods
}
|
[
"func (pva PeriodicVestingAccount) GetVestingPeriods() Periods {\n\treturn pva.VestingPeriods\n}",
"func Periods() (periods []Periodo, err error) {\n var period Periodo\n stq := \"SELECT id, inicio, final, created_at, updated_at FROM periods order by inicio desc\"\n\trows, err := Db.Query(stq)\n\tif err != nil {\n\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tif err = rows.Scan(&period.Id, &period.Inicio, &period.Final, &period.CreatedAt, &period.UpdatedAt); err != nil {\n\t\treturn\n\t\t}\n\t\tperiods = append(periods, period)\n\t}\n\treturn\n }",
"func NewPeriodicVestingAccount(baseAcc *authtypes.BaseAccount, originalVesting sdk.Coins, startTime int64, periods Periods) *PeriodicVestingAccount {\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func newPeriodicVestingAccount(address sdk.AccAddress, periods vestingtypes.Periods, firstPeriodStartTimestamp int64) *vestingtypes.PeriodicVestingAccount {\n\tbaseAccount := authtypes.NewBaseAccount(address, nil, 0, 0)\n\n\toriginalVesting := sdk.NewCoins()\n\tfor _, p := range periods {\n\t\toriginalVesting = originalVesting.Add(p.Amount...)\n\t}\n\n\tvar totalPeriods int64\n\tfor _, p := range periods {\n\t\ttotalPeriods += p.Length\n\t}\n\tendTime := firstPeriodStartTimestamp + totalPeriods\n\n\tbaseVestingAccount := vestingtypes.NewBaseVestingAccount(baseAccount, originalVesting, endTime)\n\treturn vestingtypes.NewPeriodicVestingAccountRaw(baseVestingAccount, firstPeriodStartTimestamp, periods)\n}",
"func (n Network) VestingAccounts(ctx context.Context, launchID uint64) (vestingAccs []networktypes.VestingAccount, err error) {\n\tn.ev.Send(events.New(events.StatusOngoing, \"Fetching genesis vesting accounts\"))\n\tres, err := n.launchQuery.\n\t\tVestingAccountAll(ctx,\n\t\t\t&launchtypes.QueryAllVestingAccountRequest{\n\t\t\t\tLaunchID: launchID,\n\t\t\t},\n\t\t)\n\tif err != nil {\n\t\treturn vestingAccs, err\n\t}\n\n\tfor i, acc := range res.VestingAccount {\n\t\tparsedAcc, err := networktypes.ToVestingAccount(acc)\n\t\tif err != nil {\n\t\t\treturn vestingAccs, errors.Wrapf(err, \"error parsing vesting account %d\", i)\n\t\t}\n\n\t\tvestingAccs = append(vestingAccs, parsedAcc)\n\t}\n\n\treturn vestingAccs, nil\n}",
"func (db *DB) GetAllPeriods() ([]string, error) {\n\tvar allPeriods []string\n\n\tconn, err := redishelper.GetRedisConn(db.RedisServer, db.RedisPassword)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\tdefer conn.Close()\n\n\tk := \"ming:campuses\"\n\tcampuses, err := redis.Strings(conn.Do(\"ZRANGE\", k, 0, -1))\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\n\tfor _, campus := range campuses {\n\t\tk = fmt.Sprintf(\"ming:%v:categories\", campus)\n\t\tcategories, err := redis.Strings(conn.Do(\"ZRANGE\", k, 0, -1))\n\t\tif err != nil {\n\t\t\treturn []string{}, err\n\t\t}\n\n\t\tfor _, category := range categories {\n\t\t\tk = fmt.Sprintf(\"ming:%v:%v:periods\", campus, category)\n\t\t\tperiods, err := redis.Strings(conn.Do(\"ZRANGE\", k, 0, -1))\n\t\t\tif err != nil {\n\t\t\t\treturn []string{}, err\n\t\t\t}\n\n\t\t\tfor _, period := range periods {\n\t\t\t\tallPeriods = append(allPeriods, fmt.Sprintf(\"%v:%v:%v\", campus, category, period))\n\t\t\t}\n\n\t\t}\n\t}\n\treturn allPeriods, nil\n}",
"func (vp Periods) String() string {\n\tperiodsListString := make([]string, len(vp))\n\tfor _, period := range vp {\n\t\tperiodsListString = append(periodsListString, period.String())\n\t}\n\n\treturn strings.TrimSpace(fmt.Sprintf(`Vesting Periods:\n\t\t%s`, strings.Join(periodsListString, \", \")))\n}",
"func (_VestedPayment *VestedPaymentCallerSession) TotalPeriods() (*big.Int, error) {\n\treturn _VestedPayment.Contract.TotalPeriods(&_VestedPayment.CallOpts)\n}",
"func (keeper Keeper) GetVotingPeriod(ctx sdk.Context, content govtypes.Content) (votingPeriod time.Duration) {\n\tswitch content.(type) {\n\tcase types.ParameterChangeProposal:\n\t\tvotingPeriod = keeper.GetParams(ctx).VotingPeriod\n\t}\n\n\treturn\n}",
"func PeriodGET(w http.ResponseWriter, r *http.Request) {\n\tsess := model.Instance(r)\n lisPeriods, _ := model.Periods()\n\tv := view.New(r)\n\tv.Name = \"periodo/period\"\n\tv.Vars[\"token\"] = csrfbanana.Token(w, r, sess)\n v.Vars[\"LisPeriods\"] = lisPeriods\n// Refill any form fields\n// view.Repopulate([]string{\"name\"}, r.Form, v.Vars)\n\tv.Render(w)\n }",
"func NewValidatorVestingAccount(baseAcc *authtypes.BaseAccount, startTime int64, periods vestingtypes.Periods, validatorAddress sdk.ConsAddress, returnAddress sdk.AccAddress, signingThreshold int64) *ValidatorVestingAccount {\n\n\tendTime := startTime\n\tfor _, p := range periods {\n\t\tendTime += p.Length\n\t}\n\tbaseVestingAcc := &vestingtypes.BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: baseAcc.Coins,\n\t\tEndTime: endTime,\n\t}\n\tpva := &vestingtypes.PeriodicVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n\tvar vestingPeriodProgress []VestingProgress\n\tfor i := 0; i < len(periods); i++ {\n\t\tvestingPeriodProgress = append(vestingPeriodProgress, VestingProgress{false, false})\n\t}\n\n\treturn &ValidatorVestingAccount{\n\t\tPeriodicVestingAccount: pva,\n\t\tValidatorAddress: validatorAddress,\n\t\tReturnAddress: returnAddress,\n\t\tSigningThreshold: signingThreshold,\n\t\tCurrentPeriodProgress: CurrentPeriodProgress{0, 0},\n\t\tVestingPeriodProgress: vestingPeriodProgress,\n\t\tDebtAfterFailedVesting: sdk.NewCoins(),\n\t}\n}",
"func (_VestedPayment *VestedPaymentCaller) TotalPeriods(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _VestedPayment.contract.Call(opts, out, \"totalPeriods\")\n\treturn *ret0, err\n}",
"func (c *UptimeCommand) GetPeriodOptions() []string {\n\treturn []string{\n\t\t\"Today\",\n\t\t\"Yesterday\",\n\t\t\"ThisWeek\",\n\t\t\"LastWeek\",\n\t\t\"ThisMonth\",\n\t\t\"LastMonth\",\n\t\t\"ThisYear\",\n\t\t\"LastYear\",\n\t}\n}",
"func LoadPeriods(api *eos.API, includePast, includeFuture bool) []Period {\n\n\tvar periods []Period\n\tvar periodRequest eos.GetTableRowsRequest\n\tperiodRequest.Code = \"dao.hypha\"\n\tperiodRequest.Scope = \"dao.hypha\"\n\tperiodRequest.Table = \"periods\"\n\tperiodRequest.Limit = 1000\n\tperiodRequest.JSON = true\n\n\tperiodResponse, err := api.GetTableRows(context.Background(), periodRequest)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tperiodResponse.JSONToStructs(&periods)\n\n\tvar returnPeriods []Period\n\tcurrentPeriod, err := CurrentPeriod(&periods)\n\tif (includePast || includeFuture) && err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor _, period := range periods {\n\t\tif includePast || includeFuture {\n\t\t\tif includePast && period.PeriodID <= uint64(currentPeriod) {\n\t\t\t\treturnPeriods = append(returnPeriods, period)\n\t\t\t} else if includeFuture && period.PeriodID >= uint64(currentPeriod) {\n\t\t\t\treturnPeriods = append(returnPeriods, period)\n\t\t\t}\n\t\t}\n\t}\n\treturn returnPeriods\n}",
"func NewPeriodicVestingAccountRaw(bva *BaseVestingAccount, startTime int64, periods Periods) *PeriodicVestingAccount {\n\treturn &PeriodicVestingAccount{\n\t\tBaseVestingAccount: bva,\n\t\tStartTime: startTime,\n\t\tVestingPeriods: periods,\n\t}\n}",
"func vestingDataToEvents(data cli.VestingData) ([]event, error) {\n\tstartTime := time.Unix(data.StartTime, 0)\n\tevents := []event{}\n\tlastTime := startTime\n\tfor _, p := range data.Periods {\n\t\tcoins, err := sdk.ParseCoinsNormalized(p.Coins)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnewTime := lastTime.Add(time.Duration(p.Length) * time.Second)\n\t\te := event{\n\t\t\tTime: newTime,\n\t\t\tCoins: coins,\n\t\t}\n\t\tevents = append(events, e)\n\t\tlastTime = newTime\n\t}\n\treturn events, nil\n}",
"func GetTotalVestingPeriodLength(periods vestingtypes.Periods) int64 {\n\tlength := int64(0)\n\tfor _, period := range periods {\n\t\tlength += period.Length\n\t}\n\treturn length\n}",
"func (o *GetOutagesParams) WithPeriod(period *float64) *GetOutagesParams {\n\to.SetPeriod(period)\n\treturn o\n}",
"func GetTotalVestingPeriodLength(periods vesting.Periods) int64 {\n\tlength := int64(0)\n\tfor _, period := range periods {\n\t\tlength += period.Length\n\t}\n\treturn length\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
coinEq returns whether two Coins are equal. The IsEqual() method can panic.
|
func coinEq(a, b sdk.Coins) bool {
return a.IsAllLTE(b) && b.IsAllLTE(a)
}
|
[
"func (coin Coin) IsEqual(other Coin) bool {\n\treturn coin.Amount.Equal(other.Amount)\n}",
"func (v Coin) Equal(o Coin) bool {\n\treturn v.Amount.Equal(o.Amount) &&\n\t\tv.CoinIdentifier.Equal(o.CoinIdentifier)\n}",
"func (n *Uint256) Eq(n2 *Uint256) bool {\n\treturn n.n[0] == n2.n[0] && n.n[1] == n2.n[1] && n.n[2] == n2.n[2] &&\n\t\tn.n[3] == n2.n[3]\n}",
"func (v Currency) Equal(o Currency) bool {\n\treturn v.Decimals == o.Decimals &&\n\t\tstring(v.Metadata) == string(o.Metadata) &&\n\t\tv.Symbol == o.Symbol\n}",
"func (v CoinChange) Equal(o CoinChange) bool {\n\treturn v.CoinAction == o.CoinAction &&\n\t\tv.CoinIdentifier.Equal(o.CoinIdentifier)\n}",
"func (x *Money) Equal(y *Money) bool {\n\tif x.Currency != y.Currency {\n\t\treturn false\n\t}\n\treturn x.Amount.Equal(y.Amount)\n}",
"func (v AccountCoinsRequest) Equal(o AccountCoinsRequest) bool {\n\treturn v.AccountIdentifier.Equal(o.AccountIdentifier) &&\n\t\tlen(v.Currencies) == len(o.Currencies) &&\n\t\tcurrencySliceEqual(v.Currencies, o.Currencies) &&\n\t\tv.IncludeMempool == o.IncludeMempool\n}",
"func (bal Balance) Equals(other Balance) bool {\r\n\treturn bal.Coins == other.Coins && bal.Hours == other.Hours\r\n}",
"func (c *Coinbase) Equals(t Transaction) bool {\n\n\tother, ok := t.(*Coinbase)\n\tif !ok {\n\t\treturn false\n\t}\n\n\tif !bytes.Equal(c.R, other.R) {\n\t\treturn false\n\t}\n\n\tif !bytes.Equal(c.Score, other.Score) {\n\t\treturn false\n\t}\n\n\tif !bytes.Equal(c.Proof, other.Proof) {\n\t\treturn false\n\t}\n\n\tif !c.Rewards.Equals(other.Rewards) {\n\t\treturn false\n\t}\n\n\treturn true\n}",
"func (v AccountCoinsResponse) Equal(o AccountCoinsResponse) bool {\n\treturn v.BlockIdentifier.Equal(o.BlockIdentifier) &&\n\t\tlen(v.Coins) == len(o.Coins) &&\n\t\tcoinSliceEqual(v.Coins, o.Coins) &&\n\t\tstring(v.Metadata) == string(o.Metadata)\n}",
"func (c *Client) VerifyCoin(blob, id string) (bool, error) {\n\t// build request body\n\tbody := struct {\n\t\tCoinBlob string `json:\"coin_blob\"`\n\t\tMinerID string `json:\"id_of_miner\"`\n\t}{\n\t\tCoinBlob: base64.StdEncoding.EncodeToString([]byte(blob)),\n\t\tMinerID: id,\n\t}\n\t// marshall built json\n\tbyt, err := json.Marshal(&body)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"could not marshall request body: %s\", err)\n\t}\n\t// build request\n\treq, err := http.NewRequest(http.MethodPost,\n\t\tfmt.Sprintf(\"%s/verify_example_coin\", c.url),\n\t\tbytes.NewBuffer(byt))\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"could not build http request: %s\", err)\n\t}\n\t// send request\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"could not send http request: %s\", err)\n\t}\n\t// check status code\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn false, nil\n\t}\n\treturn true, nil\n}",
"func (c1 *Certificate) Equal(c2 *Certificate) bool {\n\treturn reflect.DeepEqual(c1.Certificate, c2.Certificate)\n}",
"func Eq(obj1 any, obj2 any) bool",
"func (tx *Transaction) IsCoinbase() bool {\n\treturn len(tx.Vin) == 1 && len(tx.Vin[0].Txid) == 0 && tx.Vin[0].Vout == -1\n}",
"func (recv *Checksum) Equals(other *Checksum) bool {\n\treturn other.ToC() == recv.ToC()\n}",
"func (tx Transaction) IsCoinbase() bool {\n\treturn len(tx.Vin) == 1 && len(tx.Vin[0].Txid) == 0 && tx.Vin[0].Vout == -1\n}",
"func (b Balance) Equal(b2 Balance) bool {\n\treturn b.Int != nil && b2.Int != nil && b.Int.Cmp(b2.Int) == 0\n}",
"func Eq(a, b interface{}, f Func) bool {\n\treturn f(a, b) == 0\n}",
"func (na NetAddr) IsEq(other NetAddr) (res bool) {\n\tres = bool(C.netaddr_is_eq(na.inner, other.inner))\n\truntime.KeepAlive(na)\n\truntime.KeepAlive(other)\n\treturn\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
MarshalYAML returns the YAML representation of a ClawbackVestingAccount.
|
func (va ClawbackVestingAccount) MarshalYAML() (interface{}, error) {
accAddr, err := sdk.AccAddressFromBech32(va.Address)
if err != nil {
return nil, err
}
out := vestingAccountYAML{
Address: accAddr,
AccountNumber: va.AccountNumber,
PubKey: getPKString(va),
Sequence: va.Sequence,
OriginalVesting: va.OriginalVesting,
DelegatedFree: va.DelegatedFree,
DelegatedVesting: va.DelegatedVesting,
EndTime: va.EndTime,
StartTime: va.StartTime,
VestingPeriods: va.VestingPeriods,
}
return marshalYaml(out)
}
|
[
"func (bva BaseVestingAccount) MarshalYAML() (interface{}, error) {\n\taccAddr, err := sdk.AccAddressFromBech32(bva.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := vestingAccountYAML{\n\t\tAddress: accAddr,\n\t\tAccountNumber: bva.AccountNumber,\n\t\tPubKey: getPKString(bva),\n\t\tSequence: bva.Sequence,\n\t\tOriginalVesting: bva.OriginalVesting,\n\t\tDelegatedFree: bva.DelegatedFree,\n\t\tDelegatedVesting: bva.DelegatedVesting,\n\t\tEndTime: bva.EndTime,\n\t}\n\treturn marshalYaml(out)\n}",
"func (cva ContinuousVestingAccount) MarshalYAML() (interface{}, error) {\n\taccAddr, err := sdk.AccAddressFromBech32(cva.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := vestingAccountYAML{\n\t\tAddress: accAddr,\n\t\tAccountNumber: cva.AccountNumber,\n\t\tPubKey: getPKString(cva),\n\t\tSequence: cva.Sequence,\n\t\tOriginalVesting: cva.OriginalVesting,\n\t\tDelegatedFree: cva.DelegatedFree,\n\t\tDelegatedVesting: cva.DelegatedVesting,\n\t\tEndTime: cva.EndTime,\n\t\tStartTime: cva.StartTime,\n\t}\n\treturn marshalYaml(out)\n}",
"func (pva PeriodicVestingAccount) MarshalYAML() (interface{}, error) {\n\taccAddr, err := sdk.AccAddressFromBech32(pva.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := vestingAccountYAML{\n\t\tAddress: accAddr,\n\t\tAccountNumber: pva.AccountNumber,\n\t\tPubKey: getPKString(pva),\n\t\tSequence: pva.Sequence,\n\t\tOriginalVesting: pva.OriginalVesting,\n\t\tDelegatedFree: pva.DelegatedFree,\n\t\tDelegatedVesting: pva.DelegatedVesting,\n\t\tEndTime: pva.EndTime,\n\t\tStartTime: pva.StartTime,\n\t\tVestingPeriods: pva.VestingPeriods,\n\t}\n\treturn marshalYaml(out)\n}",
"func (acc BaseAccount) MarshalYAML() (interface{}, error) {\n\tvar bs []byte\n\tvar err error\n\tvar pubkey string\n\n\tif acc.PubKey != nil {\n\t\tpubkey, err = sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, acc.PubKey)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tbs, err = yaml.Marshal(struct {\n\t\tAddress sdk.AccAddress\n\t\tCoins sdk.Coins\n\t\tPubKey string\n\t\tAccountNumber uint64\n\t\tSequence uint64\n\t}{\n\t\tAddress: acc.Address,\n\t\tCoins: acc.Coins,\n\t\tPubKey: pubkey,\n\t\tAccountNumber: acc.AccountNumber,\n\t\tSequence: acc.Sequence,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn string(bs), err\n}",
"func (b *Backend) MarshalYAML() (interface{}, error) {\n\tb.mu.RLock()\n\tdefer b.mu.RUnlock()\n\n\tpayload := struct {\n\t\tAddress string\n\t\tDisabledUntil time.Time `yaml:\"disabledUntil\"`\n\t\tForcePromotionsAfter time.Duration `yaml:\"forcePromotionsAfter\"`\n\t\tLatency time.Duration `yaml:\"latency\"`\n\t\tMaxConnections int `yaml:\"maxConnections\"`\n\t\tTier int `yaml:\"tier\"`\n\t}{\n\t\tAddress: b.addr.String(),\n\t\tDisabledUntil: b.mu.disabledUntil,\n\t\tForcePromotionsAfter: b.mu.forcePromotionAfter,\n\t\tLatency: b.mu.lastLatency,\n\t\tMaxConnections: b.mu.maxConnections,\n\t\tTier: b.mu.tier,\n\t}\n\treturn payload, nil\n}",
"func (i Instance) MarshalYAML() (interface{}, error) {\n\treturn i.Vars, nil\n}",
"func (i UserGroupAccess) MarshalYAML() (interface{}, error) {\n\treturn i.String(), nil\n}",
"func (s *Secret) MarshalYAML() (interface{}, error) {\n\treturn \"<secret>\", nil\n}",
"func (a Authentication) MarshalYAML() (interface{}, error) {\n\tvalues := make(map[string]interface{})\n\n\tif a.AccessToken != \"\" {\n\t\tvalues[accessToken] = a.AccessToken\n\t}\n\tif a.APIKey != \"\" {\n\t\tvalues[apiKey] = a.APIKey\n\t}\n\tif a.ClientId != \"\" {\n\t\tvalues[clientID] = a.ClientId\n\t}\n\tif a.ClientSecret != \"\" {\n\t\tvalues[clientSecret] = a.ClientSecret\n\t}\n\tif a.IdentityProvider != nil {\n\t\tif a.IdentityProvider.TokenURL != \"\" {\n\t\t\tvalues[idPTokenURL] = a.IdentityProvider.TokenURL\n\t\t}\n\t\tif a.IdentityProvider.Audience != \"\" {\n\t\t\tvalues[idPAudience] = a.IdentityProvider.Audience\n\t\t}\n\t\t//values[idP] = a.IdentityProvider\n\t}\n\tif a.RefreshToken != \"\" {\n\t\tvalues[refreshToken] = a.RefreshToken\n\t}\n\tif a.P12Task != \"\" {\n\t\tvalues[p12Task] = a.P12Task\n\t}\n\tif a.Scope != \"\" {\n\t\tvalues[scope] = a.Scope\n\t}\n\n\treturn values, nil\n}",
"func (o *OAuthFlow) MarshalYAML() (interface{}, error) {\n\tnb := high.NewNodeBuilder(o, o.low)\n\treturn nb.Render(), nil\n}",
"func (key PrivateKey) MarshalYAML() (interface{}, error) {\n\treturn key.String(), nil\n}",
"func (i SecVerb) MarshalYAML() (interface{}, error) {\n\treturn i.String(), nil\n}",
"func (k PrivateKey) MarshalYAML() (interface{}, error) {\n\treturn k.Path, nil\n}",
"func (key PublicKey) MarshalYAML() (interface{}, error) {\n\treturn key.String(), nil\n}",
"func (tz Location) MarshalYAML() (interface{}, error) {\n\tbytes, err := tz.MarshalText()\n\treturn string(bytes), err\n}",
"func (r WeekdayRange) MarshalYAML() (interface{}, error) {\n\tbytes, err := r.MarshalText()\n\treturn string(bytes), err\n}",
"func MarshalYaml(v interface{}) []byte {\n\tdata, err := yaml.Marshal(v)\n\tPanicIf(err)\n\treturn data\n}",
"func (i ChannelName) MarshalYAML() (interface{}, error) {\n\treturn i.String(), nil\n}",
"func (in PluginConfig) MarshalYAML() (interface{}, error) {\n\traw := map[string]interface{}{\n\t\t\"name\": in.Name,\n\t\t\"plugin\": in.PluginSubKey,\n\t}\n\t// Don't add the config for unmarshal unless something is defined\n\tif len(in.Config.Raw) != 0 {\n\t\tvar rawCfg = map[string]interface{}{}\n\t\traw[\"config\"] = rawCfg\n\t\tif err := json.Unmarshal(in.Config.Raw, &rawCfg); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"could not marshal the plugin config to json\")\n\t\t}\n\t}\n\n\treturn raw, nil\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
NewClawbackGrantAction returns an AddGrantAction for a ClawbackVestingAccount.
|
func NewClawbackGrantAction(
funderAddress string,
sk StakingKeeper,
grantStartTime int64,
grantLockupPeriods, grantVestingPeriods []Period,
grantCoins sdk.Coins,
) exported.AddGrantAction {
return clawbackGrantAction{
funderAddress: funderAddress,
sk: sk,
grantStartTime: grantStartTime,
grantLockupPeriods: grantLockupPeriods,
grantVestingPeriods: grantVestingPeriods,
grantCoins: grantCoins,
}
}
|
[
"func NewClawbackAction(requestor, dest sdk.AccAddress, ak AccountKeeper, bk BankKeeper, sk StakingKeeper) exported.ClawbackAction {\n\treturn clawbackAction{\n\t\trequestor: requestor,\n\t\tdest: dest,\n\t\tak: ak,\n\t\tbk: bk,\n\t\tsk: sk,\n\t}\n}",
"func NewClawbackRewardAction(ak AccountKeeper, bk BankKeeper, sk StakingKeeper) exported.RewardAction {\n\treturn clawbackRewardAction{\n\t\tak: ak,\n\t\tbk: bk,\n\t\tsk: sk,\n\t}\n}",
"func (cga clawbackGrantAction) AddToAccount(ctx sdk.Context, rawAccount exported.VestingAccount) error {\n\tcva, ok := rawAccount.(*ClawbackVestingAccount)\n\tif !ok {\n\t\treturn sdkerrors.Wrapf(sdkerrors.ErrNotSupported,\n\t\t\t\"account %s must be a ClawbackVestingAccount, got %T\",\n\t\t\trawAccount.GetAddress(), rawAccount)\n\t}\n\tif cga.funderAddress != cva.FunderAddress {\n\t\treturn sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, \"account %s can only accept grants from account %s\",\n\t\t\trawAccount.GetAddress(), cva.FunderAddress)\n\t}\n\tcva.addGrant(ctx, cga.sk, cga.grantStartTime, cga.grantLockupPeriods, cga.grantVestingPeriods, cga.grantCoins)\n\treturn nil\n}",
"func NewPeriodicGrantAction(\n\tsk StakingKeeper,\n\tgrantStartTime int64,\n\tgrantVestingPeriods []Period,\n\tgrantCoins sdk.Coins,\n) exported.AddGrantAction {\n\treturn periodicGrantAction{\n\t\tsk: sk,\n\t\tgrantStartTime: grantStartTime,\n\t\tgrantVestingPeriods: grantVestingPeriods,\n\t\tgrantCoins: grantCoins,\n\t}\n}",
"func NewClawbackVestingAccount(baseAcc *authtypes.BaseAccount, funder sdk.AccAddress, originalVesting sdk.Coins, startTime int64, lockupPeriods, vestingPeriods Periods) *ClawbackVestingAccount {\n\t// copy and align schedules to avoid mutating inputs\n\tlp := make(Periods, len(lockupPeriods))\n\tcopy(lp, lockupPeriods)\n\tvp := make(Periods, len(vestingPeriods))\n\tcopy(vp, vestingPeriods)\n\t_, endTime := AlignSchedules(startTime, startTime, lp, vp)\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ClawbackVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tFunderAddress: funder.String(),\n\t\tStartTime: startTime,\n\t\tLockupPeriods: lp,\n\t\tVestingPeriods: vp,\n\t}\n}",
"func (va *ClawbackVestingAccount) addGrant(ctx sdk.Context, sk StakingKeeper, grantStartTime int64, grantLockupPeriods, grantVestingPeriods []Period, grantCoins sdk.Coins) {\n\t// how much is really delegated?\n\tbondedAmt := sk.GetDelegatorBonded(ctx, va.GetAddress())\n\tunbondingAmt := sk.GetDelegatorUnbonding(ctx, va.GetAddress())\n\tdelegatedAmt := bondedAmt.Add(unbondingAmt)\n\tdelegated := sdk.NewCoins(sdk.NewCoin(sk.BondDenom(ctx), delegatedAmt))\n\n\t// discover what has been slashed\n\toldDelegated := va.DelegatedVesting.Add(va.DelegatedFree...)\n\tslashed := oldDelegated.Sub(coinsMin(oldDelegated, delegated))\n\n\t// rebase the DV + DF by capping slashed at the current unvested amount\n\tunvested := va.OriginalVesting.Sub(va.GetVestedOnly(ctx.BlockTime()))\n\tnewSlashed := coinsMin(slashed, unvested)\n\tnewDelegated := delegated.Add(newSlashed...)\n\n\t// modify schedules for the new grant\n\tnewLockupStart, newLockupEnd, newLockupPeriods := DisjunctPeriods(va.StartTime, grantStartTime, va.LockupPeriods, grantLockupPeriods)\n\tnewVestingStart, newVestingEnd, newVestingPeriods := DisjunctPeriods(va.StartTime, grantStartTime,\n\t\tva.GetVestingPeriods(), grantVestingPeriods)\n\tif newLockupStart != newVestingStart {\n\t\tpanic(\"bad start time calculation\")\n\t}\n\tva.StartTime = newLockupStart\n\tva.EndTime = max64(newLockupEnd, newVestingEnd)\n\tva.LockupPeriods = newLockupPeriods\n\tva.VestingPeriods = newVestingPeriods\n\tva.OriginalVesting = va.OriginalVesting.Add(grantCoins...)\n\n\t// cap DV at the current unvested amount, DF rounds out to newDelegated\n\tunvested2 := va.GetVestingCoins(ctx.BlockTime())\n\tva.DelegatedVesting = coinsMin(newDelegated, unvested2)\n\tva.DelegatedFree = newDelegated.Sub(va.DelegatedVesting)\n}",
"func NewTenantAllowOrBlockListAction()(*TenantAllowOrBlockListAction) {\n m := &TenantAllowOrBlockListAction{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}",
"func NewCollateralizeAction(c *Collateralize, tx *types.Transaction, index int) *Action {\n\thash := tx.Hash()\n\tfromaddr := tx.From()\n\tcfg := c.GetAPI().GetConfig()\n\ttokenDb, err := account.NewAccountDB(cfg, tokenE.GetName(), pty.CCNYTokenName, c.GetStateDB())\n\tif err != nil {\n\t\tclog.Error(\"NewCollateralizeAction\", \"Get Account DB error\", \"error\", err)\n\t\treturn nil\n\t}\n\n\treturn &Action{\n\t\tcoinsAccount: c.GetCoinsAccount(), tokenAccount: tokenDb, db: c.GetStateDB(), localDB: c.GetLocalDB(),\n\t\ttxhash: hash, fromaddr: fromaddr, blocktime: c.GetBlockTime(), height: c.GetHeight(),\n\t\texecaddr: dapp.ExecAddress(string(tx.Execer)), difficulty: c.GetDifficulty(), index: index, Collateralize: c}\n}",
"func (pva *PeriodicVestingAccount) AddGrant(ctx sdk.Context, action exported.AddGrantAction) error {\n\treturn action.AddToAccount(ctx, pva)\n}",
"func NewAttachClaimAction(componentKey string, claimKey string, depth int) *AttachClaimAction {\n\treturn &AttachClaimAction{\n\t\tMetadata: action.NewMetadata(\"action-component-claim-attach\", componentKey, claimKey),\n\t\tComponentKey: componentKey,\n\t\tClaimKey: claimKey,\n\t\tDepth: depth,\n\t}\n}",
"func (r *jsiiProxy_Repository) Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant {\n\targs := []interface{}{grantee}\n\tfor _, a := range actions {\n\t\targs = append(args, a)\n\t}\n\n\tvar returns awsiam.Grant\n\n\t_jsii_.Invoke(\n\t\tr,\n\t\t\"grant\",\n\t\targs,\n\t\t&returns,\n\t)\n\n\treturn returns\n}",
"func (r *jsiiProxy_RepositoryBase) Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant {\n\targs := []interface{}{grantee}\n\tfor _, a := range actions {\n\t\targs = append(args, a)\n\t}\n\n\tvar returns awsiam.Grant\n\n\t_jsii_.Invoke(\n\t\tr,\n\t\t\"grant\",\n\t\targs,\n\t\t&returns,\n\t)\n\n\treturn returns\n}",
"func (p *AchievementsPlugin) Grant(nick, emojy string) (Award, error) {\n\tempty := Award{}\n\tq := `insert into awards (emojy,holder) values (?, ?)`\n\ttx, err := p.db.Beginx()\n\tif err != nil {\n\t\treturn empty, err\n\t}\n\tif _, err := tx.Exec(q, emojy, nick); err != nil {\n\t\ttx.Rollback()\n\t\treturn empty, err\n\t}\n\tif err := tx.Commit(); err != nil {\n\t\treturn empty, err\n\t}\n\treturn p.FindAward(emojy)\n}",
"func NewAuthorizeAction(ctx context.Context, viper *viper.Viper, authMode string,\n\tlocalAuthController *local.Controller, bkiamAuthController *bkiam.Controller,\n\treq *pb.AuthorizeReq, resp *pb.AuthorizeResp) *AuthorizeAction {\n\n\taction := &AuthorizeAction{\n\t\tctx: ctx,\n\t\tviper: viper,\n\t\tauthMode: authMode,\n\t\tlocalAuthController: localAuthController,\n\t\tbkiamAuthController: bkiamAuthController,\n\t\treq: req,\n\t\tresp: resp,\n\t}\n\n\taction.resp.Seq = req.Seq\n\taction.resp.Code = pbcommon.ErrCode_E_OK\n\taction.resp.Message = \"OK\"\n\n\treturn action\n}",
"func NewChallengeAction(msg *Message) (*ChallengeAction, error) {\n\taction := &ChallengeAction{*msg}\n\n\treturn action, nil\n}",
"func CreateAction(\n\tcmd, keyB, id, secretKey string,\n\targs ...interface{}) *types.Action {\n\n\tmac := hmac.New(sha1.New, []byte(secretKey))\n\tmac.Write([]byte(cmd))\n\tmac.Write([]byte(keyB))\n\tmac.Write([]byte(id))\n\tsum := mac.Sum(nil)\n\tsumhex := hex.EncodeToString(sum)\n\n\treturn &types.Action{\n\t\tCommand: cmd,\n\t\tStorageKey: keyB,\n\t\tArgs: args,\n\t\tId: id,\n\t\tSecret: sumhex,\n\t}\n}",
"func NewTriggerAction(agentName string, propertyName string, propertyValue string) *TriggerAction {\n instance := new(TriggerAction)\n instance.agentName = agentName\n instance.propertyName = propertyName\n instance.propertyValue = propertyValue\n return instance\n}",
"func NewUnifiedRbacResourceAction()(*UnifiedRbacResourceAction) {\n m := &UnifiedRbacResourceAction{\n Entity: *NewEntity(),\n }\n return m\n}",
"func NewAction(name string, arg interface{}) {\n\tDefaultActionRegistry.Post(name, arg)\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
AddToAccount implements the exported.AddGrantAction interface. It checks that rawAccount is a ClawbackVestingAccount with the same funder and adds the described Grant to it.
|
func (cga clawbackGrantAction) AddToAccount(ctx sdk.Context, rawAccount exported.VestingAccount) error {
cva, ok := rawAccount.(*ClawbackVestingAccount)
if !ok {
return sdkerrors.Wrapf(sdkerrors.ErrNotSupported,
"account %s must be a ClawbackVestingAccount, got %T",
rawAccount.GetAddress(), rawAccount)
}
if cga.funderAddress != cva.FunderAddress {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "account %s can only accept grants from account %s",
rawAccount.GetAddress(), cva.FunderAddress)
}
cva.addGrant(ctx, cga.sk, cga.grantStartTime, cga.grantLockupPeriods, cga.grantVestingPeriods, cga.grantCoins)
return nil
}
|
[
"func (pga periodicGrantAction) AddToAccount(ctx sdk.Context, rawAccount exported.VestingAccount) error {\n\tpva, ok := rawAccount.(*PeriodicVestingAccount)\n\tif !ok {\n\t\treturn sdkerrors.Wrapf(sdkerrors.ErrNotSupported,\n\t\t\t\"account %s must be a PeriodicVestingAccount, got %T\",\n\t\t\trawAccount.GetAddress(), rawAccount)\n\t}\n\tpva.addGrant(ctx, pga.sk, pga.grantStartTime, pga.grantVestingPeriods, pga.grantCoins)\n\treturn nil\n}",
"func (_Storage *StorageTransactor) AddAccount(opts *bind.TransactOpts, addr common.Address, kind uint8, isFrozen bool, parent common.Address) (*types.Transaction, error) {\n\treturn _Storage.contract.Transact(opts, \"addAccount\", addr, kind, isFrozen, parent)\n}",
"func (_Storage *StorageTransactorSession) AddAccount(addr common.Address, kind uint8, isFrozen bool, parent common.Address) (*types.Transaction, error) {\n\treturn _Storage.Contract.AddAccount(&_Storage.TransactOpts, addr, kind, isFrozen, parent)\n}",
"func (pva *PeriodicVestingAccount) AddGrant(ctx sdk.Context, action exported.AddGrantAction) error {\n\treturn action.AddToAccount(ctx, pva)\n}",
"func (va *ClawbackVestingAccount) addGrant(ctx sdk.Context, sk StakingKeeper, grantStartTime int64, grantLockupPeriods, grantVestingPeriods []Period, grantCoins sdk.Coins) {\n\t// how much is really delegated?\n\tbondedAmt := sk.GetDelegatorBonded(ctx, va.GetAddress())\n\tunbondingAmt := sk.GetDelegatorUnbonding(ctx, va.GetAddress())\n\tdelegatedAmt := bondedAmt.Add(unbondingAmt)\n\tdelegated := sdk.NewCoins(sdk.NewCoin(sk.BondDenom(ctx), delegatedAmt))\n\n\t// discover what has been slashed\n\toldDelegated := va.DelegatedVesting.Add(va.DelegatedFree...)\n\tslashed := oldDelegated.Sub(coinsMin(oldDelegated, delegated))\n\n\t// rebase the DV + DF by capping slashed at the current unvested amount\n\tunvested := va.OriginalVesting.Sub(va.GetVestedOnly(ctx.BlockTime()))\n\tnewSlashed := coinsMin(slashed, unvested)\n\tnewDelegated := delegated.Add(newSlashed...)\n\n\t// modify schedules for the new grant\n\tnewLockupStart, newLockupEnd, newLockupPeriods := DisjunctPeriods(va.StartTime, grantStartTime, va.LockupPeriods, grantLockupPeriods)\n\tnewVestingStart, newVestingEnd, newVestingPeriods := DisjunctPeriods(va.StartTime, grantStartTime,\n\t\tva.GetVestingPeriods(), grantVestingPeriods)\n\tif newLockupStart != newVestingStart {\n\t\tpanic(\"bad start time calculation\")\n\t}\n\tva.StartTime = newLockupStart\n\tva.EndTime = max64(newLockupEnd, newVestingEnd)\n\tva.LockupPeriods = newLockupPeriods\n\tva.VestingPeriods = newVestingPeriods\n\tva.OriginalVesting = va.OriginalVesting.Add(grantCoins...)\n\n\t// cap DV at the current unvested amount, DF rounds out to newDelegated\n\tunvested2 := va.GetVestingCoins(ctx.BlockTime())\n\tva.DelegatedVesting = coinsMin(newDelegated, unvested2)\n\tva.DelegatedFree = newDelegated.Sub(va.DelegatedVesting)\n}",
"func (trd *trxDispatcher) pushAccount(at string, adr *common.Address, blk *types.Block, trx *types.Transaction, wg *sync.WaitGroup) bool {\n\twg.Add(1)\n\tselect {\n\tcase trd.outAccount <- &eventAcc{\n\t\twatchDog: wg,\n\t\taddr: adr,\n\t\tact: at,\n\t\tblk: blk,\n\t\ttrx: trx,\n\t\tdeploy: nil,\n\t}:\n\tcase <-trd.sigStop:\n\t\treturn false\n\t}\n\treturn true\n}",
"func (_Store *StoreTransactor) InsertAccount(opts *bind.TransactOpts, id string, A string, B string, money *big.Int) (*types.RawTransaction, error) {\n\treturn _Store.contract.Transact(opts, \"insertAccount\", id, A, B, money)\n}",
"func (_TxRelay *TxRelayTransactor) AddToWhitelist(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) {\n\treturn _TxRelay.contract.Transact(opts, \"addToWhitelist\", addr)\n}",
"func (ca clawbackAction) TakeFromAccount(ctx sdk.Context, rawAccount exported.VestingAccount) error {\n\tcva, ok := rawAccount.(*ClawbackVestingAccount)\n\tif !ok {\n\t\treturn sdkerrors.Wrapf(sdkerrors.ErrNotSupported, \"clawback expects *ClawbackVestingAccount, got %T\", rawAccount)\n\t}\n\tif ca.requestor.String() != cva.FunderAddress {\n\t\treturn sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, \"clawback can only be requested by original funder %s\", cva.FunderAddress)\n\t}\n\treturn cva.clawback(ctx, ca.dest, ca.ak, ca.bk, ca.sk)\n}",
"func (pva *PeriodicVestingAccount) addGrant(ctx sdk.Context, sk StakingKeeper, grantStartTime int64, grantVestingPeriods []Period, grantCoins sdk.Coins) {\n\t// how much is really delegated?\n\tbondedAmt := sk.GetDelegatorBonded(ctx, pva.GetAddress())\n\tunbondingAmt := sk.GetDelegatorUnbonding(ctx, pva.GetAddress())\n\tdelegatedAmt := bondedAmt.Add(unbondingAmt)\n\tdelegated := sdk.NewCoins(sdk.NewCoin(sk.BondDenom(ctx), delegatedAmt))\n\n\t// discover what has been slashed\n\toldDelegated := pva.DelegatedVesting.Add(pva.DelegatedFree...)\n\tslashed := oldDelegated.Sub(coinsMin(oldDelegated, delegated))\n\n\t// rebase the DV+DF by capping slashed at the current unvested amount\n\tunvested := pva.GetVestingCoins(ctx.BlockTime())\n\tnewSlashed := coinsMin(unvested, slashed)\n\tnewTotalDelegated := delegated.Add(newSlashed...)\n\n\t// modify vesting schedule for the new grant\n\tnewStart, newEnd, newPeriods := DisjunctPeriods(pva.StartTime, grantStartTime,\n\t\tpva.GetVestingPeriods(), grantVestingPeriods)\n\tpva.StartTime = newStart\n\tpva.EndTime = newEnd\n\tpva.VestingPeriods = newPeriods\n\tpva.OriginalVesting = pva.OriginalVesting.Add(grantCoins...)\n\n\t// cap DV at the current unvested amount, DF rounds out to newTotalDelegated\n\tunvested2 := pva.GetVestingCoins(ctx.BlockTime())\n\tpva.DelegatedVesting = coinsMin(newTotalDelegated, unvested2)\n\tpva.DelegatedFree = newTotalDelegated.Sub(pva.DelegatedVesting)\n}",
"func (e *copyS2SMigrationFileEnumerator) addTransferFromAccount(ctx context.Context,\n\tsrcServiceURL azfile.ServiceURL, destBaseURL url.URL,\n\tsharePrefix, fileOrDirectoryPrefix, fileNamePattern string, cca *cookedCopyCmdArgs) error {\n\treturn enumerateSharesInAccount(\n\t\tctx,\n\t\tsrcServiceURL,\n\t\tsharePrefix,\n\t\tfunc(shareItem azfile.ShareItem) error {\n\t\t\t// Whatever the destination type is, it should be equivalent to account level,\n\t\t\t// so directly append share name to it.\n\t\t\ttmpDestURL := urlExtension{URL: destBaseURL}.generateObjectPath(shareItem.Name)\n\t\t\t// create bucket for destination, in case bucket doesn't exist.\n\t\t\tif err := e.createDestBucket(ctx, tmpDestURL, nil); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Two cases for exclude/include which need to match share names in account:\n\t\t\t// a. https://<fileservice>/share*/file*.vhd\n\t\t\t// b. https://<fileservice>/ which equals to https://<fileservice>/*\n\t\t\treturn e.addTransfersFromDirectory(\n\t\t\t\tctx,\n\t\t\t\tsrcServiceURL.NewShareURL(shareItem.Name).NewRootDirectoryURL(),\n\t\t\t\ttmpDestURL,\n\t\t\t\tfileOrDirectoryPrefix,\n\t\t\t\tfileNamePattern,\n\t\t\t\t\"\",\n\t\t\t\ttrue,\n\t\t\t\ttrue,\n\t\t\t\tcca)\n\t\t})\n}",
"func (auth Authenticate) RegisterAccount(session *types.Session, newAccount *types.Account) (string, error) {\n\taccount, err := auth.CheckAccountSession(session)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t//Get Account Roles\n\taccount = account.GetAccountPermissions()\n\n\t//Only Accounts with ADMIN privliges can make this request\n\tif !utils.Contains(\"ADMIN\", account.Roles) {\n\t\treturn \"\", errors.New(\"Invalid Privilges: \" + account.Name)\n\t}\n\n\t//Get newAccount Roles\n\tnewAccount = newAccount.GetAccountPermissions()\n\n\tres, err := manager.AccountManager{}.CreateAccount(newAccount, account, auth.DB)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn res, nil\n}",
"func (_PermInterface *PermInterfaceTransactor) AddAdminAccount(opts *bind.TransactOpts, _acct common.Address) (*types.Transaction, error) {\n\treturn _PermInterface.contract.Transact(opts, \"addAdminAccount\", _acct)\n}",
"func (_Store *StoreTransactorSession) InsertAccount(id string, A string, B string, money *big.Int) (*types.RawTransaction, error) {\n\treturn _Store.Contract.InsertAccount(&_Store.TransactOpts, id, A, B, money)\n}",
"func (_User *UserTransactor) AddTrustedEntity(opts *bind.TransactOpts, _trustedEntity common.Address) (*types.Transaction, error) {\n\treturn _User.contract.Transact(opts, \"addTrustedEntity\", _trustedEntity)\n}",
"func (e *copyS2SMigrationBlobEnumerator) addTransferFromAccount(ctx context.Context,\n\tsrcServiceURL azblob.ServiceURL, destBaseURL url.URL,\n\tcontainerPrefix, blobPrefix, blobNamePattern string, cca *cookedCopyCmdArgs) error {\n\treturn enumerateContainersInAccount(\n\t\tctx,\n\t\tsrcServiceURL,\n\t\tcontainerPrefix,\n\t\tfunc(containerItem azblob.ContainerItem) error {\n\t\t\t// Whatever the destination type is, it should be equivalent to account level,\n\t\t\t// so directly append container name to it.\n\t\t\ttmpDestURL := urlExtension{URL: destBaseURL}.generateObjectPath(containerItem.Name)\n\t\t\t// create bucket for destination, in case bucket doesn't exist.\n\t\t\tif err := e.createDestBucket(ctx, tmpDestURL, nil); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Two cases for exclude/include which need to match container names in account:\n\t\t\t// a. https://<blobservice>/container*/blob*.vhd\n\t\t\t// b. https://<blobservice>/ which equals to https://<blobservice>/*\n\t\t\treturn e.addTransfersFromContainer(\n\t\t\t\tctx,\n\t\t\t\tsrcServiceURL.NewContainerURL(containerItem.Name),\n\t\t\t\ttmpDestURL,\n\t\t\t\tblobPrefix,\n\t\t\t\tblobNamePattern,\n\t\t\t\t\"\",\n\t\t\t\ttrue,\n\t\t\t\ttrue,\n\t\t\t\tcca)\n\t\t})\n}",
"func (am *AccountManager) AddAccount(a *Account) {\n\tam.add <- a\n}",
"func (service *AccountService) AddAccount(ctx context.Context, req *protoAccount.NewAccountRequest, res *protoAccount.AccountResponse) error {\n\t// supported exchange keys check\n\tif !supportedExchange(req.Exchange) {\n\t\tres.Status = constRes.Fail\n\t\tres.Message = fmt.Sprintf(\"%s is not supported\", req.Exchange)\n\t\treturn nil\n\t}\n\tif !supportedType(req.AccountType) {\n\t\tres.Status = constRes.Fail\n\t\tres.Message = fmt.Sprintf(\"accountType must be paper or real\")\n\t\treturn nil\n\t}\n\n\taccountID := uuid.New().String()\n\tnow := string(pq.FormatTimestamp(time.Now().UTC()))\n\tbalances := make([]*protoBalance.Balance, 0, len(req.Balances))\n\n\t// user specified balances will be ignored if a\n\t// valid public/secret is send in with request\n\tfor _, b := range req.Balances {\n\t\tbalance := protoBalance.Balance{\n\t\t\tUserID: req.UserID,\n\t\t\tAccountID: accountID,\n\t\t\tCurrencySymbol: b.CurrencySymbol,\n\t\t\tAvailable: b.Available,\n\t\t\tLocked: 0,\n\t\t\tCreatedOn: now,\n\t\t\tUpdatedOn: now,\n\t\t}\n\t\tbalances = append(balances, &balance)\n\t}\n\n\t// assume account valid\n\taccount := protoAccount.Account{\n\t\tAccountID: accountID,\n\t\tAccountType: req.AccountType,\n\t\tUserID: req.UserID,\n\t\tExchange: req.Exchange,\n\t\tKeyPublic: req.KeyPublic,\n\t\tKeySecret: util.Rot32768(req.KeySecret),\n\t\tTitle: req.Title,\n\t\tColor: req.Color,\n\t\tDescription: req.Description,\n\t\tStatus: constAccount.AccountValid,\n\t\tCreatedOn: now,\n\t\tUpdatedOn: now,\n\t\tBalances: balances,\n\t}\n\n\t// validate account request when keys are present\n\tswitch {\n\tcase account.KeyPublic != \"\" && account.KeySecret == \"\":\n\t\tres.Status = constRes.Fail\n\t\tres.Message = \"keySecret required with keyPublic!\"\n\t\treturn nil\n\tcase account.KeyPublic == \"\" && account.KeySecret != \"\":\n\t\tres.Status = constRes.Fail\n\t\tres.Message = \"keyPublic required with keySecret!\"\n\t\treturn nil\n\tcase account.Color == \"\":\n\t\tres.Status = constRes.Fail\n\t\tres.Message = \"color required\"\n\t\treturn nil\n\t}\n\n\tswitch {\n\tcase account.Exchange == constExch.Binance && account.AccountType == constAccount.AccountReal:\n\t\t// if api key ask exchange for balances\n\t\tif account.KeyPublic == \"\" || account.KeySecret == \"\" {\n\t\t\tres.Status = constRes.Fail\n\t\t\tres.Message = \"keyPublic and keySecret required!\"\n\t\t\treturn nil\n\t\t}\n\t\treqBal := protoBinanceBal.BalanceRequest{\n\t\t\tUserID: account.UserID,\n\t\t\tKeyPublic: account.KeyPublic,\n\t\t\tKeySecret: util.Rot32768(account.KeySecret),\n\t\t}\n\t\tresBal, _ := service.BinanceClient.GetBalances(ctx, &reqBal)\n\n\t\t// reponse to client on invalid key\n\t\tif resBal.Status != constRes.Success {\n\t\t\tres.Status = resBal.Status\n\t\t\tres.Message = resBal.Message\n\t\t\treturn nil\n\t\t}\n\n\t\texBalances := make([]*protoBalance.Balance, 0)\n\t\tfor _, b := range resBal.Data.Balances {\n\t\t\ttotal := b.Free + b.Locked\n\n\t\t\t// only add non-zero balances\n\t\t\tif total > 0 {\n\t\t\t\tbalance := protoBalance.Balance{\n\t\t\t\t\tUserID: account.UserID,\n\t\t\t\t\tAccountID: account.AccountID,\n\t\t\t\t\tCurrencySymbol: b.CurrencySymbol,\n\t\t\t\t\tAvailable: b.Free,\n\t\t\t\t\tLocked: 0.0,\n\t\t\t\t\tExchangeTotal: total,\n\t\t\t\t\tExchangeAvailable: b.Free,\n\t\t\t\t\tExchangeLocked: b.Locked,\n\t\t\t\t\tCreatedOn: now,\n\t\t\t\t\tUpdatedOn: now,\n\t\t\t\t}\n\n\t\t\t\texBalances = append(exBalances, &balance)\n\t\t\t}\n\t\t}\n\t\taccount.Balances = exBalances\n\t}\n\n\tif err := repoAccount.InsertAccount(service.DB, &account); err != nil {\n\t\tmsg := fmt.Sprintf(\"insert account failed %s\", err.Error())\n\t\tlog.Println(msg)\n\n\t\tres.Status = constRes.Error\n\t\tres.Message = msg\n\t}\n\n\tres.Status = constRes.Success\n\tres.Data = &protoAccount.UserAccount{Account: &account}\n\n\treturn nil\n}",
"func (_StockToken *StockTokenTransactor) AddAddressToWhitelist(opts *bind.TransactOpts, _address common.Address) (*types.Transaction, error) {\n\treturn _StockToken.contract.Transact(opts, \"addAddressToWhitelist\", _address)\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
addGrant merges a new clawback vesting grant into an existing ClawbackVestingAccount.
|
func (va *ClawbackVestingAccount) addGrant(ctx sdk.Context, sk StakingKeeper, grantStartTime int64, grantLockupPeriods, grantVestingPeriods []Period, grantCoins sdk.Coins) {
// how much is really delegated?
bondedAmt := sk.GetDelegatorBonded(ctx, va.GetAddress())
unbondingAmt := sk.GetDelegatorUnbonding(ctx, va.GetAddress())
delegatedAmt := bondedAmt.Add(unbondingAmt)
delegated := sdk.NewCoins(sdk.NewCoin(sk.BondDenom(ctx), delegatedAmt))
// discover what has been slashed
oldDelegated := va.DelegatedVesting.Add(va.DelegatedFree...)
slashed := oldDelegated.Sub(coinsMin(oldDelegated, delegated))
// rebase the DV + DF by capping slashed at the current unvested amount
unvested := va.OriginalVesting.Sub(va.GetVestedOnly(ctx.BlockTime()))
newSlashed := coinsMin(slashed, unvested)
newDelegated := delegated.Add(newSlashed...)
// modify schedules for the new grant
newLockupStart, newLockupEnd, newLockupPeriods := DisjunctPeriods(va.StartTime, grantStartTime, va.LockupPeriods, grantLockupPeriods)
newVestingStart, newVestingEnd, newVestingPeriods := DisjunctPeriods(va.StartTime, grantStartTime,
va.GetVestingPeriods(), grantVestingPeriods)
if newLockupStart != newVestingStart {
panic("bad start time calculation")
}
va.StartTime = newLockupStart
va.EndTime = max64(newLockupEnd, newVestingEnd)
va.LockupPeriods = newLockupPeriods
va.VestingPeriods = newVestingPeriods
va.OriginalVesting = va.OriginalVesting.Add(grantCoins...)
// cap DV at the current unvested amount, DF rounds out to newDelegated
unvested2 := va.GetVestingCoins(ctx.BlockTime())
va.DelegatedVesting = coinsMin(newDelegated, unvested2)
va.DelegatedFree = newDelegated.Sub(va.DelegatedVesting)
}
|
[
"func (pva *PeriodicVestingAccount) AddGrant(ctx sdk.Context, action exported.AddGrantAction) error {\n\treturn action.AddToAccount(ctx, pva)\n}",
"func (pva *PeriodicVestingAccount) addGrant(ctx sdk.Context, sk StakingKeeper, grantStartTime int64, grantVestingPeriods []Period, grantCoins sdk.Coins) {\n\t// how much is really delegated?\n\tbondedAmt := sk.GetDelegatorBonded(ctx, pva.GetAddress())\n\tunbondingAmt := sk.GetDelegatorUnbonding(ctx, pva.GetAddress())\n\tdelegatedAmt := bondedAmt.Add(unbondingAmt)\n\tdelegated := sdk.NewCoins(sdk.NewCoin(sk.BondDenom(ctx), delegatedAmt))\n\n\t// discover what has been slashed\n\toldDelegated := pva.DelegatedVesting.Add(pva.DelegatedFree...)\n\tslashed := oldDelegated.Sub(coinsMin(oldDelegated, delegated))\n\n\t// rebase the DV+DF by capping slashed at the current unvested amount\n\tunvested := pva.GetVestingCoins(ctx.BlockTime())\n\tnewSlashed := coinsMin(unvested, slashed)\n\tnewTotalDelegated := delegated.Add(newSlashed...)\n\n\t// modify vesting schedule for the new grant\n\tnewStart, newEnd, newPeriods := DisjunctPeriods(pva.StartTime, grantStartTime,\n\t\tpva.GetVestingPeriods(), grantVestingPeriods)\n\tpva.StartTime = newStart\n\tpva.EndTime = newEnd\n\tpva.VestingPeriods = newPeriods\n\tpva.OriginalVesting = pva.OriginalVesting.Add(grantCoins...)\n\n\t// cap DV at the current unvested amount, DF rounds out to newTotalDelegated\n\tunvested2 := pva.GetVestingCoins(ctx.BlockTime())\n\tpva.DelegatedVesting = coinsMin(newTotalDelegated, unvested2)\n\tpva.DelegatedFree = newTotalDelegated.Sub(pva.DelegatedVesting)\n}",
"func (v *Vserver) AddAccessGrant(a *AccessGrant) error {\n\tkey := a.Key()\n\tif _, ok := v.AccessGrants[key]; ok {\n\t\treturn fmt.Errorf(\"Vserver %q already has AccessGrant %q\", v.Name, key)\n\t}\n\tv.AccessGrants[key] = a\n\treturn nil\n}",
"func StageGrant(db, schema, stage string) GrantBuilder {\n\treturn &CurrentGrantBuilder{\n\t\tname: stage,\n\t\tqualifiedName: fmt.Sprintf(`\"%v\".\"%v\".\"%v\"`, db, schema, stage),\n\t\tgrantType: stageType,\n\t}\n}",
"func (ag *AccessGrant) MergeAdd(other AccessGrant) error {\n\tif err := other.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif other.Address != ag.Address {\n\t\treturn fmt.Errorf(\"cannot merge in AccessGrant for different address\")\n\t}\n\tfor _, p := range other.GetAccessList() {\n\t\tif !ag.HasAccess(p) {\n\t\t\tag.Permissions = append(ag.Permissions, p)\n\t\t}\n\t}\n\treturn nil\n}",
"func (cga clawbackGrantAction) AddToAccount(ctx sdk.Context, rawAccount exported.VestingAccount) error {\n\tcva, ok := rawAccount.(*ClawbackVestingAccount)\n\tif !ok {\n\t\treturn sdkerrors.Wrapf(sdkerrors.ErrNotSupported,\n\t\t\t\"account %s must be a ClawbackVestingAccount, got %T\",\n\t\t\trawAccount.GetAddress(), rawAccount)\n\t}\n\tif cga.funderAddress != cva.FunderAddress {\n\t\treturn sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, \"account %s can only accept grants from account %s\",\n\t\t\trawAccount.GetAddress(), cva.FunderAddress)\n\t}\n\tcva.addGrant(ctx, cga.sk, cga.grantStartTime, cga.grantLockupPeriods, cga.grantVestingPeriods, cga.grantCoins)\n\treturn nil\n}",
"func (u *user) grant(ctx context.Context, db Database, access string) error {\n\tescapedDbName := pathEscape(db.Name())\n\treq, err := u.conn.NewRequest(\"PUT\", path.Join(u.relPath(), \"database\", escapedDbName))\n\tif err != nil {\n\t\treturn WithStack(err)\n\t}\n\tinput := struct {\n\t\tGrant string `arangodb:\"grant\" json:\"grant\"`\n\t}{\n\t\tGrant: access,\n\t}\n\tif _, err := req.SetBody(input); err != nil {\n\t\treturn WithStack(err)\n\t}\n\tresp, err := u.conn.Do(ctx, req)\n\tif err != nil {\n\t\treturn WithStack(err)\n\t}\n\tif err := resp.CheckStatus(200); err != nil {\n\t\treturn WithStack(err)\n\t}\n\treturn nil\n}",
"func (s *Session) GrantDB(database, user, grant string) error {\n\tok, err := s.client.UserExists(context.Background(), user)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error in finding user %s\", err)\n\t}\n\tif !ok {\n\t\treturn fmt.Errorf(\"user %s does not exist\", user)\n\t}\n\tdbuser, err := s.client.User(context.Background(), user)\n\tif err != nil {\n\t\treturn fmt.Errorf(\n\t\t\t\"error in getting user %s from database %s\",\n\t\t\tuser,\n\t\t\terr,\n\t\t)\n\t}\n\tdbh, err := s.client.Database(context.Background(), database)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot get a database instance %s\", err)\n\t}\n\terr = dbuser.SetDatabaseAccess(context.Background(), dbh, getGrant(grant))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error in setting database access %s\", err)\n\t}\n\n\treturn nil\n}",
"func (_LvRecording *LvRecordingTransactor) RunGrant(opts *bind.TransactOpts, arg0 *big.Int, arg1 bool) (*types.Transaction, error) {\n\treturn _LvRecording.contract.Transact(opts, \"runGrant\", arg0, arg1)\n}",
"func Grant(ctx context.Context, i grantRequest) error {\n\tclient, err := New(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn client.Grant(ctx, i)\n}",
"func (k *Kerberos) Grant(encTGT, appID, encAuthenticator string) (*KerberosGrantResult, error) {\n\ttgt := &kerberosTGT{}\n\tif err := k.decrypt(encTGT, k.tgsSecretKey, tgt); err != nil {\n\t\treturn nil, errTGTInvalid\n\t}\n\tif tgt.Expired < time.Now().Unix() {\n\t\treturn nil, errTGTInvalid\n\t}\n\tauthenticator := &kerberosAuthenticator{}\n\tif err := k.decrypt(encAuthenticator, tgt.CTSK, authenticator); err != nil {\n\t\treturn nil, errAuthenticatorInvalid\n\t}\n\n\tvar appSecret string\n\tif appID == \"cell\" {\n\t\tappSecret = k.appSecretKey\n\t} else {\n\t\terr := k.db.QueryRowContext(\n\t\t\tdbCtx(),\n\t\t\t\"SELECT `secret` FROM `app` WHERE `app_id`=? LIMIT 1\",\n\t\t\tappID,\n\t\t).Scan(&appSecret)\n\t\tswitch {\n\t\tcase err == sql.ErrNoRows:\n\t\t\treturn nil, errAppNotExist\n\t\tcase err != nil:\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\tst := &kerberosServiceTicket{\n\t\tCSSK: RandToken(),\n\t\tUsername: authenticator.Username,\n\t\tExpired: time.Now().Add(2 * time.Hour).Unix(),\n\t}\n\n\tencCSSK := k.encrypt(st.CSSK, tgt.CTSK)\n\tencST := k.encrypt(st, appSecret)\n\n\tres := &KerberosGrantResult{\n\t\tencCSSK,\n\t\tencST,\n\t}\n\treturn res, nil\n}",
"func (ge *CurrentGrantExecutable) Grant(p string) string {\n\tvar template string\n\tif p == `OWNERSHIP` {\n\t\ttemplate = `GRANT %v ON %v %v TO %v \"%v\" COPY CURRENT GRANTS`\n\t} else {\n\t\ttemplate = `GRANT %v ON %v %v TO %v \"%v\"`\n\t}\n\treturn fmt.Sprintf(template,\n\t\tp, ge.grantType, ge.grantName, ge.granteeType, ge.granteeName)\n}",
"func AccountGrant() GrantBuilder {\n\treturn &CurrentGrantBuilder{\n\t\tgrantType: accountType,\n\t}\n}",
"func (_Content *ContentTransactor) RunGrant(opts *bind.TransactOpts, arg0 *big.Int, arg1 bool) (*types.Transaction, error) {\n\treturn _Content.contract.Transact(opts, \"runGrant\", arg0, arg1)\n}",
"func ViewGrant(db, schema, view string) GrantBuilder {\n\treturn &CurrentGrantBuilder{\n\t\tname: view,\n\t\tqualifiedName: fmt.Sprintf(`\"%v\".\"%v\".\"%v\"`, db, schema, view),\n\t\tgrantType: viewType,\n\t}\n}",
"func (r *jsiiProxy_RepositoryBase) Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant {\n\targs := []interface{}{grantee}\n\tfor _, a := range actions {\n\t\targs = append(args, a)\n\t}\n\n\tvar returns awsiam.Grant\n\n\t_jsii_.Invoke(\n\t\tr,\n\t\t\"grant\",\n\t\targs,\n\t\t&returns,\n\t)\n\n\treturn returns\n}",
"func (s *CLITestSuite) createGrant(granter, grantee sdk.Address) {\n\tcommonFlags := []string{\n\t\tfmt.Sprintf(\"--%s=%s\", flags.FlagBroadcastMode, flags.BroadcastSync),\n\t\tfmt.Sprintf(\"--%s=true\", flags.FlagSkipConfirmation),\n\t\tfmt.Sprintf(\"--%s=%s\", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(\"stake\", sdkmath.NewInt(100))).String()),\n\t}\n\n\tfee := sdk.NewCoin(\"stake\", sdkmath.NewInt(100))\n\n\targs := append(\n\t\t[]string{\n\t\t\tgranter.String(),\n\t\t\tgrantee.String(),\n\t\t\tfmt.Sprintf(\"--%s=%s\", cli.FlagSpendLimit, fee.String()),\n\t\t\tfmt.Sprintf(\"--%s=%s\", flags.FlagFrom, granter),\n\t\t\tfmt.Sprintf(\"--%s=%s\", cli.FlagExpiration, getFormattedExpiration(oneYear)),\n\t\t},\n\t\tcommonFlags...,\n\t)\n\n\tcmd := cli.NewCmdFeeGrant(addresscodec.NewBech32Codec(\"cosmos\"))\n\tout, err := clitestutil.ExecTestCLICmd(s.clientCtx, cmd, args)\n\ts.Require().NoError(err)\n\n\tvar resp sdk.TxResponse\n\ts.Require().NoError(s.clientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp), out.String())\n\ts.Require().Equal(resp.Code, uint32(0))\n}",
"func (s *BasePlSqlParserListener) EnterGrant_statement(ctx *Grant_statementContext) {}",
"func (p *AchievementsPlugin) Grant(nick, emojy string) (Award, error) {\n\tempty := Award{}\n\tq := `insert into awards (emojy,holder) values (?, ?)`\n\ttx, err := p.db.Beginx()\n\tif err != nil {\n\t\treturn empty, err\n\t}\n\tif _, err := tx.Exec(q, emojy, nick); err != nil {\n\t\ttx.Rollback()\n\t\treturn empty, err\n\t}\n\tif err := tx.Commit(); err != nil {\n\t\treturn empty, err\n\t}\n\treturn p.FindAward(emojy)\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetFunder implements the exported.ClawbackVestingAccountI interface.
|
func (va ClawbackVestingAccount) GetFunder() sdk.AccAddress {
addr, err := sdk.AccAddressFromBech32(va.FunderAddress)
if err != nil {
panic(err)
}
return addr
}
|
[
"func (f *Fund) Balance() int {\n return f.balance\n}",
"func (svc *Service) GetFundsForProposalByFunder(req client.GetFundsForProposalByFunderRequest, reply *client.GetFundsForProposalByFunderReply) error {\n\t// Validate parameters\n\terr := req.Funder.Err()\n\tif err != nil {\n\t\treturn errors.New(\"invalid funder address\")\n\t}\n\n\tamount := svc.proposalMaster.ProposalFund.GetFundsForProposalByFunder(req.ProposalId, req.Funder)\n\t*reply = client.GetFundsForProposalByFunderReply{\n\t\tAmount: *amount,\n\t}\n\n\treturn nil\n}",
"func GetFactionLedger(hc *http.Client, rc string, f string) (FactionLedger, error) {\n\tl := log.WithFields(log.Fields{\n\t\t\"action\": \"sotapi.GetFactionLedger\",\n\t})\n\n\tfactionBandTitle := BandTitle{\n\t\tAthenasFortune: []string{\"Legend\", \"Guardian\", \"Voyager\", \"Seeker\"},\n\t\tGoldHoarder: []string{\"Captain\", \"Marauder\", \"Seafarer\", \"Castaway\"},\n\t\tMerchantAlliance: []string{\"Admiral\", \"Commander\", \"Cadet\", \"Sailor\"},\n\t\tOrderOfSouls: []string{\"Grandee\", \"Chief\", \"Mercenary\", \"Apprentice\"},\n\t\tReapersBone: []string{\"Master\", \"Keeper\", \"Servant\", \"Follower\"},\n\t}\n\n\tvar apiUrl string\n\tapiBase := \"https://www.seaofthieves.com/api/ledger/friends/\"\n\n\tswitch f {\n\tcase \"athena\":\n\t\tapiUrl = fmt.Sprintf(\"%v%v?count=10\", apiBase, \"AthenasFortune\")\n\tcase \"hoarder\":\n\t\tapiUrl = fmt.Sprintf(\"%v%v?count=10\", apiBase, \"GoldHoarders\")\n\tcase \"merchant\":\n\t\tapiUrl = fmt.Sprintf(\"%v%v?count=10\", apiBase, \"MerchantAlliance\")\n\tcase \"order\":\n\t\tapiUrl = fmt.Sprintf(\"%v%v?count=10\", apiBase, \"OrderOfSouls\")\n\tcase \"reaper\":\n\t\tapiUrl = fmt.Sprintf(\"%v%v?count=10\", apiBase, \"ReapersBones\")\n\tdefault:\n\t\treturn FactionLedger{}, fmt.Errorf(\"Unknown faction\")\n\t}\n\n\tl.Debugf(\"Fetching user ledger position in %v faction from API...\", f)\n\tvar userApiLedger ApiLedger\n\thttpResp, err := httpclient.HttpReqGet(apiUrl, hc, &rc, nil, false)\n\tif err != nil {\n\t\treturn FactionLedger{}, err\n\t}\n\tif err := json.Unmarshal(httpResp, &userApiLedger); err != nil {\n\t\tl.Errorf(\"Failed to unmarshal API response: %v\", err)\n\t\treturn FactionLedger{}, err\n\t}\n\n\tuserFactionLedger := userApiLedger.Current.Friends.User\n\tswitch f {\n\tcase \"athena\":\n\t\tuserFactionLedger.Name = \"Athenas Fortune\"\n\t\tuserFactionLedger.BandTitle = factionBandTitle.AthenasFortune[userFactionLedger.Band]\n\tcase \"hoarder\":\n\t\tuserFactionLedger.Name = \"Gold Hoarders\"\n\t\tuserFactionLedger.BandTitle = factionBandTitle.GoldHoarder[userFactionLedger.Band]\n\tcase \"merchant\":\n\t\tuserFactionLedger.Name = \"Merchant Alliance\"\n\t\tuserFactionLedger.BandTitle = factionBandTitle.MerchantAlliance[userFactionLedger.Band]\n\tcase \"order\":\n\t\tuserFactionLedger.Name = \"Order of Souls\"\n\t\tuserFactionLedger.BandTitle = factionBandTitle.OrderOfSouls[userFactionLedger.Band]\n\tcase \"reaper\":\n\t\tuserFactionLedger.Name = \"Reaper's Bones\"\n\t\tuserFactionLedger.BandTitle = factionBandTitle.ReapersBone[userFactionLedger.Band]\n\t}\n\n\treturn userFactionLedger, nil\n}",
"func (o *Tier) GetFamily() string {\n\tif o == nil || o.Family == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Family\n}",
"func (o *TransactionSplit) GetForeignAmount() string {\n\tif o == nil || o.ForeignAmount.Get() == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ForeignAmount.Get()\n}",
"func NewFundedAccount() *keypair.Full {\n\tkp, err := keypair.Random()\n\tif err != nil {\n\t\tlog.Fatal(err, \"generating random keypair\")\n\t}\n\terr = FundAccount(kp.Address())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Printf(\"successfully funded %s\", kp.Address())\n\treturn kp\n}",
"func (c *CardUnit) Faction() CardFaction {\n\treturn c.UnitFaction\n}",
"func (c *CollateralPair) FundReserver() IFundReserver {\n\treturn c\n}",
"func (m *Message) FAC() (*FAC, error) {\n\tps, err := m.Parse(\"FAC\")\n\tpst, ok := ps.(*FAC)\n\tif ok {\n\t\treturn pst, err\n\t}\n\treturn nil, err\n}",
"func (m FailingFunder) Fund(ctx context.Context, req channel.FundingReq) error {\n\treturn errors.New(\"funding failed\")\n}",
"func NewClawbackVestingAccount(baseAcc *authtypes.BaseAccount, funder sdk.AccAddress, originalVesting sdk.Coins, startTime int64, lockupPeriods, vestingPeriods Periods) *ClawbackVestingAccount {\n\t// copy and align schedules to avoid mutating inputs\n\tlp := make(Periods, len(lockupPeriods))\n\tcopy(lp, lockupPeriods)\n\tvp := make(Periods, len(vestingPeriods))\n\tcopy(vp, vestingPeriods)\n\t_, endTime := AlignSchedules(startTime, startTime, lp, vp)\n\tbaseVestingAcc := &BaseVestingAccount{\n\t\tBaseAccount: baseAcc,\n\t\tOriginalVesting: originalVesting,\n\t\tEndTime: endTime,\n\t}\n\n\treturn &ClawbackVestingAccount{\n\t\tBaseVestingAccount: baseVestingAcc,\n\t\tFunderAddress: funder.String(),\n\t\tStartTime: startTime,\n\t\tLockupPeriods: lp,\n\t\tVestingPeriods: vp,\n\t}\n}",
"func (o *W2) GetDependentCareBenefits() string {\n\tif o == nil || o.DependentCareBenefits.Get() == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.DependentCareBenefits.Get()\n}",
"func (cg *ConsumerGroup) GetUserFacingResourceRef() *metav1.OwnerReference {\n\tfor i, or := range cg.OwnerReferences {\n\t\t// TODO hardcoded resource kinds.\n\t\tif strings.EqualFold(or.Kind, \"trigger\") ||\n\t\t\tstrings.EqualFold(or.Kind, \"kafkasource\") ||\n\t\t\tstrings.EqualFold(or.Kind, \"kafkachannel\") {\n\t\t\treturn &cg.OwnerReferences[i]\n\t\t}\n\t}\n\treturn nil\n}",
"func (x ThirdPartyServiceEntity) GetAccount() accounts.AccountOutline {\n\treturn x.Account\n}",
"func (m Message) UnderlyingCashAmount() (*field.UnderlyingCashAmountField, quickfix.MessageRejectError) {\n\tf := &field.UnderlyingCashAmountField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}",
"func (_HarvestVault *HarvestVaultCallerSession) UnderlyingBalanceWithInvestment() (*big.Int, error) {\n\treturn _HarvestVault.Contract.UnderlyingBalanceWithInvestment(&_HarvestVault.CallOpts)\n}",
"func GetFundProfile(w http.ResponseWriter, r *http.Request, cache *bigcache.BigCache) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tparams := mux.Vars(r) // Gets params\n\tfundCode := strings.ToUpper(params[\"name\"])\n\tvar key string\n\tkey = \"fund:profile-\" + fundCode\n\t//Getting fund data from cache by fund name\n\tcacheData, getErr := cache.Get(key)\n\tif getErr == nil {\n\t\tvar jsonFund model.FundProfile\n\t\tif err := helper.DecodeFromBase64(&jsonFund, string(cacheData)); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tjsonFund.FromCache = true\n\t\tjson.NewEncoder(w).Encode(jsonFund)\n\t\treturn\n\t}\n\tvar configurationModel model.ConfigurationModel\n\tconfigurationModel = helper.GetConfiguration()\n\t//Getting from website\n\tfundData := helper.ScrapeFundProfileByCode(fundCode, configurationModel.ScreaperUrls.Tefas)\n\n\tenc, err := helper.EncodeToBase64(fundData)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tsetErr := cache.Set(key, []byte(enc))\n\tif setErr != nil {\n\t\tpanic(setErr)\n\t}\n\n\tjson.NewEncoder(w).Encode(fundData)\n}",
"func (a *Account) Funnel(id int) (*Funnel, error) {\n\tassert(a.id > 0, \"find funnel on unsaved account: %d\", a.id)\n\tf, err := a.Tx.Funnel(id)\n\tif err != nil {\n\t\treturn nil, err\n\t} else if f.AccountID != a.ID() {\n\t\treturn nil, ErrFunnelNotFound\n\t}\n\treturn f, nil\n}",
"func (c *CollateralPair) FundReader() IFundReader {\n\treturn c\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GetUnlockedOnly implements the exported.ClawbackVestingAccountI interface. It returns the unlocking schedule at blockTIme. Like GetVestedCoins, but only for the lockup component.
|
func (va ClawbackVestingAccount) GetUnlockedOnly(blockTime time.Time) sdk.Coins {
return ReadSchedule(va.StartTime, va.EndTime, va.LockupPeriods, va.OriginalVesting, blockTime.Unix())
}
|
[
"func (va ClawbackVestingAccount) GetVestedOnly(blockTime time.Time) sdk.Coins {\n\treturn ReadSchedule(va.StartTime, va.EndTime, va.VestingPeriods, va.OriginalVesting, blockTime.Unix())\n}",
"func (_SfcContract *SfcContractCallerSession) GetUnlockedStake(delegator common.Address, toValidatorID *big.Int) (*big.Int, error) {\n\treturn _SfcContract.Contract.GetUnlockedStake(&_SfcContract.CallOpts, delegator, toValidatorID)\n}",
"func (_SfcContract *SfcContractSession) GetUnlockedStake(delegator common.Address, toValidatorID *big.Int) (*big.Int, error) {\n\treturn _SfcContract.Contract.GetUnlockedStake(&_SfcContract.CallOpts, delegator, toValidatorID)\n}",
"func (_Constants *ConstantsCallerSession) UnstakeLockPeriod() (*big.Int, error) {\n\treturn _Constants.Contract.UnstakeLockPeriod(&_Constants.CallOpts)\n}",
"func (_Constants *ConstantsCaller) UnstakeLockPeriod(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Constants.contract.Call(opts, &out, \"unstakeLockPeriod\")\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}",
"func (a *ScratchAccount) IsUnlocked(_ context.Context) (bool, error) {\n\treturn a.unlocked, nil\n}",
"func (w *rpcWallet) WalletUnlocked(ctx context.Context) bool {\n\twalletInfo, err := w.rpcClient.WalletInfo(ctx)\n\tif err != nil {\n\t\tw.log.Errorf(\"walletinfo error: %v\", err)\n\t\treturn true // assume wallet is unlocked?\n\t}\n\treturn walletInfo.Unlocked\n}",
"func (_Testimonium *TestimoniumCaller) IsUnlocked(opts *bind.CallOpts, blockHash [32]byte) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _Testimonium.contract.Call(opts, out, \"isUnlocked\", blockHash)\n\treturn *ret0, err\n}",
"func (a *AuthBlockLockout) Get(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn get(client, \"/api/nodes/auth.block.lockout\", &a.Value, options...)\n}",
"func (_Testimonium *TestimoniumCallerSession) IsUnlocked(blockHash [32]byte) (bool, error) {\n\treturn _Testimonium.Contract.IsUnlocked(&_Testimonium.CallOpts, blockHash)\n}",
"func TestLockUnspent(t *testing.T) {\n\t// t.SkipNow()\n\tbc := testutil.GetBTC()\n\n\t// get unspent list\n\tlistUnspent, err := bc.ListUnspent(bc.ConfirmationBlock())\n\tif err != nil {\n\t\tt.Fatalf(\"fail to call ListUnspent(): %v\", err)\n\t}\n\t// use one of ListUnspentResult\n\tif len(listUnspent) == 0 {\n\t\tt.Log(\"unspent list is required for this test\")\n\t\treturn\n\t}\n\t// call LockUnspent to lock\n\tif err := bc.LockUnspent(&listUnspent[0]); err != nil {\n\t\tt.Fatalf(\"fail to call LockUnspent(): %v\", err)\n\t}\n\ttargetTxID := listUnspent[0].TxID\n\n\t// get unspent list again\n\tlistUnspent, err = bc.ListUnspent(bc.ConfirmationBlock())\n\tif err != nil {\n\t\tt.Fatalf(\"fail to call ListUnspent(): %v\", err)\n\t}\n\n\t// check that tx is locked or not\n\tif findUnspentListID(listUnspent, targetTxID) {\n\t\tt.Error(\"LockUnspent() fail to lock target unspent\")\n\t}\n\n\t// call UnlockUnspent to unlock\n\tif err = bc.UnlockUnspent(); err != nil {\n\t\tt.Fatalf(\"fail to call UnlockUnspent(): %v\", err)\n\t}\n\n\t// get unspent list again\n\tlistUnspent, err = bc.ListUnspent(bc.ConfirmationBlock())\n\tif err != nil {\n\t\tt.Fatalf(\"fail to call ListUnspent(): %v\", err)\n\t}\n\n\t// check unlocked or not\n\tif !findUnspentListID(listUnspent, targetTxID) {\n\t\tt.Error(\"UnlockUnspent() fail to unlock\")\n\t}\n\n\t// bc.Close()\n}",
"func (ks *Keystore) GetUnlocked(alias string) (crypto.PrivateKey, error) {\n\tif len(alias) == 0 {\n\t\treturn nil, ErrNeedAlias\n\t}\n\n\tks.mu.RLock()\n\tdefer ks.mu.RUnlock()\n\n\tkey, ok := ks.unlocked[alias]\n\tif ok == false {\n\t\treturn nil, ErrNotUnlocked\n\t}\n\n\treturn key.key, nil\n}",
"func (m *ProtectOnlineMeetingAction) GetLobbyBypassSettings()(LobbyBypassSettingsable) {\n val, err := m.GetBackingStore().Get(\"lobbyBypassSettings\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(LobbyBypassSettingsable)\n }\n return nil\n}",
"func (m *AndroidWorkProfileGeneralDeviceConfiguration) GetWorkProfilePasswordBlockFingerprintUnlock()(*bool) {\n return m.workProfilePasswordBlockFingerprintUnlock\n}",
"func (b *Bitcoind) ListLockUnspent() (unspendableOutputs []UnspendableOutput, err error) {\n\tr, err := b.client.call(\"listlockunspent\", nil)\n\tif err = handleError(err, &r); err != nil {\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(r.Result, &unspendableOutputs)\n\treturn\n}",
"func (w *spvWallet) listLockUnspent() ([]*RPCOutpoint, error) {\n\toutpoints := w.wallet.LockedOutpoints()\n\tpts := make([]*RPCOutpoint, 0, len(outpoints))\n\tfor _, pt := range outpoints {\n\t\tpts = append(pts, &RPCOutpoint{\n\t\t\tTxID: pt.Txid,\n\t\t\tVout: pt.Vout,\n\t\t})\n\t}\n\treturn pts, nil\n}",
"func (wc *rpcClient) locked() bool {\n\twalletInfo, err := wc.GetWalletInfo()\n\tif err != nil {\n\t\twc.log.Errorf(\"GetWalletInfo error: %w\", err)\n\t\treturn false\n\t}\n\tif walletInfo.UnlockedUntil == nil {\n\t\t// This wallet is not encrypted.\n\t\treturn false\n\t}\n\n\treturn time.Unix(*walletInfo.UnlockedUntil, 0).Before(time.Now())\n}",
"func (c *Client) WalletUnLockAct(timeout string, password string) (error) {\n\treturn c.WalletUnLockActAsync(timeout, password).Receive()\n}",
"func (w *xcWallet) unlocked() bool {\n\tif w.isDisabled() {\n\t\treturn false\n\t}\n\ta, is := w.Wallet.(asset.Authenticator)\n\tif !is {\n\t\treturn w.locallyUnlocked()\n\t}\n\tif w.parent != nil {\n\t\treturn w.parent.unlocked()\n\t}\n\tif !w.connected() {\n\t\treturn false\n\t}\n\treturn w.locallyUnlocked() && !a.Locked()\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.