query_id
stringlengths
32
32
query
stringlengths
7
4.32k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
35b72b49ef8599c9b3ef22f67e205c70
NewEmptyEncoder returns a empty encoder
[ { "docid": "01017f4f2f673aaf106587b48b654ff9", "score": "0.8314351", "text": "func NewEmptyEncoder() Encoder {\n\treturn &emptyEncoder{}\n}", "title": "" } ]
[ { "docid": "38467339a77591da8d2663aaa72f4569", "score": "0.85056394", "text": "func NewEmptyEncoder() Encoder {\r\n\treturn &emptyEncoder{}\r\n}", "title": "" }, { "docid": "66a4fe2fe2ecce9a0b5e15a8ba9be8f4", "score": "0.6745302", "text": "func DefaultEncoder() Encoder {\n\tdefaultEncoderOnce.Do(func() {\n\t\tdefaultEncoderInstance = &defaultLabelEncoder{\n\t\t\tpool: sync.Pool{\n\t\t\t\tNew: func() interface{} {\n\t\t\t\t\treturn &bytes.Buffer{}\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t})\n\treturn defaultEncoderInstance\n}", "title": "" }, { "docid": "cbf01bee923f94e3112af275ef389f53", "score": "0.6565882", "text": "func (ep *EncoderPool) New() Encoder {\n\treturn NewEncoder(nil, ep.format)\n}", "title": "" }, { "docid": "a4f84f2333736479110fc18caa93129e", "score": "0.6500416", "text": "func NewEncoder() *Encoder {\n\treturn &Encoder{cache: newCache(), regenc: make(map[reflect.Type]encoderFunc)}\n}", "title": "" }, { "docid": "349c9f2086f256f0cd6bfd40413c2624", "score": "0.6389443", "text": "func NewEncoder() *Encoder {\n\tbuffer := make([]byte, 64)\n\n\treturn &Encoder{\n\t\tbuffer: buffer[:0],\n\t\trefMap: make(map[unsafe.Pointer]_refElem, 7),\n\t}\n}", "title": "" }, { "docid": "694c634041b49813e91d27a892320d53", "score": "0.63035333", "text": "func NewEncoder(w io.Writer) *Encoder {}", "title": "" }, { "docid": "4166a48aa5f7f58cd51d15d8dd77ccc7", "score": "0.62450594", "text": "func (e *Encoder) EncodeNoOp() error {\n\treturn e.encode(NoOpMarker, func(*Encoder) error { return nil })\n}", "title": "" }, { "docid": "1b15d5f2440b8a3ea6af9881864986a4", "score": "0.6202977", "text": "func NewEncoder() *Encoder {\n\treturn &Encoder{\n\t\tPerlCompat: false,\n\t\tCompressionThreshold: 1024,\n\t\tversion: 1,\n\t}\n}", "title": "" }, { "docid": "3f142c9b3c9ed433c12308c2b3cfb0a5", "score": "0.61709267", "text": "func (en Encoder) Reset() {}", "title": "" }, { "docid": "bfaab98f84a9c2299e76fa47b932d08f", "score": "0.61592305", "text": "func NewEmptyDecoder() Decoder {\n\treturn &emptyDecoder{}\n}", "title": "" }, { "docid": "257d0bf14882a9fd9c42121890a9d7ea", "score": "0.6142079", "text": "func New(cfg *EncoderConfig) *Encoder {\n\treturn &Encoder{config: cfg}\n}", "title": "" }, { "docid": "3b503546e73ff12acd313031d88da7ad", "score": "0.6137017", "text": "func NewSingleEncoder(r EncodingRegistry, names *Names) *SingleEncoder {\n\tif names == nil {\n\t\tnames = globalNames\n\t}\n\treturn &SingleEncoder{\n\t\tregistry: r,\n\t\tnames: names,\n\t}\n}", "title": "" }, { "docid": "d5e214b816ec1e383454c2937ab49297", "score": "0.6124263", "text": "func MustNewEncoder(base Encoding) Encoder {\n\t_, ok := EncodingToStr[base]\n\tif !ok {\n\t\tpanic(\"Unsupported multibase encoding\")\n\t}\n\treturn Encoder{base}\n}", "title": "" }, { "docid": "f3cdb391b1f0d6a583aaa3f17f677d53", "score": "0.60980403", "text": "func NewEncoder(replacement byte) *Encoder {\n\tif replacement == 0 {\n\t\treplacement = byte(0x3F)\n\t}\n\treturn &Encoder{\n\t\treplacement: replacement,\n\t}\n}", "title": "" }, { "docid": "42b04bf821b94220f67835506a4721cf", "score": "0.6086417", "text": "func NewEncoder(w io.Writer) io.Writer { return &encoder{w: w} }", "title": "" }, { "docid": "dc69f6f3456adfa5b40750daeeaf3a64", "score": "0.60756004", "text": "func New() *Encoder {\n\treturn &Encoder{\n\t\tmediaType: libavutil.AvmediaTypeUnknown,\n\t}\n}", "title": "" }, { "docid": "2a1a056931ae783e26c89c1882a40b6e", "score": "0.60208595", "text": "func New() format.Encoder { return formatter }", "title": "" }, { "docid": "45bbdcb427c23bd659c92d3e4a4804b3", "score": "0.59850556", "text": "func NewPlain() (Encoder, error) {\n\treturn new(PlainEncoder), nil\n}", "title": "" }, { "docid": "c8dcd0d721a66a1d22e0099ffef915da", "score": "0.5982036", "text": "func NewEncoder(w io.Writer) *Encoder {\n enc := new(Encoder)\n enc.w = w\n\n return enc\n}", "title": "" }, { "docid": "241e56645156bfc0036a33e5c1ae79f2", "score": "0.5964168", "text": "func New(mode HashingMode) *Encoder {\n\treturn &Encoder{\n\t\tmode: mode,\n\t}\n}", "title": "" }, { "docid": "778b1d3a61432262145ec6d5ebd8299d", "score": "0.5963327", "text": "func NewEncoder(opts ...Option) *encoder {\n\tb := &encoder{}\n\tfor _, option := range opts {\n\t\toption(&b.opts)\n\t}\n\tb.encodeFuncMap = make(map[reflect.Kind]valueEncode)\n\treturn b\n}", "title": "" }, { "docid": "59dc146c70791602ff538535ad9e1a4d", "score": "0.59081995", "text": "func NewEncoder(options EncoderOptions) Encoder {\n\tif options.FileResolver == nil {\n\t\toptions.FileResolver = protoregistry.GlobalFiles\n\t}\n\tif options.TypeResolver == nil {\n\t\toptions.TypeResolver = protoregistry.GlobalTypes\n\t}\n\tenc := Encoder{\n\t\tscalarEncoders: map[string]FieldEncoder{\n\t\t\t\"cosmos.Dec\": cosmosDecEncoder,\n\t\t\t\"cosmos.Int\": cosmosIntEncoder,\n\t\t},\n\t\tmessageEncoders: map[string]MessageEncoder{\n\t\t\t\"key_field\": keyFieldEncoder,\n\t\t\t\"module_account\": moduleAccountEncoder,\n\t\t\t\"threshold_string\": thresholdStringEncoder,\n\t\t},\n\t\tfieldEncoders: map[string]FieldEncoder{\n\t\t\t\"legacy_coins\": nullSliceAsEmptyEncoder,\n\t\t},\n\t\tfileResolver: options.FileResolver,\n\t\ttypeResolver: options.TypeResolver,\n\t\tdoNotSortFields: options.DoNotSortFields,\n\t}\n\treturn enc\n}", "title": "" }, { "docid": "6742a08c55ea5de377cf373ec16c5b39", "score": "0.5878947", "text": "func NewEncoder(w io.Writer) Encoder {\n\treturn Encoder{w}\n}", "title": "" }, { "docid": "276ef4776cf0f2466002a2d394e6593e", "score": "0.58761734", "text": "func EmptyResponseEncoder(_ context.Context, writer http.ResponseWriter, _ interface{}) error {\n\twriter.WriteHeader(http.StatusOK)\n\treturn nil\n}", "title": "" }, { "docid": "a2f5c88326bfdde89ec78ac107e58e58", "score": "0.58735967", "text": "func NewEncoder(size int) *Encoder {\n\treturn &Encoder{make([]byte, 0, size)}\n}", "title": "" }, { "docid": "d50a5080f627f2f7285bb45347ae36f0", "score": "0.58569795", "text": "func NewEncoder(options ...EncoderOption) *Encoder {\n\te := &Encoder{\n\t\ttagAlias: \"qs\",\n\t}\n\n\t// Apply options\n\tfor _, opt := range options {\n\t\topt(e)\n\t}\n\n\te.cache = newCacheStore()\n\n\te.dataPool = &sync.Pool{New: func() interface{} {\n\t\ttagSize := 5\n\t\ttags := make([][]byte, 0, tagSize)\n\t\tfor i := 0; i < tagSize; i++ {\n\t\t\ttags = append(tags, make([]byte, 0, 56))\n\t\t}\n\t\treturn &encoder{\n\t\t\te: e,\n\t\t\ttags: tags,\n\t\t\tscope: make([]byte, 0, 64),\n\t\t}\n\t}}\n\n\treturn e\n}", "title": "" }, { "docid": "cc0594a7d65c77b060c30ba48cd4fb34", "score": "0.58067226", "text": "func NewDefault() Codec {\n\treturn New([]string{reflectcodec.DefaultTagName}, defaultMaxSliceLength)\n}", "title": "" }, { "docid": "3a418512aacf191e024fedbdb871f6e1", "score": "0.5784041", "text": "func NewEncoder(private_key []byte, defaults TransactionParams) *Encoder {\n\tpriv := signing.NewSecp256k1PrivateKey(private_key)\n\tpub := signing.NewSecp256k1Context().GetPublicKey(priv)\n\treturn &Encoder{\n\t\tprivate_key: private_key,\n\t\tpublic_key: pub.AsHex(),\n\t\tdefaults: defaults,\n\t}\n}", "title": "" }, { "docid": "72cf17982ca2238374fba6c2d47246c4", "score": "0.57821363", "text": "func newCodec() *Codec {\n\treturn &Codec{\n\t\trd: newReader(emptyReader),\n\t\twr: newWriter(ioutil.Discard),\n\t}\n}", "title": "" }, { "docid": "a9d52ab9c188906a68aedeb3ca668dfe", "score": "0.5766595", "text": "func (d *DummyPayload) Encode() []byte {\n\treturn nil\n}", "title": "" }, { "docid": "8b97fa3284d86ebb19b36d61f6c4a8c7", "score": "0.573791", "text": "func NewEncoder(rt reflect.Type) (*Encoder, error) {\n\tif rt == nil {\n\t\treturn nil, errors.New(\"invalid type: nil\")\n\t}\n\treturn &Encoder{typ: rt}, nil\n}", "title": "" }, { "docid": "1120ba1593dcee0c4b20289110e4eeda", "score": "0.5736089", "text": "func DefaultEncoder(ctx context.Context, res interface{}) *StandardComponents {\n\tif res, ok := res.(interface{ GetMetadata() *corev2.ObjectMeta }); ok {\n\t\treturn DefaultEncoder(ctx, res.GetMetadata())\n\t}\n\n\tcmp := StandardComponents{}\n\tif res, ok := res.(interface{ GetName() string }); ok {\n\t\tcmp.uniqueComponent = res.GetName()\n\t}\n\tif res, ok := res.(interface{ GetNamespace() string }); ok {\n\t\tcmp.namespace = res.GetNamespace()\n\t}\n\treturn &cmp\n}", "title": "" }, { "docid": "fdff4b9194b89971f3cdf35310fa1dd1", "score": "0.573544", "text": "func (e *encoder) Reset() { e.sink.Reset(0) }", "title": "" }, { "docid": "724ca511d47310d8b0641f47a7ef8dde", "score": "0.5721225", "text": "func NewEncoder() encoder.Encoder {\n\treturn cueEncoder{}\n}", "title": "" }, { "docid": "4d39505fae462a50ace9cf486e444d2c", "score": "0.5719705", "text": "func (*transcoder) NewEncoder(w io.Writer) Encoder {\n\treturn gob.NewEncoder(w)\n}", "title": "" }, { "docid": "a29eb4b9787907fca57270398bf82fef", "score": "0.5701463", "text": "func NewEncoder() *Encoder {\n\n\treturn &Encoder{\n\t\ttagName: \"form\",\n\t\tstructCache: newStructCacheMap(),\n\t}\n}", "title": "" }, { "docid": "f7cb0461e08f1f8e1f66d38959791b0f", "score": "0.56638795", "text": "func NewEncoder(w io.Writer) *Encoder {\n\treturn &Encoder{w}\n}", "title": "" }, { "docid": "f7cb0461e08f1f8e1f66d38959791b0f", "score": "0.56638795", "text": "func NewEncoder(w io.Writer) *Encoder {\n\treturn &Encoder{w}\n}", "title": "" }, { "docid": "dc737fd559c4aebe528ef35778c944e1", "score": "0.56569487", "text": "func TestOmitEmpty(t *testing.T) {\n mk := \"audi\"\n st := struct{ Omit *string `msgpack:\"omit,omitempty\"`\n Nil *string\n Make *string }{ nil, nil, &mk }\n\n //Check omitted\n buf := bytes.Buffer{}\n enc := NewEncoder(&buf)\n encodeDebug(t, enc, &buf, &st)\n t.Logf(\"%.*s\", buf.Len(), buf.Bytes())\n\n //Check not omitted\n buf.Reset()\n omit := \"NO Omit!!\"\n st.Omit = &omit\n enc = NewEncoder(&buf)\n encodeDebug(t, enc, &buf, &st)\n t.Logf(\"%.*s\", buf.Len(), buf.Bytes())\n}", "title": "" }, { "docid": "75825505fbafdbce3d872b30dbd8812d", "score": "0.5620872", "text": "func NewEncoder(w io.Writer) *Encoder {\n\treturn &Encoder{w: w}\n}", "title": "" }, { "docid": "75825505fbafdbce3d872b30dbd8812d", "score": "0.5620872", "text": "func NewEncoder(w io.Writer) *Encoder {\n\treturn &Encoder{w: w}\n}", "title": "" }, { "docid": "75825505fbafdbce3d872b30dbd8812d", "score": "0.5620872", "text": "func NewEncoder(w io.Writer) *Encoder {\n\treturn &Encoder{w: w}\n}", "title": "" }, { "docid": "75825505fbafdbce3d872b30dbd8812d", "score": "0.5620872", "text": "func NewEncoder(w io.Writer) *Encoder {\n\treturn &Encoder{w: w}\n}", "title": "" }, { "docid": "75825505fbafdbce3d872b30dbd8812d", "score": "0.5620872", "text": "func NewEncoder(w io.Writer) *Encoder {\n\treturn &Encoder{w: w}\n}", "title": "" }, { "docid": "75825505fbafdbce3d872b30dbd8812d", "score": "0.5620872", "text": "func NewEncoder(w io.Writer) *Encoder {\n\treturn &Encoder{w: w}\n}", "title": "" }, { "docid": "75825505fbafdbce3d872b30dbd8812d", "score": "0.5620872", "text": "func NewEncoder(w io.Writer) *Encoder {\n\treturn &Encoder{w: w}\n}", "title": "" }, { "docid": "c30414a1c74cae6c4840595e87230768", "score": "0.560439", "text": "func NewEncoder(w io.Writer) *Encoder {\n\treturn &Encoder{\n\t\twriter: w,\n\t\tec: encodeState{},\n\t}\n}", "title": "" }, { "docid": "b8e56c87c8b9c07811a47c3712c938a4", "score": "0.558313", "text": "func NewEncoder(w io.Writer) *Encoder {\n\treturn &Encoder{\n\t\tw: bufio.NewWriterSize(w, MinBufSize),\n\t}\n}", "title": "" }, { "docid": "7a83e206d843937019803105d3ac4c9d", "score": "0.558133", "text": "func NewMockDefaultCodec(t interface {\n\tmock.TestingT\n\tCleanup(func())\n}) *MockDefaultCodec {\n\tmock := &MockDefaultCodec{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "4bff965c3d08b97d0b173cef5a4128dd", "score": "0.5577044", "text": "func NewEncoder(w io.Writer) *Encoder {\n\treturn &Encoder{\n\t\tw: w,\n\t}\n}", "title": "" }, { "docid": "f63b29ec4ca665d26a7d29c94194d708", "score": "0.5561434", "text": "func (v *EmptyUnion) Encode(sw stream.Writer) error {\n\tif err := sw.WriteStructBegin(); err != nil {\n\t\treturn err\n\t}\n\n\treturn sw.WriteStructEnd()\n}", "title": "" }, { "docid": "92faa92215f961e4948f7dc76f44cad0", "score": "0.55530447", "text": "func (c *Charmap) NewEncoder() *encoding.Encoder {\n\tc.Init()\n\treturn &encoding.Encoder{\n\t\tTransformer: &cmapEncoder{\n\t\t\tbytes: c.bytes,\n\t\t\treplace: c.ReplacementChar,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "215d94bb89d370adbd5606bdec62d472", "score": "0.55247355", "text": "func NewEncoder(w io.Writer, opts *EncodeOptions) *Encoder {\n\taopts := api.EncodeOptions{}\n\tif opts != nil {\n\t\taopts.TrackPointers = opts.TrackPointers\n\t\taopts.Buffer = opts.Buffer\n\t}\n\treturn &Encoder{state: api.NewEncoder(w, aopts)}\n}", "title": "" }, { "docid": "5a4ff1d29bcb3cbfeecd2f89efccf0f3", "score": "0.5522263", "text": "func NewEncoder(cfg zapcore.EncoderConfig) *Encoder {\n\treturn &Encoder{\n\t\tenc: zapcore.NewJSONEncoder(cfg),\n\t}\n}", "title": "" }, { "docid": "d7d261e0a085d3931f5d4391b2a15e58", "score": "0.5494995", "text": "func NewEncoder(w io.Writer, options ...EncoderOption) *Encoder {\n\te := &Encoder{\n\t\tw: w,\n\t\tprefix: \"root\",\n\t\tsuffix: \";\\n\",\n\t}\n\tfor _, option := range options {\n\t\toption(e)\n\t}\n\treturn e\n}", "title": "" }, { "docid": "a5ccab6ed04943edf69e3721dfb7a49d", "score": "0.5480721", "text": "func NewEncoder(w io.Writer) *Encoder {\n\tenc := encoderStatePool.Get()\n\tenc.w = w\n\treturn enc\n}", "title": "" }, { "docid": "3654da87b9301a5dcefed5bc25d3e958", "score": "0.5475694", "text": "func NewEncoder(w io.Writer) *Encoder {\n\treturn &Encoder{\n\t\tbuff: new(bytes.Buffer),\n\t\tw: w,\n\t}\n}", "title": "" }, { "docid": "66d882885396285ad7ef441777a0316e", "score": "0.5464023", "text": "func NewMockObjectEncoder(ctrl *gomock.Controller) *MockObjectEncoder {\n\tmock := &MockObjectEncoder{ctrl: ctrl}\n\tmock.recorder = &MockObjectEncoderMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "3c7d049c81404653330f0f57fecc8b63", "score": "0.5462082", "text": "func NewEncoder(w io.Writer) *Encoder {\n\treturn &Encoder{\n\t\tencoder: toml.NewEncoder(w),\n\t}\n}", "title": "" }, { "docid": "e827ed8fe17a4a8b925168e5d9c79586", "score": "0.54557943", "text": "func (ep *EncoderPool) Get() (encoder Encoder) {\n\tselect {\n\tcase encoder = <-ep.pool:\n\tdefault:\n\t\tencoder = ep.New()\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "f6e8dae9b7116cdd7bcf577c84e2c099", "score": "0.5449207", "text": "func NewEncoder(target io.Writer) *Encoder {\n\treturn &Encoder{target: target}\n}", "title": "" }, { "docid": "1de75989b8929477886a72864934bc01", "score": "0.54381496", "text": "func NewEncoder(w io.Writer) *Encoder {\n\te := &Encoder{writer: newBinaryWriter(w)}\n\te.writeValType = e.writeMarker\n\treturn e\n}", "title": "" }, { "docid": "b3278c4804a6de6218bc314044150cfd", "score": "0.5429952", "text": "func NewEncoder(w io.Writer) *Encoder {\n\te := &Encoder{w: w}\n\tyaml_emitter_initialize(&e.emitter)\n\tyaml_emitter_set_output_writer(&e.emitter, e.w)\n\tyaml_stream_start_event_initialize(&e.event, yaml_UTF8_ENCODING)\n\te.emit()\n\tyaml_document_start_event_initialize(&e.event, nil, nil, true)\n\te.emit()\n\n\treturn e\n}", "title": "" }, { "docid": "1cef66a3f18de6b857629156e01039ee", "score": "0.5419423", "text": "func NewEncoder(w io.Writer) proto.Encoder {\n\te := &encoder{\n\t\tbw: bufio.NewWriterSize(w, encoderBufferSize),\n\t}\n\treturn e\n}", "title": "" }, { "docid": "03a4509bec4325406635f106e25d5afd", "score": "0.53859895", "text": "func NewEncoder(w io.Writer, cb WriteResourceCallback, asBinary bool) *Encoder {\n\treturn &Encoder{\n\t\tw: w,\n\t\tcb: cb,\n\t\tasBinary: asBinary,\n\t}\n}", "title": "" }, { "docid": "68d22dca36935b6e3e1a728d90b47282", "score": "0.5384581", "text": "func NewEncoder(data interface{}) *Encoder {\n\treturn &Encoder{\n\t\tPathToStringConverter: PathToStringConverter,\n\t\tValueCustomProcessors: make(map[reflect.Kind]ValueCustomProcessor),\n\n\t\tinitialData: data,\n\t\tformData: make(map[string]string),\n\t}\n}", "title": "" }, { "docid": "eae00cfe9485d0a19dcf1b2fc362e1df", "score": "0.5382889", "text": "func NewEncoder(log logger.Logger, errFunc func(err error), errResponseHandler func(err error) (errorResponse error, errorCode int)) *encoder {\n\treturn &encoder{log, errFunc, errResponseHandler}\n}", "title": "" }, { "docid": "30d2d679940920d2774d2a46e025a2db", "score": "0.5367889", "text": "func NewMockEncoder(ctrl *gomock.Controller) *MockEncoder {\n\tmock := &MockEncoder{ctrl: ctrl}\n\tmock.recorder = &MockEncoderMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "3a7d5f69698b8af5074512fa77ad72d2", "score": "0.5355013", "text": "func NewEmptyRegistry() *Registry {\n\treturn &Registry{\n\t\trevTypeMap: make(map[string]*Type),\n\t\tpbdb: pb.NewDb(),\n\t}\n}", "title": "" }, { "docid": "4eabf0c57a61cebcd5b474d434a93c39", "score": "0.5337445", "text": "func (cfg *Config) NewEncoder(w io.Writer) *Encoder {\n\treturn &Encoder{w, cfg}\n}", "title": "" }, { "docid": "e09b1f3f042d1f05491a261ba4651d32", "score": "0.5331331", "text": "func NewEncoder(w io.Writer) *Encoder {\n\treturn &Encoder{\n\t\tw: w,\n\t\theader: make([]byte, 0, 128),\n\t\tfooter: make([]byte, 0, 128),\n\t\tpair: make([]byte, 0, 128),\n\t\tfieldList: make([]*Field, 0, 16),\n\t\tprecision: time.Nanosecond,\n\t}\n}", "title": "" }, { "docid": "42fb6fc5d4087ce42256545aa6ded489", "score": "0.5323915", "text": "func NewEncoder(src image.Image) *Encoder {\n\treturn NewIm8Encoder(im8.Convert(src))\n}", "title": "" }, { "docid": "78404599c3ba711e44ff685eba13589b", "score": "0.527962", "text": "func NewEncoder(base Encoding) (Encoder, error) {\n\t_, ok := EncodingToStr[base]\n\tif !ok {\n\t\treturn Encoder{-1}, fmt.Errorf(\"Unsupported multibase encoding: %d\", base)\n\t}\n\treturn Encoder{base}, nil\n}", "title": "" }, { "docid": "a47101f812cca540c30c5b9d1727755c", "score": "0.52746356", "text": "func NewEncoder(w io.Writer, plugins ...plugin) *Encoder {\n\te := &Encoder{w: w, contentPrefix: contentPrefix, attributePrefix: attrPrefix}\n\tfor _, p := range plugins {\n\t\te = p.AddToEncoder(e)\n\t}\n\treturn e\n}", "title": "" }, { "docid": "bbdf086227e6d80f715dcc359c0a85a3", "score": "0.52657247", "text": "func NewEncoder(w io.Writer) sift.Encoder {\n\treturn &encoder{enc: json.NewEncoder(w)}\n}", "title": "" }, { "docid": "5572b8bcb4cd08df411f9d79cf70bf8f", "score": "0.52612436", "text": "func (e *StringEncoder) Reset() {\n\te.bytes = e.bytes[:0]\n}", "title": "" }, { "docid": "964f722d6acc3ce02a76d69c906f3464", "score": "0.5252278", "text": "func (enc *jsonEncoder) Clone() Encoder {\n\tclone := jsonPool.Get().(*jsonEncoder)\n\tclone.truncate()\n\tclone.bytes = append(clone.bytes, enc.bytes...)\n\tclone.messageF = enc.messageF\n\tclone.timeF = enc.timeF\n\tclone.levelF = enc.levelF\n\treturn clone\n}", "title": "" }, { "docid": "582d77810627d7d8679be63e08e86104", "score": "0.5251521", "text": "func NewEncoder() jsoniter.API {\n\treturn jsoniter.Config{\n\t\tEscapeHTML: true,\n\t\tSortMapKeys: true,\n\t\tValidateJsonRawMessage: true,\n\t}.Froze()\n}", "title": "" }, { "docid": "0f6d871e9c995f61305197b3152613f4", "score": "0.52468926", "text": "func NewEncoderID() EncoderID {\n\treturn EncoderID{value: atomic.AddUint64(&encoderIDCounter, 1)}\n}", "title": "" }, { "docid": "5ae635fcfd885b087db6a5eec5b42e7e", "score": "0.5242053", "text": "func NewEncoder(et Type) (Encoder, error) {\n\tswitch et {\n\tcase TypeMessagePack:\n\t\treturn NewMessagePackEncoder(), nil\n\tcase TypeProtocolBuffer:\n\t\treturn NewProtocolBufferEncoder(), nil\n\tcase TypeJSON:\n\t\treturn NewJSONEncoder(), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"cannot create encoder for unknown Typee %d\", et)\n\t}\n}", "title": "" }, { "docid": "1de6d98c909047a19535882513706c1c", "score": "0.52312046", "text": "func NewEncoder() *EncoderXML {\n\treturn &EncoderXML{\n\t\tMaxBodySize: 4194304, // 4MB\n\t\tIndented: false,\n\t\tAcceptHeader: \"application/xml\",\n\t\tContentTypeHeader: \"application/xml;charset=utf-8\",\n\t}\n}", "title": "" }, { "docid": "9fe83969dfdb7315a5ed1f469c6b6c75", "score": "0.5229958", "text": "func NewEncoder(enc *Encoding, w io.Writer) io.WriteCloser {\n\treturn &encoder{enc: enc, w: w}\n}", "title": "" }, { "docid": "ebdc002ed37a743fc702a6fda2ae7a2d", "score": "0.5225841", "text": "func NewEncoder(dynTabMaxSize uint32) *Encoder {\n\tdynT := newDynamicTable(dynTabMaxSize)\n\treturn &Encoder{\n\t\tdynTab: dynT,\n\t}\n}", "title": "" }, { "docid": "c0c6527c3c852aaa6acc0da54455a1e6", "score": "0.52168036", "text": "func NewEncoder(opts EncoderOptions) (*Encoder, error) {\n\tvar e Encoder\n\tif err := opts.validate(); err != nil {\n\t\treturn nil, fmt.Errorf(\"imaging: error validating encoder options: %w\", err)\n\t}\n\tif opts.ConcurrencyLevel > 0 {\n\t\te.sem = make(chan struct{}, opts.ConcurrencyLevel)\n\t}\n\te.opts = opts\n\te.pngEncoder = &png.Encoder{}\n\treturn &e, nil\n}", "title": "" }, { "docid": "1f01ee7b882898168835bc2096b30251", "score": "0.5214224", "text": "func NewEmptyPublisher() Publisher {\n\treturn NewPublisher(func(s Subscriber) {\n\t\tvar done int32 = 0\n\t\ts.OnSubscribe(NewSubscription(func(n int) {\n\t\t\tif atomic.CompareAndSwapInt32(&done, 0, 1) {\n\t\t\t\ts.OnComplete()\n\t\t\t}\n\t\t}, func() {}))\n\t})\n}", "title": "" }, { "docid": "8fac5408a26330389293dc743d1c1b25", "score": "0.51270664", "text": "func (e *Encoder) EncodeNull() error {\n\treturn e.encode(NullMarker, func(*Encoder) error { return nil })\n}", "title": "" }, { "docid": "dc1ac7cf9e8bbbd7cf4f9baecc2f1873", "score": "0.51140386", "text": "func (e *Encoder) Encode(input any) (any, error) {\n\treturn e.encode(reflect.ValueOf(input))\n}", "title": "" }, { "docid": "59545496910be946191803a2932b2363", "score": "0.5094511", "text": "func newFieldEncoder() *fieldEncoder {\n\tfe := encPool.Get().(*fieldEncoder)\n\tfe.fields = fe.fields[:0]\n\tfe.namespace = fe.namespace[:0]\n\treturn fe\n}", "title": "" }, { "docid": "63e5d827cc55382b12653544d9121afb", "score": "0.5087002", "text": "func Empty() Bytes {\n\treturn make([]byte, Size)\n}", "title": "" }, { "docid": "3014bbb3c1150fc024c1f03340f2587c", "score": "0.5077356", "text": "func NewEncoder(w io.Writer, options ...EncoderOption) *Encoder {\n\tenc := &Encoder{w: w, indentSize: 2}\n\tfor _, opt := range options {\n\t\topt(enc)\n\t}\n\tif enc.Colors == nil {\n\t\tenc.Colors = &Colors{\n\t\t\tKeyColor: color.New(),\n\t\t\tValueColor: color.New(),\n\t\t\tCommentColor: color.New(),\n\t\t}\n\t}\n\treturn enc\n}", "title": "" }, { "docid": "6918d8042357656d30d7cb965b2eb8cd", "score": "0.5066783", "text": "func NewEncoder(byteLen int) (*Encoder, error) {\n\tif byteLen < 1 || 8 < byteLen {\n\t\treturn nil, fmt.Errorf(\"invalid byte length: %d\", byteLen)\n\t}\n\n\treturn &Encoder{l: byteLen}, nil\n}", "title": "" }, { "docid": "7079f8ca792c910558ce9f3a101a5462", "score": "0.50655544", "text": "func (enc *Encoder) Encode(v interface{}) error {}", "title": "" }, { "docid": "3c68c4a6483300fb0785bd4cc11fd6f6", "score": "0.5064684", "text": "func NewEmptyTransformer() Transformer {\n\treturn &emptyTransformer{}\n}", "title": "" }, { "docid": "2350214c735fc7eb639526a9631178f0", "score": "0.5063244", "text": "func (t *EncoderType) Get() interface{} { return *t }", "title": "" }, { "docid": "187265c42480c3cfb307773b200664de", "score": "0.50588614", "text": "func BorrowEncoder(w io.Writer) *Encoder {\n\tenc := encPool.Get().(*Encoder)\n\tenc.w = w\n\tenc.buf = enc.buf[:0]\n\tenc.isPooled = 0\n\tenc.err = nil\n\tenc.hasKeys = false\n\tenc.keys = nil\n\treturn enc\n}", "title": "" }, { "docid": "22a63d0a92937a5fc41905cd4430c240", "score": "0.50584584", "text": "func (e *Encoder) Clone() zapcore.Encoder {\n\tencoder := e.enc.Clone()\n\treturn &Encoder{encoder}\n}", "title": "" }, { "docid": "2c4c89fba898e0c92c42838d747d9cc0", "score": "0.5051456", "text": "func MakeDefaultCodec() *codec.Codec {\n\tvar cdc = codec.New()\n\n\t// cosmos-sdk using interface to register all the modules codec.\n\tModuleBasics.RegisterCodec(cdc)\n\tbank.RegisterCodec(cdc)\n\tnameservice.RegisterCodec(cdc)\n\tsdkTypes.RegisterCodec(cdc)\n\tkyc.RegisterCodec(cdc)\n\tcodec.RegisterCrypto(cdc)\n\tfungible.RegisterCodec(cdc)\n\tnonFungible.RegisterCodec(cdc)\n\tfee.RegisterCodec(cdc)\n\tmaintenance.RegisterCodec(cdc)\n\tauth.RegisterCodec(cdc)\n\treturn cdc\n}", "title": "" }, { "docid": "4e8fe98bbed64766642ab3aaa3738a3c", "score": "0.5051161", "text": "func New() *Decoder { return &Decoder{} }", "title": "" }, { "docid": "6909283ce20ea912b24e4082d77b51da", "score": "0.50257385", "text": "func testEncoder(t *testing.T, v interface{}, err error, expected []byte) {\n\t// buffer is where we write the CBOR encoded values\n\tvar buffer = bytes.Buffer{}\n\t// create a new encoder writing to buffer, and encode v with it\n\tvar e = NewEncoder(&buffer).Encode(v)\n\n\tif e != err {\n\t\tt.Fatalf(\"err: %#v != %#v with %#v\", e, err, v)\n\t}\n\n\tif !bytes.Equal(buffer.Bytes(), expected) {\n\t\tt.Fatalf(\n\t\t\t\"(%#v) %#v != %#v\", v, buffer.Bytes(), expected,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "81db5b3de7c04eb5028faff5c642c7cb", "score": "0.5022097", "text": "func NewEncoder() *EncoderJSON {\n\treturn &EncoderJSON{\n\t\tMaxBodySize: 2097152, // 2MB\n\t\tIndented: false,\n\t\tAcceptHeader: \"application/json\",\n\t\tContentTypeHeader: \"application/json;charset=utf-8\",\n\t}\n}", "title": "" } ]
ce44e234011513468f2cf5626e08cf5f
Init populates metadata struct with values from the buffer
[ { "docid": "132106cfdc43b3cd5f1cddef96d45fe4", "score": "0.74086654", "text": "func (metadata *Metadata) Init(buffer *bytes.Buffer) error {\n\tif err := json.NewDecoder(buffer).Decode(&metadata); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "369c7a3e800f5dbc46711046eaf0289c", "score": "0.6446612", "text": "func (b *Buffer) Init(buf []byte) {\n b.buf = buf\n b.off = 0\n b.layer_off = 0\n}", "title": "" }, { "docid": "58236420c8217c7415b308d93bc1132d", "score": "0.5935042", "text": "func (mm *metricMetadata) initialize(fields field.Metas, fieldMaxID int32, tagKeys tag.Metas) {\n\tmm.fields = fields\n\tmm.tagKeys = tagKeys\n\tmm.fieldIDSeq.Store(fieldMaxID)\n}", "title": "" }, { "docid": "3d55bc43a29e3cdbc554cc6fa7e75511", "score": "0.5697314", "text": "func (f *packedFileReader) init() error { return f.v.init() }", "title": "" }, { "docid": "49e69de14b227ddcce5b6fc42a108800", "score": "0.56805116", "text": "func (b *BigData) Init(config []byte) error {\n\n\treturn nil\n}", "title": "" }, { "docid": "631046e6cf89e15580b43029916b9b80", "score": "0.56609505", "text": "func (this *node) init(tree *BTree) {\n\tthis.size = int(tree.header.KeySize) + /*size of offset*/ 4\n\tthis.offset = -1\n\tthis.count = 0\n\tthis.raw = make([]byte, tree.header.bufferSize(), tree.header.bufferSize()+uint32(this.size))\n\tthis.datas = this.raw[8:]\n\tcopy(this.raw[0:4], []byte{0xff, 0xff, 0xff, 0xff})\n}", "title": "" }, { "docid": "bd0473f8b9b363e6aaeb0ec7219f3f7a", "score": "0.54629594", "text": "func (target *QueueAttrs) Init(source map[string]interface{}) {\n\tif x := source[\"capacity\"]; x != nil {\n\t\tif y, ok := x.(int); ok {\n\t\t\ttarget.Capacity = &y\n\t\t}\n\t}\n\n\tif x := source[\"closed\"]; x != nil {\n\t\ttarget.Closed = true\n\t}\n\n\tif x := source[\"length\"]; x != nil {\n\t\tif y, ok := x.(int); ok {\n\t\t\ttarget.Length = &y\n\t\t}\n\t}\n\n\tif x := source[\"name\"]; x != nil {\n\t\tif y, ok := x.(string); ok {\n\t\t\ttarget.Name = &y\n\t\t}\n\t}\n\n\tif x := source[\"suspended\"]; x != nil {\n\t\ttarget.Suspended = true\n\t}\n\n\tif x := source[\"upload\"]; x != nil {\n\t\tif y, ok := x.(string); ok {\n\t\t\ttarget.Upload = &y\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1ecb8de68addf4c693cef3a079253310", "score": "0.5447695", "text": "func newMetadata() *metadata {\n\tm := &metadata{\n\t\tdataMu: &sync.Mutex{},\n\n\t\tmsgPerSec: newMessageRate(1*time.Second, 30),\n\t\tmsgPerMin: newMessageRate(1*time.Minute, 15),\n\t\tmsgPerHr: newMessageRate(1*time.Hour, 10),\n\t\tmsgPerDay: newMessageRate(24*time.Hour, 7),\n\t}\n\n\tm.msgPerSec.init()\n\tm.msgPerMin.init()\n\tm.msgPerHr.init()\n\tm.msgPerDay.init()\n\n\treturn m\n}", "title": "" }, { "docid": "8d47a11149a669d370e0dfc5d0cfabbb", "score": "0.5437093", "text": "func (b *propBuf) Init(\n\tp proposer, tracker tracker.Tracker, clock *hlc.Clock, settings *cluster.Settings,\n) {\n\tb.p = p\n\tb.full.L = p.rlocker()\n\tb.clock = clock\n\tb.evalTracker = tracker\n\tb.settings = settings\n\tb.liBase = p.leaseAppliedIndex()\n}", "title": "" }, { "docid": "5f1848094eb2e7a1e761e916be37dbf2", "score": "0.53441286", "text": "func NewMetadata(key string, data []byte) Metadata {\n\treturn Metadata{\n\t\tPath: key,\n\t\tSize: len(data),\n\t\tTimestamp: time.Now().UTC(),\n\t\tHash: sha1.Sum(data),\n\t}\n}", "title": "" }, { "docid": "fccbda85bb3082adbd50c88de3e4851b", "score": "0.53148437", "text": "func (c *CRDT) Init(metadata state.Metadata) error {\n\tm, err := c.parseMetadata(metadata)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.metadata = m\n\tgo c.startServer()\n\treturn nil\n}", "title": "" }, { "docid": "625f3c1775a369c50055aeb21e84623a", "score": "0.52658725", "text": "func (m *masterParser) Init(data, origin string, ttl uint32) {\n\tm.zone = NewZoneFile(\"(data)\", \"\")\n\tm.lineno = 1\n\tm.origin = strings.ToLower(origin)\n\tm.ttl = ttl\n\tif m.reader == nil {\n\t\tm.reader = new(libio.Reader)\n\t}\n\tm.reader.Init([]byte(data))\n}", "title": "" }, { "docid": "088dd81554d8df27d81acfdb425bd395", "score": "0.5246775", "text": "func newMetadata(data []byte) (*metadata, error) {\n\treturn &metadata{data: data}, nil\n\t// TODO: Create the data on disk atomically.\n}", "title": "" }, { "docid": "9c7b04218383ee596a9a5c6eceb6e876", "score": "0.5191952", "text": "func InitBuffer() {\n\tblockBuffer = NewLRUCache()\n\tfileNamePos2Int = make(map[nameAndPos]int, InitSize*4)\n\tposNum = 0\n}", "title": "" }, { "docid": "d5b623c03c544ebd02215a761a17143e", "score": "0.5180514", "text": "func (target *TagAttrs) Init(source map[string]interface{}) {\n\tif x := source[\"name\"]; x != nil {\n\t\tif y, ok := x.(string); ok {\n\t\t\ttarget.Name = &y\n\t\t}\n\t}\n\n\tif x := source[\"parent_id\"]; x != nil {\n\t\tif y, ok := x.(string); ok {\n\t\t\ttarget.ParentId = &y\n\t\t}\n\t}\n\n\tif x := source[\"theme\"]; x != nil {\n\t\tif y, ok := x.(map[string]interface{}); ok {\n\t\t\ttarget.Theme = NewTagThemeAttr(y)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5ce03fdd8655e12a9aff57bc50739128", "score": "0.51781577", "text": "func (b *Base) Init(r io.ReadCloser, readNext BaseReadNext) {\n\tb.Reader = bufio.NewReader(r)\n\tb.raw = r\n\tb.rn = readNext\n}", "title": "" }, { "docid": "21bd9aa6fbab6adf61186bea7e22b6b1", "score": "0.51622593", "text": "func (f *FieldInfos) init() error {\n\tf.addField(\"\", false)\n\treturn nil\n}", "title": "" }, { "docid": "713861dc174f83d627e41ed9d192bc13", "score": "0.51510584", "text": "func (target *ChannelAttrs) Init(source map[string]interface{}) {\n\tif x := source[\"autohide\"]; x != nil {\n\t\ttarget.Autohide = true\n\t}\n\n\tif x := source[\"autosilence\"]; x != nil {\n\t\ttarget.Autosilence = true\n\t}\n\n\tif x := source[\"blacklisted_message_types\"]; x != nil {\n\t\tif y, ok := x.([]interface{}); ok {\n\t\t\ttarget.BlacklistedMessageTypes = AppendStrings(nil, y)\n\t\t}\n\t}\n\n\tif x := source[\"closed\"]; x != nil {\n\t\ttarget.Closed = true\n\t}\n\n\tif x := source[\"disclosed_since\"]; x != nil {\n\t\tif y, ok := x.(int); ok {\n\t\t\ttarget.DisclosedSince = &y\n\t\t}\n\t}\n\n\tif x := source[\"followable\"]; x != nil {\n\t\ttarget.Followable = true\n\t}\n\n\tif x := source[\"name\"]; x != nil {\n\t\tif y, ok := x.(string); ok {\n\t\t\ttarget.Name = &y\n\t\t}\n\t}\n\n\tif x := source[\"owner_id\"]; x != nil {\n\t\tif y, ok := x.(string); ok {\n\t\t\ttarget.OwnerId = &y\n\t\t}\n\t}\n\n\tif x := source[\"private\"]; x != nil {\n\t\ttarget.Private = true\n\t}\n\n\tif x := source[\"public\"]; x != nil {\n\t\ttarget.Public = true\n\t}\n\n\tif x := source[\"ratelimit\"]; x != nil {\n\t\tif y, ok := x.(string); ok {\n\t\t\ttarget.Ratelimit = &y\n\t\t}\n\t}\n\n\tif x := source[\"suspended\"]; x != nil {\n\t\ttarget.Suspended = true\n\t}\n\n\tif x := source[\"topic\"]; x != nil {\n\t\tif y, ok := x.(string); ok {\n\t\t\ttarget.Topic = &y\n\t\t}\n\t}\n\n\tif x := source[\"upload\"]; x != nil {\n\t\tif y, ok := x.(string); ok {\n\t\t\ttarget.Upload = &y\n\t\t}\n\t}\n\n\tif x := source[\"verified_join\"]; x != nil {\n\t\ttarget.VerifiedJoin = true\n\t}\n}", "title": "" }, { "docid": "08394150a7a36ec067a2c80b8c97b3b2", "score": "0.51455855", "text": "func createMeta(buff *bytes.Buffer, start bool, id string, from, length uint64) {\n\taddedBytes := 1\n\n\tif start {\n\t\tbuff.WriteByte(0)\n\t} else {\n\t\tbuff.WriteByte(1)\n\t}\n\n\taddedBytes += len(id)\n\tbuff.WriteString(id)\n\n\taddedBytes += 8\n\tfromBytes := make([]byte, 4)\n\tfromBytes[0] = byte(from % 255)\n\tfrom /= 255\n\tfromBytes[1] = byte(from % 255)\n\tfrom /= 255\n\tfromBytes[2] = byte(from % 255)\n\tfrom /= 255\n\tfromBytes[3] = byte(from % 255)\n\tbuff.Write(fromBytes)\n\n\tlengthBytes := make([]byte, 4)\n\tlengthBytes[0] = byte(length % 255)\n\tlength /= 255\n\tlengthBytes[1] = byte(length % 255)\n\tlength /= 255\n\tlengthBytes[2] = byte(length % 255)\n\tlength /= 255\n\tlengthBytes[3] = byte(length % 255)\n\tbuff.Write(lengthBytes)\n}", "title": "" }, { "docid": "5a84d82ca23f67a6661fe3093c36d9fc", "score": "0.51368153", "text": "func (target *DialogueMemberAttrs) Init(source map[string]interface{}) {\n\tif x := source[\"audience_ended\"]; x != nil {\n\t\ttarget.AudienceEnded = true\n\t}\n\n\tif x := source[\"queue_id\"]; x != nil {\n\t\tif y, ok := x.(string); ok {\n\t\t\ttarget.QueueId = &y\n\t\t}\n\t}\n\n\tif x := source[\"rating\"]; x != nil {\n\t\tif y, ok := x.(int); ok {\n\t\t\ttarget.Rating = &y\n\t\t}\n\t}\n\n\tif x := source[\"writing\"]; x != nil {\n\t\ttarget.Writing = true\n\t}\n}", "title": "" }, { "docid": "2d3c5e6bf9f0315e4ba017b76f5a8da2", "score": "0.51240534", "text": "func (s *Store) Init(metadataRaw secretstores.Metadata) error {\n\tmetadata, err := s.parseSecretManagerMetadata(metadataRaw)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclient, err := s.getClient(metadata)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to setup secretmanager client: %s\", err)\n\t}\n\n\ts.client = client\n\ts.ProjectID = metadata.ProjectID\n\n\treturn nil\n}", "title": "" }, { "docid": "66e75f57838766912a881620337edb65", "score": "0.51041925", "text": "func (target *ChannelMemberAttrs) Init(source map[string]interface{}) {\n\tif x := source[\"autohide\"]; x != nil {\n\t\ttarget.Autohide = true\n\t}\n\n\tif x := source[\"moderator\"]; x != nil {\n\t\ttarget.Moderator = true\n\t}\n\n\tif x := source[\"operator\"]; x != nil {\n\t\ttarget.Operator = true\n\t}\n\n\tif x := source[\"silenced\"]; x != nil {\n\t\ttarget.Silenced = true\n\t}\n\n\tif x := source[\"since\"]; x != nil {\n\t\tif y, ok := x.(int); ok {\n\t\t\ttarget.Since = &y\n\t\t}\n\t}\n\n\tif x := source[\"writing\"]; x != nil {\n\t\ttarget.Writing = true\n\t}\n}", "title": "" }, { "docid": "c45a09812ef2f634805fccde12a86811", "score": "0.50799084", "text": "func (b *buf) initPkt(t packetType) {\n\tb.pb.Reset()\n\tb.h.token, b.h.status = t, 0\n\tb.h.write(&b.he)\n}", "title": "" }, { "docid": "544ba5a5f75683ecf2633522f4166df3", "score": "0.50733864", "text": "func initMetadata(m *metadata, values url.Values) {\n\tfor name, values := range values {\n\t\tif matches := serverKeyRe.MatchString(name); matches {\n\t\t\tcontinue // We MUST skip variables reserved to the server\n\t\t}\n\t\t*m = append(*m, meta.NameValue{Name: name, Value: values[0]})\n\t}\n}", "title": "" }, { "docid": "a852b1a598a0d7dadc18cb73879281fb", "score": "0.5070795", "text": "func (r *ReleaseManifest) init() {\n\tif r.AppMetadata == nil {\n\t\tr.AppMetadata = map[string]*AppMetadata{}\n\t}\n}", "title": "" }, { "docid": "76372ee0dba2b472d081f27f01e45fbb", "score": "0.50634587", "text": "func (d *TimeDecoder) Init(b []byte) {\n\td.v = 0\n\td.i = 0\n\td.ts = d.ts[:0]\n\td.err = nil\n\tif len(b) > 0 {\n\t\t// Encoding type is stored in the 4 high bits of the first byte\n\t\td.encoding = b[0] >> 4\n\t}\n\td.decode(b)\n}", "title": "" }, { "docid": "ad13e36d508857fc976dcf6eae37e74d", "score": "0.5041052", "text": "func (m *Message) Init() {\n\tm.CreatedAt = time.Now()\n\tm.UpdatedAt = time.Now()\n}", "title": "" }, { "docid": "bfc788ff85282c10d725ff2cb574aa5c", "score": "0.5037676", "text": "func (target *QueueMemberAttrs) Init(source map[string]interface{}) {\n}", "title": "" }, { "docid": "9e6d03fa22c14f55b36c5252401de77e", "score": "0.503553", "text": "func InitMetaData(rootDir string) (*MetaData, error) {\n\tvar metaData *MetaData\n\tmetaFile := filepath.Join(rootDir, \"support\", constants.RuntimeMetaFile)\n\tif fileutils.FileExists(metaFile) {\n\t\tcontents, err := fileutils.ReadFile(metaFile)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmetaData, err = ParseMetaData(contents)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tmetaData = &MetaData{}\n\t}\n\n\tif metaData.Env == nil {\n\t\tmetaData.Env = map[string]string{}\n\t}\n\n\tif metaData.PathListEnv == nil {\n\t\tmetaData.PathListEnv = map[string]string{}\n\t}\n\n\tvar relInstallDir string\n\tinstallDirs := strings.Split(constants.RuntimeInstallDirs, \",\")\n\tfor _, dir := range installDirs {\n\t\tif fileutils.DirExists(filepath.Join(rootDir, dir)) {\n\t\t\trelInstallDir = dir\n\t\t}\n\t}\n\n\tif relInstallDir == \"\" {\n\t\tlogging.Debug(\"Did not find an installation directory relative to metadata file.\")\n\t}\n\n\tmetaData.InstallDir = relInstallDir\n\terr := metaData.Prepare(filepath.Join(rootDir, relInstallDir))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn metaData, nil\n}", "title": "" }, { "docid": "0680d96019bab04d43fb085a996077d9", "score": "0.5011409", "text": "func (target *IdentityAttrs) Init(source map[string]interface{}) {\n\tif x := source[\"auth\"]; x != nil {\n\t\ttarget.Auth = true\n\t}\n\n\tif x := source[\"blocked\"]; x != nil {\n\t\ttarget.Blocked = true\n\t}\n\n\tif x := source[\"pending\"]; x != nil {\n\t\ttarget.Pending = true\n\t}\n\n\tif x := source[\"protected\"]; x != nil {\n\t\ttarget.Protected = true\n\t}\n\n\tif x := source[\"public\"]; x != nil {\n\t\ttarget.Public = true\n\t}\n\n\tif x := source[\"rejected\"]; x != nil {\n\t\ttarget.Rejected = true\n\t}\n}", "title": "" }, { "docid": "d198c0e2f34215d69cb7a82ae8381778", "score": "0.4989205", "text": "func (s ConnectResponse) NewMetadata(n int32) (Metadata_List, error) {\n\tl, err := NewMetadata_List(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn Metadata_List{}, err\n\t}\n\terr = s.Struct.SetPtr(1, l.List.ToPtr())\n\treturn l, err\n}", "title": "" }, { "docid": "01efcfc6bd24b43122d141f16e3bbbf3", "score": "0.4984709", "text": "func FromMetadataInfo(pbMetadata *api.Metadata) types.MetadataInfo {\n\treturn types.MetadataInfo{\n\t\tClock: pbMetadata.Clock,\n\t\tData: pbMetadata.Data,\n\t}\n}", "title": "" }, { "docid": "e015a08e2a7dfa10cd8b3c5e4d86dd1c", "score": "0.49709362", "text": "func init() {\n\tmd := activity.NewMetadata(jsonMetadata)\n\tactivity.Register(NewActivity(md))\n}", "title": "" }, { "docid": "e015a08e2a7dfa10cd8b3c5e4d86dd1c", "score": "0.49709362", "text": "func init() {\n\tmd := activity.NewMetadata(jsonMetadata)\n\tactivity.Register(NewActivity(md))\n}", "title": "" }, { "docid": "e015a08e2a7dfa10cd8b3c5e4d86dd1c", "score": "0.49709362", "text": "func init() {\n\tmd := activity.NewMetadata(jsonMetadata)\n\tactivity.Register(NewActivity(md))\n}", "title": "" }, { "docid": "876f634ebb1c750141937120d1da0bde", "score": "0.4965589", "text": "func NewMetadata(\n\treader io.Reader,\n\tpath string,\n\text string,\n\tformat Format,\n\tencodingFormat Format,\n\twidth int,\n\theight int,\n\tversion string,\n) (Metadata, error) {\n\tvar created time.Time\n\tvar lat, lon float64\n\tx, err := exif.Decode(reader)\n\tif err == nil {\n\t\t// time taken\n\t\tcreatedTmp, err := x.DateTime()\n\t\tif err == nil {\n\t\t\tcreated = createdTmp\n\t\t}\n\t\t// coords taken\n\t\tlatTmp, lonTmp, err := x.LatLong()\n\t\tif err == nil {\n\t\t\tlat, lon = latTmp, lonTmp\n\t\t}\n\t}\n\treturn Metadata{\n\t\tVersion: version,\n\t\tCreated: created,\n\t\tAdded: time.Now(),\n\t\tName: strings.TrimSuffix(filepath.Base(path), ext),\n\t\tExt: ext,\n\t\tOriginalFormat: string(format),\n\t\tEncodingFormat: string(encodingFormat),\n\t\tWidth: width,\n\t\tHeight: height,\n\t\tLatitude: lat,\n\t\tLongitude: lon,\n\t}, nil\n}", "title": "" }, { "docid": "0ef895d48fcb7a7276d9fbeebe659370", "score": "0.4952293", "text": "func (m *Memstore) Init(kinds []string) error {\n\treturn nil\n}", "title": "" }, { "docid": "10afd6c85ad5c3ee07d266e0a78d35e4", "score": "0.49449408", "text": "func (b *Binding) Init(metadata bindings.Metadata) error {\n\tcfg, err := metadataToConfig(metadata.Properties, b.logger)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to parse metadata properties\")\n\t}\n\tb.config = cfg\n\n\tses, err := r.Connect(b.config.ConnectOpts)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error connecting to the database\")\n\t}\n\tb.session = ses\n\n\treturn nil\n}", "title": "" }, { "docid": "0c03faea867255e3d81ed41b8ea1ad70", "score": "0.49318174", "text": "func init() {\n\tentryFields := schema.Entry{}.Fields()\n\t_ = entryFields\n\t// entryDescContent is the schema descriptor for content field.\n\tentryDescContent := entryFields[0].Descriptor()\n\t// entry.DefaultContent holds the default value on creation for the content field.\n\tentry.DefaultContent = entryDescContent.Default.(string)\n\t// entryDescCreatedAt is the schema descriptor for created_at field.\n\tentryDescCreatedAt := entryFields[1].Descriptor()\n\t// entry.DefaultCreatedAt holds the default value on creation for the created_at field.\n\tentry.DefaultCreatedAt = entryDescCreatedAt.Default.(func() time.Time)\n}", "title": "" }, { "docid": "209454f3385a74c80ec98bd89b9c65f8", "score": "0.49215665", "text": "func newMetaFile(r io.Reader) (metaFile, error) {\n\tm := metaFile{}\n\tr = io.LimitReader(r, 16*1024)\n\tb, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn m, err\n\t}\n\tlines := bytes.Split(b, []byte(\"\\r\\n\"))\n\tfor i, line := range lines {\n\t\tif len(line) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tlineno := i + 1\n\t\tparts := bytes.SplitN(line, []byte(\":\"), 2)\n\t\tif len(parts) != 2 {\n\t\t\treturn m, fmt.Errorf(\"line %d: expecting key:value not %q\", lineno, string(line))\n\t\t}\n\t\tkey := string(parts[0])\n\t\tval := string(parts[1])\n\t\tswitch key {\n\t\tcase \"lastModifiedDate\":\n\t\t\tt, err := time.Parse(time.RFC3339, val)\n\t\t\tif err != nil {\n\t\t\t\treturn m, fmt.Errorf(\"line %d: expecting lastModifiedDate={RFC3339} not %q\", lineno, string(line))\n\t\t\t}\n\t\t\tm.LastModifiedDate = t\n\t\tcase \"size\":\n\t\t\tv, err := strconv.Atoi(val)\n\t\t\tif err != nil {\n\t\t\t\treturn m, fmt.Errorf(\"line %d: expecting size={int} not %q\", lineno, string(line))\n\t\t\t}\n\t\t\tm.Size = v\n\t\tcase \"zipSize\":\n\t\t\tv, err := strconv.Atoi(val)\n\t\t\tif err != nil {\n\t\t\t\treturn m, fmt.Errorf(\"line %d: expecting zipSize={int} not %q\", lineno, string(line))\n\t\t\t}\n\t\t\tm.ZipSize = v\n\t\tcase \"gzSize\":\n\t\t\tv, err := strconv.Atoi(val)\n\t\t\tif err != nil {\n\t\t\t\treturn m, fmt.Errorf(\"line %d: expecting gzSize={int} not %q\", lineno, string(line))\n\t\t\t}\n\t\t\tm.GzSize = v\n\t\tcase \"sha256\":\n\t\t\tm.SHA256 = strings.ToUpper(val)\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "0c341ede6c75eec82565722f5431e42f", "score": "0.49107245", "text": "func (e *UserCreatedEvent) Init(data *eventstore.EventData) {\n\te.EventNumber = data.EventNumber\n\te.StreamID = data.StreamID\n\te.Timestamp = data.Timestamp\n\n\tvar eventData userCreatedEventData\n\terr := json.Unmarshal([]byte(data.Data), &eventData)\n\tif err != nil {\n\t\tfmt.Printf(\"Error parsing eventstore data: %v\", err)\n\t}\n\te.Name = eventData.Name\n\te.Age = eventData.Age\n}", "title": "" }, { "docid": "ad7c5434c5c09ceafbe820f217173ffa", "score": "0.48989382", "text": "func (s ConnectRequest) NewMetadata(n int32) (Metadata_List, error) {\n\tl, err := NewMetadata_List(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn Metadata_List{}, err\n\t}\n\terr = s.Struct.SetPtr(1, l.List.ToPtr())\n\treturn l, err\n}", "title": "" }, { "docid": "49fd23daedbfe0ccfad248be5228c6fd", "score": "0.48982114", "text": "func (af *AdaptationField) Initialize(pos int64, options options.Options) {\n\taf.pcr = 0\n\taf.pos = pos\n\taf.options = options\n\taf.buf = af.buf[0:0]\n\n\taf.adaptationFieldLength = 0\n\taf.discontinuityIndicator = 0\n\taf.randomAccessIndicator = 0\n\taf.elementaryStreamPriorityIndicator = 0\n\taf.pcrFlag = 0\n\taf.oPcrFlag = 0\n\taf.splicingPointFlag = 0\n\taf.transportPrivateDataFlag = 0\n\taf.adaptationFieldExtensionFlag = 0\n\taf.programClockReferenceBase = 0\n\taf.programClockReferenceExtension = 0\n\taf.originalProgramClockReferenceBase = 0\n\taf.originalProgramClockReferenceExtension = 0\n\taf.spliceCountdown = 0\n\taf.transportPrivateDataLength = 0\n\taf.privateDataByte = af.privateDataByte[0:0]\n\taf.adaptationFieldExtensionLength = 0\n\taf.ltwFlag = 0\n\taf.piecewiseRateFlag = 0\n\taf.seamlessSpliceFlag = 0\n\taf.ltwValidFlag = 0\n\taf.ltwOffset = 0\n\taf.piecewiseRate = 0\n\taf.spliceType = 0\n\taf.dtsNextAu = 0\n}", "title": "" }, { "docid": "02e2fa0a5e4b03456306327d02be01b0", "score": "0.487894", "text": "func (rc *ReadCloser) init(r *tar.Reader) error {\n\tdefer rc.Close()\n\n\trc.File = make([]*tar.Header, 0, 10)\n\tfor {\n\t\th, err := r.Next()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\trc.File = append(rc.File, h)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bcebcb90f779480b6d346f3a968d5acc", "score": "0.48655573", "text": "func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) {\n\tp.init(typ, name, tag, f, true)\n}", "title": "" }, { "docid": "153f6fc2d0c1079cd8e6b1311e111b9c", "score": "0.48509154", "text": "func (t *twitterInput) Init(metadata bindings.Metadata) error {\n\treturn t.parseMetadata(metadata)\n}", "title": "" }, { "docid": "0c3b32ba0d7c93d48945fdca47f36762", "score": "0.48503655", "text": "func (_this *RootBuilder) Init(session *Session, dstType reflect.Type, opts *options.BuilderOptions) {\n\t_this.dstType = dstType\n\t_this.context = context(opts,\n\t\tsession.opts.CustomBinaryBuildFunction,\n\t\tsession.opts.CustomTextBuildFunction,\n\t\t_this.referenceFiller.NotifyMarker,\n\t\t_this.referenceFiller.NotifyReference,\n\t\tsession.GetBuilderGeneratorForType)\n\t_this.object = reflect.New(dstType).Elem()\n\t_this.chunkedData = make([]byte, 0, 128)\n\n\tgenerator := session.GetBuilderGeneratorForType(dstType)\n\t_this.context.StackBuilder(newTopLevelBuilder(_this, generator))\n\t_this.referenceFiller.Init()\n}", "title": "" }, { "docid": "48295d92a0e6fb9bb03ad2b2aad790de", "score": "0.4843311", "text": "func (s *StatFHelper) Init(comm *Communicator, node string) {\r\n\ts.node = node\r\n\ts.lStatInfo = list.New()\r\n\ts.lStatInfoFromServer = list.New()\r\n\ts.mlock = new(sync.Mutex)\r\n\ts.mStatInfo = make(map[statf.StatMicMsgHead]statf.StatMicMsgBody)\r\n\ts.mStatCount = make(map[statf.StatMicMsgHead]int)\r\n\ts.comm = comm\r\n\ts.sf = new(statf.StatF)\r\n\ts.comm.StringToProxy(s.node, s.sf)\r\n}", "title": "" }, { "docid": "faa1df9476dc31f51d2445f23e321867", "score": "0.48322544", "text": "func NewMetadata(src tag.Metadata, picture string, hash string, path string) Metadata {\n\tvar dest Metadata\n\n\tdest.Format = string(src.Format())\n\tdest.FileType = string(src.FileType())\n\tdest.Title = src.Title()\n\tdest.Album = src.Album()\n\tdest.Artist = src.Artist()\n\tdest.AlbumArtist = src.AlbumArtist()\n\tdest.Composer = src.Composer()\n\tdest.Genre = src.Genre()\n\tdest.Year = src.Year()\n\n\tdest.Track, dest.TotalTracks = src.Track()\n\tdest.Disc, dest.TotalDisks = src.Disc()\n\n\tdest.Comment = src.Comment()\n\n\tdest.Picture = picture\n\tdest.Hash = hash\n\tdest.Path = path\n\n\treturn dest\n}", "title": "" }, { "docid": "72e7a9a795386e51e5bedd5064a15ec9", "score": "0.48251548", "text": "func (target *RealmAttrs) Init(source map[string]interface{}) {\n\tif x := source[\"name\"]; x != nil {\n\t\tif y, ok := x.(string); ok {\n\t\t\ttarget.Name = &y\n\t\t}\n\t}\n\n\tif x := source[\"owner_account\"]; x != nil {\n\t\tif y, ok := x.(map[string]interface{}); ok {\n\t\t\ttarget.OwnerAccount = NewRealmOwnerAccountAttr(y)\n\t\t}\n\t}\n\n\tif x := source[\"owner_id\"]; x != nil {\n\t\tif y, ok := x.(string); ok {\n\t\t\ttarget.OwnerId = &y\n\t\t}\n\t}\n\n\tif x := source[\"suspended\"]; x != nil {\n\t\ttarget.Suspended = true\n\t}\n\n\tif x := source[\"theme\"]; x != nil {\n\t\tif y, ok := x.(map[string]interface{}); ok {\n\t\t\ttarget.Theme = NewRealmThemeAttr(y)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cf003b2e660076052be16b4165be9e05", "score": "0.4824898", "text": "func (o *Object) setMetadata(info os.FileInfo) {\n\to.modTime = info.ModTime()\n\to.size = info.Size()\n\to.mode = info.Mode()\n}", "title": "" }, { "docid": "17a779926b6dde994e1cc7baedb2299f", "score": "0.48229578", "text": "func (iom *IOMetric0) Init() {\n\tif iom.LatencyNsHist == nil {\n\t\tiom.LatencyNsHist = make([]uint64, IOMetric0NumLatencyHistBuckets)\n\t}\n\tif iom.LatencyNsMaxHist == nil {\n\t\tiom.LatencyNsMaxHist = make([]uint64, IOMetric0NumMaxLatencyHistBuckets)\n\t}\n\tif iom.SizeBytesHist == nil {\n\t\tiom.SizeBytesHist = make([]uint64, IOMetric0NumSizeHistBuckets)\n\t}\n}", "title": "" }, { "docid": "b64bd98dff9a3ecf47b9cdca22c4ed5d", "score": "0.4811062", "text": "func init() {\n\ttSequence = 0\n\tdata = make(map[int64]*Topic)\n\tdescSorted = []*Topic{}\n\n}", "title": "" }, { "docid": "39ffab2c52d69df139e2f592627a33cb", "score": "0.4801694", "text": "func MetadataFromBytes(b []byte) (*Metadata, error) {\n\tpbd := new(pb.Data)\n\terr := proto.Unmarshal(b, pbd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif pbd.GetType() != pb.Data_Metadata {\n\t\treturn nil, errors.New(\"incorrect node type\")\n\t}\n\n\tpbm := new(pb.Metadata)\n\terr = proto.Unmarshal(pbd.Data, pbm)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmd := new(Metadata)\n\tmd.MimeType = pbm.GetMimeType()\n\treturn md, nil\n}", "title": "" }, { "docid": "642c76c271ab896f1b3922cdcdd310e5", "score": "0.479341", "text": "func (ps *privateStorage) init() {\n\tps.datumCtx = tree.MakeFmtCtx(&ps.keyBuf.Buffer, tree.FmtSimple)\n\tps.privatesMap = make(map[privateKey]PrivateID)\n\tps.privates = make([]interface{}, 1)\n}", "title": "" }, { "docid": "b679eb57cc5efb657023a605c12af910", "score": "0.4781889", "text": "func (*InitializeResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "6fcf11f26dd7d9ca0ef11e7c9d8c4174", "score": "0.4776816", "text": "func New(mimetype string, data []byte) *Object {\n\tsum := md5.New()\n\tsum.Write(data)\n\toid := objectid.New(sum)\n\n\tmd := metadata.New(int64(len(data)), mimetype, oid)\n\treturn &Object{\n\t\tMetadata: *md,\n\t\tData: data,\n\t}\n}", "title": "" }, { "docid": "2b5950d00a627c42e137e4e107699d49", "score": "0.47737184", "text": "func New() *metadata {\n\tmd := make(metadata)\n\n\treturn &md\n}", "title": "" }, { "docid": "2715b0ca280fcce28f53b2dafbd8ecad", "score": "0.47663125", "text": "func (b *BufferStack) Init() {\n\tfields := strings.Fields(config.General.Initial_Command)\n\tif len(fields) > 0 {\n\t\taccept := b.handleCommand(fields[0], fields[1:])\n\t\tif !accept {\n\t\t\tinvalidCommand(fields[0])\n\t\t}\n\t\tif len(b.buffers) == 0 {\n\t\t\tb.Push(NewSearchBuffer(\"\", STMessages))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "783a0d407de37727eb1752238501bd46", "score": "0.47628826", "text": "func (t *Tag) TagInit(typeKey string) {\n\tif t.TagType == \"\" {\n\t\tt.TagType = typeKey\n\t}\n\n\t// Set the full ID (but only if it not )\n\tif t.TagID == \"\" {\n\t\tt.TagID = NewID().String()\n\t}\n}", "title": "" }, { "docid": "b5bc315561b314553dde1d182f1ee8ab", "score": "0.47586593", "text": "func (meta *NativeMetadataResponse) Build(b *fb.Builder) fb.UOffsetT {\n\tinputOffsets := make([]fb.UOffsetT, len(meta.Inputs))\n\tfor i := 0; i < len(meta.Inputs); i++ {\n\t\tio := meta.Inputs[i]\n\t\tgraphpipefb.IOMetadataStartShapeVector(b, len(io.Shape))\n\t\tfor j := len(io.Shape) - 1; j >= 0; j-- {\n\t\t\tb.PrependInt64(io.Shape[j])\n\t\t}\n\t\tendShape := b.EndVector(len(io.Shape))\n\t\tname := b.CreateString(io.Name)\n\t\tdesc := b.CreateString(io.Description)\n\t\tgraphpipefb.IOMetadataStart(b)\n\t\tgraphpipefb.IOMetadataAddShape(b, endShape)\n\t\tgraphpipefb.IOMetadataAddName(b, name)\n\t\tgraphpipefb.IOMetadataAddType(b, io.Type)\n\t\tgraphpipefb.IOMetadataAddDescription(b, desc)\n\t\tinputOffsets[i] = graphpipefb.IOMetadataEnd(b)\n\t}\n\toutputOffsets := make([]fb.UOffsetT, len(meta.Outputs))\n\n\tfor i := 0; i < len(meta.Outputs); i++ {\n\t\tio := meta.Outputs[i]\n\t\tgraphpipefb.IOMetadataStartShapeVector(b, len(io.Shape))\n\t\tfor j := len(io.Shape) - 1; j >= 0; j-- {\n\t\t\tb.PrependInt64(io.Shape[j])\n\t\t}\n\t\tendShape := b.EndVector(len(io.Shape))\n\t\tname := b.CreateString(io.Name)\n\t\tdesc := b.CreateString(io.Description)\n\t\tgraphpipefb.IOMetadataStart(b)\n\t\tgraphpipefb.IOMetadataAddShape(b, endShape)\n\t\tgraphpipefb.IOMetadataAddName(b, name)\n\t\tgraphpipefb.IOMetadataAddType(b, io.Type)\n\t\tgraphpipefb.IOMetadataAddDescription(b, desc)\n\t\toutputOffsets[i] = graphpipefb.IOMetadataEnd(b)\n\t}\n\n\tgraphpipefb.MetadataResponseStartInputsVector(b, len(meta.Inputs))\n\tfor i := len(meta.Inputs) - 1; i >= 0; i-- {\n\t\tb.PrependUOffsetT(inputOffsets[i])\n\t}\n\tinputs := b.EndVector(len(meta.Inputs))\n\n\tgraphpipefb.MetadataResponseStartOutputsVector(b, len(meta.Outputs))\n\tfor i := len(meta.Outputs) - 1; i >= 0; i-- {\n\t\tb.PrependUOffsetT(outputOffsets[i])\n\t}\n\toutputs := b.EndVector(len(meta.Outputs))\n\n\tdesc := b.CreateString(meta.Description)\n\tversion := b.CreateString(meta.Version)\n\tserver := b.CreateString(meta.Server)\n\tname := b.CreateString(meta.Name)\n\tgraphpipefb.MetadataResponseStart(b)\n\tgraphpipefb.MetadataResponseAddDescription(b, desc)\n\tgraphpipefb.MetadataResponseAddVersion(b, version)\n\tgraphpipefb.MetadataResponseAddName(b, name)\n\tgraphpipefb.MetadataResponseAddServer(b, server)\n\tgraphpipefb.MetadataResponseAddInputs(b, inputs)\n\tgraphpipefb.MetadataResponseAddOutputs(b, outputs)\n\treturn graphpipefb.MetadataResponseEnd(b)\n}", "title": "" }, { "docid": "d2b396448524c894b9122e7bac0c5e55", "score": "0.4758566", "text": "func (s *Reader) newMetadataReader(offset int64) (*metadataReader, error) {\n\tvar br metadataReader\n\tbr.s = s\n\tbr.offset = offset\n\terr := br.parseMetadata()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = br.readNextDataBlock()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &br, nil\n}", "title": "" }, { "docid": "650e358e2ae00370ffc461a3ef106d77", "score": "0.4752007", "text": "func (osInfoParser *osInfoParser) Init() error {\n\n\tvar err error\n\n\tif _, err := os.Stat(osReleaseFile); os.IsNotExist(err) {\n\t\treturn errors.Wrapf(err, \"Could not find os-release file %q\", osReleaseFile)\n\t}\n\n\tosInfoParser.reader, err = os.Open(osReleaseFile)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Failed to open os-release file %q\", osReleaseFile)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a781a387f2c575686e397e9ca4cdacd7", "score": "0.47443154", "text": "func (b *PeerDependencyBuilder) Metadata(value interface{}) *PeerDependencyBuilder {\n\tb.metadata = value\n\tb.bitmap_ |= 16\n\treturn b\n}", "title": "" }, { "docid": "b52097fb9fa602d5ffa0500580b76fb3", "score": "0.47378284", "text": "func (e *Entry) ParseMeta(buf []byte) error {\n\te.Meta = NewMetaData().WithCrc(binary.LittleEndian.Uint32(buf[0:4])).\n\t\tWithTimeStamp(binary.LittleEndian.Uint64(buf[4:12])).WithKeySize(binary.LittleEndian.Uint32(buf[12:16])).\n\t\tWithValueSize(binary.LittleEndian.Uint32(buf[16:20])).WithFlag(binary.LittleEndian.Uint16(buf[20:22])).\n\t\tWithTTL(binary.LittleEndian.Uint32(buf[22:26])).WithBucketSize(binary.LittleEndian.Uint32(buf[26:30])).\n\t\tWithStatus(binary.LittleEndian.Uint16(buf[30:32])).WithDs(binary.LittleEndian.Uint16(buf[32:34])).\n\t\tWithTxID(binary.LittleEndian.Uint64(buf[34:42]))\n\treturn nil\n}", "title": "" }, { "docid": "e92aa9e6a7d8a5b39f7d116de4b341a3", "score": "0.47247902", "text": "func (it *replicatedCmdBufSlice) init(buf *replicatedCmdBuf) {\n\t*it = replicatedCmdBufSlice{\n\t\thead: replicatedCmdBufPtr{idx: 0, buf: buf, node: buf.head},\n\t\ttail: replicatedCmdBufPtr{idx: buf.len, buf: buf, node: buf.tail},\n\t}\n}", "title": "" }, { "docid": "7d1f96ccdcdc80833ad571f4fffa9b68", "score": "0.47241923", "text": "func (s *Song) FillMetadata() {\n\ts.Metadata = strings.TrimSpace(s.Metadata)\n\tif !s.HasTrack() {\n\t\treturn\n\t}\n\n\tif s.Title != \"\" && s.Artist != \"\" {\n\t\ts.Metadata = fmt.Sprintf(\"%s - %s\", s.Artist, s.Title)\n\t} else if s.Title != \"\" && s.Metadata == \"\" {\n\t\ts.Metadata = s.Title\n\t}\n}", "title": "" }, { "docid": "cd8012a480a5a36f388f037009b0f2bc", "score": "0.47192562", "text": "func decodeInit(input io.Reader) (version int16, headers []Header, err error) {\n\terr = binary.Read(input, binary.BigEndian, &version)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor {\n\t\tvar header Header\n\t\theader.Key, err = readInt32Slice(input)\n\t\tif err != nil{\n\t\t\tif err == io.EOF { // not really an error\n\t\t\t\terr = nil\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\theader.Value, err = readInt32Slice(input)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\n\t\theaders = append(headers, header)\n\t}\n}", "title": "" }, { "docid": "20fa7e3ee31dc4e43627505bbaf4cef1", "score": "0.47149655", "text": "func InitData(){\n\n /*\n Assuming AdSlot is to be unique across system having\n multiple bid of different ads on it.\n */\n\n AdData = AdDataType{\n AdData:map[int]*AdSlot{\n 10:{10.5,true,\"12345\"},\n 11:{11, true, \"12346\"},\n 12:{12,false,\"12347\"},\n },\n }\n // adding each request in the list to have a unique id for each request.\n AdData.RequestList = make([]BiddingRequest,0)\n}", "title": "" }, { "docid": "a945b3148ee5553a8a72275f8b6d679a", "score": "0.46984997", "text": "func (w *Writer) init() error {\n\tif w.e != nil {\n\t\tpanic(\"w.e expected to be nil\")\n\t}\n\tvar err error\n\tif err = w.Properties.Verify(); err != nil {\n\t\treturn err\n\t}\n\tif !(MinDictCap <= w.DictCap && int64(w.DictCap) <= MaxDictCap) {\n\t\treturn errors.New(\"lzma.Writer: DictCap out of range\")\n\t}\n\tif w.Size < 0 {\n\t\tw.EOSMarker = true\n\t}\n\tif !(maxMatchLen <= w.BufSize) {\n\t\treturn errors.New(\n\t\t\t\"lzma.Writer: lookahead buffer size too small\")\n\t}\n\n\tstate := newState(w.Properties)\n\tdict, err := newEncoderDict(w.DictCap, w.BufSize)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar flags encoderFlags\n\tif w.EOSMarker {\n\t\tflags = eosMarker\n\t}\n\tif w.e, err = newEncoder(w.bw, state, dict, flags); err != nil {\n\t\treturn err\n\t}\n\n\terr = w.writeHeader()\n\treturn err\n}", "title": "" }, { "docid": "b92c380f6087c151e1a2ca5ea038adba", "score": "0.4688774", "text": "func NewStruct(fields []*Var, tags []string) *Struct", "title": "" }, { "docid": "0ad6c0843dee9023f68c7331cd8782d9", "score": "0.46847296", "text": "func (m *Memory) Init() {}", "title": "" }, { "docid": "a1375d96d6ed272ed15eaf583575672d", "score": "0.46840343", "text": "func (*Init) Descriptor() ([]byte, []int) {\n\treturn file_eventpb_eventpb_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "41351b8dcc5745c42828ecf4b28fd048", "score": "0.46779716", "text": "func New(b []byte) Buffer {\n\treturn newInternal(b)\n}", "title": "" }, { "docid": "07c2e54e6e25776ad6a96fc9bce29843", "score": "0.46777385", "text": "func (b *Binding) Init(metadata bindings.Metadata) error {\n\tb.name = metadata.Name\n\ts, f := metadata.Properties[\"schedule\"]\n\tif !f || s == \"\" {\n\t\treturn fmt.Errorf(\"schedule not set\")\n\t}\n\t_, err := b.parser.Parse(s)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"invalid schedule format: %s\", s)\n\t}\n\tb.schedule = s\n\n\tb.resetContext()\n\n\treturn nil\n}", "title": "" }, { "docid": "60fc3b6af22c11c853ba6d3843062f5a", "score": "0.4677505", "text": "func (c *Column) Init(name, tag string) error {\n\t(*c).Name = name\n\n\t// auto-detect foreign key\n\tif len(name) > 2 && name[len(name)-2:] == \"ID\" {\n\t\t(*c).IsForeign = true\n\t\ttbl := strings.ToLower((*c).Name[:len((*c).Name)-2])\n\t\t(*c).ForeignKey = fmt.Sprintf(\"REFERENCES %s(id)\", tbl)\n\t}\n\n\t// parse attributes\n\tattributes := strings.Split(tag, \"&\")\n\tfor _, attr := range attributes {\n\t\tpair := strings.Split(attr, \"=\")\n\t\tif len(pair) != 2 {\n\t\t\treturn fmt.Errorf(\"Malformed tag: '%s'\", attr)\n\t\t}\n\n\t\tswitch strings.ToLower(pair[0]) {\n\t\tcase \"columntype\":\n\t\t\t(*c).Type = pair[1]\n\t\tcase \"primary\":\n\t\t\tif pair[1] == \"true\" {\n\t\t\t\t(*c).IsPrimary = true\n\t\t\t}\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"Unknown attribute: '%s'\", pair[0])\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "555f0ee70dd0cb86e9bad0bf114966b9", "score": "0.46649474", "text": "func (o *Object) setMetaData(info *api.MediaItem) {\n\to.url = info.BaseURL\n\to.id = info.ID\n\to.bytes = -1 // FIXME\n\to.mimeType = info.MimeType\n\to.modTime = info.MediaMetadata.CreationTime\n}", "title": "" }, { "docid": "de4ec3ca3a66ed6181557c5af697f586", "score": "0.46644524", "text": "func (d *dictDecoder) init(r io.Reader) error {\n\tbuf := make([]byte, 1)\n\tif _, err := io.ReadFull(r, buf); err != nil {\n\t\treturn err\n\t}\n\tw := int(buf[0])\n\tif w < 0 || w > 32 {\n\t\treturn errors.Errorf(\"invalid bitwidth %d\", w)\n\t}\n\tif w >= 0 {\n\t\td.keys = newHybridDecoder(w)\n\t\treturn d.keys.init(r)\n\t}\n\n\treturn errors.New(\"bit width zero with non-empty dictionary\")\n}", "title": "" }, { "docid": "e32317dc2489dcda55ba0d45fd64f8c8", "score": "0.46597275", "text": "func (m *metricProcessRuntimeMemstatsBuckHashSys) init() {\n\tm.data.SetName(\"process.runtime.memstats.buck_hash_sys\")\n\tm.data.SetDescription(\"Bytes of memory in profiling bucket hash tables.\")\n\tm.data.SetUnit(\"By\")\n\tm.data.SetEmptySum()\n\tm.data.Sum().SetIsMonotonic(false)\n\tm.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)\n}", "title": "" }, { "docid": "ecfdfdd72cdeb64cf38541bb6e275efc", "score": "0.4658285", "text": "func Init(r reader) IRSDK {\n\tif r == nil {\n\t\tvar err error\n\t\tr, err = shm.Open(fileMapName, fileMapSize)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\n\tsdk := IRSDK{r: r, lastValidData: 0}\n\twinevents.OpenEvent(dataValidEventName)\n\tinitIRSDK(&sdk)\n\treturn sdk\n}", "title": "" }, { "docid": "e489fea6bd826ea5234b63bfe2876707", "score": "0.4639159", "text": "func (rc *ReporterCache) Init() {\r\n\trc.Data = make(map[string]*entity.TrafficRecord)\r\n}", "title": "" }, { "docid": "89050111e62a28e55fcfb745b562c7de", "score": "0.46303847", "text": "func (b *Binding) Init(metadata bindings.Metadata) error {\n\ts, f := metadata.Properties[\"schedule\"]\n\tif !f || s == \"\" {\n\t\treturn fmt.Errorf(\"schedule not set\")\n\t}\n\t_, err := b.parser.Parse(s)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"invalid schedule format: %s\", s)\n\t}\n\tb.schedule = s\n\n\treturn nil\n}", "title": "" }, { "docid": "ee862cb41a1c33138445fad0098b436a", "score": "0.46280193", "text": "func NewMetadata_List(s *capnp.Segment, sz int32) (Metadata_List, error) {\n\tl, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}, sz)\n\treturn Metadata_List{l}, err\n}", "title": "" }, { "docid": "a8a6b3427990c5a9a7ca990106e7bf1d", "score": "0.46241707", "text": "func parseMetadataBlock(r network.MultiReader, fmm fieldMetadataMap) error {\n\tvar offset int32\n\terr := r.Read(&offset)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tendpos := r.Pos() + int(offset)\n\n\terr = r.Align()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar headerSize int16\n\terr = r.Read(&headerSize)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar flags int16\n\terr = r.Read(&flags)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = r.Seek(16)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor r.Pos() < endpos {\n\t\tfm, err := parseFieldMetadata(r)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfmm[int(fm.header.metadataID)] = fm\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "65756540a86eb962cdc9f28c3453387e", "score": "0.4621096", "text": "func init() {\n\t//md := activity.NewMetadata(jsonMetadata)\n\t//activity.Register(NewActivity(md))\n\tactivityLog.SetLogLevel(logger.InfoLevel)\n\t//act := NewActivity(getActivityMetadata())\n\n}", "title": "" }, { "docid": "744b14a43e1a6d545e2836cc6b5b814e", "score": "0.46105865", "text": "func InitTrack() Data {\n\treturn &Track{}\n}", "title": "" }, { "docid": "7f3b60d2d8425daef1a0f810fddf1ca5", "score": "0.4600563", "text": "func Binit(fd *os.File) *buf {\n\treturn &buf{\n\t\trdline: 0,\n\t\toffset: 0,\n\t\tbbuf: make([]byte, startBufSize),\n\t\trdr: bufio.NewReaderSize(fd, startBufSize),\n\t\tfd: fd,\n\t}\n}", "title": "" }, { "docid": "b6e4e7d3780fae4487e8a266d5005677", "score": "0.4599774", "text": "func NewBuffer(bs []byte) *Buffer {\n\tbuf := proto.NewBuffer(bs)\n\tbuf.SetDeterministic(true)\n\treturn &Buffer{Buffer: buf}\n}", "title": "" }, { "docid": "43569539b64669e0cc2f83115d833544", "score": "0.45981556", "text": "func FromBytes(bytes []byte, ext Extension) (*Metadata, error) {\n\tif ext == nil {\n\t\text = &extension{}\n\t}\n\tmetadata := &Metadata{Extension: ext}\n\n\tif err := json.Unmarshal(bytes, metadata); err != nil {\n\t\treturn nil, err\n\t}\n\twebTestFiles, err := normalizeWebTestFiles(metadata.WebTestFiles)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmetadata.WebTestFiles = webTestFiles\n\n\tif metadata.Extension != nil {\n\t\tif err := metadata.Extension.Normalize(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn metadata, nil\n}", "title": "" }, { "docid": "9b4304aee78c33ee7d6c73236f9f4c66", "score": "0.45949674", "text": "func InitData(k string, s string) {\n\tkey = k\n\tsecret = s\n}", "title": "" }, { "docid": "d43af18a1bcd9b0e40f7737d1ea12e99", "score": "0.45946693", "text": "func (fw *FieldsWriter) init(dirPath string, segment string, fn *FieldInfos) error {\n\tfw.fieldInfos = fn\n\n\tfilePath := path.Join(dirPath, segment+FileSuffix[\"fieldData\"])\n\n\tfieldsData, err := CreateFile(filePath, false, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfw.fieldsData = fieldsData\n\n\tfilePath = path.Join(dirPath, segment+FileSuffix[\"fieldIndex\"])\n\tfieldsIndex, err := CreateFile(filePath, false, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfw.fieldsIndex = fieldsIndex\n\treturn nil\n}", "title": "" }, { "docid": "9d7f9ea4fc62e752cd0e28ded5ebdc17", "score": "0.459264", "text": "func (r *storeMMapReader) initialize() error {\n\tbuf := r.readBytes(r.len - sstFileFooterSize)\n\tif (len(buf)) != sstFileFooterSize-1 {\n\t\treturn fmt.Errorf(\"read sstfile:%s footer error\", r.path)\n\t}\n\t// validate magic-number\n\tif uint64Func(buf[9:]) != magicNumberOffsetFile {\n\t\treturn fmt.Errorf(\"verify magic-number of sstfile:%s failure\", r.path)\n\t}\n\tposOfOffset := int(binary.LittleEndian.Uint32(buf[:4]))\n\tposOfKeys := int(binary.LittleEndian.Uint32(buf[4:8]))\n\tif err := encoding.BitmapUnmarshal(r.keys, r.readBytes(posOfKeys)); err != nil {\n\t\treturn fmt.Errorf(\"unmarshal keys data from file[%s] error:%s\", r.path, err)\n\t}\n\toffset := r.readBytes(posOfOffset)\n\tr.offsets = encoding.NewFixedOffsetDecoder(offset)\n\n\tif r.offsets.Size() != int(r.keys.GetCardinality()) {\n\t\treturn fmt.Errorf(\"num. of keys != num. of offsets in file[%s]\", r.path)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ffda4e617925b3d05c622b0dcb365c11", "score": "0.459195", "text": "func (m *RedisMetaConstructor) Init() error {\n\tuserData, err := internal.GetSentinelUserData()\n\tif err != nil {\n\t\treturn err\n\t}\n\tm.meta = BackupMeta{\n\t\tPermanent: m.permanent,\n\t\tUser: userData,\n\t\tStartTime: utility.TimeNowCrossPlatformLocal(),\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "902982d7f5b4b224fa416e6824a9d7b0", "score": "0.45869544", "text": "func (c *Collector) Init(ctx context.Context) (err error) { return nil }", "title": "" }, { "docid": "7f2615bc4f30333df87a8bdc29f78729", "score": "0.45834032", "text": "func NewFromBLOB(in io.Reader, chunkSize int64) (res *Manifest, err error) {\n\tres = &Manifest{}\n\terr = res.ParseBlob(in, chunkSize)\n\treturn\n}", "title": "" }, { "docid": "d3afd000003fbf37ac293ade995e7367", "score": "0.45810506", "text": "func InitImmutable(bucket *ibmcloudv1alpha1.Bucket) map[string]string {\n\tanno := make(map[string]string)\n\n\tanno[\"Resiliency\"] = bucket.Spec.Resiliency\n\tanno[\"Location\"] = bucket.Spec.Location\n\tanno[\"BucketType\"] = bucket.Spec.BucketType\n\tanno[\"StorageClass\"] = bucket.Spec.StorageClass\n\tbindingFromStr, err := json.Marshal(bucket.Spec.BindingFrom)\n\tif err == nil {\n\t\tanno[\"BindingFrom\"] = string(bindingFromStr)\n\t}\n\n\tAPIKeyStr, err := json.Marshal(bucket.Spec.APIKey)\n\tif err == nil {\n\t\tanno[\"APIKey\"] = string(APIKeyStr)\n\t}\n\n\tResourceInstanceIDStr, err := json.Marshal(bucket.Spec.ResourceInstanceID)\n\tif err == nil {\n\t\tanno[\"ResourceInstanceID\"] = string(ResourceInstanceIDStr)\n\t}\n\n\tEndpointsStr, err := json.Marshal(bucket.Spec.Endpoints)\n\tif err == nil {\n\t\tanno[\"Endpoints\"] = string(EndpointsStr)\n\t}\n\n\tanno[\"Bindonly\"] = strconv.FormatBool(bucket.Spec.BindOnly)\n\tlog.Info(bucket.ObjectMeta.Name, \"Inside InitImmutable\", anno)\n\treturn anno\n}", "title": "" }, { "docid": "77a925aaf74406be3a64a5f99ecd71a5", "score": "0.45803595", "text": "func (this *Help) Init(name, note string) (rv *Help) {\n\tparams := &Help{}\n\t*this = append(*this,\n\t\tyaml.MapItem{Key: name, Value: note},\n\t\tyaml.MapItem{Key: \"params\", Value: params})\n\treturn params\n}", "title": "" }, { "docid": "9c5255c7dc63fc0f8162c8121e62777f", "score": "0.45801723", "text": "func (m *metricProcessRuntimeMemstatsStackSys) init() {\n\tm.data.SetName(\"process.runtime.memstats.stack_sys\")\n\tm.data.SetDescription(\"Bytes of stack memory obtained from the OS.\")\n\tm.data.SetUnit(\"By\")\n\tm.data.SetEmptySum()\n\tm.data.Sum().SetIsMonotonic(false)\n\tm.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)\n}", "title": "" }, { "docid": "4ae95f5dc83091aaf5b306e10b3fc503", "score": "0.4578259", "text": "func FromReader(format dataset.DataFormat, data io.Reader) (st *dataset.Structure, n int, err error) {\n\tst = &dataset.Structure{\n\t\tFormat: format.String(),\n\t}\n\tst.Schema, n, err = Schema(st, data)\n\treturn\n}", "title": "" }, { "docid": "8d0a6ded982fc95059a3116cfcdae63d", "score": "0.45771107", "text": "func Init(conf Config) error {\n\tvar err error\n\tcodec, err = conf.BuildCodec()\n\treturn err\n}", "title": "" }, { "docid": "2076116ff83ae134375c6855019c0c03", "score": "0.45766714", "text": "func (e *MD) Init(l int) { e.ETLs = make(ETLs, l) }", "title": "" } ]
56a4c5dc26c3a456bcaeb23f1f4527ac
SyncUpdate triggers update on Orchestrator object and updates the cache
[ { "docid": "b37b3ed99bdee90110331ff681ea6273", "score": "0.67417103", "text": "func (api *orchestratorAPI) SyncUpdate(obj *orchestration.Orchestrator) error {\n\tif api.ct.objResolver != nil {\n\t\tlog.Fatal(\"Cannot use Sync update when object resolver is enabled on ctkit\")\n\t}\n\tnewObj := obj\n\tvar writeErr error\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\tnewObj, writeErr = apicl.OrchestratorV1().Orchestrator().Update(context.Background(), obj)\n\t}\n\n\tif writeErr == nil {\n\t\tapi.ct.handleOrchestratorEvent(&kvstore.WatchEvent{Object: newObj, Type: kvstore.Updated})\n\t}\n\n\treturn writeErr\n}", "title": "" } ]
[ { "docid": "2c44bb490b2548a75cc31ba76e93af78", "score": "0.6084702", "text": "func (api *orchestratorAPI) Update(obj *orchestration.Orchestrator) error {\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = apicl.OrchestratorV1().Orchestrator().Update(context.Background(), obj)\n\t\treturn err\n\t}\n\n\tapi.ct.handleOrchestratorEvent(&kvstore.WatchEvent{Object: obj, Type: kvstore.Updated})\n\treturn nil\n}", "title": "" }, { "docid": "18b6632e24c629bc9fa874e93a1425ea", "score": "0.6046163", "text": "func (service *InMemoryService) Update() {\n\tservice.backend.RequestRead(service)\n}", "title": "" }, { "docid": "53d11a858b836ab7f6f49bc4722f4422", "score": "0.59180516", "text": "func (o *Client) Update(exec boil.Executor, whitelist ...string) error {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\to.UpdatedAt = currTime\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn err\n\t}\n\tkey := makeCacheKey(whitelist, nil)\n\tclientUpdateCacheMut.RLock()\n\tcache, cached := clientUpdateCache[key]\n\tclientUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(\n\t\t\tclientColumns,\n\t\t\tclientPrimaryKeyColumns,\n\t\t\twhitelist,\n\t\t)\n\n\t\tif len(whitelist) == 0 {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"models: unable to update clients, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"clients\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, clientPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(clientType, clientMapping, append(wl, clientPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update clients row\")\n\t}\n\n\tif !cached {\n\t\tclientUpdateCacheMut.Lock()\n\t\tclientUpdateCache[key] = cache\n\t\tclientUpdateCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpdateHooks(exec)\n}", "title": "" }, { "docid": "a6fc52a2a16d941b0b79ef5edc080b87", "score": "0.5874966", "text": "func (mpc *MockPolicyCache) Update(dataChngEv datasync.ChangeEvent) error {\n\treturn nil\n}", "title": "" }, { "docid": "0639826b0dc0419f4a90fa24004de403", "score": "0.58375883", "text": "func (c *Consistent) Update() {\r\n\tc.update()\r\n}", "title": "" }, { "docid": "33237242aa818c3507ef224dbe755a99", "score": "0.57989293", "text": "func (o *Owner) Update(exec boil.Executor, whitelist ...string) error {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn err\n\t}\n\tkey := makeCacheKey(whitelist, nil)\n\townerUpdateCacheMut.RLock()\n\tcache, cached := ownerUpdateCache[key]\n\townerUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(ownerColumns, ownerPrimaryKeyColumns, whitelist)\n\t\tif len(whitelist) == 0 {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"models: unable to update owner, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"owner\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, ownerPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(ownerType, ownerMapping, append(wl, ownerPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update owner row\")\n\t}\n\n\tif !cached {\n\t\townerUpdateCacheMut.Lock()\n\t\townerUpdateCache[key] = cache\n\t\townerUpdateCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpdateHooks(exec)\n}", "title": "" }, { "docid": "d8e149245f878cd96d49623078358b78", "score": "0.5732546", "text": "func (o *Task) Update(exec boil.Executor, whitelist ...string) error {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\to.UpdatedAt.Time = currTime\n\to.UpdatedAt.Valid = true\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn err\n\t}\n\tkey := makeCacheKey(whitelist, nil)\n\ttaskUpdateCacheMut.RLock()\n\tcache, cached := taskUpdateCache[key]\n\ttaskUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(\n\t\t\ttaskColumns,\n\t\t\ttaskPrimaryKeyColumns,\n\t\t\twhitelist,\n\t\t)\n\n\t\tif len(whitelist) == 0 {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"models: unable to update tasks, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"tasks\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, taskPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(taskType, taskMapping, append(wl, taskPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update tasks row\")\n\t}\n\n\tif !cached {\n\t\ttaskUpdateCacheMut.Lock()\n\t\ttaskUpdateCache[key] = cache\n\t\ttaskUpdateCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpdateHooks(exec)\n}", "title": "" }, { "docid": "7d864039e97b79755b68aeed4a87940f", "score": "0.5721028", "text": "func (p *Manager) Sync(key string) error {\n\t// split the namespace and name from cache\n\tns, name, err := cache.SplitMetaNamespaceKey(key)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error splitting namespace/key from obj %s: %v\", key, err)\n\t}\n\n\tresource, err := p.lister.PostgresDBs(ns).Get(name)\n\tif err != nil {\n\t\t// Create a secret and see if it was pre-existing\n\t\tlog.Warnf(\"resource %s does not exist: %v\", key, err)\n\t\tlog.Warnf(\"delete processing item: %s/%s\", ns, name)\n\t\treturn p.Delete(ns, name)\n\t}\n\n\tlog.Infof(\"sync processing item: %s/%s\", ns, name)\n\n\t// deep copy to not change the cache\n\tnewDbInterface, _ := scheme.Scheme.DeepCopy(resource)\n\tobj := newDbInterface.(*v1alpha1.PostgresDB)\n\tinstanceID := fmt.Sprintf(\"%s-%s\", name, obj.GetUID())\n\tpgdb := p.newDB(instanceID, ns, resource)\n\n\treturn pgdb.Save()\n}", "title": "" }, { "docid": "9e365a4374e37e85c867c90e81dc3530", "score": "0.570042", "text": "func (self *OvsDriver) Update(context interface{}, tableUpdates libovsdb.TableUpdates) {\n self.PopulateCache(tableUpdates)\n}", "title": "" }, { "docid": "0f0421c9ea8a7f68cec2ba86980d3a48", "score": "0.569869", "text": "func (c *ipamCache) sync() error {\n\tres, err := c.etcdAPI.Get(context.Background(), CALICO_IPAM, &etcd.GetOptions{Recursive: true})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar index uint64\n\tindex = res.Index\n\tfor _, node := range res.Node.Nodes {\n\t\tif node.ModifiedIndex > index {\n\t\t\tindex = node.ModifiedIndex\n\t\t}\n\t\tif err = c.syncsubr(node); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tc.ready = true\n\tc.readyCond.Broadcast()\n\n\twatcher := c.etcdAPI.Watcher(CALICO_IPAM, &etcd.WatcherOptions{Recursive: true, AfterIndex: index})\n\tfor {\n\t\tres, err := watcher.Next(context.Background())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdel := false\n\t\tnode := res.Node\n\t\tswitch res.Action {\n\t\tcase \"set\", \"create\", \"update\", \"compareAndSwap\":\n\t\tcase \"delete\":\n\t\t\tdel = true\n\t\t\tnode = res.PrevNode\n\t\tdefault:\n\t\t\tlog.Printf(\"unhandled action: %s\", res.Action)\n\t\t\tcontinue\n\t\t}\n\t\tif err = c.update(node, del); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "91227a03540a54b3fba4b9a050d73808", "score": "0.5694654", "text": "func (e *EPaxosRMWHandler) sync() {\n if !e.R.Durable {\n return\n }\n\n e.R.StableStore.Sync()\n}", "title": "" }, { "docid": "9544a7ee30daf724311d19997fcce9f8", "score": "0.56926984", "text": "func (c mockClient) Update(ctx context.Context, obj runtime.Object, opts ...client.UpdateOption) error {\n\tc.calls[\"Update\"] = append(c.calls[\"Update\"], mockFuncCall{\n\t\tctx: ctx,\n\t\tobj: obj,\n\t})\n\tc.state[getStateKey(obj)] = obj\n\treturn nil\n}", "title": "" }, { "docid": "a802d8afac2a2ddc4e88465c0e5c2140", "score": "0.5677224", "text": "func (r *Repository) Sync() error {\n\tcacheDir := util.ReplaceHome(constants.CacheDir)\n\tcachePath := filepath.Join(cacheDir, r.ID)\n\n\terr := r.Load()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Read repomd.xml\n\trepomdURL := fmt.Sprintf(\"%s/repodata/repomd.xml\", r.BaseURL)\n\tresp, err := http.Get(repomdURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\trmd := RepoMd{}\n\n\terr = xml.Unmarshal(body, &rmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Check update\n\tif rmd.Revision > r.Revision {\n\t\terr = r.ClearCache()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvar cacheFiles []string\n\n\t\tfor _, item := range rmd.Items {\n\t\t\titemURL := fmt.Sprintf(\"%s/%s\", r.BaseURL, item.Location.Href)\n\t\t\tfname, err := util.Download(itemURL, cachePath, constants.CachePerm)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tcacheFiles = append(cacheFiles, fname)\n\t\t}\n\n\t\tr.CacheFiles = cacheFiles\n\t\tr.Revision = rmd.Revision\n\n\t\terr = r.LoadCache()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn r.Save()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7c328b7d3c4c1abbc415dd55cf487c0d", "score": "0.5657252", "text": "func (r *CachedRepo) Sync() error {\n\treturn r.Remote.Sync(r.LocalDir)\n}", "title": "" }, { "docid": "6cbcff249165895c64e0a977aaddf563", "score": "0.56441957", "text": "func (db *DB) setSync(batch *leveldb.Batch, addr swarm.Address, mode storage.ModeSet) (gcSizeChange int64, err error) {\n\titem := addressToItem(addr)\n\n\t// need to get access timestamp here as it is not\n\t// provided by the access function, and it is not\n\t// a property of a chunk provided to Accessor.Put.\n\n\ti, err := db.retrievalDataIndex.Get(item)\n\tif err != nil {\n\t\tif errors.Is(err, leveldb.ErrNotFound) {\n\t\t\t// chunk is not found,\n\t\t\t// no need to update gc index\n\t\t\t// just delete from the push index\n\t\t\t// if it is there\n\t\t\terr = db.pushIndex.DeleteInBatch(batch, item)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\treturn 0, nil\n\t\t}\n\t\treturn 0, err\n\t}\n\titem.StoreTimestamp = i.StoreTimestamp\n\titem.BinID = i.BinID\n\n\tswitch mode {\n\tcase storage.ModeSetSyncPull:\n\t\t// if we are setting a chunk for pullsync we expect it to be in the index\n\t\t// if it has a tag - we increment it and set the index item to _not_ contain the tag reference\n\t\t// this prevents duplicate increments\n\t\ti, err := db.pullIndex.Get(item)\n\t\tif err != nil {\n\t\t\tif errors.Is(err, leveldb.ErrNotFound) {\n\t\t\t\t// we handle this error internally, since this is an internal inconsistency of the indices\n\t\t\t\t// if we return the error here - it means that for example, in stream protocol peers which we sync\n\t\t\t\t// to would be dropped. this is possible when the chunk is put with ModePutRequest and ModeSetSyncPull is\n\t\t\t\t// called on the same chunk (which should not happen)\n\t\t\t\tdb.logger.Debugf(\"localstore: chunk with address %s not found in pull index\", addr)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn 0, err\n\t\t}\n\n\t\tif db.tags != nil && i.Tag != 0 {\n\t\t\tt, err := db.tags.Get(i.Tag)\n\n\t\t\t// increment if and only if tag is anonymous\n\t\t\tif err == nil && t.Anonymous {\n\t\t\t\t// since pull sync does not guarantee that\n\t\t\t\t// a chunk has reached its NN, we can only mark\n\t\t\t\t// it as Sent\n\t\t\t\tt.Inc(tags.StateSent)\n\n\t\t\t\t// setting the tag to zero makes sure that\n\t\t\t\t// we don't increment the same tag twice when syncing\n\t\t\t\t// the same chunk to different peers\n\t\t\t\titem.Tag = 0\n\n\t\t\t\terr = db.pullIndex.PutInBatch(batch, item)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn 0, err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase storage.ModeSetSyncPush:\n\t\ti, err := db.pushIndex.Get(item)\n\t\tif err != nil {\n\t\t\tif errors.Is(err, leveldb.ErrNotFound) {\n\t\t\t\t// we handle this error internally, since this is an internal inconsistency of the indices\n\t\t\t\t// this error can happen if the chunk is put with ModePutRequest or ModePutSync\n\t\t\t\t// but this function is called with ModeSetSyncPush\n\t\t\t\tdb.logger.Debugf(\"localstore: chunk with address %s not found in push index\", addr)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn 0, err\n\t\t}\n\t\tif db.tags != nil && i.Tag != 0 {\n\t\t\tt, err := db.tags.Get(i.Tag)\n\t\t\tif err != nil {\n\t\t\t\t// we cannot break or return here since the function needs to\n\t\t\t\t// run to end from db.pushIndex.DeleteInBatch\n\t\t\t\tdb.logger.Errorf(\"localstore: get tags on push sync set uid %d: %v\", i.Tag, err)\n\t\t\t} else {\n\t\t\t\t// setting a chunk for push sync assumes the tag is not anonymous\n\t\t\t\tif t.Anonymous {\n\t\t\t\t\treturn 0, errors.New(\"got an anonymous chunk in push sync index\")\n\t\t\t\t}\n\n\t\t\t\tt.Inc(tags.StateSynced)\n\t\t\t}\n\t\t}\n\n\t\terr = db.pushIndex.DeleteInBatch(batch, item)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\ti, err = db.retrievalAccessIndex.Get(item)\n\tswitch {\n\tcase err == nil:\n\t\titem.AccessTimestamp = i.AccessTimestamp\n\t\terr = db.gcIndex.DeleteInBatch(batch, item)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tgcSizeChange--\n\tcase errors.Is(err, leveldb.ErrNotFound):\n\t\t// the chunk is not accessed before\n\tdefault:\n\t\treturn 0, err\n\t}\n\titem.AccessTimestamp = now()\n\terr = db.retrievalAccessIndex.PutInBatch(batch, item)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// Add in gcIndex only if this chunk is not pinned\n\tok, err := db.pinIndex.Has(item)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif !ok {\n\t\terr = db.gcIndex.PutInBatch(batch, item)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tgcSizeChange++\n\t}\n\n\treturn gcSizeChange, nil\n}", "title": "" }, { "docid": "9a5fe86197842ad64fb2c8b645801fee", "score": "0.5630241", "text": "func (s *Storage) sync() {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\n\tfor id, mm := range s.cache {\n\t\tfor label, cache := range mm {\n\t\t\ts.writerCh <- &Entity{\n\t\t\t\tID: id,\n\t\t\t\tLabel: label,\n\t\t\t\tCount: cache.flush(),\n\t\t\t\tattempt: 0,\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "328110ee9162862f67a17ce6da2a5bfe", "score": "0.562731", "text": "func (c client) Update(ctx context.Context, in k8sclient.Object, opt ...k8sclient.UpdateOption) error {\n\tstart := time.Now()\n\tdefer Metrics.Update(c, in, float64(time.Since(start)/nanoToMilli))\n\n\tobj, err := c.downConvert(ctx, in)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Client.Update(ctx, obj, opt...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif Settings.EnableCachedClient {\n\t\texpectedRV, err := getResourceVersion(obj)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tc.waitForPopulatedCache(obj, expectedRV)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "942ff08943cc8eef98b16d088453cbf6", "score": "0.56255597", "text": "func (this *SyncRequest) update(log logger.LogContext, initiator resources.Object) (bool, error) {\n\tthis.lock.Lock()\n\tdefer this.lock.Unlock()\n\n\tif this.resourceVersion == initiator.GetResourceVersion() {\n\t\tif len(this.syncPoints) == 0 {\n\t\t\tlog.Infof(\"synchronization %s(%s) for %s(%s) done\", this.name, this.resource, initiator.ClusterKey(), this.resourceVersion)\n\t\t\treturn true, nil\n\t\t}\n\t\tlog.Infof(\"synchronization %s(%s) for %s(%s) still pending\", this.name, this.resource, initiator.ClusterKey(), this.resourceVersion)\n\t\treturn false, nil\n\t}\n\tif this.resourceVersion == \"\" {\n\t\tlog.Infof(\"synchronizing %s(%s) for %s(%s)\", this.name, this.resource, initiator.ClusterKey(), initiator.GetResourceVersion())\n\t} else {\n\t\tlog.Infof(\"resynchronizing %s(%s) for %s(%s->%s)\", this.name, this.resource, initiator.ClusterKey(), this.resourceVersion, initiator.GetResourceVersion())\n\t}\n\tthis.resourceVersion = initiator.GetResourceVersion()\n\treconcilers := this.controller.mappings.Get(this.cluster, this.resource.GroupKind())\n\tif len(reconcilers) == 0 {\n\t\treturn false, fmt.Errorf(\"no reconcilers found for resource %s in %s\", this.resource, this.cluster)\n\t}\n\tlist, err := this.controller.ClusterHandler(this.cluster).resources[this.resource].List()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tthis.syncPoints = SyncPoints{}\n\tif len(list) == 0 {\n\t\tlog.Infof(\" no %s found for sync -> done\", this.resource)\n\t\treturn true, nil\n\t}\n\tif len(reconcilers) == 1 {\n\t\tfor _, o := range list {\n\t\t\tthis.syncPoints[o.ObjectName()] = nil\n\t\t}\n\t} else {\n\t\tfor _, o := range list {\n\t\t\tthis.syncPoints[o.ObjectName()] = reconcilers.Copy()\n\t\t}\n\t}\n\treturn false, this._requestReconcilations(log)\n}", "title": "" }, { "docid": "0c89db9c9e1ab6e14167d74ea9e4f10d", "score": "0.5624002", "text": "func (api *MetadataAPI) Sync(stopCh <-chan struct{}) {\n\tapi.sharedInformers.Start(stopCh)\n\n\twaitForCacheSync(api.syncChecks)\n}", "title": "" }, { "docid": "ea252e259fe947deda5f097367fe8764", "score": "0.56224203", "text": "func (r *ReconcileMobileSecurityServiceDB) update(obj runtime.Object, reqLogger logr.Logger) error {\n\terr := r.client.Update(context.TODO(), obj)\n\tif err != nil {\n\t\treqLogger.Error(err, \"Failed to update Object\", \"obj:\", obj)\n\t\treturn err\n\t}\n\treqLogger.Info(\"Object updated\", \"obj:\", obj)\n\treturn nil\n}", "title": "" }, { "docid": "8ef5c2a3a00a87d28677d51de64a062b", "score": "0.5618591", "text": "func (c *cache) Update(ctx context.Context, key string, obj runtime.Object, cs ...kvstore.Cmp) error {\n\tvar ref apiintf.Requirement\n\tvar refs apiintf.RequirementSet\n\trc, err := apiutils.GetRequirements(ctx)\n\tif err == nil {\n\t\tif rc != nil {\n\t\t\trefs = rc.(apiintf.RequirementSet)\n\t\t\tif errs := refs.Check(ctx); len(errs) != 0 {\n\t\t\t\treturn fmt.Errorf(\"requirement not met [%v]\", errs)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tref = c.getRefRequirements(ctx, key, apiintf.UpdateOper, obj)\n\t\tif ref != nil {\n\t\t\tif errs := ref.Check(ctx); len(errs) > 0 {\n\t\t\t\treturn fmt.Errorf(\"requirement not met [%v]\", errs)\n\t\t\t}\n\t\t}\n\t}\n\tdefer c.RUnlock()\n\tc.RLock()\n\tif !c.active {\n\t\treturn errorCacheInactive\n\t}\n\t// perform KV store Update.\n\tstart := time.Now()\n\tc.logger.DebugLog(\"oper\", \"update\", \"msg\", \"called\")\n\tk := c.pool.GetFromPool().(kvstore.Interface)\n\tkvtime := time.Now()\n\terr = k.Update(ctx, key, obj, cs...)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Object update failed: %s\", kvstore.ErrorDesc(err))\n\t}\n\thdr.Record(\"kvstore.Update\", time.Since(kvtime))\n\t_, v := apiutils.MustGetObjectMetaVersion(obj)\n\tc.logger.DebugLog(\"oper\", \"update\", \"msg\", \"kvstore success, updating cache\")\n\tc.store.Set(key, v, obj, c.getCbFunc(kvstore.Updated))\n\tif refs != nil {\n\t\trefs.Finalize(ctx)\n\t} else if ref != nil {\n\t\tref.Finalize(ctx)\n\t}\n\thdr.Record(\"cache.Update\", time.Since(start))\n\tupdateOps.Add(1)\n\treturn nil\n}", "title": "" }, { "docid": "7fc343493afec536e3e26648720bc877", "score": "0.56008315", "text": "func (c *Controller) updateOrchestrator(oldObj, newObj interface{}) {\n\t_, ok := oldObj.(*netappv1.TridentOrchestrator)\n\tif !ok {\n\t\tLog().Errorf(\"'%s' controller expected '%s' CR; got '%v'\", ControllerName, CRDName, oldObj)\n\t\treturn\n\t}\n\n\tnewCR, ok := newObj.(*netappv1.TridentOrchestrator)\n\tif !ok {\n\t\tLog().Errorf(\"'%s' controller expected '%s' CR; got '%v'\", ControllerName, CRDName, newObj)\n\t\treturn\n\t}\n\n\tif !newCR.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\tLog().WithFields(LogFields{\n\t\t\t\"name\": newCR.Name,\n\t\t\t\"deletionTimestamp\": newCR.ObjectMeta.DeletionTimestamp,\n\t\t}).Infof(\"'%s' CR is being deleted, not updated.\", CRDName)\n\t\treturn\n\t}\n\n\tvar key string\n\tvar err error\n\n\tif key, err = cache.MetaNamespaceKeyFunc(newObj); err != nil {\n\t\tLog().Error(err)\n\t\treturn\n\t}\n\n\tLog().WithFields(LogFields{\n\t\t\"CR\": newCR.Name,\n\t\t\"CRD\": CRDName,\n\t}).Infof(\"CR updated.\")\n\n\tkeyItem := KeyItem{\n\t\tkeyDetails: key,\n\t\tresourceType: ResourceTridentOrchestratorCR,\n\t}\n\n\tc.workqueue.Add(keyItem)\n}", "title": "" }, { "docid": "d3ecd2add7965b69dbf091d0d6b77c90", "score": "0.5578875", "text": "func (o *GroupsInvestor) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\to.UpdatedAt = currTime\n\t}\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tgroupsInvestorUpdateCacheMut.RLock()\n\tcache, cached := groupsInvestorUpdateCache[key]\n\tgroupsInvestorUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tgroupsInvestorAllColumns,\n\t\t\tgroupsInvestorPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"dbmodel: unable to update groups_investors, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"groups_investors\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 0, groupsInvestorPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(groupsInvestorType, groupsInvestorMapping, append(wl, groupsInvestorPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"dbmodel: unable to update groups_investors row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"dbmodel: failed to get rows affected by update for groups_investors\")\n\t}\n\n\tif !cached {\n\t\tgroupsInvestorUpdateCacheMut.Lock()\n\t\tgroupsInvestorUpdateCache[key] = cache\n\t\tgroupsInvestorUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "title": "" }, { "docid": "1b040af2bc004f4436b93d1060b65472", "score": "0.55767244", "text": "func (fl *dummyLock) Update(ctx context.Context, ler Record) error {\n\treturn nil\n}", "title": "" }, { "docid": "424bce6610a7f147a16af5aaa162b8b4", "score": "0.5563645", "text": "func (r *Replica) sync() {\n if !r.Durable {\n return\n }\n\n r.StableStore.Sync()\n}", "title": "" }, { "docid": "d3476076f68efeb4f55dfb850fd7fbcf", "score": "0.55474705", "text": "func (o *StatNotifier) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tstatNotifierUpdateCacheMut.RLock()\n\tcache, cached := statNotifierUpdateCache[key]\n\tstatNotifierUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tstatNotifierAllColumns,\n\t\t\tstatNotifierPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"model2: unable to update stat_notifier, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `stat_notifier` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, statNotifierPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(statNotifierType, statNotifierMapping, append(wl, statNotifierPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model2: unable to update stat_notifier row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model2: failed to get rows affected by update for stat_notifier\")\n\t}\n\n\tif !cached {\n\t\tstatNotifierUpdateCacheMut.Lock()\n\t\tstatNotifierUpdateCache[key] = cache\n\t\tstatNotifierUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "title": "" }, { "docid": "35c272a50d8ad13ac0dfe904a21e4a9d", "score": "0.55440784", "text": "func (p *policy) Sync(add []cache.Container, del []cache.Container) error {\n\tlog.Debug(\"synchronizing state...\")\n\tfor _, c := range del {\n\t\tp.ReleaseResources(c)\n\t}\n\tfor _, c := range add {\n\t\tp.AllocateResources(c)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "65ca0f45632aa6869331a2e1eda6d133", "score": "0.55410165", "text": "func TestUpdate(t *testing.T) {\n\tec := GetCacheWithBigCache(t)\n\tresource := &customResource{\n\t\tcounter: 0,\n\t}\n\tec.AddResource(\"getUser\", resource)\n\tb, err := ec.Provide(\"getUser\", \"2\", \"3\")\n\tif err != nil {\n\t\tt.Fatalf(\"error while providing %v\", err)\n\t}\n\tif string(b) != \"getUser:2-3\" {\n\t\tt.Fatalf(\"%s != %s\", string(b), \"getUser:2-3\")\n\t}\n\n\terr = ec.Set([]byte(\"updated\"), \"getUser\", \"2\", \"3\")\n\tif err != nil {\n\t\tt.Fatalf(\"error while setting value %v\", err)\n\t}\n\tb, err = ec.Provide(\"getUser\", \"2\", \"3\")\n\tif err != nil {\n\t\tt.Fatalf(\"error while providing %v\", err)\n\t}\n\n\tif string(b) != \"updated\" {\n\t\tt.Fatalf(\"%s != %s\", string(b), \"getUser:2-3\")\n\t}\n\n}", "title": "" }, { "docid": "8ef2ca476ccf91717a5c09a346a30ce9", "score": "0.5538283", "text": "func (s *ObjectSyncer) Sync(ctx context.Context) (SyncResult, error) {\n\tvar err error\n\n\tresult := SyncResult{}\n\tlog := logf.FromContext(ctx, \"syncer\", s.Name)\n\tkey := client.ObjectKeyFromObject(s.Obj)\n\n\tresult.Operation, err = controllerutil.CreateOrUpdate(ctx, s.Client, s.Obj, s.mutateFn())\n\n\t// check deep diff\n\tdiff := deep.Equal(redact(s.previousObject), redact(s.Obj))\n\n\t// don't pass to user error for owner deletion, just don't create the object\n\t//nolint: gocritic\n\tif errors.Is(err, ErrOwnerDeleted) {\n\t\tlog.Info(string(result.Operation), \"key\", key, \"kind\", objectType(s.Obj, s.Client), \"error\", err)\n\t\terr = nil\n\t} else if errors.Is(err, ErrIgnore) {\n\t\tlog.V(1).Info(\"syncer skipped\", \"key\", key, \"kind\", objectType(s.Obj, s.Client), \"error\", err)\n\t\terr = nil\n\t} else if err != nil {\n\t\tresult.SetEventData(eventWarning, basicEventReason(s.Name, err),\n\t\t\tfmt.Sprintf(\"%s %s failed syncing: %s\", objectType(s.Obj, s.Client), key, err))\n\t\tlog.Error(err, string(result.Operation), \"key\", key, \"kind\", objectType(s.Obj, s.Client), \"diff\", diff)\n\t} else {\n\t\tresult.SetEventData(eventNormal, basicEventReason(s.Name, err),\n\t\t\tfmt.Sprintf(\"%s %s %s successfully\", objectType(s.Obj, s.Client), key, result.Operation))\n\t\tlog.V(1).Info(string(result.Operation), \"key\", key, \"kind\", objectType(s.Obj, s.Client), \"diff\", diff)\n\t}\n\n\treturn result, err\n}", "title": "" }, { "docid": "3f0226748a5362465977b112f84e59bf", "score": "0.549901", "text": "func syncStoreImpl(storage Storage, overriddenDataSchema *schema.BatchHeader, objects []map[string]interface{}, timeIntervalValue string, cacheTable bool) error {\n\tif len(objects) == 0 {\n\t\treturn nil\n\t}\n\n\tadapter, tableHelper := storage.getAdapters()\n\n\tflatDataPerTable, err := processData(storage, overriddenDataSchema, objects, timeIntervalValue)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdeleteConditions := adapters.DeleteByTimeChunkCondition(timeIntervalValue)\n\n\tfor _, flatData := range flatDataPerTable {\n\t\ttable := tableHelper.MapTableSchema(flatData.BatchHeader)\n\n\t\tdbSchema, err := tableHelper.EnsureTable(storage.ID(), table, cacheTable)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tstart := time.Now()\n\t\tif err = adapter.BulkUpdate(dbSchema, flatData.GetPayload(), deleteConditions); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlogging.Debugf(\"[%s] Inserted [%d] rows in [%.2f] seconds\", storage.ID(), flatData.GetPayloadLen(), time.Now().Sub(start).Seconds())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7d90e60d4d92c990ea116338bb8a12fb", "score": "0.54956853", "text": "func (sw *storageWrapper) Update(key string, obj runtime.Object) error {\n\tvar buf bytes.Buffer\n\tif err := sw.backendSerializer.Encode(obj, &buf); err != nil {\n\t\tklog.Errorf(\"failed to encode object in update for %s, %v\", key, err)\n\t\treturn err\n\t}\n\n\tif err := sw.store.Update(key, buf.Bytes()); err != nil {\n\t\treturn err\n\t}\n\n\tif isCacheKey(key) {\n\t\tsw.Lock()\n\t\tsw.cache[key] = obj\n\t\tsw.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "73b36519b8497ef5f9dde0317ddf7a3c", "score": "0.5492433", "text": "func (w *Watcher) Update() error {\n\t//begin transaction\n\ttx, err := w.client.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\trev := 0\n\tval, err := tx.Get(goctx.Background(), []byte(w.keyName))\n\tif err != nil {\n\t\tif err != kv.ErrNotExist {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\trev, err = strconv.Atoi(string(val))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.Println(\"Get revision: \", rev)\n\t\trev += 1\n\t}\n\tlog.Printf(\"set revision %d\\n\", rev)\n\tif err = tx.Set([]byte(w.keyName), []byte(strconv.Itoa(rev))); err != nil {\n\t\treturn err\n\t}\n\tw.Lock()\n\tif err = tx.Commit(goctx.Background()); err != nil {\n\t\treturn err\n\t}\n\n\tw.formerValue = []byte(strconv.Itoa(rev))\n\tw.Unlock()\n\treturn err\n\n}", "title": "" }, { "docid": "ed8fd55cf3547923ea89ae2ecaf5945e", "score": "0.54840183", "text": "func (m *argov2manager) Sync(ctx context.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "8736bcf3615b6344d05466ef90c85dba", "score": "0.5475562", "text": "func (s *store) sync(ctx context.Context) error {\n\tresp, err := s.apiClient.ListEvents(ctx, &pipedservice.ListEventsRequest{\n\t\tFrom: s.milestone,\n\t\tOrder: pipedservice.ListOrder_ASC,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to list events: %w\", err)\n\t}\n\tif len(resp.Events) == 0 {\n\t\treturn nil\n\t}\n\n\t// Eliminate events that have duplicated key.\n\tfiltered := make(map[string]*model.Event, len(resp.Events))\n\tfor _, e := range resp.Events {\n\t\tfiltered[e.EventKey] = e\n\t}\n\t// Make the cache up-to-date.\n\ts.mu.Lock()\n\tfor key, event := range filtered {\n\t\tcached, ok := s.latestEvents[key]\n\t\tif ok && cached.CreatedAt > event.CreatedAt {\n\t\t\tcontinue\n\t\t}\n\t\ts.latestEvents[key] = event\n\t}\n\ts.mu.Unlock()\n\n\t// Set the latest one within the result as the next time's \"from\".\n\ts.milestone = resp.Events[len(resp.Events)-1].CreatedAt + 1\n\treturn nil\n}", "title": "" }, { "docid": "6c6ba02742c520f7d6c7aa8fdec7627c", "score": "0.54718727", "text": "func (o *ServiceEndpoint) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tserviceEndpointUpdateCacheMut.RLock()\n\tcache, cached := serviceEndpointUpdateCache[key]\n\tserviceEndpointUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tserviceEndpointAllColumns,\n\t\t\tserviceEndpointPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update service_endpoint, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"service_endpoint\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, serviceEndpointPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(serviceEndpointType, serviceEndpointMapping, append(wl, serviceEndpointPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update service_endpoint row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for service_endpoint\")\n\t}\n\n\tif !cached {\n\t\tserviceEndpointUpdateCacheMut.Lock()\n\t\tserviceEndpointUpdateCache[key] = cache\n\t\tserviceEndpointUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "title": "" }, { "docid": "5ac81caf623e7058514370e0c2664e8c", "score": "0.5469756", "text": "func (this *Cache) Sync(f func(CacheGetter, CacheSetter)) {\n\tthis.mu.Lock()\n\tf(this.Get, this.set)\n\tthis.mu.Unlock()\n}", "title": "" }, { "docid": "6263741e69157de1305d6a3b81a5ed90", "score": "0.5464428", "text": "func (o *ObjectCache) Update(resourceIdent ResourceIdent, object client.Object) error {\n\tif _, ok := o.data[resourceIdent]; !ok {\n\t\treturn fmt.Errorf(\"object cache not found, cannot update\")\n\t}\n\n\tnn, err := getNamespacedNameFromRuntime(object)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, ok := o.data[resourceIdent][nn]; !ok {\n\t\treturn fmt.Errorf(\"object not found in cache, cannot update\")\n\t}\n\n\tvar gvk, obGVK schema.GroupVersionKind\n\tif gvk, err = utils.GetKindFromObj(o.scheme, resourceIdent.GetType()); err != nil {\n\t\treturn err\n\t}\n\n\tif obGVK, err = utils.GetKindFromObj(o.scheme, object); err != nil {\n\t\treturn err\n\t}\n\n\tif gvk != obGVK {\n\t\treturn fmt.Errorf(\"create: resourceIdent type does not match runtime object [%s] [%s] [%s]\", nn, gvk, obGVK)\n\t}\n\n\to.data[resourceIdent][nn].Object = object.DeepCopyObject().(client.Object)\n\n\tif clowder_config.LoadedConfig.DebugOptions.Cache.Update {\n\t\tvar jsonData []byte\n\t\tjsonData, _ = json.MarshalIndent(o.data[resourceIdent][nn].Object, \"\", \" \")\n\t\tif object.GetObjectKind().GroupVersionKind() == secretCompare {\n\t\t\to.log.Info(\"UPDATE resource \", \"namespace\", nn.Namespace, \"name\", nn.Name, \"provider\", resourceIdent.GetProvider(), \"purpose\", resourceIdent.GetPurpose(), \"kind\", object.GetObjectKind().GroupVersionKind().Kind, \"diff\", \"hidden\")\n\t\t} else {\n\t\t\to.log.Info(\"UPDATE resource \", \"namespace\", nn.Namespace, \"name\", nn.Name, \"provider\", resourceIdent.GetProvider(), \"purpose\", resourceIdent.GetPurpose(), \"kind\", object.GetObjectKind().GroupVersionKind().Kind, \"diff\", string(jsonData))\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0d3be52db473ded4c9cedf9cff319aee", "score": "0.5461235", "text": "func (c *LokiCore) Sync() error {\n\treturn nil\n}", "title": "" }, { "docid": "1c9ab3ebebb8643d72969ef23b64b827", "score": "0.54505247", "text": "func (o *CustomCommand) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) error {\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\to.UpdatedAt = currTime\n\t}\n\n\tvar err error\n\tkey := makeCacheKey(columns, nil)\n\tcustomCommandUpdateCacheMut.RLock()\n\tcache, cached := customCommandUpdateCache[key]\n\tcustomCommandUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tcustomCommandAllColumns,\n\t\t\tcustomCommandPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"models: unable to update custom_commands, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"custom_commands\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, customCommandPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(customCommandType, customCommandMapping, append(wl, customCommandPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\t_, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update custom_commands row\")\n\t}\n\n\tif !cached {\n\t\tcustomCommandUpdateCacheMut.Lock()\n\t\tcustomCommandUpdateCache[key] = cache\n\t\tcustomCommandUpdateCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dd66b6322cf28db530e417469bcb5313", "score": "0.54495215", "text": "func (o *Metric) Update(exec boil.Executor, whitelist ...string) error {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn err\n\t}\n\tkey := makeCacheKey(whitelist, nil)\n\tmetricUpdateCacheMut.RLock()\n\tcache, cached := metricUpdateCache[key]\n\tmetricUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(metricColumns, metricPrimaryKeyColumns, whitelist)\n\n\t\tif len(whitelist) == 0 {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"public: unable to update metric, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"metric\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, metricPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(metricType, metricMapping, append(wl, metricPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"public: unable to update metric row\")\n\t}\n\n\tif !cached {\n\t\tmetricUpdateCacheMut.Lock()\n\t\tmetricUpdateCache[key] = cache\n\t\tmetricUpdateCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpdateHooks(exec)\n}", "title": "" }, { "docid": "7d2c458ca971af161d3d8ec2e67e421c", "score": "0.5442696", "text": "func (cache *Cache) Sync(state Writer) error {\n\tcache.Lock()\n\tdefer cache.Unlock()\n\tvar hashes ProposalHashArray\n\tfor hash := range cache.proposals {\n\t\thashes = append(hashes, hash)\n\t}\n\tsort.Stable(hashes)\n\n\t// Update or delete proposals\n\tfor _, hash := range hashes {\n\t\tproposalInfo := cache.proposals[hash]\n\t\tproposalInfo.RLock()\n\t\tif proposalInfo.removed {\n\t\t\terr := state.RemoveProposal(hash[:])\n\t\t\tif err != nil {\n\t\t\t\tproposalInfo.RUnlock()\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else if proposalInfo.updated {\n\t\t\terr := state.UpdateProposal(hash[:], proposalInfo.ballot)\n\t\t\tif err != nil {\n\t\t\t\tproposalInfo.RUnlock()\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tproposalInfo.RUnlock()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9c1e4abb342fa9ccc4f6ebb5612fd645", "score": "0.54335815", "text": "func (o *Cache) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tcacheUpdateCacheMut.RLock()\n\tcache, cached := cacheUpdateCache[key]\n\tcacheUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tcacheAllColumns,\n\t\t\tcachePrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update caches, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"caches\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 0, cachePrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(cacheType, cacheMapping, append(wl, cachePrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update caches row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for caches\")\n\t}\n\n\tif !cached {\n\t\tcacheUpdateCacheMut.Lock()\n\t\tcacheUpdateCache[key] = cache\n\t\tcacheUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "title": "" }, { "docid": "fdfcb278fd4e6a9e58388d8eb4d197b5", "score": "0.5429538", "text": "func (c *Core) Sync() error {\n\treturn nil\n}", "title": "" }, { "docid": "d48686415e278d2dc91b23f431fbedf8", "score": "0.54253614", "text": "func (_MetaData *MetaDataTransactor) Update(opts *bind.TransactOpts, _data string) (*types.Transaction, error) {\n\treturn _MetaData.contract.Transact(opts, \"update\", _data)\n}", "title": "" }, { "docid": "77078f0f295fca64a2a32cb9c66ea003", "score": "0.54248786", "text": "func (o *CommandInfo) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) error {\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\to.UpdatedAt = currTime\n\t}\n\n\tvar err error\n\tkey := makeCacheKey(columns, nil)\n\tcommandInfoUpdateCacheMut.RLock()\n\tcache, cached := commandInfoUpdateCache[key]\n\tcommandInfoUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tcommandInfoAllColumns,\n\t\t\tcommandInfoPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"models: unable to update command_infos, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"command_infos\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, commandInfoPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(commandInfoType, commandInfoMapping, append(wl, commandInfoPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\t_, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update command_infos row\")\n\t}\n\n\tif !cached {\n\t\tcommandInfoUpdateCacheMut.Lock()\n\t\tcommandInfoUpdateCache[key] = cache\n\t\tcommandInfoUpdateCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f3c1078f2f85b4a0907a6412571b93a5", "score": "0.5420794", "text": "func (c *Cache) Update(ctx context.Context) error {\n\tstatus, err := c.DB.Get(ctx, c.roller)\n\tif err == datastore.ErrNoSuchEntity || status == nil {\n\t\t// This will occur the first time the roller starts,\n\t\t// before it sets the status for the first time. Ignore.\n\t\tsklog.Warningf(\"Unable to find AutoRollStatus for %s. Is this the first startup for this roller?\", c.roller)\n\t\tstatus = &AutoRollStatus{}\n\t} else if err != nil {\n\t\treturn err\n\t}\n\tc.mtx.Lock()\n\tdefer c.mtx.Unlock()\n\tc.status = status\n\treturn nil\n}", "title": "" }, { "docid": "c3295c5a8d6d42dd9711be5deab19433", "score": "0.54179406", "text": "func (o *GameOperation) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tkey := makeCacheKey(columns, nil)\n\tgameOperationUpdateCacheMut.RLock()\n\tcache, cached := gameOperationUpdateCache[key]\n\tgameOperationUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tgameOperationColumns,\n\t\t\tgameOperationPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update game_operations, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"game_operations\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, gameOperationPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(gameOperationType, gameOperationMapping, append(wl, gameOperationPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update game_operations row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for game_operations\")\n\t}\n\n\tif !cached {\n\t\tgameOperationUpdateCacheMut.Lock()\n\t\tgameOperationUpdateCache[key] = cache\n\t\tgameOperationUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "cefafedf5a6e01ecde0c61f4e05f80a3", "score": "0.54134977", "text": "func (*Core) Sync() error {\n\treturn nil\n}", "title": "" }, { "docid": "7aa10af68d093e3655130906c84aff57", "score": "0.5412201", "text": "func (ctrler CtrlDefReactor) OnOrchestratorUpdate(oldObj *Orchestrator, newObj *orchestration.Orchestrator) error {\n\tlog.Info(\"OnOrchestratorUpdate is not implemented\")\n\treturn nil\n}", "title": "" }, { "docid": "303372e4e4cddc13b3e9abf29f7dcb1f", "score": "0.5404804", "text": "func (r *Replica) sync() {\n\tif !r.Durable {\n\t\treturn\n\t}\n\n\tr.StableStore.Sync()\n}", "title": "" }, { "docid": "85115398f76388e2305ebe7661cf57ad", "score": "0.5380892", "text": "func (bc *BypassCache) Update(force bool) {\n\n\t// Lock the cache object.\n\tbc.CacheLock.Lock()\n\tdefer bc.CacheLock.Unlock()\n\n\t// Freeze transaction time to start of method.\n\tnow := time.Now()\n\n\t// Do not update cache if we're not forced to\n\t// and if the update is not due yet.\n\tif !force && !isStale(bc.LastUpdated, now) {\n\t\treturn\n\t}\n\n\t// Call out to the unit and update object.\n\tif gb, err := libcomfo.GetBypass(comfoConn); err == nil {\n\t\tbc.Bypass = gb\n\t\tbc.LastUpdated = now\n\t} else {\n\t\tlog.Printf(\"BypassCache.Update() - Error updating bypass cache: %s\", err)\n\t}\n}", "title": "" }, { "docid": "b2efac8975cdb1e942538759230c58d4", "score": "0.5377913", "text": "func (w *HotCache) Update(item *HotPeerStat) {\n\tswitch item.Kind {\n\tcase WriteFlow:\n\t\tw.writeFlow.Update(item)\n\tcase ReadFlow:\n\t\tw.readFlow.Update(item)\n\t}\n\n\tif item.IsNeedDelete() {\n\t\tw.incMetrics(\"remove_item\", item.StoreID, item.Kind)\n\t} else if item.IsNew() {\n\t\tw.incMetrics(\"add_item\", item.StoreID, item.Kind)\n\t} else {\n\t\tw.incMetrics(\"update_item\", item.StoreID, item.Kind)\n\t}\n}", "title": "" }, { "docid": "97abb29f0e4c22b5d8d0f213140a9b12", "score": "0.5369719", "text": "func (m *manager) Sync(ctx context.Context) error {\n\t// TODO: We're now persisting releases as secrets. To support seamless upgrades, we\n\t// need to sync the release status from the CR to the persistent storage backend.\n\t// Once we release the storage backend migration, this function (and comment)\n\t// can be removed.\n\tif err := m.syncReleaseStatus(*m.status); err != nil {\n\t\treturn fmt.Errorf(\"failed to sync release status to storage backend: %s\", err)\n\t}\n\n\t// Get release history for this release name\n\treleases, err := m.storageBackend.History(m.releaseName)\n\tif err != nil && !notFoundErr(err) {\n\t\treturn fmt.Errorf(\"failed to retrieve release history: %s\", err)\n\t}\n\n\t// Cleanup non-deployed release versions. If all release versions are\n\t// non-deployed, this will ensure that failed installations are correctly\n\t// retried.\n\tfor _, rel := range releases {\n\t\tif rel.GetInfo().GetStatus().GetCode() != rpb.Status_DEPLOYED {\n\t\t\t_, err := m.storageBackend.Delete(rel.GetName(), rel.GetVersion())\n\t\t\tif err != nil && !notFoundErr(err) {\n\t\t\t\treturn fmt.Errorf(\"failed to delete stale release version: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Load the chart and config based on the current state of the custom resource.\n\tchart, config, err := m.loadChartAndConfig()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to load chart and config: %s\", err)\n\t}\n\tm.chart = chart\n\tm.config = config\n\n\t// Load the most recently deployed release from the storage backend.\n\tdeployedRelease, err := m.getDeployedRelease()\n\tif err == ErrNotFound {\n\t\treturn nil\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get deployed release: %s\", err)\n\t}\n\tm.deployedRelease = deployedRelease\n\tm.isInstalled = true\n\n\t// Get the next candidate release to determine if an update is necessary.\n\tcandidateRelease, err := m.getCandidateRelease(ctx, m.tiller, m.releaseName, chart, config)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get candidate release: %s\", err)\n\t}\n\tif deployedRelease.GetManifest() != candidateRelease.GetManifest() {\n\t\tm.isUpdateRequired = true\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "246fe2b7e8fa759afd6d03da29249427", "score": "0.5366401", "text": "func (ri *MemCacheRepoImpl) Update(_ context.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "d2c1f3e29f6b0e287fc7c2c760fea015", "score": "0.53613096", "text": "func (cache *BlockCache) Sync() {\n\n\t// Determine order for storage updates\n\t// The address comes first so it'll be grouped.\n\tstorageKeys := make([]Tuple256, 0, len(cache.storages))\n\tfor keyTuple := range cache.storages {\n\t\tstorageKeys = append(storageKeys, keyTuple)\n\t}\n\tTuple256Slice(storageKeys).Sort()\n\n\t// Update storage for all account/key.\n\t// Later we'll iterate over all the users and save storage + update storage root.\n\tvar (\n\t\tcurAddr Word256\n\t\tcurAcc *acm.Account\n\t\tcurAccRemoved bool\n\t\tcurStorage merkle.Tree\n\t)\n\tfor _, storageKey := range storageKeys {\n\t\taddr, key := Tuple256Split(storageKey)\n\t\tif addr != curAddr || curAcc == nil {\n\t\t\tacc, storage, removed, _ := cache.accounts[string(addr.Postfix(20))].unpack()\n\t\t\tif !removed && storage == nil {\n\t\t\t\tstorage = makeStorage(cache.db, acc.StorageRoot)\n\t\t\t}\n\t\t\tcurAddr = addr\n\t\t\tcurAcc = acc\n\t\t\tcurAccRemoved = removed\n\t\t\tcurStorage = storage\n\t\t}\n\t\tif curAccRemoved {\n\t\t\tcontinue\n\t\t}\n\t\tvalue, dirty := cache.storages[storageKey].unpack()\n\t\tif !dirty {\n\t\t\tcontinue\n\t\t}\n\t\tif value.IsZero() {\n\t\t\tcurStorage.Remove(key.Bytes())\n\t\t} else {\n\t\t\tcurStorage.Set(key.Bytes(), value.Bytes())\n\t\t\tcache.accounts[string(addr.Postfix(20))] = accountInfo{curAcc, curStorage, false, true}\n\t\t}\n\t}\n\n\t// Determine order for accounts\n\taddrStrs := []string{}\n\tfor addrStr := range cache.accounts {\n\t\taddrStrs = append(addrStrs, addrStr)\n\t}\n\tsort.Strings(addrStrs)\n\n\t// Update or delete accounts.\n\tfor _, addrStr := range addrStrs {\n\t\tacc, storage, removed, dirty := cache.accounts[addrStr].unpack()\n\t\tif removed {\n\t\t\tremoved := cache.backend.RemoveAccount([]byte(addrStr))\n\t\t\tif !removed {\n\t\t\t\tPanicCrisis(Fmt(\"Could not remove account to be removed: %X\", acc.Address))\n\t\t\t}\n\t\t} else {\n\t\t\tif acc == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif storage != nil {\n\t\t\t\tnewStorageRoot := storage.Save()\n\t\t\t\tif !bytes.Equal(newStorageRoot, acc.StorageRoot) {\n\t\t\t\t\tacc.StorageRoot = newStorageRoot\n\t\t\t\t\tdirty = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif dirty {\n\t\t\t\tcache.backend.UpdateAccount(acc)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Determine order for names\n\t// note names may be of any length less than some limit\n\tnameStrs := []string{}\n\tfor nameStr := range cache.names {\n\t\tnameStrs = append(nameStrs, nameStr)\n\t}\n\tsort.Strings(nameStrs)\n\n\t// Update or delete names.\n\tfor _, nameStr := range nameStrs {\n\t\tentry, removed, dirty := cache.names[nameStr].unpack()\n\t\tif removed {\n\t\t\tremoved := cache.backend.RemoveNameRegEntry(nameStr)\n\t\t\tif !removed {\n\t\t\t\tPanicCrisis(Fmt(\"Could not remove namereg entry to be removed: %s\", nameStr))\n\t\t\t}\n\t\t} else {\n\t\t\tif entry == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif dirty {\n\t\t\t\tcache.backend.UpdateNameRegEntry(entry)\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "538951ffffe3b07a0ce1a3e1607d88c7", "score": "0.5356838", "text": "func (rm *RsrcManager) Update(item reconciler.Object) error {\n\tobj := item.Obj.(*Object)\n\td := obj.Redis\n\t_, err := rm.service.Projects.Locations.Instances.Patch(obj.Parent+\"/instances/\"+obj.InstanceID, d).UpdateMask(\"displayName,labels,memorySizeGb,redisConfigs\").Do()\n\treturn err\n}", "title": "" }, { "docid": "5ec86cf8ecbc4f32638eab7ce757da05", "score": "0.5355945", "text": "func (h *item) Sync(c echo.Context) error {\n\t// Filter params\n\tvar params service.SyncParams\n\tif err := c.Bind(&params); err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, sferror.New(\"Could not get syncing params.\"))\n\t}\n\tparams.UserAgent = c.Request().UserAgent()\n\tparams.Session = currentSession(c)\n\n\tsync := service.NewSync(h.db, currentUser(c), params)\n\tif err := sync.Execute(); err != nil {\n\t\treturn err\n\t}\n\n\treturn c.JSON(http.StatusOK, sync)\n}", "title": "" }, { "docid": "f9510efff512478f0f99ea32f0acae04", "score": "0.53349435", "text": "func (c *Core) Sync() error {\n\tc.client.Flush(c.sentryFlushTimeout)\n\treturn nil\n}", "title": "" }, { "docid": "8fc5548d06e34ce491860ff4627d8e56", "score": "0.5330499", "text": "func (i *VCSInstaller) sync(repo vcs.Repo) error {\n\n\tif _, err := os.Stat(repo.LocalPath()); os.IsNotExist(err) {\n\t\treturn repo.Get()\n\t}\n\treturn repo.Update()\n}", "title": "" }, { "docid": "15a0ccbcad13be790dc21bc38282775d", "score": "0.5324411", "text": "func (o *Gateway) Update(exec boil.Executor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tkey := makeCacheKey(columns, nil)\n\tgatewayUpdateCacheMut.RLock()\n\tcache, cached := gatewayUpdateCache[key]\n\tgatewayUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tgatewayAllColumns,\n\t\t\tgatewayPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update gateways, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"gateways\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, gatewayPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(gatewayType, gatewayMapping, append(wl, gatewayPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update gateways row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for gateways\")\n\t}\n\n\tif !cached {\n\t\tgatewayUpdateCacheMut.Lock()\n\t\tgatewayUpdateCache[key] = cache\n\t\tgatewayUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "ea62dbeb9009b2c49d58727165464826", "score": "0.5322398", "text": "func (rc *reconciler) sync() {\n\tdefer rc.updateLastSyncTime()\n\trc.syncStates(rc.kubeletPodsDir)\n}", "title": "" }, { "docid": "ea62dbeb9009b2c49d58727165464826", "score": "0.5322398", "text": "func (rc *reconciler) sync() {\n\tdefer rc.updateLastSyncTime()\n\trc.syncStates(rc.kubeletPodsDir)\n}", "title": "" }, { "docid": "803f80e9feb56caae1e8207ac19a0705", "score": "0.5321314", "text": "func (ce *cacheEntry) update(value json.RawMessage) {\n\tce.mu.Lock()\n\tdefer ce.mu.Unlock()\n\n\tce.value = value\n\tce.err = nil\n\n\t// If it was done before, set it to done.\n\tselect {\n\tcase <-ce.done:\n\tdefault:\n\t\tclose(ce.done)\n\t}\n}", "title": "" }, { "docid": "5811f1c693559a098650fd85d71f9410", "score": "0.531911", "text": "func (d *Datastore) Sync(ctx context.Context, prefix ds.Key) error {\n\treturn nil\n}", "title": "" }, { "docid": "66396ae178e5940741652caf303e8128", "score": "0.5314755", "text": "func (o *CMFGift) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tcmfGiftUpdateCacheMut.RLock()\n\tcache, cached := cmfGiftUpdateCache[key]\n\tcmfGiftUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tcmfGiftAllColumns,\n\t\t\tcmfGiftPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update cmf_gift, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `cmf_gift` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, cmfGiftPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(cmfGiftType, cmfGiftMapping, append(wl, cmfGiftPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update cmf_gift row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for cmf_gift\")\n\t}\n\n\tif !cached {\n\t\tcmfGiftUpdateCacheMut.Lock()\n\t\tcmfGiftUpdateCache[key] = cache\n\t\tcmfGiftUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "title": "" }, { "docid": "124e6ecc95cce98350bb053f42757212", "score": "0.53102285", "text": "func IncrSync(name string) {\n\tIncrDeltaSync(name, 1)\n}", "title": "" }, { "docid": "1f8dc51537307bcd4de453ef917a5b41", "score": "0.5300945", "text": "func (c *k8scache) UpdateStatus(client.Object) {}", "title": "" }, { "docid": "4e450f86597d898ef4aa96b05c7babe9", "score": "0.52950144", "text": "func (o *Repository) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\trepositoryUpdateCacheMut.RLock()\n\tcache, cached := repositoryUpdateCache[key]\n\trepositoryUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\trepositoryColumns,\n\t\t\trepositoryPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update repositories, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"repositories\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, repositoryPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(repositoryType, repositoryMapping, append(wl, repositoryPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update repositories row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for repositories\")\n\t}\n\n\tif !cached {\n\t\trepositoryUpdateCacheMut.Lock()\n\t\trepositoryUpdateCache[key] = cache\n\t\trepositoryUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "title": "" }, { "docid": "c98a29f28c399db7ff98b69ba9b7e03d", "score": "0.5294496", "text": "func (o *Goauth) Update(exec boil.Executor, whitelist ...string) error {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn err\n\t}\n\tkey := makeCacheKey(whitelist, nil)\n\tgoauthUpdateCacheMut.RLock()\n\tcache, cached := goauthUpdateCache[key]\n\tgoauthUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(goauthColumns, goauthPrimaryKeyColumns, whitelist)\n\t\tif len(whitelist) == 0 {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"models: unable to update goauth, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"goauth\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, goauthPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(goauthType, goauthMapping, append(wl, goauthPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update goauth row\")\n\t}\n\n\tif !cached {\n\t\tgoauthUpdateCacheMut.Lock()\n\t\tgoauthUpdateCache[key] = cache\n\t\tgoauthUpdateCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpdateHooks(exec)\n}", "title": "" }, { "docid": "f385ed0931ec2e6044cf1eb4e72e7265", "score": "0.52799594", "text": "func (s *podStorage) Sync() {\n\ts.updateLock.Lock()\n\tdefer s.updateLock.Unlock()\n\ts.updates <- kubetypes.PodUpdate{Pods: s.MergedState().([]*v1.Pod), Op: kubetypes.SET, Source: kubetypes.AllSource}\n}", "title": "" }, { "docid": "29d244e5262df2384c104721bf09eead", "score": "0.5270341", "text": "func (c *KubeClient) Sync(exit <-chan struct{}) {\n\tif !cache.WaitForCacheSync(exit, c.PodInformer.HasSynced) {\n\t\tklog.Error(\"pod cache could not be synchronized\")\n\t}\n}", "title": "" }, { "docid": "6fcdebed3dca66168d4d6297357138ea", "score": "0.5269193", "text": "func (ac *AuthorizationCache) synchronize() {\n\t// if none of our internal reflectors changed, then we can skip reviewing the cache\n\tskip, currentState := ac.skip.SkipSynchronize(ac.lastState, ac.lastSyncResourceVersioner, ac.policyLastSyncResourceVersioner)\n\tif skip {\n\t\treturn\n\t}\n\n\t// by default, we update our current caches and do an incremental change\n\tuserSubjectRecordStore := ac.userSubjectRecordStore\n\tgroupSubjectRecordStore := ac.groupSubjectRecordStore\n\treviewRecordStore := ac.reviewRecordStore\n\n\t// if there was a global change that forced complete invalidation, we rebuild our cache and do a fast swap at end\n\tinvalidateCache := ac.invalidateCache()\n\tif invalidateCache {\n\t\tuserSubjectRecordStore = cache.NewStore(subjectRecordKeyFn)\n\t\tgroupSubjectRecordStore = cache.NewStore(subjectRecordKeyFn)\n\t\treviewRecordStore = cache.NewStore(reviewRecordKeyFn)\n\t}\n\n\t// iterate over caches and synchronize our three caches\n\tnewKnownNamespaces := ac.synchronizeNamespaces(userSubjectRecordStore, groupSubjectRecordStore, reviewRecordStore)\n\tac.synchronizePolicies(userSubjectRecordStore, groupSubjectRecordStore, reviewRecordStore)\n\tac.synchronizePolicyBindings(userSubjectRecordStore, groupSubjectRecordStore, reviewRecordStore)\n\tac.purgeDeletedNamespaces(ac.allKnownNamespaces, newKnownNamespaces, userSubjectRecordStore, groupSubjectRecordStore, reviewRecordStore)\n\n\t// if we did a full rebuild, now we swap the fully rebuilt cache\n\tif invalidateCache {\n\t\tac.userSubjectRecordStore = userSubjectRecordStore\n\t\tac.groupSubjectRecordStore = groupSubjectRecordStore\n\t\tac.reviewRecordStore = reviewRecordStore\n\t}\n\tac.allKnownNamespaces = newKnownNamespaces\n\n\t// we were able to update our cache since this last observation period\n\tac.lastState = currentState\n}", "title": "" }, { "docid": "642e8211e260d48001bd61019ab13294", "score": "0.5267145", "text": "func (_e *Manager_Expecter) Update(policy interface{}) *Manager_Update_Call {\n\treturn &Manager_Update_Call{Call: _e.mock.On(\"Update\", policy)}\n}", "title": "" }, { "docid": "c6d40686e73925447597a50bec0443ce", "score": "0.52646726", "text": "func (c mockStatusWriter) Update(ctx context.Context, obj runtime.Object, opts ...client.UpdateOption) error {\n\tc.calls = append(c.calls, mockFuncCall{\n\t\tctx: ctx,\n\t\tobj: obj,\n\t})\n\treturn c.err\n}", "title": "" }, { "docid": "3d713b6ba58864a7d61238c22fa1c2f7", "score": "0.5261428", "text": "func (c MockClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error {\n\t// Check for induced errors\n\tif value, ok := c.InduceErrorKind[splcommon.MockClientInduceErrorUpdate]; ok && value != nil {\n\t\treturn value\n\t}\n\tc.Calls[\"Update\"] = append(c.Calls[\"Update\"], MockFuncCall{\n\t\tCTX: ctx,\n\t\tObj: obj,\n\t})\n\tc.State[getStateKey(obj)] = obj\n\treturn nil\n}", "title": "" }, { "docid": "34300d49b694c5ddff23e60ad10c09e9", "score": "0.5258888", "text": "func (h *UsecaseEvent) Update(ctx context.Context, data interface{}) error {\n\n\tif data == nil {\n\t\treturn errors.New(\"Data can't be null\")\n\t}\n\n\tctx, cancel := context.WithTimeout(ctx, h.contextTimeout)\n\tdefer cancel()\n\n\t// Manage version\n\tdata.(models.Model).SetVersion(data.(models.Model).GetVersion() + 1)\n\n\terr := h.ElasticRepo.Update(ctx, data)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Infof(\"Update data successfully\")\n\n\treturn nil\n}", "title": "" }, { "docid": "3586a40ed21903caaa8086023f1a0f30", "score": "0.525708", "text": "func (o *Ogp) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\togpUpdateCacheMut.RLock()\n\tcache, cached := ogpUpdateCache[key]\n\togpUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\togpAllColumns,\n\t\t\togpPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update ogp, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `ogp` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, ogpPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(ogpType, ogpMapping, append(wl, ogpPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update ogp row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for ogp\")\n\t}\n\n\tif !cached {\n\t\togpUpdateCacheMut.Lock()\n\t\togpUpdateCache[key] = cache\n\t\togpUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "title": "" }, { "docid": "75df2dbe5959b05cdcbce37addf600ad", "score": "0.5255351", "text": "func (t *TransactionMetadata) Update(objectstorage.StorableObject) {\n\tpanic(\"updates disabled\")\n}", "title": "" }, { "docid": "2f4f47b9de8f3311c2db5987d25439e7", "score": "0.52514154", "text": "func (p *ScopedBBoltPersister) Sync() error {\n\treturn p.db.Update(func(tx *bbolt.Tx) error {\n\t\toffsetBucket, err := tx.CreateBucketIfNotExists(OffsetsBucket)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbucket, err := offsetBucket.CreateBucketIfNotExists(p.scope)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tp.cacheMux.Lock()\n\t\tfor k, v := range p.cache {\n\t\t\terr := bucket.Put([]byte(k), v)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tp.cacheMux.Unlock()\n\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "79e1d4bea9ba422784621f635039350b", "score": "0.52514124", "text": "func (o *Accountdatum) Update(exec boil.Executor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\taccountdatumUpdateCacheMut.RLock()\n\tcache, cached := accountdatumUpdateCache[key]\n\taccountdatumUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\taccountdatumColumns,\n\t\t\taccountdatumPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"stellarcore: unable to update accountdata, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"accountdata\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, accountdatumPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(accountdatumType, accountdatumMapping, append(wl, accountdatumPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"stellarcore: unable to update accountdata row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"stellarcore: failed to get rows affected by update for accountdata\")\n\t}\n\n\tif !cached {\n\t\taccountdatumUpdateCacheMut.Lock()\n\t\taccountdatumUpdateCache[key] = cache\n\t\taccountdatumUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(exec)\n}", "title": "" }, { "docid": "80928d66dc4b6f20cff6389b35c504c2", "score": "0.52509296", "text": "func (m *ManagerMock) Update(ctx context.Context, r *hub.Repository) error {\n\targs := m.Called(ctx, r)\n\treturn args.Error(0)\n}", "title": "" }, { "docid": "34da94135343712e8ab89e2324f51bd6", "score": "0.5247027", "text": "func (c *taskCache) Update(ctx context.Context) error {\n\tctx, span := trace.StartSpan(ctx, \"taskcache_Update\")\n\tdefer span.End()\n\tc.mtx.Lock()\n\tdefer c.mtx.Unlock()\n\tc.modMtx.Lock()\n\tdefer c.modMtx.Unlock()\n\tc.expireTasks()\n\tfor _, t := range c.modified {\n\t\tif c.timeWindow.TestTime(t.Repo, t.Created) {\n\t\t\tc.insertOrUpdateTask(t)\n\t\t}\n\t}\n\tc.modified = map[string]*types.Task{}\n\treturn nil\n}", "title": "" }, { "docid": "56b54fb9e1b5c50d27893dcc451461f0", "score": "0.5242797", "text": "func (o *Claim) Update(exec boil.Executor, columns boil.Columns) error {\n\tvar err error\n\tkey := makeCacheKey(columns, nil)\n\tclaimUpdateCacheMut.RLock()\n\tcache, cached := claimUpdateCache[key]\n\tclaimUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tclaimAllColumns,\n\t\t\tclaimPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"model: unable to update claim, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `claim` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, claimPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(claimType, claimMapping, append(wl, claimPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to update claim row\")\n\t}\n\n\tif !cached {\n\t\tclaimUpdateCacheMut.Lock()\n\t\tclaimUpdateCache[key] = cache\n\t\tclaimUpdateCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9455dfb00b203ad2bf2b1cddf2684cc4", "score": "0.5242754", "text": "func (o *Blob) Update(exec boil.Executor, columns boil.Columns) (int64, error) {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\to.UpdatedAt = currTime\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tblobUpdateCacheMut.RLock()\n\tcache, cached := blobUpdateCache[key]\n\tblobUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tblobAllColumns,\n\t\t\tblobPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"db: unable to update blobs, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"blobs\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, blobPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(blobType, blobMapping, append(wl, blobPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"db: unable to update blobs row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"db: failed to get rows affected by update for blobs\")\n\t}\n\n\tif !cached {\n\t\tblobUpdateCacheMut.Lock()\n\t\tblobUpdateCache[key] = cache\n\t\tblobUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(exec)\n}", "title": "" }, { "docid": "45ca383184cdfc1e6274399ef3bbc1b8", "score": "0.52398854", "text": "func (this *Context) Update(spec *ar.ApicurioRegistry) {\n\tthis.configuration.Update(spec)\n\n\tspecEntry := NewResourceCacheEntry(spec.Name, spec)\n\tthis.resourceCache.Set(RC_KEY_SPEC, specEntry)\n}", "title": "" }, { "docid": "bf48272b9ac20fecac52db0b73a5ebaf", "score": "0.5233055", "text": "func (evc *Cache) Sync(publisher Publisher) error {\n\tvar err error\n\tfor _, mi := range evc.events {\n\t\tpublishErr := publisher.Publish(mi.ctx, mi.message, mi.tags)\n\t\t// Capture first by try to sync the rest\n\t\tif publishErr != nil && err == nil {\n\t\t\terr = publishErr\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "1bdbd79ff0bca607a755e68cbd52b458", "score": "0.5232458", "text": "func (e *Entity) ApplyUpdate(reader *bitread.BitReader) {\n\te.Called(reader)\n}", "title": "" }, { "docid": "d915d4f794e7cdf74688a866c3cde583", "score": "0.5231846", "text": "func (o *Institution) Update(exec boil.Executor, whitelist ...string) error {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\to.UpdatedAt = currTime\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn err\n\t}\n\tkey := makeCacheKey(whitelist, nil)\n\tinstitutionUpdateCacheMut.RLock()\n\tcache, cached := institutionUpdateCache[key]\n\tinstitutionUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(\n\t\t\tinstitutionColumns,\n\t\t\tinstitutionPrimaryKeyColumns,\n\t\t\twhitelist,\n\t\t)\n\n\t\tif len(whitelist) == 0 {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"models: unable to update institution, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"instruments\\\".\\\"institution\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, institutionPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(institutionType, institutionMapping, append(wl, institutionPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update institution row\")\n\t}\n\n\tif !cached {\n\t\tinstitutionUpdateCacheMut.Lock()\n\t\tinstitutionUpdateCache[key] = cache\n\t\tinstitutionUpdateCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpdateHooks(exec)\n}", "title": "" }, { "docid": "39a3b689fc0b08e8426f1053db10dc9d", "score": "0.5231431", "text": "func (w *HotSpotCache) Update(key uint64, item *core.RegionStat, kind FlowKind) {\n\tswitch kind {\n\tcase WriteFlow:\n\t\tif item == nil {\n\t\t\tw.writeFlow.Remove(key)\n\t\t} else {\n\t\t\tw.writeFlow.Put(key, item)\n\t\t\tw.incMetrics(\"update_item\", kind)\n\t\t}\n\tcase ReadFlow:\n\t\tif item == nil {\n\t\t\tw.readFlow.Remove(key)\n\t\t} else {\n\t\t\tw.readFlow.Put(key, item)\n\t\t\tw.incMetrics(\"update_item\", kind)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5825a40342fac14b0a6ef2fa99648b4b", "score": "0.522997", "text": "func (cmd *AccUpdateCmd) Execute(args []string) error {\n\t_, _, err := updateDetailsCache()\n\treturn err\n}", "title": "" }, { "docid": "8eb129b7962701ae4da575368961b110", "score": "0.5215953", "text": "func (c *Client) commit(data *Data) error {\n\n\tdata.Index++\n\n\t// try to write to disk before updating in memory\n\tif c.node != nil {\n\t\tif err := snapshot(c.node.Path, data); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// update in memory\n\tc.cacheData = data\n\n\t// close channels to signal changes\n\tclose(c.changed)\n\tc.changed = make(chan struct{})\n\n\treturn nil\n}", "title": "" }, { "docid": "2764c6b36cb6a559e53d31bea863b544", "score": "0.5215111", "text": "func (s *lockBasedTxSimulator) ExecuteUpdate(query string) error {\n\treturn errors.New(\"Not supported\")\n}", "title": "" }, { "docid": "85feb3159057c4ccc0d1f4d281711e7b", "score": "0.52133805", "text": "func (s *LockBasedTxSimulator) ExecuteUpdate(query string) error {\n\treturn errors.New(\"Not supported by KV data model\")\n}", "title": "" }, { "docid": "3cfa094018a6e343136981fef03b46dd", "score": "0.5210557", "text": "func (s *static) Sync(add []cache.Container, del []cache.Container) error {\n\ts.Debug(\"synchronizing state...\")\n\tfor _, c := range del {\n\t\ts.ReleaseResources(c)\n\t}\n\tfor _, c := range add {\n\t\ts.AllocateResources(c)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f3bca6393d787df5ed806fdce44a4f44", "score": "0.5204667", "text": "func (fc *FanCache) Update(force bool) {\n\n\t// Lock the cache object\n\tfc.CacheLock.Lock()\n\tdefer fc.CacheLock.Unlock()\n\n\t// Freeze transaction time to start of method\n\tnow := time.Now()\n\n\t// Do not update cache if we're not forced to\n\t// and if the update is not due yet\n\tif !force && !isStale(fc.LastUpdated, now) {\n\t\treturn\n\t}\n\n\t// Call out to the unit and update object\n\tif gf, err := libcomfo.GetFans(comfoConn); err == nil {\n\t\tfc.Fans = gf\n\t\tfc.LastUpdated = now\n\t} else {\n\t\tlog.Printf(\"FanCache.Update() - Error updating fan cache: %s\", err)\n\t}\n}", "title": "" }, { "docid": "8b90b788ea9ed3a902557e3dac47faa5", "score": "0.52015865", "text": "func (t *Transaction) Update(objectstorage.StorableObject) {\n\tpanic(\"updates disabled\")\n}", "title": "" }, { "docid": "e26d3834169be6616c082b41c824b57d", "score": "0.5199432", "text": "func (rmc *ReactiveMockClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error {\n\tfun := getReactorFuncForObject(obj, &rmc.ReactorFuncs)\n\tif fun != nil {\n\t\treturn fun()\n\t}\n\n\treturn rmc.FakeClient.Update(ctx, obj, opts...)\n}", "title": "" }, { "docid": "b50794047f38edeee1b5ce47d70e4326", "score": "0.519718", "text": "func (c *CRDBManager) Update(policy ladon.Policy) error {\n\n\treturn nil\n}", "title": "" }, { "docid": "3f8bc84fb7ba7d60d1c0ebd49d609607", "score": "0.5192841", "text": "func (o *Datum) Update(exec boil.Executor, whitelist ...string) error {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn err\n\t}\n\tkey := makeCacheKey(whitelist, nil)\n\tdatumUpdateCacheMut.RLock()\n\tcache, cached := datumUpdateCache[key]\n\tdatumUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(\n\t\t\tdatumColumns,\n\t\t\tdatumPrimaryKeyColumns,\n\t\t\twhitelist,\n\t\t)\n\n\t\tif len(whitelist) == 0 {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"models: unable to update data, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"data\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, datumPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(datumType, datumMapping, append(wl, datumPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update data row\")\n\t}\n\n\tif !cached {\n\t\tdatumUpdateCacheMut.Lock()\n\t\tdatumUpdateCache[key] = cache\n\t\tdatumUpdateCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpdateHooks(exec)\n}", "title": "" }, { "docid": "449ced9e9146d49bd66e53e147c60815", "score": "0.51911604", "text": "func (o *Oracle) updateCache(d dao.DAO) error {\n\torc, _ := o.Module.Load().(services.Oracle)\n\tif orc == nil {\n\t\treturn nil\n\t}\n\n\treqs := o.newRequests\n\to.newRequests = make(map[uint64]*state.OracleRequest)\n\tfor id := range reqs {\n\t\tkey := makeRequestKey(id)\n\t\tif si := d.GetStorageItem(o.ID, key); si == nil { // tx has failed\n\t\t\tdelete(reqs, id)\n\t\t}\n\t}\n\torc.AddRequests(reqs)\n\treturn nil\n}", "title": "" } ]
01e48f2cb76abc64371fa530fb3a0a2b
Inherit inherits previous generation of EurekaServiceRegistry.
[ { "docid": "bbab7759d23ccad8c9e5bbac02ed32b7", "score": "0.657721", "text": "func (eureka *EurekaServiceRegistry) Inherit(superSpec *supervisor.Spec, previousGeneration supervisor.Object) {\n\tpreviousGeneration.Close()\n\teureka.Init(superSpec)\n}", "title": "" } ]
[ { "docid": "ae0c18695e1419c19a87730cafb12de2", "score": "0.55394065", "text": "func (sr *ServiceRegistry) Inherit(superSpec *supervisor.Spec, previousGeneration supervisor.Object) {\n\tpreviousGeneration.Close()\n\tsr.Init(superSpec)\n}", "title": "" }, { "docid": "bfd5f927adeb0340c36985881a78a954", "score": "0.54672164", "text": "func (eureka *EurekaServiceRegistry) Kind() string {\n\treturn Kind\n}", "title": "" }, { "docid": "bda559f9a00839611fa583482fb38335", "score": "0.53853315", "text": "func (eureka *EurekaServiceRegistry) Category() supervisor.ObjectCategory {\n\treturn Category\n}", "title": "" }, { "docid": "9b6fa4e1d77f677c3ba036f2261a9ad8", "score": "0.532248", "text": "func (s *service) Init(opts ...Option) {\n\t// process options\n\tfor _, o := range opts {\n\t\to(&s.opts)\n\t}\n\n\tif s.opts.Registry == nil {\n\t\ts.opts.Server = server.NewServer()\n\t\ts.opts.Registry = &registry.Registry{\n\t\t\tRegNaming: registry.NewDNSNamingRegistry(),\n\t\t}\n\n\t\ts.opts.Client = client.NewClient(client.WithRegistryNaming(s.opts.Registry.RegNaming))\n\n\t\ts.opts.Server.Init(server.WithRegistryNaming(s.opts.Registry.RegNaming))\n\t\ts.opts.Client.Init(client.WithRegistryNaming(s.opts.Registry.RegNaming))\n\t}\n\n\t// init registry parms\n\ts.opts.Registry.RegNaming.Init(registry.WithAddrs(s.opts.Server.Options().Address),\n\t\tregistry.WithNodeID(s.opts.Server.Options().ID),\n\t\tregistry.WithServiceName(s.opts.Server.Options().Name),\n\t\tregistry.WithTimeout(s.opts.Server.Options().RegisterTTL),\n\t)\n\n\ts.once.Do(func() {\n\t\t// setup the plugins\n\t\t// TODO:once done\n\t})\n}", "title": "" }, { "docid": "bf1bce18a12151512ddfc9d3df7707dc", "score": "0.53093016", "text": "func GenerateRegistryServices(port int) ([]byte, error) {\n\treturn executeTemplate(registryServicesTmpl, map[string]interface{}{\n\t\t\"KubenabK8sAppName\": KubenabK8sAppName,\n\t\t\"RegistryK8sAppName\": RegistryK8sAppName,\n\t\t\"RegistryNamespace\": RegistryNamespace,\n\t\t\"RegistryNodePort\": strconv.Itoa(port),\n\t})\n}", "title": "" }, { "docid": "49f9e2161dd1e79d74d1171c3f2d358b", "score": "0.5209571", "text": "func init() {\n\tfor group, values := range defaultConfigs {\n\t\tcore.RegisterConfig(group, values)\n\t}\n\tcore.RegisterService(\"api\", nil, &ApiServiceFactory{})\n\tcore.RegisterService(\"notify\", nil, &NotifyServiceFactory{})\n}", "title": "" }, { "docid": "8b2cc4a3524d08d5a2ecc15c6b0a68fe", "score": "0.51670545", "text": "func Registry(r registry.IRegistry) Option {\n\treturn func(cfg *Config) {\n\t\tr.Init(registry.WithConfigPrefixName(cfg.String()))\n\t\tcfg.Registry = r\n\t\tcfg.Router.Config().Registry = r\n\t\tcfg.Router.Config().RegistryCacher = cacher.New(r)\n\t\tcfg.RegistryType = r.Config().Name\n\t\t///cfg.RegistryHost = r.Config(). // FIXME\n\n\t\t// Update Broker\n\t\tif cfg.Broker != nil {\n\t\t\tcfg.Broker.Init(broker.Registry(r))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "38d4dfe68b0fcd0441e2609b232bca47", "score": "0.51410234", "text": "func (c *RestService) Register() {\n\t// Override in child classes\n\tc.Overrides.Register()\n}", "title": "" }, { "docid": "d6d186a84c5e18c55ec7ac6f948eb08c", "score": "0.5020395", "text": "func (cs *ChainService) Registry() *protocol.Registry { return cs.registry }", "title": "" }, { "docid": "c36b198ec165b545401148b3f375c3d9", "score": "0.50188345", "text": "func init() {\n\tprocessors.Add(\"k8sdecorator\", func() telegraf.Processor {\n\t\treturn &K8sDecorator{TagService: true}\n\t})\n}", "title": "" }, { "docid": "74c590197fd864a8ecc3df2036efcc2e", "score": "0.495308", "text": "func Initialize(serviceDef types.Service) (service registry.Service, err error) {\n\tfactory := registry.Lookup(serviceDef.Type)\n\tif factory == nil {\n\t\treturn nil, errors.New(\"unknown service type\")\n\t}\n\treturn factory.Make(serviceDef.Name, serviceDef.Settings)\n\n\t/*switch sType := serviceDef.Type; sType {\n\tcase \"http\":\n\t\treturn InitializeHTTP(serviceDef.Settings)\n\tcase \"js\":\n\t\treturn InitializeJS(serviceDef.Settings)\n\tcase \"flogoActivity\":\n\t\treturn InitializeFlogoActivity(serviceDef.Settings)\n\tcase \"flogoFlow\":\n\t\treturn InitializeFlogoFlow(serviceDef.Settings)\n\tcase \"sqld\":\n\t\treturn InitializeSQLD(serviceDef.Settings)\n\tcase \"grpc\":\n\t\treturn grpc.InitializeGRPC(serviceDef.Settings)\n\tcase \"circuitBreaker\":\n\t\treturn InitializeCircuitBreaker(serviceDef.Settings)\n\tcase \"anomaly\":\n\t\treturn InitializeAnomaly(serviceDef.Settings)\n\tcase \"jwt\":\n\t\treturn InitializeJWT(serviceDef.Settings)\n\tcase \"ws\":\n\t\treturn wsproxy.InitializeWSProxy(serviceDef.Name, serviceDef.Settings)\n\tcase \"ratelimiter\":\n\t\treturn InitializeRateLimiter(serviceDef.Name, serviceDef.Settings)\n\tdefault:\n\t\treturn nil, errors.New(\"unknown service type\")\n\t}*/\n}", "title": "" }, { "docid": "f4e494355fc1bb0fe66593e8bae3e8af", "score": "0.4916515", "text": "func (ps *PushContext) initServiceRegistry(env *Environment) error {\n\tservices, err := env.Services()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Sort the services in order of creation.\n\tallServices := sortServicesByCreationTime(services)\n\tfor _, s := range allServices {\n\t\tns := s.Attributes.Namespace\n\t\tif len(s.Attributes.ExportTo) == 0 {\n\t\t\tif ps.defaultServiceExportTo[visibility.Private] {\n\t\t\t\tps.privateServicesByNamespace[ns] = append(ps.privateServicesByNamespace[ns], s)\n\t\t\t} else if ps.defaultServiceExportTo[visibility.Public] {\n\t\t\t\tps.publicServices = append(ps.publicServices, s)\n\t\t\t}\n\t\t} else {\n\t\t\tif s.Attributes.ExportTo[visibility.Private] {\n\t\t\t\tps.privateServicesByNamespace[ns] = append(ps.privateServicesByNamespace[ns], s)\n\t\t\t} else {\n\t\t\t\tps.publicServices = append(ps.publicServices, s)\n\t\t\t}\n\t\t}\n\t\tif _, f := ps.ServiceByHostnameAndNamespace[s.Hostname]; !f {\n\t\t\tps.ServiceByHostnameAndNamespace[s.Hostname] = map[string]*Service{}\n\t\t}\n\t\tps.ServiceByHostnameAndNamespace[s.Hostname][s.Attributes.Namespace] = s\n\t}\n\n\tps.initServiceAccounts(env, allServices)\n\n\treturn nil\n}", "title": "" }, { "docid": "9a0f3265c5220d99f0697ceb1e6897df", "score": "0.4851258", "text": "func (r *registry) newService() *core.Service {\n\treturn new(ServiceBuilder).\n\t\tWithMeta(r.csc.GetName(), r.csc.GetNamespace()).\n\t\tWithOwnerLabel(r.csc.CatalogSourceConfig).\n\t\tWithSpec(r.newServiceSpec()).\n\t\tService()\n}", "title": "" }, { "docid": "5231052f6c16a14d75ea0a2f6ee8390d", "score": "0.48476484", "text": "func NewRegistryBase(config *RegistryConfig) InternalRegistry {\n\tr := &RegistryBase{\n\t\tsession: config.MgoSession,\n\t\tredis: config.RedisClient,\n\t\thydra: config.HydraAdminApi,\n\t\tmfa: config.MfaService,\n\t\tmailer: config.Mailer,\n\t\tgeo: config.GeoIpService,\n\t\tott: NewOneTimeTokenService(config.RedisClient),\n\t\tlts: NewLauncherTokenService(config.RedisClient),\n\t\tcent: config.CentrifugoService,\n\t\tspaces: config.Spaces,\n\t}\n\tr.as = NewApplicationService(r)\n\n\treturn r\n}", "title": "" }, { "docid": "80fbff9103a74cba8235db3c7d240f92", "score": "0.4839477", "text": "func init() {\n\tresolver.Register(&consulBuilder{})\n}", "title": "" }, { "docid": "04c1227664540112c5ec0d008d9a8a64", "score": "0.48362786", "text": "func Start() {\n\tarch := \"netflixoss\"\n\tlistener = make(chan gotocol.Message) // listener for netflixoss\n\teurekachan = make(chan gotocol.Message, archaius.Conf.Population) // listener for netflixoss\n\tif archaius.Conf.Population < 1 {\n\t\tlog.Fatal(\"netflixoss: can't create less than 1 microservice\")\n\t} else {\n\t\tlog.Printf(\"netflixoss: scaling to %v%%\", archaius.Conf.Population)\n\t}\n\t// create map of channels\n\tnoodles = make(map[string]chan gotocol.Message, archaius.Conf.Population)\n\n\t// start the service registry first, TODO needs to be one per region\n\tgo eureka.Start(eurekachan, \"netflixoss.eureka\")\n\n\t// we need a DNS service to create a global multi-region architecture\n\tdnsname := names.Make(arch, \"*\", \"*\", \"global-api-dns\", \"denominator\", 0)\n\tnoodles[dnsname] = make(chan gotocol.Message)\n\tgo denominator.Start(noodles[dnsname])\n\t// setup the dns name and logging, set chat rate after everything else is started\n\tnoodles[dnsname] <- gotocol.Message{gotocol.Hello, listener, time.Now(), dnsname}\n\tnoodles[dnsname] <- gotocol.Message{gotocol.Inform, eurekachan, time.Now(), \"\"}\n\t// pause at this point to generate partial config for demonstrations\n\tif archaius.Conf.StopStep == 1 {\n\t\trun(dnsname)\n\t\treturn\n\t}\n\n\t// Build the configuration bottom up\n\n\t// we need elb as a front end in each region to spread request traffic around each endpoint\n\trnames := [...]string{\"us-east-1\", \"us-west-2\", \"eu-west-1\", \"eu-east-1\", \"ap-south-1\", \"ap-south-2\"}\n\t// remember them in the global config\n\tfor i, s := range rnames {\n\t\tarchaius.Conf.RegionNames[i] = s\n\t}\n\t// netflixoss always needs three zones\n\tznames := [...]string{\"zoneA\", \"zoneB\", \"zoneC\"}\n\t// elb for api endpoint\n\telbcnt := 0\n\t// cross region cassandra cluster names need to scope outside loop\n\tcname := \"cassTurtle\"\n\tcpkg := \"priamCassandra\"\n\tfor r := 0; r < archaius.Conf.Regions; r++ {\n\t\trname := rnames[r]\n\t\telbname := names.Make(arch, rname, \"ABC\", \"api-elb\", \"elb\", elbcnt)\n\t\telbcnt++\n\t\tnoodles[elbname] = make(chan gotocol.Message)\n\t\tgo elb.Start(noodles[elbname])\n\t\t// setup the elb's name and logging, set chat rate after everything else is started\n\t\tnoodles[elbname] <- gotocol.Message{gotocol.Hello, listener, time.Now(), elbname}\n\t\tnoodles[elbname] <- gotocol.Message{gotocol.Inform, eurekachan, time.Now(), \"\"}\n\t\t// tell denominator how to talk to the elb\n\t\tnoodles[dnsname] <- gotocol.Message{gotocol.NameDrop, noodles[elbname], time.Now(), elbname}\n\t\tif archaius.Conf.StopStep == 2 {\n\t\t\trun(dnsname)\n\t\t\treturn\n\t\t}\n\n\t\t// start first priam managed Cassandra cluster, turtle because it's used to configure other clusters\n\t\tpriamCassandracount := 12 * archaius.Conf.Population / 100\n\t\tfor i := r * priamCassandracount; i < (r+1)*priamCassandracount; i++ {\n\t\t\tpriamCassandraname := names.Make(arch, rname, znames[i%3], cname, cpkg, i)\n\t\t\tnoodles[priamCassandraname] = make(chan gotocol.Message)\n\t\t\tgo priamCassandra.Start(noodles[priamCassandraname])\n\t\t\tnoodles[priamCassandraname] <- gotocol.Message{gotocol.Hello, listener, time.Now(), priamCassandraname}\n\t\t\tnoodles[priamCassandraname] <- gotocol.Message{gotocol.Inform, eurekachan, time.Now(), \"\"}\n\t\t}\n\n\t\tif archaius.Conf.StopStep == 3 {\n\t\t\trun(dnsname)\n\t\t\treturn\n\t\t}\n\n\t\t// make the cross zone priamCassandra connections, assumes staash/astayanax ring aware client routing\n\t\tfor i := r * priamCassandracount; i < (r+1)*priamCassandracount; i++ {\n\t\t\tpriamCassandraZ0 := names.Make(arch, rname, znames[i%3], cname, cpkg, i)\n\t\t\tpriamCassandraZ1 := names.Make(arch, rname, znames[(i+1)%3], cname, cpkg, r*priamCassandracount+(i+1)%priamCassandracount)\n\t\t\tnoodles[priamCassandraZ0] <- gotocol.Message{gotocol.NameDrop, noodles[priamCassandraZ1], time.Now(), priamCassandraZ1}\n\t\t\tpriamCassandraZ2 := names.Make(arch, rname, znames[(i+2)%3], cname, cpkg, r*priamCassandracount+(i+2)%priamCassandracount)\n\t\t\tnoodles[priamCassandraZ0] <- gotocol.Message{gotocol.NameDrop, noodles[priamCassandraZ2], time.Now(), priamCassandraZ2}\n\t\t}\n\n\t\tif archaius.Conf.StopStep == 4 {\n\t\t\trun(dnsname)\n\t\t\treturn\n\t\t}\n\n\t\t// start staash data access layer\n\t\tstaashcount := 6 * archaius.Conf.Population / 100\n\t\tsname := \"turtle\"\n\t\tspkg := \"staash\"\n\t\tfor i := r * staashcount; i < (r+1)*staashcount; i++ {\n\t\t\tstaashname := names.Make(arch, rname, znames[i%3], sname, spkg, i)\n\t\t\tnoodles[staashname] = make(chan gotocol.Message)\n\t\t\tgo staash.Start(noodles[staashname])\n\t\t\tnoodles[staashname] <- gotocol.Message{gotocol.Hello, listener, time.Now(), staashname}\n\t\t\tnoodles[staashname] <- gotocol.Message{gotocol.Inform, eurekachan, time.Now(), \"\"}\n\t\t\t// connect all the staash in a zone to all priamCassandra in that zone only\n\t\t\tfor j := r*priamCassandracount + i%3; j < (r+1)*priamCassandracount; j = j + 3 {\n\t\t\t\tpc := names.Make(arch, rname, znames[i%3], cname, cpkg, j)\n\t\t\t\tnoodles[staashname] <- gotocol.Message{gotocol.NameDrop, noodles[pc], time.Now(), pc}\n\t\t\t}\n\t\t}\n\t\tif archaius.Conf.StopStep == 5 {\n\t\t\trun(dnsname)\n\t\t\treturn\n\t\t}\n\n\t\t// start api business logic, we can create a network of simple services from the karyon package\n\t\tapicount := 27 * archaius.Conf.Population / 100\n\t\taname := \"api\"\n\t\tapkg := \"karyon\"\n\t\tfor i := r * apicount; i < (r+1)*apicount; i++ {\n\t\t\tapiname := names.Make(arch, rname, znames[i%3], aname, apkg, i)\n\t\t\tnoodles[apiname] = make(chan gotocol.Message)\n\t\t\tgo karyon.Start(noodles[apiname])\n\t\t\tnoodles[apiname] <- gotocol.Message{gotocol.Hello, listener, time.Now(), apiname}\n\t\t\tnoodles[apiname] <- gotocol.Message{gotocol.Inform, eurekachan, time.Now(), \"\"}\n\t\t\t// connect all the api in a zone to all staash in that zone only\n\t\t\tfor j := r*staashcount + i%3; j < (r+1)*staashcount; j = j + 3 {\n\t\t\t\ts := names.Make(arch, rname, znames[i%3], sname, spkg, j)\n\t\t\t\tnoodles[apiname] <- gotocol.Message{gotocol.NameDrop, noodles[s], time.Now(), s}\n\t\t\t}\n\t\t}\n\n\t\tif archaius.Conf.StopStep == 6 {\n\t\t\trun(dnsname)\n\t\t\treturn\n\t\t}\n\n\t\t// start zuul api proxies\n\t\tzuulcount := 9 * archaius.Conf.Population / 100\n\t\tzuname := \"apiproxy\"\n\t\tzupkg := \"zuul\"\n\t\tfor i := r * zuulcount; i < (r+1)*zuulcount; i++ {\n\t\t\tzuulname := names.Make(arch, rname, znames[i%3], zuname, zupkg, i)\n\t\t\tnoodles[zuulname] = make(chan gotocol.Message)\n\t\t\tgo zuul.Start(noodles[zuulname])\n\t\t\tnoodles[zuulname] <- gotocol.Message{gotocol.Hello, listener, time.Now(), zuulname}\n\t\t\tnoodles[zuulname] <- gotocol.Message{gotocol.Inform, eurekachan, time.Now(), \"\"}\n\t\t\t// connect all the zuul in a zone to all api in that zone only\n\t\t\tfor j := r*apicount + i%3; j < (r+1)*apicount; j = j + 3 {\n\t\t\t\ta := names.Make(arch, rname, znames[i%3], aname, apkg, j)\n\t\t\t\tnoodles[zuulname] <- gotocol.Message{gotocol.NameDrop, noodles[a], time.Now(), a}\n\t\t\t}\n\t\t\t// hook all the zuul proxies up to the elb in this region\n\t\t\tnoodles[elbname] <- gotocol.Message{gotocol.NameDrop, noodles[zuulname], time.Now(), zuulname}\n\t\t}\n\t}\n\n\t// stop here for 7 for single region, then add second region for step 8, then join them for 9\n\tif archaius.Conf.StopStep == 7 || archaius.Conf.StopStep == 8 {\n\t\trun(dnsname)\n\t\treturn\n\t}\n\t// Connect cross region Cassandra\n\tpriamCassandracount := 12 * archaius.Conf.Population / 100\n\tif archaius.Conf.Regions > 1 {\n\t\t// for each region\n\t\tfor r := 0; r < archaius.Conf.Regions; r++ {\n\t\t\t// for each priamCassandrian in that region\n\t\t\tfor i := r * priamCassandracount; i < (r+1)*priamCassandracount; i++ {\n\t\t\t\tpC := names.Make(arch, rnames[r], znames[i%3], cname, cpkg, i)\n\t\t\t\t// for each of the other regions connect to one node\n\t\t\t\tfor j := 1; j < archaius.Conf.Regions; j++ {\n\t\t\t\t\tpCindex := (i + j*priamCassandracount) % (archaius.Conf.Regions * priamCassandracount)\n\t\t\t\t\tpCremote := names.Make(arch, rnames[(r+1)%archaius.Conf.Regions], znames[pCindex%3], cname, cpkg, pCindex)\n\t\t\t\t\tnoodles[pC] <- gotocol.Message{gotocol.NameDrop, noodles[pCremote], time.Now(), pCremote}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\trun(dnsname)\n}", "title": "" }, { "docid": "fd5a26d43521877dd46b85b23648ff4c", "score": "0.48106202", "text": "func init() {\n\tSchemeBuilder.Register(&ServiceMeshMemberRoll{}, &ServiceMeshMemberRollList{})\n}", "title": "" }, { "docid": "867aa74e358c533a9b0903d83cc70391", "score": "0.4749622", "text": "func (s *DeviceService) selfRegister() error {\n\taddr, err := s.createAndUpdateAddressable()\n\tif err != nil {\n\t\ts.LoggingClient.Error(fmt.Sprintf(\"createAndUpdateAddressable failed: %v\", err))\n\t\treturn err\n\t}\n\n\tnewDeviceService := contract.DeviceService{\n\t\tName: s.ServiceName,\n\t\tLabels: s.config.Service.Labels,\n\t\tOperatingState: contract.Enabled,\n\t\tAddressable: *addr,\n\t\tAdminState: contract.Unlocked,\n\t}\n\tnewDeviceService.Origin = time.Now().UnixNano() / int64(time.Millisecond)\n\n\tctx := context.WithValue(context.Background(), common.CorrelationHeader, uuid.New().String())\n\ts.LoggingClient.Debug(\"Trying to find DeviceService: \" + s.ServiceName)\n\tds, err := s.edgexClients.DeviceServiceClient.DeviceServiceForName(ctx, s.ServiceName)\n\tif err != nil {\n\t\tif errsc, ok := err.(types.ErrServiceClient); ok && (errsc.StatusCode == http.StatusNotFound) {\n\t\t\ts.LoggingClient.Info(fmt.Sprintf(\"DeviceService %s doesn't exist, creating a new one\", s.ServiceName))\n\t\t\tid, err := s.edgexClients.DeviceServiceClient.Add(ctx, &newDeviceService)\n\t\t\tif err != nil {\n\t\t\t\ts.LoggingClient.Error(fmt.Sprintf(\"Failed to add Deviceservice %s: %v\", s.ServiceName, err))\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err = common.VerifyIdFormat(id, \"Device Service\"); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// NOTE - this differs from Addressable and Device Resources,\n\t\t\t// neither of which require the '.Service'prefix\n\t\t\tnewDeviceService.Id = id\n\t\t\ts.LoggingClient.Debug(\"New DeviceService Id: \" + newDeviceService.Id)\n\t\t} else {\n\t\t\ts.LoggingClient.Error(fmt.Sprintf(\"DeviceServicForName failed: %v\", err))\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\ts.LoggingClient.Info(fmt.Sprintf(\"DeviceService %s exists, updating it\", ds.Name))\n\t\terr = s.edgexClients.DeviceServiceClient.Update(ctx, newDeviceService)\n\t\tif err != nil {\n\t\t\ts.LoggingClient.Error(fmt.Sprintf(\"Failed to update DeviceService %s: %v\", newDeviceService.Name, err))\n\t\t\t// use the existed one to at least make sure config is in sync with metadata.\n\t\t\tnewDeviceService = ds\n\t\t}\n\t\tnewDeviceService.Id = ds.Id\n\t}\n\n\ts.deviceService = &newDeviceService\n\treturn nil\n}", "title": "" }, { "docid": "c1400afce8eeec1ff3c3703987c1f7dd", "score": "0.47381398", "text": "func (c *Pattern) Registry(service string) *Pattern {\n\tc.publish = true\n\tc.Service = service\n\treturn c\n}", "title": "" }, { "docid": "b5b8ce88a1df7165f48ba7c63fbd8e37", "score": "0.47326127", "text": "func Register(s *Service, opts ...RegisterOption) error {\n\treturn DefaultRegistry.Register(s, opts...)\n}", "title": "" }, { "docid": "34670de9575a9fa738507cee3c05fc7e", "score": "0.4731783", "text": "func InheritRestService(overrides IRestServiceOverrides) *RestService {\n\trs := RestService{\n\t\tOverrides: overrides,\n\t}\n\trs.defaultConfig = cconf.NewConfigParamsFromTuples(\n\t\t\"base_route\", \"\",\n\t\t\"dependencies.endpoint\", \"*:endpoint:http:*:1.0\",\n\t\t\"dependencies.swagger\", \"*:swagger-service:*:*:1.0\",\n\t)\n\trs.DependencyResolver = crefer.NewDependencyResolver()\n\trs.DependencyResolver.Configure(rs.defaultConfig)\n\trs.Logger = clog.NewCompositeLogger()\n\trs.Counters = ccount.NewCompositeCounters()\n\trs.Tracer = ctrace.NewCompositeTracer(nil)\n\trs.SwaggerEnabled = false\n\trs.SwaggerRoute = \"swagger\"\n\treturn &rs\n}", "title": "" }, { "docid": "7d2b32d9eef90376f4813a66edc2af89", "score": "0.4726286", "text": "func (ep *ServiceControlEndpoint) Use() {}", "title": "" }, { "docid": "1f719b25e5270e8a8ebd5a1924a72d24", "score": "0.46876767", "text": "func NewService(c Config) *Service {\n \n s := &Service{}\n s.instance = c.Instance\n s.hostname = c.Hostname\n s.userAgent = c.UserAgent\n s.port = c.Endpoint\n s.router = mux.NewRouter()\n s.entityHandler = c.EntityHandler\n \n if c.Name == \"\" {\n s.name = \"service\"\n }else{\n s.name = c.Name\n }\n \n if c.Debug || os.Getenv(\"GOREST_DEBUG\") == \"true\" {\n s.debug = true\n }\n \n if c.TraceRegexps != nil {\n s.traceRequests = make(map[string]*regexp.Regexp)\n for _, e := range c.TraceRegexps {\n s.traceRequests[e.String()] = e\n }\n }\n \n return s\n}", "title": "" }, { "docid": "2f1b4b79c4aa998a483077898c51b93e", "score": "0.46797478", "text": "func (kong *KongGateway) SelfRegister() error {\n\t// err := kong.createOrUpdateUpstream(kong.config.VirtualHost, kong.config.ServicesMaxSlots)\n\t// if err != nil {\n\t// \treturn err\n\t// }\n\n\tapiConf := NewAPIConf()\n\t// TODO: map here from config\n\tapiConf.Name = kong.config.MicroserviceName\n\tapiConf.Hosts = kong.config.Hosts\n\tapiConf.UpstreamURL = fmt.Sprintf(\"http://%s:%d\", kong.config.VirtualHost, kong.config.MicroservicePort)\n\tapiConf.URIs = kong.config.Paths\n\t_, err := kong.createOrUpdateAPI(apiConf)\n\treturn err\n\n\t// _, err = kong.addSelfAsTarget(kong.config.VirtualHost, kong.config.MicroservicePort, kong.config.Weight)\n\t// return err\n}", "title": "" }, { "docid": "883273eccdc791bb61c1499e8915b3b2", "score": "0.4665983", "text": "func (_Vesting *VestingCallerSession) Registry() (common.Address, error) {\n\treturn _Vesting.Contract.Registry(&_Vesting.CallOpts)\n}", "title": "" }, { "docid": "f9e5f0edb6f3c73b297d886a810fe7aa", "score": "0.46357152", "text": "func New(config Config) (*Service, error) {\n\t// Settings.\n\tif config.Flag == nil {\n\t\treturn nil, microerror.Maskf(invalidConfigError, \"config.Flag must not be empty\")\n\t}\n\tif config.Viper == nil {\n\t\treturn nil, microerror.Maskf(invalidConfigError, \"config.Viper must not be empty\")\n\t}\n\n\t// Dependencies.\n\tif config.Logger == nil {\n\t\treturn nil, microerror.Maskf(invalidConfigError, \"logger must not be empty\")\n\t}\n\n\tvar err error\n\n\tvar restConfig *rest.Config\n\t{\n\t\tc := k8srestconfig.Config{\n\t\t\tLogger: config.Logger,\n\n\t\t\tAddress: config.Viper.GetString(config.Flag.Service.Kubernetes.Address),\n\t\t\tInCluster: config.Viper.GetBool(config.Flag.Service.Kubernetes.InCluster),\n\t\t\tTLS: k8srestconfig.TLSClientConfig{\n\t\t\t\tCAFile: config.Viper.GetString(config.Flag.Service.Kubernetes.TLS.CAFile),\n\t\t\t\tCrtFile: config.Viper.GetString(config.Flag.Service.Kubernetes.TLS.CrtFile),\n\t\t\t\tKeyFile: config.Viper.GetString(config.Flag.Service.Kubernetes.TLS.KeyFile),\n\t\t\t},\n\t\t}\n\n\t\trestConfig, err = k8srestconfig.New(c)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\t}\n\n\tg8sClient, err := versioned.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn nil, microerror.Mask(err)\n\t}\n\n\tk8sClient, err := kubernetes.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn nil, microerror.Mask(err)\n\t}\n\n\tk8sExtClient, err := apiextensionsclient.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn nil, microerror.Mask(err)\n\t}\n\n\tvar clusterFramework *framework.Framework\n\t{\n\t\tc := awsconfig.ClusterFrameworkConfig{\n\t\t\tG8sClient: g8sClient,\n\t\t\tK8sClient: k8sClient,\n\t\t\tK8sExtClient: k8sExtClient,\n\t\t\tLogger: config.Logger,\n\n\t\t\tGuestAWSConfig: awsconfig.FrameworkConfigAWSConfig{\n\t\t\t\tAccessKeyID: config.Viper.GetString(config.Flag.Service.AWS.AccessKey.ID),\n\t\t\t\tAccessKeySecret: config.Viper.GetString(config.Flag.Service.AWS.AccessKey.Secret),\n\t\t\t\tSessionToken: config.Viper.GetString(config.Flag.Service.AWS.AccessKey.Session),\n\t\t\t\tRegion: config.Viper.GetString(config.Flag.Service.AWS.Region),\n\t\t\t},\n\t\t\tGuestUpdateEnabled: config.Viper.GetBool(config.Flag.Service.Guest.Update.Enabled),\n\t\t\tHostAWSConfig: awsconfig.FrameworkConfigAWSConfig{\n\t\t\t\tAccessKeyID: config.Viper.GetString(config.Flag.Service.AWS.HostAccessKey.ID),\n\t\t\t\tAccessKeySecret: config.Viper.GetString(config.Flag.Service.AWS.HostAccessKey.Secret),\n\t\t\t\tSessionToken: config.Viper.GetString(config.Flag.Service.AWS.HostAccessKey.Session),\n\t\t\t\tRegion: config.Viper.GetString(config.Flag.Service.AWS.Region),\n\t\t\t},\n\t\t\tInstallationName: config.Viper.GetString(config.Flag.Service.Installation.Name),\n\t\t\tOIDC: awsconfig.FrameworkConfigOIDCConfig{\n\t\t\t\tClientID: config.Viper.GetString(config.Flag.Service.Installation.Guest.Kubernetes.API.Auth.Provider.OIDC.ClientID),\n\t\t\t\tIssuerURL: config.Viper.GetString(config.Flag.Service.Installation.Guest.Kubernetes.API.Auth.Provider.OIDC.IssuerURL),\n\t\t\t\tUsernameClaim: config.Viper.GetString(config.Flag.Service.Installation.Guest.Kubernetes.API.Auth.Provider.OIDC.UsernameClaim),\n\t\t\t\tGroupsClaim: config.Viper.GetString(config.Flag.Service.Installation.Guest.Kubernetes.API.Auth.Provider.OIDC.GroupsClaim),\n\t\t\t},\n\t\t\tProjectName: config.ProjectName,\n\t\t\tPubKeyFile: config.Viper.GetString(config.Flag.Service.AWS.PubKeyFile),\n\t\t}\n\n\t\tclusterFramework, err = awsconfig.NewClusterFramework(c)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\t}\n\n\tvar drainerFramework *framework.Framework\n\t{\n\t\tc := awsconfig.DrainerFrameworkConfig{\n\t\t\tG8sClient: g8sClient,\n\t\t\tK8sClient: k8sClient,\n\t\t\tK8sExtClient: k8sExtClient,\n\t\t\tLogger: config.Logger,\n\n\t\t\tAWS: awsconfig.DrainerFrameworkConfigAWS{\n\t\t\t\tAccessKeyID: config.Viper.GetString(config.Flag.Service.AWS.AccessKey.ID),\n\t\t\t\tAccessKeySecret: config.Viper.GetString(config.Flag.Service.AWS.AccessKey.Secret),\n\t\t\t\tSessionToken: config.Viper.GetString(config.Flag.Service.AWS.AccessKey.Session),\n\t\t\t\tRegion: config.Viper.GetString(config.Flag.Service.AWS.Region),\n\t\t\t},\n\t\t\tGuestUpdateEnabled: config.Viper.GetBool(config.Flag.Service.Guest.Update.Enabled),\n\t\t\tProjectName: config.ProjectName,\n\t\t}\n\n\t\tdrainerFramework, err = awsconfig.NewDrainerFramework(c)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\t}\n\n\tvar awsConfig awsclient.Config\n\t{\n\t\tawsConfig = awsclient.Config{\n\t\t\tAccessKeyID: config.Viper.GetString(config.Flag.Service.AWS.AccessKey.ID),\n\t\t\tAccessKeySecret: config.Viper.GetString(config.Flag.Service.AWS.AccessKey.Secret),\n\t\t\tSessionToken: config.Viper.GetString(config.Flag.Service.AWS.AccessKey.Session),\n\t\t}\n\t}\n\n\tvar alerterService *alerter.Service\n\t{\n\t\t// Set the region, in the operator this comes from the cluster object.\n\t\tawsConfig.Region = config.Viper.GetString(config.Flag.Service.AWS.Region)\n\n\t\talerterConfig := alerter.DefaultConfig()\n\t\talerterConfig.AwsConfig = awsConfig\n\t\talerterConfig.InstallationName = config.Viper.GetString(config.Flag.Service.Installation.Name)\n\t\talerterConfig.G8sClient = g8sClient\n\t\talerterConfig.Logger = config.Logger\n\n\t\talerterService, err = alerter.New(alerterConfig)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\t}\n\n\tvar healthzService *healthz.Service\n\t{\n\t\tc := healthz.Config{\n\t\t\tAwsConfig: awsConfig,\n\t\t\tLogger: config.Logger,\n\t\t}\n\t\thealthzService, err = healthz.New(c)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\t}\n\n\tvar versionService *version.Service\n\t{\n\t\tversionConfig := version.DefaultConfig()\n\n\t\tversionConfig.Description = config.Description\n\t\tversionConfig.GitCommit = config.GitCommit\n\t\tversionConfig.Name = config.ProjectName\n\t\tversionConfig.Source = config.Source\n\t\tversionConfig.VersionBundles = NewVersionBundles()\n\n\t\tversionService, err = version.New(versionConfig)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\t}\n\n\tnewService := &Service{\n\t\t// Dependencies.\n\t\tAlerter: alerterService,\n\t\tClusterFramework: clusterFramework,\n\t\tDrainerFramework: drainerFramework,\n\t\tHealthz: healthzService,\n\t\tVersion: versionService,\n\n\t\t// Internals\n\t\tbootOnce: sync.Once{},\n\t}\n\n\treturn newService, nil\n}", "title": "" }, { "docid": "c232488d5535a2b13f755da011fbc753", "score": "0.46318242", "text": "func main() {\n\n\tcountWorker := &qdstemplate.AQdsService{\n\t\tGRPCPortToListen: \"50051\",\n\t\tHostName: aux.GetHostname(),\n\t\tLogLevel: log.WarnLevel,\n\t\tRegisterURL: qdstemplate.EurekaURL,\n\t\tTTL: qdstemplate.EurekaTTL,\n\t}\n\n\topts.New(countWorker).\n\t\tRepo(\"github.com/theovassiliou/doctrans\").\n\t\tVersion(version).\n\t\tParse()\n\n\tif countWorker.LogLevel != 0 {\n\t\tlog.SetLevel(countWorker.LogLevel)\n\t}\n\n\tif countWorker.IsSSL {\n\t\tlog.Warnln(\"SSL currently not support. Ignoring,\")\n\t\tcountWorker.IsSSL = false\n\t}\n\n\t// 1. Load config\n\t// a. load service name\n\t// service name build in\n\t// b. get galaxy name\n\t// read from command line\n\n\t// c. get grpc ports / get REST ports\n\t// default ports\n\t// GRPC/GRPCS: 50051/60051\n\t// HTTP/HTTPS : 80 / 8080\n\n\t// enable optional SSL\n\n\t// 2. Start GRPC and/or REST\n\n\t// 3. Register @ Registry\n\t// \"http://127.0.0.1:8761/eureka\"\n\n\t// 4. Enable signals\n\n\t// (1) SetUp Configuration\n\t//\tpb.SetupConfiguration(dts, workingHomeDir, VERSION)\n\n\t// init the resolver so that we have access to the list of apps\n\n\t// (2) Init and register GRPC Service\n\t// We first create the listener to know the dynamically allocated port we listen on\n\t_configuredPort := countWorker.GRPCPortToListen\n\n\tlis, assignedPort := countWorker.CreateListener()\n\tif _configuredPort != assignedPort {\n\t\tlog.Warnf(\"Listing on port %v instead on configured, but port-inuse %v\\n\", assignedPort, _configuredPort)\n\t}\n\n\tcountWorker.GRPCPortToListen = assignedPort\n\n\tif countWorker.Register {\n\n\t\tcountWorker.SetRegistry(eureka.NewClient([]string{\n\t\t\tcountWorker.RegisterURL,\n\t\t\t// add others servers here\n\t\t}))\n\n\t\tcountWorker.RegisterGRPCService(serviceName, aux.GetIPAdress())\n\n\t\tjob := countWorker.GetHearbeatFunc()\n\t\t// Run every 25 seconds but not now.\n\t\thbj, _ := scheduler.Every(int(countWorker.TTL)).Seconds().NotImmediately().Run(job)\n\t\tcountWorker.SetHeartBeatJob(hbj)\n\t}\n\n\tvar impl = count.Implementation{}\n\n\tgo func() {\n\t\ts := grpc.NewServer()\n\t\tpb.RegisterDTAServerServer(s, impl)\n\t\tif err := s.Serve(lis); err != nil {\n\t\t\tlog.WithFields(log.Fields{\"Service\": \"Registrar\", \"Status\": \"Abort\"}).Fatalf(\"failed to serve: %v\", err)\n\t\t}\n\t}()\n\n\tif countWorker.REST {\n\t\t//(3) Let's instanciate the the HTTP Server\n\t\t// FIXME: Reimplement signals\n\t\t// qdsservices.CaptureSignals(dts)\n\n\t\tctx := context.Background()\n\t\tctx, cancel := context.WithCancel(ctx)\n\t\tdefer cancel()\n\t\t_configuredHTTPPort := countWorker.HTTPPort\n\n\t\tassignedHTTPPort := countWorker.RegisterHTTPService(ctx)\n\n\t\tif _configuredHTTPPort != assignedHTTPPort {\n\t\t\tlog.Warnf(\"Listing on port %v instead on configured, but port-inuse %v\\n\", assignedPort, _configuredPort)\n\t\t}\n\t\tcountWorker.HTTPPort = assignedHTTPPort\n\n\t\t// FIXME: Continue here\n\t}\n\t// else {\n\t// \tsignalCh := make(chan os.Signal)\n\t// \tsignal.Notify(signalCh, os.Interrupt, syscall.SIGTERM, syscall.SIGINT)\n\t// \tqdsservices.HandleSignals(dts, signalCh)\n\t// }\n\treturn\n}", "title": "" }, { "docid": "ff8e4f2cd1e9f2f2087b997cfe541379", "score": "0.46240783", "text": "func (p *Provider) buildConfigurationV1(instances []ecsInstance) (*types.Configuration, error) {\n\tservices := make(map[string][]ecsInstance)\n\tfor _, instance := range instances {\n\t\tbackendName := getBackendNameV1(instance)\n\t\tif p.filterInstanceV1(instance) {\n\t\t\tif serviceInstances, ok := services[backendName]; ok {\n\t\t\t\tservices[backendName] = append(serviceInstances, instance)\n\t\t\t} else {\n\t\t\t\tservices[backendName] = []ecsInstance{instance}\n\t\t\t}\n\t\t}\n\t}\n\n\tvar ecsFuncMap = template.FuncMap{\n\t\t// Backend functions\n\t\t\"getHost\": getHost,\n\t\t\"getPort\": getPort,\n\n\t\t\"getProtocol\": getFuncStringValueV1(label.TraefikProtocol, label.DefaultProtocol),\n\t\t\"getWeight\": getFuncIntValueV1(label.TraefikWeight, label.DefaultWeight),\n\t\t\"getLoadBalancerMethod\": getFuncFirstStringValueV1(label.TraefikBackendLoadBalancerMethod, label.DefaultBackendLoadBalancerMethod),\n\t\t\"getLoadBalancerSticky\": getStickyV1,\n\t\t\"hasStickinessLabel\": getFuncFirstBoolValueV1(label.TraefikBackendLoadBalancerStickiness, false),\n\t\t\"getStickinessCookieName\": getFuncFirstStringValueV1(label.TraefikBackendLoadBalancerStickinessCookieName, label.DefaultBackendLoadbalancerStickinessCookieName),\n\t\t\"hasHealthCheckLabels\": hasFuncFirstV1(label.TraefikBackendHealthCheckPath),\n\t\t\"getHealthCheckPath\": getFuncFirstStringValueV1(label.TraefikBackendHealthCheckPath, \"\"),\n\t\t\"getHealthCheckInterval\": getFuncFirstStringValueV1(label.TraefikBackendHealthCheckInterval, \"\"),\n\n\t\t// Frontend functions\n\t\t\"filterFrontends\": filterFrontendsV1,\n\t\t\"getFrontendRule\": p.getFrontendRuleV1,\n\t\t\"getPassHostHeader\": getFuncBoolValueV1(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),\n\t\t\"getPassTLSCert\": getFuncBoolValueV1(label.TraefikFrontendPassTLSCert, label.DefaultPassTLSCert),\n\t\t\"getPriority\": getFuncIntValueV1(label.TraefikFrontendPriority, label.DefaultFrontendPriority),\n\t\t\"getBasicAuth\": getFuncSliceStringV1(label.TraefikFrontendAuthBasic),\n\t\t\"getEntryPoints\": getFuncSliceStringV1(label.TraefikFrontendEntryPoints),\n\t}\n\n\treturn p.GetConfiguration(\"templates/ecs-v1.tmpl\", ecsFuncMap, struct {\n\t\tServices map[string][]ecsInstance\n\t}{\n\t\tServices: services,\n\t})\n}", "title": "" }, { "docid": "0ed56ac2ccfe5bc942740b26acb3b5de", "score": "0.461577", "text": "func (r *Registry) Populate() error {\n\tif r.populated {\n\t\tr.log.Warn(\"Service locator is already populated\")\n\t\treturn nil\n\t}\n\tfor _, entry := range r.entries {\n\t\tserviceType := reflect.TypeOf(entry.source)\n\t\tif serviceType.Kind() == reflect.Ptr && serviceType.Elem().Kind() == reflect.Struct {\n\t\t\tif err := r.InjectFields(entry.source); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tservice, ok := entry.source.(Service)\n\t\tif ok {\n\t\t\tif err := service.Init(r); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9c69a1c202bb1a9963f2d10bd8f81a20", "score": "0.46152917", "text": "func (_Vesting *VestingCaller) Registry(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Vesting.contract.Call(opts, out, \"registry\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "c7543d7453015f969fb01e49f55a9e51", "score": "0.46142027", "text": "func main() {\n\thello_service_generic_golang.ConfigReferenceConfigRegistry(\"localzk\")\n\thello_service_generic_golang.GenericCall()\n}", "title": "" }, { "docid": "5d61bd79e7c2c95fd5ed00fbf003afa3", "score": "0.46089596", "text": "func (_Registry *RegistryCallerSession) Registry(arg0 common.Address) (common.Address, error) {\n\treturn _Registry.Contract.Registry(&_Registry.CallOpts, arg0)\n}", "title": "" }, { "docid": "dcc7ec4516338722bef631d1d57d74aa", "score": "0.46065938", "text": "func init() {\n\tproxy.Register(&JobManagerBuilder{})\n}", "title": "" }, { "docid": "70a46fdcace452f8a122468dff3f680f", "score": "0.460288", "text": "func (e *EthereumContractDeployer) LoadKeeperRegistry(address common.Address, registryVersion eth_contracts.KeeperRegistryVersion) (KeeperRegistry, error) {\n\tswitch registryVersion {\n\tcase eth_contracts.RegistryVersion_1_1:\n\t\tinstance, err := e.client.LoadContract(\"KeeperRegistry\", address, func(\n\t\t\taddress common.Address,\n\t\t\tbackend bind.ContractBackend,\n\t\t) (interface{}, error) {\n\t\t\treturn keeper_registry_wrapper1_1.NewKeeperRegistry(address, backend)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &EthereumKeeperRegistry{\n\t\t\taddress: &address,\n\t\t\tclient: e.client,\n\t\t\tregistry1_1: instance.(*keeper_registry_wrapper1_1.KeeperRegistry),\n\t\t}, err\n\tcase eth_contracts.RegistryVersion_1_2:\n\t\tinstance, err := e.client.LoadContract(\"KeeperRegistry\", address, func(\n\t\t\taddress common.Address,\n\t\t\tbackend bind.ContractBackend,\n\t\t) (interface{}, error) {\n\t\t\treturn keeper_registry_wrapper1_2.NewKeeperRegistry(address, backend)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &EthereumKeeperRegistry{\n\t\t\taddress: &address,\n\t\t\tclient: e.client,\n\t\t\tregistry1_2: instance.(*keeper_registry_wrapper1_2.KeeperRegistry),\n\t\t}, err\n\tcase eth_contracts.RegistryVersion_1_3:\n\t\tinstance, err := e.client.LoadContract(\"KeeperRegistry\", address, func(\n\t\t\taddress common.Address,\n\t\t\tbackend bind.ContractBackend,\n\t\t) (interface{}, error) {\n\t\t\treturn keeper_registry_wrapper1_3.NewKeeperRegistry(address, backend)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &EthereumKeeperRegistry{\n\t\t\taddress: &address,\n\t\t\tclient: e.client,\n\t\t\tregistry1_3: instance.(*keeper_registry_wrapper1_3.KeeperRegistry),\n\t\t}, err\n\tcase eth_contracts.RegistryVersion_2_0:\n\t\tinstance, err := e.client.LoadContract(\"KeeperRegistry\", address, func(\n\t\t\taddress common.Address,\n\t\t\tbackend bind.ContractBackend,\n\t\t) (interface{}, error) {\n\t\t\treturn keeper_registry_wrapper2_0.NewKeeperRegistry(address, backend)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &EthereumKeeperRegistry{\n\t\t\taddress: &address,\n\t\t\tclient: e.client,\n\t\t\tregistry2_0: instance.(*keeper_registry_wrapper2_0.KeeperRegistry),\n\t\t}, err\n\tcase eth_contracts.RegistryVersion_2_1:\n\t\tinstance, err := e.client.LoadContract(\"KeeperRegistry\", address, func(\n\t\t\taddress common.Address,\n\t\t\tbackend bind.ContractBackend,\n\t\t) (interface{}, error) {\n\t\t\treturn iregistry21.NewIKeeperRegistryMaster(address, backend)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &EthereumKeeperRegistry{\n\t\t\taddress: &address,\n\t\t\tclient: e.client,\n\t\t\tregistry2_1: instance.(*registry21.KeeperRegistry),\n\t\t}, err\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"keeper registry version %d is not supported\", registryVersion)\n\t}\n}", "title": "" }, { "docid": "82a3bc4154cf3e6857861b5a96c7c91e", "score": "0.45893005", "text": "func (r AWSServiceDiscoveryService) MarshalJSON() ([]byte, error) {\n\ttype Properties AWSServiceDiscoveryService\n\treturn json.Marshal(&struct {\n\t\tType string\n\t\tProperties Properties\n\t\tDependsOn []string `json:\"DependsOn,omitempty\"`\n\t\tMetadata map[string]interface{} `json:\"Metadata,omitempty\"`\n\t\tDeletionPolicy DeletionPolicy `json:\"DeletionPolicy,omitempty\"`\n\t}{\n\t\tType: r.AWSCloudFormationType(),\n\t\tProperties: (Properties)(r),\n\t\tDependsOn: r._dependsOn,\n\t\tMetadata: r._metadata,\n\t\tDeletionPolicy: r._deletionPolicy,\n\t})\n}", "title": "" }, { "docid": "c164e0447e59c761eaf35267786041b7", "score": "0.45804024", "text": "func (dn *Node) ApplyGenericEndpointMethods(targetEndpoint EndpointInterface) {\n\tthisNode := dn\n\t//type EndpointMethod func(*CmdParams, *websocket.Conn, *int) interface{}\n\ttargetEndpoint.RegisterMethod(\"getEndpointID\", func(params *CmdParams, callingEndpoint EndpointInterface, token *int) interface{} {\n\t\treturn targetEndpoint.GetID()\n\t})\n\n\ttargetEndpoint.RegisterMethod(\"getNodeDeclaration\", func(params *CmdParams, callingEndpoint EndpointInterface, token *int) interface{} {\n\t\treturn thisNode.NodeDeclaration\n\t})\n\t/*\n\t\ttargetEndpoint.RegisterMethod(\"pathCmd\", async (params, srcEndpoint, token) => {\n\t\t\treturn await thisNode.GetObjFromPath(params, thisNode.GetBaseObj(), srcEndpoint);\n\t\t});\n\t*/\n\ttargetEndpoint.RegisterMethod(\"getRegistry\", func(params *CmdParams, callingEndpoint EndpointInterface, token *int) interface{} {\n\t\tvar reqNodeID *string = nil\n\t\tif params != nil {\n\t\t\tvalueJSON := (*params)[\"reqNodeID\"]\n\t\t\tif valueJSON != nil {\n\t\t\t\tjson.Unmarshal(*valueJSON, reqNodeID)\n\t\t\t}\n\t\t}\n\t\treturn thisNode.TopologyTracker.GetRegistry(reqNodeID)\n\t})\n\t/*\n\t\ttargetEndpoint.RegisterMethod(\"getServiceDefinition\", (...args) => {\n\t\t\treturn thisNode.GetServiceDefinition(...args);\n\t\t});\n\n\t\ttargetEndpoint.RegisterMethod(\"getServiceDefinitions\", async function (...args) {\n\t\t\treturn await thisNode.GetServiceDefinitions(...args);\n\t\t});\n\t*/\n\ttargetEndpoint.RegisterMethod(\"getLocalServiceDefinitions\", func(params *CmdParams, callingEndpoint EndpointInterface, token *int) interface{} {\n\t\tvar serviceName *string = nil\n\t\tif params != nil {\n\t\t\tvalueJSON := (*params)[\"serviceName\"]\n\t\t\tif valueJSON != nil {\n\t\t\t\tjson.Unmarshal(*valueJSON, serviceName)\n\t\t\t}\n\t\t}\n\t\tvar clientConnectionData = thisNode.GetLocalServiceDefinitions(serviceName)\n\t\treturn clientConnectionData\n\t})\n\n\t/*\n\n\t\ttargetEndpoint.RegisterMethod(\"getClassRecords\", async (...args) => {\n\t\t\treturn await thisNode.GetClassRecords(...args);\n\t\t});\n\n\t\ttargetEndpoint.RegisterMethod(\"listClassInstances\", async (...args) => {\n\t\t\treturn await thisNode.ListClassInstances(...args);\n\t\t});\n\n\t\ttargetEndpoint.RegisterMethod(\"sendToTopic\", function (params, srcEndpoint, token) {\n\t\t\tthisNode.TopicManager.SendToTopic(params.topicName, params.topicData);\n\t\t});\n\n\t\ttargetEndpoint.RegisterMethod(\"getTopology\", async function (...args) {\n\t\t\treturn await thisNode.GetTopology(...args);\n\t\t});\n\t*/\n\ttargetEndpoint.RegisterMethod(\"listClientConnections\", func(params *CmdParams, callingEndpoint EndpointInterface, token *int) interface{} {\n\t\tvar clientConnectionData = thisNode.ListClientConnections()\n\t\treturn clientConnectionData\n\t})\n\t/*\n\t\ttargetEndpoint.RegisterMethod(\"tcpPing\", async (...args) => {\n\t\t\treturn thisNode.TCPPing(...args);\n\t\t});\n\n\t\ttargetEndpoint.RegisterMethod(\"findInstanceOfService\", async (params) => {\n\t\t\treturn thisNode.TopologyTracker.FindInstanceOfService(params.serviceName, params.serviceType, params.zone);\n\t\t});\n\n\t\ttargetEndpoint.RegisterMethod(\"listServices\", async (params) => {\n\t\t\treturn thisNode.TopologyTracker.ListServices(params.serviceName, params.serviceType, params.zone);\n\t\t});\n\n\t\ttargetEndpoint.RegisterMethod(\"subscribe\", async function (params, srcEndpoint, token) {\n\t\t\t// Only allow if the scope is local or this Node is a Broker\n\t\t\tif (params.scope !== \"local\" && !thisNode.IsBroker()) return null;\n\n\t\t\tlet sendFunction = async (message) => {\n\t\t\t\t// Returns send status; error if not null\n\t\t\t\treturn await srcEndpoint.SendReply(params.streamToken, 2, message);\n\t\t\t};\n\t\t\tlet sendFailCallback = async (sendFailMsg) => {\n\t\t\t\t// Failed to send; may have already disconnected, take no further action\n\t\t\t};\n\t\t\tlet thisSubscription = new DRP_Subscriber(params.topicName, params.scope, params.filter, sendFunction, sendFailCallback);\n\t\t\tsrcEndpoint.Subscriptions[params.streamToken] = thisSubscription;\n\t\t\treturn await thisNode.Subscribe(thisSubscription);\n\t\t});\n\n\t\ttargetEndpoint.RegisterMethod(\"unsubscribe\", async function (params, srcEndpoint, token) {\n\t\t\tlet response = false;\n\t\t\tlet thisSubscription = srcEndpoint.Subscriptions[params.streamToken];\n\t\t\tif (thisSubscription) {\n\t\t\t\tthisSubscription.Terminate();\n\t\t\t\tthisNode.SubscriptionManager.Subscribers.delete(thisSubscription);\n\t\t\t\tresponse = true;\n\t\t\t}\n\t\t\treturn response;\n\t\t});\n\n\t\ttargetEndpoint.RegisterMethod(\"refreshSwaggerRouter\", async function (params, srcEndpoint, token) {\n\t\t\tlet serviceName = null;\n\t\t\tif (params && params.serviceName) {\n\t\t\t\t// params was passed from cliGetPath\n\t\t\t\tserviceName = params.serviceName;\n\n\t\t\t} else if (params && params.pathList && params.pathList.length > 0) {\n\t\t\t\t// params was passed from cliGetPath\n\t\t\t\tserviceName = params.pathList.shift();\n\t\t\t} else {\n\t\t\t\tif (params && params.pathList) return `Format \\\\refreshSwaggerRouter\\\\{serviceName}`;\n\t\t\t\telse return `FAIL - serviceName not defined`;\n\t\t\t}\n\n\t\t\tif (thisNode.SwaggerRouters[serviceName]) {\n\t\t\t\tdelete thisNode.SwaggerRouters[serviceName];\n\t\t\t\tlet serviceInstance = thisNode.TopologyTracker.FindInstanceOfService(serviceName);\n\t\t\t\tif (!serviceInstance) return `FAIL - Service [${serviceName}] does not exist`;\n\t\t\t\tawait thisNode.AddSwaggerRouter(serviceName, serviceInstance.NodeID);\n\t\t\t\treturn `OK - Refreshed SwaggerRouters[${serviceName}]`;\n\t\t\t} else {\n\t\t\t\treturn `FAIL - SwaggerRouters[${serviceName}] does not exist`;\n\t\t\t}\n\t\t});\n\t*/\n}", "title": "" }, { "docid": "78e72be674ee2e60b3ffe68aca8530c1", "score": "0.45752764", "text": "func New(apiClient *api.Client, opts ...Option) *Registry {\n\tr := &Registry{\n\t\tregistry: make(map[string]*serviceSet),\n\t\tenableHealthCheck: true,\n\t\ttimeout: 10 * time.Second,\n\t\tcli: &Client{\n\t\t\tdc: SingleDatacenter,\n\t\t\tcli: apiClient,\n\t\t\tresolver: defaultResolver,\n\t\t\thealthcheckInterval: 10,\n\t\t\theartbeat: true,\n\t\t\tderegisterCriticalServiceAfter: 600,\n\t\t},\n\t}\n\tfor _, o := range opts {\n\t\to(r)\n\t}\n\tr.cli.ctx, r.cli.cancel = context.WithCancel(context.Background())\n\treturn r\n}", "title": "" }, { "docid": "68666068f6da20a3379489769dd97910", "score": "0.45734602", "text": "func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *ResourceGroupsTaggingAPI {\n\tsvc := &ResourceGroupsTaggingAPI{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: ServiceName,\n\t\t\t\tSigningName: signingName,\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2017-01-26\",\n\t\t\t\tJSONVersion: \"1.1\",\n\t\t\t\tTargetPrefix: \"ResourceGroupsTaggingAPI_20170126\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)\n\tsvc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)\n\n\t// Run custom client initialization if present\n\tif initClient != nil {\n\t\tinitClient(svc.Client)\n\t}\n\n\treturn svc\n}", "title": "" }, { "docid": "9065dd356e07abb9628c10fcf0fa1e44", "score": "0.4566994", "text": "func Get() service_registry.GatewayRegistry {\n\treturn service_registry.Get()\n}", "title": "" }, { "docid": "0423453b488b498389f95b68b59734d7", "score": "0.45566985", "text": "func init() {\n\tprocessors.Add(\"ec2tagger\", func() telegraf.Processor {\n\t\tmdCredentialConfig := &internalaws.CredentialConfig{}\n\t\tmdConfigProvider := mdCredentialConfig.Credentials()\n\t\tec2Provider := func(ec2CredentialConfig *internalaws.CredentialConfig) ec2iface.EC2API {\n\t\t\tec2ConfigProvider := ec2CredentialConfig.Credentials()\n\t\t\treturn ec2.New(ec2ConfigProvider)\n\t\t}\n\t\treturn &Tagger{\n\t\t\tec2metadata: ec2metadata.New(mdConfigProvider),\n\t\t\tec2Provider: ec2Provider,\n\t\t}\n\t})\n}", "title": "" }, { "docid": "3d965b1020b20d6b26aa29a52a36e299", "score": "0.45517308", "text": "func (handler *handlerService) register(rcvr Component) error {\n\tif handler.serviceMap == nil {\n\t\thandler.serviceMap = make(map[string]*service)\n\t}\n\ts := new(service)\n\ts.typ = reflect.TypeOf(rcvr)\n\ts.rcvr = reflect.ValueOf(rcvr)\n\tsname := reflect.Indirect(s.rcvr).Type().Name()\n\tif sname == \"\" {\n\t\treturn errors.New(\"handler.Register: no service name for type \" + s.typ.String())\n\t}\n\tif !utils.IsExported(sname) {\n\t\treturn errors.New(\"handler.Register: type \" + sname + \" is not exported\")\n\n\t}\n\tif _, present := handler.serviceMap[sname]; present {\n\t\treturn errors.New(\"handler: service already defined: \" + sname)\n\t}\n\ts.name = sname\n\n\t// Install the methods\n\ts.method = suitableMethods(s.typ, true)\n\n\tif len(s.method) == 0 {\n\t\tstr := \"\"\n\n\t\t// To help the user, see if a pointer receiver would work.\n\t\tmethod := suitableMethods(reflect.PtrTo(s.typ), false)\n\t\tif len(method) != 0 {\n\t\t\tstr = \"handler.Register: type \" + sname + \" has no exported methods of suitable type (hint: pass a pointer to value of that type)\"\n\t\t} else {\n\t\t\tstr = \"handler.Register: type \" + sname + \" has no exported methods of suitable type\"\n\t\t}\n\t\treturn errors.New(str)\n\t}\n\thandler.serviceMap[s.name] = s\n\treturn nil\n}", "title": "" }, { "docid": "e532864c663600b94efa3303ccad9305", "score": "0.4549168", "text": "func (p *provider) Init(ctx servicehub.Context) error {\n\tif p.Register != nil {\n\t\tp.jaegerService = &jaegerServiceImpl{Log: p.Log, p: p}\n\t\tpb.RegisterJaegerServiceImp(p.Register, p.jaegerService,\n\t\t\ttransport.WithHTTPOptions(transhttp.WithDecoder(ThriftDecoder), transhttp.WithInterceptor(p.Interceptors.ExtractHttpHeaders)),\n\t\t\ttransport.WithInterceptors(p.Interceptors.Authentication, p.Interceptors.SpanTagOverwrite),\n\t\t)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "228baee7054fc5628a5d4b31231eac93", "score": "0.4547223", "text": "func NewApplicationLoadBalancedServiceBase_Override(a ApplicationLoadBalancedServiceBase, scope constructs.Construct, id *string, props *ApplicationLoadBalancedServiceBaseProps) {\n\t_init_.Initialize()\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_ecs_patterns.ApplicationLoadBalancedServiceBase\",\n\t\t[]interface{}{scope, id, props},\n\t\ta,\n\t)\n}", "title": "" }, { "docid": "da65af4ade217887944bf04c35ca7738", "score": "0.45429787", "text": "func (_Vesting *VestingSession) Registry() (common.Address, error) {\n\treturn _Vesting.Contract.Registry(&_Vesting.CallOpts)\n}", "title": "" }, { "docid": "50417e3cab471ef72d7e0b8dc8cfff82", "score": "0.45429084", "text": "func NewRegistry(ctx *pulumi.Context,\n\tname string, args *RegistryArgs, opts ...pulumi.ResourceOption) (*Registry, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\tif args.Sku == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Sku'\")\n\t}\n\tsecrets := pulumi.AdditionalSecretOutputs([]string{\n\t\t\"adminPassword\",\n\t})\n\topts = append(opts, secrets)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Registry\n\terr := ctx.RegisterResource(\"azure:containerservice/registry:Registry\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "499423e15b2379718ff61f696587a4c4", "score": "0.45395893", "text": "func expandServiceEndpointAzureCR(d *schema.ResourceData) (*serviceendpoint.ServiceEndpoint, *string, error) {\n\tserviceEndpoint, projectID := doBaseExpansion(d)\n\tsubscriptionID := d.Get(\"azurecr_subscription_id\")\n\tscope := fmt.Sprintf(\n\t\t\"/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerRegistry/registries/%s\",\n\t\tsubscriptionID, d.Get(\"resource_group\"), d.Get(\"azurecr_name\"),\n\t)\n\tloginServer := fmt.Sprintf(\"%s.azurecr.io\", strings.ToLower(d.Get(\"azurecr_name\").(string)))\n\tserviceEndpoint.Authorization = &serviceendpoint.EndpointAuthorization{\n\t\tParameters: &map[string]string{\n\t\t\t\"authenticationType\": \"spnKey\",\n\t\t\t\"tenantId\": d.Get(\"azurecr_spn_tenantid\").(string),\n\t\t\t\"loginServer\": loginServer,\n\t\t\t\"scope\": scope,\n\t\t\t\"serviceprincipalid\": d.Get(\"service_principal_id\").(string),\n\t\t},\n\t\tScheme: converter.String(\"ServicePrincipal\"),\n\t}\n\tserviceEndpoint.Data = &map[string]string{\n\t\t\"registryId\": scope,\n\t\t\"subscriptionId\": subscriptionID.(string),\n\t\t\"subscriptionName\": d.Get(\"azurecr_subscription_name\").(string),\n\t\t\"registrytype\": \"ACR\",\n\t\t\"appObjectId\": d.Get(\"app_object_id\").(string),\n\t\t\"spnObjectId\": d.Get(\"spn_object_id\").(string),\n\t\t\"azureSpnPermissions\": d.Get(\"az_spn_role_permissions\").(string),\n\t\t\"azureSpnRoleAssignmentId\": d.Get(\"az_spn_role_assignment_id\").(string),\n\t}\n\tserviceEndpoint.Type = converter.String(\"dockerregistry\")\n\tazureContainerRegistryURL := fmt.Sprintf(\"https://%s\", loginServer)\n\tserviceEndpoint.Url = converter.String(azureContainerRegistryURL)\n\n\treturn serviceEndpoint, projectID, nil\n}", "title": "" }, { "docid": "bf27a2a9f3d882ada8ff2136c0534c0a", "score": "0.4536913", "text": "func New(opt option.Registry) (component.Registry, error) {\n\tconn, _, err := zkClient.Connect(opt.Address, time.Duration(opt.Timeout)*time.Second)\n\tif err != nil {\n\t\tklog.Errorf(\"Get zookeeper client has an error: %v\", err)\n\t}\n\tif err != nil || conn == nil {\n\t\treturn nil, fmt.Errorf(\"get zookeeper client fail or client is nil, err:%+v\", err)\n\t}\n\n\treturn &RegistryClient{\n\t\tconn: conn,\n\t\tservices: make(map[string]*types.Service),\n\t\tserviceOut: make(chan *types.ServiceEvent),\n\t\taccessors: make(map[string]*types.Service),\n\t\taccessorOut: make(chan *types.ServiceEvent),\n\t\tscopedAccessorsMapping: make(map[string]map[string]struct{}),\n\t\tscache: nil,\n\t\tpcaches: make(map[string]*zookeeper.PathCache),\n\t\tccaches: make(map[string]*zookeeper.PathCache),\n\t\tautoFillNode: true,\n\t}, nil\n}", "title": "" }, { "docid": "34a473cfaf8f0193b8e6e7c1d02dea06", "score": "0.45343667", "text": "func NewEtcdRegistry(option *Options) Registry {\n\t//setting default options\n\tif option.TTL == time.Duration(0) {\n\t\toption.TTL = time.Duration(time.Second * 40)\n\t}\n\tif option.Interval == time.Duration(0) {\n\t\toption.Interval = time.Duration(time.Second * 30)\n\t}\n\t//create etcd registry\n\tr := etcd.NewRegistry(\n\t\tregistry.Addrs(option.RegistryAddr...),\n\t\tregistry.TLSConfig(option.Config),\n\t)\n\t//creat local service\n\toption.id = uuid.New().String()\n\tsvc := &registry.Service{\n\t\tName: option.Name,\n\t\tVersion: option.Version,\n\t\tNodes: []*registry.Node{\n\t\t\t&registry.Node{\n\t\t\t\tId: fmt.Sprintf(\"%s-%s\", option.Name, option.id),\n\t\t\t\tAddress: option.RegAddr,\n\t\t\t\tMetadata: option.Meta,\n\t\t\t},\n\t\t},\n\t}\n\tctx, stop := context.WithCancel(context.Background())\n\te := &etcdRegister{\n\t\toption: option,\n\t\tctx: ctx,\n\t\tstop: stop,\n\t\tetcdregistry: r,\n\t\tlocalService: svc,\n\t\tregistered: false,\n\t}\n\treturn e\n}", "title": "" }, { "docid": "64cb74df63d47954bcbbdcc05719c67c", "score": "0.45320117", "text": "func NewService() *Service {\n\ts := new(Service)\n\treg := xmcconsul.NewRegistry().(*xmcconsul.XMCConsulRegistry)\n\ts.Consul = reg.Client\n\tconfReader := config.NewReader(s.Consul, \"xmc.srv.core/cfg\")\n\tconfReader.MustReadConfig()\n\tregistry.DefaultRegistry = reg\n\ts.Micro = micro.NewService(\n\t\tmicro.Name(\"xmc.srv.core\"),\n\t\tmicro.Registry(reg),\n\n\t\tmicro.WrapHandler(perms.JWTWrapper),\n\n\t\tmicro.Flags(\n\t\t\tcli.BoolFlag{\n\t\t\t\tName: \"debug\",\n\t\t\t\tEnvVar: \"DEBUG\",\n\t\t\t\tUsage: \"Enable debug messages\",\n\t\t\t\tDestination: &s.Debug,\n\t\t\t},\n\t\t\tcli.StringFlag{\n\t\t\t\tName: \"database_url\",\n\t\t\t\tEnvVar: \"CFG_DB_URL\",\n\t\t\t\tUsage: \"The database URL and its parameters e.g. user:password@/dbname?parseTime=True\",\n\t\t\t\tDestination: &s.DBURL,\n\t\t\t},\n\t\t\tcli.StringFlag{\n\t\t\t\tName: \"database_type\",\n\t\t\t\tValue: \"postgres\",\n\t\t\t\tUsage: \"The database type (currently only postgres)\",\n\t\t\t\tDestination: &s.DBType,\n\t\t\t},\n\t\t\tcli.StringFlag{\n\t\t\t\tName: \"s3_endpoint\",\n\t\t\t\tValue: \"s3.amazonaws.com\",\n\t\t\t\tUsage: \"The endpoint of the S3 server\",\n\t\t\t\tEnvVar: \"CFG_S3_ENDPOINT\",\n\t\t\t\tDestination: &s.S3Endpoint,\n\t\t\t},\n\t\t\tcli.StringFlag{\n\t\t\t\tName: \"s3_access_key_id\",\n\t\t\t\tEnvVar: \"CFG_S3_ACCESS_KEY_ID\",\n\t\t\t\tUsage: \"The S3 access key id\",\n\t\t\t\tDestination: &s.S3AccessKeyID,\n\t\t\t},\n\t\t\tcli.StringFlag{\n\t\t\t\tName: \"s3_secret_access_key\",\n\t\t\t\tEnvVar: \"CFG_S3_SECRET_ACCESS_KEY\",\n\t\t\t\tUsage: \"The S3 secret access key\",\n\t\t\t\tDestination: &s.S3SecretAccessKey,\n\t\t\t},\n\t\t\tcli.BoolTFlag{\n\t\t\t\tName: \"s3_use_ssl\",\n\t\t\t\tUsage: \"Whether to to use SSL when connecting to S3\",\n\t\t\t\tEnvVar: \"CFG_S3_USE_SSL\",\n\t\t\t\tDestination: &s.S3UseSSL,\n\t\t\t},\n\t\t\tcli.StringFlag{\n\t\t\t\tName: \"s3_bucket_name\",\n\t\t\t\tUsage: \"The name of the S3 bucket\",\n\t\t\t\tEnvVar: \"CFG_S3_BUCKET_NAME\",\n\t\t\t\tDestination: &s.S3BucketName,\n\t\t\t},\n\t\t\tcli.StringFlag{\n\t\t\t\tName: \"s3_bucket_location\",\n\t\t\t\tUsage: \"The location of the S3 bucket\",\n\t\t\t\tValue: \"eu-central-1\",\n\t\t\t\tEnvVar: \"CFG_S3_BUCKET_LOCATION\",\n\t\t\t\tDestination: &s.S3BucketLocation,\n\t\t\t},\n\t\t\tcli.StringFlag{\n\t\t\t\tName: \"oauth2_token\",\n\t\t\t\tUsage: \"The API endpoint for tokens\",\n\t\t\t\tEnvVar: \"CFG_TOKEN\",\n\t\t\t\tDestination: &s.OAuth2Token,\n\t\t\t},\n\t\t),\n\t)\n\n\treturn s\n}", "title": "" }, { "docid": "81f77e8ead29d404d258bec8d0551a56", "score": "0.4530124", "text": "func NewService(\n\tconfigFile string,\n\tcfgManager *prom.ConfigManager,\n\tgetLastScrapeStatistics func(jobName string, withoutMetricsDetail bool) (map[string]*kscrape.StatisticsSeriesResult, error),\n\tgetScrapeStatus func() map[uint64]*target.ScrapeStatus,\n\tgetActiveTargets func() map[string][]*discovery.SDTargets,\n\tgetDropTargets func() map[string][]*discovery.SDTargets,\n\tpromRegistry *prometheus.Registry,\n\tlg logrus.FieldLogger) *Service {\n\n\tw := &Service{\n\t\tconfigFile: configFile,\n\t\tEngine: gin.Default(),\n\t\tlg: lg,\n\t\tcfgManager: cfgManager,\n\t\tgetScrapeStatus: getScrapeStatus,\n\t\tgetActiveTargets: getActiveTargets,\n\t\tgetDropTargets: getDropTargets,\n\t\tgetLastScrapeStatistics: getLastScrapeStatistics,\n\t}\n\n\tpprof.Register(w.Engine)\n\n\th := api.NewHelper(lg, promRegistry, \"kvass_coordinator\")\n\tw.GET(\"/metrics\", h.MetricsHandler)\n\tw.GET(\"/api/v1/targets\", h.Wrap(w.targets))\n\tw.GET(\"/api/v1/runtimeinfo\", h.Wrap(w.runtimeInfo))\n\tw.GET(\"/api/v1/samples\", h.Wrap(w.samples))\n\tw.POST(\"/-/reload\", h.Wrap(func(ctx *gin.Context) *api.Result {\n\t\tif err := w.cfgManager.ReloadFromFile(configFile); err != nil {\n\t\t\treturn api.BadDataErr(err, \"reload failed\")\n\t\t}\n\t\treturn api.Data(nil)\n\t}))\n\n\tw.GET(\"/api/v1/status/config\", h.Wrap(func(ctx *gin.Context) *api.Result {\n\t\treturn api.Data(gin.H{\"yaml\": string(cfgManager.ConfigInfo().RawContent)})\n\t}))\n\tw.POST(\"/api/v1/status/extra_config\", h.Wrap(w.updateExtraConfig))\n\tw.GET(\"/api/v1/status/extra_config\", h.Wrap(func(ctx *gin.Context) *api.Result {\n\t\treturn api.Data(gin.H{\"json\": test.MustJSON(cfgManager.ConfigInfo().ExtraConfig)})\n\t}))\n\treturn w\n}", "title": "" }, { "docid": "c6f5a3aa8b9d533b1daf0e11a8579e85", "score": "0.4529173", "text": "func Register(service interface{}) error {\n\tServices=append(Services,service)\n\t//object:=reflect.ValueOf(service)\n\n//\tobjRef:=object.Elem()\n\tobjType:=reflect.TypeOf(service)\n\tobjValue:=reflect.ValueOf(service)\n\tserviceName:=\"\"\n\tport:=\"\"\n\tfieldCount:=objType.NumField()\n\tfor i:=0;i<fieldCount ;i++ {\n\t\tfield:=objType.Field(i)\n\t\tif field.Name==\"ServiceMeta\"{\n\t\t\tserviceName=field.Tag.Get(\"ServiceName\")\n\t\t\tport=field.Tag.Get(\"ServicePort\")\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif serviceName==\"\" {\n\t\treturn errors.New(\"Can't found ServiceName\")\n\t}\n\n\tmethodCount:=objType.NumMethod()\n\tfor i:=0;i<methodCount ;i++ {\n\t\tmethodType:=objType.Method(i)\n\t\tmethodValue:=objValue.Method(i)\n\t\t//Methods[serviceName+\"_\"+methodType.Name]=methodType\n\t\tMethodValues[serviceName+\"_\"+methodType.Name]=methodValue\n\t\tfmt.Println(methodType.Name,methodType.Type)\n\t}\n\tBuildService(serviceName,port)\n\treturn nil\n}", "title": "" }, { "docid": "bd3c12292c38a3ad4e81d25acd18cb4c", "score": "0.4527829", "text": "func (eureka *EurekaServiceRegistry) DefaultSpec() interface{} {\n\treturn &Spec{\n\t\tEndpoints: []string{\"http://127.0.0.1:8761/eureka\"},\n\t\tSyncInterval: \"10s\",\n\t}\n}", "title": "" }, { "docid": "246a6fa74a9644bc6a1fd565e2b30cf4", "score": "0.45253128", "text": "func New() endly.Service {\n\tvar result = &service{\n\t\tAbstractService: endly.NewAbstractService(ServiceID),\n\t}\n\tresult.AbstractService.Service = result\n\tresult.registerRoutes()\n\treturn result\n}", "title": "" }, { "docid": "246a6fa74a9644bc6a1fd565e2b30cf4", "score": "0.45253128", "text": "func New() endly.Service {\n\tvar result = &service{\n\t\tAbstractService: endly.NewAbstractService(ServiceID),\n\t}\n\tresult.AbstractService.Service = result\n\tresult.registerRoutes()\n\treturn result\n}", "title": "" }, { "docid": "246a6fa74a9644bc6a1fd565e2b30cf4", "score": "0.45253128", "text": "func New() endly.Service {\n\tvar result = &service{\n\t\tAbstractService: endly.NewAbstractService(ServiceID),\n\t}\n\tresult.AbstractService.Service = result\n\tresult.registerRoutes()\n\treturn result\n}", "title": "" }, { "docid": "246a6fa74a9644bc6a1fd565e2b30cf4", "score": "0.45253128", "text": "func New() endly.Service {\n\tvar result = &service{\n\t\tAbstractService: endly.NewAbstractService(ServiceID),\n\t}\n\tresult.AbstractService.Service = result\n\tresult.registerRoutes()\n\treturn result\n}", "title": "" }, { "docid": "246a6fa74a9644bc6a1fd565e2b30cf4", "score": "0.45253128", "text": "func New() endly.Service {\n\tvar result = &service{\n\t\tAbstractService: endly.NewAbstractService(ServiceID),\n\t}\n\tresult.AbstractService.Service = result\n\tresult.registerRoutes()\n\treturn result\n}", "title": "" }, { "docid": "acd3ba7cbca75e17ba331e7030368040", "score": "0.452432", "text": "func (this *EtcdServices) Register(service string, nodename string, nodevalue string, stop chan struct{}) (registered *clientv3.PutResponse, err error) {\n\tif len(nodevalue) == 0 {\n\t\treturn nil, ErrInvalidParams\n\t}\n\n\tkey := fmt.Sprintf(\"/services/%s/%s\", service, nodename)\n\tticker := time.NewTicker((time.Duration)(this.heartBeat-1) * time.Second)\n\n\tresp, err := this.client.Grant(context.TODO(), this.keyTTL)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tregistered, err = this.client.Put(context.TODO(), key, nodevalue, clientv3.WithLease(resp.ID))\n\tif err != nil {\n\t\treturn\n\t}\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-stop:\n\t\t\t\t_, err = this.client.Delete(context.TODO(), key)\n\t\t\t\tticker.Stop()\n\t\t\t\treturn\n\t\t\tcase <-ticker.C:\n\t\t\t\tresp, err := this.client.Grant(context.TODO(), this.heartBeat)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\t\t\t\t_, err = this.client.Put(context.TODO(), key, nodevalue, clientv3.WithLease(resp.ID))\n\t\t\t\tfor err != nil {\n\t\t\t\t\t//errEtcd := err.(*clientv3.EtcdError)\n\t\t\t\t\t//logger.Printf(\"register %v fail : %v [clusters: %v]\", service, errEtcd.Message, this.client.GetCluster())\n\t\t\t\t\ttime.Sleep(2 * time.Second)\n\t\t\t\t\t_, err = this.client.Put(context.TODO(), key, nodevalue, clientv3.WithLease(resp.ID))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn\n}", "title": "" }, { "docid": "85f3a8434e4afcf1dfed4489467b5a7f", "score": "0.4517667", "text": "func (_Registry *RegistryCaller) Registry(opts *bind.CallOpts, arg0 common.Address) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Registry.contract.Call(opts, out, \"registry\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e7b7661a81f88244b232f87d5e5c8e5c", "score": "0.45167282", "text": "func GenerateService(cr *loggingv1alpha1.Elasticsearch, labels map[string]string, serviceName string, nodeType string) *corev1.Service {\n\tServiceName := serviceName + \"-\" + nodeType\n\tservice := &corev1.Service{\n\t\tTypeMeta: identifier.GenerateMetaInformation(\"Service\", \"core/v1\"),\n\t\tObjectMeta: identifier.GenerateObjectMetaInformation(ServiceName, cr.Namespace, labels, identifier.GenerateElasticAnnotations()),\n\t\tSpec: corev1.ServiceSpec{\n\t\t\tSelector: labels,\n\t\t\tPorts: []corev1.ServicePort{\n\t\t\t\t{\n\t\t\t\t\tName: \"http\",\n\t\t\t\t\tPort: 9200,\n\t\t\t\t\tTargetPort: intstr.FromInt(int(9200)),\n\t\t\t\t\tProtocol: corev1.ProtocolTCP,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"transport\",\n\t\t\t\t\tPort: 9300,\n\t\t\t\t\tTargetPort: intstr.FromInt(int(9200)),\n\t\t\t\t\tProtocol: corev1.ProtocolTCP,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tidentifier.AddOwnerRefToObject(service, identifier.ElasticAsOwner(cr))\n\treturn service\n}", "title": "" }, { "docid": "3c74a68b5b78b56b0c3bcaea66358769", "score": "0.44981417", "text": "func (_Registry *RegistrySession) Registry(arg0 common.Address) (common.Address, error) {\n\treturn _Registry.Contract.Registry(&_Registry.CallOpts, arg0)\n}", "title": "" }, { "docid": "4eb3d3e3b67ce02934bd508e9490d7d4", "score": "0.44939908", "text": "func (this *PushBroker) GetAllRegistrations() []PushServicer {\n\n\tservices := make([]PushServicer, 10)\n\tfor _, v := range this.serviceRegistrations {\n\t\tservices = append(services, *(v.Service))\n\t}\n\treturn services\n}", "title": "" }, { "docid": "dda0a7ff2571d064413ae104da76a97c", "score": "0.44884485", "text": "func (r *GenericREST) defaultOnReadService(service *api.Service) {\n\tif service == nil {\n\t\treturn\n\t}\n\n\t// We might find Services that were written before ClusterIP became plural.\n\t// We still want to present a consistent view of them.\n\t// NOTE: the args are (old, new)\n\tsvcreg.NormalizeClusterIPs(nil, service)\n\n\t// The rest of this does not apply unless dual-stack is enabled.\n\tif !utilfeature.DefaultFeatureGate.Enabled(features.IPv6DualStack) {\n\t\treturn\n\t}\n\n\tif len(service.Spec.IPFamilies) > 0 {\n\t\treturn // already defaulted\n\t}\n\n\t// set clusterIPs based on ClusterIP\n\tif len(service.Spec.ClusterIPs) == 0 {\n\t\tif len(service.Spec.ClusterIP) > 0 {\n\t\t\tservice.Spec.ClusterIPs = []string{service.Spec.ClusterIP}\n\t\t}\n\t}\n\n\trequireDualStack := api.IPFamilyPolicyRequireDualStack\n\tsingleStack := api.IPFamilyPolicySingleStack\n\tpreferDualStack := api.IPFamilyPolicyPreferDualStack\n\t// headless services\n\tif len(service.Spec.ClusterIPs) == 1 && service.Spec.ClusterIPs[0] == api.ClusterIPNone {\n\t\tservice.Spec.IPFamilies = []api.IPFamily{*r.primaryIPFamily}\n\n\t\t// headless+selectorless\n\t\t// headless+selectorless takes both families. Why?\n\t\t// at this stage we don't know what kind of endpoints (specifically their IPFamilies) the\n\t\t// user has assigned to this selectorless service. We assume it has dualstack and we default\n\t\t// it to PreferDualStack on any cluster (single or dualstack configured).\n\t\tif len(service.Spec.Selector) == 0 {\n\t\t\tservice.Spec.IPFamilyPolicy = &preferDualStack\n\t\t\tif *r.primaryIPFamily == api.IPv4Protocol {\n\t\t\t\tservice.Spec.IPFamilies = append(service.Spec.IPFamilies, api.IPv6Protocol)\n\t\t\t} else {\n\t\t\t\tservice.Spec.IPFamilies = append(service.Spec.IPFamilies, api.IPv4Protocol)\n\t\t\t}\n\t\t} else {\n\t\t\t// headless w/ selector\n\t\t\t// this service type follows cluster configuration. this service (selector based) uses a\n\t\t\t// selector and will have to follow how the cluster is configured. If the cluster is\n\t\t\t// configured to dual stack then the service defaults to PreferDualStack. Otherwise we\n\t\t\t// default it to SingleStack.\n\t\t\tif r.secondaryFamily != nil {\n\t\t\t\tservice.Spec.IPFamilies = append(service.Spec.IPFamilies, *r.secondaryFamily)\n\t\t\t\tservice.Spec.IPFamilyPolicy = &preferDualStack\n\t\t\t} else {\n\t\t\t\tservice.Spec.IPFamilyPolicy = &singleStack\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// headful\n\t\t// make sure a slice exists to receive the families\n\t\tservice.Spec.IPFamilies = make([]api.IPFamily, len(service.Spec.ClusterIPs), len(service.Spec.ClusterIPs))\n\t\tfor idx, ip := range service.Spec.ClusterIPs {\n\t\t\tif netutil.IsIPv6String(ip) {\n\t\t\t\tservice.Spec.IPFamilies[idx] = api.IPv6Protocol\n\t\t\t} else {\n\t\t\t\tservice.Spec.IPFamilies[idx] = api.IPv4Protocol\n\t\t\t}\n\n\t\t\tif len(service.Spec.IPFamilies) == 1 {\n\t\t\t\tservice.Spec.IPFamilyPolicy = &singleStack\n\t\t\t} else if len(service.Spec.IPFamilies) == 2 {\n\t\t\t\tservice.Spec.IPFamilyPolicy = &requireDualStack\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "87306374bea86acb427c292f83ba7db9", "score": "0.44710192", "text": "func (s serviceMap) newService(service string) error {\n\tendpoints, err := getHealthyEndpoints(service)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts[service] = &serviceEndpoints{\n\t\tname: service,\n\t\tendpoints: endpoints,\n\t\tindex: 0,\n\t\ttimeout: time.After(consulRefreshRate),\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "82a15799f163c5bcd3f7290cc8df3e2d", "score": "0.44651893", "text": "func (r *Registrar) Register(registry broker.BrokerRegistry) error {\n\tregisterLogger := utils.NewLogger(\"brokerpak-registration\")\n\n\treturn r.walk(func(name string, pak BrokerpakSourceConfig, vc *varcontext.VarContext) error {\n\t\tregisterLogger.Info(\"registering\", lager.Data{\n\t\t\t\"name\": name,\n\t\t\t\"location\": pak.BrokerpakUri,\n\t\t\t\"notes\": pak.Notes,\n\t\t\t\"excluded-services\": pak.ExcludedServicesSlice(),\n\t\t\t\"prefix\": pak.ServicePrefix,\n\t\t})\n\n\t\tbrokerPak, err := DownloadAndOpenBrokerpak(pak.BrokerpakUri)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"couldn't open brokerpak: %q: %v\", pak.BrokerpakUri, err)\n\t\t}\n\t\tdefer brokerPak.Close()\n\n\t\texecutor, err := r.createExecutor(brokerPak, vc)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// register the services\n\t\tservices, err := brokerPak.Services()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdefns, err := r.toDefinitions(services, pak, executor)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, defn := range defns {\n\t\t\tregistry.Register(defn)\n\t\t}\n\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "97d8ae44c3a4853107beaf1221ffe4a3", "score": "0.4462099", "text": "func Registry(r registry.Registry) Option {\r\n\treturn func(o *Options) {\r\n\t\to.Registry = r\r\n\t}\r\n}", "title": "" }, { "docid": "cb8a1e633b9fe0d58e5cc9aff6e62558", "score": "0.4445919", "text": "func (e *Kubecore) Gen() error {\n\t//gen kubeadm config file\n\tgenKubeAdmConfigFile(define.KubeFlags.EtcdIPs, define.KubeFlags.MasterIPs, define.KubeFlags.LoadbalanceIP,\n\t\tdefine.KubeFlags.LoadbalancePort, define.KubeFlags.Subnet, define.KubeFlags.Version, define.KubeadmTemp)\n\n\t//gen kubelet config file\n\tgenKubeletSystemdConfig(KubeletSystemdTemp)\n\tpkg.WriteFile(\"out/kube/kubelet.service\", KubeletServiceStr)\n\treturn nil\n}", "title": "" }, { "docid": "f71ae4b7ae12ff6f5bb1449fe4b9fafd", "score": "0.4433097", "text": "func NewRegistry(\n\theartbeatCh chan heartbeat.Heartbeat,\n\tstatusRequestChannelName string,\n\tstatusReportChannelName string,\n\tepnStatusChannelName string,\n\tmaxResponseTime time.Duration,\n\tmessenger messenger.Messenger) Registry {\n\n\tstatusReportCh := make(chan []byte)\n\tstatusReportSubs := messenger.ChanSubscribe(statusReportChannelName, statusReportCh)\n\n\treturn Registry{\n\t\tlastStatusRequest: time.Now(),\n\t\tactors: make(Actors),\n\t\tstatusRequestChannelName: statusRequestChannelName,\n\t\tepnStatusChannelName: epnStatusChannelName,\n\t\tmaxResponseTime: maxResponseTime,\n\t\tmessenger: messenger,\n\t\theartbeatCh: heartbeatCh,\n\t\tstatusReportCh: statusReportCh,\n\t\tstatusReportSubs: statusReportSubs,\n\t\tregistryDoneCh: make(chan struct{}),\n\t}\n}", "title": "" }, { "docid": "891660ae183b83074ba401e96b9768a4", "score": "0.4428877", "text": "func (r *CloudProvider) Initialize(clientBuilder controller.ControllerClientBuilder) {}", "title": "" }, { "docid": "b166b801263d50e44367f5d782fbd7eb", "score": "0.44242853", "text": "func RegisterRegistryServant(r *mux.Router, s Registry) {\n\trouter := r.PathPrefix(\"/api/v1\").Subrouter()\n\n\t// register routes info to router\n\trouter.HandleFunc(\"account/register\", s.Register).\n\t\tMethods(\"POST\")\n\trouter.HandleFunc(\"account/login\", s.Login).\n\t\tMethods(\"POST\")\n\trouter.HandleFunc(\"account/tokens\", s.TokensInfo).\n\t\tMethods(\"POST\")\n\trouter.HandleFunc(\"account/tokens\", s.GenerateTokens).\n\t\tMethods(\"PUT\")\n\trouter.HandleFunc(\"account/tokens\", s.RevokeTokens).\n\t\tMethods(\"DELETE\")\n\trouter.HandleFunc(\"account/tokens/{name}\", s.TokenByName).\n\t\tMethods(\"GET\")\n\trouter.HandleFunc(\"categories\", s.Categories).\n\t\tMethods(\"GET\")\n\trouter.HandleFunc(\"crates\", s.SearchCrates).\n\t\tMethods(\"GET\")\n\trouter.HandleFunc(\"crates/new\", s.PublishCrates).\n\t\tMethods(\"PUT\")\n\trouter.HandleFunc(\"crates/suggest\", s.SuggestCrates).\n\t\tMethods(\"GET\")\n\trouter.HandleFunc(\"crates/{name}\", s.CrateInfo).\n\t\tMethods(\"GET\")\n\trouter.HandleFunc(\"crates/{name}/owners\", s.CrateOwnersInfo).\n\t\tMethods(\"GET\")\n\trouter.HandleFunc(\"crates/{name}/owners\", s.PutCrateOwners).\n\t\tMethods(\"PUT\")\n\trouter.HandleFunc(\"crates/{name}/owners\", s.DelCrateOwners).\n\t\tMethods(\"DELETE\")\n\trouter.HandleFunc(\"crates/{name}/{version}/yank\", s.YankCrate).\n\t\tMethods(\"DELETE\")\n\trouter.HandleFunc(\"crates/{name}/{version}/unyank\", s.UnyankCrate).\n\t\tMethods(\"PUT\")\n\trouter.HandleFunc(\"crates/{name}/{version}/download\", s.DownloadCrate).\n\t\tMethods(\"GET\")\n}", "title": "" }, { "docid": "a5de5989755c2b0e2ed6c925947a01e3", "score": "0.44222617", "text": "func ImplementedBy(implementation definitions.HelloWorldProviderInterface, componentLogger *zerolog.Logger) HelloWorldServiceConfig {\n\treturn HelloWorldServiceConfig{\n\t\timplementation,\n\t\tcomponentLogger,\n\t}\n}", "title": "" }, { "docid": "74cb4735764bc81d9e790bfb5116dfa4", "score": "0.44172567", "text": "func (p *Registrar) Register() {\n\tif err := p.client.Register(p.registration); err != nil {\n\t\tp.logger.Info(\"service Discovery status :: \", \"false\")\n\t\t//panic(\"service not find serviceDiscovery to register it\")\n\t\tp.registerErr = ErrNotRegisterServiceDiscovery\n\t} else {\n\t\tp.logger.Info(\"service Discovery status :: \", \" true\")\n\t}\n}", "title": "" }, { "docid": "d665d5128b58d9c9f036ce2a211100f1", "score": "0.44152987", "text": "func (k *k8sWatcher) handleEvent(event *watch.Event) {\n\tendpoints, ok := event.Object.(client.Endpoints)\n\tif !ok {\n\t\treturn\n\t}\n\n\tname, ok := endpoints.Metadata.Labels[labelNameKey]\n\tif !ok {\n\t\treturn\n\t}\n\n\tswitch event.Type {\n\tcase watch.Added, watch.Modified:\n\n\tcase watch.Deleted:\n\t\t// service was deleted, therefore all the nodes were too.\n\t\t// send in a blank\n\t\tk.next <- &registry.Result{\n\t\t\tAction: \"delete\",\n\t\t\tService: &registry.Service{Name: *name},\n\t\t}\n\t\treturn\n\tdefault:\n\t\treturn\n\t}\n\n\t// build services from endpoints data, not versioned.\n\t// each service should have one node only.\n\tvar svcs []*registry.Service\n\tsubset := endpoints.Subsets[0]\n\n\tif len(endpoints.Subsets) > 0 && len(subset.Addresses) > 0 && len(subset.Ports) > 0 {\n\t\tport := subset.Ports[0].Port\n\n\t\t// loop through endpoints\n\t\tfor _, address := range subset.Addresses {\n\t\t\tpodKey := annotationServiceKeyPrefix + address.TargetRef.Name\n\t\t\tsvcStr, podKeyOk := endpoints.Metadata.Annotations[podKey]\n\t\t\tif !podKeyOk {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// TODO: only do this if the service node has changed\n\t\t\t// from the cached version. Maybe have a SHA annotation.\n\t\t\tvar svc registry.Service\n\t\t\terr := json.Unmarshal([]byte(*svcStr), &svc)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tsvc.Nodes = []*registry.Node{\n\t\t\t\t&registry.Node{\n\t\t\t\t\tAddress: address.IP,\n\t\t\t\t\tPort: port,\n\t\t\t\t\tMetadata: svc.Nodes[0].Metadata,\n\t\t\t\t\tId: svc.Nodes[0].Id,\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tsvcs = append(svcs, &svc)\n\t\t}\n\t}\n\n\t// check cache\n\tk.Lock()\n\tcache, ok := k.services[*name]\n\tk.Unlock()\n\n\tif !ok {\n\t\t// service doesnt yet exist,\n\t\t// emit create for each service node.\n\t\tfor _, svc := range svcs {\n\t\t\tk.next <- &registry.Result{\n\t\t\t\tAction: \"create\",\n\t\t\t\tService: svc,\n\t\t\t}\n\t\t}\n\n\t\tk.RLock()\n\t\tk.services[*name] = svcs\n\t\tk.RUnlock()\n\t\treturn\n\t}\n\n\t// cache exists, trigger create/update/delete accordingly\n\n\t// find service in cache and emit update, otherwise emit create\n\tfor _, svc := range svcs {\n\t\tfound := false\n\n\t\tfor _, cSvc := range cache {\n\t\t\tif cSvc.Nodes[0].Id == svc.Nodes[0].Id {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif !found {\n\t\t\t// not in cache, so emit create\n\t\t\tk.next <- &registry.Result{\n\t\t\t\tAction: \"create\",\n\t\t\t\tService: svc,\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// in cache, so just send update\n\t\t// TODO: improve this, could do with some kind of hash\n\t\t// to compare against, and only send if changed\n\t\tk.next <- &registry.Result{\n\t\t\tAction: \"update\",\n\t\t\tService: svc,\n\t\t}\n\t}\n\n\t// remove items from cache no longer existing\n\tfor _, cSvc := range cache {\n\t\tfound := false\n\n\t\tfor _, svc := range svcs {\n\t\t\tif cSvc.Nodes[0].Id == svc.Nodes[0].Id {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif !found {\n\t\t\tk.next <- &registry.Result{\n\t\t\t\tAction: \"delete\",\n\t\t\t\tService: cSvc,\n\t\t\t}\n\t\t}\n\t}\n\n\tk.RLock()\n\tk.services[*name] = svcs\n\tk.RUnlock()\n\n}", "title": "" }, { "docid": "404c62f0a3a47ebf4e7ab7dfa5338b6f", "score": "0.44132784", "text": "func init() {\n\tRegistry.Add(\"senderInterface.Sender\", new(smtp.MailSenderImpl))\n}", "title": "" }, { "docid": "bd4cefed9411f9e14ecfa42a5d32b96d", "score": "0.44124007", "text": "func RegistryProvider() *Registry {\n\treturn globalRegistry.Load().(*Registry)\n}", "title": "" }, { "docid": "6a44e07a66774c323317f832e3ce9406", "score": "0.44106925", "text": "func init() {\n\tif err := mb.Registry.AddMetricSet(\"elasticsearch\", \"nodes\", New); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "f0d315e356c98493bf4a143bb6c5808c", "score": "0.44060934", "text": "func NewRegistry(cfg config.Metrics) (r Registry, err error) {\n\tprefix := cfg.Prefix\n\tif prefix == \"default\" {\n\t\tprefix = defaultPrefix()\n\t}\n\n\tfuncMap := template.FuncMap{\n\t\t\"clean\": clean,\n\t}\n\n\trouteMetricNameTemplate, err = template.New(\"routeMetricName\").Funcs(funcMap).Parse(cfg.RouteMetricNameTemplate)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := verifyTemplate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch cfg.Target {\n\tcase \"stdout\":\n\t\tlog.Printf(\"[INFO] Sending metrics to stdout\")\n\t\treturn gmStdoutRegistry(cfg.Interval)\n\n\tcase \"graphite\":\n\t\tlog.Printf(\"[INFO] Sending metrics to Graphite on %s as %q\", cfg.GraphiteAddr, prefix)\n\t\treturn gmGraphiteRegistry(prefix, cfg.GraphiteAddr, cfg.Interval)\n\n\tcase \"statsd\":\n\t\tlog.Printf(\"[INFO] Sending metrics to StatsD on %s as %q\", cfg.StatsDAddr, prefix)\n\t\treturn gmStatsDRegistry(prefix, cfg.StatsDAddr, cfg.Interval)\n\n\tcase \"circonus\":\n\t\treturn circonusRegistry(prefix,\n\t\t\tcfg.CirconusAPIKey,\n\t\t\tcfg.CirconusAPIApp,\n\t\t\tcfg.CirconusAPIURL,\n\t\t\tcfg.CirconusBrokerID,\n\t\t\tcfg.CirconusCheckID,\n\t\t\tcfg.Interval)\n\n\tdefault:\n\t\texit.Fatal(\"[FATAL] Invalid metrics target \", cfg.Target)\n\t}\n\tpanic(\"unreachable\")\n}", "title": "" }, { "docid": "37a3586084a5418036c5b7a4f7b7b9a1", "score": "0.44055697", "text": "func New() *Service {\n\tret := &Service{\n\t\tsqlBuilder: NewBuilder(),\n\t\tResource: view.EmptyResource(),\n\t}\n\tret.Resource.TypeRegistry().SetParent(config.Config.Types)\n\treturn ret\n}", "title": "" }, { "docid": "d5c3fdaad7fd1f4504f1b2ddbba4f1e9", "score": "0.44044307", "text": "func StackdriverMonitoringServiceDefinition() *broker.ServiceDefinition {\n\treturn &broker.ServiceDefinition{\n\t\tId: \"2bc0d9ed-3f68-4056-b842-4a85cfbc727f\",\n\t\tName: \"google-stackdriver-monitoring\",\n\t\tDescription: \"Stackdriver Monitoring provides visibility into the performance, uptime, and overall health of cloud-powered applications.\",\n\t\tDisplayName: \"Stackdriver Monitoring\",\n\t\tImageUrl: \"https://cloud.google.com/_static/images/cloud/products/logos/svg/stackdriver.svg\",\n\t\tDocumentationUrl: \"https://cloud.google.com/monitoring/docs/\",\n\t\tSupportUrl: \"https://cloud.google.com/stackdriver/docs/getting-support\",\n\t\tTags: []string{\"gcp\", \"stackdriver\", \"monitoring\", \"preview\"},\n\t\tBindable: true,\n\t\tPlanUpdateable: false,\n\t\tPlans: []broker.ServicePlan{\n\t\t\t{\n\t\t\t\tServicePlan: brokerapi.ServicePlan{\n\t\t\t\t\tID: \"2e4b85c1-0ce6-46e4-91f5-eebeb373e3f5\",\n\t\t\t\t\tName: \"default\",\n\t\t\t\t\tDescription: \"Stackdriver Monitoring default plan.\",\n\t\t\t\t\tFree: brokerapi.FreeValue(false),\n\t\t\t\t},\n\t\t\t\tServiceProperties: map[string]string{},\n\t\t\t},\n\t\t},\n\t\tProvisionInputVariables: []broker.BrokerVariable{},\n\t\tBindInputVariables: []broker.BrokerVariable{},\n\t\tBindComputedVariables: accountmanagers.FixedRoleBindComputedVariables(\"monitoring.metricWriter\"),\n\t\tBindOutputVariables: accountmanagers.ServiceAccountBindOutputVariables(),\n\t\tExamples: []broker.ServiceExample{\n\t\t\t{\n\t\t\t\tName: \"Basic Configuration\",\n\t\t\t\tDescription: \"Creates an account with the permission `monitoring.metricWriter` for writing metrics.\",\n\t\t\t\tPlanId: \"2e4b85c1-0ce6-46e4-91f5-eebeb373e3f5\",\n\t\t\t\tProvisionParams: map[string]interface{}{},\n\t\t\t\tBindParams: map[string]interface{}{},\n\t\t\t},\n\t\t},\n\t\tProviderBuilder: NewStackdriverAccountProvider,\n\t\tIsBuiltin: true,\n\t}\n}", "title": "" }, { "docid": "b6f238cca505bd1902db6b437107ee84", "score": "0.44020888", "text": "func Assemble(dt Deftree) error {\n\tmd := dt.(*MicroserviceDefinition)\n\tfor _, file := range md.Files {\n\t\tfor _, svc := range file.Services {\n\t\t\tfor _, meth := range svc.Methods {\n\t\t\t\tfor _, pbind := range meth.HttpBindings {\n\t\t\t\t\terr := contextualizeBinding(meth, pbind)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn errors.Wrap(err, \"contextualizing http bindings failed\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6ba706e45fd0f06b6008cf318bc62293", "score": "0.44009405", "text": "func initService(service *goa.Service) {\n\t// Setup encoders and decoders\n\tservice.Encoder.Register(goa.NewJSONEncoder, \"application/json\")\n\tservice.Encoder.Register(goa.NewGobEncoder, \"application/gob\", \"application/x-gob\")\n\tservice.Encoder.Register(goa.NewXMLEncoder, \"application/xml\")\n\tservice.Decoder.Register(goa.NewJSONDecoder, \"application/json\")\n\tservice.Decoder.Register(goa.NewGobDecoder, \"application/gob\", \"application/x-gob\")\n\tservice.Decoder.Register(goa.NewXMLDecoder, \"application/xml\")\n\n\t// Setup default encoder and decoder\n\tservice.Encoder.Register(goa.NewJSONEncoder, \"*/*\")\n\tservice.Decoder.Register(goa.NewJSONDecoder, \"*/*\")\n}", "title": "" }, { "docid": "6ba706e45fd0f06b6008cf318bc62293", "score": "0.44009405", "text": "func initService(service *goa.Service) {\n\t// Setup encoders and decoders\n\tservice.Encoder.Register(goa.NewJSONEncoder, \"application/json\")\n\tservice.Encoder.Register(goa.NewGobEncoder, \"application/gob\", \"application/x-gob\")\n\tservice.Encoder.Register(goa.NewXMLEncoder, \"application/xml\")\n\tservice.Decoder.Register(goa.NewJSONDecoder, \"application/json\")\n\tservice.Decoder.Register(goa.NewGobDecoder, \"application/gob\", \"application/x-gob\")\n\tservice.Decoder.Register(goa.NewXMLDecoder, \"application/xml\")\n\n\t// Setup default encoder and decoder\n\tservice.Encoder.Register(goa.NewJSONEncoder, \"*/*\")\n\tservice.Decoder.Register(goa.NewJSONDecoder, \"*/*\")\n}", "title": "" }, { "docid": "6ba706e45fd0f06b6008cf318bc62293", "score": "0.44009405", "text": "func initService(service *goa.Service) {\n\t// Setup encoders and decoders\n\tservice.Encoder.Register(goa.NewJSONEncoder, \"application/json\")\n\tservice.Encoder.Register(goa.NewGobEncoder, \"application/gob\", \"application/x-gob\")\n\tservice.Encoder.Register(goa.NewXMLEncoder, \"application/xml\")\n\tservice.Decoder.Register(goa.NewJSONDecoder, \"application/json\")\n\tservice.Decoder.Register(goa.NewGobDecoder, \"application/gob\", \"application/x-gob\")\n\tservice.Decoder.Register(goa.NewXMLDecoder, \"application/xml\")\n\n\t// Setup default encoder and decoder\n\tservice.Encoder.Register(goa.NewJSONEncoder, \"*/*\")\n\tservice.Decoder.Register(goa.NewJSONDecoder, \"*/*\")\n}", "title": "" }, { "docid": "6ba706e45fd0f06b6008cf318bc62293", "score": "0.44009405", "text": "func initService(service *goa.Service) {\n\t// Setup encoders and decoders\n\tservice.Encoder.Register(goa.NewJSONEncoder, \"application/json\")\n\tservice.Encoder.Register(goa.NewGobEncoder, \"application/gob\", \"application/x-gob\")\n\tservice.Encoder.Register(goa.NewXMLEncoder, \"application/xml\")\n\tservice.Decoder.Register(goa.NewJSONDecoder, \"application/json\")\n\tservice.Decoder.Register(goa.NewGobDecoder, \"application/gob\", \"application/x-gob\")\n\tservice.Decoder.Register(goa.NewXMLDecoder, \"application/xml\")\n\n\t// Setup default encoder and decoder\n\tservice.Encoder.Register(goa.NewJSONEncoder, \"*/*\")\n\tservice.Decoder.Register(goa.NewJSONDecoder, \"*/*\")\n}", "title": "" }, { "docid": "6ba706e45fd0f06b6008cf318bc62293", "score": "0.44009405", "text": "func initService(service *goa.Service) {\n\t// Setup encoders and decoders\n\tservice.Encoder.Register(goa.NewJSONEncoder, \"application/json\")\n\tservice.Encoder.Register(goa.NewGobEncoder, \"application/gob\", \"application/x-gob\")\n\tservice.Encoder.Register(goa.NewXMLEncoder, \"application/xml\")\n\tservice.Decoder.Register(goa.NewJSONDecoder, \"application/json\")\n\tservice.Decoder.Register(goa.NewGobDecoder, \"application/gob\", \"application/x-gob\")\n\tservice.Decoder.Register(goa.NewXMLDecoder, \"application/xml\")\n\n\t// Setup default encoder and decoder\n\tservice.Encoder.Register(goa.NewJSONEncoder, \"*/*\")\n\tservice.Decoder.Register(goa.NewJSONDecoder, \"*/*\")\n}", "title": "" }, { "docid": "6ba706e45fd0f06b6008cf318bc62293", "score": "0.44009405", "text": "func initService(service *goa.Service) {\n\t// Setup encoders and decoders\n\tservice.Encoder.Register(goa.NewJSONEncoder, \"application/json\")\n\tservice.Encoder.Register(goa.NewGobEncoder, \"application/gob\", \"application/x-gob\")\n\tservice.Encoder.Register(goa.NewXMLEncoder, \"application/xml\")\n\tservice.Decoder.Register(goa.NewJSONDecoder, \"application/json\")\n\tservice.Decoder.Register(goa.NewGobDecoder, \"application/gob\", \"application/x-gob\")\n\tservice.Decoder.Register(goa.NewXMLDecoder, \"application/xml\")\n\n\t// Setup default encoder and decoder\n\tservice.Encoder.Register(goa.NewJSONEncoder, \"*/*\")\n\tservice.Decoder.Register(goa.NewJSONDecoder, \"*/*\")\n}", "title": "" }, { "docid": "6ba706e45fd0f06b6008cf318bc62293", "score": "0.44009405", "text": "func initService(service *goa.Service) {\n\t// Setup encoders and decoders\n\tservice.Encoder.Register(goa.NewJSONEncoder, \"application/json\")\n\tservice.Encoder.Register(goa.NewGobEncoder, \"application/gob\", \"application/x-gob\")\n\tservice.Encoder.Register(goa.NewXMLEncoder, \"application/xml\")\n\tservice.Decoder.Register(goa.NewJSONDecoder, \"application/json\")\n\tservice.Decoder.Register(goa.NewGobDecoder, \"application/gob\", \"application/x-gob\")\n\tservice.Decoder.Register(goa.NewXMLDecoder, \"application/xml\")\n\n\t// Setup default encoder and decoder\n\tservice.Encoder.Register(goa.NewJSONEncoder, \"*/*\")\n\tservice.Decoder.Register(goa.NewJSONDecoder, \"*/*\")\n}", "title": "" }, { "docid": "a223262e9bf4ce648fa313d36a214abf", "score": "0.4392992", "text": "func init() {\n\tSchemeBuilder.Register(&StepIssuer{}, &StepIssuerList{})\n}", "title": "" }, { "docid": "fd55ab2e1b4a57d5c6f448b2ada498d7", "score": "0.43893903", "text": "func Service(owningStack *latest.Stack, name string, builders ...func(*coretypes.Service)) *coretypes.Service {\n\tsvc := &coretypes.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: owningStack.Namespace,\n\t\t\tLabels: labels.ForService(owningStack.Name, name),\n\t\t},\n\t}\n\tfor _, b := range builders {\n\t\tb(svc)\n\t}\n\treturn svc\n}", "title": "" }, { "docid": "33bf6650a2ab1c87f0dc9392c7d0fcfe", "score": "0.43799746", "text": "func expandServiceEndpointKubernetes(d *schema.ResourceData) (*serviceendpoint.ServiceEndpoint, *string, error) {\n\tserviceEndpoint, projectID := doBaseExpansion(d)\n\tserviceEndpoint.Type = converter.String(\"kubernetes\")\n\tserviceEndpoint.Url = converter.String(d.Get(resourceAttrAPIURL).(string))\n\n\tswitch d.Get(resourceAttrAuthType).(string) {\n\tcase \"AzureSubscription\":\n\t\tconfigurationRaw := d.Get(resourceBlockAzSubscription).(*schema.Set).List()\n\t\tconfiguration := configurationRaw[0].(map[string]interface{})\n\t\tserviceEndpoint.Authorization = &serviceendpoint.EndpointAuthorization{\n\t\t\tParameters: &map[string]string{\n\t\t\t\t\"azureEnvironment\": configuration[\"azure_environment\"].(string),\n\t\t\t\t\"azureTenantId\": configuration[\"tenant_id\"].(string),\n\t\t\t},\n\t\t\tScheme: converter.String(\"Kubernetes\"),\n\t\t}\n\n\t\tclusterID := fmt.Sprintf(\"/subscriptions/%s/resourcegroups/%s/providers/Microsoft.ContainerService/managedClusters/%s\", configuration[\"subscription_id\"].(string), configuration[\"resourcegroup_id\"].(string), configuration[\"cluster_name\"].(string))\n\t\tserviceEndpoint.Data = &map[string]string{\n\t\t\t\"authorizationType\": \"AzureSubscription\",\n\t\t\t\"azureSubscriptionId\": configuration[\"subscription_id\"].(string),\n\t\t\t\"azureSubscriptionName\": configuration[\"subscription_name\"].(string),\n\t\t\t\"clusterId\": clusterID,\n\t\t\t\"namespace\": configuration[\"namespace\"].(string),\n\t\t\t\"clusterAdmin\": strconv.FormatBool(configuration[\"cluster_admin\"].(bool)),\n\t\t}\n\tcase \"Kubeconfig\":\n\t\tconfigurationRaw := d.Get(resourceBlockKubeconfig).(*schema.Set).List()\n\t\tconfiguration := configurationRaw[0].(map[string]interface{})\n\n\t\tclusterContextInput := configuration[\"cluster_context\"].(string)\n\t\tif clusterContextInput == \"\" {\n\t\t\tkubeConfigYAML := configuration[\"kube_config\"].(string)\n\t\t\tvar kubeConfigYAMLUnmarshalled map[string]interface{}\n\t\t\terr := yaml.Unmarshal([]byte(kubeConfigYAML), &kubeConfigYAMLUnmarshalled)\n\t\t\tif err != nil {\n\t\t\t\terrResult := fmt.Errorf(\"kube_config contains an invalid YAML: %s\", err)\n\t\t\t\treturn nil, nil, errResult\n\t\t\t}\n\t\t\tclusterContextInputList := kubeConfigYAMLUnmarshalled[\"contexts\"].([]interface{})[0].(map[interface{}]interface{})\n\t\t\tclusterContextInput = clusterContextInputList[\"name\"].(string)\n\t\t}\n\n\t\tserviceEndpoint.Authorization = &serviceendpoint.EndpointAuthorization{\n\t\t\tParameters: &map[string]string{\n\t\t\t\t\"clusterContext\": clusterContextInput,\n\t\t\t\t\"kubeconfig\": configuration[\"kube_config\"].(string),\n\t\t\t},\n\t\t\tScheme: converter.String(\"Kubernetes\"),\n\t\t}\n\n\t\tserviceEndpoint.Data = &map[string]string{\n\t\t\t\"authorizationType\": \"Kubeconfig\",\n\t\t\t\"acceptUntrustedCerts\": fmt.Sprintf(\"%v\", configuration[\"accept_untrusted_certs\"].(bool)),\n\t\t}\n\tcase \"ServiceAccount\":\n\t\tconfigurationRaw := d.Get(resourceBlockServiceAccount).(*schema.Set).List()\n\t\tconfiguration := configurationRaw[0].(map[string]interface{})\n\n\t\tserviceEndpoint.Authorization = &serviceendpoint.EndpointAuthorization{\n\t\t\tParameters: &map[string]string{\n\t\t\t\t\"apiToken\": configuration[\"token\"].(string),\n\t\t\t\t\"serviceAccountCertificate\": configuration[\"ca_cert\"].(string),\n\t\t\t},\n\t\t\tScheme: converter.String(\"Token\"),\n\t\t}\n\n\t\tserviceEndpoint.Data = &map[string]string{\n\t\t\t\"authorizationType\": \"ServiceAccount\",\n\t\t}\n\t}\n\n\treturn serviceEndpoint, projectID, nil\n}", "title": "" }, { "docid": "5fea2edb80818f94d1bf7f54d113be9c", "score": "0.43793756", "text": "func registerServices(ctx context.Context, cfg Config, grpcServer *grpc.Server, gwmux *runtime.ServeMux, addr string, dopts []grpc.DialOption) error {\n\t// node object registry\n\tnodeObjReg, ok := ctx.Value(bootstrap.NodeObjRegistry).(map[string]interface{})\n\tif !ok {\n\t\treturn errors.New(\"failed to get %s\", bootstrap.NodeObjRegistry)\n\t}\n\n\t// load dependencies\n\tregistry, ok := nodeObjReg[documents.BootstrappedRegistry].(*documents.ServiceRegistry)\n\tif !ok {\n\t\treturn errors.New(\"failed to get %s\", documents.BootstrappedRegistry)\n\t}\n\n\tconfigService, ok := nodeObjReg[config.BootstrappedConfigStorage].(config.Service)\n\tif !ok {\n\t\treturn errors.New(\"failed to get %s\", config.BootstrappedConfigStorage)\n\t}\n\n\tInvoiceUnpaidService, ok := nodeObjReg[bootstrap.BootstrappedInvoiceUnpaid].(nft.InvoiceUnpaid)\n\tif !ok {\n\t\treturn errors.New(\"failed to get %s\", bootstrap.BootstrappedInvoiceUnpaid)\n\t}\n\n\t// register documents (common)\n\tdocumentpb.RegisterDocumentServiceServer(grpcServer, documents.GRPCHandler(configService, registry))\n\terr := documentpb.RegisterDocumentServiceHandlerFromEndpoint(ctx, gwmux, addr, dopts)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// register document types\n\terr = registerDocumentTypes(ctx, nodeObjReg, grpcServer, gwmux, addr, dopts)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// register other api endpoints\n\terr = registerAPIs(ctx, cfg, InvoiceUnpaidService, configService, nodeObjReg, grpcServer, gwmux, addr, dopts)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "313b9f6379f2540b7c333e1ee0591f7f", "score": "0.4360802", "text": "func initService(service *goa.Service) {\n\t// Setup encoders and decoders\n\tservice.Encoder.Register(goa.NewJSONEncoder, \"application/json\")\n\tservice.Decoder.Register(goa.NewJSONDecoder, \"application/json\")\n\tservice.Decoder.Register(goa.NewGobDecoder, \"application/gob\", \"application/x-gob\")\n\tservice.Decoder.Register(goa.NewXMLDecoder, \"application/xml\")\n\n\t// Setup default encoder and decoder\n\tservice.Encoder.Register(goa.NewJSONEncoder, \"*/*\")\n\tservice.Decoder.Register(goa.NewJSONDecoder, \"*/*\")\n}", "title": "" }, { "docid": "85c9bc02d75b79a5e33bf8972a78a317", "score": "0.43578663", "text": "func (p *GitLabProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"projects\": &ProjectGenerator{},\n\t\t\"groups\": &GroupGenerator{},\n\t}\n}", "title": "" }, { "docid": "26c7290416ddbd38d4cf67e4d7ae37c7", "score": "0.43549246", "text": "func NewService(options ...Option) (*Service, error) {\n\topts := NewOptions()\n\n\tfor _, f := range options {\n\t\tf(opts)\n\t}\n\n\tl := log.NewLogger(\n\t\tlog.Color(opts.Config.Log.Color),\n\t\tlog.Pretty(opts.Config.Log.Pretty),\n\t\tlog.Level(opts.Config.Log.Level),\n\t)\n\n\tglobalCtx, cancelGlobal := context.WithCancel(context.Background())\n\n\ts := &Service{\n\t\tServicesRegistry: make(serviceFuncMap),\n\t\tDelayed: make(serviceFuncMap),\n\t\tLog: l,\n\n\t\tserviceToken: make(map[string][]suture.ServiceToken),\n\t\tcontext: globalCtx,\n\t\tcancel: cancelGlobal,\n\t\tcfg: opts.Config,\n\t}\n\n\ts.ServicesRegistry[\"settings\"] = settings.NewSutureService\n\ts.ServicesRegistry[\"storage-metadata\"] = storage.NewStorageMetadata\n\ts.ServicesRegistry[\"glauth\"] = glauth.NewSutureService\n\ts.ServicesRegistry[\"graph\"] = graph.NewSutureService\n\ts.ServicesRegistry[\"graph-explorer\"] = graphExplorer.NewSutureService\n\ts.ServicesRegistry[\"idp\"] = idp.NewSutureService\n\ts.ServicesRegistry[\"ocs\"] = ocs.NewSutureService\n\ts.ServicesRegistry[\"store\"] = store.NewSutureService\n\ts.ServicesRegistry[\"thumbnails\"] = thumbnails.NewSutureService\n\ts.ServicesRegistry[\"web\"] = web.NewSutureService\n\ts.ServicesRegistry[\"webdav\"] = webdav.NewSutureService\n\ts.ServicesRegistry[\"storage-frontend\"] = storage.NewFrontend\n\ts.ServicesRegistry[\"storage-gateway\"] = storage.NewGateway\n\ts.ServicesRegistry[\"storage-userprovider\"] = storage.NewUserProvider\n\ts.ServicesRegistry[\"storage-groupprovider\"] = storage.NewGroupProvider\n\ts.ServicesRegistry[\"storage-authbasic\"] = storage.NewAuthBasic\n\ts.ServicesRegistry[\"storage-authbearer\"] = storage.NewAuthBearer\n\ts.ServicesRegistry[\"storage-home\"] = storage.NewStorageHome\n\ts.ServicesRegistry[\"storage-users\"] = storage.NewStorageUsers\n\ts.ServicesRegistry[\"storage-public-link\"] = storage.NewStoragePublicLink\n\ts.ServicesRegistry[\"storage-appprovider\"] = storage.NewAppProvider\n\n\t// populate delayed services\n\ts.Delayed[\"storage-sharing\"] = storage.NewSharing\n\ts.Delayed[\"accounts\"] = accounts.NewSutureService\n\ts.Delayed[\"proxy\"] = proxy.NewSutureService\n\n\treturn s, nil\n}", "title": "" }, { "docid": "abeba03393e41110bc1f1ee54dab94e5", "score": "0.43425977", "text": "func genRegionServiceNodes(data string) []VizceralNode {\n\t// Create interfaces\n\tvsg := []VizceralNode{}\n\n\treturn vsg\n}", "title": "" }, { "docid": "336831110edb1d6535ebedf05c69be29", "score": "0.43417656", "text": "func (m *_EndpointType) InitializeParent(parent ExtensionObjectDefinition) {}", "title": "" }, { "docid": "faa50de7e5c78e2b313c66b4038af39d", "score": "0.4341579", "text": "func CreateRegistry() Registry {\n\tvar reg registryStruct\n\n\treg.endpoints = make(map[string]Endpoint)\n\n\treturn &reg\n}", "title": "" }, { "docid": "90dd5a897f30a0ab55fa48b0901b0c17", "score": "0.43391466", "text": "func (lo *RegistrationObject) Run(ctx context.Context, kube client.Client) error {\n\tl := &srosv1.Registration{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"sros-registrations\",\n\t\t\t//OwnerReferences: []metav1.OwnerReference{meta.AsController(meta.TypedReferenceTo(&d.ObjectMeta, appsv1.SchemeGroupVersion.WithKind(\"Deployment\")))},\n\t\t},\n\t\tSpec: srosv1.RegistrationSpec{\n\t\t\tResourceSpec: nddv1.ResourceSpec{\n\t\t\t\tNetworkNodeReference: &nddv1.Reference{\n\t\t\t\t\tName: \"leaf1\",\n\t\t\t\t\t//Name: \"all\",\n\t\t\t\t},\n\t\t\t\tDeletionPolicy: nddv1.DeletionOrphan,\n\t\t\t\tActive: true,\n\t\t\t},\n\t\t\tForProvider: srosv1.RegistrationParameters{\n\t\t\t\tSubscriptions: []string{\n\t\t\t\t\t\"/acl\",\n\t\t\t\t\t\"/bfd\",\n\t\t\t\t\t\"/interface\",\n\t\t\t\t\t\"/network-instance\",\n\t\t\t\t\t\"/platform\",\n\t\t\t\t\t\"/qos\",\n\t\t\t\t\t\"/routing-policy\",\n\t\t\t\t\t\"/tunnel\",\n\t\t\t\t\t\"/tunnel-interface\",\n\t\t\t\t\t\"/system/snmp\",\n\t\t\t\t\t\"/system/sflow\",\n\t\t\t\t\t\"/system/ntp\",\n\t\t\t\t\t\"/system/network-instance\",\n\t\t\t\t\t\"/system/name\",\n\t\t\t\t\t\"/system/mtu\",\n\t\t\t\t\t\"/system/maintenance\",\n\t\t\t\t\t\"/system/lldp\",\n\t\t\t\t\t\"/system/lacp\",\n\t\t\t\t\t\"/system/authentication\",\n\t\t\t\t\t\"/system/banner\",\n\t\t\t\t\t\"/system/bridge-table\",\n\t\t\t\t\t\"/system/ftp-server\",\n\t\t\t\t\t\"/system/ip-load-balancing\",\n\t\t\t\t\t\"/system/json-rpc-server\",\n\t\t\t\t},\n\t\t\t\tExceptionPaths: []string{\n\t\t\t\t\t\"/interface[name=mgmt0]\",\n\t\t\t\t\t\"/network-instance[name=mgmt]\",\n\t\t\t\t\t\"/system/gnmi-server\",\n\t\t\t\t\t\"/system/tls\",\n\t\t\t\t\t\"/system/ssh-server\",\n\t\t\t\t\t\"/system/aaa\",\n\t\t\t\t\t\"/system/logging\",\n\t\t\t\t\t\"/acl/cpm-filter\",\n\t\t\t\t},\n\t\t\t\tExplicitExceptionPaths: []string{\n\t\t\t\t\t\"/acl\",\n\t\t\t\t\t\"/bfd\",\n\t\t\t\t\t\"/platform\",\n\t\t\t\t\t\"/qos\",\n\t\t\t\t\t\"/routing-policy\",\n\t\t\t\t\t\"/system\",\n\t\t\t\t\t\"/tunnel\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\treturn errors.Wrap(resource.NewAPIPatchingApplicator(kube).Apply(ctx, l), errApplyRegistration)\n}", "title": "" }, { "docid": "177c7511eb373872b97afdf5d52104d8", "score": "0.43375617", "text": "func (p *customPlugin) Start(config service.ServiceConfig, trigger chan string) error {\n\tif err := util.SetLogLevel(p.CustomLogLevel, config.LogLevel, logName); err != nil {\n\t\treturn maskAny(err)\n\t}\n\tif p.etcdURL != \"\" {\n\t\tetcdUrl, err := url.Parse(p.etcdURL)\n\t\tif err != nil {\n\t\t\treturn maskAny(fmt.Errorf(\"--etcd-url '%s' is not valid: %#v\", p.etcdURL, err))\n\t\t}\n\t\tp.etcdEndpoints = []string{fmt.Sprintf(\"%s://%s\", etcdUrl.Scheme, etcdUrl.Host)}\n\t\tp.etcdPath = etcdUrl.Path\n\t}\n\tif len(p.etcdEndpoints) == 0 {\n\t\t// ETCD not configured\n\t\treturn nil\n\t}\n\tetcdClient, err := newEtcdClient(p.etcdEndpoints)\n\tif err != nil {\n\t\treturn maskAny(err)\n\t}\n\tp.backend, err = newEtcdBackend(etcdClient, p.etcdPath, p.log)\n\tif err != nil {\n\t\treturn maskAny(err)\n\t}\n\tp.registrator, err = regapi.NewRegistratorClient(etcdClient, \"\", p.log)\n\tif err != nil {\n\t\treturn maskAny(err)\n\t}\n\t// Ensure rules dir exists\n\tif err := os.MkdirAll(config.RulesPath, 0755); err != nil {\n\t\treturn maskAny(err)\n\t}\n\n\t// Watch for backend updates\n\tgo func() {\n\t\tfor {\n\t\t\tif err := p.backend.Watch(); err != nil {\n\t\t\t\tp.log.Errorf(\"backend watch failed: %#v\", err)\n\t\t\t}\n\t\t\ttrigger <- \"custom-backend\"\n\t\t}\n\t}()\n\n\t// Watch for registrator updates\n\tgo func() {\n\t\tfor {\n\t\t\tif err := p.registrator.Watch(); err != nil {\n\t\t\t\tp.log.Errorf(\"registrator watch failed: %#v\", err)\n\t\t\t}\n\t\t\ttrigger <- \"custom-registrator\"\n\t\t}\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "d48194931f98bf5e851240f52b49e8e3", "score": "0.43363392", "text": "func (r *Registry) Impl() RegistryImpl {\n\treturn r.impl\n}", "title": "" } ]
ee6d6c59b28361eaa4ffb0c05066549f
UUIDv5Val creates a UUID v5 string based on the given inputs. Return value is a big.Int
[ { "docid": "bdcfdc9f5de81cc7a980e2c0f367c4ce", "score": "0.8887028", "text": "func UUIDv5Val(inputs ...string) big.Int {\n\tu := uuidv5(inputs...)\n\tvar i big.Int\n\ti.SetBytes(u[:])\n\treturn i\n}", "title": "" } ]
[ { "docid": "e2f929082cfd98df4bc6c1546b48f7a9", "score": "0.78646064", "text": "func UUIDv5(inputs ...string) string {\n\treturn uuidv5(inputs...).String()\n}", "title": "" }, { "docid": "25416b2b5273882e59304a7a8eafc5c2", "score": "0.7745002", "text": "func uuidv5(inputs ...string) uuid.UUID {\n\tvar baseUUID uuid.UUID\n\tinput := strings.Join(inputs, \"\\n\")\n\treturn uuid.NewHash(sha256.New(), baseUUID, []byte(input), 5)\n}", "title": "" }, { "docid": "eefae37f9cf5cec4d2c4578c2e9a625b", "score": "0.7555964", "text": "func uuidGenerateV5Fn(t *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {\n\tvar v string\n\tif err := starlark.UnpackPositionalArgs(b.Name(), args, nil, 1, &v); err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := uuid.NewSHA1(seedUUID, []byte(v))\n\treturn starlark.String(result.String()), nil\n}", "title": "" }, { "docid": "f23c3a677c1a40c84240ae76d9ce69c0", "score": "0.7512325", "text": "func UUID5(input string) uuid.UUID {\n\treturn uuid.NewV5(gnNamespace, input)\n}", "title": "" }, { "docid": "14904bf1105eb2650c33e482ad21b6c6", "score": "0.7475246", "text": "func GenerateUUIDV5(namespace, payload string) string {\n\tns, err := uuid.FromString(namespace)\n\tif err != nil {\n\t\tns = uuid.NamespaceOID\n\t}\n\treturn uuid.NewV5(ns, payload).String()\n}", "title": "" }, { "docid": "f6f45ecddbfd5a28afdb93c9721d9248", "score": "0.7276019", "text": "func UUIDv5Base36(inputs ...string) string {\n\ti := UUIDv5Val(inputs...)\n\treturn fmt.Sprintf(\"%025s\", i.Text(36))\n}", "title": "" }, { "docid": "263978a6af40112e77415f76d58697df", "score": "0.717627", "text": "func V5(ns UUID, data []byte) UUID {\n\treturn uuidOrPanic(GenerateV5(ns, data))\n}", "title": "" }, { "docid": "84cd1c14718c852de2641eb47a6b2a58", "score": "0.71453935", "text": "func NewV5(namespaceUUID *UUID, name []byte) *UUID {\n\tuuid := newByHash(sha1.New(), namespaceUUID, name)\n\tuuid[6] = (uuid[6] & 0x0f) | 0x50\n\treturn uuid\n}", "title": "" }, { "docid": "e55369c7dc541df5c743ed9462c91dee", "score": "0.71386814", "text": "func GenerateV5(ns UUID, data []byte) (UUID, error) {\n\tguid, err := hashUUID(sha1.New(), ns, data)\n\tif err != nil {\n\t\treturn Null, err\n\t}\n\treturn guid.withVersion(Version5), nil\n}", "title": "" }, { "docid": "bd908758581a4eeaa1d18475b4401e03", "score": "0.66457963", "text": "func NewV5(ns UUID, name []byte) UUID {\n\treturn v2.New(ns, name)\n}", "title": "" }, { "docid": "0b0295e002372d0d4b30d9026dcd433a", "score": "0.6601996", "text": "func NewV5(ns UUID, name string) UUID {\n\tu := newFromHash(sha1.New(), ns, name)\n\tu.SetVersion(5)\n\tu.SetVariant()\n\treturn u\n}", "title": "" }, { "docid": "b7de4dedc82ed53a0a0f7a99ea65c64a", "score": "0.64227265", "text": "func UUIDv4() *Config {\n\n\tmin := 36.0\n\tmax := 36.0\n\n\treturn NewConfig(\n\t\t\"98ceed88-756e-4823-96ef-2815eafc0c1e\",\n\t\tfunc (req web.RequestInterface, uid string) (*web.ResponseStatus, interface{}) {\n\n\t\t\tu, err := uuid.FromString(uid)\n\t\t\tif req.Log().Error(err) {\n\t\t\t\treturn req.Respond(400, err), nil\n\t\t\t}\n\n\t\t\treturn nil, u.String()\n\t\t},\n\t\tfunc (req web.RequestInterface, param interface{}) (*web.ResponseStatus, interface{}) {\n\n\t\t\tuid, ok := param.(string); if !ok { return req.Respond(400, ERR_NOT_STRING), nil }\n\n\t\t\tu, err := uuid.FromString(uid)\n\t\t\tif req.Log().Error(err) {\n\t\t\t\treturn req.Respond(400, err), nil\n\t\t\t}\n\n\t\t\treturn nil, u.String()\n\t\t},\n\t\tmin,\n\t\tmax,\n\t)\n}", "title": "" }, { "docid": "dcc286ed85d700773ceaa6d882848174", "score": "0.6343526", "text": "func BenchmarkUUID(b *testing.B) {\n\tgnUUID := uuid.NewV5(uuid.NamespaceDNS, \"globalnames.org\")\n\tn := \"UUID\"\n\tvar res uuid.UUID\n\tb.Run(n, func(b *testing.B) {\n\t\tfor i := 0; i < b.N; i++ {\n\t\t\tres = uuid.NewV5(gnUUID, \"Influenza A virus (A/blue-winged teal/Missouri/11OS2563/2011(H12N4))\")\n\t\t\t_ = res.String\n\t\t}\n\t\t_ = fmt.Sprintf(\"%d\", len(res))\n\t})\n}", "title": "" }, { "docid": "042f5e83c18530514b56ba26ecf8e7d7", "score": "0.6341688", "text": "func UUID5s(input []string) []uuid.UUID {\n\tuuids := make([]uuid.UUID, len(input))\n\tfor i := range input {\n\t\tuuids[i] = UUID5(input[i])\n\t}\n\treturn uuids\n}", "title": "" }, { "docid": "b31e9f07842eadb450c5021282e6b83e", "score": "0.63252944", "text": "func NewV5(namespace Implementation, names ...interface{}) UUID {\n\treturn generator.NewV5(namespace, names...)\n}", "title": "" }, { "docid": "0bdddc9ce54856d7f6cc6551672e9764", "score": "0.6200488", "text": "func GenerateUUID(val string) string {\r\n\treturn uuid.NewMD5(uuid.NameSpace_DNS, []byte(val)).String()\r\n}", "title": "" }, { "docid": "9f2c20f63672f2b6d5cb85f5b31ce98f", "score": "0.6190651", "text": "func uuidGenerateV3Fn(t *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {\n\tvar v string\n\tif err := starlark.UnpackPositionalArgs(b.Name(), args, nil, 1, &v); err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := uuid.NewMD5(seedUUID, []byte(v))\n\treturn starlark.String(result.String()), nil\n}", "title": "" }, { "docid": "71d4fda0fe82ee57299e0db12a427afb", "score": "0.61452484", "text": "func UUIDString(v int64) string {\n\treturn fmt.Sprintf(\"%x%x%x%x%x%x%x%x\", byte(v>>56), byte(v>>48), byte(v>>40), byte(v>>32), byte(v>>24), byte(v>>16), byte(v>>8), byte(v))\n}", "title": "" }, { "docid": "25ffb35ea8c49ef6309170a6342d6a68", "score": "0.61267304", "text": "func UUIDv4() (uid string) {\n\tu := make([]byte, 16)\n\trand.Read(u)\n\tu[6] = (u[6] & 0x0f) | 0x40\n\tu[8] = (u[8] & 0x3f) | 0x80\n\tuid = fmt.Sprintf(\"%x-%x-%x-%x-%x\", u[0:4], u[4:6], u[6:8], u[8:10], u[10:])\n\treturn\n}", "title": "" }, { "docid": "8b3d9dde9885391159afc93a7eedff7a", "score": "0.6046912", "text": "func uuidGenerateV4Fn(t *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {\n\treturn starlark.String(uuid.New().String()), nil\n}", "title": "" }, { "docid": "470e121020bbe55e2244ba88d03e127c", "score": "0.5996392", "text": "func generateUUID() string {\n\tuuid := make([]byte, 16)\n\tif _, err := io.ReadFull(rand.Reader, uuid); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tuuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4\n\tuuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10\n\n\tvar hexbuf [32]byte\n\n\thex.Encode(hexbuf[:], uuid[:])\n\treturn string(hexbuf[:])\n}", "title": "" }, { "docid": "40a0ff8e30341ee67026c94d32e6a054", "score": "0.5846304", "text": "func NewUUIDV4() (string, error) {\n\tstr := strings.Split(\"0123456789abcdef\", \"\")\n\ta := []string{}\n\n\tt := time.Now().UnixNano()\n\trand.Seed(t)\n\n\tfor i := 0; i < 36; i++ {\n\t\ta = append(a, str[rand.Intn(16)])\n\t}\n\tb := strings.Join(a, \"\")\n\n\tuuid := fmt.Sprintf(\"%s-%s-%s-%s-%s\", b[0:8], b[9:13], b[14:18], b[19:23], b[24:36])\n\n\treturn uuid, nil\n}", "title": "" }, { "docid": "f89b22c363654e692a4640af42612b06", "score": "0.58241296", "text": "func uuid() string {\n\tb := make([]byte, 16)\n\trand.Read(b)\n\tb[6] = (b[6] & 0x0f) | 0x40\n\tb[8] = (b[8] & 0x3f) | 0x80\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", b[0:4], b[4:6], b[6:8], b[8:10],\n\t\tb[10:])\n}", "title": "" }, { "docid": "3248fd810965b9c2057ee762878b9b52", "score": "0.58208764", "text": "func (fnUUID) Eval(params ...interface{}) (interface{}, error) {\n\tuuid := make([]byte, 16)\n\tn, err := io.ReadFull(rand.Reader, uuid)\n\tif n != len(uuid) || err != nil {\n\t\treturn \"\", err\n\t}\n\t// variant bits; see section 4.1.1\n\tuuid[8] = uuid[8]&^0xc0 | 0x80\n\t// version 4 (pseudo-random); see section 4.1.3\n\tuuid[6] = uuid[6]&^0xf0 | 0x40\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:]), nil\n}", "title": "" }, { "docid": "cc742247b9dd3af4029dcba61756b83f", "score": "0.58194953", "text": "func UUIDOf(version Version) string {\n\tswitch version {\n\tcase V1:\n\t\treturn uuid.NewV1().String()\n\tcase V4:\n\t\treturn uuid.NewV4().String()\n\t}\n\treturn uuid.NewV4().String()\n}", "title": "" }, { "docid": "c09d25d79d1371acf683692d7b23feab", "score": "0.5814103", "text": "func randValue() string {\n\tb := make([]byte, md5.Size)\n\t_, _ = rand.Read(b)\n\treturn hex.EncodeToString(b)\n}", "title": "" }, { "docid": "42f911ec65b5160689d74a2f51bf2157", "score": "0.5800966", "text": "func newUUID() string {\n\tuuid := make([]byte, 16)\n\tn, err := io.ReadFull(rand.Reader, uuid)\n\tif n != len(uuid) || err != nil {\n\t\treturn \"\"\n\t}\n\t// variant bits; see section 4.1.1\n\tuuid[8] = uuid[8]&^0xc0 | 0x80\n\t// version 4 (pseudo-random); see section 4.1.3\n\tuuid[6] = uuid[6]&^0xf0 | 0x40\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:])\n}", "title": "" }, { "docid": "8be1b17d5721b20c8f1d458a704cc6b4", "score": "0.5788561", "text": "func UUID() string {\n\tversion := byte(4)\n\tuuid := make([]byte, 16)\n\t_, err := rand.Read(uuid)\n\tif err != nil {\n\t\tpanic(\"failed to read from random generator: \" + err.Error())\n\t}\n\n\t// Set version\n\tuuid[6] = (uuid[6] & 0x0f) | (version << 4)\n\n\t// Set variant\n\tuuid[8] = (uuid[8] & 0xbf) | 0x80\n\n\tbuf := make([]byte, 36)\n\tvar dash byte = '-'\n\thex.Encode(buf[0:8], uuid[0:4])\n\tbuf[8] = dash\n\thex.Encode(buf[9:13], uuid[4:6])\n\tbuf[13] = dash\n\thex.Encode(buf[14:18], uuid[6:8])\n\tbuf[18] = dash\n\thex.Encode(buf[19:23], uuid[8:10])\n\tbuf[23] = dash\n\thex.Encode(buf[24:], uuid[10:])\n\n\treturn string(buf)\n}", "title": "" }, { "docid": "d744644ea07bf3c4723e387523aa3122", "score": "0.57583", "text": "func (s *service) generateUUID(val1, val2 string) (string, error) {\n\tdata := strings.Join([]string{val1, val2}, \":\")\n\thash := sha1.New()\n\t_, err := hash.Write([]byte(data))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\thashed := fmt.Sprintf(\"%x\", hash.Sum(nil))\n\treturn hashed, nil\n}", "title": "" }, { "docid": "5c7f2f221e4fc7a36d5b5e0137ed116e", "score": "0.57432467", "text": "func newUUID() (string) {\n\tuuid := make([]byte, 16)\n\tn, err := io.ReadFull(rand.Reader, uuid)\n\tif n != len(uuid) || err != nil {\n\t\treturn \"\"\n\t}\n\t// variant bits; see section 4.1.1\n\tuuid[8] = uuid[8]&^0xc0 | 0x80\n\t// version 4 (pseudo-random); see section 4.1.3\n\tuuid[6] = uuid[6]&^0xf0 | 0x40\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:])\n}", "title": "" }, { "docid": "43b9679c86d2f1b2811e4f29e8f068f9", "score": "0.5729643", "text": "func GetUUIDStr() string { return string(GetUUID()) }", "title": "" }, { "docid": "eba5299a54517dd61f4548aa57036727", "score": "0.5709278", "text": "func uuid() string {\n\tb := make([]byte, 16)\n\trand.Read(b)\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", b[0:4], b[4:6], b[6:8], b[8:10], b[10:])\n}", "title": "" }, { "docid": "7f9cfe13b47c558716007c001a382465", "score": "0.5698825", "text": "func genMD5(slice ...string) string {\n\th := md5.New()\n\tfor _, v := range slice {\n\t\tio.WriteString(h, v)\n\t}\n\treturn fmt.Sprintf(\"%x\", h.Sum(nil))\n}", "title": "" }, { "docid": "6e7b1d7ab673e5c4e0d970280b5a764f", "score": "0.568151", "text": "func newUUID() (string, error) {\n uuid := make([]byte, 16)\n n, err := io.ReadFull(rand.Reader, uuid)\n if n != len(uuid) || err != nil {\n return \"\", err\n }\n // variant bits; see section 4.1.1\n uuid[8] = uuid[8]&^0xc0 | 0x80\n // version 4 (pseudo-random); see section 4.1.3\n uuid[6] = uuid[6]&^0xf0 | 0x40\n return fmt.Sprintf(\"%x-%x-%x-%x-%x\", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:]), nil\n}", "title": "" }, { "docid": "be1c3f8bce7787cb0232aa56b039227b", "score": "0.5654865", "text": "func StringUUID(s string) int64 {\n\th := fnv.New64a()\n\t_, err := h.Write([]byte(s))\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"StringUUID(%s) failed for: %s\", s, err.Error()))\n\t}\n\treturn int64(h.Sum64())\n}", "title": "" }, { "docid": "01340f38d884ed6d98b9f0fa18c52e9c", "score": "0.56158507", "text": "func newUUID3() (string, error) {\n\t/*This won't work on Windows\n\tout, err := exec.Command(\"uuidgen\").Output()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}*/\n\tout, err := uuid.NewV4()\n\tif err != nil {\n\t\tfmt.Println(\"error:\", err)\n\t\treturn out.String(), err\n\t}\n\t//fmt.Println(out)\n\treturn out.String(), err\n}", "title": "" }, { "docid": "a3f8089458ae23a83b23a39931fc4cb5", "score": "0.5614034", "text": "func newUUID() (string, error) {\n\tuuid := make([]byte, 16)\n\tn, err := io.ReadFull(rand.Reader, uuid)\n\tif n != len(uuid) || err != nil {\n\t\treturn \"\", err\n\t}\n\t// variant bits; see section 4.1.1\n\tuuid[8] = uuid[8]&^0xc0 | 0x80\n\t// version 4 (pseudo-random); see section 4.1.3\n\tuuid[6] = uuid[6]&^0xf0 | 0x40\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:]), nil\n}", "title": "" }, { "docid": "a3f8089458ae23a83b23a39931fc4cb5", "score": "0.5614034", "text": "func newUUID() (string, error) {\n\tuuid := make([]byte, 16)\n\tn, err := io.ReadFull(rand.Reader, uuid)\n\tif n != len(uuid) || err != nil {\n\t\treturn \"\", err\n\t}\n\t// variant bits; see section 4.1.1\n\tuuid[8] = uuid[8]&^0xc0 | 0x80\n\t// version 4 (pseudo-random); see section 4.1.3\n\tuuid[6] = uuid[6]&^0xf0 | 0x40\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:]), nil\n}", "title": "" }, { "docid": "fa335f4c637b1bbc745e2ce375844cef", "score": "0.5604868", "text": "func uuidVersion4(u [16]byte) string {\n\t// https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29\n\n\t// 13th character is \"4\"\n\tu[6] = (u[6] & 0x0f) | 0x40 // Version 4\n\t// 17th character is \"8\", \"9\", \"a\", or \"b\"\n\tu[8] = (u[8] & 0x3f) | 0x80 // Variant is 10\n\n\treturn fmt.Sprintf(`%X-%X-%X-%X-%X`, u[0:4], u[4:6], u[6:8], u[8:10], u[10:])\n}", "title": "" }, { "docid": "75e84f7625939de4217ced77022db9d7", "score": "0.56027704", "text": "func Uuid() string {\n\tout, error := exec.Command(\"/usr/bin/uuidgen\").Output()\n\tif error != nil {\n\t\tlog.Errorf(\"Uuid generation failed: %s.\", error)\n\t}\n\treturn strings.Trim(string(out[:]), \"\\n \")\n}", "title": "" }, { "docid": "fb00a0e3266473b8644ff409a664dd7a", "score": "0.55982167", "text": "func UUID() string {\n\tvar b [16]byte\n\tif _, err := rand.Reader.Read(b[:]); err != nil {\n\t\treturn \"\"\n\t}\n\tb[6] = (b[6] & 0x0f) | 0x40\n\tb[8] = (b[8] & 0x3f) | 0x80\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", b[0:4], b[4:6], b[6:8], b[8:10], b[10:])\n}", "title": "" }, { "docid": "85967ecfa4714f242cf34d9416de0b48", "score": "0.5567503", "text": "func getMd5(in uint32) string {\n hash := md5.New()\n hash.Write([]byte(string(in)))\n\n return fmt.Sprintf(\"%x\", hash.Sum(nil))\n}", "title": "" }, { "docid": "f97fc0b1c6e568ebf7e1895be8a85253", "score": "0.5563593", "text": "func GenUUID() string {\n\tb := make([]byte, 16)\n\trand.Read(b)\n\n\t// set version\n\tb[6] = (b[6] & 0xF) | (4 << 4)\n\t// set variant to 10\n\tb[8] = (b[8] & 0x3F) | 0x80\n\n\treturn FormatUUID(b)\n}", "title": "" }, { "docid": "9257882932111031b60d304379eb52b6", "score": "0.5546147", "text": "func uuid() string {\n\tuuid := make([]byte, 16)\n\tif _, err := rand.Read(uuid); err != nil {\n\t\treturn \"\"\n\t}\n\t// see section 4.1.1.\n\tuuid[8] = uuid[8]&^0xc0 | 0x80\n\t// see section 4.1.3.\n\tuuid[6] = uuid[6]&^0xf0 | 0x40\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:])\n}", "title": "" }, { "docid": "1c9e33755ae168ea8b9e9c230c7ba2c1", "score": "0.55342287", "text": "func ByteUUID(s []byte) int64 {\n\th := fnv.New64a()\n\t_, err := h.Write(s)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"ByteUUID(%s) failed for: %s\", s, err.Error()))\n\t}\n\treturn int64(h.Sum64())\n}", "title": "" }, { "docid": "ff58afa7439e8188ad389c01b10a6ce3", "score": "0.5533731", "text": "func newUUID(value uuid.UUID) UUID {\n\treturn UUID{\n\t\tUUID: value,\n\t\tValid: value != uuid.Nil,\n\t}\n}", "title": "" }, { "docid": "ee061ef88bdf2297bc5bfec82fd35319", "score": "0.55177605", "text": "func newUUID2() (string, error) {\n\t/*This won't work on Windows\n\tout, err := exec.Command(\"uuidgen\").Output()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}*/\n\tout, err := uuid.NewV4()\n\tif err != nil {\n\t\tfmt.Println(\"error:\", err)\n\t\treturn out.String(), err\n\t}\n\t//fmt.Println(out)\n\treturn out.String(), err\n}", "title": "" }, { "docid": "e719adc8a8dd3731c081d38fb4515330", "score": "0.5508481", "text": "func newUUID() string {\n\treturn uuid.Must(uuid.NewV4()).String()\n}", "title": "" }, { "docid": "2a399ed97f8dc030157ccdfe7aabf36a", "score": "0.549452", "text": "func (f *UUID) NewUUID() string {\n\tvar b bytes.Buffer\n\tencoder := base32.NewEncoder(encoding, &b)\n\tencoder.Write(uuid.NewRandom())\n\tencoder.Close()\n\tb.Truncate(26) // removes the '==' padding\n\treturn b.String()\n}", "title": "" }, { "docid": "fd8ba5e57b18524af563d00001a1e8dd", "score": "0.54902977", "text": "func generateMD5( string string) (md5hash hash.Hash){\n\n\treturn\n}", "title": "" }, { "docid": "0eb81e0b2d9e2cddb9e79944ed35d74d", "score": "0.5485431", "text": "func Md5Base36(s string) string {\n\ti := new(big.Int)\n\ti.SetString(fmt.Sprintf(\"%x\", cryptomd5.Sum([]byte(s))), 16)\n\treturn fmt.Sprintf(md5Base36Format, i.Text(36))\n}", "title": "" }, { "docid": "7f346d4979eb2cad5aa2b542bb06ef06", "score": "0.54733163", "text": "func newUUID() (u uuid) {\n\tu = uuid{}\n\t// Set all bits to randomly (or pseudo-randomly) chosen values.\n\trand.Read(u[:])\n\tu[8] = (u[8] | reservedRFC4122) & 0x7F // u.setVariant(ReservedRFC4122)\n\n\tvar version byte = 4\n\tu[6] = (u[6] & 0xF) | (version << 4) // u.setVersion(4)\n\treturn\n}", "title": "" }, { "docid": "7f346d4979eb2cad5aa2b542bb06ef06", "score": "0.54733163", "text": "func newUUID() (u uuid) {\n\tu = uuid{}\n\t// Set all bits to randomly (or pseudo-randomly) chosen values.\n\trand.Read(u[:])\n\tu[8] = (u[8] | reservedRFC4122) & 0x7F // u.setVariant(ReservedRFC4122)\n\n\tvar version byte = 4\n\tu[6] = (u[6] & 0xF) | (version << 4) // u.setVersion(4)\n\treturn\n}", "title": "" }, { "docid": "71b89ed8994d24d93f99b4d3126d5c6c", "score": "0.54658896", "text": "func NewUuid() string {\n\tvar uuid_ *uuid.UUID\n\tuuid_,_ = uuid.NewV4()\n\n\treturn (*uuid_).String()\n}", "title": "" }, { "docid": "825932efdcc4141d411d92e6a797b9cb", "score": "0.5462363", "text": "func UUID4() string {\n\tb := make([]byte, 16)\n\t_, err := rand.Read(b)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tb[6] = (b[6] & 0x0f) | (4 << 4)\n\tb[8] = (b[8] & 0xbf) | 0x80\n\n\tbuf := make([]byte, 36)\n\tdash := byte('-')\n\thex.Encode(buf[0:8], b[0:4])\n\tbuf[8] = dash\n\thex.Encode(buf[9:13], b[4:6])\n\tbuf[13] = dash\n\thex.Encode(buf[14:18], b[6:8])\n\tbuf[18] = dash\n\thex.Encode(buf[19:23], b[8:10])\n\tbuf[23] = dash\n\thex.Encode(buf[24:], b[10:])\n\n\treturn string(buf)\n}", "title": "" }, { "docid": "fd905517f47165e27287b358408da0a7", "score": "0.542959", "text": "func UUIDGen(str string) string {\n\tsecret := \"\"\n\th := hmac.New(sha256.New, []byte(secret))\n\th.Write([]byte(str))\n\tsha := hex.EncodeToString(h.Sum(nil))\n\treturn sha\n}", "title": "" }, { "docid": "3d7f07aa78baa5ca6eee0e53c4a98062", "score": "0.54227006", "text": "func getNewID (str string) string{\n var ret string\n md5sum := md5.New()\n io.WriteString(md5sum, str)\n ret = fmt.Sprintf(\"%x\",md5sum.Sum([]byte(str)))\n return ret\n}", "title": "" }, { "docid": "d055b20bfd612c550162f24241c8b821", "score": "0.54215544", "text": "func GenUUIDV4() (string, error) {\n\tnewUUID, err := uuid.NewRandom()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn newUUID.String(), nil\n}", "title": "" }, { "docid": "9b11547d1e23c8e3d4f9a15639e012f9", "score": "0.54203624", "text": "func NewUUID() string {\n\treturn ToString(generator.Next())\n}", "title": "" }, { "docid": "789149ba1cef28d12010ec1323ce78ed", "score": "0.54137146", "text": "func NewUUID(v uuid.UUID) UUID {\n\tb := UUID{v}\n\treturn b\n}", "title": "" }, { "docid": "fde2184b025369203c83e66b82547ff7", "score": "0.5403681", "text": "func MD5(vm *otto.Otto) {\n\tvm.Set(\"md5\", func(call otto.FunctionCall) otto.Value {\n\t\ta0 := call.Argument(0)\n\t\tif !a0.IsString() {\n\t\t\tfmt.Println(\"ERROR\", \"md5(string)\")\n\t\t\treturn otto.Value{}\n\t\t}\n\t\ts, err := a0.ToString()\n\t\tif err != nil {\n\t\t\tfmt.Println(\"ERROR\", err)\n\t\t\treturn otto.Value{}\n\t\t}\n\t\ts = x.MD5(s)\n\t\tv, err := vm.ToValue(s)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"ERROR\", err)\n\t\t\treturn otto.Value{}\n\t\t}\n\t\treturn v\n\t})\n}", "title": "" }, { "docid": "b68d6174072f2d3b87fd79dff2f437f0", "score": "0.540227", "text": "func NewUUID() string {\n\tu1 := uuid.NewV4()\n\ts1 := fmt.Sprintf(\"%s\", u1)\n\treturn strings.Split(s1, \"-\")[0]\n}", "title": "" }, { "docid": "c39a69e327376679ebca789cf3b59633", "score": "0.54002935", "text": "func TestUUID(t *testing.T) {\n\tfor i := 0; i < 10; i++ {\n\t\tuuid := NewUUID4()\n\t\tt.Log(uuid.String())\n\t}\n}", "title": "" }, { "docid": "858f1b0cd3d9e79589897e4dd89a5a25", "score": "0.5396681", "text": "func (uuid UUID) String() string {\n\t//b := [16]byte(uuid)\n\tb := uuid\n\treturn fmt.Sprintf(\n\t\t\"%08x-%04x-%04x-%04x-%012x\", b[:4], b[4:6], b[6:8], b[8:10], b[10:],\n\t)\n}", "title": "" }, { "docid": "aaabdbb41ae71d75712e109751d310bf", "score": "0.53889513", "text": "func New() (string, error) {\n\n\tuuid, err := NewBytes()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// 36-character uuid string\n\ts := make([]byte, 36)\n\n\ti := 0 // string index\n\tfor _, v := range uuid {\n\t\t// Insert hyphens at appropriate indices\n\t\tif i == 8 || i == 13 || i == 18 || i == 23 {\n\t\t\ts[i] = byte(sep)\n\t\t\ti++\n\t\t}\n\t\t// Convert byte to two chars\n\t\ts[i] = hex[v>>4]\n\t\ts[i+1] = hex[v&0x0f]\n\t\ti += 2\n\t}\n\n\treturn string(s), nil\n}", "title": "" }, { "docid": "a07132bad61676e6f71a999e85d55d2d", "score": "0.53875405", "text": "func NewUUID() (string, error) {\n\tuuid := make([]byte, 16)\n\tn, err := io.ReadFull(cryptoRand.Reader, uuid)\n\tif n != len(uuid) || err != nil {\n\t\treturn \"\", err\n\t}\n\t// variant bits; see section 4.1.1\n\tuuid[8] = uuid[8]&^0xc0 | 0x80\n\t// version 4 (pseudo-random); see section 4.1.3\n\tuuid[6] = uuid[6]&^0xf0 | 0x40\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:]), nil\n}", "title": "" }, { "docid": "32f2697af4fb91bd58783d8a35b75a61", "score": "0.53818387", "text": "func UUID4() (string, error) {\n\tb := make([]byte, 16)\n\t_, err := rand.Read(b)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tb[6] = (b[6] & 0x0f) | 0x40\n\tb[8] = (b[8] & 0x3f) | 0x80\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", b[0:4], b[4:6], b[6:8], b[8:10], b[10:]), nil\n}", "title": "" }, { "docid": "1b7d955157ed032e14919f98f7b16aef", "score": "0.53804326", "text": "func createUUID() (uuid string) {\n\tu := new([16]byte)\n\t_, err := rand.Read(u[:])\n\tif err != nil {\n\t\tutils.Danger(\"Cannot generate UUID\", err)\n\t}\n\n\t// 0x40 is reserved variant from RFC 4122\n\tu[8] = (u[8] | 0x40) & 0x7F\n\t// Set the four most significant bits (bits 12 through 15) of the\n\t// time_hi_and_version field to the 4-bit version number.\n\tu[6] = (u[6] & 0xF) | (0x4 << 4)\n\tuuid = fmt.Sprintf(\"%x-%x-%x-%x-%x\", u[0:4], u[4:6], u[6:8], u[8:10], u[10:])\n\treturn\n}", "title": "" }, { "docid": "80e6527ecd9c6c31cb27e07400bd065b", "score": "0.5373437", "text": "func TestFixedUUIDGeneration(t *testing.T) {\n\tu := uuid.FixedUUID{}\n\tuuid := u.UUID()\n\trequire.Equal(t, uuid, \"9dcc77fc-dda5-4edf-a683-64f2589036d6\")\n}", "title": "" }, { "docid": "281cab43679ee4124ad18605e9a566c3", "score": "0.5369737", "text": "func NewUUID() (string, error) {\n\tuuid := make([]byte, 16)\n\tn, err := io.ReadFull(rand.Reader, uuid)\n\tif n != len(uuid) || err != nil {\n\t\treturn \"\", err\n\t}\n\t// variant bits; see section 4.1.1\n\tuuid[8] = uuid[8]&^0xc0 | 0x80\n\t// version 4 (pseudo-random); see section 4.1.3\n\tuuid[6] = uuid[6]&^0xf0 | 0x40\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:]), nil\n}", "title": "" }, { "docid": "281cab43679ee4124ad18605e9a566c3", "score": "0.5369737", "text": "func NewUUID() (string, error) {\n\tuuid := make([]byte, 16)\n\tn, err := io.ReadFull(rand.Reader, uuid)\n\tif n != len(uuid) || err != nil {\n\t\treturn \"\", err\n\t}\n\t// variant bits; see section 4.1.1\n\tuuid[8] = uuid[8]&^0xc0 | 0x80\n\t// version 4 (pseudo-random); see section 4.1.3\n\tuuid[6] = uuid[6]&^0xf0 | 0x40\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:]), nil\n}", "title": "" }, { "docid": "93c5905a702e1305dcf248d21e3bea08", "score": "0.5362613", "text": "func NewUUID() (string, error) {\n\tuuid := make([]byte, 16)\n\tn, err := io.ReadFull(rand.Reader, uuid)\n\tif n != len(uuid) || err != nil {\n\t\treturn \"\", err\n\t}\n\t// variant bits; see section 4.1.1\n\tuuid[8] = uuid[8]&^0xc0 | 0x80\n\t// version 4 (pseudo-random); see section 4.1.3\n\tuuid[6] = uuid[6]&^0xf0 | 0x40\n\n\tuuid_str := fmt.Sprintf(\"%x-%x-%x-%x-%x\", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:])\n\n\treturn uuid_str, err\n}", "title": "" }, { "docid": "fad67464a423ffc4117ff1708c7cbbd7", "score": "0.53616124", "text": "func TestGenUUID(t *testing.T) {\n\tassert := assert.New(t)\n\tfor i := 0; i < 100; i++ {\n\t\tu := Generate()\n\t\ts := u.String()\n\t\tassert.EqualValues(s[14], '4')\n\t\tu2, err := Parse(s)\n\t\tassert.NoError(err)\n\t\tassert.Equal(u, u2)\n\t}\n}", "title": "" }, { "docid": "e9898ba7d34f1243c63112e132cb93c7", "score": "0.53588545", "text": "func NewUUID() []byte {\n\tb := make([]byte, 16)\n\n\trand.Read(b)\n\n\tb[6] = (b[6] & 0x0f) | 0x40\n\tb[8] = (b[8] & 0x3f) | 0x80\n\n\treturn b\n}", "title": "" }, { "docid": "c5ba51b5c9f6f55bd39005b701177674", "score": "0.53455603", "text": "func GetUUIDByLen(length int) string {\n\ttime.Sleep(time.Nanosecond)\n\tm := MD5(strconv.FormatInt(GetID(), 10))\n\tif len(m) > length && length > 0 {\n\t\treturn m[:length]\n\t}\n\treturn m\n}", "title": "" }, { "docid": "f7ffe04ae9401d482cd55aecdc7be095", "score": "0.5345043", "text": "func GenUUID() string {\n\t// V4: one chance in 17 billion.\n\tnewUUID, err := GenUUIDV4()\n\tif err != nil {\n\t\t// NOTE: V1.\n\t\tnewUUID, _ = GenUUIDV1()\n\t}\n\treturn newUUID\n}", "title": "" }, { "docid": "11b8ee524cf78e1c36bac5bcea3ce686", "score": "0.53402215", "text": "func generateUUID() string {\n\tid := dockerutil.GenerateBytesUUID()\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", id[0:4], id[4:6], id[6:8], id[8:10], id[10:])\n}", "title": "" }, { "docid": "2a25962a2496fe814ab36d3f261d4466", "score": "0.53379047", "text": "func GenUuid() (string, error) {\n\tuuid := make([]byte, 16)\n\tn, err := rand.Read(uuid)\n\tif n != len(uuid) || err != nil {\n\t\treturn \"\", err\n\t}\n\t// TODO: verify the two lines implement RFC 4122 correctly\n\tuuid[8] = 0x80 // variant bits see page 5\n\tuuid[4] = 0x40 // version 4 Pseudo Random, see page 7\n\n\treturn hex.EncodeToString(uuid), nil\n}", "title": "" }, { "docid": "2ff0802717e006f4ec95605c0f3e8ffd", "score": "0.5337716", "text": "func (b *builtinBinToUUIDSig) vecEvalString(input *chunk.Chunk, result *chunk.Column) error {\n\tn := input.NumRows()\n\tvalBuf, err := b.bufAllocator.get()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer b.bufAllocator.put(valBuf)\n\tif err := b.args[0].VecEvalString(b.ctx, input, valBuf); err != nil {\n\t\treturn err\n\t}\n\n\tvar flagBuf *chunk.Column\n\ti64s := make([]int64, n)\n\tif len(b.args) == 2 {\n\t\tflagBuf, err = b.bufAllocator.get()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer b.bufAllocator.put(flagBuf)\n\t\tif err := b.args[1].VecEvalInt(b.ctx, input, flagBuf); err != nil {\n\t\t\treturn err\n\t\t}\n\t\ti64s = flagBuf.Int64s()\n\t}\n\tresult.ReserveString(n)\n\tfor i := 0; i < n; i++ {\n\t\tif valBuf.IsNull(i) {\n\t\t\tresult.AppendNull()\n\t\t\tcontinue\n\t\t}\n\t\tval := valBuf.GetString(i)\n\t\tvar u uuid.UUID\n\t\terr = u.UnmarshalBinary([]byte(val))\n\t\tif err != nil {\n\t\t\treturn errWrongValueForType.GenWithStackByArgs(\"string\", val, \"bin_to_uuid\")\n\t\t}\n\t\tstr := u.String()\n\t\tif len(b.args) == 2 && flagBuf.IsNull(i) {\n\t\t\tresult.AppendString(str)\n\t\t\tcontinue\n\t\t}\n\t\tif i64s[i] != 0 {\n\t\t\tresult.AppendString(swapStringUUID(str))\n\t\t} else {\n\t\t\tresult.AppendString(str)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "743b00d6a04b59fe955e1bbc35a44072", "score": "0.5336271", "text": "func NewUUID() (string, error) {\n\tuuid := make([]byte, 16)\n\tn, err := io.ReadFull(crand.Reader, uuid)\n\tif n != len(uuid) || err != nil {\n\t\treturn \"\", err\n\t}\n\t// variant bits; see section 4.1.1\n\tuuid[8] = uuid[8]&^0xc0 | 0x80\n\t// version 4 (pseudo-random); see section 4.1.3\n\tuuid[6] = uuid[6]&^0xf0 | 0x40\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:]), nil\n}", "title": "" }, { "docid": "d3cae1fe5e1c19fdd9e29876052ee364", "score": "0.53164333", "text": "func uuid() string {\n\tout, err := exec.Command(\"/usr/bin/uuidgen\").Output()\n\tif err != nil {\n\t\t// TODO: Handle error case.\n\t\tlog.Fatal(err)\n\t\treturn \"\"\n\t}\n\t// Command returns newline at end and must be stripped before use\n\t// otherwise SetCookie will fail.\n\tuuid := strings.TrimSuffix(string(out), \"\\n\")\n\treturn uuid\n}", "title": "" }, { "docid": "5de7d75f3c1bdb7009154a7f912a8500", "score": "0.53130156", "text": "func NewUUID() string {\n\treturn uuid.New()\n}", "title": "" }, { "docid": "0b5496dbea69a69cc5bb58ca0e3d5d50", "score": "0.5298683", "text": "func TestUuid(t *testing.T) {\n\tuuid, err:= goeureka.GetUuid()\n\tif err!= nil{\n\t\tt.Errorf(\"getuuid error(%v)\", err.Error())\n\t}\n\tt.Log(\"uuid:\", uuid)\n}", "title": "" }, { "docid": "be91335d46c1fdaf613483038be640c6", "score": "0.52974963", "text": "func GenerateLenUUID(i int) (string, error) {\n\tif i < 0 {\n\t\ti = 2<<29 + i\n\t}\n\treturn FormatUUID(fmt.Sprintf(\"%x\", i))\n}", "title": "" }, { "docid": "58cf900f7ae88d056554444d74c33898", "score": "0.52906924", "text": "func UUIDLTE(v uuid.UUID) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUUID), v))\n\t})\n}", "title": "" }, { "docid": "a17ffeec06084d88c124fd9e0fda7e90", "score": "0.5286828", "text": "func generateUUID() string {\n\tb := make([]byte, 16)\n\trand.Read(b)\n\tuuid := fmt.Sprintf(\"%X-%X-%X-%X-%X\", b[0:4], b[4:6], b[6:8], b[8:10], b[10:])\n\treturn uuid\n}", "title": "" }, { "docid": "19dfd80ef7504f1223c3fd68765fb48f", "score": "0.528397", "text": "func UUID(id int64) string {\n\thashB := ExtractTimestamp(id) & hashMask\n\n\t//fmt.Sprintf(\"%X\", i)\n\thashBStr := fmt.Sprintf(\"%03x\", hashB)\n\n\treturn hashBStr + uuid.Must(uuid.NewRandom()).String()\n}", "title": "" }, { "docid": "a567080ee73b531594606433df204e17", "score": "0.52798903", "text": "func GenerateUuid() string {\n\tuuid := uuid.NewV4()\n\n\treturn uuid.String()\n}", "title": "" }, { "docid": "c021399ee5efc016c2aad698908283e8", "score": "0.52749896", "text": "func MD5String(value string, length int) string {\n\tsumArray := sha1.Sum([]byte(value)) // nolint:gosec // Non-crypto use\n\tsum := hex.EncodeToString(sumArray[:])\n\n\tif length == -1 || length > len(sum) {\n\t\treturn sum\n\t}\n\treturn sum[:length]\n}", "title": "" }, { "docid": "53e2bcdef5bb07fda50f1c7ae1fb17d7", "score": "0.52720135", "text": "func encodeUUID(src [16]byte) string {\n\treturn fmt.Sprintf(\"%x-%x-%x-%x-%x\", src[0:4], src[4:6], src[6:8], src[8:10], src[10:16])\n}", "title": "" }, { "docid": "8a7892c8fa96faa9d5509d177553f94e", "score": "0.5270722", "text": "func md5String(md5Sum [16]byte) string {\n\tmd5Str := fmt.Sprintf(\"% x\", md5Sum)\n\tmd5Str = strings.Replace(md5Str, \" \", \":\", -1)\n\treturn md5Str\n}", "title": "" }, { "docid": "3f609b9d8aa7d7026ddd0b8bf8e706ce", "score": "0.5268581", "text": "func Decode5bits(c byte) int16 {\n\tif 'A' <= c && c <= 'Z' {\n\t\treturn int16(c) - 'A' + 1\n\t}\n\tif 'a' <= c && c <= 'z' {\n\t\treturn int16(c) - 'a' + 1\n\t}\n\tpanic(fmt.Sprintf(\"Decode5bits: Bad byte %d.\", c))\n}", "title": "" }, { "docid": "290f558ab027a8d28348cac644b6110f", "score": "0.5244453", "text": "func NewMD5(space UUID, data []byte) UUID {\n\treturn NewHash(md5.New(), space, data, 3)\n}", "title": "" }, { "docid": "69afda6f38e8ee5b1e26a80ee2bf7efb", "score": "0.5232524", "text": "func GenUUID() string {\n\tuuid := make([]byte, 16)\n\tn, err := rand.Read(uuid)\n\tgodbc.Check(n == len(uuid), n, len(uuid))\n\tgodbc.Check(err == nil, err)\n\n\treturn hex.EncodeToString(uuid)\n}", "title": "" }, { "docid": "b0802ad92f6b28ebb9463ec850ceab4a", "score": "0.521276", "text": "func (cru *CasbinRuleUpdate) SetV5(s string) *CasbinRuleUpdate {\n\tcru.mutation.SetV5(s)\n\treturn cru\n}", "title": "" }, { "docid": "5ec1bb798fac12f5eb34fb18e43e4f6f", "score": "0.5207303", "text": "func GenUUIDV1() (string, error) {\n\tnewUUID, err := uuid.NewUUID()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn newUUID.String(), nil\n}", "title": "" }, { "docid": "caf1a9e01c85ec9b3be1b89f103b13f9", "score": "0.5201562", "text": "func generateBadUUID(title string) string {\n\thashbytes := md5.Sum([]byte(title))\n\treturn fmt.Sprintf(\"%1x%1x%1x%1x-%1x%1x-40%1x-%1x%1x-%1x%1x%1x%1x%1x%1x\",\n\t\thashbytes[0], hashbytes[1], hashbytes[2], hashbytes[3], hashbytes[4],\n\t\thashbytes[5], hashbytes[6], hashbytes[7], hashbytes[8], hashbytes[9],\n\t\thashbytes[10], hashbytes[11], hashbytes[12], hashbytes[13],\n\t\thashbytes[14])\n\n}", "title": "" }, { "docid": "5922cd9b8ecd378391d2b4982ee9b981", "score": "0.5191666", "text": "func UUIDByte(s int64) []byte {\n\tvar buf = make([]byte, 8)\n\tbinary.BigEndian.PutUint64(buf, uint64(s))\n\treturn buf\n}", "title": "" }, { "docid": "dfbc71a9f10cd8a90f8a324a33998a64", "score": "0.5190487", "text": "func getUuid() string {\n\n\t\tid,_ := uuid.NewV4()\n\n\t\treturn id.String()\n}", "title": "" }, { "docid": "7ac0d71578105cad171f9e825c021ec1", "score": "0.5185678", "text": "func (src UUID) Value() (driver.Value, error) {\n\tif !src.Valid {\n\t\treturn nil, nil\n\t}\n\n\treturn encodeUUID(src.Bytes), nil\n}", "title": "" } ]
e88ffae39ed9e4e8175ad29d6b7c02c2
Where returns a new SchemaSlice whose elements return true for func. See:
[ { "docid": "a2843a6ba3e4806297aa8b270e9f1726", "score": "0.7655883", "text": "func (rcv SchemaSlice) Where(fn func(Schema) bool) (result SchemaSlice) {\n\tfor _, v := range rcv {\n\t\tif fn(v) {\n\t\t\tresult = append(result, v)\n\t\t}\n\t}\n\treturn result\n}", "title": "" } ]
[ { "docid": "2bdeb1b329840bca4c6ad03a78492d0e", "score": "0.5590401", "text": "func (rcv PlatformSlice) Where(fn func(Platform) bool) (result PlatformSlice) {\n\tfor _, v := range rcv {\n\t\tif fn(v) {\n\t\t\tresult = append(result, v)\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "463ab1e627550729c5f8beb6c3a9fa37", "score": "0.55800617", "text": "func (ld *LicenseDelete) Where(ps ...predicate.License) *LicenseDelete {\n\tld.mutation.Where(ps...)\n\treturn ld\n}", "title": "" }, { "docid": "cf73d517b42660d720fd234939f4c208", "score": "0.5556406", "text": "func (df Table) Filter(maf ...MapFun) Table {\n\tmf := unwrapMap(maf)\n\n\tmask := make([][]bool, 0, len(mf))\n\tindex := make([]int, 0, df.size[0])\n\n\tfor _, val := range mf {\n\n\t\tswitch v := df.data[val.col].(type) {\n\t\tcase vec.IntVector:\n\t\t\tswitch f := val.fun.(type) {\n\t\t\tcase func(int, bool) bool:\n\t\t\t\tout, err := v.Check(f)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn Table{err: fmt.Errorf(\"error in Check() method in columns %s : %w\", val.col, err)}\n\n\t\t\t\t}\n\t\t\t\tmask = append(mask, out)\n\t\t\tdefault:\n\t\t\t\treturn Table{\n\t\t\t\t\terr: fmt.Errorf(\"wrong function definition, expected func(int) bool, got %T\", f),\n\t\t\t\t}\n\t\t\t}\n\t\tcase vec.StrVector:\n\t\t\tswitch f := val.fun.(type) {\n\t\t\tcase func(string, bool) bool:\n\t\t\t\tout, err := v.Check(f)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn Table{err: fmt.Errorf(\"error in Check() method in columns %s : %w\", val.col, err)}\n\n\t\t\t\t}\n\t\t\t\tmask = append(mask, out)\n\t\t\tdefault:\n\t\t\t\treturn Table{\n\t\t\t\t\terr: fmt.Errorf(\"wrong function definition, expected func(int) bool, got %T\", f),\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tfor i := 0; i < df.size[0]; i++ {\n\t\ty := true\n\t\tfor j := 0; j < len(mf); j++ {\n\t\t\ty = y || mask[j][i]\n\t\t}\n\t\tif y {\n\t\t\tindex = append(index, i)\n\t\t}\n\t}\n\n\treturn df.Rows(index)\n\n}", "title": "" }, { "docid": "4ce39dda30171242cf52932f5e400479", "score": "0.5523115", "text": "func (s LINQ) Where(pred Predicate) LINQ {\n\treturn FromSequenceFunction(func() IteratorFunc {\n\t\ti := s.Iterator()\n\t\treturn func() (T, bool) {\n\t\t\tfor {\n\t\t\t\tif !i.Next() {\n\t\t\t\t\treturn nil, false\n\t\t\t\t} else if item := i.Current(); pred(item) {\n\t\t\t\t\treturn item, true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n}", "title": "" }, { "docid": "5b012e0da84ef38115b71d30650a8e16", "score": "0.54656094", "text": "func (ftd *FieldTypeDelete) Where(ps ...predicate.FieldType) *FieldTypeDelete {\n\tftd.predicates = append(ftd.predicates, ps...)\n\treturn ftd\n}", "title": "" }, { "docid": "c20c6088351ad995e7cb29fc4bcaed79", "score": "0.5429311", "text": "func (m *K8sNamespaceMutation) Where(ps ...predicate.K8sNamespace) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "fc17c05661e50b8415559b841001f024", "score": "0.5366626", "text": "func (m *SlotMutation) Where(ps ...predicate.Slot) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "e9c34161e4861022d011b8b9f2d5f88d", "score": "0.5344081", "text": "func (m *NamespaceMutation) Where(ps ...predicate.Namespace) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "8c0395cf5a0fa3d3ae999eda89bf739e", "score": "0.53133565", "text": "func Slice[T ~[]E, E any](f func(T) []Schema) Validator {\n\treturn Func(func(field *Field) (errs Errors) {\n\t\tv, ok := field.Value.(T)\n\t\tif !ok {\n\t\t\treturn NewUnsupportedErrors(field, \"Slice\")\n\t\t}\n\n\t\tschemas := f(v)\n\t\tfor i, s := range schemas {\n\t\t\terr := validateSchema(s, field, func(name string) string {\n\t\t\t\treturn name + \"[\" + strconv.Itoa(i) + \"]\"\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\terrs.Append(err...)\n\t\t\t}\n\t\t}\n\t\treturn\n\t})\n}", "title": "" }, { "docid": "09c936ae3da89ebc688f7b3e552b641c", "score": "0.5296736", "text": "func (knq *K8sNamespaceQuery) Where(ps ...predicate.K8sNamespace) *K8sNamespaceQuery {\n\tknq.predicates = append(knq.predicates, ps...)\n\treturn knq\n}", "title": "" }, { "docid": "0087fe712a2a6ddc9a15e20410e31c2c", "score": "0.52886456", "text": "func (fu *FareUpdate) Where(ps ...predicate.Fare) *FareUpdate {\n\tfu.mutation.predicates = append(fu.mutation.predicates, ps...)\n\treturn fu\n}", "title": "" }, { "docid": "d2d9d54bf6ba4b33156e528a679d05e6", "score": "0.52699494", "text": "func (src DataSource) Filter(pred func(Row) bool) DataSource {\n\treturn func(fn RowFunc) error {\n\t\treturn src(func(row Row) (err error) {\n\t\t\tif pred(row) {\n\t\t\t\terr = fn(row)\n\t\t\t}\n\n\t\t\treturn\n\t\t})\n\t}\n}", "title": "" }, { "docid": "e0c9830d758f34ad2c40d23c86addcc4", "score": "0.5245494", "text": "func (su *SlotUpdate) Where(ps ...predicate.Slot) *SlotUpdate {\n\tsu.mutation.Where(ps...)\n\treturn su\n}", "title": "" }, { "docid": "4d61166345d70bf07a52b26e084de541", "score": "0.5227639", "text": "func (b DeleteBuilder) Where(pred interface{}, args ...interface{}) DeleteBuilder {\n\treturn builder.Append(b, \"WhereParts\", newWherePart(pred, args...)).(DeleteBuilder)\n}", "title": "" }, { "docid": "d71f39a23cfd5dda5c91bdf18f8badde", "score": "0.52253413", "text": "func (ftu *FieldTypeUpdate) Where(ps ...predicate.FieldType) *FieldTypeUpdate {\n\tftu.predicates = append(ftu.predicates, ps...)\n\treturn ftu\n}", "title": "" }, { "docid": "c7bcbab25a75c886f7034e87d6d5346b", "score": "0.5194778", "text": "func (m *K8sDaemonSetMutation) Where(ps ...predicate.K8sDaemonSet) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "928abf19f1c52ec18c283acc026c9070", "score": "0.5169619", "text": "func (ldo *LicenseDeleteOne) Where(ps ...predicate.License) *LicenseDeleteOne {\n\tldo.ld.mutation.Where(ps...)\n\treturn ldo\n}", "title": "" }, { "docid": "c01c474ac4e9d11f6014497c79da03e6", "score": "0.51659185", "text": "func (b *DeleteBuilder) Where(pred interface{}, args ...interface{}) *DeleteBuilder {\n\tb.whereParts = append(b.whereParts, newWherePart(pred, args...))\n\treturn b\n}", "title": "" }, { "docid": "0513ba9b09870f3ed689950cd27294ca", "score": "0.5164747", "text": "func (m *K8sReplicaSetMutation) Where(ps ...predicate.K8sReplicaSet) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "d5beae515725610f162611ab957f78e9", "score": "0.5157025", "text": "func schemaFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test_schema.c:247:12: */\n\tvar rc int32\n\tvar pVtab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab\n\tvar pCur uintptr = pVtabCursor\n\t(*schema_cursor)(unsafe.Pointer(pCur)).Frowid = 0\n\tfinalize(tls, (pCur + 16 /* &.pTableList */))\n\tfinalize(tls, (pCur + 24 /* &.pColumnList */))\n\tfinalize(tls, (pCur + 8 /* &.pDbList */))\n\trc = sqlite3.Xsqlite3_prepare(tls, (*schema_vtab)(unsafe.Pointer(pVtab)).Fdb, ts+36767 /* \"PRAGMA database_...\" */, -1, (pCur + 8 /* &.pDbList */), uintptr(0))\n\treturn func() int32 {\n\t\tif rc == SQLITE_OK {\n\t\t\treturn schemaNext(tls, pVtabCursor)\n\t\t}\n\t\treturn rc\n\t}()\n}", "title": "" }, { "docid": "e22a512a0897b70f9283cf10fc477576", "score": "0.51483566", "text": "func (rcv Tags) Where(fn func(Tag) bool) (result Tags) {\n\tfor _, v := range rcv {\n\t\tif fn(v) {\n\t\t\tresult = append(result, v)\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "ff71b82c55c7d2a6e231c97443ee6d50", "score": "0.51402175", "text": "func (m *K8sStatefulSetMutation) Where(ps ...predicate.K8sStatefulSet) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "15947db970f104eb5a668112ffa2455f", "score": "0.51355225", "text": "func FilterOn[I any](slice *[]I, f func(index int, value I) (keep bool)) {\n\tif slice == nil { // do nothing\n\t\treturn\n\t}\n\t// see: https://github.com/golang/go/wiki/SliceTricks#filtering-without-allocating\n\tnewSlice := (*slice)[:0]\n\tfor i, v := range *slice {\n\t\tif f(i, v) {\n\t\t\tnewSlice = append(newSlice, v)\n\t\t}\n\t}\n\t*slice = newSlice\n}", "title": "" }, { "docid": "5539436295404b4d5f685902dcb0751f", "score": "0.5132626", "text": "func (dlt *Delete) Where(preds ...PredExpr) *Delete {\n\tdlt.where.add(preds)\n\treturn dlt\n}", "title": "" }, { "docid": "ee655479e433c775c1db22b9e87978c5", "score": "0.51253414", "text": "func (s *Set) Filter(fn func(interface{}) bool) *Set {\n\t// Create a set to return with elements which match filter function\n\tfilterSet := New()\n\n\t// Enumerate all elements and apply the function\n\tfor _, e := range s.Enumerate() {\n\t\t// Apply the function, add elements which it matches\n\t\tif fn(e) {\n\t\t\tfilterSet.Add(e)\n\t\t}\n\t}\n\n\treturn filterSet\n}", "title": "" }, { "docid": "91e2b3e6afdf9346ce29f007bf4f7492", "score": "0.51199806", "text": "func (rcv DifferentTypes) Where(fn func(DifferentType) bool) (result DifferentTypes) {\n\tfor _, v := range rcv {\n\t\tif fn(v) {\n\t\t\tresult = append(result, v)\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "c5c401bf39565a5c8e99b01c01108714", "score": "0.51101476", "text": "func (su *SpecUpdate) Where(ps ...predicate.Spec) *SpecUpdate {\n\tsu.predicates = append(su.predicates, ps...)\n\treturn su\n}", "title": "" }, { "docid": "0318acb368214abe860d7ff5efb41ce6", "score": "0.5099577", "text": "func (m *InstanceRuntimeMutation) Where(ps ...predicate.InstanceRuntime) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "eef612e7bf0aec240baf8258b256f888", "score": "0.5097932", "text": "func (m *K8sDeploymentMutation) Where(ps ...predicate.K8sDeployment) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "d53b6c4ff4b00fa5563cf2717686b2d6", "score": "0.5095068", "text": "func (q *Query) Filter(fn func(Vertex) bool) *Query {\n\tvar output []Vertex\n\tfor _, v := range q.results {\n\t\tfil := fn(v)\n\t\tif fil {\n\t\t\toutput = append(output, v)\n\t\t}\n\t}\n\tq.results = output\n\treturn q\n}", "title": "" }, { "docid": "0ecf7097ed12c9562c29326fa79709df", "score": "0.50948024", "text": "func (m *MetricEndpointMutation) Where(ps ...predicate.MetricEndpoint) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "fdd2ee3970b8012c09952f325a3a48f0", "score": "0.5093715", "text": "func (m *InstanceMutation) Where(ps ...predicate.Instance) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "2eb770626d2b62c33e97972e150bc4be", "score": "0.5093426", "text": "func (ibrd *IncidentBasicRuleDelete) Where(ps ...predicate.IncidentBasicRule) *IncidentBasicRuleDelete {\n\tibrd.mutation.Where(ps...)\n\treturn ibrd\n}", "title": "" }, { "docid": "0d779811e07d810248c67bebd4cb65c0", "score": "0.5085547", "text": "func Filter(records []Record, predicate func(Record) bool) []Record {\n\tresult := make([]Record, 0, len(records))\n\tfor _, r := range records {\n\t\tif predicate(r) {\n\t\t\tresult = append(result, r)\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "ad8b00e48322eab6a84189bd05588fe1", "score": "0.5081083", "text": "func (m *K8sEventMutation) Where(ps ...predicate.K8sEvent) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "fa5a9b073cebc3ba959ccce299f63f95", "score": "0.50585616", "text": "func (m *K8sNodeMutation) Where(ps ...predicate.K8sNode) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "d5bc00ae254566dc9d86a17756a88dc1", "score": "0.50569755", "text": "func Array[T ~[]E, E any](f func(T) []Schema) Validator {\n\treturn Slice[T](f)\n}", "title": "" }, { "docid": "b633910de07df3a6a120672bc38a0e7a", "score": "0.5053816", "text": "func (acd *AuthCodeDelete) Where(ps ...predicate.AuthCode) *AuthCodeDelete {\n\tacd.mutation.Where(ps...)\n\treturn acd\n}", "title": "" }, { "docid": "9e47c4edea3095445d307e5c49d5bc0d", "score": "0.5050772", "text": "func (m *K8sPodMutation) Where(ps ...predicate.K8sPod) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "e6fc7f283b508199c80611e76641aea6", "score": "0.5046051", "text": "func (m *K8sObjectMutation) Where(ps ...predicate.K8sObject) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "09421283008202445bd26e03b35d8609", "score": "0.5044502", "text": "func (m *KeysMutation) Where(ps ...predicate.Keys) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "fc6f3c4d370bb11aeaf664774025343b", "score": "0.5042922", "text": "func (m *VarDataMutation) Where(ps ...predicate.VarData) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "0ec43f6e74e7b037d82d2af71494b5f9", "score": "0.5041951", "text": "func (m *K8sContainerMutation) Where(ps ...predicate.K8sContainer) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "b8920db4fc8327036b34536033e32738", "score": "0.50225604", "text": "func (m *K8sConnectorMutation) Where(ps ...predicate.K8sConnector) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "4bb18e9627210534a69d7eabdf311085", "score": "0.5011913", "text": "func (ddd *DNSDetectorDelete) Where(ps ...predicate.DNSDetector) *DNSDetectorDelete {\n\tddd.mutation.Where(ps...)\n\treturn ddd\n}", "title": "" }, { "docid": "9bad019c79e3c8308ae508388e3d9be4", "score": "0.50076294", "text": "func (s *SliceOfSomething) Filter(filterFunc func(Something) bool) *SliceOfSomething {\n\tvar newItems []Something\n\tfor _, value := range s.items {\n\t\tif filterFunc(value) {\n\t\t\tnewItems = append(newItems, value)\n\t\t}\n\t}\n\treturn s\n}", "title": "" }, { "docid": "4170c053a0b0abb716412fc0759f4e61", "score": "0.50023943", "text": "func (fq *FinancialQuery) Where(ps ...predicate.Financial) *FinancialQuery {\n\tfq.predicates = append(fq.predicates, ps...)\n\treturn fq\n}", "title": "" }, { "docid": "4e0207450a80846df78c1ac6fe91ee58", "score": "0.49867278", "text": "func (m *EventsMutation) Where(ps ...predicate.Events) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "b007386070dbf66a8b2d775907cc276d", "score": "0.49840572", "text": "func (v IntList) Filter(fn predFunc) IntList {\n\t// make a new empty IntList append elements and return it\n\tu := IntList{}\n\tfor i := 0; i < v.Length(); i++ {\n\t\tif fn(v[i]) {\n\t\t\tu = u.Append(IntList{v[i]})\n\t\t}\n\t}\n\treturn u\n}", "title": "" }, { "docid": "49b16284fb6d35fb0f221a06aaa9bb7a", "score": "0.49803188", "text": "func (s GenericSet) Where(p func(v Value) (bool, error)) (_ Set, err error) {\n\tset := s.set.Where(func(elem interface{}) bool {\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tif elem == nil {\n\t\t\treturn false\n\t\t}\n\t\tmatch, err2 := p(elem.(Value))\n\t\tif err2 != nil {\n\t\t\terr = err2\n\t\t\treturn false\n\t\t}\n\t\treturn match\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn newSetFromFrozenSet(set), nil\n}", "title": "" }, { "docid": "cd72e5cc2f6792c9fd15b4ca84b30a03", "score": "0.49622038", "text": "func (knq *K8sNodeQuery) Where(ps ...predicate.K8sNode) *K8sNodeQuery {\n\tknq.predicates = append(knq.predicates, ps...)\n\treturn knq\n}", "title": "" }, { "docid": "28b9edb5d817ddb82f3b4103af090fa3", "score": "0.4961468", "text": "func (ked *K8sEventDelete) Where(ps ...predicate.K8sEvent) *K8sEventDelete {\n\tked.mutation.Where(ps...)\n\treturn ked\n}", "title": "" }, { "docid": "f762fb4f22f3e361e728393eaf9ec47f", "score": "0.4961173", "text": "func (wtu *WidgetTypeUpdate) Where(ps ...predicate.WidgetType) *WidgetTypeUpdate {\n\twtu.mutation.Where(ps...)\n\treturn wtu\n}", "title": "" }, { "docid": "67b830546c5739afb6bb1367a69ea215", "score": "0.495703", "text": "func (m *ContainerMutation) Where(ps ...predicate.Container) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "b3d6b4a2d6e0fe5ec22ede10eeb181d4", "score": "0.49563783", "text": "func (m *ToolMutation) Where(ps ...predicate.Tool) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "7e37bcd579d80fba02af1a04aedc5ce7", "score": "0.4954066", "text": "func (rcv Movies) Where(fn func(*Movie) bool) (result Movies) {\n\tfor _, v := range rcv {\n\t\tif fn(v) {\n\t\t\tresult = append(result, v)\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "091d97b481bfe36d1c5c8c7e66622dfa", "score": "0.4953594", "text": "func Where(slc []string, matchFunc func(string) bool) []string {\n\tnewslc := []string{}\n\tfor _, s := range slc {\n\t\tif matchFunc(s) {\n\t\t\tnewslc = append(newslc, s)\n\t\t}\n\t}\n\treturn newslc\n}", "title": "" }, { "docid": "67bb6a8e4f612d7d8d40bd67a6dff775", "score": "0.4939253", "text": "func (td *TestDelete) Where(ps ...predicate.Test) *TestDelete {\n\ttd.predicates = append(td.predicates, ps...)\n\treturn td\n}", "title": "" }, { "docid": "70d2e9779528fbfa72324c7bef588f20", "score": "0.4938721", "text": "func (pd *ProjectDelete) Where(ps ...predicate.Project) *ProjectDelete {\n\tpd.predicates = append(pd.predicates, ps...)\n\treturn pd\n}", "title": "" }, { "docid": "ead5b6bd44335e8fcda45844ec96a75d", "score": "0.49313623", "text": "func (mu *MetricUpdate) Where(ps ...predicate.Metric) *MetricUpdate {\n\tmu.mutation.Where(ps...)\n\treturn mu\n}", "title": "" }, { "docid": "db125ade6273f2e48c210dd916078e14", "score": "0.4930587", "text": "func (m *ResourceMutation) Where(ps ...predicate.Resource) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "5b4dc374f29005e15b56b12eaf206f78", "score": "0.49213958", "text": "func (m *ImplementMutation) Where(ps ...predicate.Implement) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "db71689c20cc5842d47ae10c601ebbf2", "score": "0.49192917", "text": "func (fdq *FlowDraftQuery) Where(ps ...predicate.FlowDraft) *FlowDraftQuery {\n\tfdq.predicates = append(fdq.predicates, ps...)\n\treturn fdq\n}", "title": "" }, { "docid": "f6f251c0eed13493b80fb7c6937774ea", "score": "0.4914575", "text": "func (m *SettingMutation) Where(ps ...predicate.Setting) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "9831c9ec6d46fc24e02b324769d4ca52", "score": "0.49121", "text": "func (m *K8sMetricMutation) Where(ps ...predicate.K8sMetric) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "76f355119ba68a60b98c07829fc257bc", "score": "0.4905002", "text": "func Filter(items DashSlice, predicate Predicate) DashSlice {\n\tresult := DashSlice{}\n\n\tfor _, item := range items {\n\t\tif ok := predicate(item); ok {\n\t\t\tresult = append(result, item)\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "df2e1b738de65751e5c2ee9b20632aa7", "score": "0.4904637", "text": "func (su *ServiceUpdate) Where(ps ...predicate.Service) *ServiceUpdate {\n\tsu.mutation.predicates = append(su.mutation.predicates, ps...)\n\treturn su\n}", "title": "" }, { "docid": "39ab99b766a8e543619d0ce81627f776", "score": "0.4894378", "text": "func (s *StringSlicer) Filter(fn func(string) bool) *StringSlicer {\n\tresult := &StringSlicer{}\n\tfor _, elem := range s.slice {\n\t\tif fn(elem) {\n\t\t\tresult.Add(elem)\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "3caecb4ae39b1818ec1529c19deced2a", "score": "0.48840395", "text": "func (su *SeriesUpdate) Where(ps ...predicate.Series) *SeriesUpdate {\n\tsu.mutation.predicates = append(su.mutation.predicates, ps...)\n\treturn su\n}", "title": "" }, { "docid": "3e7e9facb0ab3a54a870a6124c5d05f9", "score": "0.4882003", "text": "func (m *MetaMutation) Where(ps ...predicate.Meta) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "72dcb3d51ff8869a4d5eb07e37b39b53", "score": "0.48797607", "text": "func (su *ScholarshiptypeUpdate) Where(ps ...predicate.Scholarshiptype) *ScholarshiptypeUpdate {\n\tsu.predicates = append(su.predicates, ps...)\n\treturn su\n}", "title": "" }, { "docid": "bc160cdb8629e86649f2c38ec25bf91b", "score": "0.4878945", "text": "func (cd *CardDelete) Where(ps ...predicate.Card) *CardDelete {\n\tcd.mutation.Where(ps...)\n\treturn cd\n}", "title": "" }, { "docid": "bdce21429c429b96ce6474856c919cfe", "score": "0.48784116", "text": "func (m *MetricMutation) Where(ps ...predicate.Metric) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "683b7eebb0291237021dd2ec969bdb24", "score": "0.487429", "text": "func (cu *ContainerUpdate) Where(ps ...predicate.Container) *ContainerUpdate {\n\tcu.mutation.Where(ps...)\n\treturn cu\n}", "title": "" }, { "docid": "46259b6f9fbc57c40ebdb15f8e1bd17c", "score": "0.48663965", "text": "func (m *AlertMutation) Where(ps ...predicate.Alert) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "c8f01052a7777106b6aa8dd87214420f", "score": "0.48658085", "text": "func (m *K8sObjectTagMutation) Where(ps ...predicate.K8sObjectTag) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "60ffd1f165edf1e8817a0232ba1fccd6", "score": "0.4862113", "text": "func (m *MetricTypeMutation) Where(ps ...predicate.MetricType) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "7beb9ab80aa30fa9dc522d8487cc9d99", "score": "0.4859135", "text": "func (m *EventMutation) Where(ps ...predicate.Event) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "7beb9ab80aa30fa9dc522d8487cc9d99", "score": "0.4859135", "text": "func (m *EventMutation) Where(ps ...predicate.Event) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "e9e89b9486ccfbdbed58bcc3202f974b", "score": "0.48570323", "text": "func (qmd *QQModelDelete) Where(ps ...predicate.QQModel) *QQModelDelete {\n\tqmd.mutation.predicates = append(qmd.mutation.predicates, ps...)\n\treturn qmd\n}", "title": "" }, { "docid": "1fe4a59df1ddc4d2b7a5e7c8c850043c", "score": "0.4845344", "text": "func (sq *SpecialdoctorQuery) Where(ps ...predicate.Specialdoctor) *SpecialdoctorQuery {\n\tsq.predicates = append(sq.predicates, ps...)\n\treturn sq\n}", "title": "" }, { "docid": "d585bda3fee4f8365b644721df8c8943", "score": "0.48329264", "text": "func (m *AuthCodeMutation) Where(ps ...predicate.AuthCode) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "d35d1e4f6b8e6d8ce04e4a9457fd45cd", "score": "0.48295408", "text": "func newWhereSQLizer(predicate interface{}) SQLizer {\n\treturn &whereSQLizer{predicate}\n}", "title": "" }, { "docid": "20ece3885e5e0fdda71383eb3211d000", "score": "0.48286942", "text": "func (o *OperationPermissions) FilterSchema(schema *ast.Schema) *ast.Schema {\n\tnewSchema := *schema\n\tnewSchema.Types = make(map[string]*ast.Definition)\n\n\tnewSchema.Query = filterDefinition(schema, nil, newSchema.Types, schema.Query, o.AllowedRootQueryFields)\n\tif newSchema.Query != nil {\n\t\tnewSchema.Types[\"Query\"] = newSchema.Query\n\t}\n\tnewSchema.Mutation = filterDefinition(schema, nil, newSchema.Types, schema.Mutation, o.AllowedRootMutationFields)\n\tif newSchema.Mutation != nil {\n\t\tnewSchema.Types[\"Mutation\"] = newSchema.Mutation\n\t}\n\tnewSchema.Subscription = filterDefinition(schema, nil, newSchema.Types, schema.Subscription, o.AllowedRootSubscriptionFields)\n\tif newSchema.Subscription != nil {\n\t\tnewSchema.Types[\"Subscription\"] = newSchema.Subscription\n\t}\n\n\treturn &newSchema\n}", "title": "" }, { "docid": "f86d60a46f73cd14c14ba83c218aedaf", "score": "0.48274454", "text": "func (ctu *ClinicalTrialUpdate) Where(ps ...predicate.ClinicalTrial) *ClinicalTrialUpdate {\n\tctu.mutation.Where(ps...)\n\treturn ctu\n}", "title": "" }, { "docid": "93225e7188adf900e159208efc348e40", "score": "0.48258337", "text": "func (m *BookingMetadatumMutation) Where(ps ...predicate.BookingMetadatum) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "997159b54ab7ba52f40fc00df1ef4846", "score": "0.48235026", "text": "func (acdo *AuthCodeDeleteOne) Where(ps ...predicate.AuthCode) *AuthCodeDeleteOne {\n\tacdo.acd.mutation.Where(ps...)\n\treturn acdo\n}", "title": "" }, { "docid": "28d91966d3c9a049bb432e545ee41abc", "score": "0.48234248", "text": "func (ru *ResourceUpdate) Where(ps ...predicate.Resource) *ResourceUpdate {\n\tru.mutation.Where(ps...)\n\treturn ru\n}", "title": "" }, { "docid": "6eb3f4265f7496f806e4100d1d6e0920", "score": "0.48189828", "text": "func (m *IncidentBasicRuleMutation) Where(ps ...predicate.IncidentBasicRule) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "70478fe66cc950366ced137031f60e83", "score": "0.48185313", "text": "func Filter(slice Slice, pred interface{}, prags ...Pragma) Slice {\n\tf := new(filterSlice)\n\tf.name = MakeName(\"filter\")\n\tf.Slice = slice\n\tf.Pragma = Pragmas(prags)\n\tfn, ok := slicefunc.Of(pred)\n\tif !ok {\n\t\ttypecheck.Panicf(1, \"filter: invalid predicate function %T\", pred)\n\t}\n\tif !typecheck.CanApply(fn, slice) {\n\t\ttypecheck.Panicf(1, \"filter: function %T does not match input slice type %s\", pred, slicetype.String(slice))\n\t}\n\tif fn.Out.NumOut() != 1 || fn.Out.Out(0).Kind() != reflect.Bool {\n\t\ttypecheck.Panic(1, \"filter: predicate must return a single boolean value\")\n\t}\n\tf.pred = fn\n\treturn f\n}", "title": "" }, { "docid": "51aada2d43e1b9edbbf1f48155278e08", "score": "0.4817188", "text": "func (m *VarRefMutation) Where(ps ...predicate.VarRef) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "061ddb3263f28a1cc1fed3ca9b8ed9a7", "score": "0.48142436", "text": "func (m *ConnectorMutation) Where(ps ...predicate.Connector) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "fd7a1b8d6cbba8e8e99c20965a054f92", "score": "0.48131052", "text": "func (m *PetMutation) Where(ps ...predicate.Pet) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "a90fe1507fcff925483ddd6e65698f3b", "score": "0.48046067", "text": "func (m *MstCustomerMutation) Where(ps ...predicate.MstCustomer) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "2831c7b85ffc386ced7ce5e7bacbac30", "score": "0.4799833", "text": "func (m *RefMutation) Where(ps ...predicate.Ref) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "2a0f9133a38c9865b880304173a2c459", "score": "0.47954038", "text": "func (m *CloudEventsMutation) Where(ps ...predicate.CloudEvents) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "22d150ab619c09771055aa4d252b3d9c", "score": "0.4794908", "text": "func (m *InodeMutation) Where(ps ...predicate.Inode) {\n\tm.predicates = append(m.predicates, ps...)\n}", "title": "" }, { "docid": "b7ad132a75c66807cf44baf655bf3b29", "score": "0.47905973", "text": "func filterByPredicate(res *[]interface{}, pred func(*interface{}) bool) []interface{} {\n\tvar result []interface{}\n\trespSlice := *res\n\tfor _, v := range respSlice {\n\t\tif pred(&v) {\n\t\t\tresult = append(result, v)\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "f542a383e76b8a44b5675d3b2048f4ae", "score": "0.47899976", "text": "func (su *ShortUpdate) Where(ps ...predicate.Short) *ShortUpdate {\n\tsu.predicates = append(su.predicates, ps...)\n\treturn su\n}", "title": "" }, { "docid": "75ecd4f2936990171105349d9d2ee34e", "score": "0.47887242", "text": "func (r *PostgresStorage) Where(ctx *context.Context, elems interface{}, where string, arg map[string]interface{}) error {\n\tdb := r.db\n\ttx, ok := TxFromContext(ctx)\n\tif ok {\n\t\tdb = tx\n\t}\n\tcurrentAccount := appcontext.CurrentAccount(ctx)\n\n\tif !r.isImmutable {\n\t\twhere = fmt.Sprintf(`\"deletedAt\" IS NULL AND %s`, where)\n\t}\n\tif currentAccount != nil {\n\t\twhere = fmt.Sprintf(`\"owner\" = :currentAccount AND %s`, where)\n\t}\n\targ[\"currentAccount\"] = currentAccount\n\n\tquery := fmt.Sprintf(`SELECT %s FROM \"%s\" WHERE %s`, r.selectFields, r.tableName, where)\n\tquery, args, err := sqlx.Named(query, arg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tquery, args, err = sqlx.In(query, args...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tquery = db.Rebind(query)\n\n\terr = db.Select(elems, query, args...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" } ]
7a86926a2f642cb79cc248e44fb7de2d
A reference to frontend IP addresses.
[ { "docid": "69ae72c648b919da837b10c59c1d8417", "score": "0.0", "text": "func (o InboundNatPoolOutput) FrontendIPConfiguration() SubResourcePtrOutput {\n\treturn o.ApplyT(func(v InboundNatPool) *SubResource { return v.FrontendIPConfiguration }).(SubResourcePtrOutput)\n}", "title": "" } ]
[ { "docid": "e2203f24da477df1beaf874e8821d71b", "score": "0.65561885", "text": "func (o DeploymentFrontendPublicOutput) IpAddresses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v DeploymentFrontendPublic) []string { return v.IpAddresses }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "c811b83f65c97a916e79425634092d01", "score": "0.65175617", "text": "func IPs() []string {\n\treturn localIPs()\n}", "title": "" }, { "docid": "46eea727f690f0cd178126888ae03f40", "score": "0.6319903", "text": "func (c *cluster) InternalIP(ctx context.Context, node nodeListOption) []string {\n\tvar ips []string\n\tfor _, addr := range c.InternalAddr(ctx, node) {\n\t\tips = append(ips, addrToHost(c, addr))\n\t}\n\treturn ips\n}", "title": "" }, { "docid": "b7fd96e45715db6c7483ca1de78d826d", "score": "0.6272535", "text": "func (c *cluster) ExternalIP(ctx context.Context, node nodeListOption) []string {\n\tvar ips []string\n\tfor _, addr := range c.ExternalAddr(ctx, node) {\n\t\tips = append(ips, addrToHost(c, addr))\n\t}\n\treturn ips\n}", "title": "" }, { "docid": "c7b2381fabed45adeb84023ae09d6133", "score": "0.6252624", "text": "func (o DeploymentFrontendPublicPtrOutput) IpAddresses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *DeploymentFrontendPublic) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.IpAddresses\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "7bbabb06c6125c0667cf3112bbe91dbc", "score": "0.6237874", "text": "func (r *Resolver) GetCurrentIPs() []string {\n\treturn r.r.Addresses\n}", "title": "" }, { "docid": "c3b54ee0b6b4c8e38b0e3734363e1c0c", "score": "0.62360483", "text": "func (c *Container) IPAddress(interfaceName string) ([]string, error) {\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\n\tif err := c.makeSure(isRunning); err != nil {\n\t\treturn nil, err\n\t}\n\n\tcinterface := C.CString(interfaceName)\n\tdefer C.free(unsafe.Pointer(cinterface))\n\n\tresult := C.go_lxc_get_ips(c.container, cinterface, nil, 0)\n\tif result == nil {\n\t\treturn nil, ErrIPAddress\n\t}\n\treturn convertArgs(result), nil\n}", "title": "" }, { "docid": "8ea17c424d8c00f99cb28433353ab42d", "score": "0.61203027", "text": "func (sm *SysModel) getVeniceIPAddrs() []string {\n\tvar veniceIPs []string\n\n\t// walk all venice nodes\n\tfor _, node := range sm.Tb.Nodes {\n\t\tif node.Personality == iota.PersonalityType_PERSONALITY_VENICE {\n\t\t\tsIP := sm.Tb.GetSecondaryIP(node.NodeName)\n\t\t\tif sIP != \"\" {\n\t\t\t\tveniceIPs = append(veniceIPs, sIP)\n\t\t\t} else {\n\t\t\t\tveniceIPs = append(veniceIPs, node.NodeMgmtIP)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn veniceIPs\n}", "title": "" }, { "docid": "a90cb4e5c76da084f0626c16e29dd0c5", "score": "0.61070937", "text": "func (c *Context) ClientIP() string {\n\tps := c.Proxys()\n\tif len(ps) > 0 && ps[0] != \"\" {\n\t\trealIP, _, err := net.SplitHostPort(ps[0])\n\t\tif err != nil {\n\t\t\trealIP = ps[0]\n\t\t}\n\t\treturn realIP\n\t}\n\tif ip, _, err := net.SplitHostPort(c.Request.RemoteAddr); err == nil {\n\t\treturn ip\n\t}\n\treturn c.Request.RemoteAddr\n}", "title": "" }, { "docid": "728f5a31af8ecc46d9f7768b0b8480c5", "score": "0.6075458", "text": "func InetClientAddr(db XODB) (string, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.inet_client_addr()`\n\n\t// run query\n\tvar ret string\n\tXOLog(sqlstr)\n\terr = db.QueryRow(sqlstr).Scan(&ret)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "627a0d21634736ddfac85f93131e6125", "score": "0.60591495", "text": "func (c *Container) IPAddresses() ([]string, error) {\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\n\treturn c.ipAddresses()\n}", "title": "" }, { "docid": "86f762b6a6f07cb0c27be7becefc6240", "score": "0.6046356", "text": "func (he *hostEditor) Address() modules.NetAddress { return he.contract.IP }", "title": "" }, { "docid": "f023bfe2b7d49135c478dc3a9249cbe8", "score": "0.6036022", "text": "func (ni *NetInfo) my_addresses() error {\n ifaces, err := net.Interfaces()\n if err != nil {\n return(err)\n }\n for _, i := range ifaces {\n addrs, err := i.Addrs()\n if err != nil {\n return(err)\n }\n for _, addr := range addrs {\n switch v := addr.(type) {\n case *net.IPNet:\n if v.IP.IsLoopback() != true {\n ni.IPS = append(ni.IPS, *v)\n }\n }\n }\n }\n return nil\n}", "title": "" }, { "docid": "aa24c01a0c4e50ebb4e16306b30b491e", "score": "0.6030431", "text": "func External() net.IP {\n\treturn external\n}", "title": "" }, { "docid": "a9d9f3f28b7d6d5b900da3eeeea2f583", "score": "0.6004867", "text": "func (o SpringCloudServiceRequiredNetworkTrafficRuleOutput) IpAddresses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v SpringCloudServiceRequiredNetworkTrafficRule) []string { return v.IpAddresses }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "1d7479e2ea19604126477506ecd8f61d", "score": "0.59881794", "text": "func (c *cluster) InternalAddr(ctx context.Context, node nodeListOption) []string {\n\tvar addrs []string\n\tfor _, u := range c.pgURL(ctx, node, false /* external */) {\n\t\taddrs = append(addrs, urlToAddr(c, u))\n\t}\n\treturn addrs\n}", "title": "" }, { "docid": "518c4d53f7953cdb09008f0dfff1427e", "score": "0.59782165", "text": "func GetClientIPAddress(r *http.Request) string {\n\tif ip := r.Header.Get(\"X-Envoy-External-Address\"); ip != \"\" {\n\t\treturn ip\n\t}\n\n\tif ip, _, err := net.SplitHostPort(r.RemoteAddr); err == nil {\n\t\treturn ip\n\t}\n\n\treturn \"127.0.0.1\"\n}", "title": "" }, { "docid": "6fdd7ef0e68fa7aeeb340b38ceb3fe7a", "score": "0.59729916", "text": "func ExternalIP() (string, error) {\n\treturn getTrimmed(\"instance/network-interfaces/0/access-configs/0/external-ip\")\n}", "title": "" }, { "docid": "3c05332874053c4efb82c039bab4f418", "score": "0.5910882", "text": "func (nsClient) IP(value string) fld.Field {\n\treturn ecsString(\"client.ip\", value)\n}", "title": "" }, { "docid": "89620cbe5c49d55029bb70c7e70f29ea", "score": "0.58873767", "text": "func (this *Ctx) ClientIP() (ip string) {\n\t// X-Forwarded-For\n\txForwardedFor := this.Request.Header.Get(\"X-Forwarded-For\")\n\tif xForwardedFor != \"\" {\n\t\tproxyIps := strings.Split(strings.Replace(xForwardedFor, \" \", \"\", -1), \",\")\n\t\tif len(proxyIps) > 0 {\n\t\t\tip = proxyIps[0]\n\t\t\treturn\n\t\t}\n\t}\n\t// X-Real-IP\n\tip = this.Request.Header.Get(\"X-Real-IP\")\n\tif ip != \"\" {\n\t\treturn\n\t}\n\t// RemoteAddr\n\tip, _, _ = net.SplitHostPort(this.Request.RemoteAddr)\n\treturn\n}", "title": "" }, { "docid": "017aea33e81aecfc7e7ca52dc5a3b7c8", "score": "0.5828429", "text": "func (o SecretBackendOutput) ListenAddrs() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *SecretBackend) pulumi.StringArrayOutput { return v.ListenAddrs }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "4cc94ee54945ca468ec971bacfbdbb6b", "score": "0.58282447", "text": "func ClientIP(r *http.Request) net.IP {\n\tfor _, addr := range []string{\"X-Real-IP\", \"X-Forwarded-For\"} {\n\t\tif ip := ParseIP(r.Header.Get(addr)); ip != nil {\n\t\t\treturn ip\n\t\t}\n\t}\n\n\tfor _, addr := range strings.Split(r.Header.Get(\"X-Forwarded-For\"), \",\") {\n\t\tif ip := ParseIP(addr); ip != nil {\n\t\t\treturn ip\n\t\t}\n\t}\n\n\treturn ParseIP(r.RemoteAddr)\n}", "title": "" }, { "docid": "6d1a34dc255fe5737a4ca1a62f4c30fb", "score": "0.581125", "text": "func (c *C) ClientIP() string {\n\tra := c.Request.RemoteAddr\n\treturn ra[:strings.LastIndex(ra, \":\")]\n}", "title": "" }, { "docid": "98b5fb565ad8488414e405d9d76bb8bb", "score": "0.5806856", "text": "func (c *Client) IP(ctx context.Context) (res string, err error) {\n\tvar ires interface{}\n\tires, err = c.IPEndpoint(ctx, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(string), nil\n}", "title": "" }, { "docid": "19312982ec7420f98ce999935703c8cc", "score": "0.58063745", "text": "func (o GetSpringCloudServiceRequiredNetworkTrafficRuleOutput) IpAddresses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetSpringCloudServiceRequiredNetworkTrafficRule) []string { return v.IpAddresses }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "d478ef50b924647cd6d335ca9c71d71b", "score": "0.57765317", "text": "func ExternalIP(timeout time.Duration) string {\n\tclient := &http.Client{\n\t\tTimeout: timeout,\n\t}\n\tfor _, site := range sites {\n\t\tif ip := externalIP(client, site); ip != \"\" {\n\t\t\treturn ip\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "b61829bbd259c0ade9d8f620b01a17a2", "score": "0.5771925", "text": "func MyIpAddr() (net.IP, error) {\n\taddrs, err := net.InterfaceAddrs()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar six net.IP\n\tfor _, addr := range addrs {\n\t\tif ipnet, ok := addr.(*net.IPNet); ok {\n\t\t\tif ipnet.IP.IsLoopback() {\n\t\t\t\tcontinue\n\t\t\t} else if ipnet.IP.To4() != nil {\n\t\t\t\treturn ipnet.IP, nil\n\t\t\t} else if six != nil && ipnet.IP.To16() != nil {\n\t\t\t\tsix = ipnet.IP\n\t\t\t}\n\t\t}\n\t}\n\treturn six, nil\n}", "title": "" }, { "docid": "ad6c143243ca84b0e934955d7e4f33fa", "score": "0.57464767", "text": "func InternalIP() (ip string) {\n\taddrs, err := net.InterfaceAddrs()\n\tif err != nil {\n\t\tpanic(\"Oops: \" + err.Error())\n\t}\n\n\tfor _, a := range addrs {\n\t\tif ipNet, ok := a.(*net.IPNet); ok && !ipNet.IP.IsLoopback() {\n\t\t\tif ipNet.IP.To4() != nil {\n\t\t\t\t// os.Stdout.WriteString(ipNet.IP.String() + \"\\n\")\n\t\t\t\tip = ipNet.IP.String()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\t// os.Exit(0)\n\treturn\n}", "title": "" }, { "docid": "8882c25ac203c1fc529d753cae883cbc", "score": "0.5736548", "text": "func (info *BaseEndpointInfo) IP() string {\n\treturn utilproxy.IPPart(info.Endpoint)\n}", "title": "" }, { "docid": "8882c25ac203c1fc529d753cae883cbc", "score": "0.5736548", "text": "func (info *BaseEndpointInfo) IP() string {\n\treturn utilproxy.IPPart(info.Endpoint)\n}", "title": "" }, { "docid": "135c5bfc1a26ea3dffe3a28afaf05b5f", "score": "0.5731097", "text": "func ExternalIPAddr() string {\n\t// IP address are maximum 32 bytes\n\tbuffer := make([]byte, 32)\n\tresp, err := http.Get(\"http://ipv4.icanhazip.com/\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tval, _ := resp.Body.Read(buffer)\n\treturn strings.TrimRight(string(buffer[:val]), \"\\r\\n\")\n\n}", "title": "" }, { "docid": "087b54ed264809fec8dfb2bfb80e18f7", "score": "0.57134473", "text": "func (o DeploymentFrontendPrivateOutput) IpAddress() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DeploymentFrontendPrivate) string { return v.IpAddress }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "66a14c7e0f1e9376b61f02d91acd96cc", "score": "0.569108", "text": "func (n *Node) IPAddr() string {\n\treturn n.Cfg.Addr\n}", "title": "" }, { "docid": "f7f879e2b9ccf9d8f11e485c9832f4cf", "score": "0.568173", "text": "func (s *Service) IPs() []string {\n\treturn s.IPBucket.IPs()\n}", "title": "" }, { "docid": "3a7e82fce778c07f2a9ca87ffede815d", "score": "0.5671708", "text": "func getIPAddresses() []net.IP {\n\n\tipAddresses := []net.IP{net.ParseIP(\"127.0.0.1\"), net.ParseIP(\"::1\")}\n\n\t// addIP appends an IP address only if it isn't already in the slice.\n\taddIP := func(ipAddr net.IP) {\n\t\tfor _, ip := range ipAddresses {\n\t\t\tif bytes.Equal(ip, ipAddr) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tipAddresses = append(ipAddresses, ipAddr)\n\t}\n\n\t// Add all the interface IPs that aren't already in the slice.\n\taddrs, err := net.InterfaceAddrs()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfor _, a := range addrs {\n\t\tipAddr, _, err := net.ParseCIDR(a.String())\n\t\tif err == nil {\n\t\t\taddIP(ipAddr)\n\t\t}\n\t}\n\n\treturn ipAddresses\n\n}", "title": "" }, { "docid": "b7a980befd06e847014057cb000d300a", "score": "0.56649864", "text": "func (a *addr) IPs() []string {\n\tifaces, err := net.Interfaces()\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tvar ipAddrs []string\n\n\tfor _, i := range ifaces {\n\t\taddrs, err := i.Addrs()\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, addr := range addrs {\n\t\t\tvar ip net.IP\n\t\t\tswitch v := addr.(type) {\n\t\t\tcase *net.IPNet:\n\t\t\t\tip = v.IP\n\t\t\tcase *net.IPAddr:\n\t\t\t\tip = v.IP\n\t\t\t}\n\n\t\t\tif ip == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// dont skip ipv6 addrs\n\t\t\t/*\n\t\t\t\tip = ip.To4()\n\t\t\t\tif ip == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t*/\n\n\t\t\tipAddrs = append(ipAddrs, ip.String())\n\t\t}\n\t}\n\n\treturn ipAddrs\n}", "title": "" }, { "docid": "f4da3b6d7c65498fc76c4dfa502a066f", "score": "0.5664119", "text": "func (o ApplicationGatewayBackendAddressPoolOutput) IpAddresses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ApplicationGatewayBackendAddressPool) []string { return v.IpAddresses }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "d9d3e232b3df5a93ee195401c9db9d3a", "score": "0.5661717", "text": "func getMyIPs() []string {\n\tvar retList []string\n\taddrs, err := net.InterfaceAddrs()\n\tif err != nil {\n\t\tos.Stderr.WriteString(\"Oops: \" + err.Error() + \"\\n\")\n\t\tos.Exit(1)\n\t}\n\n\tfor _, a := range addrs {\n\t\tif ipnet, ok := a.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {\n\n\t\t\tif ipnet.IP.To4() != nil {\n\t\t\t\tretList = append(retList, a.String())\n\t\t\t}\n\n\t\t}\n\t}\n\n\tif *debugFlag {\n\t\tfmt.Printf(\"Found interface IPs of %v \\n\", retList)\n\t}\n\n\treturn retList\n}", "title": "" }, { "docid": "bd68988aaab876f82eb2859a383015c6", "score": "0.5655991", "text": "func (o FirewallVirtualHubOutput) PublicIpAddresses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v FirewallVirtualHub) []string { return v.PublicIpAddresses }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "334516e8dff09b1e2829c9f146ce29eb", "score": "0.5653943", "text": "func (o ApplicationGatewayFrontendIPConfigurationOutput) PublicIPAddress() SubResourcePtrOutput {\n\treturn o.ApplyT(func(v ApplicationGatewayFrontendIPConfiguration) *SubResource { return v.PublicIPAddress }).(SubResourcePtrOutput)\n}", "title": "" }, { "docid": "e57f30891c6156102038ad989e3cdc9f", "score": "0.5647383", "text": "func HostIP() []string {\n\tvar out []string\n\taddrs, err := net.InterfaceAddrs()\n\tif err != nil {\n\t\tlog.Println(\"ERROR unable to resolve net.InterfaceAddrs\", err)\n\t}\n\tfor _, addr := range addrs {\n\t\t// check the address type and if it is not a loopback the display it\n\t\tif ipnet, ok := addr.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {\n\t\t\tif ipnet.IP.To4() != nil {\n\t\t\t\tout = append(out, ipnet.IP.String())\n\t\t\t}\n\t\t\tif ipnet.IP.To16() != nil {\n\t\t\t\tout = append(out, ipnet.IP.String())\n\t\t\t}\n\t\t}\n\t}\n\treturn List2Set(out)\n}", "title": "" }, { "docid": "f6dff7493a40ba7e3bff912b31faea90", "score": "0.5645442", "text": "func (o FirewallPolicyThreatIntelWhitelistOutput) IpAddresses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v FirewallPolicyThreatIntelWhitelist) []string { return v.IpAddresses }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "fc4badaf1a13981c9526afb6e6c1c99f", "score": "0.56437236", "text": "func updateIpAddresses() {\n\tfor name, elem := range netElemMap {\n\t\telem.Ip = tce.ipManager.GetPodIp(name)\n\t\tfor _, filterInfo := range elem.FilterInfoMap {\n\t\t\tfilterInfo.SrcIp = tce.ipManager.GetPodIp(filterInfo.SrcName)\n\t\t\tfilterInfo.SrcSvcIp = tce.ipManager.GetSvcIp(filterInfo.SrcName)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6a2a2752edf00470859748cb643e3d74", "score": "0.5639437", "text": "func ObtnerIP() {\n\taddrs, err := net.InterfaceAddrs()\n\tif err != nil {\n\t\tos.Stderr.WriteString(\"Oops: \" + err.Error() + \"\\n\")\n\t\tos.Exit(1)\n\t}\n\n\tfor _, a := range addrs {\n\t\t//fmt.Println(a)\n\t\tif ipnet, ok := a.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {\n\t\t\tif ipnet.IP.To4() != nil {\n\t\t\t\tos.Stdout.WriteString(ipnet.IP.String() + \"\\n\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5b67f3167a4a804e585dba3392be5e98", "score": "0.5620188", "text": "func (b *baseNode) IP() string {\n\tif len(b.node.Status.Addresses) == 0 {\n\t\treturn \"N/A\"\n\t}\n\taddress := b.node.Status.Addresses[0]\n\treturn address.Address\n}", "title": "" }, { "docid": "fc0872bf55d289fd8474f51125dd9bd2", "score": "0.561737", "text": "func (c Client) ExtIP() (string, error) {\n\tres, err := c.Get(WhatsmyipAPI)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"contacting my-external-ip api: %w\", err)\n\t}\n\tdefer res.Body.Close()\n\n\tbs, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"reading response: %w\", err)\n\t}\n\n\tip := net.ParseIP(string(bs))\n\tif ip == nil {\n\t\treturn \"\", fmt.Errorf(\"invalid ip address: %s\", ip)\n\t}\n\n\treturn ip.String(), nil\n}", "title": "" }, { "docid": "70180d34191775ee6ba328ddf6293b82", "score": "0.5605427", "text": "func (p *Context) ClientIP() string {\n\t// if p.engine.ForwardedByClientIP {\n\t// \tclientIP := strings.TrimSpace(c.requestHeader(\"X-Real-Ip\"))\n\t// \tif len(clientIP) > 0 {\n\t// \t\treturn clientIP\n\t// \t}\n\t// \tclientIP = c.requestHeader(\"X-Forwarded-For\")\n\t// \tif index := strings.IndexByte(clientIP, ','); index >= 0 {\n\t// \t\tclientIP = clientIP[0:index]\n\t// \t}\n\t// \tclientIP = strings.TrimSpace(clientIP)\n\t// \tif len(clientIP) > 0 {\n\t// \t\treturn clientIP\n\t// \t}\n\t// }\n\tif ip, _, err := net.SplitHostPort(strings.TrimSpace(p.Request.RemoteAddr)); err == nil {\n\t\treturn ip\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "c3ad386b306fba36124444fb4b53f718", "score": "0.5604597", "text": "func (nsRelated) IP(value string) fld.Field {\n\treturn ecsString(\"related.ip\", value)\n}", "title": "" }, { "docid": "7560bdf88da9eae46f0ecd0994372d3c", "score": "0.5600906", "text": "func ExternalIP() (string, error) {\r\n\tifaces, err := net.Interfaces()\r\n\tif err != nil {\r\n\t\treturn \"\", err\r\n\t}\r\n\tfor _, iface := range ifaces {\r\n\t\tif iface.Flags&net.FlagUp == 0 {\r\n\t\t\tcontinue // interface down\r\n\t\t}\r\n\t\tif iface.Flags&net.FlagLoopback != 0 {\r\n\t\t\tcontinue // loopback interface\r\n\t\t}\r\n\t\taddrs, err := iface.Addrs()\r\n\t\tif err != nil {\r\n\t\t\treturn \"\", err\r\n\t\t}\r\n\t\tfor _, addr := range addrs {\r\n\t\t\tvar ip net.IP\r\n\t\t\tswitch v := addr.(type) {\r\n\t\t\tcase *net.IPNet:\r\n\t\t\t\tip = v.IP\r\n\t\t\tcase *net.IPAddr:\r\n\t\t\t\tip = v.IP\r\n\t\t\t}\r\n\t\t\tif ip == nil || ip.IsLoopback() {\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\tip = ip.To4()\r\n\t\t\tif ip == nil {\r\n\t\t\t\tcontinue // not an ipv4 address\r\n\t\t\t}\r\n\t\t\treturn ip.String(), nil\r\n\t\t}\r\n\t}\r\n\treturn \"\", errors.New(\"are you connected to the network?\")\r\n}", "title": "" }, { "docid": "64c18e1b71dace4e79f161da9516bac0", "score": "0.55996245", "text": "func (c *Context) ClientIP() string {\n\t// Check if we're running on a trusted platform, continue running backwards if error\n\tif c.engine.TrustedPlatform != \"\" {\n\t\t// Developers can define their own header of Trusted Platform or use predefined constants\n\t\tif addr := c.requestHeader(c.engine.TrustedPlatform); addr != \"\" {\n\t\t\treturn addr\n\t\t}\n\t}\n\n\t// Legacy \"AppEngine\" flag\n\tif c.engine.AppEngine {\n\t\tlog.Println(`The AppEngine flag is going to be deprecated. Please check issues #2723 and #2739 and use 'TrustedPlatform: gin.PlatformGoogleAppEngine' instead.`)\n\t\tif addr := c.requestHeader(\"X-Appengine-Remote-Addr\"); addr != \"\" {\n\t\t\treturn addr\n\t\t}\n\t}\n\n\t// It also checks if the remoteIP is a trusted proxy or not.\n\t// In order to perform this validation, it will see if the IP is contained within at least one of the CIDR blocks\n\t// defined by Engine.SetTrustedProxies()\n\tremoteIP := net.ParseIP(c.RemoteIP())\n\tif remoteIP == nil {\n\t\treturn \"\"\n\t}\n\ttrusted := c.engine.isTrustedProxy(remoteIP)\n\n\tif trusted && c.engine.ForwardedByClientIP && c.engine.RemoteIPHeaders != nil {\n\t\tfor _, headerName := range c.engine.RemoteIPHeaders {\n\t\t\tip, valid := c.engine.validateHeader(c.requestHeader(headerName))\n\t\t\tif valid {\n\t\t\t\treturn ip\n\t\t\t}\n\t\t}\n\t}\n\treturn remoteIP.String()\n}", "title": "" }, { "docid": "b79bd005f8c3d2239eafc4f33e47557d", "score": "0.5592231", "text": "func (b *BaseController) IP() (string, error) {\n\tcheckError(nil, fmt.Sprintf(\"Retrieving IP from %s with virtual eth0\", b.NetworkInterface()))\n\n\t// ips, ex := b.bcontainer.IPAddresses()\n\tips, ex := b.bcontainer.IPAddress(\"eth0\")\n\n\tcheckError(ex, fmt.Sprintf(\"Retrieving IP from %s from ips %s\", b.Name(), ips))\n\n\tif len(ips) <= 0 {\n\t\treturn \"\", ErrBadIP\n\t}\n\n\treturn ips[0], ex\n}", "title": "" }, { "docid": "46318435ee327c947b231baca0be1558", "score": "0.55786425", "text": "func (c *cluster) ExternalAddr(ctx context.Context, node nodeListOption) []string {\n\tvar addrs []string\n\tfor _, u := range c.pgURL(ctx, node, true /* external */) {\n\t\taddrs = append(addrs, urlToAddr(c, u))\n\t}\n\treturn addrs\n}", "title": "" }, { "docid": "d5a42b9eada5568e960541fca73d0434", "score": "0.5576917", "text": "func (o WorkflowOutput) ConnectorEndpointIpAddresses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *Workflow) pulumi.StringArrayOutput { return v.ConnectorEndpointIpAddresses }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "1bca879c9dfdaf64e0e8c6204756619d", "score": "0.55709845", "text": "func (nsServer) IP(value string) fld.Field {\n\treturn ecsString(\"server.ip\", value)\n}", "title": "" }, { "docid": "5be404757b52d343edc9ff35a9f7fece", "score": "0.5564355", "text": "func (c Container) IP() string { return c.ip }", "title": "" }, { "docid": "e3a0e34a7f2a3c3486e6718fddf8f045", "score": "0.55612624", "text": "func (l *MultiListener) Addr() net.Addr {\n\treturn l.listeners\n}", "title": "" }, { "docid": "a5552d7e87138fc95b8647fe3ae48720", "score": "0.553572", "text": "func (k *Public) IP() net.IP {\n\treturn k.makeIPv6()\n}", "title": "" }, { "docid": "0c2f4db7683389c272cd12b88f422198", "score": "0.55307484", "text": "func (c *FoundationContext) ClientIP() string {\n\treturn c.opt.ClientIP()\n}", "title": "" }, { "docid": "b1c23c842e46fe10263c6c682df39092", "score": "0.55128497", "text": "func ipClient(request *http.Request) string {\n\tIP := request.URL.Query().Get(\"for\")\n\tif IP == \"\" {\n\t\tIP = request.RemoteAddr\n\t}\n\treturn IP\n}", "title": "" }, { "docid": "2ecd6d467d98db39ceca166168c3bab9", "score": "0.5506385", "text": "func (i *Internet) IP() string {\n\tresult := []string{}\n\n\tfor i := 0; i < 4; i++ {\n\t\tresult = append(result, string(random(255)))\n\t}\n\n\treturn strings.Join(result, \".\")\n}", "title": "" }, { "docid": "b9381f422d3b2b61b887af7d2d0bcb4d", "score": "0.5499075", "text": "func Addresses(start, n int) []string {\n\taddrs := make([]string, n, n)\n\tfor i := 0; i < n; i++ {\n\t\taddrs[i] = \"127.0.0.1:\" + strconv.Itoa(GetFreePort())\n\t}\n\treturn addrs\n}", "title": "" }, { "docid": "5a2baff277dc0d99f8f12406ceb86905", "score": "0.5493887", "text": "func InternalIP() (string, error) {\n\treturn getTrimmed(\"instance/network-interfaces/0/ip\")\n}", "title": "" }, { "docid": "42e1cd7349babe2279da0a1a50cd9415", "score": "0.5492859", "text": "func (c *Action) IP() string {\n\tips := c.Proxy()\n\tif len(ips) > 0 && ips[0] != \"\" {\n\t\treturn ips[0]\n\t}\n\tip := strings.Split(c.Request.RemoteAddr, \":\")\n\tif len(ip) > 0 {\n\t\tif ip[0] != \"[\" {\n\t\t\treturn ip[0]\n\t\t}\n\t}\n\treturn \"127.0.0.1\"\n}", "title": "" }, { "docid": "66f272b019a1af0c9f6543f22a65a056", "score": "0.54828155", "text": "func (i *Instance) IP(public bool) (string, error) {\n\tif public {\n\t\tip, err := i.publicIP()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn ip, nil\n\t}\n\n\tip, err := i.privateIP()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn ip, nil\n}", "title": "" }, { "docid": "39565463fc9b9de55d7af1b6b7aea003", "score": "0.54824257", "text": "func MachineIPAddresses() echo.HandlerFunc {\n\treturn func(c echo.Context) error {\n\n\t\t// get private ip addresses\n\t\tinterfaceList, err := util.GetInterfaceIPs()\n\t\tif err != nil {\n\t\t\treturn c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, \"Cannot get machine ip addresses\"})\n\t\t}\n\n\t\t// get public ip address\n\t\t// TODO: Remove the go-external-ip dependency\n\t\tpublicInterface, err := util.GetPublicIP()\n\t\tif err != nil {\n\t\t\tlog.Warn(\"Cannot get machine public ip address: \", err)\n\t\t} else {\n\t\t\t// prepend public ip to the list\n\t\t\tinterfaceList = append([]model.Interface{publicInterface}, interfaceList...)\n\t\t}\n\n\t\treturn c.JSON(http.StatusOK, interfaceList)\n\t}\n}", "title": "" }, { "docid": "7b2c2ede4c6128e74cccbab9059c23d8", "score": "0.5478371", "text": "func (ni *NetInfo) ipfs_addresses(a []string) error {\n var foo IPFSAddr\n for _, f := range a {\n err := foo.Parse(f)\n if err != nil {\n return err\n }\n if ni.HaveIP(foo.IP) {\n ni.PublishAddrs = append(ni.PublishAddrs, f)\n ni.Port = append(ni.Port, foo.Port)\n }\n }\n return nil\n}", "title": "" }, { "docid": "5dff76d396ae1ecc820f637f72a5688c", "score": "0.5478188", "text": "func (o GetFirewallVirtualHubOutput) PublicIpAddresses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetFirewallVirtualHub) []string { return v.PublicIpAddresses }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "c3d27f6d391a9403ae6e889c000d9f44", "score": "0.5466832", "text": "func localIPs() ([]*net.IP, error) {\n\tlocalIPs := make([]*net.IP, 0)\n\taddrs, err := netInterfaceAddrs()\n\tif err != nil {\n\t\treturn localIPs, err\n\t}\n\tfor _, addr := range addrs {\n\t\tvar ip net.IP\n\t\tswitch a := addr.(type) {\n\t\tcase *net.IPNet:\n\t\t\tip = a.IP\n\t\tcase *net.IPAddr:\n\t\t\tip = a.IP\n\t\tdefault:\n\t\t\treturn localIPs, fmt.Errorf(\"unknown address type %q\", addr.String())\n\t\t}\n\t\tif ip != nil {\n\t\t\tlocalIPs = append(localIPs, &ip)\n\t\t}\n\t}\n\treturn localIPs, nil\n}", "title": "" }, { "docid": "acb39ef76ef694680792a16cdf4202f9", "score": "0.54612523", "text": "func (o WorkflowOutput) WorkflowEndpointIpAddresses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *Workflow) pulumi.StringArrayOutput { return v.WorkflowEndpointIpAddresses }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "a52a8aa4793fe06d7954463e18cec637", "score": "0.54571617", "text": "func (i *IE) IP() (net.IP, error) {\n\tif len(i.Payload) < 4 {\n\t\treturn nil, io.ErrUnexpectedEOF\n\t}\n\n\tswitch i.Type {\n\tcase EndUserAddress:\n\t\tif i.MustPDPTypeOrganization() != pdpTypeIETF {\n\t\t\treturn nil, ErrMalformed\n\t\t}\n\t\treturn net.IP(i.Payload[2:]), nil\n\tcase GSNAddress:\n\t\treturn net.IP(i.Payload), nil\n\tdefault:\n\t\treturn nil, &InvalidTypeError{i.Type}\n\t}\n}", "title": "" }, { "docid": "a163920fec8bd76bbaeebebfb89f0c2e", "score": "0.54493564", "text": "func InetServerAddr(db XODB) (string, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.inet_server_addr()`\n\n\t// run query\n\tvar ret string\n\tXOLog(sqlstr)\n\terr = db.QueryRow(sqlstr).Scan(&ret)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "8e874017137a342c787a4edb1f19aefd", "score": "0.5444346", "text": "func (s *Core) GetMyExternalIP() string {\n\tdebugVal := os.Getenv(\"DEBUG_LOCAL_IP\")\n\tif debugVal != \"\" {\n\t\treturn \"127.0.0.1\"\n\t}\n\n\tifaces, _ := net.Interfaces()\n\tfor _, iface := range ifaces {\n\t\taddrs, _ := iface.Addrs()\n\t\tfor _, addr := range addrs {\n\t\t\ttmp := addr.String()\n\t\t\tif strings.Count(tmp, \".\") == 3 && !strings.HasPrefix(tmp, \"127.0.0.1\") {\n\t\t\t\treturn strings.Split(tmp, \"/\")[0]\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\"\n\n}", "title": "" }, { "docid": "4e4079e58770763241b911eb3db2cd72", "score": "0.54377973", "text": "func getIPs(networkID uint32) []string {\n\tswitch networkID {\n\tcase constants.MainnetID:\n\t\treturn nil // Remove this line, should you activate public IP beacons in production mainnet\n\t\t/*\n\t\t\treturn []string{\n\t\t\t\t\"127.0.0.1:9651\",//replace with public ip in production mainnet\n\t\t\t}\n\t\t*/\n\tcase constants.FujiID:\n\t\treturn []string{\n\t\t\t\"18.188.121.35:21001\",\n\t\t\t\"3.133.83.66:21001\",\n\t\t\t\"3.15.206.239:21001\",\n\t\t\t\"18.224.140.156:21001\",\n\t\t\t\"3.133.131.39:21001\",\n\t\t\t\"18.191.29.54:21001\",\n\t\t\t\"18.224.172.110:21001\",\n\t\t\t\"18.223.211.203:21001\",\n\t\t\t\"18.216.130.143:21001\",\n\t\t\t\"18.223.184.147:21001\",\n\t\t\t\"52.15.48.84:21001\",\n\t\t\t\"18.189.194.220:21001\",\n\t\t\t\"18.223.119.104:21001\",\n\t\t\t\"3.133.155.41:21001\",\n\t\t\t\"13.58.170.174:21001\",\n\t\t\t\"3.21.245.246:21001\",\n\t\t\t\"52.15.190.149:21001\",\n\t\t\t\"18.188.95.241:21001\",\n\t\t\t\"3.12.197.248:21001\",\n\t\t\t\"3.17.39.236:21001\",\n\t\t}\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "8934127973e8c67c073c5820629aae7d", "score": "0.5435699", "text": "func (c *cluster) ExternalAdminUIAddr(ctx context.Context, node nodeListOption) []string {\n\tvar addrs []string\n\tfor _, u := range c.ExternalAddr(ctx, node) {\n\t\taddrs = append(addrs, addrToAdminUIAddr(c, u))\n\t}\n\treturn addrs\n}", "title": "" }, { "docid": "c7f8d405d46fe294ae283d9e922667a8", "score": "0.5435339", "text": "func (o SubjectAltNamesOutput) IpAddresses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v SubjectAltNames) []string { return v.IpAddresses }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "969a6c696d95106c4162b350feca4e36", "score": "0.5434319", "text": "func (o FirewallPolicyThreatIntelWhitelistResponseOutput) IpAddresses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v FirewallPolicyThreatIntelWhitelistResponse) []string { return v.IpAddresses }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "33ed87cf19d3631e49fef2e521731cac", "score": "0.5423007", "text": "func (o CustomDnsConfigPropertiesFormatOutput) IpAddresses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v CustomDnsConfigPropertiesFormat) []string { return v.IpAddresses }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "2b54d5765d873e36417b175067fe7f58", "score": "0.5422904", "text": "func (nsHost) IP(value string) fld.Field {\n\treturn ecsString(\"host.ip\", value)\n}", "title": "" }, { "docid": "8d80630afe53396aab2d9ca58bd450ed", "score": "0.5400579", "text": "func execInterfaceAddrs(_ int, p *gop.Context) {\n\tret, ret1 := net.InterfaceAddrs()\n\tp.Ret(0, ret, ret1)\n}", "title": "" }, { "docid": "52cac7958201579d183120972a8bfe80", "score": "0.53991723", "text": "func (o ResolverRuleTargetAddressOutput) Ip() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ResolverRuleTargetAddress) *string { return v.Ip }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3cacd41d6db76466539c7200facae9ec", "score": "0.53976566", "text": "func (r Network_Storage_Backup_Evault) GetAllowedIpAddresses() (resp []datatypes.Network_Subnet_IpAddress, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Storage_Backup_Evault\", \"getAllowedIpAddresses\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "f7a7e2464f59911984ff8bdbefa443a0", "score": "0.53973377", "text": "func ip() (string, error) {\n\tif localIP != \"\" {\n\t\treturn localIP, nil\n\t}\n\taddresses, err := net.InterfaceAddrs()\n\tif err != nil {\n\t\treturn EmptyIP, err\n\t}\n\tfor _, address := range addresses {\n\t\tif ipNet, ok := address.(*net.IPNet); ok && !ipNet.IP.IsLoopback() {\n\t\t\tif ipNet.IP.To4() != nil {\n\t\t\t\tlocalIP = ipNet.IP.String()\n\t\t\t\treturn localIP, nil\n\t\t\t}\n\t\t}\n\t}\n\treturn EmptyIP, nil\n}", "title": "" }, { "docid": "45ffd0f96b32f89ca2836efc7ba86442", "score": "0.53917116", "text": "func (nsObserver) IP(value string) fld.Field {\n\treturn ecsString(\"observer.ip\", value)\n}", "title": "" }, { "docid": "adfdd77524be02ba37ebfdfc93ce8d12", "score": "0.5390869", "text": "func _ifaddrs(fm *Frame) error {\n\taddrs, err := net.InterfaceAddrs()\n\tif err != nil {\n\t\treturn err\n\t}\n\tout := fm.OutputChan()\n\tfor _, addr := range addrs {\n\t\tout <- addr.String()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7f8fdbe333ac8ea61b5c62fe2db9a973", "score": "0.53901047", "text": "func (bridge *ConnectLoopBackBridge) Addr() net.Addr {\n\treturn proxyBridgeAdd{addr: bridge.Address}\n}", "title": "" }, { "docid": "92174a86bbe162c3e576bd8942bfe99a", "score": "0.5387869", "text": "func GetIP() string{\r\n addrs, err := net.InterfaceAddrs()\r\n if err != nil{\r\n panic(err)\r\n }\r\n\r\n return addrs[1].String()\r\n}", "title": "" }, { "docid": "dbc97518b5dc11348197e10fb991a48e", "score": "0.5386455", "text": "func getClientIPAddress(c buffalo.Context) (net.IP, error) {\n\treq := c.Request()\n\n\t// https://developers.cloudflare.com/fundamentals/get-started/reference/http-request-headers/#cf-connecting-ip\n\tif cf := req.Header.Get(\"CF-Connecting-IP\"); cf != \"\" {\n\t\treturn net.ParseIP(cf), nil\n\t}\n\n\tip, _, err := net.SplitHostPort(req.RemoteAddr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"userip: %q is not IP:port, %w\", req.RemoteAddr, err)\n\t}\n\n\tuserIP := net.ParseIP(ip)\n\tif userIP == nil {\n\t\treturn nil, fmt.Errorf(\"userip: %q is not a valid IP address, %w\", req.RemoteAddr, err)\n\t}\n\n\treturn userIP, nil\n}", "title": "" }, { "docid": "825664a3fff86003864a849affb1d856", "score": "0.5378169", "text": "func (o FirewallVirtualHubPtrOutput) PublicIpAddresses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *FirewallVirtualHub) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.PublicIpAddresses\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "e87a56f7ee9c8de15f3059e299f134bd", "score": "0.5377829", "text": "func (s *Swarm) ListenAddresses() []ma.Multiaddr {\n\ts.listeners.RLock()\n\tdefer s.listeners.RUnlock()\n\taddrs := make([]ma.Multiaddr, 0, len(s.listeners.m))\n\tfor l := range s.listeners.m {\n\t\taddrs = append(addrs, l.Multiaddr())\n\t}\n\treturn addrs\n}", "title": "" }, { "docid": "ac8981afb2cf94135c4bea0b3b973d74", "score": "0.5377358", "text": "func (m *NetworkInfo) GetIpAddress()(*string) {\n return m.ipAddress\n}", "title": "" }, { "docid": "5e3a7a8deed70207222df34321dea9ea", "score": "0.5377356", "text": "func ipAddr() net.IP {\n\tip, err := iputils.ExternalIP()\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not get IPv4 address: %v\", err)\n\t}\n\treturn net.ParseIP(ip)\n}", "title": "" }, { "docid": "34bfa8110256da195910bddc44d7a985", "score": "0.537663", "text": "func (inst *ServiceInstance) Addr() string {\n\treturn net.JoinHostPort(inst.IP, strconv.Itoa(int(inst.Port)))\n}", "title": "" }, { "docid": "428a926eb2209536680b4423e2890a93", "score": "0.5366874", "text": "func (o FirewallPolicyThreatIntelligenceAllowlistOutput) IpAddresses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v FirewallPolicyThreatIntelligenceAllowlist) []string { return v.IpAddresses }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "1bd7a0085d40a8d40faaaf5838ec10eb", "score": "0.5366756", "text": "func Addr(ins spec.Instance) string {\n\tif ins.GetPort() == 0 || ins.GetPort() == 80 {\n\t\tpanic(ins)\n\t}\n\treturn ins.GetHost() + \":\" + strconv.Itoa(ins.GetPort())\n}", "title": "" }, { "docid": "95ec79043eac0a6218307746bfaa9360", "score": "0.536506", "text": "func (l *Lachesis) CtrlListenAddr() string {\n\tport := strconv.Itoa(l.conf.CtrlPort)\n\treturn net.JoinHostPort(\"localhost\", port)\n}", "title": "" }, { "docid": "d29ed5206d2eb4367ae9621f2705a434", "score": "0.5363951", "text": "func (o ReplicaSetOutput) ExternalAccessIpAddress() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ReplicaSet) pulumi.StringOutput { return v.ExternalAccessIpAddress }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b0ffdf38b7d37786d976047d29b3573d", "score": "0.5363347", "text": "func getIp() string {\n\taddrs, err := net.InterfaceAddrs()\n\tif err != nil {\n\t\tos.Stderr.WriteString(\"Error: \" + err.Error() + \"\\n\")\n\t\tos.Exit(1)\n\t}\n\n\tfor _, a := range addrs {\n\t\tif ipnet, ok := a.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {\n\t\t\tif ipnet.IP.To4() != nil {\n\t\t\t\treturn ipnet.IP.String()\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a50b6b285108e8cf85b63d0443c38e46", "score": "0.5361471", "text": "func (client *Client) ListExternalIPs() ([]types.MappedIP, error) {\n\tvar IPs []types.MappedIP\n\n\turl, ver, err := client.getCiaoExternalIPsResource()\n\tif err != nil {\n\t\treturn IPs, errors.Wrap(err, \"Error getting external IP resource\")\n\t}\n\n\terr = client.getResource(url, ver, nil, &IPs)\n\n\treturn IPs, err\n}", "title": "" }, { "docid": "616247437241271a3a900e4c030ea22d", "score": "0.5358927", "text": "func (o *IamOAuthTokenAllOf) GetClientIpAddress() string {\n\tif o == nil || o.ClientIpAddress == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ClientIpAddress\n}", "title": "" }, { "docid": "be59b7f696dd58e29d45bfd71e95dcd1", "score": "0.535754", "text": "func (o FirewallPolicyThreatIntelWhitelistPtrOutput) IpAddresses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *FirewallPolicyThreatIntelWhitelist) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.IpAddresses\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "f80b535fc1d125a3f3a13e491d98b3e0", "score": "0.5354124", "text": "func getCiliumHostIPs() (ipv4GW, ipv6Router net.IP) {\n\tnodeConfig := option.Config.GetNodeConfigPath()\n\tipv4GW, ipv6Router = getCiliumHostIPsFromFile(nodeConfig)\n\tif ipv4GW != nil || ipv6Router != nil {\n\t\tlog.WithFields(logrus.Fields{\n\t\t\t\"ipv4\": ipv4GW,\n\t\t\t\"ipv6\": ipv6Router,\n\t\t\t\"file\": nodeConfig,\n\t\t}).Info(\"Restored router address from node_config\")\n\t\treturn ipv4GW, ipv6Router\n\t}\n\treturn getCiliumHostIPsFromNetDev(defaults.HostDevice)\n}", "title": "" } ]
48d250c036dc71b7837e5c4ff396dffc
getStatementCategory returns the proto.BL_ category for a SQL statement.
[ { "docid": "44c2c8fa1226be605d04ab921181e1b5", "score": "0.7585344", "text": "func getStatementCategory(sql []byte) int {\n\tif i := bytes.IndexByte(sql, byte(' ')); i >= 0 {\n\t\tsql = sql[:i]\n\t}\n\treturn statementPrefixes[string(bytes.ToLower(sql))]\n}", "title": "" } ]
[ { "docid": "15e23cd09b1c779a2fd4c2bf29e436e3", "score": "0.5986222", "text": "func (s *Swift) GetCategory() string {\n\tif s == nil || s.Category == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.Category\n}", "title": "" }, { "docid": "f3e3630dca37438d6a35091b4e9032fb", "score": "0.57924545", "text": "func (o *TransactionBase) GetCategory() []string {\n\tif o == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn o.Category\n}", "title": "" }, { "docid": "e9d0d2d4e1af5239642a01e398d127ed", "score": "0.5786864", "text": "func (Terbium) GetCategory() string {\n\tvar c categoryType = lanthanoid\n\treturn c.get()\n}", "title": "" }, { "docid": "38bc9e4cbe69c0678e39349bc16c852c", "score": "0.57822603", "text": "func (o *MicrosoftGraphMalwareState) GetCategory() string {\n\tif o == nil || o.Category == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Category\n}", "title": "" }, { "docid": "e6b7f96954136ee8890427bb8fe9427d", "score": "0.57228786", "text": "func (o *BundleData) GetCategory() string {\n\tif o == nil || o.Category == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Category\n}", "title": "" }, { "docid": "256bd97eba99eda1ec373e659e7773ee", "score": "0.56771415", "text": "func (Platinum) GetCategory() string {\n\tvar c categoryType = transitionMetal\n\treturn c.get()\n}", "title": "" }, { "docid": "790ecd684ca3a198c2b7101fd66f8860", "score": "0.5672759", "text": "func (Polonium) GetCategory() string {\n\tvar c categoryType = postTransitionMetal\n\treturn c.get()\n}", "title": "" }, { "docid": "fb1e2f06fc2f220d8e00f0f3c1b6c19d", "score": "0.5663416", "text": "func Category() string {\n\treturn category\n}", "title": "" }, { "docid": "e9b346821495fc89b8c7517c0fd8993e", "score": "0.5660213", "text": "func (m *AuditEvent) GetCategory()(*string) {\n return m.category\n}", "title": "" }, { "docid": "081ee0acc579235fd62fa98d37813197", "score": "0.5639584", "text": "func DecodeStatement(dec *sqbin.Codec) LogStatement {\n\t// the first byte should be the statement type\n\tvar stmt LogStatement\n\ttm := dec.PeekTypeMarker()\n\tswitch tm {\n\tcase TMCreateDDL:\n\t\tstmt = &CreateDDL{}\n\tcase TMInsertRows:\n\t\tstmt = &InsertRows{}\n\tcase TMUpdateRows:\n\t\tstmt = &UpdateRows{}\n\tcase TMDeleteRows:\n\t\tstmt = &DeleteRows{}\n\tcase TMDropDDL:\n\t\tstmt = &DropDDL{}\n\tdefault:\n\t\tif DecodeStatementHook != nil {\n\t\t\tstmt = DecodeStatementHook(tm)\n\t\t} else {\n\t\t\tlog.Panicf(\"Attempting to decode unknown LogStatement type %d-%s\", tm, sqbin.TMToString(tm))\n\t\t}\n\t}\n\tstmt.Decode(dec)\n\treturn stmt\n}", "title": "" }, { "docid": "f71ce6d221c50302aa7100710a413bce", "score": "0.56360865", "text": "func (o *TransactionBase) GetCategoryId() string {\n\tif o == nil || o.CategoryId.Get() == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.CategoryId.Get()\n}", "title": "" }, { "docid": "29c77d995765ee5e528bd93fc50534bc", "score": "0.561391", "text": "func (c CommonStatement) GetSQL() string { return c.SQL }", "title": "" }, { "docid": "82c271d3c8981c87fc9496a5c0c9559e", "score": "0.559385", "text": "func (o *HyperflexHealthCheckExecutionSnapshotAllOf) GetCategory() string {\n\tif o == nil || o.Category == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Category\n}", "title": "" }, { "docid": "03ec98f90e8d7361d86b5ceb115c7c04", "score": "0.55582136", "text": "func (o *MicrosoftGraphDirectoryAudit) GetCategory() string {\n\tif o == nil || o.Category == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Category\n}", "title": "" }, { "docid": "a7294a07cf237e530a7630afbf95a924", "score": "0.5543826", "text": "func (Vanadium) GetCategory() string {\n\tvar c categoryType = transitionMetal\n\treturn c.get()\n}", "title": "" }, { "docid": "a6b69f666585b9c85e3ceb372fcec896", "score": "0.5526608", "text": "func (o *CloudTfcWorkspaceVariablesAllOf) GetCategory() string {\n\tif o == nil || o.Category == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Category\n}", "title": "" }, { "docid": "9b8d21d535157b5c614583c20d83f883", "score": "0.5520579", "text": "func (Copernicium) GetCategory() string {\n\tvar c categoryType = transitionMetal\n\treturn c.get()\n}", "title": "" }, { "docid": "fac8ec917913f0a7b4fb98b94dc29c98", "score": "0.5495761", "text": "func (o *MutualFundProfileData) GetCategory() string {\n\tif o == nil || o.Category == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Category\n}", "title": "" }, { "docid": "f2e95a49a0c5993d69b5a8fd0db4093c", "score": "0.5403357", "text": "func (o *IaasDeviceStatus) GetCategory() string {\n\tif o == nil || o.Category == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Category\n}", "title": "" }, { "docid": "3053e0cb06214a822d645d8e212e70ef", "score": "0.53997624", "text": "func (Germanium) GetCategory() string {\n\tvar c categoryType = metalloid\n\treturn c.get()\n}", "title": "" }, { "docid": "e31f95a861b0bc8b65e9090c05ee045a", "score": "0.53991973", "text": "func (Curium) GetCategory() string {\n\tvar c categoryType = actinoid\n\treturn c.get()\n}", "title": "" }, { "docid": "e61c1d94d3a351c81ff7c941e06e8732", "score": "0.5378108", "text": "func (Americium) GetCategory() string {\n\tvar c categoryType = actinoid\n\treturn c.get()\n}", "title": "" }, { "docid": "6452e7eb329476ead9510c8193de3c04", "score": "0.53140926", "text": "func (o *ConsumptionEntry) GetCategory() string {\n\tif o == nil || o.Category == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Category\n}", "title": "" }, { "docid": "6e5c36caa9da1f198773f4aaa46b30bf", "score": "0.53028506", "text": "func (o *InlineResponse20053Projects) GetCategory() InlineResponse2002Column {\n\tif o == nil || o.Category == nil {\n\t\tvar ret InlineResponse2002Column\n\t\treturn ret\n\t}\n\treturn *o.Category\n}", "title": "" }, { "docid": "a90cfb299d2be7e051984af849369ec3", "score": "0.5277382", "text": "func (cur *Cursor) getStatementType() error {\n\tvar statementType C.ub2\n\tvar vsize C.ub4\n\tif CTrace {\n\t\tctrace(\"getStatementType.OCIAttrGet(%p, HTYPE_STMT, &stt=%p, &vsize=%p, ATTR_SMT_TYPE, errh=%p)\",\n\t\t\tcur.handle, &statementType, &vsize, cur.environment.errorHandle)\n\t}\n\tif err := cur.environment.CheckStatus(\n\t\tC.OCIAttrGet(unsafe.Pointer(cur.handle), C.OCI_HTYPE_STMT,\n\t\t\tunsafe.Pointer(&statementType), &vsize, C.OCI_ATTR_STMT_TYPE,\n\t\t\tcur.environment.errorHandle),\n\t\t\"getStatementType\"); err != nil {\n\t\treturn errgo.Mask(err)\n\t}\n\tcur.statementType = int(statementType)\n\tif CTrace {\n\t\tctrace(\"statement type is %d\", cur.statementType)\n\t}\n\tif cur.fetchVariables != nil {\n\t\tcur.fetchVariables = nil\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a9bfd4fc25c9be873fa04b0d3d88bc72", "score": "0.5243897", "text": "func (Chlorine) GetCategory() string {\n\tvar c categoryType = nonMetal\n\treturn c.get()\n}", "title": "" }, { "docid": "f7b6b08a70510ab3dbe712b2d1698ff8", "score": "0.5225059", "text": "func (m *UserExperienceAnalyticsImpactingProcess) GetCategory()(*string) {\n val, err := m.GetBackingStore().Get(\"category\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "6218b97d7be270a1012d67dca6ae8b43", "score": "0.5183073", "text": "func (Europium) GetCategory() string {\n\tvar c categoryType = lanthanoid\n\treturn c.get()\n}", "title": "" }, { "docid": "42da7a47420ac5a7c0549fbe95e8f28d", "score": "0.5110053", "text": "func (o GroupMetricRuleOutput) Category() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *GroupMetricRule) pulumi.StringOutput { return v.Category }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a7a192f11ab70a387cda8e880b856e66", "score": "0.5107423", "text": "func (s *SubCommandRouter) Category() string {\n\tif s.Router != nil {\n\t\treturn s.Router.CurrentCategory\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "198a05e295d94d64553e00548a142662", "score": "0.5102903", "text": "func (sdt ScalarDataType) Category() DataTypeCategory {\n\treturn ScalarDataTypeCategory\n}", "title": "" }, { "docid": "6971c26960dfb0e67a0de13dd7e6eda3", "score": "0.5071631", "text": "func (c *CacheImpl) Category(categoryID api.Snowflake) *api.Category {\n\tfor _, guildCategories := range c.categories {\n\t\tif channel, ok := guildCategories[categoryID]; ok {\n\t\t\treturn channel\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "75aa4d21a095dbd7b6c0eb353a3c4769", "score": "0.5053394", "text": "func (Calcium) GetCategory() string {\n\tvar c categoryType = alkalineEarthMetal\n\treturn c.get()\n}", "title": "" }, { "docid": "73ea74c8606d43ed5a40b85646bba288", "score": "0.5045858", "text": "func (o GetRulesRuleOutput) Category() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetRulesRule) int { return v.Category }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "66567688655aabf266744c82ac5d840e", "score": "0.5038753", "text": "func (o GetMetricRuleBlackListsListOutput) Category() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetMetricRuleBlackListsList) string { return v.Category }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "58d94b6fd46e324a9e27fd130f70b94c", "score": "0.49779752", "text": "func (job *IncomingJob) Category() string {\n\treturn job.CategoryField\n}", "title": "" }, { "docid": "c61d31e913deb5019b9402fdf220db32", "score": "0.49710715", "text": "func (q *Query) Statement() string {\n\treturn q.query.Statement()\n}", "title": "" }, { "docid": "472037ef66f1db16859992f441dd0e36", "score": "0.4953122", "text": "func (c *Client) GetStatement(sessionID int, statementID int) (*Statement, error) {\n\treq, err := c.NewRequest(\"GET\", fmt.Sprintf(\"/sessions/%d/statements/%d\", sessionID, statementID), nil)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"creating request\")\n\t}\n\n\tvar statement Statement\n\tif err := c.Do(req, &statement); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &statement, nil\n}", "title": "" }, { "docid": "e889d66416d4effc20a60c473a4a5b1f", "score": "0.4924883", "text": "func (o *PrivilegePrivilege) GetStatement() []Statement {\n\tif o == nil {\n\t\tvar ret []Statement\n\t\treturn ret\n\t}\n\n\treturn o.Statement\n}", "title": "" }, { "docid": "5c9208d9b746d1a75378e332a8438792", "score": "0.49134657", "text": "func (Radium) GetCategory() string {\n\tvar c categoryType = alkalineEarthMetal\n\treturn c.get()\n}", "title": "" }, { "docid": "88ab308f61718233384298c577a6988e", "score": "0.49076858", "text": "func (o GetMetricRuleTemplatesTemplateAlertTemplateOutput) Category() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetMetricRuleTemplatesTemplateAlertTemplate) string { return v.Category }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a2ad9ff5594842804373dee700804eb2", "score": "0.48842704", "text": "func (q *Query) StatementType() StatementType {\n\treturn QueryStatement\n}", "title": "" }, { "docid": "a45a3bc84ef08801e48150e4a629472c", "score": "0.48764426", "text": "func (o LogSettingsResponseOutput) Category() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LogSettingsResponse) *string { return v.Category }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "25ab04082b046e8a4509502fa361d6cc", "score": "0.48758385", "text": "func (o *TransactionBase) GetCategoryOk() (*[]string, bool) {\n\tif o == nil || o.Category == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Category, true\n}", "title": "" }, { "docid": "7a8237296df80c5b33a1745454f50e4f", "score": "0.48756936", "text": "func (s StringStatement) GetSQL() string { return string(s) }", "title": "" }, { "docid": "f7db49fa4e34e261b0c771642b12047d", "score": "0.48671293", "text": "func GetCategory(categoryId string) (*domain.Category, error) {\n\treturn persistence.GetCategory(categoryId)\n}", "title": "" }, { "docid": "031fd0c392d5097745f2bb73404e90f2", "score": "0.48407283", "text": "func (o *EmsAutosupportLogRequest) Category() string {\n\tvar r string\n\tif o.CategoryPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.CategoryPtr\n\treturn r\n}", "title": "" }, { "docid": "c61951154a64fe1d69fd81ed3d9ca70f", "score": "0.48353922", "text": "func (p *Product) Category() string {\n\treturn p.ProductType\n}", "title": "" }, { "docid": "6eb1f57a682c64427c1c481fe0087b52", "score": "0.48284614", "text": "func (gen *Gen) writeCategory(stmt *sql.Stmt) {\n\tgen.mutex.Lock()\n\tdefer func() {\n\t\tgen.mutex.Unlock()\n\t\tgen.wg.Done()\n\t}()\n\n\tvar category *Category\n\n\tcategory, categories = categories[0], categories[1:]\n\n\tif category.ParentId.String() != defaultUUIDValue {\n\t\t_, err := stmt.Exec(category.Id, category.Name, category.ParentId)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t} else {\n\t\t_, err := stmt.Exec(category.Id, category.Name, sql.NullString{\n\t\t\tString: \"\",\n\t\t\tValid: false,\n\t\t})\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e93fda91b02382f200723c4a9ad80fc5", "score": "0.48185655", "text": "func GetCategory(ID int, appid string) (Category, error) {\n\tlastOperation := time.Now()\n\tdb := util.GetMainDB()\n\tvar c Category\n\tif db == nil {\n\t\treturn c, fmt.Errorf(\"main db connection pool is nil\")\n\t}\n\trawQuery := fmt.Sprintf(\"SELECT CategoryId, CategoryName, ParentId FROM %s_categories WHERE CategoryId = ?\", appid)\n\terr := db.QueryRow(rawQuery, ID).Scan(&c.ID, &c.Name, &c.ParentID)\n\tif err == sql.ErrNoRows {\n\t\treturn c, err\n\t} else if err != nil {\n\t\treturn c, fmt.Errorf(\"query row failed, %v\", err)\n\t}\n\tutil.LogInfo.Printf(\"get category in GetCategory took: %s\\n\", time.Since(lastOperation))\n\n\treturn c, nil\n}", "title": "" }, { "docid": "8efb50ff9b1a0e3c187ed041fd8d6c90", "score": "0.4808266", "text": "func (o LogSettingsOutput) Category() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LogSettings) *string { return v.Category }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "07d9deca2b414ec01c796a27995ce47c", "score": "0.477709", "text": "func (c *Client) CancelStatement(sessionID, statementID int) error {\n\treq, err := c.NewRequest(\"POST\", fmt.Sprintf(\"/sessions/%d/statements/%d/cancel\", sessionID, statementID), nil)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"creating request\")\n\t}\n\n\treturn c.Do(req, nil)\n}", "title": "" }, { "docid": "65c15df919bbe0c0fc67e0d4de61587e", "score": "0.47645432", "text": "func (o *FilesIdJsonFile) GetCategoryId() string {\n\tif o == nil || o.CategoryId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.CategoryId\n}", "title": "" }, { "docid": "8e3049d7f751de0d8c4203893c5fc39d", "score": "0.47633702", "text": "func (e *ExamplePage) GetCategory() string {\n return e.Category\n}", "title": "" }, { "docid": "80615121f94c5fb3d4e934481cb4afa0", "score": "0.47598007", "text": "func (o *FDXNotification) GetCategory() FDXNotificationCategory {\n\tif o == nil {\n\t\tvar ret FDXNotificationCategory\n\t\treturn ret\n\t}\n\n\treturn o.Category\n}", "title": "" }, { "docid": "557e70d0bfa5062465b6b67c6f5b0d7b", "score": "0.47560552", "text": "func (c *Node) Category() *Category {\n\treturn c.category\n}", "title": "" }, { "docid": "88703c58767e91b88498b0c4f9cbf6ad", "score": "0.47559375", "text": "func (o MetricRuleTemplateAlertTemplateOutput) Category() pulumi.StringOutput {\n\treturn o.ApplyT(func(v MetricRuleTemplateAlertTemplate) string { return v.Category }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "47c6b98bd2611a39a1aef56839646e27", "score": "0.47523573", "text": "func (m *ThreatSubmission) GetCategory()(*SubmissionCategory) {\n val, err := m.GetBackingStore().Get(\"category\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*SubmissionCategory)\n }\n return nil\n}", "title": "" }, { "docid": "27c408e8f32808e912913250eb86c12f", "score": "0.47236592", "text": "func (o WorkbookTemplateGalleryOutput) Category() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WorkbookTemplateGallery) string { return v.Category }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "49b2498c8ac274d0a198e23e1abed8e2", "score": "0.47227752", "text": "func (o MonitorGroupInstancesInstanceOutput) Category() pulumi.StringOutput {\n\treturn o.ApplyT(func(v MonitorGroupInstancesInstance) string { return v.Category }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6b3996e81ce272bddd4b2e8c494aa255", "score": "0.47146004", "text": "func (m *PlannerCategoryDescriptions) GetCategory18()(*string) {\n return m.category18\n}", "title": "" }, { "docid": "f61e1bddc9703e5b0f926281084dd253", "score": "0.4713767", "text": "func (b Delete) Statement() stmt.Statement {\n\treturn b.query\n}", "title": "" }, { "docid": "4d99575a9daaf4e61ffd9982c6a931cd", "score": "0.47012794", "text": "func (f *FredClient) GetCategory(params map[string]interface{}) (*FredType, error) {\n\n\tfc, err := f.operate(params, categoryParam)\n\n\tif err != nil {\n\t\tf.logError(categoryParam, err)\n\t\treturn nil, err\n\t}\n\n\treturn fc, nil\n\n}", "title": "" }, { "docid": "ea518381f149b28ba649066c5fea9a6a", "score": "0.46993577", "text": "func FindCategory(exec boil.Executor, iD string, selectCols ...string) (*Category, error) {\n\tcategoryObj := &Category{}\n\n\tsel := \"*\"\n\tif len(selectCols) > 0 {\n\t\tsel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), \",\")\n\t}\n\tquery := fmt.Sprintf(\n\t\t\"select %s from \\\"category\\\" where \\\"id\\\"=$1\", sel,\n\t)\n\n\tq := queries.Raw(query, iD)\n\n\terr := q.Bind(nil, exec, categoryObj)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: unable to select from category\")\n\t}\n\n\treturn categoryObj, nil\n}", "title": "" }, { "docid": "5d3ef50c6f3d3a5b370703925d11b3ad", "score": "0.46970865", "text": "func AsComponentCategory(s string) ComponentCategory {\n\tswitch s {\n\tcase BlkChannel:\n\t\treturn CategoryChannels\n\tcase BlkRouter:\n\t\treturn CategoryRouters\n\tcase BlkTransf:\n\t\treturn CategoryTransformers\n\tcase BlkSource:\n\t\treturn CategorySources\n\tcase BlkTarget:\n\t\treturn CategoryTargets\n\tdefault:\n\t\treturn CategoryUnknown\n\t}\n}", "title": "" }, { "docid": "53e8aca1711435823b25238c322e5212", "score": "0.46931174", "text": "func (o *NotebookNotebook) GetCategoryId() int32 {\n\tif o == nil || o.CategoryId == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.CategoryId\n}", "title": "" }, { "docid": "17bc2dd9137d3db1b70ed8d8caac9513", "score": "0.46805242", "text": "func (b *Builder) Statement() string {\n\tstmt := b.buf.String()\n\tpool.Put(b.buf)\n\tb.buf = nil\n\treturn stmt\n}", "title": "" }, { "docid": "74410e7e6032e79e001acff5539405a1", "score": "0.46720606", "text": "func (m *PlannerCategoryDescriptions) GetCategory3()(*string) {\n return m.category3\n}", "title": "" }, { "docid": "2b9a3add5ed915f9b1f1ce5a7cbca321", "score": "0.46713233", "text": "func GetCategory(id int) (Category, error) {\n\tdb := DB()\n\tdefer db.Close()\n\n\tcategory := Category{}\n\n\trow := db.QueryRow(\"SELECT id, title, description, updated_at, created_at FROM categories where id = ? \", id)\n\n\terr := row.Scan(&category.ID, &category.Title, &category.Description, &category.UpdatedAt, &category.CreatedAt)\n\n\tswitch {\n\tcase err == sql.ErrNoRows:\n\t\terrMsg := fmt.Errorf(\"category with (id %d) does not exist\", id)\n\t\treturn category, errMsg\n\tcase err != nil:\n\t\terrMsg := fmt.Errorf(\"an unknown error occurred %s\", err.Error())\n\t\treturn category, errMsg\n\tdefault:\n\t\treturn category, nil\n\t}\n}", "title": "" }, { "docid": "67c8745ec13908f5cbb7891f27f11397", "score": "0.4655016", "text": "func (pc *PreConfiguredProduct) Category() string {\n\t// TODO: finish this\n\treturn \"n/a\"\n}", "title": "" }, { "docid": "06baca19cc5b0532e87c9dfeb07d55c5", "score": "0.46304357", "text": "func (c Category) Query(ctx context.Context, traceID string) ([]CategoryInfo, error) {\n\tctx, span := trace.SpanFromContext(ctx).Tracer().Start(ctx, \"business.data.category.query\")\n\tdefer span.End()\n\n\tconst q = `SELECT * FROM categories`\n\n\tlog.Printf(\"%s : %s : query : %s\", traceID, \"category.Query\",\n\t\tdatabase.Log(q),\n\t)\n\n\tcategories := []CategoryInfo{}\n\tif err := c.db.SelectContext(ctx, &categories, q); err != nil {\n\t\treturn nil, errors.Wrap(err, \"selecting categories\")\n\t}\n\n\treturn categories, nil\n}", "title": "" }, { "docid": "cf984d4ffb7ec2e20c8a31d1c80d4ae8", "score": "0.46172956", "text": "func (m *PlannerCategoryDescriptions) GetCategory2()(*string) {\n return m.category2\n}", "title": "" }, { "docid": "02628eda90ad2b2f694a3169a2be265b", "score": "0.46043187", "text": "func GetCategory(ID int, appid string) (Category, error) {\n\tdb := util.GetMainDB()\n\tvar c Category\n\tif db == nil {\n\t\treturn c, fmt.Errorf(\"main db connection pool is nil\")\n\t}\n\trawQuery := fmt.Sprintf(\"SELECT CategoryId, CategoryName, ParentId FROM %s_categories WHERE CategoryId = ?\", appid)\n\terr := db.QueryRow(rawQuery, ID).Scan(&c.ID, &c.Name, &c.ParentID)\n\tif err == sql.ErrNoRows {\n\t\treturn c, err\n\t} else if err != nil {\n\t\treturn c, fmt.Errorf(\"query row failed, %v\", err)\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "8db65691466653ddeea37ca3d25f6c1d", "score": "0.45991436", "text": "func (o *MicrosoftGraphDirectoryAudit) GetCategoryOk() (string, bool) {\n\tif o == nil || o.Category == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Category, true\n}", "title": "" }, { "docid": "e5aff2e0730b538d7584cabc2a9d54a0", "score": "0.4566504", "text": "func (m *PlannerCategoryDescriptions) GetCategory12()(*string) {\n return m.category12\n}", "title": "" }, { "docid": "21cbbf3f595bbae15ba0b2bc3f90e3ca", "score": "0.45522526", "text": "func (m *PlannerCategoryDescriptions) GetCategory17()(*string) {\n return m.category17\n}", "title": "" }, { "docid": "ead8548e6b288ea5b3867193798e9c5a", "score": "0.4545862", "text": "func (o TestIssueResponseOutput) Category() pulumi.StringOutput {\n\treturn o.ApplyT(func(v TestIssueResponse) string { return v.Category }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "36799fdb346170c589d53422dc45ab67", "score": "0.45342273", "text": "func (c *Client) CancelStatement(ctx context.Context, params *CancelStatementInput, optFns ...func(*Options)) (*CancelStatementOutput, error) {\n\tif params == nil {\n\t\tparams = &CancelStatementInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"CancelStatement\", params, optFns, addOperationCancelStatementMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*CancelStatementOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "ea16f6732dfc9a363ebabf05a1de1b69", "score": "0.45319137", "text": "func (o *MicrosoftGraphMalwareState) GetCategoryOk() (string, bool) {\n\tif o == nil || o.Category == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Category, true\n}", "title": "" }, { "docid": "c188c2e18c1cc8865df00a368e95f99f", "score": "0.4528338", "text": "func (b *Builder) statementTag(expr memo.RelExpr) string {\n\tswitch expr.Op() {\n\tcase opt.OpaqueRelOp, opt.OpaqueMutationOp, opt.OpaqueDDLOp:\n\t\treturn expr.Private().(*memo.OpaqueRelPrivate).Metadata.String()\n\n\tdefault:\n\t\treturn expr.Op().SyntaxTag()\n\t}\n}", "title": "" }, { "docid": "afdd76b6218c7532ce8a3ca5e510e6f3", "score": "0.4512551", "text": "func (m *PlannerCategoryDescriptions) GetCategory23()(*string) {\n return m.category23\n}", "title": "" }, { "docid": "63e350f6f0f8ede8ed89e4bf32b4a6c9", "score": "0.45109776", "text": "func (s *statusServer) StatementDiagnostics(\n\tctx context.Context, req *serverpb.StatementDiagnosticsRequest,\n) (*serverpb.StatementDiagnosticsResponse, error) {\n\tctx = propagateGatewayMetadata(ctx)\n\tctx = s.AnnotateCtx(ctx)\n\n\tif _, err := s.privilegeChecker.requireViewActivityPermission(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar err error\n\trow, err := s.internalExecutor.QueryRowEx(ctx, \"stmt-diag-get-one\", nil, /* txn */\n\t\tsessiondata.InternalExecutorOverride{\n\t\t\tUser: security.RootUserName(),\n\t\t},\n\t\t`SELECT\n\t\t\tid,\n\t\t\tstatement_fingerprint,\n\t\t\tcollected_at\n\t\tFROM\n\t\t\tsystem.statement_diagnostics\n\t\tWHERE\n\t\t\tid = $1`, req.StatementDiagnosticsId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif row == nil {\n\t\treturn nil, errors.Newf(\n\t\t\t\"requested a statement diagnostic (%d) that does not exist\",\n\t\t\treq.StatementDiagnosticsId,\n\t\t)\n\t}\n\n\tdiagnostics := stmtDiagnostics{\n\t\tID: int(req.StatementDiagnosticsId),\n\t}\n\n\tif statementFingerprint, ok := row[1].(*tree.DString); ok {\n\t\tdiagnostics.StatementFingerprint = statementFingerprint.String()\n\t}\n\n\tif collectedAt, ok := row[2].(*tree.DTimestampTZ); ok {\n\t\tdiagnostics.CollectedAt = collectedAt.Time\n\t}\n\n\tdiagnosticsProto := diagnostics.toProto()\n\tresponse := &serverpb.StatementDiagnosticsResponse{\n\t\tDiagnostics: &diagnosticsProto,\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "dd02784d9685250e926aeae528f11a5f", "score": "0.4509581", "text": "func removeStatementHint(sql string) string {\n\t// Valid statement hints at the beginning of a query statement can only contain a fixed set of\n\t// possible values. Although it is possible to add a @{FORCE_INDEX=...} as a statement hint, the\n\t// only allowed value is _BASE_TABLE. This means that we can safely assume that the statement\n\t// hint will not contain any special characters, for example a closing curly brace or one of the\n\t// keywords SELECT, UPDATE, DELETE, WITH, and that we can keep the check simple by just\n\t// searching for the first occurrence of a keyword that should be preceded by a closing curly\n\t// brace at the end of the statement hint.\n\tstartStatementHintIndex := strings.Index(sql, \"{\")\n\t// Statement hints are allowed for both queries and DML statements.\n\tstartQueryIndex := -1\n\tupperCaseSql := strings.ToUpper(sql)\n\tfor keyword := range selectAndDmlStatements {\n\t\tif startQueryIndex = strings.Index(upperCaseSql, keyword); startQueryIndex > -1 {\n\t\t\tbreak\n\t\t}\n\t}\n\tif startQueryIndex > -1 {\n\t\tendStatementHintIndex := strings.LastIndex(sql[:startQueryIndex], \"}\")\n\t\tif startStatementHintIndex == -1 || startStatementHintIndex > endStatementHintIndex {\n\t\t\t// Looks like an invalid statement hint. Just ignore at this point\n\t\t\t// and let the caller handle the invalid query.\n\t\t\treturn sql\n\t\t}\n\t\treturn strings.TrimSpace(sql[endStatementHintIndex+1:])\n\t}\n\t// Seems invalid, just return the original statement.\n\treturn sql\n}", "title": "" }, { "docid": "60de7edb8763088a965d1357a4553033", "score": "0.45085874", "text": "func (m *PlannerCategoryDescriptions) GetCategory20()(*string) {\n return m.category20\n}", "title": "" }, { "docid": "9a824485293fba18f07699074766bbe8", "score": "0.45081055", "text": "func (o ExternalRefResponseOutput) Category() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ExternalRefResponse) string { return v.Category }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9a824485293fba18f07699074766bbe8", "score": "0.45081055", "text": "func (o ExternalRefResponseOutput) Category() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ExternalRefResponse) string { return v.Category }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ba407a565ae92c2511ab0ccdb62e793c", "score": "0.45057115", "text": "func (ndt NamedDataType) Category() DataTypeCategory {\n\treturn NamedDataTypeCategory\n}", "title": "" }, { "docid": "f8d457ab47ad6d3693fd9301844d50d2", "score": "0.45054147", "text": "func (m *PlannerCategoryDescriptions) GetCategory19()(*string) {\n return m.category19\n}", "title": "" }, { "docid": "a6b4a21b01b26e3749717ca535dec219", "score": "0.44988114", "text": "func (m *PlannerCategoryDescriptions) GetCategory22()(*string) {\n return m.category22\n}", "title": "" }, { "docid": "0a15e66df06eeb962016f944978b1391", "score": "0.4490913", "text": "func GetCategoryRaw(id int) (models.CategoryRaw, error) {\n\tvar categoryRaw models.CategoryRaw\n\terr := config.DB.QueryRow(\"SELECT id, name FROM project_category WHERE id=?\", id).Scan(&categoryRaw.ID, &categoryRaw.Name)\n\n\tif err != nil {\n\t\treturn models.CategoryRaw{}, errors.New(\"Server is unable to execute query to the database\")\n\t}\n\n\treturn categoryRaw, nil\n}", "title": "" }, { "docid": "f1ecbfa39b39cc25a723447f8c5803ff", "score": "0.44822937", "text": "func (v *Variant) Category() string {\n\treturn v.GetProduct().Category()\n}", "title": "" }, { "docid": "40e23e25b781c7c356ed758dc7d430c9", "score": "0.44794536", "text": "func (o *BundleData) GetCategoryOk() (*string, bool) {\n\tif o == nil || o.Category == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Category, true\n}", "title": "" }, { "docid": "5226c080e3827a2938f2336f24e15f2c", "score": "0.44781506", "text": "func (o DiskOutput) Category() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Disk) pulumi.StringPtrOutput { return v.Category }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "122c9baf6aa7db501011112be12b3910", "score": "0.44770613", "text": "func statementTableName(stmt sql2.Statement) (string, error) {\n\tswitch stmt := stmt.(type) {\n\tcase *sql2.SelectStatement:\n\t\treturn sourceTableName(stmt.Source)\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"statement not currently supported\")\n\t}\n}", "title": "" }, { "docid": "34a3130c054c1ab48568d568024b688e", "score": "0.4471039", "text": "func (b Insert) Statement() stmt.Statement {\n\treturn b.insert\n}", "title": "" }, { "docid": "9db5f201e4a2514186aeab429ddfa951", "score": "0.44656214", "text": "func compileStatement(s ast.Statement, bytecode *Bytecode) error {\n\tswitch statement := s.(type) {\n\tcase *ast.AssignStatement:\n\t\treturn compileAssignStatement(statement, bytecode)\n\n\tcase *ast.ReturnStatement:\n\t\treturn compileReturnStatement(statement, bytecode)\n\n\tcase *ast.IfStatement:\n\t\treturn compileIfStatement(statement, bytecode)\n\n\tcase *ast.BlockStatement:\n\t\treturn compileBlockStatement(statement, bytecode)\n\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "10ebc085609fd552b38ceb9084694d52", "score": "0.44605675", "text": "func (m *MessageRulePredicates) GetCategories()([]string) {\n val, err := m.GetBackingStore().Get(\"categories\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]string)\n }\n return nil\n}", "title": "" }, { "docid": "71f3597f8e79cd4c056b9e31a03b2d0e", "score": "0.44528735", "text": "func (c *Client) CategoryGet(categoryID ID) (*Category, error) {\n\tresponse, err := c.R().\n\t\tGet(fmt.Sprintf(\"/categories/%d\", categoryID))\n\n\tvar result Category\n\treturn &result, responseUnmarshal(response, err, &result)\n}", "title": "" }, { "docid": "e6861c377601ecd94599963a9a7543f6", "score": "0.44452673", "text": "func (o *VisualScriptCustomNode) X_GetCategory() gdnative.String {\n\t//log.Println(\"Calling VisualScriptCustomNode.X_GetCategory()\")\n\n\t// Build out the method's arguments\n\tptrArguments := make([]gdnative.Pointer, 0, 0)\n\n\t// Get the method bind\n\tmethodBind := gdnative.NewMethodBind(\"VisualScriptCustomNode\", \"_get_category\")\n\n\t// Call the parent method.\n\t// String\n\tretPtr := gdnative.NewEmptyString()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewStringFromPointer(retPtr)\n\treturn ret\n}", "title": "" }, { "docid": "3df4ccf6b79c7b2bdbee25d504a65dac", "score": "0.4427114", "text": "func (o *CloudTfcWorkspaceVariablesAllOf) GetCategoryOk() (*string, bool) {\n\tif o == nil || o.Category == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Category, true\n}", "title": "" } ]
e75811b9207449488b7028f3759bc47a
Connectorspecific properties required when using Slack. See Generic Connector Profile Properties for more details.
[ { "docid": "071262a246174aec75adc8e96629dcbc", "score": "0.5846951", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesOutput) Slack() ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSlackPtrOutput {\n\treturn o.ApplyT(func(v ConnectorProfileConnectorProfileConfigConnectorProfileProperties) *ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSlack {\n\t\treturn v.Slack\n\t}).(ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSlackPtrOutput)\n}", "title": "" } ]
[ { "docid": "a42c2a39f4527b767ee5da69a53c3d50", "score": "0.56841123", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesPtrOutput) Slack() ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSlackPtrOutput {\n\treturn o.ApplyT(func(v *ConnectorProfileConnectorProfileConfigConnectorProfileProperties) *ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSlack {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Slack\n\t}).(ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSlackPtrOutput)\n}", "title": "" }, { "docid": "89f7b634b4b92b7616ee6fe51eb84106", "score": "0.5328307", "text": "func (o FlowSourceFlowConfigSourceConnectorPropertiesOutput) Slack() FlowSourceFlowConfigSourceConnectorPropertiesSlackPtrOutput {\n\treturn o.ApplyT(func(v FlowSourceFlowConfigSourceConnectorProperties) *FlowSourceFlowConfigSourceConnectorPropertiesSlack {\n\t\treturn v.Slack\n\t}).(FlowSourceFlowConfigSourceConnectorPropertiesSlackPtrOutput)\n}", "title": "" }, { "docid": "946614b51d96d8e6d0fcdc794060260c", "score": "0.5282737", "text": "func (o FlowSourceFlowConfigSourceConnectorPropertiesPtrOutput) Slack() FlowSourceFlowConfigSourceConnectorPropertiesSlackPtrOutput {\n\treturn o.ApplyT(func(v *FlowSourceFlowConfigSourceConnectorProperties) *FlowSourceFlowConfigSourceConnectorPropertiesSlack {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Slack\n\t}).(FlowSourceFlowConfigSourceConnectorPropertiesSlackPtrOutput)\n}", "title": "" }, { "docid": "ddca1b5e5c0456af87ee35cd3c04af7a", "score": "0.5265566", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsOutput) Slack() ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsSlackPtrOutput {\n\treturn o.ApplyT(func(v ConnectorProfileConnectorProfileConfigConnectorProfileCredentials) *ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsSlack {\n\t\treturn v.Slack\n\t}).(ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsSlackPtrOutput)\n}", "title": "" }, { "docid": "35adbb389c9baa3297b0bdbdc1604a1b", "score": "0.52022684", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsPtrOutput) Slack() ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsSlackPtrOutput {\n\treturn o.ApplyT(func(v *ConnectorProfileConnectorProfileConfigConnectorProfileCredentials) *ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsSlack {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Slack\n\t}).(ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsSlackPtrOutput)\n}", "title": "" }, { "docid": "372c1e575372b806bacc2fddb9e3ac3d", "score": "0.5048875", "text": "func getConnectorConfig() connector.Config {\n\tdefaultsFile := flag.String(\"defaults-file\", \"\", \"Define the defaults file to read\")\n\thost := flag.String(\"host\", \"\", \"Provide the hostname of the MySQL to connect to\")\n\tpassword := flag.String(\"password\", \"\", \"Provide the password when connecting to the MySQL server\")\n\tport := flag.Int(\"port\", 0, \"Provide the port number of the MySQL to connect to (default: 3306)\") /* Port is deliberately 0 here, defaults to 3306 elsewhere */\n\tsocket := flag.String(\"socket\", \"\", \"Provide the path to the local MySQL server to connect to\")\n\tuser := flag.String(\"user\", \"\", \"Provide the username to connect with to MySQL (default: $USER)\")\n\tuseEnvironment := flag.Bool(\"use-environment\", false, \"Use the environment variable MYSQL_DSN (go dsn) to connect with to MySQL\")\n\n\tflag.Parse()\n\n\treturn connector.Config{\n\t\tDefaultsFile: defaultsFile,\n\t\tHost: host,\n\t\tPassword: password,\n\t\tPort: port,\n\t\tSocket: socket,\n\t\tUser: user,\n\t\tUseEnvironment: useEnvironment,\n\t}\n}", "title": "" }, { "docid": "91dd60ccb153101b3f0a870f6faf049c", "score": "0.5037466", "text": "func createConnector(logger logrus.FieldLogger, connectorType string, connectorConfig ConnectorConfig) (connector.Connector, error) {\n\tvar c connector.Connector\n\n\tif connectorConfig.Type == connectorType {\n\t\t//logger.Info(\"parse connector config: Type: Name == %s:%s\", connectorConfig.Type, connectorConfig.Name)\n\t\tf, ok := PydioConnectorsConfig[connectorType]\n\t\tif !ok {\n\t\t\treturn c, fmt.Errorf(\"unknown connector type %q\", connectorType)\n\t\t}\n\n\t\tconnConfig := f()\n\t\tif connectorConfig.Config != nil {\n\t\t\t//data := []byte(connectorConfig.Config)\n\t\t\tif err := json.Unmarshal(connectorConfig.Config, connConfig); err != nil {\n\t\t\t\tlogger.Errorf(\"parse connector config: %v\", err)\n\t\t\t\treturn c, fmt.Errorf(\"parse connector config: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\tc, err := connConfig.Open(logger)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"failed to create connector %d - %s: %v\", connectorConfig.ID, connectorConfig.Name, err)\n\t\t\treturn c, fmt.Errorf(\"failed to create connector %d - %s: %v\", connectorConfig.ID, connectorConfig.Name, err)\n\t\t}\n\n\t\treturn c, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"unknown connector type %q\", connectorType)\n}", "title": "" }, { "docid": "5617b3a0ddb5d8ca8f53b20b75c2ad89", "score": "0.4954623", "text": "func (o ConnectorProfileConnectorProfileConfigOutput) ConnectorProfileCredentials() ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsOutput {\n\treturn o.ApplyT(func(v ConnectorProfileConnectorProfileConfig) ConnectorProfileConnectorProfileConfigConnectorProfileCredentials {\n\t\treturn v.ConnectorProfileCredentials\n\t}).(ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsOutput)\n}", "title": "" }, { "docid": "468f9cbfdc09b8a2bb16f1764d286a92", "score": "0.494451", "text": "func (r *Reconciler) MakeExternalConnectionParams() *nb.AddExternalConnectionParams {\n\n\tconn := &nb.AddExternalConnectionParams{\n\t\tName: r.BackingStore.Name,\n\t}\n\n\tswitch r.BackingStore.Spec.Type {\n\tcase nbv1.StoreTypeAWSS3:\n\t\tconn.EndpointType = nb.EndpointTypeAws\n\t\tconn.Endpoint = r.BackingStore.Spec.S3Options.Endpoint\n\t\tproto := \"https\"\n\t\tif r.BackingStore.Spec.S3Options.SSLDisabled {\n\t\t\tproto = \"http\"\n\t\t}\n\t\tif conn.Endpoint == \"\" && r.BackingStore.Spec.S3Options.Region != \"\" {\n\t\t\tconn.Endpoint = fmt.Sprintf(\"%s://s3.%s.amazonaws.com\", proto, r.BackingStore.Spec.S3Options.Region)\n\t\t}\n\t\tif conn.Endpoint == \"\" {\n\t\t\tconn.Endpoint = fmt.Sprintf(\"%s://s3.amazonaws.com\", proto)\n\t\t}\n\t\tconn.Identity = r.Secret.StringData[\"AWS_ACCESS_KEY_ID\"]\n\t\tconn.Secret = r.Secret.StringData[\"AWS_SECRET_ACCESS_KEY\"]\n\tcase nbv1.StoreTypeS3Compatible:\n\t\tconn.EndpointType = nb.EndpointTypeS3Compat\n\t\tconn.Endpoint = r.BackingStore.Spec.S3Options.Endpoint\n\t\tconn.Identity = r.Secret.StringData[\"AWS_ACCESS_KEY_ID\"]\n\t\tconn.Secret = r.Secret.StringData[\"AWS_SECRET_ACCESS_KEY\"]\n\t\t// conn.AuthMethod =\n\tcase nbv1.StoreTypeAzureBlob:\n\t\tconn.EndpointType = nb.EndpointTypeAzure\n\t\t// conn.Identity = r.Secret.StringData[\"AWS_ACCESS_KEY_ID\"]\n\t\t// conn.Secret = r.Secret.StringData[\"AWS_SECRET_ACCESS_KEY\"]\n\tcase nbv1.StoreTypeGoogleCloudStorage:\n\t\tconn.EndpointType = nb.EndpointTypeGoogle\n\t\t// conn.Identity = r.Secret.StringData[\"AWS_ACCESS_KEY_ID\"]\n\t\t// conn.Secret = r.Secret.StringData[\"AWS_SECRET_ACCESS_KEY\"]\n\tdefault:\n\t}\n\n\treturn conn\n}", "title": "" }, { "docid": "d2c2a6e6f56a1f7f8a58d9b60fb7dd48", "score": "0.49420586", "text": "func (agsppf ApplicationGatewaySslProfilePropertiesFormat)MarshalJSON() ([]byte, error){\n objectMap := make(map[string]interface{})\n if(agsppf.TrustedClientCertificates != nil) {\n objectMap[\"trustedClientCertificates\"] = agsppf.TrustedClientCertificates\n }\n if(agsppf.SslPolicy != nil) {\n objectMap[\"sslPolicy\"] = agsppf.SslPolicy\n }\n if(agsppf.ClientAuthConfiguration != nil) {\n objectMap[\"clientAuthConfiguration\"] = agsppf.ClientAuthConfiguration\n }\n return json.Marshal(objectMap)\n }", "title": "" }, { "docid": "08e88e3109b60e02ba187bf631459a37", "score": "0.49266982", "text": "func (obConn *outboundConn) Connect(extendedParameters ...interface{}) (err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = r.(error)\n\t\t\tif obConn.err == nil {\n\t\t\t\tobConn.err = err\n\t\t\t}\n\t\t}\n\t}()\n\t// Create connect command\n\tbuf := new(bytes.Buffer)\n\t// Command name\n\t_, err = amf.WriteString(buf, \"connect\")\n\tCheckError(err, \"Connect() Write name: connect\")\n\ttransactionID := obConn.conn.NewTransactionID()\n\tobConn.transactions[transactionID] = \"connect\"\n\t_, err = amf.WriteDouble(buf, float64(transactionID))\n\tCheckError(err, \"Connect() Write transaction ID\")\n\t_, err = amf.WriteObjectMarker(buf)\n\tCheckError(err, \"Connect() Write object marker\")\n\n\t_, err = amf.WriteObjectName(buf, \"app\")\n\tCheckError(err, \"Connect() Write app name\")\n\t_, err = amf.WriteString(buf, obConn.rtmpURL.App())\n\tCheckError(err, \"Connect() Write app value\")\n\n\t_, err = amf.WriteObjectName(buf, \"flashVer\")\n\tCheckError(err, \"Connect() Write flashver name\")\n\t_, err = amf.WriteString(buf, FLASH_PLAYER_VERSION_STRING)\n\tCheckError(err, \"Connect() Write flashver value\")\n\n\t//\t_, err = amf.WriteObjectName(buf, \"swfUrl\")\n\t//\tCheckError(err, \"Connect() Write swfUrl name\")\n\t//\t_, err = amf.WriteString(buf, SWF_URL_STRING)\n\t//\tCheckError(err, \"Connect() Write swfUrl value\")\n\n\t_, err = amf.WriteObjectName(buf, \"tcUrl\")\n\tCheckError(err, \"Connect() Write tcUrl name\")\n\t_, err = amf.WriteString(buf, obConn.url)\n\tCheckError(err, \"Connect() Write tcUrl value\")\n\n\t_, err = amf.WriteObjectName(buf, \"fpad\")\n\tCheckError(err, \"Connect() Write fpad name\")\n\t_, err = amf.WriteBoolean(buf, false)\n\tCheckError(err, \"Connect() Write fpad value\")\n\n\t_, err = amf.WriteObjectName(buf, \"capabilities\")\n\tCheckError(err, \"Connect() Write capabilities name\")\n\t_, err = amf.WriteDouble(buf, DEFAULT_CAPABILITIES)\n\tCheckError(err, \"Connect() Write capabilities value\")\n\n\t_, err = amf.WriteObjectName(buf, \"audioCodecs\")\n\tCheckError(err, \"Connect() Write audioCodecs name\")\n\t_, err = amf.WriteDouble(buf, DEFAULT_AUDIO_CODECS)\n\tCheckError(err, \"Connect() Write audioCodecs value\")\n\n\t_, err = amf.WriteObjectName(buf, \"videoCodecs\")\n\tCheckError(err, \"Connect() Write videoCodecs name\")\n\t_, err = amf.WriteDouble(buf, DEFAULT_VIDEO_CODECS)\n\tCheckError(err, \"Connect() Write videoCodecs value\")\n\n\t_, err = amf.WriteObjectName(buf, \"videoFunction\")\n\tCheckError(err, \"Connect() Write videoFunction name\")\n\t_, err = amf.WriteDouble(buf, float64(1))\n\tCheckError(err, \"Connect() Write videoFunction value\")\n\n\t//\t_, err = amf.WriteObjectName(buf, \"pageUrl\")\n\t//\tCheckError(err, \"Connect() Write pageUrl name\")\n\t//\t_, err = amf.WriteString(buf, PAGE_URL_STRING)\n\t//\tCheckError(err, \"Connect() Write pageUrl value\")\n\n\t//_, err = amf.WriteObjectName(buf, \"objectEncoding\")\n\t//CheckError(err, \"Connect() Write objectEncoding name\")\n\t//_, err = amf.WriteDouble(buf, float64(amf.AMF0))\n\t//CheckError(err, \"Connect() Write objectEncoding value\")\n\n\t_, err = amf.WriteObjectEndMarker(buf)\n\tCheckError(err, \"Connect() Write ObjectEndMarker\")\n\n\t// extended parameters\n\tfor _, param := range extendedParameters {\n\t\t_, err = amf.WriteValue(buf, param)\n\t\tCheckError(err, \"Connect() Write extended parameters\")\n\t}\n\tconnectMessage := &Message{\n\t\tChunkStreamID: CS_ID_COMMAND,\n\t\tType: COMMAND_AMF0,\n\t\tSize: uint32(buf.Len()),\n\t\tBuf: buf,\n\t}\n\tconnectMessage.Dump(\"connect\")\n\tobConn.status = OUTBOUND_CONN_STATUS_CONNECT\n\treturn obConn.conn.Send(connectMessage)\n}", "title": "" }, { "docid": "c2a2f1b178ca6948e0b1a14106709bc7", "score": "0.4921956", "text": "func Initialize(robot bot.Handler, l *log.Logger) bot.Connector {\n\tvar c config\n\n\terr := robot.GetProtocolConfig(&c)\n\tif err != nil {\n\t\trobot.Log(bot.Fatal, fmt.Errorf(\"Unable to retrieve protocol configuration: %v\", err))\n\t}\n\n\tfor i, u := range c.Users {\n\t\tuserMap[u.Name] = i\n\t}\n\n\ttc := &TestConnector{\n\t\tbotName: c.BotName,\n\t\tbotFullName: c.BotFullName,\n\t\tbotID: \"deadbeef\", // yes - hex in a string\n\t\tusers: c.Users,\n\t\tchannels: c.Channels,\n\t\tlistener: make(chan *TestMessage),\n\t\tspeaking: make(chan *TestMessage),\n\t}\n\n\ttc.Handler = robot\n\ttc.SetFullName(tc.botFullName)\n\ttc.Log(bot.Debug, \"Set bot full name to\", tc.botFullName)\n\ttc.SetName(tc.botName)\n\ttc.Log(bot.Info, \"Set bot name to\", tc.botName)\n\n\treturn bot.Connector(tc)\n}", "title": "" }, { "docid": "6d8d9df83e3c50e34ddec22373869033", "score": "0.48981538", "text": "func (kcc Client) Read(connector string) (*Response, error) {\n\tvar config map[string]string\n\tif govalidator.IsDNSName(connector) {\n\t\tstatus, body, err := kcc.httpClient.Get(\"/connectors/\" + connector + \"/config\")\n\n\t\tif err != nil {\n\t\t\treturn &Response{Result: \"error\"}, fmt.Errorf(\"Error executing Read on Kafka Connect: %s\", err.Error())\n\t\t}\n\n\t\tswitch status {\n\t\tcase 200:\n\t\t\terr := json.Unmarshal(*body, &config)\n\t\t\tif err == nil {\n\t\t\t\tresponse := new(Response)\n\t\t\t\tresponse.Result = \"success\"\n\t\t\t\tresponse.Payload = config\n\t\t\t\treturn response, nil\n\t\t\t}\n\t\t\treturn &Response{Result: \"error\"}, errors.New(\"Failed to deserialize Kafka Connect response\")\n\t\tdefault:\n\t\t\treturn HandleNonOKResponse(status, body)\n\t\t}\n\t}\n\treturn nil, errors.New(\"Malformed connector name\")\n}", "title": "" }, { "docid": "433cb4d04660cd57b197558059b253df", "score": "0.4893987", "text": "func (o FlowSourceFlowConfigOutput) ConnectorProfileName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FlowSourceFlowConfig) *string { return v.ConnectorProfileName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b510284f1600134da825551f8ba355a0", "score": "0.48888472", "text": "func (p *Provider) getExtraConf(labels map[string]string) (configuration, error) {\n\tconf := configuration{\n\t\tEnable: p.ExposedByDefault,\n\t\tConsulCatalog: specificConfiguration{Connect: p.ConnectByDefault},\n\t}\n\n\terr := label.Decode(labels, &conf, \"traefik.consulcatalog.\", \"traefik.enable\")\n\tif err != nil {\n\t\treturn configuration{}, err\n\t}\n\n\treturn conf, nil\n}", "title": "" }, { "docid": "bc16b0627cbb80d97f19a60ff30e6223", "score": "0.48424056", "text": "func ReadProps() {\n\tif u, err := user.Current(); err == nil {\n\t\tpath := filepath.Join(u.HomeDir, \".mr.wilson.json\")\n\t\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\t\tconfig.HTTPPort = 1212\n\t\t\tconfig.WitAccessToken = \"enter wit access token here.\"\n\t\t\tconfig.DBPath = \"/path/to/csv/file/\"\n\t\t\tsampleConfig, _ := json.MarshalIndent(config, \"\", \" \")\n\t\t\tioutil.WriteFile(path, sampleConfig, os.FileMode(int(0400)))\n\t\t\tfmt.Printf(\"Created a sample config file: %s\\nPlease update it with your information.\\n\", path)\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\tcontent, err := ioutil.ReadFile(path)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error reading props file, got: %v\\n\", err)\n\t\t}\n\n\t\terr = json.Unmarshal(content, &config)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Invalid Props file, got: %v\\n\", err)\n\t\t}\n\n\t\t// Strip trailing slashes from DB path.\n\t\tfor len(config.DBPath) > 0 && os.IsPathSeparator(config.DBPath[len(config.DBPath)-1]) {\n\t\t\tconfig.DBPath = config.DBPath[0 : len(config.DBPath)-1]\n\t\t}\n\t\t// Strip trailing slashes from let's encrypt cache path.\n\t\tfor len(config.LECacheFilePath) > 0 && os.IsPathSeparator(config.LECacheFilePath[len(config.LECacheFilePath)-1]) {\n\t\t\tconfig.LECacheFilePath = config.LECacheFilePath[0 : len(config.LECacheFilePath)-1]\n\t\t}\n\t\tif m := os.Getenv(\"RUNMODE\"); m == \"production\" {\n\t\t\tmode = production\n\t\t}\n\t\tlog.Printf(\"Running in %s mode.\\n\", mode)\n\t}\n}", "title": "" }, { "docid": "fbc915fdbaeb25d612673ec8ca9823cc", "score": "0.48200434", "text": "func (plscp PrivateLinkServiceConnectionProperties)MarshalJSON() ([]byte, error){\n objectMap := make(map[string]interface{})\n if(plscp.PrivateLinkServiceID != nil) {\n objectMap[\"privateLinkServiceId\"] = plscp.PrivateLinkServiceID\n }\n if(plscp.GroupIds != nil) {\n objectMap[\"groupIds\"] = plscp.GroupIds\n }\n if(plscp.RequestMessage != nil) {\n objectMap[\"requestMessage\"] = plscp.RequestMessage\n }\n if(plscp.PrivateLinkServiceConnectionState != nil) {\n objectMap[\"privateLinkServiceConnectionState\"] = plscp.PrivateLinkServiceConnectionState\n }\n return json.Marshal(objectMap)\n }", "title": "" }, { "docid": "571de568a3ff0abd3a751ae04823360b", "score": "0.48163614", "text": "func (cli *VanClient) ConnectorInspect(ctx context.Context, name string) (*types.LinkStatus, error) {\n\tcurrent, err := cli.getRouterConfig(ctx, \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsecret, err := cli.KubeClient.CoreV1().Secrets(cli.Namespace).Get(ctx, name, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconnections, _ := kubeqdr.GetConnections(cli.Namespace, cli.KubeClient, cli.RestConfig)\n\tlink := qdr.GetLinkStatus(secret, current.IsEdge(), connections)\n\treturn &link, nil\n}", "title": "" }, { "docid": "14f8cbb299cb42b16b32bed83a57ad74", "score": "0.48109156", "text": "func (o FlowSourceFlowConfigSourceConnectorPropertiesOutput) CustomConnector() FlowSourceFlowConfigSourceConnectorPropertiesCustomConnectorPtrOutput {\n\treturn o.ApplyT(func(v FlowSourceFlowConfigSourceConnectorProperties) *FlowSourceFlowConfigSourceConnectorPropertiesCustomConnector {\n\t\treturn v.CustomConnector\n\t}).(FlowSourceFlowConfigSourceConnectorPropertiesCustomConnectorPtrOutput)\n}", "title": "" }, { "docid": "d09bfcf5745e8de5f9ad5c1bfff997ec", "score": "0.48049748", "text": "func (o ConnectorProfileConnectorProfileConfigPtrOutput) ConnectorProfileCredentials() ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsPtrOutput {\n\treturn o.ApplyT(func(v *ConnectorProfileConnectorProfileConfig) *ConnectorProfileConnectorProfileConfigConnectorProfileCredentials {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ConnectorProfileCredentials\n\t}).(ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsPtrOutput)\n}", "title": "" }, { "docid": "ec310860e7ce9f71e88849905729893b", "score": "0.48016655", "text": "func (c Config) PropsURL() string {\n\treturn c.propsURL\n}", "title": "" }, { "docid": "3a4ca4be53eb6d9e8bdb417d610704a4", "score": "0.47819632", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesCustomConnectorPtrOutput) ProfileProperties() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesCustomConnector) map[string]string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ProfileProperties\n\t}).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "1e827357372a810297394da2e2c02441", "score": "0.47476503", "text": "func (client *clientConn) Connect(extendedParameters ...interface{}) (err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = r.(error)\n\t\t\tif client.err == nil {\n\t\t\t\tclient.err = err\n\t\t\t}\n\t\t}\n\t}()\n\t// Create connect command\n\tbuf := new(bytes.Buffer)\n\t// Command name\n\t_, err = amf.WriteString(buf, \"connect\")\n\tCheckError(err, \"Connect() Write name: connect\")\n\ttransactionID := client.conn.NewTransactionID()\n\tclient.transactions[transactionID] = \"connect\"\n\t_, err = amf.WriteDouble(buf, float64(transactionID))\n\tCheckError(err, \"Connect() Write transaction ID\")\n\t_, err = amf.WriteObjectMarker(buf)\n\tCheckError(err, \"Connect() Write object marker\")\n\n\t_, err = amf.WriteObjectName(buf, \"app\")\n\tCheckError(err, \"Connect() Write app name\")\n\t_, err = amf.WriteString(buf, client.rtmpURL.App())\n\tCheckError(err, \"Connect() Write app value\")\n\n\t_, err = amf.WriteObjectName(buf, \"flashVer\")\n\tCheckError(err, \"Connect() Write flashver name\")\n\t_, err = amf.WriteString(buf, FLASH_PLAYER_VERSION_STRING)\n\tCheckError(err, \"Connect() Write flashver value\")\n\n\t//\t_, err = amf.WriteObjectName(buf, \"swfUrl\")\n\t//\tCheckError(err, \"Connect() Write swfUrl name\")\n\t//\t_, err = amf.WriteString(buf, SWF_URL_STRING)\n\t//\tCheckError(err, \"Connect() Write swfUrl value\")\n\n\t_, err = amf.WriteObjectName(buf, \"tcUrl\")\n\tCheckError(err, \"Connect() Write tcUrl name\")\n\t_, err = amf.WriteString(buf, client.url)\n\tCheckError(err, \"Connect() Write tcUrl value\")\n\n\t_, err = amf.WriteObjectName(buf, \"fpad\")\n\tCheckError(err, \"Connect() Write fpad name\")\n\t_, err = amf.WriteBoolean(buf, false)\n\tCheckError(err, \"Connect() Write fpad value\")\n\n\t_, err = amf.WriteObjectName(buf, \"capabilities\")\n\tCheckError(err, \"Connect() Write capabilities name\")\n\t_, err = amf.WriteDouble(buf, DEFAULT_CAPABILITIES)\n\tCheckError(err, \"Connect() Write capabilities value\")\n\n\t_, err = amf.WriteObjectName(buf, \"audioCodecs\")\n\tCheckError(err, \"Connect() Write audioCodecs name\")\n\t_, err = amf.WriteDouble(buf, DEFAULT_AUDIO_CODECS)\n\tCheckError(err, \"Connect() Write audioCodecs value\")\n\n\t_, err = amf.WriteObjectName(buf, \"videoCodecs\")\n\tCheckError(err, \"Connect() Write videoCodecs name\")\n\t_, err = amf.WriteDouble(buf, DEFAULT_VIDEO_CODECS)\n\tCheckError(err, \"Connect() Write videoCodecs value\")\n\n\t_, err = amf.WriteObjectName(buf, \"videoFunction\")\n\tCheckError(err, \"Connect() Write videoFunction name\")\n\t_, err = amf.WriteDouble(buf, float64(1))\n\tCheckError(err, \"Connect() Write videoFunction value\")\n\n\t//\t_, err = amf.WriteObjectName(buf, \"pageUrl\")\n\t//\tCheckError(err, \"Connect() Write pageUrl name\")\n\t//\t_, err = amf.WriteString(buf, PAGE_URL_STRING)\n\t//\tCheckError(err, \"Connect() Write pageUrl value\")\n\n\t//_, err = amf.WriteObjectName(buf, \"objectEncoding\")\n\t//CheckError(err, \"Connect() Write objectEncoding name\")\n\t//_, err = amf.WriteDouble(buf, float64(amf.AMF0))\n\t//CheckError(err, \"Connect() Write objectEncoding value\")\n\n\t_, err = amf.WriteObjectEndMarker(buf)\n\tCheckError(err, \"Connect() Write ObjectEndMarker\")\n\n\t// extended parameters\n\tfor _, param := range extendedParameters {\n\t\t_, err = amf.WriteValue(buf, param)\n\t\tCheckError(err, \"Connect() Write extended parameters\")\n\t}\n\tconnectMessage := &Message{\n\t\tChunkStreamID: CS_ID_COMMAND,\n\t\tType: COMMAND_AMF0,\n\t\tSize: uint32(buf.Len()),\n\t\tBuf: buf,\n\t}\n\tconnectMessage.LogDump(\"connect\")\n\tclient.status = CLIENT_CONN_STATUS_CONNECT\n\treturn client.conn.Send(connectMessage)\n}", "title": "" }, { "docid": "feb3b791416a2b54a30f756d3ff5c812", "score": "0.47471586", "text": "func (o FlowSourceFlowConfigSourceConnectorPropertiesCustomConnectorPtrOutput) CustomProperties() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *FlowSourceFlowConfigSourceConnectorPropertiesCustomConnector) map[string]string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.CustomProperties\n\t}).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "36c96d2a5218ce543b10ca24e80daf80", "score": "0.47470704", "text": "func (kcc Client) Update(connector Connector) (*Response, error) {\n\tif govalidator.IsDNSName(connector.Name) {\n\t\tstatus, body, err := kcc.httpClient.Get(\"/connectors/\" + connector.Name)\n\n\t\tif err != nil {\n\t\t\treturn &Response{Result: \"error\"}, fmt.Errorf(\"Error executing Update on Kafka Connect: %s\", err.Error())\n\t\t}\n\n\t\tif status != 200 {\n\t\t\treturn HandleNonOKResponse(status, body)\n\t\t}\n\n\t\tconfigBytes, err := json.Marshal(connector.Config)\n\n\t\tif err != nil {\n\t\t\treturn &Response{Result: \"error\"}, errors.New(\"Failed to serialize connector configuration\")\n\t\t}\n\n\t\tstatus, body, err = kcc.httpClient.Put(\"/connectors/\"+connector.Name+\"/config\", configBytes)\n\n\t\tif err != nil {\n\t\t\treturn &Response{Result: \"error\"}, fmt.Errorf(\"Error executing Update on Kafka Connect: %s\", err.Error())\n\t\t}\n\n\t\tswitch status {\n\t\tcase 200:\n\t\t\tvar connector Connector\n\t\t\terr := json.Unmarshal(*body, &connector)\n\t\t\tif err == nil {\n\t\t\t\tresponse := new(Response)\n\t\t\t\tresponse.Result = \"success\"\n\t\t\t\tresponse.Payload = connector\n\t\t\t\treturn response, nil\n\t\t\t}\n\t\t\treturn &Response{Result: \"error\"}, errors.New(\"Failed to deserialize Kafka Connect response\")\n\t\tdefault:\n\t\t\treturn HandleNonOKResponse(status, body)\n\t\t}\n\t}\n\treturn nil, errors.New(\"Malformed connector name\")\n}", "title": "" }, { "docid": "906df0cf1e9c1f95251c23883c7e91dc", "score": "0.47209126", "text": "func (o FlowDestinationFlowConfigOutput) ConnectorProfileName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FlowDestinationFlowConfig) *string { return v.ConnectorProfileName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c19fbfbafb51be36096366221a596a32", "score": "0.47184893", "text": "func (conn *clientConn) Connect(extendedParameters ...interface{}) (err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = r.(error)\n\t\t\tif conn.err == nil {\n\t\t\t\tconn.err = err\n\t\t\t}\n\t\t}\n\t}()\n\t// Create connect command\n\tbuf := new(bytes.Buffer)\n\t// Command name\n\t_, err = amf.WriteString(buf, \"connect\")\n\tCheckError(err, \"Connect() Write name: connect\")\n\ttransactionID := conn.conn.NewTransactionID()\n\tconn.transactions[transactionID] = \"connect\"\n\t_, err = amf.WriteDouble(buf, float64(transactionID))\n\tCheckError(err, \"Connect() Write transaction ID\")\n\t_, err = amf.WriteObjectMarker(buf)\n\tCheckError(err, \"Connect() Write object marker\")\n\n\t_, err = amf.WriteObjectName(buf, \"app\")\n\tCheckError(err, \"Connect() Write app name\")\n\t_, err = amf.WriteString(buf, conn.rtmpURL.App())\n\tCheckError(err, \"Connect() Write app value\")\n\n\t_, err = amf.WriteObjectName(buf, \"flashVer\")\n\tCheckError(err, \"Connect() Write flashver name\")\n\t_, err = amf.WriteString(buf, FLASH_PLAYER_VERSION_STRING)\n\tCheckError(err, \"Connect() Write flashver value\")\n\n\t_, err = amf.WriteObjectName(buf, \"tcUrl\")\n\tCheckError(err, \"Connect() Write tcUrl name\")\n\t_, err = amf.WriteString(buf, conn.url)\n\tCheckError(err, \"Connect() Write tcUrl value\")\n\n\t_, err = amf.WriteObjectName(buf, \"fpad\")\n\tCheckError(err, \"Connect() Write fpad name\")\n\t_, err = amf.WriteBoolean(buf, false)\n\tCheckError(err, \"Connect() Write fpad value\")\n\n\t_, err = amf.WriteObjectName(buf, \"capabilities\")\n\tCheckError(err, \"Connect() Write capabilities name\")\n\t_, err = amf.WriteDouble(buf, DEFAULT_CAPABILITIES)\n\tCheckError(err, \"Connect() Write capabilities value\")\n\n\t_, err = amf.WriteObjectName(buf, \"audioCodecs\")\n\tCheckError(err, \"Connect() Write audioCodecs name\")\n\t_, err = amf.WriteDouble(buf, DEFAULT_AUDIO_CODECS)\n\tCheckError(err, \"Connect() Write audioCodecs value\")\n\n\t_, err = amf.WriteObjectName(buf, \"videoCodecs\")\n\tCheckError(err, \"Connect() Write videoCodecs name\")\n\t_, err = amf.WriteDouble(buf, DEFAULT_VIDEO_CODECS)\n\tCheckError(err, \"Connect() Write videoCodecs value\")\n\n\t_, err = amf.WriteObjectName(buf, \"videoFunction\")\n\tCheckError(err, \"Connect() Write videoFunction name\")\n\t_, err = amf.WriteDouble(buf, float64(1))\n\tCheckError(err, \"Connect() Write videoFunction value\")\n\n\t_, err = amf.WriteObjectEndMarker(buf)\n\tCheckError(err, \"Connect() Write ObjectEndMarker\")\n\n\t// extended parameters\n\tfor _, param := range extendedParameters {\n\t\t_, err = amf.WriteValue(buf, param)\n\t\tCheckError(err, \"Connect() Write extended parameters\")\n\t}\n\tconnectMessage := &Message{\n\t\tChunkStreamID: CS_ID_COMMAND,\n\t\tType: COMMAND_AMF0,\n\t\tSize: uint32(buf.Len()),\n\t\tBuf: buf,\n\t}\n\tconnectMessage.Dump(\"connect\")\n\tconn.status = ConnectionStatusConnect\n\treturn conn.conn.Send(connectMessage)\n}", "title": "" }, { "docid": "43642b73e25ddb26a2e29a26def8e2e8", "score": "0.47140336", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesCustomConnectorOutput) ProfileProperties() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesCustomConnector) map[string]string {\n\t\treturn v.ProfileProperties\n\t}).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "2fb9e65bc450e1a101f184efc0458ed7", "score": "0.46946082", "text": "func (o FlowSourceFlowConfigOutput) SourceConnectorProperties() FlowSourceFlowConfigSourceConnectorPropertiesOutput {\n\treturn o.ApplyT(func(v FlowSourceFlowConfig) FlowSourceFlowConfigSourceConnectorProperties {\n\t\treturn v.SourceConnectorProperties\n\t}).(FlowSourceFlowConfigSourceConnectorPropertiesOutput)\n}", "title": "" }, { "docid": "c88032f11dc32679538ac9ea1861d070", "score": "0.46816766", "text": "func (o FlowSourceFlowConfigSourceConnectorPropertiesPtrOutput) CustomConnector() FlowSourceFlowConfigSourceConnectorPropertiesCustomConnectorPtrOutput {\n\treturn o.ApplyT(func(v *FlowSourceFlowConfigSourceConnectorProperties) *FlowSourceFlowConfigSourceConnectorPropertiesCustomConnector {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.CustomConnector\n\t}).(FlowSourceFlowConfigSourceConnectorPropertiesCustomConnectorPtrOutput)\n}", "title": "" }, { "docid": "1dcdc93d4a5dad94fef553279e138eea", "score": "0.4672069", "text": "func (cs *ConnectorSetting) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar connectorSettingProperties ConnectorSettingProperties\n\t\t\t\terr = json.Unmarshal(*v, &connectorSettingProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcs.ConnectorSettingProperties = &connectorSettingProperties\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcs.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcs.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcs.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ca80a79cdd49410d05011ebc787fb608", "score": "0.4662104", "text": "func (pecp PrivateEndpointConnectionProperties)MarshalJSON() ([]byte, error){\n objectMap := make(map[string]interface{})\n if(pecp.PrivateLinkServiceConnectionState != nil) {\n objectMap[\"privateLinkServiceConnectionState\"] = pecp.PrivateLinkServiceConnectionState\n }\n return json.Marshal(objectMap)\n }", "title": "" }, { "docid": "3046456f9c168cd7d2a6edd75c8af8d2", "score": "0.4656153", "text": "func (c Connector) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif c.ConnectorID != nil {\n\t\tobjectMap[\"connectorId\"] = c.ConnectorID\n\t}\n\tif c.ConnectorName != nil {\n\t\tobjectMap[\"connectorName\"] = c.ConnectorName\n\t}\n\tif c.ConnectorType != \"\" {\n\t\tobjectMap[\"connectorType\"] = c.ConnectorType\n\t}\n\tif c.DisplayName != nil {\n\t\tobjectMap[\"displayName\"] = c.DisplayName\n\t}\n\tif c.Description != nil {\n\t\tobjectMap[\"description\"] = c.Description\n\t}\n\tif c.ConnectorProperties != nil {\n\t\tobjectMap[\"connectorProperties\"] = c.ConnectorProperties\n\t}\n\tif c.Created != nil {\n\t\tobjectMap[\"created\"] = c.Created\n\t}\n\tif c.LastModified != nil {\n\t\tobjectMap[\"lastModified\"] = c.LastModified\n\t}\n\tif c.State != \"\" {\n\t\tobjectMap[\"state\"] = c.State\n\t}\n\tif c.TenantID != nil {\n\t\tobjectMap[\"tenantId\"] = c.TenantID\n\t}\n\tif c.IsInternal != nil {\n\t\tobjectMap[\"isInternal\"] = c.IsInternal\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "076f55e3f7400127d7b87b7d1955aeb7", "score": "0.46427885", "text": "func baseRemoteReadConfig(host string) *config.RemoteReadConfig {\n\tcfg := config.DefaultRemoteReadConfig\n\tcfg.URL = &common_config.URL{\n\t\tURL: &url.URL{\n\t\t\tHost: host,\n\t\t},\n\t}\n\treturn &cfg\n}", "title": "" }, { "docid": "91d72a77a35a6760d6cdd1e7baf1fca4", "score": "0.46384123", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesOutput) CustomConnector() ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesCustomConnectorPtrOutput {\n\treturn o.ApplyT(func(v ConnectorProfileConnectorProfileConfigConnectorProfileProperties) *ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesCustomConnector {\n\t\treturn v.CustomConnector\n\t}).(ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesCustomConnectorPtrOutput)\n}", "title": "" }, { "docid": "f7fbffbe644222726e3b3f9c6d0123d2", "score": "0.4629018", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorBasicOutput) Password() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorBasic) string {\n\t\treturn v.Password\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "268962c688569b2364168cda029075a0", "score": "0.46258202", "text": "func (d *SshConnector) connect(login_profile LoginProfile) (err error) {\n\tlog.Infof(\"SshConnector.connect profile: %+v\", login_profile)\n\td.connected = true\n\treturn\n}", "title": "" }, { "docid": "462e8cc4d19752d146168d20f6dbc768", "score": "0.46253523", "text": "func (o FlowSourceFlowConfigPtrOutput) SourceConnectorProperties() FlowSourceFlowConfigSourceConnectorPropertiesPtrOutput {\n\treturn o.ApplyT(func(v *FlowSourceFlowConfig) *FlowSourceFlowConfigSourceConnectorProperties {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.SourceConnectorProperties\n\t}).(FlowSourceFlowConfigSourceConnectorPropertiesPtrOutput)\n}", "title": "" }, { "docid": "f4c59785cc06c801e1b06a7441f2c768", "score": "0.46200752", "text": "func Initialize(handler robot.Handler, l *log.Logger) robot.Connector {\n\tvar c config\n\n\terr := handler.GetProtocolConfig(&c)\n\tif err != nil {\n\t\thandler.Log(robot.Fatal, \"Unable to retrieve protocol configuration: %v\", err)\n\t}\n\n\tfor i, u := range c.Users {\n\t\tuserIDMap[u.InternalID] = i\n\t\tuserMap[u.Name] = i\n\t}\n\n\tExportTest.Lock()\n\tt := ExportTest.Test\n\tExportTest.Unlock()\n\n\ttc := &TestConnector{\n\t\tbotName: c.BotName,\n\t\tbotFullName: c.BotFullName,\n\t\tbotID: \"deadbeef\", // yes - hex in a string\n\t\tusers: c.Users,\n\t\tchannels: c.Channels,\n\t\tlistener: make(chan *TestMessage),\n\t\tspeaking: make(chan *TestMessage),\n\t\ttest: t,\n\t}\n\n\ttc.Handler = handler\n\ttc.SetBotID(tc.botID)\n\ttc.Log(robot.Info, \"Set bot ID to\", tc.botID)\n\n\treturn robot.Connector(tc)\n}", "title": "" }, { "docid": "2b09b3eabfd26c8eb523813cbb77f1d8", "score": "0.4619286", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorBasicPtrOutput) Password() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorBasic) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Password\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "13e1160f78176a99a02d233c2e997e28", "score": "0.4613048", "text": "func (o MySqlConnectionProfileOutput) Ssl() SslConfigPtrOutput {\n\treturn o.ApplyT(func(v MySqlConnectionProfile) *SslConfig { return v.Ssl }).(SslConfigPtrOutput)\n}", "title": "" }, { "docid": "c9983f0ac2ecebc9d7d424ed64139ef9", "score": "0.4607192", "text": "func (m *CertificateConnectorSetting) GetConnectorVersion()(*string) {\n val, err := m.GetBackingStore().Get(\"connectorVersion\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "14c5b4a9c227519d17972556c25aeb09", "score": "0.46061513", "text": "func (o FlowSourceFlowConfigSourceConnectorPropertiesCustomConnectorOutput) CustomProperties() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v FlowSourceFlowConfigSourceConnectorPropertiesCustomConnector) map[string]string {\n\t\treturn v.CustomProperties\n\t}).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "e7dc4aaf22091e7d1acb08fd72ee4489", "score": "0.46058846", "text": "func (o FlowSourceFlowConfigPtrOutput) ConnectorProfileName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FlowSourceFlowConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ConnectorProfileName\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8017a9074bf291286fe9f6ec309d34e6", "score": "0.4587963", "text": "func (o MySqlConnectionProfilePtrOutput) Ssl() SslConfigPtrOutput {\n\treturn o.ApplyT(func(v *MySqlConnectionProfile) *SslConfig {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Ssl\n\t}).(SslConfigPtrOutput)\n}", "title": "" }, { "docid": "2f8528e86f6260c6efaaf860062a9a57", "score": "0.45817402", "text": "func (this ActivityStreamsMention) GetUnknownProperties() map[string]interface{} {\n\treturn this.unknown\n}", "title": "" }, { "docid": "98cf0118da7899b9ada75ba0b9c12dc5", "score": "0.4579205", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSapoDataOutput) OauthProperties() ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSapoDataOauthPropertiesPtrOutput {\n\treturn o.ApplyT(func(v ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSapoData) *ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSapoDataOauthProperties {\n\t\treturn v.OauthProperties\n\t}).(ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSapoDataOauthPropertiesPtrOutput)\n}", "title": "" }, { "docid": "09b2b42865ff2b65682b55fc9884db15", "score": "0.45727947", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorOutput) Basic() ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorBasicPtrOutput {\n\treturn o.ApplyT(func(v ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnector) *ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorBasic {\n\t\treturn v.Basic\n\t}).(ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorBasicPtrOutput)\n}", "title": "" }, { "docid": "db9d7a9ddbf3d21fd30368c11958515d", "score": "0.45628607", "text": "func NewCertificateConnectorSetting()(*CertificateConnectorSetting) {\n m := &CertificateConnectorSetting{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "e589f6a29338d7b1297d66121841f66f", "score": "0.4558252", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsOutput) CustomConnector() ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorPtrOutput {\n\treturn o.ApplyT(func(v ConnectorProfileConnectorProfileConfigConnectorProfileCredentials) *ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnector {\n\t\treturn v.CustomConnector\n\t}).(ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorPtrOutput)\n}", "title": "" }, { "docid": "33ff7b260e8e9f5a0b613cfae1372bd9", "score": "0.45542806", "text": "func (me *CONFIGURATION_IMPL) BasicAuthPassword() string{\r\n return me.basicauthpassword\r\n}", "title": "" }, { "docid": "c649bdd1b6f590793bba667b9e171459", "score": "0.45502734", "text": "func (config *Config) SSHOAuthClient() string {\n\treturn config.ConfigFile.SSHOAuthClient\n}", "title": "" }, { "docid": "09cff1eaad04381c6553650cdf65cf03", "score": "0.4533214", "text": "func (plsc *PrivateLinkServiceConnection) UnmarshalJSON(body []byte) error {\n var m map[string]*json.RawMessage\n err := json.Unmarshal(body, &m)\n if err != nil {\n return err\n }\n for k, v := range m {\n switch k {\n case \"properties\":\n if v != nil {\n var privateLinkServiceConnectionProperties PrivateLinkServiceConnectionProperties\n err = json.Unmarshal(*v, &privateLinkServiceConnectionProperties)\n if err != nil {\n return err\n }\n plsc.PrivateLinkServiceConnectionProperties = &privateLinkServiceConnectionProperties\n }\n case \"name\":\n if v != nil {\n var name string\n err = json.Unmarshal(*v, &name)\n if err != nil {\n return err\n }\n plsc.Name = &name\n }\n case \"type\":\n if v != nil {\n var typeVar string\n err = json.Unmarshal(*v, &typeVar)\n if err != nil {\n return err\n }\n plsc.Type = &typeVar\n }\n case \"etag\":\n if v != nil {\n var etag string\n err = json.Unmarshal(*v, &etag)\n if err != nil {\n return err\n }\n plsc.Etag = &etag\n }\n case \"id\":\n if v != nil {\n var ID string\n err = json.Unmarshal(*v, &ID)\n if err != nil {\n return err\n }\n plsc.ID = &ID\n }\n }\n }\n\n return nil\n }", "title": "" }, { "docid": "d8ee7b4a61bde7c4a94d7834ae8156ca", "score": "0.45298094", "text": "func (agpecp ApplicationGatewayPrivateEndpointConnectionProperties)MarshalJSON() ([]byte, error){\n objectMap := make(map[string]interface{})\n if(agpecp.PrivateLinkServiceConnectionState != nil) {\n objectMap[\"privateLinkServiceConnectionState\"] = agpecp.PrivateLinkServiceConnectionState\n }\n return json.Marshal(objectMap)\n }", "title": "" }, { "docid": "e2614b880e1abd796901f07e3363db88", "score": "0.45081317", "text": "func (o FlowDestinationFlowConfigDestinationConnectorPropertiesCustomConnectorPtrOutput) CustomProperties() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *FlowDestinationFlowConfigDestinationConnectorPropertiesCustomConnector) map[string]string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.CustomProperties\n\t}).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "21be9635945ba35d82b1be9fec3ed082", "score": "0.45071116", "text": "func Test_Conf(t *testing.T){\n\troot, _ := Read(\"E:/go/src/flex/conf/login.info\")\n\t//_, err := Read(\"E:/go/src/flex/conf/login.info\")\n\t\n\tfmt.Println(root.GetValue(\"md5key\"))\n\taccounts := root.GetConf(\"accounts_db\")\n\tfmt.Printf(\"db:%s\\n\", accounts.GetValue(\"connection_string\"))\n\tconf2 := root.GetConf(\"login\")\n\tif conf2 != nil {\n\t\tconfs3 := conf2.GetConf(\"listen\")\n\t\tif confs3 != nil {\n\t\t\t//fmt.Println(confs3.GetConf(\"\"))\n\t\t\tfmt.Printf(\"address:%s\\n\", confs3.GetConf(\"\").GetValue(\"port\"))\n\t\t\tfmt.Printf(\"address:%s\\n\", confs3.GetConfs(\"\")[1].GetValue(\"port\"))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "39b7e8f47c8a20f1efb3d9b55bd4a7ca", "score": "0.45065925", "text": "func (o FlowDestinationFlowConfigDestinationConnectorPropertiesOutput) CustomConnector() FlowDestinationFlowConfigDestinationConnectorPropertiesCustomConnectorPtrOutput {\n\treturn o.ApplyT(func(v FlowDestinationFlowConfigDestinationConnectorProperties) *FlowDestinationFlowConfigDestinationConnectorPropertiesCustomConnector {\n\t\treturn v.CustomConnector\n\t}).(FlowDestinationFlowConfigDestinationConnectorPropertiesCustomConnectorPtrOutput)\n}", "title": "" }, { "docid": "4512d946e1bc97356fb3a3f92d7f331e", "score": "0.45064452", "text": "func (ctx *Ctx) Properties() map[string]string {\n\tp := make(map[string]string)\n\n\tp[\"ContentType\"] = ctx.data.ContentType\n\tp[\"ContentEncoding\"] = ctx.data.ContentEncoding\n\t//p[\"DeliveryMode\"] = ctx.data.DeliveryMode\n\t//p[\"Priority\"] = ctx.data.Priority\n\tp[\"CorrelationId\"] = ctx.data.CorrelationId\n\tp[\"ReplyTo\"] = ctx.data.ReplyTo\n\tp[\"Expiration\"] = ctx.data.Expiration\n\tp[\"MessageId\"] = ctx.data.MessageId\n\t//p[\"Timestamp\"] = ctx.data.Timestamp\n\tp[\"Type\"] = ctx.data.Type\n\tp[\"UserId\"] = ctx.data.UserId\n\tp[\"AppId\"] = ctx.data.AppId\n\n\treturn p\n}", "title": "" }, { "docid": "056e3d3d5fa2335c4e9db36297d3f4c6", "score": "0.45048672", "text": "func (me *CONFIGURATION_IMPL) BasicAuthUserName() string{\r\n return me.basicauthusername\r\n}", "title": "" }, { "docid": "d30dce75b29e6cf232e302ffaa292b3d", "score": "0.45024607", "text": "func (*Settings_ConsulUpstreamDiscoveryConfiguration) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_settings_proto_rawDescGZIP(), []int{0, 12}\n}", "title": "" }, { "docid": "bf818c7c8036704731be95ac97814335", "score": "0.4499698", "text": "func (o MicrosoftGraphAndroidWorkProfileGeneralDeviceConfiguration) MarshalJSON() ([]byte, error) {\n\ttoSerialize := map[string]interface{}{}\n\tif o.Id != nil {\n\t\ttoSerialize[\"id\"] = o.Id\n\t}\n\tif o.LastModifiedDateTime != nil {\n\t\ttoSerialize[\"lastModifiedDateTime\"] = o.LastModifiedDateTime\n\t}\n\tif o.CreatedDateTime != nil {\n\t\ttoSerialize[\"createdDateTime\"] = o.CreatedDateTime\n\t}\n\tif o.Description == nil {\n\t\tif o.isExplicitNullDescription {\n\t\t\ttoSerialize[\"description\"] = o.Description\n\t\t}\n\t} else {\n\t\ttoSerialize[\"description\"] = o.Description\n\t}\n\tif o.DisplayName != nil {\n\t\ttoSerialize[\"displayName\"] = o.DisplayName\n\t}\n\tif o.Version != nil {\n\t\ttoSerialize[\"version\"] = o.Version\n\t}\n\tif o.Assignments != nil {\n\t\ttoSerialize[\"assignments\"] = o.Assignments\n\t}\n\tif o.DeviceStatuses != nil {\n\t\ttoSerialize[\"deviceStatuses\"] = o.DeviceStatuses\n\t}\n\tif o.UserStatuses != nil {\n\t\ttoSerialize[\"userStatuses\"] = o.UserStatuses\n\t}\n\tif o.DeviceStatusOverview == nil {\n\t\tif o.isExplicitNullDeviceStatusOverview {\n\t\t\ttoSerialize[\"deviceStatusOverview\"] = o.DeviceStatusOverview\n\t\t}\n\t} else {\n\t\ttoSerialize[\"deviceStatusOverview\"] = o.DeviceStatusOverview\n\t}\n\tif o.UserStatusOverview == nil {\n\t\tif o.isExplicitNullUserStatusOverview {\n\t\t\ttoSerialize[\"userStatusOverview\"] = o.UserStatusOverview\n\t\t}\n\t} else {\n\t\ttoSerialize[\"userStatusOverview\"] = o.UserStatusOverview\n\t}\n\tif o.DeviceSettingStateSummaries != nil {\n\t\ttoSerialize[\"deviceSettingStateSummaries\"] = o.DeviceSettingStateSummaries\n\t}\n\tif o.PasswordBlockFingerprintUnlock != nil {\n\t\ttoSerialize[\"passwordBlockFingerprintUnlock\"] = o.PasswordBlockFingerprintUnlock\n\t}\n\tif o.PasswordBlockTrustAgents != nil {\n\t\ttoSerialize[\"passwordBlockTrustAgents\"] = o.PasswordBlockTrustAgents\n\t}\n\tif o.PasswordExpirationDays == nil {\n\t\tif o.isExplicitNullPasswordExpirationDays {\n\t\t\ttoSerialize[\"passwordExpirationDays\"] = o.PasswordExpirationDays\n\t\t}\n\t} else {\n\t\ttoSerialize[\"passwordExpirationDays\"] = o.PasswordExpirationDays\n\t}\n\tif o.PasswordMinimumLength == nil {\n\t\tif o.isExplicitNullPasswordMinimumLength {\n\t\t\ttoSerialize[\"passwordMinimumLength\"] = o.PasswordMinimumLength\n\t\t}\n\t} else {\n\t\ttoSerialize[\"passwordMinimumLength\"] = o.PasswordMinimumLength\n\t}\n\tif o.PasswordMinutesOfInactivityBeforeScreenTimeout == nil {\n\t\tif o.isExplicitNullPasswordMinutesOfInactivityBeforeScreenTimeout {\n\t\t\ttoSerialize[\"passwordMinutesOfInactivityBeforeScreenTimeout\"] = o.PasswordMinutesOfInactivityBeforeScreenTimeout\n\t\t}\n\t} else {\n\t\ttoSerialize[\"passwordMinutesOfInactivityBeforeScreenTimeout\"] = o.PasswordMinutesOfInactivityBeforeScreenTimeout\n\t}\n\tif o.PasswordPreviousPasswordBlockCount == nil {\n\t\tif o.isExplicitNullPasswordPreviousPasswordBlockCount {\n\t\t\ttoSerialize[\"passwordPreviousPasswordBlockCount\"] = o.PasswordPreviousPasswordBlockCount\n\t\t}\n\t} else {\n\t\ttoSerialize[\"passwordPreviousPasswordBlockCount\"] = o.PasswordPreviousPasswordBlockCount\n\t}\n\tif o.PasswordSignInFailureCountBeforeFactoryReset == nil {\n\t\tif o.isExplicitNullPasswordSignInFailureCountBeforeFactoryReset {\n\t\t\ttoSerialize[\"passwordSignInFailureCountBeforeFactoryReset\"] = o.PasswordSignInFailureCountBeforeFactoryReset\n\t\t}\n\t} else {\n\t\ttoSerialize[\"passwordSignInFailureCountBeforeFactoryReset\"] = o.PasswordSignInFailureCountBeforeFactoryReset\n\t}\n\tif o.PasswordRequiredType != nil {\n\t\ttoSerialize[\"passwordRequiredType\"] = o.PasswordRequiredType\n\t}\n\tif o.WorkProfileDataSharingType != nil {\n\t\ttoSerialize[\"workProfileDataSharingType\"] = o.WorkProfileDataSharingType\n\t}\n\tif o.WorkProfileBlockNotificationsWhileDeviceLocked != nil {\n\t\ttoSerialize[\"workProfileBlockNotificationsWhileDeviceLocked\"] = o.WorkProfileBlockNotificationsWhileDeviceLocked\n\t}\n\tif o.WorkProfileBlockAddingAccounts != nil {\n\t\ttoSerialize[\"workProfileBlockAddingAccounts\"] = o.WorkProfileBlockAddingAccounts\n\t}\n\tif o.WorkProfileBluetoothEnableContactSharing != nil {\n\t\ttoSerialize[\"workProfileBluetoothEnableContactSharing\"] = o.WorkProfileBluetoothEnableContactSharing\n\t}\n\tif o.WorkProfileBlockScreenCapture != nil {\n\t\ttoSerialize[\"workProfileBlockScreenCapture\"] = o.WorkProfileBlockScreenCapture\n\t}\n\tif o.WorkProfileBlockCrossProfileCallerId != nil {\n\t\ttoSerialize[\"workProfileBlockCrossProfileCallerId\"] = o.WorkProfileBlockCrossProfileCallerId\n\t}\n\tif o.WorkProfileBlockCamera != nil {\n\t\ttoSerialize[\"workProfileBlockCamera\"] = o.WorkProfileBlockCamera\n\t}\n\tif o.WorkProfileBlockCrossProfileContactsSearch != nil {\n\t\ttoSerialize[\"workProfileBlockCrossProfileContactsSearch\"] = o.WorkProfileBlockCrossProfileContactsSearch\n\t}\n\tif o.WorkProfileBlockCrossProfileCopyPaste != nil {\n\t\ttoSerialize[\"workProfileBlockCrossProfileCopyPaste\"] = o.WorkProfileBlockCrossProfileCopyPaste\n\t}\n\tif o.WorkProfileDefaultAppPermissionPolicy != nil {\n\t\ttoSerialize[\"workProfileDefaultAppPermissionPolicy\"] = o.WorkProfileDefaultAppPermissionPolicy\n\t}\n\tif o.WorkProfilePasswordBlockFingerprintUnlock != nil {\n\t\ttoSerialize[\"workProfilePasswordBlockFingerprintUnlock\"] = o.WorkProfilePasswordBlockFingerprintUnlock\n\t}\n\tif o.WorkProfilePasswordBlockTrustAgents != nil {\n\t\ttoSerialize[\"workProfilePasswordBlockTrustAgents\"] = o.WorkProfilePasswordBlockTrustAgents\n\t}\n\tif o.WorkProfilePasswordExpirationDays == nil {\n\t\tif o.isExplicitNullWorkProfilePasswordExpirationDays {\n\t\t\ttoSerialize[\"workProfilePasswordExpirationDays\"] = o.WorkProfilePasswordExpirationDays\n\t\t}\n\t} else {\n\t\ttoSerialize[\"workProfilePasswordExpirationDays\"] = o.WorkProfilePasswordExpirationDays\n\t}\n\tif o.WorkProfilePasswordMinimumLength == nil {\n\t\tif o.isExplicitNullWorkProfilePasswordMinimumLength {\n\t\t\ttoSerialize[\"workProfilePasswordMinimumLength\"] = o.WorkProfilePasswordMinimumLength\n\t\t}\n\t} else {\n\t\ttoSerialize[\"workProfilePasswordMinimumLength\"] = o.WorkProfilePasswordMinimumLength\n\t}\n\tif o.WorkProfilePasswordMinNumericCharacters == nil {\n\t\tif o.isExplicitNullWorkProfilePasswordMinNumericCharacters {\n\t\t\ttoSerialize[\"workProfilePasswordMinNumericCharacters\"] = o.WorkProfilePasswordMinNumericCharacters\n\t\t}\n\t} else {\n\t\ttoSerialize[\"workProfilePasswordMinNumericCharacters\"] = o.WorkProfilePasswordMinNumericCharacters\n\t}\n\tif o.WorkProfilePasswordMinNonLetterCharacters == nil {\n\t\tif o.isExplicitNullWorkProfilePasswordMinNonLetterCharacters {\n\t\t\ttoSerialize[\"workProfilePasswordMinNonLetterCharacters\"] = o.WorkProfilePasswordMinNonLetterCharacters\n\t\t}\n\t} else {\n\t\ttoSerialize[\"workProfilePasswordMinNonLetterCharacters\"] = o.WorkProfilePasswordMinNonLetterCharacters\n\t}\n\tif o.WorkProfilePasswordMinLetterCharacters == nil {\n\t\tif o.isExplicitNullWorkProfilePasswordMinLetterCharacters {\n\t\t\ttoSerialize[\"workProfilePasswordMinLetterCharacters\"] = o.WorkProfilePasswordMinLetterCharacters\n\t\t}\n\t} else {\n\t\ttoSerialize[\"workProfilePasswordMinLetterCharacters\"] = o.WorkProfilePasswordMinLetterCharacters\n\t}\n\tif o.WorkProfilePasswordMinLowerCaseCharacters == nil {\n\t\tif o.isExplicitNullWorkProfilePasswordMinLowerCaseCharacters {\n\t\t\ttoSerialize[\"workProfilePasswordMinLowerCaseCharacters\"] = o.WorkProfilePasswordMinLowerCaseCharacters\n\t\t}\n\t} else {\n\t\ttoSerialize[\"workProfilePasswordMinLowerCaseCharacters\"] = o.WorkProfilePasswordMinLowerCaseCharacters\n\t}\n\tif o.WorkProfilePasswordMinUpperCaseCharacters == nil {\n\t\tif o.isExplicitNullWorkProfilePasswordMinUpperCaseCharacters {\n\t\t\ttoSerialize[\"workProfilePasswordMinUpperCaseCharacters\"] = o.WorkProfilePasswordMinUpperCaseCharacters\n\t\t}\n\t} else {\n\t\ttoSerialize[\"workProfilePasswordMinUpperCaseCharacters\"] = o.WorkProfilePasswordMinUpperCaseCharacters\n\t}\n\tif o.WorkProfilePasswordMinSymbolCharacters == nil {\n\t\tif o.isExplicitNullWorkProfilePasswordMinSymbolCharacters {\n\t\t\ttoSerialize[\"workProfilePasswordMinSymbolCharacters\"] = o.WorkProfilePasswordMinSymbolCharacters\n\t\t}\n\t} else {\n\t\ttoSerialize[\"workProfilePasswordMinSymbolCharacters\"] = o.WorkProfilePasswordMinSymbolCharacters\n\t}\n\tif o.WorkProfilePasswordMinutesOfInactivityBeforeScreenTimeout == nil {\n\t\tif o.isExplicitNullWorkProfilePasswordMinutesOfInactivityBeforeScreenTimeout {\n\t\t\ttoSerialize[\"workProfilePasswordMinutesOfInactivityBeforeScreenTimeout\"] = o.WorkProfilePasswordMinutesOfInactivityBeforeScreenTimeout\n\t\t}\n\t} else {\n\t\ttoSerialize[\"workProfilePasswordMinutesOfInactivityBeforeScreenTimeout\"] = o.WorkProfilePasswordMinutesOfInactivityBeforeScreenTimeout\n\t}\n\tif o.WorkProfilePasswordPreviousPasswordBlockCount == nil {\n\t\tif o.isExplicitNullWorkProfilePasswordPreviousPasswordBlockCount {\n\t\t\ttoSerialize[\"workProfilePasswordPreviousPasswordBlockCount\"] = o.WorkProfilePasswordPreviousPasswordBlockCount\n\t\t}\n\t} else {\n\t\ttoSerialize[\"workProfilePasswordPreviousPasswordBlockCount\"] = o.WorkProfilePasswordPreviousPasswordBlockCount\n\t}\n\tif o.WorkProfilePasswordSignInFailureCountBeforeFactoryReset == nil {\n\t\tif o.isExplicitNullWorkProfilePasswordSignInFailureCountBeforeFactoryReset {\n\t\t\ttoSerialize[\"workProfilePasswordSignInFailureCountBeforeFactoryReset\"] = o.WorkProfilePasswordSignInFailureCountBeforeFactoryReset\n\t\t}\n\t} else {\n\t\ttoSerialize[\"workProfilePasswordSignInFailureCountBeforeFactoryReset\"] = o.WorkProfilePasswordSignInFailureCountBeforeFactoryReset\n\t}\n\tif o.WorkProfilePasswordRequiredType != nil {\n\t\ttoSerialize[\"workProfilePasswordRequiredType\"] = o.WorkProfilePasswordRequiredType\n\t}\n\tif o.WorkProfileRequirePassword != nil {\n\t\ttoSerialize[\"workProfileRequirePassword\"] = o.WorkProfileRequirePassword\n\t}\n\tif o.SecurityRequireVerifyApps != nil {\n\t\ttoSerialize[\"securityRequireVerifyApps\"] = o.SecurityRequireVerifyApps\n\t}\n\treturn json.Marshal(toSerialize)\n}", "title": "" }, { "docid": "194c5eec47b9d7247e485c3d280c8a5f", "score": "0.4494203", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorPtrOutput) Basic() ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorBasicPtrOutput {\n\treturn o.ApplyT(func(v *ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnector) *ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorBasic {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Basic\n\t}).(ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorBasicPtrOutput)\n}", "title": "" }, { "docid": "8f8acb742e414782c5104110d31030eb", "score": "0.4486625", "text": "func (o FlowSourceFlowConfigOutput) ConnectorType() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FlowSourceFlowConfig) string { return v.ConnectorType }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a85efc761b52861b6a7e04b583808d18", "score": "0.44746837", "text": "func (*AppConnector) Descriptor() ([]byte, []int) {\n\treturn file_cloud_beyondcorp_appconnectors_v1_data_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "c01e8b320a8880f936f074673c840cd7", "score": "0.4473479", "text": "func (p *pydioWrapperConnector) getConnectorList(logger logrus.FieldLogger) (connectorList []ConnectorList, err error) {\n\t// Sort\n\tsort.Sort(byID(p.Connectors))\n\t// end sort\n\tfor _, connConfig := range p.Connectors {\n\t\tconnConnector, er := createConnector(logger, connConfig.Type, connConfig)\n\t\tif er != nil {\n\t\t\tlogger.Errorf(er.Error())\n\t\t\tcontinue\n\t\t}\n\t\tconnConnectorFull := ConnectorList{\n\t\t\tType: connConfig.Type,\n\t\t\tName: connConfig.Name,\n\t\t\tID: connConfig.ID,\n\t\t\tConnector: connConnector.(interface {\n\t\t\t\tconnector.Connector\n\t\t\t\tconnector.PasswordConnector\n\t\t\t\tconnector.RefreshConnector\n\t\t\t}),\n\t\t}\n\t\tconnectorList = append(connectorList, connConnectorFull)\n\t}\n\treturn connectorList, nil\n}", "title": "" }, { "docid": "db3c552f6295e1a8f444ea1ac8952fb0", "score": "0.44703048", "text": "func (plsc PrivateLinkServiceConnection)MarshalJSON() ([]byte, error){\n objectMap := make(map[string]interface{})\n if(plsc.PrivateLinkServiceConnectionProperties != nil) {\n objectMap[\"properties\"] = plsc.PrivateLinkServiceConnectionProperties\n }\n if(plsc.Name != nil) {\n objectMap[\"name\"] = plsc.Name\n }\n if(plsc.ID != nil) {\n objectMap[\"id\"] = plsc.ID\n }\n return json.Marshal(objectMap)\n }", "title": "" }, { "docid": "467499ea5415f87ae3842ccbb64e93e2", "score": "0.44573587", "text": "func (a LtmApi) GetProfileOneConnect(id string) (*LtmProfileOneConnect, error) {\n\n\tvar httpMethod = \"Get\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/ltm/profile/oneConnect/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(LtmProfileOneConnect)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "20f71045c83f0d2608ca9a2b072f89c9", "score": "0.44505882", "text": "func (a LtmApi) GetProfileOneConnectList() (*LtmProfileOneConnectList, error) {\n\n\tvar httpMethod = \"Get\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/ltm/profile/oneConnect\"\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(LtmProfileOneConnectList)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "1de5e9258fc5659bb8eff756e448fff7", "score": "0.44412702", "text": "func (o ConnectorOutput) ConnectorDescription() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Connector) pulumi.StringPtrOutput { return v.ConnectorDescription }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a047cf579c029583c8ca3c049851abca", "score": "0.44379514", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesPtrOutput) CustomConnector() ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesCustomConnectorPtrOutput {\n\treturn o.ApplyT(func(v *ConnectorProfileConnectorProfileConfigConnectorProfileProperties) *ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesCustomConnector {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.CustomConnector\n\t}).(ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesCustomConnectorPtrOutput)\n}", "title": "" }, { "docid": "7e8fd9277ede65251c05e00010eb85e6", "score": "0.44321987", "text": "func (o ConnectorOutput) ConnectorConfiguration() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v *Connector) pulumi.AnyOutput { return v.ConnectorConfiguration }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "527c8b4743b6a959e5054fc04e944a83", "score": "0.44303122", "text": "func (*CPlayer_CommunityPreferences) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_player_steamclient_proto_rawDescGZIP(), []int{37}\n}", "title": "" }, { "docid": "c39096e763e86c3498790c124dbdd130", "score": "0.44255972", "text": "func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error {\n var m map[string]*json.RawMessage\n err := json.Unmarshal(body, &m)\n if err != nil {\n return err\n }\n for k, v := range m {\n switch k {\n case \"properties\":\n if v != nil {\n var privateEndpointConnectionProperties PrivateEndpointConnectionProperties\n err = json.Unmarshal(*v, &privateEndpointConnectionProperties)\n if err != nil {\n return err\n }\n pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties\n }\n case \"name\":\n if v != nil {\n var name string\n err = json.Unmarshal(*v, &name)\n if err != nil {\n return err\n }\n pec.Name = &name\n }\n case \"type\":\n if v != nil {\n var typeVar string\n err = json.Unmarshal(*v, &typeVar)\n if err != nil {\n return err\n }\n pec.Type = &typeVar\n }\n case \"etag\":\n if v != nil {\n var etag string\n err = json.Unmarshal(*v, &etag)\n if err != nil {\n return err\n }\n pec.Etag = &etag\n }\n case \"id\":\n if v != nil {\n var ID string\n err = json.Unmarshal(*v, &ID)\n if err != nil {\n return err\n }\n pec.ID = &ID\n }\n }\n }\n\n return nil\n }", "title": "" }, { "docid": "58eafd053a4d5a035d025ce73ca0c8c4", "score": "0.44233358", "text": "func (csp *ConnectorSettingProperties) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"hybridComputeSettings\":\n\t\t\tif v != nil {\n\t\t\t\tvar hybridComputeSettings HybridComputeSettingsProperties\n\t\t\t\terr = json.Unmarshal(*v, &hybridComputeSettings)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcsp.HybridComputeSettings = &hybridComputeSettings\n\t\t\t}\n\t\tcase \"authenticationDetails\":\n\t\t\tif v != nil {\n\t\t\t\tauthenticationDetails, err := unmarshalBasicAuthenticationDetailsProperties(*v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcsp.AuthenticationDetails = authenticationDetails\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "262d25671b7dafbe51fe8a8317cfc9f4", "score": "0.44220418", "text": "func LoadConf() {\n\tconf := struct {\n\t\tThreadGitlab string\n\t\tThreadAppCenter string\n\t\tThreadTuleap string\n\t\tThreadGitlabGroup []GitlabGroup\n\t\tPushIcon string\n\t\tMergeIcon string\n\t\tBuildIcon string\n\t\tBotStartMessage string\n\t\tFbAPIUrl string\n\t\tVerbose bool\n\t\tShowAllCommits bool\n\t\tHTTPTimeout float64\n\t\tChatType string\n\t\tTuleapURL string\n\t\tPort string\n\t\tURLNoteHookFunction string\n\t\tTimeZone string\n\t}{}\n\n\tcontent, err := ioutil.ReadFile(*ConfigFile)\n\tif err != nil {\n\t\tl.Critical(\"Error: Read config file error: \" + err.Error())\n\t}\n\n\terr = json.Unmarshal(content, &conf)\n\tif err != nil {\n\t\tl.Critical(\"Error: Parse config file error: \" + err.Error())\n\t}\n\n\tPushIcon = conf.PushIcon\n\tMergeIcon = conf.MergeIcon\n\tBuildIcon = conf.BuildIcon\n\tBotStartMessage = conf.BotStartMessage\n\tFbAPIUrl = conf.FbAPIUrl\n\tVerbose = conf.Verbose\n\tShowAllCommits = conf.ShowAllCommits\n\tHTTPTimeout = int(conf.HTTPTimeout)\n\tChatType = conf.ChatType\n\tTuleapURL = conf.TuleapURL\n\tPort = conf.Port\n\tThreadGitlab = conf.ThreadGitlab\n\tThreadAppCenter = conf.ThreadAppCenter\n\tThreadTuleap = conf.ThreadTuleap\n\tURLNoteHookFunction = conf.URLNoteHookFunction\n\tTimeZone = conf.TimeZone\n\tThreadGitlabGroup = conf.ThreadGitlabGroup\n}", "title": "" }, { "docid": "7ce53a24ab564ef35ee030d9c99be3df", "score": "0.44212428", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSapoDataPtrOutput) OauthProperties() ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSapoDataOauthPropertiesPtrOutput {\n\treturn o.ApplyT(func(v *ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSapoData) *ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSapoDataOauthProperties {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.OauthProperties\n\t}).(ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesSapoDataOauthPropertiesPtrOutput)\n}", "title": "" }, { "docid": "0c9d5c36b691d4f32efb750dbffe49a5", "score": "0.44203317", "text": "func (h *Handler) trySettingConnectorNameToPasswordless(ctx context.Context, sessCtx *SessionContext, req changeUserAuthenticationRequest) error {\n\t// We use the presence of a WebAuthn response, along with the absence of a\n\t// password, as a proxy to determine that a passwordless registration took\n\t// place, as it is not possible to infer that just from the WebAuthn response.\n\tisPasswordlessRegistration := req.WebauthnCreationResponse != nil && len(req.Password) == 0\n\tif !isPasswordlessRegistration {\n\t\treturn nil\n\t}\n\n\tif !h.ClusterFeatures.GetCloud() {\n\t\treturn nil\n\t}\n\n\tauthPreference, err := sessCtx.cfg.RootClient.GetAuthPreference(ctx)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tif connector := authPreference.GetConnectorName(); connector != \"\" && connector != constants.LocalConnector {\n\t\treturn nil\n\t}\n\n\tusers, err := h.cfg.ProxyClient.GetUsers(false)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tif len(users) != 1 {\n\t\treturn nil\n\t}\n\n\tauthPreference.SetConnectorName(constants.PasswordlessConnector)\n\n\terr = sessCtx.cfg.RootClient.SetAuthPreference(ctx, authPreference)\n\treturn trace.Wrap(err)\n}", "title": "" }, { "docid": "5796a63eaed3684eb07002f227b647a4", "score": "0.44197375", "text": "func JavaConfig(javaJSONObj *Java, c *websocket.Client) {\n\n\tempJSON, _ := json.MarshalIndent(javaJSONObj, \"\", \" \")\n\n\tc.Pool.Broadcast <- websocket.Message{Type: 1, Body: (\"Original config for \" + javaJSONObj.Lang + \"\\n\")}\n\tc.Pool.Broadcast <- websocket.Message{Type: 1, Body: string(empJSON)}\n\n\tvar environmentstr string\n\n\tfor key, value := range javaJSONObj.Environment {\n\t\tfmt.Println(\"Reading Value for Key :\", key)\n\t\tfmt.Println(\"Reading Value for Value :\", value)\n\t\tenvironmentstr = environmentstr + `\"` + string(key) + `\" : \"` + fmt.Sprint(value) + `\",`\n\t}\n\n\tclasspath, _ := json.Marshal(javaJSONObj.Classpath)\n\toptions, _ := json.Marshal(javaJSONObj.Options)\n\n\tjsonString := `\n{\n\t\"applications\" : {\n\t\t\"` + javaJSONObj.Appname + `\" : {\n\t\t\t\"type\" : \"java\",\n\t\t\t\"limits\" : {\n\t\t\t\t\"timeout\" : ` + strconv.Itoa(javaJSONObj.Limits.Timeout) + `,\n\t\t\t\t\"requests\" : ` + strconv.Itoa(javaJSONObj.Limits.Requests) + `\n\t\t\t},\n\t\t\t\"processes\" : {\n\t\t\t\t\"max\" : ` + strconv.Itoa(javaJSONObj.Processes.Max) + `,\n\t\t\t\t\"spare\" : ` + strconv.Itoa(javaJSONObj.Processes.Spare) + `,\n\t\t\t\t\"idle_timeout\" : ` + strconv.Itoa(javaJSONObj.Processes.IdleTimeout) + `\n\t\t\t},\n\t\t\t\"working_directory\" : \"` + javaJSONObj.WorkingDirectory + `\",\n\t\t\t\"user\" : \"` + javaJSONObj.User + `\",\n\t\t\t\"group\" : \"` + javaJSONObj.Group + `\",\n\t\t\t\"environment\" : {\n\t\t\t\t` + fmt.Sprint(environmentstr) + `\n\t\t\t},\n\t\t\t\"webapp\" : \"` + javaJSONObj.Webapp + `\",\n\t\t\t\"classpath\" : ` + string(classpath) + `,\n\t\t\t\"options\" : ` + string(options) + `,\n\t\t\t\"threads\" : ` + strconv.Itoa(javaJSONObj.Threads) + `,\n\t\t\t\"thread_stack_size\" : ` + strconv.Itoa(javaJSONObj.ThreadStackSize) + `,\n\t\t}\n\t},\n\t\"listeners\" : {\n\t\t\"*:` + strconv.Itoa(javaJSONObj.Port) + `\" : {\n\t\t\t\"pass\" : \"applications/` + javaJSONObj.Appname + `\"\n\t\t}\n\t}\n}`\n\n\tpliantString := `\n{\n\t\"bodyData\": {\n\t\t\"lang\" : \"` + javaJSONObj.Lang + `\",\n\t\t\"repo\" : \"` + javaJSONObj.Repo + `\",\n\t\t\"package\" : \"` + DockerPackages[javaJSONObj.Lang] + `\",\n\t\t\"cloud\" : {\n\t\t\t\"platform\" : \"` + javaJSONObj.Cloud.Platform + `\",\n\t\t\t\"machinetype\" : \"` + javaJSONObj.Cloud.MachineType + `\"\n\t\t},\n\t\t\"initialconfig\" : \n\t\t\t` + jsonString + `\n\t}\n}\n`\n\n\tc.Pool.Broadcast <- websocket.Message{Type: 1, Body: (\"Finished Pliant config for \" + javaJSONObj.Lang + \"\\n\")}\n\tc.Pool.Broadcast <- websocket.Message{Type: 1, Body: pliantString}\n\tc.Pool.Broadcast <- websocket.Message{Type: 1, Body: (\"Sending to Pliant server\\n\")}\n\n\tresp, err := pliant.Connect(pliantString)\n\n\tif err != nil {\n\t\tc.Pool.Broadcast <- websocket.Message{Type: 1, Body: (\"Error sending to Pliant server \" + err.Error() + \"\\n\")}\n\t} else {\n\t\tc.Pool.Broadcast <- websocket.Message{Type: 1, Body: (\"Error sending to Pliant server \" + *resp + \"\\n\")}\n\t}\n\n\tc.Pool.Broadcast <- websocket.Message{Type: 1, Body: (\"Finished config for \" + javaJSONObj.Lang + \"\\n\")}\n\tc.Pool.Broadcast <- websocket.Message{Type: 1, Body: jsonString}\n\n\t_ = ioutil.WriteFile((BUILDDIR + \"/machines/builds/nginx-unit-\" + javaJSONObj.Lang + \"/docker-entrypoint.d/config.json\"), []byte(jsonString), 0644)\n}", "title": "" }, { "docid": "ae77b0a6153a85e5621feb560303980e", "score": "0.44184276", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsPtrOutput) CustomConnector() ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorPtrOutput {\n\treturn o.ApplyT(func(v *ConnectorProfileConnectorProfileConfigConnectorProfileCredentials) *ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnector {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.CustomConnector\n\t}).(ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorPtrOutput)\n}", "title": "" }, { "docid": "c0e726fd8ca612537fd283f7b226e75e", "score": "0.4416233", "text": "func (s *Slack) Setup(config map[string]string) error {\n\tvar err error\n\tconfig[\"token\"], err = prompt.Basic(\"Token: \", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c9ad3614f43c69d8527f8bbc7a820f4e", "score": "0.4411729", "text": "func getClientConfig(tlsEnabled bool, channelID, ordererEndpoint, committerEndpoint, proverEndpoint string) *client.ClientConfig {\n\tconfig := client.ClientConfig{\n\t\tChannelID: channelID,\n\t\tMSPInfo: client.MSPInfo{\n\t\t\tMSPConfigPath: \"./testdata/crypto/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp\",\n\t\t\tMSPID: \"Org1MSP\",\n\t\t\tMSPType: \"bccsp\",\n\t\t},\n\t\tOrderer: client.ConnectionConfig{\n\t\t\tAddress: ordererEndpoint,\n\t\t\tConnectionTimeout: 1 * time.Second,\n\t\t\tTLSEnabled: tlsEnabled,\n\t\t\tTLSRootCertFile: \"./testdata/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt\",\n\t\t},\n\t\tCommitterPeer: client.ConnectionConfig{\n\t\t\tAddress: committerEndpoint,\n\t\t\tConnectionTimeout: 1 * time.Second,\n\t\t\tTLSEnabled: tlsEnabled,\n\t\t\tTLSRootCertFile: \"./testdata/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt\",\n\t\t},\n\t\tProverPeer: client.ConnectionConfig{\n\t\t\tAddress: proverEndpoint,\n\t\t\tConnectionTimeout: 1 * time.Second,\n\t\t\tTLSEnabled: tlsEnabled,\n\t\t\tTLSRootCertFile: \"./testdata/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt\",\n\t\t},\n\t}\n\treturn &config\n}", "title": "" }, { "docid": "98696ee9a9c9957d469b152cde0cfe69", "score": "0.4407404", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorBasicPtrOutput) Username() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ConnectorProfileConnectorProfileConfigConnectorProfileCredentialsCustomConnectorBasic) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Username\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8f7afb04d56997f5eb5df6f536d32717", "score": "0.4405421", "text": "func (o ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesCustomConnectorOutput) Oauth2Properties() ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesCustomConnectorOauth2PropertiesPtrOutput {\n\treturn o.ApplyT(func(v ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesCustomConnector) *ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesCustomConnectorOauth2Properties {\n\t\treturn v.Oauth2Properties\n\t}).(ConnectorProfileConnectorProfileConfigConnectorProfilePropertiesCustomConnectorOauth2PropertiesPtrOutput)\n}", "title": "" }, { "docid": "4131013ab62d3a59c5008291d99ac552", "score": "0.44026834", "text": "func (mc *MonitorConfig) ExtraConfig() (map[string]interface{}, error) {\n\treturn mc.OtherConfig, nil\n}", "title": "" }, { "docid": "86a7335cb55021a8f114b66ca9a1142d", "score": "0.4402422", "text": "func (*HSSConfig_SubscriptionProfile) Descriptor() ([]byte, []int) {\n\treturn file_mconfigs_proto_rawDescGZIP(), []int{12, 0}\n}", "title": "" }, { "docid": "ab76d17af82ec5e854d60e14e1bff9f1", "score": "0.44014287", "text": "func (a *SocialsApiService) GetSocialProfileProperties(ctx context.Context, socialType string) ( *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/socials/profile\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\tlocalVarQueryParams.Add(\"socialType\", parameterToString(socialType, \"\"))\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/x-www-form-urlencoded\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\treturn localVarHttpResponse, err\n}", "title": "" }, { "docid": "d889ba93c22c169799e0b5de9dbbf985", "score": "0.43984377", "text": "func (*LoginProfile) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_oslogin_v1_oslogin_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "02f152130826c82694c9c0c7839d7f0b", "score": "0.43843067", "text": "func testClientConf(user, pw string) *ssh.ClientConfig {\n\treturn &ssh.ClientConfig{\n\t\tUser: user,\n\t\tAuth: []ssh.AuthMethod{\n\t\t\tssh.Password(pw),\n\t\t},\n\t\tHostKeyCallback: ssh.InsecureIgnoreHostKey(),\n\t}\n}", "title": "" }, { "docid": "531a954ebaa0b89f99ddc04e1c5a6dc2", "score": "0.43838763", "text": "func requiredOptions() map[string]string {\n\treturn map[string]string{\n\t\toptEndpoint: \"http://am.iec.com:8080/openam/oauth2/realms/root/realms/edge/introspect\",\n\t\toptClientID: \"client_id\",\n\t\toptClientSecret: \"changeit\",\n\t}\n}", "title": "" }, { "docid": "6ab82298c81a3d3877e4de190c8e520d", "score": "0.437588", "text": "func (o FlowDestinationFlowConfigDestinationConnectorPropertiesCustomConnectorOutput) CustomProperties() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v FlowDestinationFlowConfigDestinationConnectorPropertiesCustomConnector) map[string]string {\n\t\treturn v.CustomProperties\n\t}).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "d09e115871f08981fcb9eaa1006762ce", "score": "0.4374638", "text": "func (cp *ConnectionProperties) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar v *json.RawMessage\n\n\tv = m[\"serverPort\"]\n\tif v != nil {\n\t\tvar serverPort PortReference\n\t\terr = json.Unmarshal(*m[\"serverPort\"], &serverPort)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcp.ServerPort = &serverPort\n\t}\n\n\tv = m[\"failureState\"]\n\tif v != nil {\n\t\tvar failureState ConnectionFailureState\n\t\terr = json.Unmarshal(*m[\"failureState\"], &failureState)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcp.FailureState = failureState\n\t}\n\n\tv = m[\"source\"]\n\tif v != nil {\n\t\tsource, err := unmarshalResourceReference(*m[\"source\"])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcp.Source = source\n\t}\n\n\tv = m[\"destination\"]\n\tif v != nil {\n\t\tdestination, err := unmarshalResourceReference(*m[\"destination\"])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcp.Destination = destination\n\t}\n\n\tv = m[\"startTime\"]\n\tif v != nil {\n\t\tvar startTime date.Time\n\t\terr = json.Unmarshal(*m[\"startTime\"], &startTime)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcp.StartTime = &startTime\n\t}\n\n\tv = m[\"endTime\"]\n\tif v != nil {\n\t\tvar endTime date.Time\n\t\terr = json.Unmarshal(*m[\"endTime\"], &endTime)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcp.EndTime = &endTime\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "262b2300c930256085774f813bd5d501", "score": "0.43731827", "text": "func (pec PrivateEndpointConnection)MarshalJSON() ([]byte, error){\n objectMap := make(map[string]interface{})\n if(pec.PrivateEndpointConnectionProperties != nil) {\n objectMap[\"properties\"] = pec.PrivateEndpointConnectionProperties\n }\n if(pec.Name != nil) {\n objectMap[\"name\"] = pec.Name\n }\n if(pec.ID != nil) {\n objectMap[\"id\"] = pec.ID\n }\n return json.Marshal(objectMap)\n }", "title": "" }, { "docid": "91ef2a40fd0495bc7c36caffacf516b8", "score": "0.43705323", "text": "func (o FlowSourceFlowConfigPtrOutput) ConnectorType() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FlowSourceFlowConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ConnectorType\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2701a8de3ffb5c60a0bc7cb83fa528ca", "score": "0.436601", "text": "func (iicplcp InterfaceIPConfigurationPrivateLinkConnectionProperties)MarshalJSON() ([]byte, error){\n objectMap := make(map[string]interface{})\n return json.Marshal(objectMap)\n }", "title": "" }, { "docid": "c1942fa54db1e5820b77a27e5d9fbba3", "score": "0.43477553", "text": "func ValidateBaseConnection(cloudConfig ClientConfig) error {\n\tif len(cloudConfig.Host) == 0 && len(cloudConfig.AgentFile) == 0 {\n\t\treturn fmt.Errorf(\"You have empty host\")\n\t}\n\n\tif len(cloudConfig.User) == 0 {\n\t\treturn fmt.Errorf(\"You have empty user\")\n\t}\n\n\tif len(cloudConfig.Password) == 0 {\n\t\treturn fmt.Errorf(\"You have empty password\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "207a6887e1db7829e625eacdba9170d2", "score": "0.43476656", "text": "func (p *PrestoLinkedServiceTypeProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"allowHostNameCNMismatch\":\n\t\t\terr = unpopulate(val, &p.AllowHostNameCNMismatch)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"allowSelfSignedServerCert\":\n\t\t\terr = unpopulate(val, &p.AllowSelfSignedServerCert)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"authenticationType\":\n\t\t\terr = unpopulate(val, &p.AuthenticationType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"catalog\":\n\t\t\terr = unpopulate(val, &p.Catalog)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"enableSsl\":\n\t\t\terr = unpopulate(val, &p.EnableSSL)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"encryptedCredential\":\n\t\t\terr = unpopulate(val, &p.EncryptedCredential)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"host\":\n\t\t\terr = unpopulate(val, &p.Host)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"password\":\n\t\t\tp.Password, err = unmarshalSecretBaseClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"port\":\n\t\t\terr = unpopulate(val, &p.Port)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"serverVersion\":\n\t\t\terr = unpopulate(val, &p.ServerVersion)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"timeZoneID\":\n\t\t\terr = unpopulate(val, &p.TimeZoneID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"trustedCertPath\":\n\t\t\terr = unpopulate(val, &p.TrustedCertPath)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"useSystemTrustStore\":\n\t\t\terr = unpopulate(val, &p.UseSystemTrustStore)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"username\":\n\t\t\terr = unpopulate(val, &p.Username)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "df3127d4a23876a5e28a5775b0bfb471", "score": "0.4345274", "text": "func (o ProfileMonitorConfigOutput) Protocol() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ProfileMonitorConfig) string { return v.Protocol }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "72d2a2c249ff8a65d1dc2f8e12e4ad18", "score": "0.43412414", "text": "func (*HTTPSWebProfile) Descriptor() ([]byte, []int) {\n\treturn file_spire_api_types_federationrelationship_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "a3b5143a6bb868e59c6c6ba2162fb3e1", "score": "0.4341129", "text": "func (agsp ApplicationGatewaySslProfile)MarshalJSON() ([]byte, error){\n objectMap := make(map[string]interface{})\n if(agsp.ApplicationGatewaySslProfilePropertiesFormat != nil) {\n objectMap[\"properties\"] = agsp.ApplicationGatewaySslProfilePropertiesFormat\n }\n if(agsp.Name != nil) {\n objectMap[\"name\"] = agsp.Name\n }\n if(agsp.ID != nil) {\n objectMap[\"id\"] = agsp.ID\n }\n return json.Marshal(objectMap)\n }", "title": "" }, { "docid": "a21837e3f72c044cc78afe84df1ab9d3", "score": "0.43356994", "text": "func ensureCredentials(profile map[string]string) {\n\tkind, ok := profile[\"kind\"]\n\tif !ok {\n\t\treturn\n\t}\n\tif kind == \"client\" {\n\t\treturn // user creds not needed\n\t}\n\tif _, ok := profile[\"username\"]; !ok {\n\t\tprofile[\"username\"] = getUsername()\n\t}\n\tif _, ok := profile[\"password\"]; !ok {\n\t\tprofile[\"password\"] = getPassword()\n\t}\n}", "title": "" } ]
d59ec7d22dea69d9bc007606192c0e1c
Send sends a new line to the terminal, as if a user typed it
[ { "docid": "88f3be8bdb7cca52143d01a3fe1ae19e", "score": "0.66261685", "text": "func (cp *ConsoleProcess) Send(value string) {\n\t_, _ = cp.console.SendLine(value)\n}", "title": "" } ]
[ { "docid": "1926cc12c475a0f855845c34ee81c555", "score": "0.6657518", "text": "func (cp *ConsoleProcess) SendLine(value string) {\n\t_, _ = cp.console.SendOSLine(value)\n}", "title": "" }, { "docid": "b2862c6cfba744ed728896033410de3a", "score": "0.63762784", "text": "func (w *winWin) sendtype() {\n\traw := w.israw()\nlineloop:\n\tfor w.ntypebreak != 0 || (raw && len(w.typing) > 0) {\n\t\tfor i, r := range w.typing {\n\t\t\tif r == '\\n' || r == 0x04 || (i == len(w.typing)-1 && raw) {\n\t\t\t\tif (r == '\\n' || r == 0x04) && w.ntypebreak > 0 {\n\t\t\t\t\tw.ntypebreak--\n\t\t\t\t}\n\t\t\t\tn := i + 1\n\t\t\t\tif !raw {\n\t\t\t\t\tw.echo.Echoed(w.typing)\n\t\t\t\t}\n\t\t\t\tn, err := w.rcpty.Write([]byte(string(w.typing[0:n])))\n\t\t\t\tif n != i+1 || err != nil {\n\t\t\t\t\tfmt.Fprintf(os.Stderr, \"sending to program\")\n\t\t\t\t}\n\t\t\t\tw.p += len([]rune(string(w.typing[0:n])))\n\t\t\t\tcopy(w.typing[0:len(w.typing)-n], w.typing[n:])\n\t\t\t\tw.typing = w.typing[0 : len(w.typing)-n]\n\t\t\t\tcontinue lineloop\n\t\t\t}\n\t\t}\n\t\tfmt.Fprintf(os.Stderr, \"no breakchar\\n\")\n\t\tw.ntypebreak = 0\n\t}\n}", "title": "" }, { "docid": "7f6be7e653151d687bf21470ad10036b", "score": "0.6143088", "text": "func (fs *Connection) Send(cmd string) {\n\tfs.text.PrintfLine(\"%s \\r\\n\", cmd)\n}", "title": "" }, { "docid": "082ac163ac8c9385b747b4af32b6ac0c", "score": "0.6102596", "text": "func (d *Display) WriteLine(str string) error {\n\t_, err := d.term.Write([]byte(str + \"\\n\"))\n\treturn err\n}", "title": "" }, { "docid": "aeadb7edf51127573a0b4558131c7f6a", "score": "0.6079992", "text": "func (t *Term) Newline() {\n\tt.Write(chars(Newline))\n}", "title": "" }, { "docid": "e2f710b16f0f41983c37240e12acacf8", "score": "0.6044454", "text": "func (s Session) SendLine(line string) error {\n\ts.Println(\"S:\" + line)\n\treturn s.Conn.WriteLine(line)\n}", "title": "" }, { "docid": "a130efedc9a196249e8ac8c1e8da5a9f", "score": "0.6042371", "text": "func (b *Buntstift) NewLine() {\n\tfmt.Fprintf(Output, \"\\r \\n\")\n}", "title": "" }, { "docid": "304224886dde10afb19c230f571169c7", "score": "0.5937282", "text": "func acceptInput(server net.Conn){\n reader := bufio.NewReader(os.Stdin)\n go handleServerMessage(server)\n for{\n fmt.Print(\"Client-> \")\n command,_ := reader.ReadString('\\n')\n //command = strings.Replace(command, \"\\n\", \"\", -1)\n server.Write([]byte(command))\n }\n\n}", "title": "" }, { "docid": "3de577c6541975114b6f852c238ce67d", "score": "0.5890774", "text": "func (p *Printer) SendCommand(g string) error {\n\tg = g + \"\\n\"\n\t_, err := p.s.Write([]byte(g))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif !strings.HasSuffix(p.readPump(), \"ok\\n\") {\n\t\treturn errors.New(\"command did not complete successfully\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fd0e3f54a3faedd12174529644898b7d", "score": "0.5848731", "text": "func sendStdin(c *twitch.Client, twChan string) {\n\tfor {\n\t\treader := bufio.NewReader(os.Stdin)\n\t\ttext, _ := reader.ReadString('\\n')\n\t\ttext = strings.TrimSuffix(text, \"\\n\")\n\n\t\tif text == \"exit\" {\n\t\t\tfmt.Printf(\"quitting!\\n\")\n\t\t\tbreak\n\t\t}\n\t\tif len(text) != 0 {\n\t\t\tc.Say(twChan, text)\n\t\t}\n\t}\n\tc.Disconnect()\n}", "title": "" }, { "docid": "8d7a4226d97cca545ffaa51a0ffb6505", "score": "0.5725258", "text": "func (this *PendingWords) newLine() {\n\tthis.pending = append(this.pending, string(LineRune))\n}", "title": "" }, { "docid": "1949623499334be840007765a27c71ea", "score": "0.5712537", "text": "func Newline() {\n\tfmt.Printf(\"\\n\")\n}", "title": "" }, { "docid": "4cfecf48d22a5924c05128e46879ddb2", "score": "0.57108516", "text": "func (e *Editor) PrintLine(sym string) error {\n\tmsg := e.createAsyncTask(func() {\n\t\tif err := e.printLineInternal(sym); err != nil {\n\t\t\te.handleAsyncErr(err)\n\t\t}\n\t})\n\treturn e.send(e.ctx, msg)\n}", "title": "" }, { "docid": "4b9956d2b5404361a2d5d8d233741775", "score": "0.5675947", "text": "func sendCmd(cmd string) error {\n\tif !running {\n\t\treturn nil\n\t}\n\t_, e := fmt.Fprint(stdin, cmd)\n\t// if there was an error 'stop' the player\n\tif e != nil {\n\t\tStop()\n\t}\n\treturn e\n}", "title": "" }, { "docid": "296e1d866fdee7655bef35762afbe56c", "score": "0.5611108", "text": "func (socket *Socket) WriteLine(line string) error {\n\treturn socket.Write(line + \"\\r\\n\")\n}", "title": "" }, { "docid": "b1e925bf2ab62f43dd9d2c74bdd98ca7", "score": "0.5595984", "text": "func (c SMTPConnection) SendLine(line *string) error {\n\t_, err := fmt.Fprintf(c.Conn, \"%v\\r\\n\", line)\n\tfmt.Println(\">\" + *line + \"\\r\\n\")\n\treturn err\n}", "title": "" }, { "docid": "5ee8b50a9437d505aa58082aa9d55429", "score": "0.5585886", "text": "func (client *Client) SendTerminalSize(columns, rows int) error {\n\treturn client.signal(syscall.SIGWINCH, columns, rows)\n}", "title": "" }, { "docid": "a7f949828b3e8303b79cd3a1eec5f218", "score": "0.55074716", "text": "func (c ircConn) writeLine(line string) (err error) {\n\t_, err = c.w.WriteString(line)\n\tc.w.Flush()\n\treturn\n}", "title": "" }, { "docid": "e411aa55affac1cc73287bde3969b95e", "score": "0.54806113", "text": "func (t *Term) Write(b []byte) {\n\tt.tty.Write(b)\n}", "title": "" }, { "docid": "b800b9dca05ce4ed3b604b6e747e0d3b", "score": "0.5426513", "text": "func (t *Term) SendBreak() error {\n\treturn termios.Tcsendbreak(uintptr(t.fd), 0)\n}", "title": "" }, { "docid": "20476430be47effb6eb992830ff4dbcc", "score": "0.539788", "text": "func (s *Webhook) NewLine() string {\n\treturn \"\\n\"\n}", "title": "" }, { "docid": "9219a0297b1bb959c29b4ccdf8d22ac3", "score": "0.53786296", "text": "func (e *Escpos) gSend(m byte, fn byte, data []byte) {\n\tl := len(data) + 2\n\n\te.Write(\"\\x1b(L\")\n\te.WriteRaw([]byte{byte(l % 256), byte(l / 256), m, fn})\n\te.WriteRaw(data)\n}", "title": "" }, { "docid": "9219a0297b1bb959c29b4ccdf8d22ac3", "score": "0.53786296", "text": "func (e *Escpos) gSend(m byte, fn byte, data []byte) {\n\tl := len(data) + 2\n\n\te.Write(\"\\x1b(L\")\n\te.WriteRaw([]byte{byte(l % 256), byte(l / 256), m, fn})\n\te.WriteRaw(data)\n}", "title": "" }, { "docid": "4709233886ff0b3573fd90a88eaf60ba", "score": "0.5370817", "text": "func writeLine(buf *bytes.Buffer, words ...string) {\n\tbuf.WriteString(strings.Join(words, \" \") + \"\\n\")\n}", "title": "" }, { "docid": "663320dd61a842f89bb0df6de3b7cbb8", "score": "0.536081", "text": "func (t *transport) SendLine(line string) (err error) {\n\tif len(line) > 512 {\n\t\treturn ErrServerLineTooLong\n\t}\n\n\terr = t.conn.SetWriteDeadline(time.Now().Add(t.timeouts.write))\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = t.writer.Write([]byte(line + \"\\r\\n\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = t.writer.Flush()\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Debugf(\"Wrote: \\\"%v\\\"\", line)\n\treturn nil\n}", "title": "" }, { "docid": "8e8d1cc93603ba230f54cb4fc8087561", "score": "0.5352253", "text": "func SendClient(hc text.Editor, e key.Event) {\n\tif e.Direction == key.DirRelease {\n\t\treturn\n\t}\n\te = preProcess(e)\n\tdefer markDirt(hc)\n\tq0, q1 := hc.Dot()\n\tswitch e.Code {\n\tcase key.CodeEqualSign, key.CodeHyphenMinus:\n\t\tif e.Direction == key.DirRelease {\n\t\t\treturn\n\t\t}\n\n\t\tif e.Modifiers == key.ModControl {\n\t\t\treturn\n\t\t\tswitch hc := hc.(type) {\n\t\t\tcase *win.Win:\n\t\t\t\tdf := 2\n\t\t\t\tif key.CodeHyphenMinus == e.Code {\n\t\t\t\t\tdf = -2\n\t\t\t\t}\n\t\t\t\tif ft, ok := hc.Face().(*font.Resizer); ok {\n\t\t\t\t\thc.SetFont(ft.New(ft.Dy() + df))\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\tcase key.CodeUpArrow, key.CodePageUp, key.CodeDownArrow, key.CodePageDown:\n\t\tn := 1\n\t\tif e.Code == key.CodePageUp || e.Code == key.CodePageDown {\n\t\t\tn *= 10\n\t\t}\n\t\tif e.Code == key.CodeUpArrow || e.Code == key.CodePageUp {\n\t\t\tn = -n\n\t\t}\n\t\tif hc, ok := hc.(text.Scroller); ok {\n\t\t\thc.Scroll(n)\n\t\t}\n\t\t//\t\thc.Mark()\n\t\treturn\n\tcase key.CodeLeftArrow, key.CodeRightArrow:\n\t\tif e.Code == key.CodeLeftArrow {\n\t\t\tif e.Modifiers&key.ModShift == 0 {\n\t\t\t\tq1--\n\t\t\t}\n\t\t\tq0--\n\t\t} else {\n\t\t\tif e.Modifiers&key.ModShift == 0 {\n\t\t\t\tq0++\n\t\t\t}\n\t\t\tq1++\n\t\t}\n\t\thc.Select(q0, q1)\n\t\t//\t\thc.Mark()\n\t\treturn\n\t}\n\tswitch e.Rune {\n\tcase -1:\n\t\treturn\n\tcase '\\x01', '\\x05', '\\x08', '\\x15', '\\x17':\n\t\tif q0 == 0 && q1 == 0 {\n\t\t\treturn\n\t\t}\n\t\tif q0 == q1 && q0 != 0 {\n\t\t\tq0--\n\t\t}\n\t\tswitch e.Rune {\n\t\tcase '\\x15', '\\x01': // ^U, ^A\n\t\t\tp := hc.Bytes()\n\t\t\tif q0 < int64(len(p))-1 {\n\t\t\t\tq0++\n\t\t\t}\n\t\t\tn0, n1 := find.Findlinerev(hc.Bytes(), q0, 0)\n\t\t\tif e.Rune == '\\x15' {\n\t\t\t\thc.Delete(n0, n1)\n\t\t\t}\n\t\t\thc.Select(n0, n0)\n\t\tcase '\\x05': // ^E\n\t\t\t_, n1 := find.Findline3(hc.Bytes(), q1, 1)\n\t\t\tif n1 > 0 {\n\t\t\t\tn1--\n\t\t\t}\n\t\t\thc.Select(n1, n1)\n\t\tcase '\\x17':\n\t\t\tif find.Isany(hc.Bytes()[q0], find.AlphaNum) {\n\t\t\t\tq0 = find.Acceptback(hc.Bytes(), q0, find.AlphaNum)\n\t\t\t}\n\t\t\thc.Delete(q0, q1)\n\t\t\thc.Select(q0, q0)\n\t\tcase '\\x08':\n\t\t\tfallthrough\n\t\tdefault:\n\t\t\tif q0 > q1 {\n\t\t\t\tq0, q1 = q1, q0\n\t\t\t}\n\t\t\thc.Delete(q0, q1)\n\t\t\thc.Select(q0, q0)\n\t\t}\n\t\t//\t\thc.Mark()\n\t\treturn\n\t}\n\tch := []byte(string(e.Rune))\n\tif q1 != q0 {\n\t\thc.Delete(q0, q1)\n\t\t//\t\thc.Mark()\n\t\tq1 = q0\n\t}\n\tq1 += int64(hc.Insert(ch, q0))\n\tq0 = q1\n\thc.Select(q0, q1)\n\n}", "title": "" }, { "docid": "9e8a316c1af70b2c0857adac2e50aad8", "score": "0.53389746", "text": "func (t *terminal) ctrlK() {\n\tif t.position >= len(t.line) {\n\t\tdoBeep()\n\t} else {\n\t\tt.line = t.line[:t.position]\n\t\tt.needRefresh = true\n\t}\n}", "title": "" }, { "docid": "ca1dd67e3dad6398a808f1277e972e64", "score": "0.5272705", "text": "func (cp *ConsoleProcess) SendUnterminated(value string) {\n\t_, _ = cp.console.Send(value)\n}", "title": "" }, { "docid": "e05544f64c5a1f668334a63776b64f78", "score": "0.5259715", "text": "func writeLine(lines *bytes.Buffer, words ...string) {\n\tlines.WriteString(strings.Join(words, \" \") + \"\\n\")\n\tfmt.Printf(\"Handling iptables: %s\\n\", lines)\n}", "title": "" }, { "docid": "f7a135bbf9ca425a650a68013a77625f", "score": "0.52494764", "text": "func writeLine(buf *bytes.Buffer, words ...string) {\n\t// We avoid strings.Join for performance reasons.\n\tfor i := range words {\n\t\tbuf.WriteString(words[i])\n\t\tif i < len(words)-1 {\n\t\t\tbuf.WriteByte(' ')\n\t\t} else {\n\t\t\tbuf.WriteByte('\\n')\n\t\t}\n\t}\n}", "title": "" }, { "docid": "80661de64e5fa8343449307048fc693b", "score": "0.52042985", "text": "func (p *remoteDisplay) WriteLine(line []string) {\n\tp.errorFatal()\n\tp.Err = p.PtrRPC.Call(\"DisplayServer.WriteLine\", line, nil)\n}", "title": "" }, { "docid": "54ccd399b35acf4a64c59d19f874dc36", "score": "0.5167536", "text": "func (s *BasetlListener) EnterSendKey(ctx *SendKeyContext) {}", "title": "" }, { "docid": "0d360a295f129b32e8f73f4b946e371c", "score": "0.515945", "text": "func (r *Render) BreakLine(buf *Buffer, cancelled bool) {\n\tr.outputLock.Lock()\n\tdefer r.outputLock.Unlock()\n\n\t// Erasing and Render\n\tdoc := buf.Document()\n\teditPoint := doc.CursorDisplayCoordWithPrefix(r.termWidth, r.getPrefix)\n\tr.promptHome(editPoint)\n\tr.out.EraseDown()\n\tr.renderPrompt(doc, true, cancelled)\n\tdebug.AssertNoError(r.out.Flush())\n\n\tr.previousCursor = Coord{}\n\tr.previousLineCount = 1\n}", "title": "" }, { "docid": "795ab1e46ec54a5c74ec349612b0619f", "score": "0.5151583", "text": "func writeLine(x, y int, fg, bg termbox.Attribute, line string) {\n\twidth, _ := termbox.Size()\n\n\tfor _, c := range line {\n\t\ttermbox.SetCell(x, y, c, fg, bg)\n\t\tx++\n\t}\n\tfor i := x; i < width; i++ {\n\t\ttermbox.SetCell(x+i, y, ' ', fg, bg)\n\t}\n}", "title": "" }, { "docid": "9a63c3358a9e6a13134650999e9af2ed", "score": "0.51513535", "text": "func syncClipoard(text string) {\n\tif !setClipboard(text) {\n\t\treturn\n\t}\n\n\tif stream == nil {\n\t\tprintToConsole(\"Client: No connection to a server is open, unable to send clipboard\")\n\t\treturn\n\t}\n\n\terr := stream.Send(&pb.Clipboard{Data: text})\n\tif err != nil {\n\t\tprintToConsole(fmt.Sprintf(\"Client: Error sending clipboard: %s\", err))\n\t\treturn\n\t}\n\n\tprintToConsole(\"Client: New clipboard sent\")\n}", "title": "" }, { "docid": "1e9dea5f935813b26a2d20480605ad9e", "score": "0.51467586", "text": "func (v *View) EditNewLine() {\n\n\trx, ry, _ := v.realPosition(v.cx, v.cy)\n\tv.Actions.Exec(NewNewLineCmd(v, rx, ry))\n\n\tv.breakLine(v.cx, v.cy)\n\n\ty := v.oy + v.cy\n\tif y >= len(v.viewLines) || (y >= 0 && y < len(v.viewLines) &&\n\t\t!(v.Wrap && v.cx == 0 && v.viewLines[y].linesX > 0)) {\n\t\t// new line at the end of the buffer or\n\t\t// cursor is not at the beginning of a wrapped line\n\t\tv.ox = 0\n\t\tv.cx = 0\n\t\tv.MoveCursor(0, 1, true)\n\t}\n}", "title": "" }, { "docid": "644aad8a1782176e6ebcc675ba87ed20", "score": "0.5121839", "text": "func (c *Client) SendText(sequence string) error {\n\tif c.session.State != SessionActive {\n\t\treturn ErrNotConnected\n\t}\n\n\tfor _, ch := range sequence {\n\t\tkeycode := strconv.Itoa(int(ch))\n\t\terr := c.session.Send(protocol.NewInstruction(\"key\", keycode, \"1\"))\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\t\terr = c.session.Send(protocol.NewInstruction(\"key\", keycode, \"0\"))\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8dde5f0674c13d80cd0570306a14f9c2", "score": "0.5104506", "text": "func (s *SQLBuilder) NewLine() {\n\ts.write([]byte{'\\n'})\n\ts.write(bytes.Repeat([]byte{' '}, s.ident))\n}", "title": "" }, { "docid": "44336e9442ffed693b883273bf73aead", "score": "0.50935", "text": "func (t *Tail) SendLines(lines chan string, shutdown Shutdown) error {\n\treturn t.ProcessLines(func(l string) error{\n\t\tselect {\n\t\tcase lines <- l:\n\t\t\treturn nil\n\t\tcase <-shutdown.Dying():\n\t\t\treturn ErrTailShutdown\n\t\t}\n\t})\n}", "title": "" }, { "docid": "0a8aa38e0416e28bd9f046f1649292e5", "score": "0.50901884", "text": "func (remote *RemoteDebugger) SendRune(c rune) error {\n\tif _, err := remote.SendRequest(\"Input.dispatchKeyEvent\", Params{\n\t\t\"type\": \"rawKeyDown\",\n\t\t\"windowsVirtualKeyCode\": int(c),\n\t\t\"nativeVirtualKeyCode\": int(c),\n\t\t\"unmodifiedText\": string(c),\n\t\t\"text\": string(c),\n\t}); err != nil {\n\t\treturn err\n\t}\n\tif _, err := remote.SendRequest(\"Input.dispatchKeyEvent\", Params{\n\t\t\"type\": \"char\",\n\t\t\"windowsVirtualKeyCode\": int(c),\n\t\t\"nativeVirtualKeyCode\": int(c),\n\t\t\"unmodifiedText\": string(c),\n\t\t\"text\": string(c),\n\t}); err != nil {\n\t\treturn err\n\t}\n\t_, err := remote.SendRequest(\"Input.dispatchKeyEvent\", Params{\n\t\t\"type\": \"keyUp\",\n\t\t\"windowsVirtualKeyCode\": int(c),\n\t\t\"nativeVirtualKeyCode\": int(c),\n\t\t\"unmodifiedText\": string(c),\n\t\t\"text\": string(c),\n\t})\n\treturn err\n}", "title": "" }, { "docid": "f0b9014958e3d50f9aa633af98825846", "score": "0.5088239", "text": "func main() {\n\tserverPort := flag.String(\"p\", \"9090\", \"port\")\n\tserverHost := flag.String(\"h\", \"127.0.0.1\", \"host\")\n\tflag.Parse()\n\n\tconn, _ := net.Dial(\"tcp\", *serverHost+\":\"+*serverPort)\n\tfmt.Printf(\"Client connect to -> \" + *serverHost + \":\" + *serverPort + \"\\n\")\n\tfmt.Println(\"Please enter the command:\")\n\tfor {\n\t\treader := bufio.NewReader(os.Stdin)\n\t\ttext, _ := reader.ReadString('\\n')\n\t\tfmt.Print(\"Text to send: \" + text)\n\t\t_, err := fmt.Fprintf(conn, text)\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t\tmessage, _ := bufio.NewReader(conn).ReadString('\\n')\n\t\tfmt.Print(\"Server response: \" + message)\n\t}\n}", "title": "" }, { "docid": "63fd8eeae046726e34d9f763e4e5680a", "score": "0.5085481", "text": "func (r *renderer) printStyledLine(targetScreen tcell.Screen, message string, style tcell.Style, x, y int) {\n\tnextX := x\n\tfor _, char := range message {\n\t\ttargetScreen.SetContent(nextX, y, char, nil, style)\n\t\tnextX++\n\t}\n}", "title": "" }, { "docid": "493eba670d67d554f9ab86fdc421d914", "score": "0.50823843", "text": "func (t *instance) Write(key []byte) error {\n\tt.pty.logger.Debugf(\"Terminal Instance Write\", key)\n\n\tif t.pty == nil {\n\t\treturn errors.New(\"can not execute command, no stdin\")\n\t}\n\tt.pty.keystroke <- key\n\n\treturn nil\n}", "title": "" }, { "docid": "493eba670d67d554f9ab86fdc421d914", "score": "0.50823843", "text": "func (t *instance) Write(key []byte) error {\n\tt.pty.logger.Debugf(\"Terminal Instance Write\", key)\n\n\tif t.pty == nil {\n\t\treturn errors.New(\"can not execute command, no stdin\")\n\t}\n\tt.pty.keystroke <- key\n\n\treturn nil\n}", "title": "" }, { "docid": "fdf7377061f1e2c75da758206c222092", "score": "0.50758463", "text": "func send(str string) {\n\t_, err := fmt.Fprintf(conn, \"%s\", str)\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n}", "title": "" }, { "docid": "5f8f386610c1ac9c6d44ec3063e29040", "score": "0.50664234", "text": "func (t *terminal) ctrlD() {\n\tif t.position == 0 && len(t.line) == 0 {\n\t\tt.eof = true\n\t\treturn\n\t}\n\n\tif t.position >= len(t.line) {\n\t\tdoBeep()\n\t} else {\n\t\tt.line = append(t.line[:t.position], t.line[t.position+1:]...)\n\t\tt.needRefresh = true\n\t}\n}", "title": "" }, { "docid": "265acbe89281d5ec7a61e079b2b6ac87", "score": "0.5055603", "text": "func newLine() []byte {\n\tconst (\n\t\tCR = \"\\r\"\n\t\tLF = \"\\n\"\n\t)\n\tswitch runtime.GOOS {\n\tcase \"windows\":\n\t\treturn []byte(CR + LF)\n\tcase \"linux\":\n\t\tfallthrough\n\tdefault:\n\t\treturn []byte(LF)\n\t}\n}", "title": "" }, { "docid": "3df8736c59bc33be23b0dcdcc5b17f11", "score": "0.504724", "text": "func (ib *InputBox) Append(letter rune) {\n\tib.Txt += string(letter)\n}", "title": "" }, { "docid": "761cf876259491b83a258455452094e9", "score": "0.5046298", "text": "func (cs *CursorState) NewLine() ansi.Seq {\n\tcs.Y++\n\tcs.X = 1\n\treturn ansi.Escape('\\r').With('\\n')\n}", "title": "" }, { "docid": "07d2831a28a4d150b6940167e2b772db", "score": "0.5043791", "text": "func typeOutLine(line string, charDelay time.Duration) {\n\tfor _, c := range line {\n\t\tfmt.Printf(string(c))\n\t\ttime.Sleep(charDelay)\n\t}\n}", "title": "" }, { "docid": "ab30d1c959c933636f33419858eb4d42", "score": "0.50432366", "text": "func clearLine() {\n\tfmt.Printf(\"\\033[2K\")\n}", "title": "" }, { "docid": "62886455530b483f096ea546e77bcd48", "score": "0.50415784", "text": "func (t *terminal) ctrlT() {\n\tif len(t.line) < 2 || t.position < 1 {\n\t\tdoBeep()\n\t} else {\n\t\tif t.position == len(t.line) {\n\t\t\tt.position--\n\t\t}\n\t\tt.line[t.position-1], t.line[t.position] = t.line[t.position], t.line[t.position-1]\n\t\tt.position++\n\t\tt.needRefresh = true\n\t}\n}", "title": "" }, { "docid": "ad5e4a61d333b615bfc937b190a18edb", "score": "0.50396043", "text": "func (cmd *Cmd) Prompt(s string) {\n\tcmd.out.WriteString(s)\n\tcmd.out.Flush()\n}", "title": "" }, { "docid": "23ac54a6db7ffda5083d1fe806164d15", "score": "0.503658", "text": "func (t *terminal) ctrlH() {\n\tif t.position <= 0 {\n\t\tdoBeep()\n\t} else {\n\t\tt.line = append(t.line[:t.position-1], t.line[t.position:]...)\n\t\tt.position--\n\t\tt.needRefresh = true\n\t}\n}", "title": "" }, { "docid": "50a8d6f6542c5ed3b77bcf3a153fb056", "score": "0.50242037", "text": "func (this *CursorOutput) AddLine() {\n\tline := this.pending.String()\n\tthis.lines = append(this.lines, line)\n\tthis.pending = new(bytes.Buffer)\n\tthis.ResetCursor()\n}", "title": "" }, { "docid": "81a305b639b3c1c0594ffadcf09a74a1", "score": "0.4974189", "text": "func PostLineMsg(id, msg string) error {\n\tbot = GetLinebot()\n\t_, err = bot.PushMessage(id, linebot.NewTextMessage(msg)).Do()\n\treturn err\n}", "title": "" }, { "docid": "2c103643b676031e7ac9fb53ee4bf0d6", "score": "0.4954076", "text": "func (t *terminal) delete() {\n\tif t.position >= len(t.line) {\n\t\tdoBeep()\n\t} else {\n\t\tt.line = append(t.line[:t.position], t.line[t.position+1:]...)\n\t}\n}", "title": "" }, { "docid": "764a28e40ad33df000945091edcc5382", "score": "0.49497628", "text": "func (n *CATIfication) Send() error {\n\tr := fmt.Sprint(n.Rate)\n\tcmd := exec.Command(\"say\", \"-v\", n.Voice, \"-r\", r, n.Text)\n\tcmd.Stderr = os.Stderr\n\treturn cmd.Run()\n}", "title": "" }, { "docid": "c31f5cdede244b7716a8221187263565", "score": "0.49461052", "text": "func (t *terminal) ctrlR() {\n\tmatches := find(string(t.line[:t.position]), t.history)\n\n\tif len(matches) > 0 {\n\t\tif t.ctrlRSearches >= len(matches) {\n\t\t\tt.ctrlRSearches = 0\n\t\t}\n\n\t\tt.line = []rune(matches[t.ctrlRSearches])\n\t\tt.ctrlRSearches++\n\t\tt.needRefresh = true\n\n\t} else {\n\t\tdoBeep()\n\t}\n}", "title": "" }, { "docid": "3a563e2e9c3ff7e2cdc444e441b0a968", "score": "0.49275768", "text": "func (device *LCD16x2Bricklet) WriteLine(line uint8, position uint8, text string) (err error) {\n\tvar buf bytes.Buffer\n\tbinary.Write(&buf, binary.LittleEndian, line)\n\tbinary.Write(&buf, binary.LittleEndian, position)\n\ttext_byte_slice, err := StringToByteSlice(text, 16)\n\tif err != nil {\n\t\treturn\n\t}\n\tbuf.Write(text_byte_slice)\n\n\tresultBytes, err := device.device.Set(uint8(FunctionWriteLine), buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(resultBytes) > 0 {\n\t\tvar header PacketHeader\n\n\t\theader.FillFromBytes(resultBytes)\n\n\t\tif header.Length != 8 {\n\t\t\treturn fmt.Errorf(\"Received packet of unexpected size %d, instead of %d\", header.Length, 8)\n\t\t}\n\n\t\tif header.ErrorCode != 0 {\n\t\t\treturn DeviceError(header.ErrorCode)\n\t\t}\n\n\t\tbytes.NewBuffer(resultBytes[8:])\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ef42836bf6ebb25b29afb642ad1557c4", "score": "0.49204645", "text": "func SendStdin(client ts.Client, topic string) error {\n\tvar err error\n\tch, err := client.CreateChannel(topic)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer ch.Close()\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfor scanner.Scan() {\n\t\tmessage := scanner.Text()\n\t\tch.Send(message)\n\t\tfmt.Println(message)\n\t}\n\tif err = scanner.Err(); err != nil {\n\t\treturn err\n\t}\n\tfmt.Fprintln(os.Stderr, \"Stream done, closing connection\")\n\treturn err\n}", "title": "" }, { "docid": "052498b09169f1ec74e33f4197aad390", "score": "0.4912591", "text": "func (b *Buffer) appendLine(val string) {\n\tb.modified = true\n\n\tb.table.Lines = append(b.table.Lines, piecetable.NewLine(val, b.table))\n\t// because we've added a new line\n\t// we have to set the x to the start\n\tb.curs.x = 0\n}", "title": "" }, { "docid": "eeae7ed3861fccd4dc418c06160dd2b3", "score": "0.49103072", "text": "func (cp *ConsoleProcess) SendCtrlC() {\n\tcp.SendUnterminated(string([]byte{0x03})) // 0x03 is ASCII character for ^C\n}", "title": "" }, { "docid": "27698031df6021367b763e0d0adb4d0b", "score": "0.4906246", "text": "func (c *Command) SendInput(p []byte, end bool) error {\n\tclient := c.shell.Client()\n\tif len(p) > client.SendInputMax() {\n\t\treturn fmt.Errorf(\"p is too large\")\n\t}\n\tmessageID, err := uuid.NewV4()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error generating uuid: %w\", err)\n\t}\n\trequestBody := soap.SendInputRequest(\n\t\tclient.URL(), client.ZenParametersConst().EnvelopeSize,\n\t\tclient.defaultOperationTimeoutSeconds, messageID,\n\t\tc.shell.ID(), c.id, p,\n\t\tend)\n\n\tlog.WithFields(log.Fields{\n\t\tLogFieldCommandID: c.id,\n\t\t\"end\": end,\n\t}).Debugf(\"sending %d bytes of input\", len(p))\n\t_, err = client.doPost(requestBody)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error sending input to command %s: %w\", c.id, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d60ef6dc4651ebf331f62ebf1ad04bc9", "score": "0.49055335", "text": "func (state *State) printLn(text string) {\n\ttext += \"\\n\"\n\taddress := state.assembler.AddString(text)\n\tstate.assembler.MoveRegisterNumber(state.registers.Syscall[0], uint64(syscall.Write))\n\tstate.assembler.MoveRegisterNumber(state.registers.Syscall[1], 1)\n\tstate.assembler.MoveRegisterAddress(state.registers.Syscall[2], address)\n\tstate.assembler.MoveRegisterNumber(state.registers.Syscall[3], uint64(len(text)))\n\tstate.assembler.Syscall()\n}", "title": "" }, { "docid": "978d57f5d2b5b1dde2bd04f9696075ab", "score": "0.49032983", "text": "func (e *Escpos) SendEmphasize() {\n\te.Write(fmt.Sprintf(\"\\x1BG%c\", e.emphasize))\n}", "title": "" }, { "docid": "978d57f5d2b5b1dde2bd04f9696075ab", "score": "0.49032983", "text": "func (e *Escpos) SendEmphasize() {\n\te.Write(fmt.Sprintf(\"\\x1BG%c\", e.emphasize))\n}", "title": "" }, { "docid": "b01b832e0e5b9d93c3e5d043ebba7a14", "score": "0.48850098", "text": "func (ic *IrcClient) SendCommand(c *Command) {\n\tfmt.Fprint(ic.Conn, c)\n}", "title": "" }, { "docid": "ba78401addf7993b8587170f210c9aee", "score": "0.48704162", "text": "func (t *terminal) ctrlU() {\n\tt.line = t.line[t.position:]\n\tt.position = 0\n\tt.needRefresh = true\n}", "title": "" }, { "docid": "89586a169a6de6604f2e22c5e07cec7b", "score": "0.4865185", "text": "func send(node *noise.Node, overlay *kademlia.Protocol, line []byte) {\n\tfor _, id := range overlay.Table().Peers() {\n\t\tctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n\t\terr := node.SendMessage(ctx, id.Address, network.Script{Contents: line})\n\t\tcancel()\n\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Failed to send message to %s(%s). Skipping... [error: %s]\\n\",\n\t\t\t\tid.Address,\n\t\t\t\tid.ID.String()[:printedLength],\n\t\t\t\terr,\n\t\t\t)\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "daafc25c65367fdcd1c06951e90857ed", "score": "0.48651597", "text": "func (p *pty) Write(b []byte) (int, error) {\n\tp.logger.Debugf(\"Starting Terminal Instance Write \", b)\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tdefer p.activityFunc()\n\n\treturn p.out.Write(b)\n}", "title": "" }, { "docid": "daafc25c65367fdcd1c06951e90857ed", "score": "0.48651597", "text": "func (p *pty) Write(b []byte) (int, error) {\n\tp.logger.Debugf(\"Starting Terminal Instance Write \", b)\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tdefer p.activityFunc()\n\n\treturn p.out.Write(b)\n}", "title": "" }, { "docid": "38a09be1353e1befb61c688f0fffff0b", "score": "0.486216", "text": "func writeData() {\n\n\t// Buffer reading from chat\n\tstdReader := bufio.NewReader(os.Stdin)\n\n\t// Keep reading\n\tfor {\n\n\t\t// Wait and read last line\n\t\tline, err := stdReader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\t// Set default prompt\n\t\tfmt.Print(chat.ID(), \" \")\n\n\t\t// An empty line writes a prompt locally but does not send anything\n\t\tif strings.Trim(line, \"\\n\") == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Remove linebreak and check leading backslash for a chat command\n\t\tif strings.HasPrefix(strings.Trim(line, \"\\n\"), \"\\\\\") {\n\t\t\texecuteCommand(line)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Loop over all connected writers\n\t\tfor _, rx := range readWriters {\n\n\t\t\t// Write sender's ID and the last line written\n\t\t\trx.WriteString(fmt.Sprintf(\"%v %s\", chat.ID(), line))\n\t\t\trx.Flush()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cc0256e8e90748346b37b3f2769fb484", "score": "0.48487473", "text": "func main() {\n\tmessages := make(chan string, 1)\n\tgo send(messages, \"Jeff\")\n\treceive(messages)\n\tfor _, char := range \"test\" {\n\t\tfmt.Println(char)\n\t}\n}", "title": "" }, { "docid": "7e66991033ebc488de77c2d30d3dc238", "score": "0.4846387", "text": "func (r *renderer) printLine(targetScreen tcell.Screen, message string, x, y int) {\n\tr.printStyledLine(targetScreen, message, tcell.StyleDefault, x, y)\n}", "title": "" }, { "docid": "7e4a39600c75fc21e84c3b4f67946081", "score": "0.4846313", "text": "func (s *BaseitnListener) EnterLine(ctx *LineContext) {}", "title": "" }, { "docid": "00b285f4e8cebea9c833ae59676b4003", "score": "0.48388934", "text": "func readTerminalInput(channel chan<- string) {\n\tfor {\n\t\t// read input from terminal\n\t\treader := bufio.NewReader(os.Stdin)\n\t\tmsg, err := reader.ReadString('\\n')\n\n\t\tif err != nil {\n\t\t\tprint(\"Something went wrong\\n\")\n\t\t\tbreak\n\t\t}\n\n\t\t// write input to channel\n\t\tmsgWithTimestamp := msg[:len(msg)-1] + strconv.FormatInt(time.Now().Unix(), 10) + \"\\n\"\n\t\tchannel <- msgWithTimestamp\n\t}\n}", "title": "" }, { "docid": "00ea37e4bd7140122760331c1a013cc7", "score": "0.48255494", "text": "func ConsoleInput(channel chan string) {\n\treader := bufio.NewReader(os.Stdin)\n\tfor {\n\t\t//fmt.Printf(\"[%s] Input message: \", time.Now().Format(DateTimeFormat))\n\t\tfmt.Print(\"Input message: \")\n\t\tmsg, _ := reader.ReadString('\\n')\n\t\tmsg = strings.TrimSuffix(msg, \"\\n\")\n\t\tchannel <- msg\n\t}\n}", "title": "" }, { "docid": "26dfc5ebca693b8887856a53c42a1ff2", "score": "0.4824854", "text": "func kputc(c *Client, ch rune) {\n\tc.kbd.r[c.kbd.wi] = ch\n\tc.kbd.wi++\n\tif c.kbd.wi == len(c.kbd.r) {\n\t\tc.kbd.wi = 0\n\t}\n\tif c.kbd.ri == c.kbd.wi {\n\t\tc.kbd.stall = 1\n\t}\n\tmatchkbd(c)\n}", "title": "" }, { "docid": "2bbfd0bcdbf0e6b914d9e6934bb1c4de", "score": "0.48202035", "text": "func (c *Client) send(msg *ircparse.Message) {\n\tif c.isTerminated {\n\t\treturn\n\t}\n\n\ts := msg.String()\n\n\tif c.sendqCur+uint(len(s)) > c.sendqMax {\n\t\tc.terminate(\"sendq exceeded\")\n\t\treturn\n\t}\n\n\tc.sendqCur += uint(len(s))\n\tc.txChan <- s\n}", "title": "" }, { "docid": "001718ba5070300d523de2cccfc34ac6", "score": "0.48147693", "text": "func (p *Peer) writeClient(conn net.Conn) {\n\tfor {\n\t\tfmt.Print(\"> \")\n\t\treader := bufio.NewReader(os.Stdin)\n\t\tm, err := reader.ReadString('\\n')\n\t\tif err != nil || m == \"quit\\n\" { \n\t\t\treturn \n\t\t}\n\t\tp.outbound<- m \n\t}\n}", "title": "" }, { "docid": "53f27ec0911486379477200afcddb3bf", "score": "0.4806748", "text": "func (w *winWin) addtype(c rune, p0 int, text []rune) {\n\tfor _, r := range text {\n\t\tif (r == 0x7F || r == 3) && c == 'K' { // del and ^c from keyboard\n\t\t\tw.rcpty.Write([]byte{byte(r)})\n\t\t\t/* toss all typing */\n\t\t\tw.p += len(w.typing) + len(text)\n\t\t\tw.typing = w.typing[0:0]\n\t\t\tw.ntypebreak = 0\n\t\t\t/* buglet: more than one delete ignored */\n\t\t\treturn\n\t\t}\n\t\tif r == '\\n' || r == 0x04 {\n\t\t\tw.ntypebreak++\n\t\t}\n\t}\n\tw.typing = append(append(w.typing[0:p0], text...), w.typing[p0:]...)\n}", "title": "" }, { "docid": "e7bd56d7814367d0a691be6973fcc201", "score": "0.48014027", "text": "func (r *Relay) RelayLine(l string) {\n\tlineLength := uint(len(l))\n\tif lineLength == 0 {\n\t\tlevel.Debug(r.logger).Log(\"msg\", \"Empty line, not relaying\")\n\t\treturn\n\t}\n\tif lineLength > r.packetLength-1 {\n\t\tlevel.Warn(r.logger).Log(\"msg\", \"line too long, not relaying\", \"length\", lineLength, \"max\", r.packetLength)\n\t\tr.longLinesTotal.Inc()\n\t\treturn\n\t}\n\tlevel.Debug(r.logger).Log(\"msg\", \"Relaying line\", \"line\", string(l))\n\tif !strings.HasSuffix(l, \"\\n\") {\n\t\tl = l + \"\\n\"\n\t}\n\tr.relayedLinesTotal.Inc()\n\tr.bufferChannel <- []byte(l)\n}", "title": "" }, { "docid": "d8036288f3e5683ce39200948ca199dd", "score": "0.47890168", "text": "func ClearLine() {\n\tif IsTTY && HasColour {\n\t\tfmt.Print(\"\\033[1G\\033[2K\")\n\t} else {\n\t\tfmt.Println()\n\t}\n}", "title": "" }, { "docid": "9c259bc94b72b156c835aab330d0da48", "score": "0.4782862", "text": "func goditorRowInsertChar(char key) {\n\twriteToTerminal(string(char))\n}", "title": "" }, { "docid": "1f139e05ad23cebc2ea85394168d7f17", "score": "0.477301", "text": "func (a *newCharacter) newCharacterDisplay() {\n\ta.buf.Send(\"Enter your characters name or just press enter to cancel:\")\n\ta.nextFunc = a.charNameProcess\n}", "title": "" }, { "docid": "43e8eaf6e897d2e46e2c407acd554c98", "score": "0.47711572", "text": "func send(c *cli.Context) error {\n\tclient, err := echo.NewClient(c.String(\"addr\"), c.String(\"name\"))\n\tif err != nil {\n\t\treturn exit(\"could not create client\", err)\n\t}\n\tdefer client.Shutdown()\n\n\tvar timeout time.Duration\n\tif timeout, err = time.ParseDuration(c.String(\"timeout\")); err != nil {\n\t\treturn exit(\"\", err)\n\t}\n\n\tif err = client.Connect(timeout); err != nil {\n\t\treturn exit(\"\", err)\n\t}\n\n\tfor _, msg := range c.Args() {\n\t\tif err := client.Send(msg); err != nil {\n\t\t\texit(\"\", err)\n\t\t}\n\t}\n\n\treturn client.Close()\n}", "title": "" }, { "docid": "1ab63abb94ea4480018ac64d3b9931fa", "score": "0.47641736", "text": "func captureInput(token string, stream api.ChatService_BroadcastClient) {\n\tr := bufio.NewReader(os.Stdin)\n\tfor {\n\t\tfmt.Print(\"You're saying: \")\n\t\tinput, err := r.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tlog.Printf(\"error while trying to read stdin: %s\\n\", err)\n\t\t}\n\t\terr = stream.Send(&api.BroadcastRequest{\n\t\t\tToken: token,\n\t\t\tContent: input,\n\t\t})\n\t\tif err != nil {\n\t\t\tlog.Printf(\"error while sending message to server: %s\\n\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0187cf2f6f7c510e4448cc3b5d3b31b7", "score": "0.4762257", "text": "func lexTextNewLine(l *lexer) {\r\n\tif (l.pos + len(br)) > len(l.input) {\r\n\t\tl.emit(itemEOF)\r\n\t\tos.Exit(0)\r\n\t}\r\n\tif l.input[l.pos - 2:l.pos + len(br)] == string(hardBr) {\r\n\t\tl.backupNSpaces(2)\r\n\t\tif (l.pos > l.start) {\r\n\t\t\tl.emit(itemText)\r\n\t\t}\r\n\t\tl.nextNTimes(len(hardBr))\r\n\t\tl.ignore()\t// Ignore literal \\r\\n chars\r\n\t\tl.emit(itemHardNewLine)\r\n\t} else {\r\n\t\tif l.pos > l.start {\r\n\t\t\tl.emit(itemText)\r\n\t\t}\r\n\t\tl.nextNTimes(len(br))\r\n\t\tl.ignore()\r\n\t\tl.emit(itemNewLine)\r\n\t}\r\n}", "title": "" }, { "docid": "713a47028cfe31dd770ab347b991f0b3", "score": "0.47602183", "text": "func sendMessage(ch chan<- string) {\n\tfor i := 0; i < 20; i++ { \n\t\tch <- fmt.Sprintf(\"data %d\", i) \n\t}\n\n\tclose(ch)\n}", "title": "" }, { "docid": "133e5cecc408f08afb7ca312fb21361c", "score": "0.4759919", "text": "func (t *Term) ClearLine() {\n\tt.Return()\n\tt.Clear()\n}", "title": "" }, { "docid": "da91de171a15393753bc07af0b9d6b90", "score": "0.47500956", "text": "func (r *Run) sendMountCommand(args ...string) {\n\tr.cmdMu.Lock()\n\tdefer r.cmdMu.Unlock()\n\ttx := strings.Join(args, \"\\t\")\n\t// log.Printf(\"Send mount command: %q\", tx)\n\tvar rx string\n\tif r.useVFS {\n\t\t// if using VFS do the VFS command directly\n\t\trx, _ = doMountCommand(r.os.(vfsOs).VFS, tx)\n\t} else {\n\t\t_, err := io.WriteString(r.out, tx+\"\\n\")\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"WriteString err %v\", err)\n\t\t}\n\t\tif !r.scanner.Scan() {\n\t\t\tlog.Fatalf(\"Mount has gone away\")\n\t\t}\n\t\trx = strings.Trim(r.scanner.Text(), \"\\r\\n\")\n\t}\n\tin := strings.Split(rx, \"\\t\")\n\t// log.Printf(\"Answer is %q\", in)\n\tif in[0] != \"OK\" {\n\t\tlog.Fatalf(\"Error from mount: %q\", in[1:])\n\t}\n}", "title": "" }, { "docid": "3817fa6fd15de5bc86252888c3b81efa", "score": "0.47478703", "text": "func (lobby *Lobby) AppendLine(line *LineEvent) {\n\tlobby.CurrentDrawing = append(lobby.CurrentDrawing, line)\n}", "title": "" }, { "docid": "87d408ba187b33e70fb9f25e20d82431", "score": "0.47356582", "text": "func enterString(ctx context.Context, kb *input.KeyboardEventWriter, textToType string) error {\n\ttesting.ContextLogf(ctx, \"Typing %q\", textToType)\n\tif err := kb.Type(ctx, textToType); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to type %q\", textToType)\n\t}\n\tif err := kb.Accel(ctx, \"enter\"); err != nil {\n\t\treturn errors.Wrap(err, \"failed to press enter key\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0129885a136890025beb9527785ee4fe", "score": "0.47300917", "text": "func (ui *DefaultUi) PrintLine(str string, x int, y int) int {\n\t// strWidth is the total width of the string\n\tstrWidth := 0\n\n\twidth, _ := termbox.Size()\n\n\tfor len(str) > 0 {\n\t\tc, w := utf8.DecodeRuneInString(str)\n\t\tif c == utf8.RuneError {\n\t\t\tc = '?'\n\t\t\tw = 1\n\t\t}\n\n\t\tstr = str[w:]\n\n\t\ttermbox.SetCell(x, y, c, ui.Fg, ui.Bg)\n\n\t\tx += runewidth.RuneWidth(c)\n\t\tstrWidth += runewidth.RuneWidth(c)\n\t}\n\n\tblankPosition := strWidth\n\n\t// print blank into the rest of line.\n\tfor blankPosition < width {\n\t\ttermbox.SetCell(blankPosition, y, ' ', ui.Fg, ui.Bg)\n\t\tblankPosition++\n\t}\n\n\treturn strWidth\n}", "title": "" }, { "docid": "7a0a2fcb8b618a6d3a0184f25fad1ec9", "score": "0.47284427", "text": "func (t *Terminal) NewLine() Line {\n\tt.mtx.Lock()\n\tdefer t.mtx.Unlock()\n\n\trow := &TerminalLine{terminal: t}\n\tt.rows = append(t.rows, row)\n\treturn row\n}", "title": "" }, { "docid": "e465766ef66999ba1f80cab0d1271371", "score": "0.47251233", "text": "func newlineDoctor(text []byte) []byte {\n for i, c := range text {\n if c == '\\r' {\n text[i] = '\\n'\n }\n }\n return text\n}", "title": "" }, { "docid": "0a2114f5a47c93b38224f4993f514dbc", "score": "0.47241548", "text": "func (v *TextIter) SetLine(v1 int) {\n\tC.gtk_text_iter_set_line(v.native(), C.gint(v1))\n}", "title": "" }, { "docid": "b086f6c1f7d9a987a9d41c103a474533", "score": "0.472267", "text": "func PressAnyKeyToContinue(text string) error {\n\tfmt.Print(text)\n\t_, err := bufio.NewReader(os.Stdin).ReadBytes('\\n')\n\treturn err\n}", "title": "" }, { "docid": "a6ecfa18f7661c8250f8925a8cc06ca8", "score": "0.47221345", "text": "func main() {\n\treader := bufio.NewReader(os.Stdin)\n\tfmt.Print(\"Enter text: \")\n\ttext, err := reader.ReadString('\\n')\n\tif err != nil {\n\t\tlog.Fatal(\"Error:\", err)\n\t}\n\tfmt.Println(text)\n}", "title": "" } ]
851ee22dea4d3f69d9c6e9ef34540c21
Upsert attempts an insert using an executor, and does an update or ignore on conflict.
[ { "docid": "08a457badd2523a298bb80b30eb26909", "score": "0.0", "text": "func (o *CollectionI18n) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"mdbmdbmodels: no collection_i18n provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(collectionI18nColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tcollectionI18nUpsertCacheMut.RLock()\n\tcache, cached := collectionI18nUpsertCache[key]\n\tcollectionI18nUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\tcollectionI18nColumns,\n\t\t\tcollectionI18nColumnsWithDefault,\n\t\t\tcollectionI18nColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tcollectionI18nColumns,\n\t\t\tcollectionI18nPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"mdbmdbmodels: unable to upsert collection_i18n, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(collectionI18nPrimaryKeyColumns))\n\t\t\tcopy(conflict, collectionI18nPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"collection_i18n\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(collectionI18nType, collectionI18nMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(collectionI18nType, collectionI18nMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mdbmdbmodels: unable to upsert collection_i18n\")\n\t}\n\n\tif !cached {\n\t\tcollectionI18nUpsertCacheMut.Lock()\n\t\tcollectionI18nUpsertCache[key] = cache\n\t\tcollectionI18nUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "1841daa21b3ffdbb6a80bc6b0148c44f", "score": "0.6991177", "text": "func (o *Blob) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"db: no blobs provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\to.UpdatedAt = currTime\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(blobColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tblobUpsertCacheMut.RLock()\n\tcache, cached := blobUpsertCache[key]\n\tblobUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tblobAllColumns,\n\t\t\tblobColumnsWithDefault,\n\t\t\tblobColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tblobAllColumns,\n\t\t\tblobPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"db: unable to upsert blobs, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(blobPrimaryKeyColumns))\n\t\t\tcopy(conflict, blobPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"blobs\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(blobType, blobMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(blobType, blobMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"db: unable to upsert blobs\")\n\t}\n\n\tif !cached {\n\t\tblobUpsertCacheMut.Lock()\n\t\tblobUpsertCache[key] = cache\n\t\tblobUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "ffe1d003ff0ee80191a80905a118dbae", "score": "0.6780588", "text": "func (o *Task) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no tasks provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.Time.IsZero() {\n\t\to.CreatedAt.Time = currTime\n\t\to.CreatedAt.Valid = true\n\t}\n\to.UpdatedAt.Time = currTime\n\to.UpdatedAt.Valid = true\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(taskColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\ttaskUpsertCacheMut.RLock()\n\tcache, cached := taskUpsertCache[key]\n\ttaskUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\ttaskColumns,\n\t\t\ttaskColumnsWithDefault,\n\t\t\ttaskColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\ttaskColumns,\n\t\t\ttaskPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert tasks, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(taskPrimaryKeyColumns))\n\t\t\tcopy(conflict, taskPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"tasks\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(taskType, taskMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(taskType, taskMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert tasks\")\n\t}\n\n\tif !cached {\n\t\ttaskUpsertCacheMut.Lock()\n\t\ttaskUpsertCache[key] = cache\n\t\ttaskUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "13fa468eea9d02a7afbb2aa0948cb78d", "score": "0.6744652", "text": "func (o *Poll) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no polls provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(pollColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tpollUpsertCacheMut.RLock()\n\tcache, cached := pollUpsertCache[key]\n\tpollUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tpollAllColumns,\n\t\t\tpollColumnsWithDefault,\n\t\t\tpollColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tpollAllColumns,\n\t\t\tpollPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert polls, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(pollPrimaryKeyColumns))\n\t\t\tcopy(conflict, pollPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"polls\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(pollType, pollMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(pollType, pollMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert polls\")\n\t}\n\n\tif !cached {\n\t\tpollUpsertCacheMut.Lock()\n\t\tpollUpsertCache[key] = cache\n\t\tpollUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2911f1f96cc5e6fffc871cd5ca5993c5", "score": "0.6716605", "text": "func (o *Repository) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no repositories provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(repositoryColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\trepositoryUpsertCacheMut.RLock()\n\tcache, cached := repositoryUpsertCache[key]\n\trepositoryUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\trepositoryColumns,\n\t\t\trepositoryColumnsWithDefault,\n\t\t\trepositoryColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\trepositoryColumns,\n\t\t\trepositoryPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert repositories, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(repositoryPrimaryKeyColumns))\n\t\t\tcopy(conflict, repositoryPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"repositories\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(repositoryType, repositoryMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(repositoryType, repositoryMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert repositories\")\n\t}\n\n\tif !cached {\n\t\trepositoryUpsertCacheMut.Lock()\n\t\trepositoryUpsertCache[key] = cache\n\t\trepositoryUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "350dd5e43deb8f91e5a92b21ce0ad3ec", "score": "0.6716112", "text": "func (o *Issue) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no issues provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif queries.MustTime(o.CreatedAt).IsZero() {\n\t\t\tqueries.SetScanner(&o.CreatedAt, currTime)\n\t\t}\n\t\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(issueColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLIssueUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tissueUpsertCacheMut.RLock()\n\tcache, cached := issueUpsertCache[key]\n\tissueUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tissueAllColumns,\n\t\t\tissueColumnsWithDefault,\n\t\t\tissueColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tissueAllColumns,\n\t\t\tissuePrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert issues, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"issues\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `issues` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(issueType, issueMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(issueType, issueMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for issues\")\n\t}\n\n\tvar lastID int64\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = uint(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == issueMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(issueType, issueMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for issues\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, nzUniqueCols...)\n\t}\n\n\terr = exec.QueryRowContext(ctx, cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for issues\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tissueUpsertCacheMut.Lock()\n\t\tissueUpsertCache[key] = cache\n\t\tissueUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "5c78e6e7364dd08b10406c441cdbdd8e", "score": "0.6712925", "text": "func (o *Datum) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no data provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(datumColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tdatumUpsertCacheMut.RLock()\n\tcache, cached := datumUpsertCache[key]\n\tdatumUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\tdatumColumns,\n\t\t\tdatumColumnsWithDefault,\n\t\t\tdatumColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tdatumColumns,\n\t\t\tdatumPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert data, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(datumPrimaryKeyColumns))\n\t\t\tcopy(conflict, datumPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"data\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(datumType, datumMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(datumType, datumMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert data\")\n\t}\n\n\tif !cached {\n\t\tdatumUpsertCacheMut.Lock()\n\t\tdatumUpsertCache[key] = cache\n\t\tdatumUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "920ae930c5e4fb876e86c2c96f39ffae", "score": "0.6661266", "text": "func (o *Institution) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no institution provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(institutionColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tinstitutionUpsertCacheMut.RLock()\n\tcache, cached := institutionUpsertCache[key]\n\tinstitutionUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\tinstitutionColumns,\n\t\t\tinstitutionColumnsWithDefault,\n\t\t\tinstitutionColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tinstitutionColumns,\n\t\t\tinstitutionPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert institution, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(institutionPrimaryKeyColumns))\n\t\t\tcopy(conflict, institutionPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"instruments\\\".\\\"institution\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(institutionType, institutionMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(institutionType, institutionMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert institution\")\n\t}\n\n\tif !cached {\n\t\tinstitutionUpsertCacheMut.Lock()\n\t\tinstitutionUpsertCache[key] = cache\n\t\tinstitutionUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "b4aefe7c2a545b1e92278c816d3ec1a9", "score": "0.6650676", "text": "func (o *Archive) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"mysql: no archives provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(archiveColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLArchiveUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tarchiveUpsertCacheMut.RLock()\n\tcache, cached := archiveUpsertCache[key]\n\tarchiveUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tarchiveAllColumns,\n\t\t\tarchiveColumnsWithDefault,\n\t\t\tarchiveColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tarchiveAllColumns,\n\t\t\tarchivePrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"mysql: unable to upsert archives, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"archives\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `archives` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(archiveType, archiveMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(archiveType, archiveMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tresult, err := exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mysql: unable to upsert for archives\")\n\t}\n\n\tvar lastID int64\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = int64(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == archiveMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(archiveType, archiveMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mysql: unable to retrieve unique values for archives\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.retQuery)\n\t\tfmt.Fprintln(writer, nzUniqueCols...)\n\t}\n\terr = exec.QueryRowContext(ctx, cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mysql: unable to populate default values for archives\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tarchiveUpsertCacheMut.Lock()\n\t\tarchiveUpsertCache[key] = cache\n\t\tarchiveUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "70dbb7f78fc66ef60bb1939c5cceea1d", "score": "0.6647568", "text": "func (o *Image) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no images provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif queries.MustTime(o.CreatedAt).IsZero() {\n\t\t\tqueries.SetScanner(&o.CreatedAt, currTime)\n\t\t}\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(imageColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\timageUpsertCacheMut.RLock()\n\tcache, cached := imageUpsertCache[key]\n\timageUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\timageAllColumns,\n\t\t\timageColumnsWithDefault,\n\t\t\timageColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\timageAllColumns,\n\t\t\timagePrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert images, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(imagePrimaryKeyColumns))\n\t\t\tcopy(conflict, imagePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"images\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(imageType, imageMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(imageType, imageMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert images\")\n\t}\n\n\tif !cached {\n\t\timageUpsertCacheMut.Lock()\n\t\timageUpsertCache[key] = cache\n\t\timageUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "0ea8db99ad924bf31cabff5464405f66", "score": "0.6607567", "text": "func (c *City) Upsert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif c._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `INSERT INTO public.city (` +\n\t\t`city_id, city, country_id, last_update` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3, $4` +\n\t\t`) ON CONFLICT (city_id) DO UPDATE SET (` +\n\t\t`city_id, city, country_id, last_update` +\n\t\t`) = (` +\n\t\t`EXCLUDED.city_id, EXCLUDED.city, EXCLUDED.country_id, EXCLUDED.last_update` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, c.CityID, c.City, c.CountryID, c.LastUpdate)\n\t_, err = db.Exec(sqlstr, c.CityID, c.City, c.CountryID, c.LastUpdate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\tc._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "fdb0db5e1a44cf2b7b1c458db703c68f", "score": "0.6596843", "text": "func (bi *BaitInventory) Upsert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif bi._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `INSERT INTO public.bait_inventory (` +\n\t\t`user, tier_1, tier_2, tier_3, tier_4, tier_5, current, gathering` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3, $4, $5, $6, $7, $8` +\n\t\t`) ON CONFLICT (user) DO UPDATE SET (` +\n\t\t`user, tier_1, tier_2, tier_3, tier_4, tier_5, current, gathering` +\n\t\t`) = (` +\n\t\t`EXCLUDED.user, EXCLUDED.tier_1, EXCLUDED.tier_2, EXCLUDED.tier_3, EXCLUDED.tier_4, EXCLUDED.tier_5, EXCLUDED.current, EXCLUDED.gathering` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, bi.User, bi.Tier1, bi.Tier2, bi.Tier3, bi.Tier4, bi.Tier5, bi.Current, bi.Gathering)\n\t_, err = db.Exec(sqlstr, bi.User, bi.Tier1, bi.Tier2, bi.Tier3, bi.Tier4, bi.Tier5, bi.Current, bi.Gathering)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\tbi._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "82bbaeb4bef754c14b4de6a82766db23", "score": "0.6588169", "text": "func (o *Account) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no account provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(accountColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\taccountUpsertCacheMut.RLock()\n\tcache, cached := accountUpsertCache[key]\n\taccountUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\taccountAllColumns,\n\t\t\taccountColumnsWithDefault,\n\t\t\taccountColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\taccountAllColumns,\n\t\t\taccountPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert account, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(accountPrimaryKeyColumns))\n\t\t\tcopy(conflict, accountPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"account\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(accountType, accountMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(accountType, accountMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert account\")\n\t}\n\n\tif !cached {\n\t\taccountUpsertCacheMut.Lock()\n\t\taccountUpsertCache[key] = cache\n\t\taccountUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e2f96fa203d926295813ebd33c7744ad", "score": "0.65765053", "text": "func (o *Player) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no players provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif queries.MustTime(o.CreatedAt).IsZero() {\n\t\t\tqueries.SetScanner(&o.CreatedAt, currTime)\n\t\t}\n\t\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(playerColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tplayerUpsertCacheMut.RLock()\n\tcache, cached := playerUpsertCache[key]\n\tplayerUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tplayerColumns,\n\t\t\tplayerColumnsWithDefault,\n\t\t\tplayerColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tplayerColumns,\n\t\t\tplayerPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert players, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(playerPrimaryKeyColumns))\n\t\t\tcopy(conflict, playerPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"players\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(playerType, playerMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(playerType, playerMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert players\")\n\t}\n\n\tif !cached {\n\t\tplayerUpsertCacheMut.Lock()\n\t\tplayerUpsertCache[key] = cache\n\t\tplayerUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c58b0ccbbce420c7a8787b885f06f17a", "score": "0.6575933", "text": "func (o *Cvtermprop) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no cvtermprop provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(cvtermpropColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tcvtermpropUpsertCacheMut.RLock()\n\tcache, cached := cvtermpropUpsertCache[key]\n\tcvtermpropUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\tcvtermpropColumns,\n\t\t\tcvtermpropColumnsWithDefault,\n\t\t\tcvtermpropColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tcvtermpropColumns,\n\t\t\tcvtermpropPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"chado: unable to upsert cvtermprop, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(cvtermpropPrimaryKeyColumns))\n\t\t\tcopy(conflict, cvtermpropPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"cvtermprop\\\"\", updateOnConflict, ret, update, conflict, whitelist)\n\n\t\tcache.valueMapping, err = queries.BindMapping(cvtermpropType, cvtermpropMapping, whitelist)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(cvtermpropType, cvtermpropMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to upsert for cvtermprop\")\n\t}\n\n\tif !cached {\n\t\tcvtermpropUpsertCacheMut.Lock()\n\t\tcvtermpropUpsertCache[key] = cache\n\t\tcvtermpropUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "261b7d2ed6213c748c712c913fcfa86e", "score": "0.6571262", "text": "func (o *City) Upsert(exec boil.Executor, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"sqlboiler: no city provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(cityColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tcityUpsertCacheMut.RLock()\n\tcache, cached := cityUpsertCache[key]\n\tcityUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\tcityColumns,\n\t\t\tcityColumnsWithDefault,\n\t\t\tcityColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tcityColumns,\n\t\t\tcityPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"sqlboiler: unable to upsert city, could not build update column list\")\n\t\t}\n\n\t\tcache.query = queries.BuildUpsertQueryMySQL(dialect, \"city\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `city` WHERE `city_id`=?\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(cityType, cityMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(cityType, cityMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tresult, err := exec.Exec(cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to upsert for city\")\n\t}\n\n\tvar lastID int64\n\tvar identifierCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.CityID = uint16(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == cityMapping[\"CityID\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tidentifierCols = []interface{}{\n\t\to.CityID,\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, identifierCols...)\n\t}\n\n\terr = exec.QueryRow(cache.retQuery, identifierCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to populate default values for city\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tcityUpsertCacheMut.Lock()\n\t\tcityUpsertCache[key] = cache\n\t\tcityUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "809471b4f8f39b0dc20e760e750699fa", "score": "0.6558823", "text": "func (o *Avatar) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"public: no avatar provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(avatarColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tavatarUpsertCacheMut.RLock()\n\tcache, cached := avatarUpsertCache[key]\n\tavatarUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\tavatarColumns,\n\t\t\tavatarColumnsWithDefault,\n\t\t\tavatarColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tavatarColumns,\n\t\t\tavatarPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"public: unable to upsert avatar, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(avatarPrimaryKeyColumns))\n\t\t\tcopy(conflict, avatarPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"avatar\\\"\", updateOnConflict, ret, update, conflict, whitelist)\n\n\t\tcache.valueMapping, err = queries.BindMapping(avatarType, avatarMapping, whitelist)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(avatarType, avatarMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"public: unable to upsert avatar\")\n\t}\n\n\tif !cached {\n\t\tavatarUpsertCacheMut.Lock()\n\t\tavatarUpsertCache[key] = cache\n\t\tavatarUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "de09886b6e49c5ccb2ea8a599d5ebcad", "score": "0.65518016", "text": "func (o *Board) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"model: no boards provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(boardColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLBoardUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tboardUpsertCacheMut.RLock()\n\tcache, cached := boardUpsertCache[key]\n\tboardUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tboardAllColumns,\n\t\t\tboardColumnsWithDefault,\n\t\t\tboardColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tboardAllColumns,\n\t\t\tboardPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"model: unable to upsert boards, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"boards\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `boards` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(boardType, boardMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(boardType, boardMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tresult, err := exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to upsert for boards\")\n\t}\n\n\tvar lastID int64\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = int(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == boardMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(boardType, boardMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to retrieve unique values for boards\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.retQuery)\n\t\tfmt.Fprintln(writer, nzUniqueCols...)\n\t}\n\terr = exec.QueryRowContext(ctx, cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to populate default values for boards\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tboardUpsertCacheMut.Lock()\n\t\tboardUpsertCache[key] = cache\n\t\tboardUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "736e7572b3c99e82207ab98e8787ef25", "score": "0.654081", "text": "func (o *Artifact) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no artifacts provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(artifactColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLArtifactUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tartifactUpsertCacheMut.RLock()\n\tcache, cached := artifactUpsertCache[key]\n\tartifactUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tartifactAllColumns,\n\t\t\tartifactColumnsWithDefault,\n\t\t\tartifactColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tartifactAllColumns,\n\t\t\tartifactPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert artifacts, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"artifacts\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `artifacts` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(artifactType, artifactMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(artifactType, artifactMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for artifacts\")\n\t}\n\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(artifactType, artifactMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for artifacts\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.retQuery)\n\t\tfmt.Fprintln(writer, nzUniqueCols...)\n\t}\n\terr = exec.QueryRowContext(ctx, cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for artifacts\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tartifactUpsertCacheMut.Lock()\n\t\tartifactUpsertCache[key] = cache\n\t\tartifactUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "068179aae80555f6279f2d6fd48cb8cc", "score": "0.652026", "text": "func (c *Connector) Upsert(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error {\n\treturn nil\n}", "title": "" }, { "docid": "edb83c6f43b403d7294984caa1d9462d", "score": "0.65177196", "text": "func (o *CommandInfo) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no command_infos provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(commandInfoColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tcommandInfoUpsertCacheMut.RLock()\n\tcache, cached := commandInfoUpsertCache[key]\n\tcommandInfoUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tcommandInfoAllColumns,\n\t\t\tcommandInfoColumnsWithDefault,\n\t\t\tcommandInfoColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tcommandInfoAllColumns,\n\t\t\tcommandInfoPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert command_infos, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(commandInfoPrimaryKeyColumns))\n\t\t\tcopy(conflict, commandInfoPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"command_infos\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(commandInfoType, commandInfoMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(commandInfoType, commandInfoMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert command_infos\")\n\t}\n\n\tif !cached {\n\t\tcommandInfoUpsertCacheMut.Lock()\n\t\tcommandInfoUpsertCache[key] = cache\n\t\tcommandInfoUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dc89af322478ca85001ff7e4647bedec", "score": "0.65115833", "text": "func (o *Account) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"public: no account provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(accountColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\taccountUpsertCacheMut.RLock()\n\tcache, cached := accountUpsertCache[key]\n\taccountUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\taccountColumns,\n\t\t\taccountColumnsWithDefault,\n\t\t\taccountColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\taccountColumns,\n\t\t\taccountPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"public: unable to upsert account, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(accountPrimaryKeyColumns))\n\t\t\tcopy(conflict, accountPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"account\\\"\", updateOnConflict, ret, update, conflict, whitelist)\n\n\t\tcache.valueMapping, err = queries.BindMapping(accountType, accountMapping, whitelist)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(accountType, accountMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"public: unable to upsert account\")\n\t}\n\n\tif !cached {\n\t\taccountUpsertCacheMut.Lock()\n\t\taccountUpsertCache[key] = cache\n\t\taccountUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "f9b1c46f30f667708c3c6420aaa5acb4", "score": "0.6474923", "text": "func (o *Gateway) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no gateways provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(gatewayColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tgatewayUpsertCacheMut.RLock()\n\tcache, cached := gatewayUpsertCache[key]\n\tgatewayUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tgatewayAllColumns,\n\t\t\tgatewayColumnsWithDefault,\n\t\t\tgatewayColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tgatewayAllColumns,\n\t\t\tgatewayPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert gateways, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(gatewayPrimaryKeyColumns))\n\t\t\tcopy(conflict, gatewayPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"gateways\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(gatewayType, gatewayMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(gatewayType, gatewayMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert gateways\")\n\t}\n\n\tif !cached {\n\t\tgatewayUpsertCacheMut.Lock()\n\t\tgatewayUpsertCache[key] = cache\n\t\tgatewayUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9e5ecda20af8872d0c65975cb774c162", "score": "0.64595884", "text": "func (o *OriginPublicKey) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no origin_public_keys provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif queries.MustTime(o.CreatedAt).IsZero() {\n\t\t\tqueries.SetScanner(&o.CreatedAt, currTime)\n\t\t}\n\t\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(originPublicKeyColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\toriginPublicKeyUpsertCacheMut.RLock()\n\tcache, cached := originPublicKeyUpsertCache[key]\n\toriginPublicKeyUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\toriginPublicKeyColumns,\n\t\t\toriginPublicKeyColumnsWithDefault,\n\t\t\toriginPublicKeyColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\toriginPublicKeyColumns,\n\t\t\toriginPublicKeyPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert origin_public_keys, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(originPublicKeyPrimaryKeyColumns))\n\t\t\tcopy(conflict, originPublicKeyPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"origin_public_keys\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(originPublicKeyType, originPublicKeyMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(originPublicKeyType, originPublicKeyMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert origin_public_keys\")\n\t}\n\n\tif !cached {\n\t\toriginPublicKeyUpsertCacheMut.Lock()\n\t\toriginPublicKeyUpsertCache[key] = cache\n\t\toriginPublicKeyUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "39f4ec94e0b0d9f8bffeae5dd7f9efee", "score": "0.64549977", "text": "func (db *RDBMS) DoUpsert(actor int64, table string, kvparams M.SX) (id int64) {\n\tid = 0\n\tdb.DoTransaction(func(tx *Tx) string {\n\t\tid = tx.DoUpsert(actor, table, kvparams)\n\t\treturn ``\n\t})\n\treturn\n}", "title": "" }, { "docid": "0e8a64c57180b037558ec1b8bde07856", "score": "0.64484775", "text": "func (o *Metric) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"public: no metric provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(metricColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tmetricUpsertCacheMut.RLock()\n\tcache, cached := metricUpsertCache[key]\n\tmetricUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\tmetricColumns,\n\t\t\tmetricColumnsWithDefault,\n\t\t\tmetricColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tmetricColumns,\n\t\t\tmetricPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"public: unable to upsert metric, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(metricPrimaryKeyColumns))\n\t\t\tcopy(conflict, metricPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"metric\\\"\", updateOnConflict, ret, update, conflict, whitelist)\n\n\t\tcache.valueMapping, err = queries.BindMapping(metricType, metricMapping, whitelist)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(metricType, metricMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"public: unable to upsert metric\")\n\t}\n\n\tif !cached {\n\t\tmetricUpsertCacheMut.Lock()\n\t\tmetricUpsertCache[key] = cache\n\t\tmetricUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "5afbdf40756d03ff5c068e3b09386f27", "score": "0.64411175", "text": "func (o *InfectedEncounter) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no infected_encounter provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(infectedEncounterColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tinfectedEncounterUpsertCacheMut.RLock()\n\tcache, cached := infectedEncounterUpsertCache[key]\n\tinfectedEncounterUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tinfectedEncounterAllColumns,\n\t\t\tinfectedEncounterColumnsWithDefault,\n\t\t\tinfectedEncounterColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tinfectedEncounterAllColumns,\n\t\t\tinfectedEncounterPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert infected_encounter, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(infectedEncounterPrimaryKeyColumns))\n\t\t\tcopy(conflict, infectedEncounterPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"infected_encounter\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(infectedEncounterType, infectedEncounterMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(infectedEncounterType, infectedEncounterMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert infected_encounter\")\n\t}\n\n\tif !cached {\n\t\tinfectedEncounterUpsertCacheMut.Lock()\n\t\tinfectedEncounterUpsertCache[key] = cache\n\t\tinfectedEncounterUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "2143190277f350966b9c139749919c87", "score": "0.64394253", "text": "func (o *EarthquakeEpicenter) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no EarthquakeEpicenters provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(earthquakeEpicenterColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLEarthquakeEpicenterUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tearthquakeEpicenterUpsertCacheMut.RLock()\n\tcache, cached := earthquakeEpicenterUpsertCache[key]\n\tearthquakeEpicenterUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tearthquakeEpicenterAllColumns,\n\t\t\tearthquakeEpicenterColumnsWithDefault,\n\t\t\tearthquakeEpicenterColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tearthquakeEpicenterAllColumns,\n\t\t\tearthquakeEpicenterPrimaryKeyColumns,\n\t\t)\n\n\t\tif !updateColumns.IsNone() && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert EarthquakeEpicenters, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"`EarthquakeEpicenters`\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `EarthquakeEpicenters` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(earthquakeEpicenterType, earthquakeEpicenterMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(earthquakeEpicenterType, earthquakeEpicenterMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tresult, err := exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for EarthquakeEpicenters\")\n\t}\n\n\tvar lastID int64\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = uint(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == earthquakeEpicenterMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(earthquakeEpicenterType, earthquakeEpicenterMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for EarthquakeEpicenters\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.retQuery)\n\t\tfmt.Fprintln(writer, nzUniqueCols...)\n\t}\n\terr = exec.QueryRowContext(ctx, cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for EarthquakeEpicenters\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tearthquakeEpicenterUpsertCacheMut.Lock()\n\t\tearthquakeEpicenterUpsertCache[key] = cache\n\t\tearthquakeEpicenterUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "5d7cef0afe79e8dabf9df7077a632135", "score": "0.643661", "text": "func (o *StatNotifier) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"model2: no stat_notifier provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(statNotifierColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLStatNotifierUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tstatNotifierUpsertCacheMut.RLock()\n\tcache, cached := statNotifierUpsertCache[key]\n\tstatNotifierUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tstatNotifierAllColumns,\n\t\t\tstatNotifierColumnsWithDefault,\n\t\t\tstatNotifierColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tstatNotifierAllColumns,\n\t\t\tstatNotifierPrimaryKeyColumns,\n\t\t)\n\n\t\tif !updateColumns.IsNone() && len(update) == 0 {\n\t\t\treturn errors.New(\"model2: unable to upsert stat_notifier, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"`stat_notifier`\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `stat_notifier` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(statNotifierType, statNotifierMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(statNotifierType, statNotifierMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model2: unable to upsert for stat_notifier\")\n\t}\n\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(statNotifierType, statNotifierMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model2: unable to retrieve unique values for stat_notifier\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.retQuery)\n\t\tfmt.Fprintln(writer, nzUniqueCols...)\n\t}\n\terr = exec.QueryRowContext(ctx, cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model2: unable to populate default values for stat_notifier\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tstatNotifierUpsertCacheMut.Lock()\n\t\tstatNotifierUpsertCache[key] = cache\n\t\tstatNotifierUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "0388be6003c772c47e55a3010a2afdce", "score": "0.64289", "text": "func (o *Site) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no sites provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(siteColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLSiteUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tsiteUpsertCacheMut.RLock()\n\tcache, cached := siteUpsertCache[key]\n\tsiteUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tsiteAllColumns,\n\t\t\tsiteColumnsWithDefault,\n\t\t\tsiteColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tsiteAllColumns,\n\t\t\tsitePrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert sites, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"sites\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `sites` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(siteType, siteMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(siteType, siteMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for sites\")\n\t}\n\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(siteType, siteMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for sites\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.retQuery)\n\t\tfmt.Fprintln(writer, nzUniqueCols...)\n\t}\n\terr = exec.QueryRowContext(ctx, cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for sites\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tsiteUpsertCacheMut.Lock()\n\t\tsiteUpsertCache[key] = cache\n\t\tsiteUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "35fd8bd3f8db469ddda2b176a90a6036", "score": "0.64225423", "text": "func (o *GameOperation) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no game_operations provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(gameOperationColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tgameOperationUpsertCacheMut.RLock()\n\tcache, cached := gameOperationUpsertCache[key]\n\tgameOperationUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tgameOperationColumns,\n\t\t\tgameOperationColumnsWithDefault,\n\t\t\tgameOperationColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tgameOperationColumns,\n\t\t\tgameOperationPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert game_operations, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(gameOperationPrimaryKeyColumns))\n\t\t\tcopy(conflict, gameOperationPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"game_operations\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(gameOperationType, gameOperationMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(gameOperationType, gameOperationMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert game_operations\")\n\t}\n\n\tif !cached {\n\t\tgameOperationUpsertCacheMut.Lock()\n\t\tgameOperationUpsertCache[key] = cache\n\t\tgameOperationUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b6e7c36dfd3f279326c82cd452d3adcc", "score": "0.6417218", "text": "func (o *Client) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no clients provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(clientColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tclientUpsertCacheMut.RLock()\n\tcache, cached := clientUpsertCache[key]\n\tclientUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\tclientColumns,\n\t\t\tclientColumnsWithDefault,\n\t\t\tclientColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tclientColumns,\n\t\t\tclientPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert clients, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(clientPrimaryKeyColumns))\n\t\t\tcopy(conflict, clientPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"clients\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(clientType, clientMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(clientType, clientMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert clients\")\n\t}\n\n\tif !cached {\n\t\tclientUpsertCacheMut.Lock()\n\t\tclientUpsertCache[key] = cache\n\t\tclientUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "fc17209c73e4c49cac9f62e1c0f48cd4", "score": "0.6416837", "text": "func (o *UpepBlastDB) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no upep_blast_db provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.Time.IsZero() {\n\t\to.CreatedAt.Time = currTime\n\t\to.CreatedAt.Valid = true\n\t}\n\to.UpdatedAt.Time = currTime\n\to.UpdatedAt.Valid = true\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(upepBlastDBColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tupepBlastDBUpsertCacheMut.RLock()\n\tcache, cached := upepBlastDBUpsertCache[key]\n\tupepBlastDBUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\tupepBlastDBColumns,\n\t\t\tupepBlastDBColumnsWithDefault,\n\t\t\tupepBlastDBColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tupepBlastDBColumns,\n\t\t\tupepBlastDBPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert upep_blast_db, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(upepBlastDBPrimaryKeyColumns))\n\t\t\tcopy(conflict, upepBlastDBPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"upep\\\".\\\"upep_blast_db\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(upepBlastDBType, upepBlastDBMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(upepBlastDBType, upepBlastDBMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert upep_blast_db\")\n\t}\n\n\tif !cached {\n\t\tupepBlastDBUpsertCacheMut.Lock()\n\t\tupepBlastDBUpsertCache[key] = cache\n\t\tupepBlastDBUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "613ea67fd1d44ba9da115cb704079d6a", "score": "0.6405161", "text": "func (o *Account) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no accounts provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(accountColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\taccountUpsertCacheMut.RLock()\n\tcache, cached := accountUpsertCache[key]\n\taccountUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\taccountAllColumns,\n\t\t\taccountColumnsWithDefault,\n\t\t\taccountColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\taccountAllColumns,\n\t\t\taccountPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert accounts, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(accountPrimaryKeyColumns))\n\t\t\tcopy(conflict, accountPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"accounts\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(accountType, accountMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(accountType, accountMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert accounts\")\n\t}\n\n\tif !cached {\n\t\taccountUpsertCacheMut.Lock()\n\t\taccountUpsertCache[key] = cache\n\t\taccountUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "9a1fc1733e9c01ed8826768bcb96072b", "score": "0.6400108", "text": "func (lr *LexRecognizer) Upsert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif lr._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `INSERT INTO public.lex_recognizer (` +\n\t\t`id, description, recognizer, replacer, passthrough, priority` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3, $4, $5, $6` +\n\t\t`) ON CONFLICT (id) DO UPDATE SET (` +\n\t\t`id, description, recognizer, replacer, passthrough, priority` +\n\t\t`) = (` +\n\t\t`EXCLUDED.id, EXCLUDED.description, EXCLUDED.recognizer, EXCLUDED.replacer, EXCLUDED.passthrough, EXCLUDED.priority` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, lr.ID, lr.Description, lr.Recognizer, lr.Replacer, lr.Passthrough, lr.Priority)\n\t_, err = db.Exec(sqlstr, lr.ID, lr.Description, lr.Recognizer, lr.Replacer, lr.Passthrough, lr.Priority)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\tlr._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "3902350406bbc469944c54886c93d771", "score": "0.63979805", "text": "func (o *Shop) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no shop provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif queries.MustTime(o.CreatedAt).IsZero() {\n\t\t\tqueries.SetScanner(&o.CreatedAt, currTime)\n\t\t}\n\t\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(shopColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLShopUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tshopUpsertCacheMut.RLock()\n\tcache, cached := shopUpsertCache[key]\n\tshopUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tshopAllColumns,\n\t\t\tshopColumnsWithDefault,\n\t\t\tshopColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tshopAllColumns,\n\t\t\tshopPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert shop, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"shop\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `shop` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(shopType, shopMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(shopType, shopMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tresult, err := exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for shop\")\n\t}\n\n\tvar lastID int64\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = int(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == shopMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(shopType, shopMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for shop\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.retQuery)\n\t\tfmt.Fprintln(writer, nzUniqueCols...)\n\t}\n\terr = exec.QueryRowContext(ctx, cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for shop\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tshopUpsertCacheMut.Lock()\n\t\tshopUpsertCache[key] = cache\n\t\tshopUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "e8ea23d9ac524f8447ec2c60aa8aac1f", "score": "0.6379002", "text": "func (o *WorksFor) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "0f159317d20a770e92475ade759583cd", "score": "0.6374374", "text": "func (o *OperationType) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"mdbmodels: no operation_types provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(operationTypeColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\toperationTypeUpsertCacheMut.RLock()\n\tcache, cached := operationTypeUpsertCache[key]\n\toperationTypeUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\toperationTypeAllColumns,\n\t\t\toperationTypeColumnsWithDefault,\n\t\t\toperationTypeColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\toperationTypeAllColumns,\n\t\t\toperationTypePrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"mdbmodels: unable to upsert operation_types, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(operationTypePrimaryKeyColumns))\n\t\t\tcopy(conflict, operationTypePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"operation_types\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(operationTypeType, operationTypeMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(operationTypeType, operationTypeMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mdbmodels: unable to upsert operation_types\")\n\t}\n\n\tif !cached {\n\t\toperationTypeUpsertCacheMut.Lock()\n\t\toperationTypeUpsertCache[key] = cache\n\t\toperationTypeUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "78f38504745d01be4c3032fd87dcc390", "score": "0.6374147", "text": "func (o *Blogger) Upsert(exec boil.Executor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no blogger provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(bloggerColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLBloggerUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tbloggerUpsertCacheMut.RLock()\n\tcache, cached := bloggerUpsertCache[key]\n\tbloggerUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tbloggerAllColumns,\n\t\t\tbloggerColumnsWithDefault,\n\t\t\tbloggerColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tbloggerAllColumns,\n\t\t\tbloggerPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert blogger, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"blogger\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `blogger` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(bloggerType, bloggerMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(bloggerType, bloggerMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\tresult, err := exec.Exec(cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for blogger\")\n\t}\n\n\tvar lastID int64\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.Index = int(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == bloggerMapping[\"index\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(bloggerType, bloggerMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for blogger\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, nzUniqueCols...)\n\t}\n\terr = exec.QueryRow(cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for blogger\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tbloggerUpsertCacheMut.Lock()\n\t\tbloggerUpsertCache[key] = cache\n\t\tbloggerUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "fca97c60cfaa8019fa4a0ded1f4395ab", "score": "0.63676685", "text": "func (o *Ogp) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no ogp provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(ogpColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLOgpUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\togpUpsertCacheMut.RLock()\n\tcache, cached := ogpUpsertCache[key]\n\togpUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\togpAllColumns,\n\t\t\togpColumnsWithDefault,\n\t\t\togpColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\togpAllColumns,\n\t\t\togpPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert ogp, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"ogp\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `ogp` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(ogpType, ogpMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(ogpType, ogpMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for ogp\")\n\t}\n\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(ogpType, ogpMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for ogp\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.retQuery)\n\t\tfmt.Fprintln(writer, nzUniqueCols...)\n\t}\n\terr = exec.QueryRowContext(ctx, cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for ogp\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\togpUpsertCacheMut.Lock()\n\t\togpUpsertCache[key] = cache\n\t\togpUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "9797f6f1390b0d94b7eac4978909d4b1", "score": "0.6367007", "text": "func (b *BoltStore) Upsert(key string, val interface{}) error {\n\tif err := b.store.Upsert(key, val); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3851a187f59519261dfab7035eaac86b", "score": "0.6360818", "text": "func (o *Goauth) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no goauth provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(goauthColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tgoauthUpsertCacheMut.RLock()\n\tcache, cached := goauthUpsertCache[key]\n\tgoauthUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\tgoauthColumns,\n\t\t\tgoauthColumnsWithDefault,\n\t\t\tgoauthColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tgoauthColumns,\n\t\t\tgoauthPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert goauth, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(goauthPrimaryKeyColumns))\n\t\t\tcopy(conflict, goauthPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"goauth\\\"\", updateOnConflict, ret, update, conflict, whitelist)\n\n\t\tcache.valueMapping, err = queries.BindMapping(goauthType, goauthMapping, whitelist)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(goauthType, goauthMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert goauth\")\n\t}\n\n\tif !cached {\n\t\tgoauthUpsertCacheMut.Lock()\n\t\tgoauthUpsertCache[key] = cache\n\t\tgoauthUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "4d657a8bcf8a5701ea99678bc6faffe5", "score": "0.63607246", "text": "func (o *ClaimTag) Upsert(exec boil.Executor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"model: no claim_tag provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(claimTagColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLClaimTagUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tclaimTagUpsertCacheMut.RLock()\n\tcache, cached := claimTagUpsertCache[key]\n\tclaimTagUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tclaimTagAllColumns,\n\t\t\tclaimTagColumnsWithDefault,\n\t\t\tclaimTagColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tclaimTagAllColumns,\n\t\t\tclaimTagPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"model: unable to upsert claim_tag, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"claim_tag\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `claim_tag` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(claimTagType, claimTagMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(claimTagType, claimTagMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tresult, err := exec.Exec(cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to upsert for claim_tag\")\n\t}\n\n\tvar lastID int64\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = uint64(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == claimTagMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(claimTagType, claimTagMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to retrieve unique values for claim_tag\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, nzUniqueCols...)\n\t}\n\n\terr = exec.QueryRow(cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to populate default values for claim_tag\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tclaimTagUpsertCacheMut.Lock()\n\t\tclaimTagUpsertCache[key] = cache\n\t\tclaimTagUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3ecfeacbb622f03b598926dc4d1c23be", "score": "0.6356923", "text": "func (o *Owner) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no owner provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(ownerColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\townerUpsertCacheMut.RLock()\n\tcache, cached := ownerUpsertCache[key]\n\townerUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\townerColumns,\n\t\t\townerColumnsWithDefault,\n\t\t\townerColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\townerColumns,\n\t\t\townerPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert owner, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(ownerPrimaryKeyColumns))\n\t\t\tcopy(conflict, ownerPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"owner\\\"\", updateOnConflict, ret, update, conflict, whitelist)\n\n\t\tcache.valueMapping, err = queries.BindMapping(ownerType, ownerMapping, whitelist)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(ownerType, ownerMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert owner\")\n\t}\n\n\tif !cached {\n\t\townerUpsertCacheMut.Lock()\n\t\townerUpsertCache[key] = cache\n\t\townerUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "1db1199f5d1165d075035e8323e855c1", "score": "0.6356212", "text": "func (fa *FilmActor) Upsert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif fa._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `INSERT INTO public.film_actor (` +\n\t\t`actor_id, film_id, last_update` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3` +\n\t\t`) ON CONFLICT (actor_id, film_id) DO UPDATE SET (` +\n\t\t`actor_id, film_id, last_update` +\n\t\t`) = (` +\n\t\t`EXCLUDED.actor_id, EXCLUDED.film_id, EXCLUDED.last_update` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, fa.ActorID, fa.FilmID, fa.LastUpdate)\n\t_, err = db.Exec(sqlstr, fa.ActorID, fa.FilmID, fa.LastUpdate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\tfa._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "f37f9d0550a5d56ce6693710e6085727", "score": "0.6351621", "text": "func (o *IcoPhaseBankAccount) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no ico_phase_bank_account provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(icoPhaseBankAccountColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\ticoPhaseBankAccountUpsertCacheMut.RLock()\n\tcache, cached := icoPhaseBankAccountUpsertCache[key]\n\ticoPhaseBankAccountUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\ticoPhaseBankAccountColumns,\n\t\t\ticoPhaseBankAccountColumnsWithDefault,\n\t\t\ticoPhaseBankAccountColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\ticoPhaseBankAccountColumns,\n\t\t\ticoPhaseBankAccountPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert ico_phase_bank_account, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(icoPhaseBankAccountPrimaryKeyColumns))\n\t\t\tcopy(conflict, icoPhaseBankAccountPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"ico_phase_bank_account\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(icoPhaseBankAccountType, icoPhaseBankAccountMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(icoPhaseBankAccountType, icoPhaseBankAccountMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert ico_phase_bank_account\")\n\t}\n\n\tif !cached {\n\t\ticoPhaseBankAccountUpsertCacheMut.Lock()\n\t\ticoPhaseBankAccountUpsertCache[key] = cache\n\t\ticoPhaseBankAccountUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "8e69b90dc7673c6e9c7badbe79a7f9b2", "score": "0.63355327", "text": "func (o *CustomCommand) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no custom_commands provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(customCommandColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tcustomCommandUpsertCacheMut.RLock()\n\tcache, cached := customCommandUpsertCache[key]\n\tcustomCommandUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tcustomCommandAllColumns,\n\t\t\tcustomCommandColumnsWithDefault,\n\t\t\tcustomCommandColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tcustomCommandAllColumns,\n\t\t\tcustomCommandPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert custom_commands, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(customCommandPrimaryKeyColumns))\n\t\t\tcopy(conflict, customCommandPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"custom_commands\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(customCommandType, customCommandMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(customCommandType, customCommandMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert custom_commands\")\n\t}\n\n\tif !cached {\n\t\tcustomCommandUpsertCacheMut.Lock()\n\t\tcustomCommandUpsertCache[key] = cache\n\t\tcustomCommandUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1b47989834b0efded9548474e6ddc3f6", "score": "0.63341844", "text": "func (o *Airport) Upsert(exec boil.Executor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no airports provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tnzDefaults := queries.NonZeroDefaultSet(airportColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLAirportUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tairportUpsertCacheMut.RLock()\n\tcache, cached := airportUpsertCache[key]\n\tairportUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tairportAllColumns,\n\t\t\tairportColumnsWithDefault,\n\t\t\tairportColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tairportAllColumns,\n\t\t\tairportPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert airports, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"airports\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `airports` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(airportType, airportMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(airportType, airportMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\tresult, err := exec.Exec(cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for airports\")\n\t}\n\n\tvar lastID int64\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = int(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == airportMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(airportType, airportMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for airports\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, nzUniqueCols...)\n\t}\n\terr = exec.QueryRow(cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for airports\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tairportUpsertCacheMut.Lock()\n\t\tairportUpsertCache[key] = cache\n\t\tairportUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6619e52c0480539f683b9b6279af5e79", "score": "0.63271254", "text": "func (b *Book) Upsert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif b._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `INSERT INTO public.books (` +\n\t\t`book_id, author_id, isbn, booktype, title, year, available, tags` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3, $4, $5, $6, $7, $8` +\n\t\t`) ON CONFLICT (book_id) DO UPDATE SET (` +\n\t\t`book_id, author_id, isbn, booktype, title, year, available, tags` +\n\t\t`) = (` +\n\t\t`EXCLUDED.book_id, EXCLUDED.author_id, EXCLUDED.isbn, EXCLUDED.booktype, EXCLUDED.title, EXCLUDED.year, EXCLUDED.available, EXCLUDED.tags` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, b.BookID, b.AuthorID, b.Isbn, b.Booktype, b.Title, b.Year, b.Available, b.Tags)\n\t_, err = db.Exec(sqlstr, b.BookID, b.AuthorID, b.Isbn, b.Booktype, b.Title, b.Year, b.Available, b.Tags)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\tb._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "598446543ced1b35b63f54ed08130840", "score": "0.6325575", "text": "func (o *DailyDatum) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"db: no daily_data provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(dailyDatumColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tdailyDatumUpsertCacheMut.RLock()\n\tcache, cached := dailyDatumUpsertCache[key]\n\tdailyDatumUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tdailyDatumColumns,\n\t\t\tdailyDatumColumnsWithDefault,\n\t\t\tdailyDatumColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tdailyDatumColumns,\n\t\t\tdailyDatumPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"db: unable to upsert daily_data, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(dailyDatumPrimaryKeyColumns))\n\t\t\tcopy(conflict, dailyDatumPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"prh\\\".\\\"daily_data\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(dailyDatumType, dailyDatumMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(dailyDatumType, dailyDatumMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"db: unable to upsert daily_data\")\n\t}\n\n\tif !cached {\n\t\tdailyDatumUpsertCacheMut.Lock()\n\t\tdailyDatumUpsertCache[key] = cache\n\t\tdailyDatumUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "79234fd6f189e69d9547b9e4da745193", "score": "0.63186824", "text": "func (m MySQLHourRepository) upsertHour(tx *sqlx.Tx, hourToUpdate *hour.Hour) error {\n\tupdatedDbHour := mysqlHour{\n\t\tHour: hourToUpdate.Time().UTC(),\n\t\tAvailability: hourToUpdate.Availability().String(),\n\t}\n\n\t_, err := tx.NamedExec(\n\t\t`INSERT INTO \n\t\t\thours (hour, availability) \n\t\tVALUES \n\t\t\t(:hour, :availability)\n\t\tON DUPLICATE KEY UPDATE \n\t\t\tavailability = :availability`,\n\t\tupdatedDbHour,\n\t)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to upsert hour\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "86c39f99df9c7ace9427022363f9d21d", "score": "0.6291026", "text": "func (rr *RelationRelatedhit) Upsert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif rr._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `INSERT INTO public.relation_relatedhit (` +\n\t\t`id, destination_id, relationtype_id, source_id, forbidden` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3, $4, $5` +\n\t\t`) ON CONFLICT (id) DO UPDATE SET (` +\n\t\t`id, destination_id, relationtype_id, source_id, forbidden` +\n\t\t`) = (` +\n\t\t`EXCLUDED.id, EXCLUDED.destination_id, EXCLUDED.relationtype_id, EXCLUDED.source_id, EXCLUDED.forbidden` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, rr.ID, rr.DestinationID, rr.RelationtypeID, rr.SourceID, rr.Forbidden)\n\t_, err = db.Exec(sqlstr, rr.ID, rr.DestinationID, rr.RelationtypeID, rr.SourceID, rr.Forbidden)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\trr._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "528114ca99668d43c4cdd281dc342ba2", "score": "0.62856627", "text": "func (o *IPAddress) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no ip_addresses provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\to.UpdatedAt = currTime\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(ipAddressColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tipAddressUpsertCacheMut.RLock()\n\tcache, cached := ipAddressUpsertCache[key]\n\tipAddressUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tipAddressAllColumns,\n\t\t\tipAddressColumnsWithDefault,\n\t\t\tipAddressColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tipAddressAllColumns,\n\t\t\tipAddressPrimaryKeyColumns,\n\t\t)\n\n\t\tinsert = strmangle.SetComplement(insert, ipAddressGeneratedColumns)\n\t\tupdate = strmangle.SetComplement(update, ipAddressGeneratedColumns)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert ip_addresses, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(ipAddressPrimaryKeyColumns))\n\t\t\tcopy(conflict, ipAddressPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"ip_addresses\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(ipAddressType, ipAddressMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(ipAddressType, ipAddressMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert ip_addresses\")\n\t}\n\n\tif !cached {\n\t\tipAddressUpsertCacheMut.Lock()\n\t\tipAddressUpsertCache[key] = cache\n\t\tipAddressUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "13933b4d701e8a11277ca12c7387bf63", "score": "0.62853837", "text": "func (o *DiscountCode) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no discount_codes provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(discountCodeColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tdiscountCodeUpsertCacheMut.RLock()\n\tcache, cached := discountCodeUpsertCache[key]\n\tdiscountCodeUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tdiscountCodeColumns,\n\t\t\tdiscountCodeColumnsWithDefault,\n\t\t\tdiscountCodeColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tdiscountCodeColumns,\n\t\t\tdiscountCodePrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert discount_codes, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(discountCodePrimaryKeyColumns))\n\t\t\tcopy(conflict, discountCodePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"discount_codes\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(discountCodeType, discountCodeMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(discountCodeType, discountCodeMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert discount_codes\")\n\t}\n\n\tif !cached {\n\t\tdiscountCodeUpsertCacheMut.Lock()\n\t\tdiscountCodeUpsertCache[key] = cache\n\t\tdiscountCodeUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "ac0c27893e8af01e9e45b7f34ae6d0d1", "score": "0.6283092", "text": "func (o *Post) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"dbmodel: no post provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.Time.IsZero() {\n\t\to.CreatedAt.Time = currTime\n\t\to.CreatedAt.Valid = true\n\t}\n\to.UpdatedAt.Time = currTime\n\to.UpdatedAt.Valid = true\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(postColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tpostUpsertCacheMut.RLock()\n\tcache, cached := postUpsertCache[key]\n\tpostUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\tpostColumns,\n\t\t\tpostColumnsWithDefault,\n\t\t\tpostColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tpostColumns,\n\t\t\tpostPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"dbmodel: unable to upsert post, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(postPrimaryKeyColumns))\n\t\t\tcopy(conflict, postPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"app\\\".\\\"post\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(postType, postMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(postType, postMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"dbmodel: unable to upsert post\")\n\t}\n\n\tif !cached {\n\t\tpostUpsertCacheMut.Lock()\n\t\tpostUpsertCache[key] = cache\n\t\tpostUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "2a5db280eff506c172660bbb9a2e0b40", "score": "0.6279648", "text": "func (o *ContentUnit) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"mdbmdbmodels: no content_units provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(contentUnitColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tcontentUnitUpsertCacheMut.RLock()\n\tcache, cached := contentUnitUpsertCache[key]\n\tcontentUnitUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\tcontentUnitColumns,\n\t\t\tcontentUnitColumnsWithDefault,\n\t\t\tcontentUnitColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tcontentUnitColumns,\n\t\t\tcontentUnitPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"mdbmdbmodels: unable to upsert content_units, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(contentUnitPrimaryKeyColumns))\n\t\t\tcopy(conflict, contentUnitPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"content_units\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(contentUnitType, contentUnitMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(contentUnitType, contentUnitMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mdbmdbmodels: unable to upsert content_units\")\n\t}\n\n\tif !cached {\n\t\tcontentUnitUpsertCacheMut.Lock()\n\t\tcontentUnitUpsertCache[key] = cache\n\t\tcontentUnitUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bffef5e766caa23aa667342e5ccdda8e", "score": "0.62708586", "text": "func (o *OrderItem) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"orm: no order_items provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(orderItemColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\torderItemUpsertCacheMut.RLock()\n\tcache, cached := orderItemUpsertCache[key]\n\torderItemUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\torderItemAllColumns,\n\t\t\torderItemColumnsWithDefault,\n\t\t\torderItemColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\torderItemAllColumns,\n\t\t\torderItemPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"orm: unable to upsert order_items, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(orderItemPrimaryKeyColumns))\n\t\t\tcopy(conflict, orderItemPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"order_items\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(orderItemType, orderItemMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(orderItemType, orderItemMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"orm: unable to upsert order_items\")\n\t}\n\n\tif !cached {\n\t\torderItemUpsertCacheMut.Lock()\n\t\torderItemUpsertCache[key] = cache\n\t\torderItemUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "d6fe9c494a286c55c6cc1f74ddbeeb5f", "score": "0.6258559", "text": "func (o *Input) Upsert(exec boil.Executor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"model: no input provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(inputColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLInputUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tinputUpsertCacheMut.RLock()\n\tcache, cached := inputUpsertCache[key]\n\tinputUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tinputAllColumns,\n\t\t\tinputColumnsWithDefault,\n\t\t\tinputColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tinputAllColumns,\n\t\t\tinputPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"model: unable to upsert input, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"input\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `input` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(inputType, inputMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(inputType, inputMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tresult, err := exec.Exec(cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to upsert for input\")\n\t}\n\n\tvar lastID int64\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = uint64(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == inputMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(inputType, inputMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to retrieve unique values for input\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, nzUniqueCols...)\n\t}\n\n\terr = exec.QueryRow(cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to populate default values for input\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tinputUpsertCacheMut.Lock()\n\t\tinputUpsertCache[key] = cache\n\t\tinputUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e41d9435d521ba3c5be7f216403f84b1", "score": "0.6255999", "text": "func (bb *BufferedBulkInserter) Upsert(pair []interface{}) error {\n\tif len(pair)%2 != 0 {\n\t\treturn fmt.Errorf(\"Bulk.Upsert requires an even number of parameters\")\n\t}\n\tselector := pair[0]\n\tif selector == nil {\n\t\tselector = bson.D{}\n\t}\n\tdocument := pair[1]\n\trawBytes, err := bson.Marshal(document)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"bson encoding error: %v\", err)\n\t}\n\trawBytesSelector, errSelector := bson.Marshal(selector)\n\tif errSelector != nil {\n\t\treturn fmt.Errorf(\"bson encoding error: %v\", errSelector)\n\t}\n\ttotalRequestSize := len(rawBytes) + len(rawBytesSelector)\n\t// flush if we are full\n\tif bb.docCount >= bb.docLimit || bb.byteCount+totalRequestSize > MaxBSONSize {\n\t\terr = bb.Flush()\n\t}\n\t// buffer the document\n\tbb.docCount++\n\tbb.byteCount += totalRequestSize\n\tbb.bulk.Upsert(selector, bson.Raw{Data: rawBytes})\n\treturn err\n}", "title": "" }, { "docid": "620d6700060d209be1fc29e38c79f8c7", "score": "0.6255052", "text": "func (o *Session) Upsert(exec boil.Executor, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no session provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(sessionColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tsessionUpsertCacheMut.RLock()\n\tcache, cached := sessionUpsertCache[key]\n\tsessionUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\tsessionColumns,\n\t\t\tsessionColumnsWithDefault,\n\t\t\tsessionColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tsessionColumns,\n\t\t\tsessionPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert session, could not build update column list\")\n\t\t}\n\n\t\tcache.query = queries.BuildUpsertQueryMySQL(dialect, \"session\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `session` WHERE `id`=?\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(sessionType, sessionMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(sessionType, sessionMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\t_, err = exec.Exec(cache.query, vals...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for session\")\n\t}\n\n\tvar identifierCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tidentifierCols = []interface{}{\n\t\to.ID,\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, identifierCols...)\n\t}\n\n\terr = exec.QueryRow(cache.retQuery, identifierCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for session\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tsessionUpsertCacheMut.Lock()\n\t\tsessionUpsertCache[key] = cache\n\t\tsessionUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "6063e73995ce8f09409da4a2ffde5c9e", "score": "0.62522477", "text": "func (o *Currency) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no currencies provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(currencyColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLCurrencyUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tcurrencyUpsertCacheMut.RLock()\n\tcache, cached := currencyUpsertCache[key]\n\tcurrencyUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tcurrencyColumns,\n\t\t\tcurrencyColumnsWithDefault,\n\t\t\tcurrencyColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tcurrencyColumns,\n\t\t\tcurrencyPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert currencies, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"currencies\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `currencies` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(currencyType, currencyMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(currencyType, currencyMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for currencies\")\n\t}\n\n\tvar lastID int64\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = uint(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == currencyMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(currencyType, currencyMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for currencies\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, nzUniqueCols...)\n\t}\n\n\terr = exec.QueryRowContext(ctx, cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for currencies\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tcurrencyUpsertCacheMut.Lock()\n\t\tcurrencyUpsertCache[key] = cache\n\t\tcurrencyUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "6c86d23b4d3d90d995c2b38e8d0acbad", "score": "0.6252188", "text": "func (s *Substance) Upsert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif s._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `INSERT INTO public.substance (` +\n\t\t`id, name` +\n\t\t`) VALUES (` +\n\t\t`$1, $2` +\n\t\t`) ON CONFLICT (id) DO UPDATE SET (` +\n\t\t`id, name` +\n\t\t`) = (` +\n\t\t`EXCLUDED.id, EXCLUDED.name` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, s.ID, s.Name)\n\t_, err = db.Exec(sqlstr, s.ID, s.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\ts._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "d2fe1c68f0cf8e35f7242f33c5583ccb", "score": "0.6234604", "text": "func (o *Task) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "5a5a6687bce54417950770c3e1d73b00", "score": "0.62301034", "text": "func (o *Case) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no cases provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\to.UpdatedAt = currTime\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(caseColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLCaseUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tcaseUpsertCacheMut.RLock()\n\tcache, cached := caseUpsertCache[key]\n\tcaseUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tcaseAllColumns,\n\t\t\tcaseColumnsWithDefault,\n\t\t\tcaseColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tcaseAllColumns,\n\t\t\tcasePrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert cases, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"cases\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `cases` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(caseType, caseMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(caseType, caseMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tresult, err := exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for cases\")\n\t}\n\n\tvar lastID int64\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = int(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == caseMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(caseType, caseMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for cases\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.retQuery)\n\t\tfmt.Fprintln(writer, nzUniqueCols...)\n\t}\n\terr = exec.QueryRowContext(ctx, cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for cases\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tcaseUpsertCacheMut.Lock()\n\t\tcaseUpsertCache[key] = cache\n\t\tcaseUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "48e5bd595ca22ae2fb92ea1357bf7ea9", "score": "0.62248397", "text": "func (o *Cvterm) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no cvterm provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(cvtermColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tcvtermUpsertCacheMut.RLock()\n\tcache, cached := cvtermUpsertCache[key]\n\tcvtermUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\tcvtermColumns,\n\t\t\tcvtermColumnsWithDefault,\n\t\t\tcvtermColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tcvtermColumns,\n\t\t\tcvtermPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"chado: unable to upsert cvterm, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(cvtermPrimaryKeyColumns))\n\t\t\tcopy(conflict, cvtermPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"cvterm\\\"\", updateOnConflict, ret, update, conflict, whitelist)\n\n\t\tcache.valueMapping, err = queries.BindMapping(cvtermType, cvtermMapping, whitelist)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(cvtermType, cvtermMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to upsert for cvterm\")\n\t}\n\n\tif !cached {\n\t\tcvtermUpsertCacheMut.Lock()\n\t\tcvtermUpsertCache[key] = cache\n\t\tcvtermUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "7fc46b844e640dba9403e4c047eafce9", "score": "0.62150687", "text": "func (e *Employee) Upsert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif e._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `INSERT INTO public.employee (` +\n\t\t`emp_id, emp_number` +\n\t\t`) VALUES (` +\n\t\t`$1, $2` +\n\t\t`) ON CONFLICT (emp_id) DO UPDATE SET (` +\n\t\t`emp_id, emp_number` +\n\t\t`) = (` +\n\t\t`EXCLUDED.emp_id, EXCLUDED.emp_number` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, e.EmpID, e.EmpNumber)\n\t_, err = db.Exec(sqlstr, e.EmpID, e.EmpNumber)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\te._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "5b2154be0793c96302d4a87a02ce7422", "score": "0.6204639", "text": "func (node *LeafNode) SafeUpsert(updateKey, value string) InsertionResult {\n\tidx := 0\n\tfor idx < len(node.Keys) && updateKey > node.Keys[idx] {\n\t\tidx++\n\t}\n\tif idx != len(node.Keys) && updateKey == node.Keys[idx] {\n\t\tnode.Values[idx] = value\n\t\treturn InsertionResult{Created: false}\n\t}\n\tnode.Keys = insert(node.Keys, idx, updateKey)\n\tnode.Values = insert(node.Values, idx, value)\n\tif len(node.Keys) > node.MaxKeys {\n\t\tleft, right, splitKey := node.Split()\n\t\treturn InsertionResult{left, right, splitKey, true}\n\t}\n\treturn InsertionResult{Created: true}\n}", "title": "" }, { "docid": "8a60504a94546851453c140b61fe5262", "score": "0.62043387", "text": "func (o *Phenstatement) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no phenstatement provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(phenstatementColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tphenstatementUpsertCacheMut.RLock()\n\tcache, cached := phenstatementUpsertCache[key]\n\tphenstatementUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\tphenstatementColumns,\n\t\t\tphenstatementColumnsWithDefault,\n\t\t\tphenstatementColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tphenstatementColumns,\n\t\t\tphenstatementPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"chado: unable to upsert phenstatement, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(phenstatementPrimaryKeyColumns))\n\t\t\tcopy(conflict, phenstatementPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"phenstatement\\\"\", updateOnConflict, ret, update, conflict, whitelist)\n\n\t\tcache.valueMapping, err = queries.BindMapping(phenstatementType, phenstatementMapping, whitelist)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(phenstatementType, phenstatementMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to upsert for phenstatement\")\n\t}\n\n\tif !cached {\n\t\tphenstatementUpsertCacheMut.Lock()\n\t\tphenstatementUpsertCache[key] = cache\n\t\tphenstatementUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "86b5332178eef58d95438aab1c35041f", "score": "0.62031573", "text": "func (o *CMFUserPushid) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no cmf_user_pushid provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(cmfUserPushidColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLCMFUserPushidUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tcmfUserPushidUpsertCacheMut.RLock()\n\tcache, cached := cmfUserPushidUpsertCache[key]\n\tcmfUserPushidUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tcmfUserPushidAllColumns,\n\t\t\tcmfUserPushidColumnsWithDefault,\n\t\t\tcmfUserPushidColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tcmfUserPushidAllColumns,\n\t\t\tcmfUserPushidPrimaryKeyColumns,\n\t\t)\n\n\t\tif !updateColumns.IsNone() && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert cmf_user_pushid, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"`cmf_user_pushid`\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `cmf_user_pushid` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(cmfUserPushidType, cmfUserPushidMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(cmfUserPushidType, cmfUserPushidMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for cmf_user_pushid\")\n\t}\n\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(cmfUserPushidType, cmfUserPushidMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for cmf_user_pushid\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.retQuery)\n\t\tfmt.Fprintln(writer, nzUniqueCols...)\n\t}\n\terr = exec.QueryRowContext(ctx, cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for cmf_user_pushid\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tcmfUserPushidUpsertCacheMut.Lock()\n\t\tcmfUserPushidUpsertCache[key] = cache\n\t\tcmfUserPushidUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "22de34d374cbdf8a65683a2290786655", "score": "0.61920875", "text": "func (o *Client) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "fbd11b40ac589b131470aebd0f4dc17e", "score": "0.61905104", "text": "func (c *Connector) Upsert(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error {\n\tev, err := fieldValueMapFromClientMap(values)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tttl := dosa.NoTTL().Nanoseconds()\n\tif ei.TTL != nil {\n\t\tttl = ei.TTL.Nanoseconds()\n\t}\n\n\tupsertRequest := dosarpc.UpsertRequest{\n\t\tRef: entityInfoToSchemaRef(ei),\n\t\tEntityValues: ev,\n\t\tTTL: &ttl,\n\t}\n\n\terr = c.client.Upsert(ctx, &upsertRequest, getHeaders(c.headers)...)\n\n\tif !dosarpc.Dosa_Upsert_Helper.IsException(err) {\n\t\treturn errors.Wrap(err, \"failed to Upsert due to network issue\")\n\t}\n\n\treturn errors.Wrap(err, \"failed to Upsert\")\n}", "title": "" }, { "docid": "2cdc8dbc9c9fc579993106be931a1147", "score": "0.61791915", "text": "func (o *CurrentChartDataHourly) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no current_chart_data_hourly provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(currentChartDataHourlyColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tcurrentChartDataHourlyUpsertCacheMut.RLock()\n\tcache, cached := currentChartDataHourlyUpsertCache[key]\n\tcurrentChartDataHourlyUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tcurrentChartDataHourlyColumns,\n\t\t\tcurrentChartDataHourlyColumnsWithDefault,\n\t\t\tcurrentChartDataHourlyColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tcurrentChartDataHourlyColumns,\n\t\t\tcurrentChartDataHourlyPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert current_chart_data_hourly, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(currentChartDataHourlyPrimaryKeyColumns))\n\t\t\tcopy(conflict, currentChartDataHourlyPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"current_chart_data_hourly\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(currentChartDataHourlyType, currentChartDataHourlyMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(currentChartDataHourlyType, currentChartDataHourlyMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert current_chart_data_hourly\")\n\t}\n\n\tif !cached {\n\t\tcurrentChartDataHourlyUpsertCacheMut.Lock()\n\t\tcurrentChartDataHourlyUpsertCache[key] = cache\n\t\tcurrentChartDataHourlyUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "3c984b51f50761f252bac272cf4539a7", "score": "0.6179186", "text": "func (o *Sale) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no sale provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(saleColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tsaleUpsertCacheMut.RLock()\n\tcache, cached := saleUpsertCache[key]\n\tsaleUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tsaleAllColumns,\n\t\t\tsaleColumnsWithDefault,\n\t\t\tsaleColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tsaleAllColumns,\n\t\t\tsalePrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert sale, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(salePrimaryKeyColumns))\n\t\t\tcopy(conflict, salePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"sale\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(saleType, saleMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(saleType, saleMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert sale\")\n\t}\n\n\tif !cached {\n\t\tsaleUpsertCacheMut.Lock()\n\t\tsaleUpsertCache[key] = cache\n\t\tsaleUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "db6409de572a4188a8509f5d8fd5e04d", "score": "0.61789817", "text": "func (o *BookmarkSearchIdx) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no bookmark_search_idx provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(bookmarkSearchIdxColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tbookmarkSearchIdxUpsertCacheMut.RLock()\n\tcache, cached := bookmarkSearchIdxUpsertCache[key]\n\tbookmarkSearchIdxUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tbookmarkSearchIdxAllColumns,\n\t\t\tbookmarkSearchIdxColumnsWithDefault,\n\t\t\tbookmarkSearchIdxColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tbookmarkSearchIdxAllColumns,\n\t\t\tbookmarkSearchIdxPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert bookmark_search_idx, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(bookmarkSearchIdxPrimaryKeyColumns))\n\t\t\tcopy(conflict, bookmarkSearchIdxPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQuerySQLite(dialect, \"\\\"bookmark_search_idx\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(bookmarkSearchIdxType, bookmarkSearchIdxMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(bookmarkSearchIdxType, bookmarkSearchIdxMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert bookmark_search_idx\")\n\t}\n\n\tif !cached {\n\t\tbookmarkSearchIdxUpsertCacheMut.Lock()\n\t\tbookmarkSearchIdxUpsertCache[key] = cache\n\t\tbookmarkSearchIdxUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "e7f97564b9b5dc20afd52be1a6dde97a", "score": "0.61788565", "text": "func (o *Payment) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no payment provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(paymentColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tpaymentUpsertCacheMut.RLock()\n\tcache, cached := paymentUpsertCache[key]\n\tpaymentUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tpaymentAllColumns,\n\t\t\tpaymentColumnsWithDefault,\n\t\t\tpaymentColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tpaymentAllColumns,\n\t\t\tpaymentPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert payment, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(paymentPrimaryKeyColumns))\n\t\t\tcopy(conflict, paymentPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"payment\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(paymentType, paymentMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(paymentType, paymentMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert payment\")\n\t}\n\n\tif !cached {\n\t\tpaymentUpsertCacheMut.Lock()\n\t\tpaymentUpsertCache[key] = cache\n\t\tpaymentUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "59f43f4db0b1087f0b8992b225f9f541", "score": "0.6175598", "text": "func (o *Peer) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"stellarcore: no peers provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(peerColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tpeerUpsertCacheMut.RLock()\n\tcache, cached := peerUpsertCache[key]\n\tpeerUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tpeerColumns,\n\t\t\tpeerColumnsWithDefault,\n\t\t\tpeerColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tpeerColumns,\n\t\t\tpeerPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"stellarcore: unable to upsert peers, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(peerPrimaryKeyColumns))\n\t\t\tcopy(conflict, peerPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"peers\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(peerType, peerMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(peerType, peerMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"stellarcore: unable to upsert peers\")\n\t}\n\n\tif !cached {\n\t\tpeerUpsertCacheMut.Lock()\n\t\tpeerUpsertCache[key] = cache\n\t\tpeerUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "5a81a2a6cc7cd4545f6e35a7a7407841", "score": "0.61609066", "text": "func (db *DBService) Upsert(jobs ...*DataHistoryJob) error {\n\tctx := context.TODO()\n\n\ttx, err := db.sql.BeginTx(ctx, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"beginTx %w\", err)\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\terrRB := tx.Rollback()\n\t\t\tif errRB != nil {\n\t\t\t\tlog.Errorf(log.DatabaseMgr, \"Insert tx.Rollback %v\", errRB)\n\t\t\t}\n\t\t}\n\t}()\n\n\tswitch db.driver {\n\tcase database.DBSQLite3, database.DBSQLite:\n\t\terr = upsertSqlite(ctx, tx, jobs...)\n\tcase database.DBPostgreSQL:\n\t\terr = upsertPostgres(ctx, tx, jobs...)\n\tdefault:\n\t\treturn database.ErrNoDatabaseProvided\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn tx.Commit()\n}", "title": "" }, { "docid": "5596ee9a42e6f70a294355fd9ad3016e", "score": "0.6159482", "text": "func (oo *OccurrenceOccurrence) Upsert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif oo._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `INSERT INTO public.occurrence_occurrence (` +\n\t\t`id, hit_in_content, basket_id, location_id, _order` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3, $4, $5` +\n\t\t`) ON CONFLICT (id) DO UPDATE SET (` +\n\t\t`id, hit_in_content, basket_id, location_id, _order` +\n\t\t`) = (` +\n\t\t`EXCLUDED.id, EXCLUDED.hit_in_content, EXCLUDED.basket_id, EXCLUDED.location_id, EXCLUDED._order` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, oo.ID, oo.HitInContent, oo.BasketID, oo.LocationID, oo.Order)\n\t_, err = db.Exec(sqlstr, oo.ID, oo.HitInContent, oo.BasketID, oo.LocationID, oo.Order)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\too._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "294d0679bc8f38ae377116e55aa98aba", "score": "0.61583966", "text": "func (o *Cvtermprop) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "7de37440e17bbb33478a1c81842e6f3c", "score": "0.61583364", "text": "func (o *PostTemplate) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"orm: no post_templates provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(postTemplateColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tpostTemplateUpsertCacheMut.RLock()\n\tcache, cached := postTemplateUpsertCache[key]\n\tpostTemplateUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tpostTemplateColumns,\n\t\t\tpostTemplateColumnsWithDefault,\n\t\t\tpostTemplateColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tpostTemplateColumns,\n\t\t\tpostTemplatePrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"orm: unable to upsert post_templates, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(postTemplatePrimaryKeyColumns))\n\t\t\tcopy(conflict, postTemplatePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"post_templates\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(postTemplateType, postTemplateMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(postTemplateType, postTemplateMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"orm: unable to upsert post_templates\")\n\t}\n\n\tif !cached {\n\t\tpostTemplateUpsertCacheMut.Lock()\n\t\tpostTemplateUpsertCache[key] = cache\n\t\tpostTemplateUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "4270b11b8c4215d542231782043e655d", "score": "0.61563927", "text": "func (o *Country) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no countries provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(countryColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tcountryUpsertCacheMut.RLock()\n\tcache, cached := countryUpsertCache[key]\n\tcountryUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tcountryColumns,\n\t\t\tcountryColumnsWithDefault,\n\t\t\tcountryColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tcountryColumns,\n\t\t\tcountryPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert countries, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(countryPrimaryKeyColumns))\n\t\t\tcopy(conflict, countryPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"countries\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(countryType, countryMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(countryType, countryMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert countries\")\n\t}\n\n\tif !cached {\n\t\tcountryUpsertCacheMut.Lock()\n\t\tcountryUpsertCache[key] = cache\n\t\tcountryUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "0eadb2a2dc5ee484774bd94a226eab62", "score": "0.61550355", "text": "func (o *AdminUnauthorizedTrustline) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no admin_unauthorized_trustline provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(adminUnauthorizedTrustlineColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tadminUnauthorizedTrustlineUpsertCacheMut.RLock()\n\tcache, cached := adminUnauthorizedTrustlineUpsertCache[key]\n\tadminUnauthorizedTrustlineUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tadminUnauthorizedTrustlineColumns,\n\t\t\tadminUnauthorizedTrustlineColumnsWithDefault,\n\t\t\tadminUnauthorizedTrustlineColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tadminUnauthorizedTrustlineColumns,\n\t\t\tadminUnauthorizedTrustlinePrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert admin_unauthorized_trustline, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(adminUnauthorizedTrustlinePrimaryKeyColumns))\n\t\t\tcopy(conflict, adminUnauthorizedTrustlinePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"admin_unauthorized_trustline\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(adminUnauthorizedTrustlineType, adminUnauthorizedTrustlineMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(adminUnauthorizedTrustlineType, adminUnauthorizedTrustlineMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert admin_unauthorized_trustline\")\n\t}\n\n\tif !cached {\n\t\tadminUnauthorizedTrustlineUpsertCacheMut.Lock()\n\t\tadminUnauthorizedTrustlineUpsertCache[key] = cache\n\t\tadminUnauthorizedTrustlineUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "c7aad4e965d79378e44b353c5dfc88f6", "score": "0.61538017", "text": "func (o *Datum) UpsertP(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "0a84358e067d90c06238e39968cd6f94", "score": "0.61462474", "text": "func (o *Output) Upsert(exec boil.Executor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"model: no output provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(outputColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLOutputUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\toutputUpsertCacheMut.RLock()\n\tcache, cached := outputUpsertCache[key]\n\toutputUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\toutputAllColumns,\n\t\t\toutputColumnsWithDefault,\n\t\t\toutputColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\toutputAllColumns,\n\t\t\toutputPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"model: unable to upsert output, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"output\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `output` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(outputType, outputMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(outputType, outputMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tresult, err := exec.Exec(cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to upsert for output\")\n\t}\n\n\tvar lastID int64\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = uint64(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == outputMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(outputType, outputMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to retrieve unique values for output\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, nzUniqueCols...)\n\t}\n\n\terr = exec.QueryRow(cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to populate default values for output\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\toutputUpsertCacheMut.Lock()\n\t\toutputUpsertCache[key] = cache\n\t\toutputUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "386f01357f2a6d4d23bcd89eff8b6601", "score": "0.6144909", "text": "func (m *ConcurrentMap) Upsert(key KeyType, value interface{}, cb UpsertCb) (res interface{}) {\n\tshard := m.getShard(key)\n\tshard.Lock()\n\tv, ok := shard.items[key]\n\tres = cb(ok, v, value)\n\tshard.items[key] = res\n\tshard.Unlock()\n\treturn res\n}", "title": "" }, { "docid": "86d2b497f46f25b1eae44bba5a9b8c8c", "score": "0.61382735", "text": "func (ts *threadStore) Upsert(t *chatable.Thread) (int64, error) {\n\tquery := `\n with upsert as (\n update threads\n set created_at = $1, latest_message = $2\n where user_id = $3 and with_user_id = $4\n returning *)\n insert into threads (user_id, with_user_id, author_username,\n created_at, latest_message)\n select $3, $4, $5, $1, $2\n where not exists (select * from upsert)\n `\n\tresult, err := ts.dbh.Exec(query, t.CreatedAt, t.LatestMessage,\n\t\tt.UserID, t.WithUserID, t.AuthorUsername)\n\tif err != nil {\n\t\treturn int64(0), err\n\t}\n\treturn result.RowsAffected()\n}", "title": "" }, { "docid": "1b3b4ce13b469ae26c89207fe20f62cb", "score": "0.6125486", "text": "func (o *Claim) Upsert(exec boil.Executor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"model: no claim provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(claimColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLClaimUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tclaimUpsertCacheMut.RLock()\n\tcache, cached := claimUpsertCache[key]\n\tclaimUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tclaimAllColumns,\n\t\t\tclaimColumnsWithDefault,\n\t\t\tclaimColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tclaimAllColumns,\n\t\t\tclaimPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"model: unable to upsert claim, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"claim\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `claim` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(claimType, claimMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(claimType, claimMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tresult, err := exec.Exec(cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to upsert for claim\")\n\t}\n\n\tvar lastID int64\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = uint64(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == claimMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(claimType, claimMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to retrieve unique values for claim\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, nzUniqueCols...)\n\t}\n\n\terr = exec.QueryRow(cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to populate default values for claim\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tclaimUpsertCacheMut.Lock()\n\t\tclaimUpsertCache[key] = cache\n\t\tclaimUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2ed4de3e08a210a43fa6eea75f1fe8eb", "score": "0.61228514", "text": "func (o *InputAchievement) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no input_achievements provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(inputAchievementColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLInputAchievementUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tinputAchievementUpsertCacheMut.RLock()\n\tcache, cached := inputAchievementUpsertCache[key]\n\tinputAchievementUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tinputAchievementAllColumns,\n\t\t\tinputAchievementColumnsWithDefault,\n\t\t\tinputAchievementColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tinputAchievementAllColumns,\n\t\t\tinputAchievementPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert input_achievements, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"input_achievements\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `input_achievements` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(inputAchievementType, inputAchievementMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(inputAchievementType, inputAchievementMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tresult, err := exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for input_achievements\")\n\t}\n\n\tvar lastID int64\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.InputAchievementID = int(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == inputAchievementMapping[\"input_achievement_id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(inputAchievementType, inputAchievementMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for input_achievements\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.retQuery)\n\t\tfmt.Fprintln(writer, nzUniqueCols...)\n\t}\n\terr = exec.QueryRowContext(ctx, cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for input_achievements\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tinputAchievementUpsertCacheMut.Lock()\n\t\tinputAchievementUpsertCache[key] = cache\n\t\tinputAchievementUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "3f0e613244fcd11179132bc6abe22339", "score": "0.61196977", "text": "func (s *Store) Upsert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif s._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `INSERT INTO public.store (` +\n\t\t`store_id, manager_staff_id, address_id, last_update` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3, $4` +\n\t\t`) ON CONFLICT (store_id) DO UPDATE SET (` +\n\t\t`store_id, manager_staff_id, address_id, last_update` +\n\t\t`) = (` +\n\t\t`EXCLUDED.store_id, EXCLUDED.manager_staff_id, EXCLUDED.address_id, EXCLUDED.last_update` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, s.StoreID, s.ManagerStaffID, s.AddressID, s.LastUpdate)\n\t_, err = db.Exec(sqlstr, s.StoreID, s.ManagerStaffID, s.AddressID, s.LastUpdate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\ts._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "2c06c5d2f8684825773662357db045b4", "score": "0.61193955", "text": "func (o *UserVerificationToken) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no user_verification_tokens provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(userVerificationTokenColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tuserVerificationTokenUpsertCacheMut.RLock()\n\tcache, cached := userVerificationTokenUpsertCache[key]\n\tuserVerificationTokenUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\tuserVerificationTokenColumns,\n\t\t\tuserVerificationTokenColumnsWithDefault,\n\t\t\tuserVerificationTokenColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tuserVerificationTokenColumns,\n\t\t\tuserVerificationTokenPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert user_verification_tokens, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(userVerificationTokenPrimaryKeyColumns))\n\t\t\tcopy(conflict, userVerificationTokenPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"user_verification_tokens\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(userVerificationTokenType, userVerificationTokenMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(userVerificationTokenType, userVerificationTokenMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert user_verification_tokens\")\n\t}\n\n\tif !cached {\n\t\tuserVerificationTokenUpsertCacheMut.Lock()\n\t\tuserVerificationTokenUpsertCache[key] = cache\n\t\tuserVerificationTokenUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "e58bc13871b1f8eb0a581f4007d8a0cf", "score": "0.61056507", "text": "func (p *portdomainServer) Upsert(ctx context.Context, req *portdomain.UpsertRequest) (*portdomain.UpsertResponse, error) {\n\treturn upsert.Upsert(ctx, req, p.database)\n}", "title": "" }, { "docid": "884508d396ed907c82920c14e9dca0b2", "score": "0.6099229", "text": "func (r *PriceRepository) Upsert(ctx context.Context, pwp *price.WithProduct) (price.ID, error) {\n\tp, err := newPrice(pwp)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tq := `\n\t\tINSERT INTO pricing_product_prices (product_id, hash, currency, price, unit, attributes)\n\t\tVALUES (?, ?, ?, ?, ?, ?)\n\t\tON DUPLICATE KEY UPDATE\n\t\t\tid = LAST_INSERT_ID(id),\n\t\t\tcurrency = VALUES(currency),\n\t\t\tprice = VALUES(price),\n\t\t\tunit = VALUES(unit),\n\t\t\tattributes = VALUES(attributes)\n\t`\n\n\tres, err := r.querier.ExecContext(ctx, q, p.ProductID, p.Hash, p.Currency, p.Value, p.Unit, p.Attributes)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tid, err := res.LastInsertId()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn price.ID(id), nil\n}", "title": "" }, { "docid": "f21dae2b353fb4269491f4b05c369de3", "score": "0.6089797", "text": "func (a *Alias) Upsert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif a._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `INSERT INTO public.alias (` +\n\t\t`\"id\", \"namespace\", \"context_id\", \"alias\"` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3, $4` +\n\t\t`) ON CONFLICT (\"id\") DO UPDATE SET (` +\n\t\t`\"id\", \"namespace\", \"context_id\", \"alias\"` +\n\t\t`) = (` +\n\t\t`EXCLUDED.\"id\", EXCLUDED.\"namespace\", EXCLUDED.\"context_id\", EXCLUDED.\"alias\"` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, a.ID, a.Namespace, a.ContextID, a.Alias)\n\t_, err = db.Exec(sqlstr, a.ID, a.Namespace, a.ContextID, a.Alias)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\ta._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "4c0b12e0069abb89978c8116ca349ead", "score": "0.60813093", "text": "func (o *Address) Upsert(exec boil.Executor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"model: no address provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(addressColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLAddressUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\taddressUpsertCacheMut.RLock()\n\tcache, cached := addressUpsertCache[key]\n\taddressUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\taddressAllColumns,\n\t\t\taddressColumnsWithDefault,\n\t\t\taddressColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\taddressAllColumns,\n\t\t\taddressPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"model: unable to upsert address, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"address\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `address` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(addressType, addressMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(addressType, addressMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tresult, err := exec.Exec(cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to upsert for address\")\n\t}\n\n\tvar lastID int64\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = uint64(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == addressMapping[\"id\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(addressType, addressMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to retrieve unique values for address\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, nzUniqueCols...)\n\t}\n\n\terr = exec.QueryRow(cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to populate default values for address\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\taddressUpsertCacheMut.Lock()\n\t\taddressUpsertCache[key] = cache\n\t\taddressUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5f7925752ea36daa7c676c7aa7560d9e", "score": "0.60779333", "text": "func (o *ServiceEndpoint) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no service_endpoint provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(serviceEndpointColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tserviceEndpointUpsertCacheMut.RLock()\n\tcache, cached := serviceEndpointUpsertCache[key]\n\tserviceEndpointUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tserviceEndpointAllColumns,\n\t\t\tserviceEndpointColumnsWithDefault,\n\t\t\tserviceEndpointColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tserviceEndpointAllColumns,\n\t\t\tserviceEndpointPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert service_endpoint, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(serviceEndpointPrimaryKeyColumns))\n\t\t\tcopy(conflict, serviceEndpointPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"service_endpoint\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(serviceEndpointType, serviceEndpointMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(serviceEndpointType, serviceEndpointMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert service_endpoint\")\n\t}\n\n\tif !cached {\n\t\tserviceEndpointUpsertCacheMut.Lock()\n\t\tserviceEndpointUpsertCache[key] = cache\n\t\tserviceEndpointUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "d0c36d2aacd872b14cdce532452a1fa6", "score": "0.6076507", "text": "func (m *CuckooHashMap) Upsert(key string, val interface{}) bool {\n\t/*\n\t\thv := hashedKey(key)\n\t\tb := m.snapshotAndLockTwo(hv)\n\t\tpos := m.cuckooInsertLoop(hv, b, key)\n\t\tif pos.status != ok {\n\t\t\treturn false\n\t\t}\n\t\tm.addToBucket(pos.index, pos.slot, hv.partial, key, val)\n\t*/\n\treturn true\n}", "title": "" }, { "docid": "38b69b1e4bde299fbe8bb730fa6fbcd4", "score": "0.6074514", "text": "func (o *Lye) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no lye provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(lyeColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tlyeUpsertCacheMut.RLock()\n\tcache, cached := lyeUpsertCache[key]\n\tlyeUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tlyeAllColumns,\n\t\t\tlyeColumnsWithDefault,\n\t\t\tlyeColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tlyeAllColumns,\n\t\t\tlyePrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert lye, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(lyePrimaryKeyColumns))\n\t\t\tcopy(conflict, lyePrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"lye\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(lyeType, lyeMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(lyeType, lyeMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert lye\")\n\t}\n\n\tif !cached {\n\t\tlyeUpsertCacheMut.Lock()\n\t\tlyeUpsertCache[key] = cache\n\t\tlyeUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "655d568de11a02f7c03bdfa0810c26d7", "score": "0.60718215", "text": "func (o *BraceletBracelet) Upsert(exec boil.Executor, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no bracelet_bracelet provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(braceletBraceletColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tbraceletBraceletUpsertCacheMut.RLock()\n\tcache, cached := braceletBraceletUpsertCache[key]\n\tbraceletBraceletUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\tbraceletBraceletColumns,\n\t\t\tbraceletBraceletColumnsWithDefault,\n\t\t\tbraceletBraceletColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tbraceletBraceletColumns,\n\t\t\tbraceletBraceletPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert bracelet_bracelet, could not build update column list\")\n\t\t}\n\n\t\tcache.query = queries.BuildUpsertQueryMySQL(dialect, \"bracelet_bracelet\", update, whitelist)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `bracelet_bracelet` WHERE `id`=?\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(braceletBraceletType, braceletBraceletMapping, whitelist)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(braceletBraceletType, braceletBraceletMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tresult, err := exec.Exec(cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for bracelet_bracelet\")\n\t}\n\n\tvar lastID int64\n\tvar identifierCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = int(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == braceletBraceletMapping[\"ID\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tidentifierCols = []interface{}{\n\t\to.ID,\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, identifierCols...)\n\t}\n\n\terr = exec.QueryRow(cache.retQuery, identifierCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for bracelet_bracelet\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tbraceletBraceletUpsertCacheMut.Lock()\n\t\tbraceletBraceletUpsertCache[key] = cache\n\t\tbraceletBraceletUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "22ac4ac6eb9f2c93dd9e2fd7ff613e68", "score": "0.60716146", "text": "func (o *UpepSorfPosition) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no upep_sorf_positions provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.Time.IsZero() {\n\t\to.CreatedAt.Time = currTime\n\t\to.CreatedAt.Valid = true\n\t}\n\to.UpdatedAt.Time = currTime\n\to.UpdatedAt.Valid = true\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(upepSorfPositionColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tupepSorfPositionUpsertCacheMut.RLock()\n\tcache, cached := upepSorfPositionUpsertCache[key]\n\tupepSorfPositionUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := strmangle.InsertColumnSet(\n\t\t\tupepSorfPositionColumns,\n\t\t\tupepSorfPositionColumnsWithDefault,\n\t\t\tupepSorfPositionColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tupepSorfPositionColumns,\n\t\t\tupepSorfPositionPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert upep_sorf_positions, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(upepSorfPositionPrimaryKeyColumns))\n\t\t\tcopy(conflict, upepSorfPositionPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"upep\\\".\\\"upep_sorf_positions\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(upepSorfPositionType, upepSorfPositionMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(upepSorfPositionType, upepSorfPositionMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert upep_sorf_positions\")\n\t}\n\n\tif !cached {\n\t\tupepSorfPositionUpsertCacheMut.Lock()\n\t\tupepSorfPositionUpsertCache[key] = cache\n\t\tupepSorfPositionUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "ba1624320f5050455ad0496f2ccc0e07", "score": "0.6068124", "text": "func (o *UserDomain) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"datamodels_raw: no user_domain provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(userDomainColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tuserDomainUpsertCacheMut.RLock()\n\tcache, cached := userDomainUpsertCache[key]\n\tuserDomainUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tuserDomainAllColumns,\n\t\t\tuserDomainColumnsWithDefault,\n\t\t\tuserDomainColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tuserDomainAllColumns,\n\t\t\tuserDomainPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"datamodels_raw: unable to upsert user_domain, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(userDomainPrimaryKeyColumns))\n\t\t\tcopy(conflict, userDomainPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"user_domain\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(userDomainType, userDomainMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(userDomainType, userDomainMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"datamodels_raw: unable to upsert user_domain\")\n\t}\n\n\tif !cached {\n\t\tuserDomainUpsertCacheMut.Lock()\n\t\tuserDomainUpsertCache[key] = cache\n\t\tuserDomainUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "f7ffa3278e2349466147947900976ce6", "score": "0.60659593", "text": "func (o *User) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"dal: no user provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(userColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tuserUpsertCacheMut.RLock()\n\tcache, cached := userUpsertCache[key]\n\tuserUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tuserAllColumns,\n\t\t\tuserColumnsWithDefault,\n\t\t\tuserColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tuserAllColumns,\n\t\t\tuserPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"dal: unable to upsert user, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(userPrimaryKeyColumns))\n\t\t\tcopy(conflict, userPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"user\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(userType, userMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(userType, userMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"dal: unable to upsert user\")\n\t}\n\n\tif !cached {\n\t\tuserUpsertCacheMut.Lock()\n\t\tuserUpsertCache[key] = cache\n\t\tuserUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "56cdea2ecbc3bc093e19d991b62f7a59", "score": "0.60610247", "text": "func (c *Collection) Upsert(selector, update interface{}) (info *mgo.ChangeInfo, err error) {\n\terr = c.Invoke(func(col *mgo.Collection) error {\n\t\tinfo, err = col.Upsert(selector, update)\n\t\treturn err\n\t})\n\treturn\n}", "title": "" } ]
b48f3614244106e59ca70cefc87c9605
BOSHManifestCFRouting returns a manifest for the CF routing release with an underscore in the name
[ { "docid": "8530c7b4920f6d6c09c224f5cf3a3dab", "score": "0.7423274", "text": "func (c *Catalog) BOSHManifestCFRouting() *manifest.Manifest {\n\tm, err := manifest.LoadYAML([]byte(bm.CFRouting))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn m\n}", "title": "" } ]
[ { "docid": "f67679f58e9a9d5b8b0fe0905336202f", "score": "0.55102295", "text": "func (msg MsgCreateDeployment) Route() string { return RouterKey }", "title": "" }, { "docid": "0f70630d9dcc48aef92aba5e1de0a8ca", "score": "0.53420293", "text": "func (msg MsgUpdateDeployment) Route() string { return RouterKey }", "title": "" }, { "docid": "67e2435425a1843886b72c00944b98ab", "score": "0.4957828", "text": "func (msg MsgCloseDeployment) Route() string { return RouterKey }", "title": "" }, { "docid": "7ee7e39291ff0bc96ad07efc7471e16a", "score": "0.4846742", "text": "func AchRouting() string {\n\treturn Numerify(\"#########\")\n}", "title": "" }, { "docid": "aeb984141866890aae2852db852227d5", "score": "0.48152277", "text": "func (a Asset) distribution() string {\n\tuc := a.Config.URL\n\tuseSharedHost := !uc.PrivateCDN\n\tvar hostName string\n\tif uc.Secure {\n\t\thostName = uc.SecureCName\n\t\tif hostName == \"\" {\n\t\t\tif uc.PrivateCDN {\n\t\t\t\thostName = buildHostName(a.Config.Cloud.CloudName, \"\", uc.SubDomain, uc.Domain)\n\t\t\t} else {\n\t\t\t\thostName = uc.SharedHost\n\t\t\t\tuseSharedHost = true\n\t\t\t}\n\t\t}\n\n\t\tsecureCDNSubDomain := uc.SecureCDNSubDomain\n\t\tif useSharedHost && !secureCDNSubDomain {\n\t\t\tsecureCDNSubDomain = uc.CDNSubDomain\n\t\t}\n\n\t\tif secureCDNSubDomain {\n\t\t\thostName = strings.Replace(hostName, uc.SharedHost, buildHostName(\"\", domainShard(a.PublicID), uc.SubDomain, uc.Domain), 1)\n\t\t}\n\t} else {\n\t\tif uc.CName != \"\" {\n\t\t\tsubDomain := \"\"\n\t\t\tif uc.CDNSubDomain {\n\t\t\t\tsubDomain = \"a\" + domainShard(a.PublicID)\n\t\t\t}\n\t\t\thostName = buildHostName(\"\", \"\", subDomain, uc.CName)\n\t\t} else {\n\t\t\tprefix := \"\"\n\t\t\tif uc.PrivateCDN {\n\t\t\t\tprefix = a.Config.Cloud.CloudName\n\t\t\t}\n\t\t\tsuffix := \"\"\n\t\t\tif uc.CDNSubDomain {\n\t\t\t\tsuffix = domainShard(a.PublicID)\n\t\t\t}\n\t\t\thostName = buildHostName(prefix, suffix, uc.SubDomain, uc.Domain)\n\t\t}\n\t}\n\n\tdistribution := fmt.Sprintf(\"%s://%s\", uc.Protocol(), hostName)\n\n\tif useSharedHost {\n\t\tdistribution += \"/\" + a.Config.Cloud.CloudName\n\t}\n\n\treturn distribution\n}", "title": "" }, { "docid": "418ebb706d87709d506f975581fb20a3", "score": "0.48145828", "text": "func (msg MsgCreateEthBridgeClaim) Route() string { return RouterKey }", "title": "" }, { "docid": "a4d608db62894925cf0d4c2f17721f6d", "score": "0.48134094", "text": "func (c *Catalog) BOSHManifestWithBPMRelease() *manifest.Manifest {\n\tm, err := manifest.LoadYAML([]byte(bm.BPMRelease))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "8290e6bd8b51d9b37d817b9c2f59984a", "score": "0.47482297", "text": "func (*RoutingRules) Descriptor() ([]byte, []int) {\n\treturn file_s3_proto_s3_proto_rawDescGZIP(), []int{35}\n}", "title": "" }, { "docid": "117efc37f218517685353b8ddebf447d", "score": "0.47273046", "text": "func (c *HTTP) GetManifest(ctx context.Context, release string) (*manifest.A2, error) {\n\turl := fmt.Sprintf(c.manifestURLFmt, release)\n\treturn c.manifestFromURL(ctx, url)\n}", "title": "" }, { "docid": "a79f0dedaa968c62f32310c9d9708277", "score": "0.47051436", "text": "func (msg MsgSellAsset) Route() string { return RouterKey }", "title": "" }, { "docid": "f8bf6877e382d9ce4b2a8354de76f27f", "score": "0.46798858", "text": "func GetAPIPattern(bkConfig config.DubboBackendConfig) string {\n\treturn strings.Join([]string{\"/\" + bkConfig.ApplicationName, bkConfig.Interface, bkConfig.Version}, constant.PathSlash)\n}", "title": "" }, { "docid": "a74ec538a52fd58a59439f390ad3f13c", "score": "0.46707645", "text": "func (c Cmd) Routing() Cmd {\n\treturn Cmd(c & 0xffff)\n}", "title": "" }, { "docid": "0da9ea526465e4dc36827f77de3ea21d", "score": "0.46696785", "text": "func (c *Call) RoutingKey() string {\n\tif c == nil {\n\t\treturn \"\"\n\t}\n\treturn c.md.RoutingKey()\n}", "title": "" }, { "docid": "da92043ba08e32b82e58c4f00de50f14", "score": "0.46632406", "text": "func (msg MsgBuyAsset) Route() string { return RouterKey }", "title": "" }, { "docid": "24b1784be19c4a5b5ce9f1528f901f0c", "score": "0.46337432", "text": "func (b KBucket) Routing() []overlay.Node {\n\treturn []overlay.Node{}\n}", "title": "" }, { "docid": "bfc5e1a3a4e37b8fe67f4186c11d3847", "score": "0.46264988", "text": "func GetPtBuildRoutingKey(container string) string {\n\treturn fmt.Sprintf(\"%s_%s\", container, PT_BUILD_ROUTING_KEY)\n}", "title": "" }, { "docid": "d95ef2ac1c98a610bdf7a4e520874081", "score": "0.4581671", "text": "func (msg MsgDeleteShareHolder) Route() string { return RouterKey }", "title": "" }, { "docid": "e5a87e2b30a166eff6a274859671ecc2", "score": "0.45808786", "text": "func (t *Target) GetManifestName(spec *TestSpec) string {\n\treturn fmt.Sprintf(\"%s_%s_manifest.json\", spec.Prefix, strings.ToLower(t.Kind))\n}", "title": "" }, { "docid": "e0c5261e3254e3a5a1d41ae95d9401aa", "score": "0.45719197", "text": "func (msg MsgFund) Route() string { return RouterKey }", "title": "" }, { "docid": "19ffa796001e1971b9ba24e8907ddc65", "score": "0.4538518", "text": "func ForKind(kind schema.GroupVersionKind) interface{} {\n\tswitch kind {\n\t// Group=aci.fabricattachment, Version=v1\n\tcase v1.SchemeGroupVersion.WithKind(\"AciNodeLinkAdjacency\"):\n\t\treturn &acifabricattachmentv1.AciNodeLinkAdjacencyApplyConfiguration{}\n\tcase v1.SchemeGroupVersion.WithKind(\"EncapRef\"):\n\t\treturn &acifabricattachmentv1.EncapRefApplyConfiguration{}\n\tcase v1.SchemeGroupVersion.WithKind(\"EncapSource\"):\n\t\treturn &acifabricattachmentv1.EncapSourceApplyConfiguration{}\n\tcase v1.SchemeGroupVersion.WithKind(\"NadVlanMap\"):\n\t\treturn &acifabricattachmentv1.NadVlanMapApplyConfiguration{}\n\tcase v1.SchemeGroupVersion.WithKind(\"NadVlanMapSpec\"):\n\t\treturn &acifabricattachmentv1.NadVlanMapSpecApplyConfiguration{}\n\tcase v1.SchemeGroupVersion.WithKind(\"NadVlanMapStatus\"):\n\t\treturn &acifabricattachmentv1.NadVlanMapStatusApplyConfiguration{}\n\tcase v1.SchemeGroupVersion.WithKind(\"NADVlanRef\"):\n\t\treturn &acifabricattachmentv1.NADVlanRefApplyConfiguration{}\n\tcase v1.SchemeGroupVersion.WithKind(\"NodeFabricNetworkAttachment\"):\n\t\treturn &acifabricattachmentv1.NodeFabricNetworkAttachmentApplyConfiguration{}\n\tcase v1.SchemeGroupVersion.WithKind(\"NodeFabricNetworkAttachmentSpec\"):\n\t\treturn &acifabricattachmentv1.NodeFabricNetworkAttachmentSpecApplyConfiguration{}\n\tcase v1.SchemeGroupVersion.WithKind(\"NodeFabricNetworkAttachmentStatus\"):\n\t\treturn &acifabricattachmentv1.NodeFabricNetworkAttachmentStatusApplyConfiguration{}\n\tcase v1.SchemeGroupVersion.WithKind(\"ObjRef\"):\n\t\treturn &acifabricattachmentv1.ObjRefApplyConfiguration{}\n\tcase v1.SchemeGroupVersion.WithKind(\"PodAttachment\"):\n\t\treturn &acifabricattachmentv1.PodAttachmentApplyConfiguration{}\n\tcase v1.SchemeGroupVersion.WithKind(\"StaticFabricNetworkAttachment\"):\n\t\treturn &acifabricattachmentv1.StaticFabricNetworkAttachmentApplyConfiguration{}\n\tcase v1.SchemeGroupVersion.WithKind(\"StaticFabricNetworkAttachmentSpec\"):\n\t\treturn &acifabricattachmentv1.StaticFabricNetworkAttachmentSpecApplyConfiguration{}\n\tcase v1.SchemeGroupVersion.WithKind(\"StaticFabricNetworkAttachmentStatus\"):\n\t\treturn &acifabricattachmentv1.StaticFabricNetworkAttachmentStatusApplyConfiguration{}\n\tcase v1.SchemeGroupVersion.WithKind(\"VlanRef\"):\n\t\treturn &acifabricattachmentv1.VlanRefApplyConfiguration{}\n\tcase v1.SchemeGroupVersion.WithKind(\"VlanSpec\"):\n\t\treturn &acifabricattachmentv1.VlanSpecApplyConfiguration{}\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fb720843429d5c8c217c7569c1029bfb", "score": "0.45380127", "text": "func (p *Proxy) constructRoute(clusterURL string, ns string) (string, string, error) {\n\tappSuffix := p.clusters[clusterURL]\n\tif len(appSuffix) == 0 {\n\t\treturn \"\", \"\", fmt.Errorf(\"could not find entry for cluster %s\", clusterURL)\n\t}\n\troute := fmt.Sprintf(\"jenkins-%s.%s\", ns, p.clusters[clusterURL])\n\treturn route, \"https\", nil\n}", "title": "" }, { "docid": "4447b837110012754e74e33c2c3a3665", "score": "0.45303786", "text": "func (h Client) GetManifestString(namespace, release string) (string, error) {\n\tout, err := h.get(\"manifest\", namespace, release)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn out, err\n}", "title": "" }, { "docid": "070020aa1850e1650fdf2fcade14132e", "score": "0.45172065", "text": "func ConstructPxReleaseManifestURL(specGenURL string) (string, error) {\n\tu, err := url.Parse(specGenURL)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to parse URL [%s], Err: %v\", specGenURL, err)\n\t}\n\tu.Path = path.Join(u.Path, \"version\")\n\treturn u.String(), nil\n}", "title": "" }, { "docid": "6ce5a6ecfaae834605d4ac37bf249f5d", "score": "0.45135903", "text": "func rktGetManifest(uuid string) (*appcschema.PodManifest, error) {\n\tstatusArgs := []string{\n\t\t\"cat-manifest\",\n\t\tuuid,\n\t}\n\tvar outBuf bytes.Buffer\n\tcmd := exec.Command(rktCmd, statusArgs...)\n\tcmd.Stdout = &outBuf\n\tcmd.Stderr = ioutil.Discard\n\tif err := cmd.Run(); err != nil {\n\t\treturn nil, err\n\t}\n\tvar manifest appcschema.PodManifest\n\tif err := json.Unmarshal(outBuf.Bytes(), &manifest); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &manifest, nil\n}", "title": "" }, { "docid": "80121fc8194aa3e554af20fff7fabfd7", "score": "0.4501499", "text": "func GetKubeDNSManifest(kubeVersion *version.Version) string {\n\t// v1.7.0+ has only one known YAML manifest spec, just return that here\n\t// In the future when the kube-dns version is bumped at HEAD; add conditional logic to return the right manifest\n\treturn v170AndAboveKubeDNSDeployment\n}", "title": "" }, { "docid": "7abeff5fe129c15ce0951004b8343688", "score": "0.44793126", "text": "func Get(name string) string {\n\n\tfor i := 0; i < len(name); i++ {\n\t\tif name[i] == '_' {\n\t\t\tstr := name[:i]\n\t\t\tif versionReg.FindString(str) != \"\" {\n\t\t\t\treturn str\n\t\t\t}\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "ab9a9a53359bc6199e954b2bb2fac23b", "score": "0.4476679", "text": "func (r *ReconcileKogitoApp) GetRouteHost(route oroutev1.Route, cr *v1alpha1.KogitoApp) string {\n\tlog := log.With(\"kind\", route.GetObjectKind().GroupVersionKind().Kind, \"name\", route.Name, \"namespace\", route.Namespace)\n\n\tfor i := 1; i < 60; i++ {\n\t\ttime.Sleep(time.Duration(100) * time.Millisecond)\n\t\tif exists, err :=\n\t\t\tkubernetes.ResourceC(r.client).FetchWithKey(types.NamespacedName{Name: route.Name, Namespace: route.Namespace}, &route); exists {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\tlog.Error(\"Error getting Route. \", err)\n\t\t}\n\t}\n\n\treturn route.Spec.Host\n}", "title": "" }, { "docid": "63c4ab04157c452d89d7de9d2c3541b6", "score": "0.44736657", "text": "func ExtractKindFromManifest(manifest string) string {\n\tre := regexp.MustCompile(kindRegex)\n\tmatches := re.FindStringSubmatch(manifest)\n\n\tif len(matches) > 0 {\n\t\treturn matches[1]\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "cef54ff2b9803ff7373b0b7d87a373e4", "score": "0.4468864", "text": "func GenerateBindingName(kind, name string) string {\n\t// The name of resources, like 'Role'/'ClusterRole'/'RoleBinding'/'ClusterRoleBinding',\n\t// may contain symbols(like ':') that are not allowed by CRD resources which require the\n\t// name can be used as a DNS subdomain name. So, we need to replace it.\n\t// These resources may also allow for other characters(like '&','$') that are not allowed\n\t// by CRD resources, we only handle the most common ones now for performance concerns.\n\t// For more information about the DNS subdomain name, please refer to\n\t// https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names.\n\tif strings.Contains(name, \":\") {\n\t\tname = strings.ReplaceAll(name, \":\", \".\")\n\t}\n\n\treturn strings.ToLower(name + \"-\" + kind)\n}", "title": "" }, { "docid": "30efc294a69cdb46221dce307c3c20aa", "score": "0.44653413", "text": "func mapChildNamespaceRoute(route martini.Router, namespace *schema.Namespace) {\n\tlog.Debug(\"[Path] %s\", namespace.GetFullPrefix())\n\troute.Get(\n\t\tnamespace.GetFullPrefix(),\n\t\tfunc(w http.ResponseWriter, r *http.Request, p martini.Params, context martini.Context) {\n\t\t\tresources := []schema.NamespaceResource{}\n\t\t\tfor _, s := range schema.GetManager().Schemas() {\n\t\t\t\tif s.NamespaceID == namespace.ID {\n\t\t\t\t\tresources = append(resources, schema.NamespaceResource{\n\t\t\t\t\t\tLinks: []schema.Link{\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tHref: s.GetPluralURL(),\n\t\t\t\t\t\t\t\tRel: \"self\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tName: s.Singular,\n\t\t\t\t\t\tCollection: s.Plural,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\troutes.ServeJson(w, map[string][]schema.NamespaceResource{\"resources\": resources})\n\t\t},\n\t)\n}", "title": "" }, { "docid": "e2d60b600f60dcccf67fd264171fa8d0", "score": "0.4464465", "text": "func (msg MsgCreateBid) Route() string { return RouterKey }", "title": "" }, { "docid": "e2d60b600f60dcccf67fd264171fa8d0", "score": "0.4464465", "text": "func (msg MsgCreateBid) Route() string { return RouterKey }", "title": "" }, { "docid": "e2d60b600f60dcccf67fd264171fa8d0", "score": "0.4464465", "text": "func (msg MsgCreateBid) Route() string { return RouterKey }", "title": "" }, { "docid": "224615bd3b6d530effe8af4da5d5dc8a", "score": "0.4444577", "text": "func Get(name string) string {\n\tfor i := 0; i < len(name); i++ {\n\t\tif name[i] == '_' {\n\t\t\tstr := name[:i]\n\t\t\tif versionReg.FindString(str) != \"\" {\n\t\t\t\treturn str\n\t\t\t}\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "a3d624279455892c95a9d88958669bc8", "score": "0.44427237", "text": "func buildRoute(name, namespace, serviceName string) *routev1.Route {\n\treturn &routev1.Route{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t},\n\t\tSpec: routev1.RouteSpec{\n\t\t\tTo: routev1.RouteTargetReference{\n\t\t\t\tKind: \"Service\",\n\t\t\t\tName: serviceName,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "577ba09a4f28f9a60fbbb4a8b25d68c0", "score": "0.43905535", "text": "func (AppModule) Route() string { return types.RouterKey }", "title": "" }, { "docid": "0423df84704ce1460dbf34be51f12448", "score": "0.43721023", "text": "func TestBucketGetSnapshotDirectRoute(t *testing.T) {\n\t// t.Skip()\n\tbucket.SetLogger(log)\n\n\tbkt := bucket.New()\n\n\tfilename := \"./bucket-obus-node-01-eds-rds-60001-route-direct.yaml\"\n\terr := bkt.FromFile(filename)\n\n\tif err != nil {\n\t\tt.Errorf(\"Could not bkt.FromFile(%s), err = %s\", filename, err)\n\t}\n\n\tif val , exp := bkt.Routes.Items[0].VirtualHosts[0].Routes[0].Route.ClusterName, \"obus-server-60001\";\n\tval != exp {\n\t\tt.Errorf(\"bkt.Routes.Items[0].VirtualHosts[0].Routes[0].Route.ClusterName = %s, should be %s\", val, exp)\n\t}\n\n\tsnapshot, err := bkt.GetSnapshot()\n\t\n\tif err != nil {\n\t\tt.Errorf(\"Could not bkt.GetSnapshot(), err = %+v\", err)\n\t}\n\n\tres := snapshot.Endpoints.Items[0]\n\n\tclusterName := cache.GetResourceName(res)\n\n\tif clusterName != \"obus-server-60001\" {\n\t\tt.Errorf(\"clusterName := cache.GetResourceName(item) = %s, should be %s\", clusterName, \"obus-server-60001\")\n\t}\n\n\tcla := res.(*v2.ClusterLoadAssignment)\n\n\t// TODO: check some more accessor methods \n\taddr := cla.Endpoints[0].LbEndpoints[0].Endpoint.Address.Address\n\tif fmt.Sprintf(\"%+v\",addr) != \"&{SocketAddress:address:\\\"127.0.0.1\\\" port_value:60001 }\" {\n\t\tt.Errorf(\"addr does not match\")\n\t}\n\t\n}", "title": "" }, { "docid": "cbc76f2f851721f80661fefdeba6f46d", "score": "0.43713903", "text": "func (f *lazyCallReq) RoutingKey() []byte {\n\treturn f.key\n}", "title": "" }, { "docid": "a27ee6bd31fa5372269dc8e92769ff52", "score": "0.43676654", "text": "func (module *SdkLibrary) apiDistPath(apiScope *apiScope) string {\n\treturn path.Join(\"apistubs\", module.distGroup(), apiScope.name)\n}", "title": "" }, { "docid": "59ade09e3e47ddcb770b9fdb434d7dce", "score": "0.43612498", "text": "func (AppModule) Route() string {\n\treturn RouterKey\n}", "title": "" }, { "docid": "c6e36190d5147b9808f0c8f9b7a0b28a", "score": "0.4349051", "text": "func (p *postProcessor) Manifest() (map[string]ManifestEntry, error) {\n\tlog.Println(\"updating gapic manifest\")\n\tentries := map[string]ManifestEntry{} // Key is the package name.\n\tf, err := os.Create(filepath.Join(p.googleCloudDir, \"internal\", \".repo-metadata-full.json\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\tfor _, manual := range p.config.ManualClientInfo {\n\t\tentries[manual.DistributionName] = *manual\n\t}\n\tfor inputDir, conf := range p.config.GoogleapisToImportPath {\n\t\tif conf.ServiceConfig == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tyamlPath := filepath.Join(p.googleapisDir, inputDir, conf.ServiceConfig)\n\t\tyamlFile, err := os.Open(yamlPath)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tyamlConfig := struct {\n\t\t\tTitle string `yaml:\"title\"` // We only need the title and name.\n\t\t\tNameFull string `yaml:\"name\"` // We only need the title and name.\n\t\t}{}\n\t\tif err := yaml.NewDecoder(yamlFile).Decode(&yamlConfig); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"decode: %v\", err)\n\t\t}\n\t\tdocURL, err := docURL(p.googleCloudDir, conf.ImportPath, conf.RelPath)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to build docs URL: %v\", err)\n\t\t}\n\t\treleaseLevel, err := releaseLevel(p.googleCloudDir, conf.ImportPath, conf.RelPath)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to calculate release level for %v: %v\", inputDir, err)\n\t\t}\n\n\t\tapiShortname, err := apiShortname(yamlConfig.NameFull)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to determine api_shortname from %v: %v\", yamlConfig.NameFull, err)\n\t\t}\n\n\t\tentry := ManifestEntry{\n\t\t\tAPIShortname: apiShortname,\n\t\t\tDistributionName: conf.ImportPath,\n\t\t\tDescription: yamlConfig.Title,\n\t\t\tLanguage: \"go\",\n\t\t\tClientLibraryType: \"generated\",\n\t\t\tClientDocumentation: docURL,\n\t\t\tReleaseLevel: releaseLevel,\n\t\t\tLibraryType: gapicAutoLibraryType,\n\t\t}\n\t\tentries[conf.ImportPath] = entry\n\t}\n\t// Remove base module entry\n\tdelete(entries, \"\")\n\tenc := json.NewEncoder(f)\n\tenc.SetIndent(\"\", \" \")\n\treturn entries, enc.Encode(entries)\n}", "title": "" }, { "docid": "2b4b281813fb0287e15bae12b1128a94", "score": "0.4346979", "text": "func (r *RouteListEntry) RouteName() string {\n\treturn fmt.Sprintf(\"+11%-13s\", r.routeName)\n}", "title": "" }, { "docid": "6f25579f188d87443ae00161adc71d2c", "score": "0.4342286", "text": "func getResource(mapping *meta.RESTMapping, config *rest.Config, group string,\n\tversion string, namespace string, name string) error {\n\trestClient, err := getRESTClient(config, group, version)\n\tif err != nil {\n\t\treturn &kfapis.KfError{\n\t\t\tCode: int(kfapis.INVALID_ARGUMENT),\n\t\t\tMessage: fmt.Sprintf(\"getResource error: %v\", err),\n\t\t}\n\t}\n\n\tif _, err = restClient.\n\t\tGet().\n\t\tResource(mapping.Resource.Resource).\n\t\tNamespaceIfScoped(namespace, mapping.Scope.Name() == \"namespace\").\n\t\tName(name).\n\t\tDo().\n\t\tGet(); err == nil {\n\t\treturn nil\n\t} else {\n\t\treturn &kfapis.KfError{\n\t\t\tCode: int(kfapis.INVALID_ARGUMENT),\n\t\t\tMessage: fmt.Sprintf(\"getResource error: %v\", err),\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7975d46e1cd8c421b81747cf2edc3853", "score": "0.43373233", "text": "func getRBACResourceName(owner metav1.Object) string {\n\treturn fmt.Sprintf(\"%s-%s-%s-%s\", owner.GetNamespace(), owner.GetName(), cspmRBACPrefix, \"cluster-agent\")\n}", "title": "" }, { "docid": "32584f6eb1a9893bb6af708a3e3169f5", "score": "0.43358457", "text": "func (action ActionScheduleUpgrade) Route() string { return \"consortium\" }", "title": "" }, { "docid": "513293f7960ac5d9022d9b3fb369d55b", "score": "0.43277946", "text": "func buildManifest(name, tag, layerDigest string) (io.Reader, error) {\n\tmapping := map[string]interface{}{\n\t\t\"schemaVersion\": 1,\n\t\t\"name\": name,\n\t\t\"tag\": tag,\n\t\t\"architecture\": \"amd64\",\n\t\t\"fsLayers\": []map[string]interface{}{\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"blobSum\": \"sha256:\" + layerDigest,\n\t\t\t},\n\t\t},\n\t\t\"history\": []map[string]string{\n\t\t\tmap[string]string{\n\t\t\t\t\"v1Compatibility\": fmt.Sprintf(`{\n\t\t\t\t\t\"architecture\": \"amd64\",\n\t\t\t\t\t\"config\": {\n\t\t\t\t\t\t\"Entrypoint\": [\"/entrypoint\"]\n\t\t\t\t\t},\n\t\t\t\t\t\"id\": \"%s\"\n\t\t\t\t}`, layerDigest),\n\t\t\t},\n\t\t},\n\t}\n\tsig, err := libtrust.NewJSONSignatureFromMap(mapping)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to make JSON sig: %s\\n\", err)\n\t\treturn nil, err\n\t}\n\n\trsaKey, err := rsa.GenerateKey(rand.Reader, 1024)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tkey, err := libtrust.FromCryptoPrivateKey(rsaKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = sig.Sign(key)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to sign: %s\\n\", err)\n\t\treturn nil, err\n\t}\n\n\tblob, err := sig.PrettySignature(\"signatures\")\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to add sig: %s\\n\", err)\n\t\treturn nil, err\n\t}\n\n\tfmt.Printf(\"%s\\n\", string(blob))\n\treturn bytes.NewReader(blob), nil\n}", "title": "" }, { "docid": "2c9ef43f036b48f5539be43d02062532", "score": "0.42990372", "text": "func generateWarcFileName(prefix string, compression string, serial int) (fileName string) {\n\t// Get host name as reported by the kernel\n\thostName, err := os.Hostname()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tformattedSerial := formatSerial(serial, \"5\")\n\n\tif compression != \"\" {\n\t\tif compression == \"GZIP\" {\n\t\t\treturn prefix + \"-\" + time.Now().UTC().Format(\"20060102150405\") + \"-\" + formattedSerial + \"-\" + hostName + \".warc.gz.open\"\n\t\t}\n\t\tif compression == \"ZSTD\" {\n\t\t\treturn prefix + \"-\" + time.Now().UTC().Format(\"20060102150405\") + \"-\" + formattedSerial + \"-\" + hostName + \".warc.zst.open\"\n\t\t}\n\t}\n\treturn prefix + \"-\" + time.Now().UTC().Format(\"20060102150405\") + \"-\" + formattedSerial + \"-\" + hostName + \".warc.open\"\n}", "title": "" }, { "docid": "7bd0620eec1722395c8595caade2109f", "score": "0.42868617", "text": "func (c *Config) GetConsoleRouteName() string {\n\treturn c.member.GetString(varConsoleRouteName)\n}", "title": "" }, { "docid": "b545f468afdde927464432719ee3d9a0", "score": "0.42829174", "text": "func generateManifest(gitRepo *gitRepo, imageName, imageTag string) (*registry.ManifestData, error) {\n\tbranches, err := gitRepo.branch()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar imageChecksums []string = make([]string, len(branches))\n\tfor _, br := range branches {\n\t\tchecksum := br.imageID()\n\t\tsumTypeBytes, err := gitRepo.branchDescription(br)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\timageChecksums[br.number()] = string(sumTypeBytes) + \":\" + checksum\n\t}\n\n\tmanifest := &registry.ManifestData{\n\t\tName: imageName,\n\t\tArchitecture: \"amd64\", //unclean but so far looks ok ...\n\t\tTag: imageTag,\n\t\tSchemaVersion: 1,\n\t\tFSLayers: make([]*registry.FSLayer, 0, 4),\n\t}\n\n\tfor i, checksum := range imageChecksums {\n\t\tif tarsum.VersionLabelForChecksum(checksum) != tarsum.Version1.String() {\n\t\t\t//need to calculate the tarsum V1 for each layer ...\n\t\t\tlayerData, err := gitRepo.exportChangeSet(branches[i])\n\t\t\tif err == ErrNoChange {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tdefer layerData.Close()\n\n\t\t\ttarSum, err := tarsum.NewTarSum(layerData, true, tarsum.Version1)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif _, err := io.Copy(ioutil.Discard, tarSum); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tchecksum = tarSum.Sum(nil)\n\t\t}\n\t\tmanifest.FSLayers = append(manifest.FSLayers, &registry.FSLayer{BlobSum: checksum})\n\t}\n\treturn manifest, nil\n}", "title": "" }, { "docid": "57551b79ad62b34266f57a597d4a71ae", "score": "0.42793658", "text": "func GetRoute(inRoute string) string {\n\tind := FindOccurences(inRoute, \"/\", 2)\n\treturn inRoute[:ind]\n}", "title": "" }, { "docid": "933d2ca8ad073ec75657d509ac7bf56b", "score": "0.4278871", "text": "func (*Route) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_routing_v2_route_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "adc9cdf96e79ba39c8e5dd740657a4a2", "score": "0.42766708", "text": "func (c *Config) GetCheKeycloakRouteName() string {\n\treturn c.member.GetString(varCheKeycloakRouteName)\n}", "title": "" }, { "docid": "c2c05969bd39ee122118ccc8ba818dff", "score": "0.42681444", "text": "func getManifest(fimg *sif.FileImage) pluginapi.Manifest {\n\treturn pluginapi.Manifest{}\n}", "title": "" }, { "docid": "ec75285aae892a2bc3d1094ebecc3c28", "score": "0.42612764", "text": "func (o *NumbersACH) GetRouting() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Routing\n}", "title": "" }, { "docid": "181b53417f00ce7669fdba59765d2ceb", "score": "0.42574108", "text": "func (*PolicyBasedRoute) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkconnectivity_v1_policy_based_routing_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "fee22dd4e47563454e9b2b588dce0d9e", "score": "0.425523", "text": "func (r *Registry) GetManifest(pkg, version string) (*Manifest, error) {\n\treq, err := r.client.NewRequest(\"GET\", path.Join(pkg, version), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := r.client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tdec := json.NewDecoder(resp.Body)\n\tvar m *Manifest\n\tif err := dec.Decode(&m); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "69fac22b28d08fa55190f0a63e9aa7c3", "score": "0.42531893", "text": "func (br *BGPReflector) vppRoute(dst *net.IPNet, gw net.IP) (key string, config *vpp_l3.Route) {\n\troute := &vpp_l3.Route{\n\t\tDstNetwork: dst.String(),\n\t\tNextHopAddr: gw.String(),\n\t\tOutgoingInterface: br.ContivConf.GetMainInterfaceName(),\n\t\tVrfId: br.ContivConf.GetRoutingConfig().MainVRFID,\n\t}\n\treturn models.Key(route), route\n}", "title": "" }, { "docid": "3309ce80e6aae1cc3eae1489729bd616", "score": "0.424999", "text": "func (t *TestSpec) GetManifestName() string {\n\treturn fmt.Sprintf(\"%s_manifest.yaml\", t.Prefix)\n}", "title": "" }, { "docid": "c90b7c524b91be962bd950f83b8c0db5", "score": "0.42446584", "text": "func manifestDispatcher(ctx *Context, r *http.Request) http.Handler {\n\tmanifestHandler := &manifestHandler{\n\t\tContext: ctx,\n\t}\n\tref := getReference(ctx)\n\tdgst, err := digest.Parse(ref)\n\tif err != nil {\n\t\t// We just have a tag\n\t\tmanifestHandler.Tag = ref\n\t} else {\n\t\tmanifestHandler.Digest = dgst\n\t}\n\n\tmhandler := handlers.MethodHandler{\n\t\thttp.MethodGet: http.HandlerFunc(manifestHandler.GetManifest),\n\t\thttp.MethodHead: http.HandlerFunc(manifestHandler.GetManifest),\n\t}\n\n\tif !ctx.readOnly {\n\t\tmhandler[http.MethodPut] = http.HandlerFunc(manifestHandler.PutManifest)\n\t\tmhandler[http.MethodDelete] = http.HandlerFunc(manifestHandler.DeleteManifest)\n\t}\n\n\treturn mhandler\n}", "title": "" }, { "docid": "540f191ad45b57880987ef7126362cb6", "score": "0.42422876", "text": "func (*ResourceManifest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_gkehub_v1_membership_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "674fba8242bb7f71a0ae8260eb6b0b56", "score": "0.42419273", "text": "func (c *Catalog) BPMReleaseWithAffinity() *manifest.Manifest {\n\tm, err := manifest.LoadYAML([]byte(bm.BPMReleaseWithAffinity))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "5a4577dc62fb16fdcadfdd0b7b394ec1", "score": "0.42418078", "text": "func getRouteOperation(in *route.Route, vsName string, port int) string {\n\tpath := \"/*\"\n\tm := in.GetMatch()\n\tps := m.GetPathSpecifier()\n\tif ps != nil {\n\t\tswitch ps.(type) {\n\t\tcase *route.RouteMatch_Prefix:\n\t\t\tpath = fmt.Sprintf(\"%s*\", m.GetPrefix())\n\t\tcase *route.RouteMatch_Path:\n\t\t\tpath = m.GetPath()\n\t\tcase *route.RouteMatch_Regex:\n\t\t\tpath = m.GetRegex()\n\t\t}\n\t}\n\n\t// If there is only one destination cluster in route, return host:port/uri as description of route.\n\t// Otherwise there are multiple destination clusters and destination host is not clear. For that case\n\t// return virtual serivce name:port/uri as substitute.\n\tif c := in.GetRoute().GetCluster(); model.IsValidSubsetKey(c) {\n\t\t// Parse host and port from cluster name.\n\t\t_, _, h, p := model.ParseSubsetKey(c)\n\t\treturn fmt.Sprintf(\"%s:%d%s\", h, p, path)\n\t}\n\treturn fmt.Sprintf(\"%s:%d%s\", vsName, port, path)\n}", "title": "" }, { "docid": "4aeffa1bb16865e47c85d627ca0483a2", "score": "0.42386445", "text": "func (msg MsgBuyName) Route() string { return RouterKey }", "title": "" }, { "docid": "036774c893f51d80addeb6712b96b8b4", "score": "0.42371756", "text": "func buildRoute(prefix, route string) string {\n\treturn strings.TrimRight(prefix, \"/\") + \"/\" + strings.TrimLeft(route, \"/\")\n}", "title": "" }, { "docid": "9014f51943cf43d5744c11b33418e1ef", "score": "0.42333815", "text": "func getKindRefID(params GetResourceParams) (string, error) {\n\tres, err := Get(params.GetParams)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar refID string\n\tswitch params.Kind {\n\tcase util.Apm:\n\t\tfor _, resource := range res.Resources.Apm {\n\t\t\trefID = *resource.RefID\n\t\t}\n\tcase util.Kibana:\n\t\tfor _, resource := range res.Resources.Kibana {\n\t\t\trefID = *resource.RefID\n\t\t}\n\tcase util.Elasticsearch:\n\t\tfor _, resource := range res.Resources.Elasticsearch {\n\t\t\trefID = *resource.RefID\n\t\t}\n\tcase util.Appsearch:\n\t\tfor _, resource := range res.Resources.Appsearch {\n\t\t\trefID = *resource.RefID\n\t\t}\n\tcase util.EnterpriseSearch:\n\t\tfor _, resource := range res.Resources.EnterpriseSearch {\n\t\t\trefID = *resource.RefID\n\t\t}\n\t}\n\n\tif refID == \"\" {\n\t\treturn \"\", fmt.Errorf(\"deployment get: resource kind %s is not available\", params.Kind)\n\t}\n\n\treturn refID, nil\n}", "title": "" }, { "docid": "85c2912328b393b5cb4b7d49319a5c7f", "score": "0.4232274", "text": "func BucketPathForRelease(bucketPrefix, buildType, releaseVersion, gitRef string) string {\n\tif buildType == BuildTypeRelease {\n\t\treturn fmt.Sprintf(\"%s/%s/%s-%s\", bucketPrefix, buildType, releaseVersion, gitRef)\n\t}\n\treturn fmt.Sprintf(\"%s/%s/%s\", bucketPrefix, buildType, gitRef)\n}", "title": "" }, { "docid": "e0df6c402eccb2fa97b8ff600efa50b6", "score": "0.42305574", "text": "func (msg MsgBurn) Route() string { return RouterKey }", "title": "" }, { "docid": "0760c247a9b66fe18108b6a953fb4b2a", "score": "0.42258888", "text": "func deriveName(root, full string) string {\n\tshort, _ := filepath.Rel(root, full)\n\tbits := strings.Split(short, string(os.PathSeparator))\n\treturn strings.Join(bits, \"-\")\n}", "title": "" }, { "docid": "7cc62976b5ffc12f0bea3fbfbd7ca2e7", "score": "0.4223971", "text": "func getNameFromARN(arn string) string {\n\tif ss := strings.Split(arn, \"/\"); len(ss) > 0 {\n\t\tarn = ss[len(ss)-1]\n\t}\n\treturn arn\n}", "title": "" }, { "docid": "f286abcea4aa40d60d0d5bf8eaea5c81", "score": "0.42173108", "text": "func (*PolicyBasedRoute_Filter) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkconnectivity_v1_policy_based_routing_proto_rawDescGZIP(), []int{0, 2}\n}", "title": "" }, { "docid": "eddfe0f89193e0493ab848f4e12beacf", "score": "0.42163336", "text": "func (msg MsgSetShareHolder) Route() string { return RouterKey }", "title": "" }, { "docid": "81f521f01b78f78b414b68ecb37173bb", "score": "0.42112565", "text": "func (p *postProcessor) Manifest() (map[string]ManifestEntry, error) {\n\tlog.Println(\"updating gapic manifest\")\n\tentries := map[string]ManifestEntry{} // Key is the package name.\n\tf, err := os.Create(filepath.Join(p.googleCloudDir, \"internal\", \".repo-metadata-full.json\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\tfor _, manual := range p.config.ManualClientInfo {\n\t\tentries[manual.DistributionName] = *manual\n\t}\n\tfor inputDir, conf := range p.config.GoogleapisToImportPath {\n\t\tif conf.ServiceConfig == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tyamlPath := filepath.Join(p.googleapisDir, inputDir, conf.ServiceConfig)\n\t\tyamlFile, err := os.Open(yamlPath)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tyamlConfig := struct {\n\t\t\tTitle string `yaml:\"title\"` // We only need the title field.\n\t\t}{}\n\t\tif err := yaml.NewDecoder(yamlFile).Decode(&yamlConfig); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"decode: %v\", err)\n\t\t}\n\t\tdocURL, err := docURL(p.googleCloudDir, conf.ImportPath)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to build docs URL: %v\", err)\n\t\t}\n\t\treleaseLevel, err := releaseLevel(p.googleCloudDir, conf.ImportPath)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to calculate release level for %v: %v\", inputDir, err)\n\t\t}\n\n\t\tentry := ManifestEntry{\n\t\t\tDistributionName: conf.ImportPath,\n\t\t\tDescription: yamlConfig.Title,\n\t\t\tLanguage: \"Go\",\n\t\t\tClientLibraryType: \"generated\",\n\t\t\tDocsURL: docURL,\n\t\t\tReleaseLevel: releaseLevel,\n\t\t\tLibraryType: gapicAutoLibraryType,\n\t\t}\n\t\tentries[conf.ImportPath] = entry\n\t}\n\t// Remove base module entry\n\tdelete(entries, \"\")\n\tenc := json.NewEncoder(f)\n\tenc.SetIndent(\"\", \" \")\n\treturn entries, enc.Encode(entries)\n}", "title": "" }, { "docid": "17e8c2a44da339d293c47eda848b57b1", "score": "0.42109072", "text": "func (app AppModule) Route() string {\n\treturn RouterKey\n}", "title": "" }, { "docid": "9b987cbd705c1b1412c6ea70cc5d44fb", "score": "0.420816", "text": "func (msg MsgAuctionBid) Route() string { return RouterKey }", "title": "" }, { "docid": "15bdd5149283f66ae7e05d58f05dfcfb", "score": "0.42080182", "text": "func (msg MsgCreatePDV) Route() string { return RouterKey }", "title": "" }, { "docid": "03a0192d7f4d9c2e6c413b6a0603232a", "score": "0.42058563", "text": "func pathFromManifest(pluginapi.Manifest) string {\n\treturn \"\"\n}", "title": "" }, { "docid": "0db327580cbc42b070dfcc68a638dd99", "score": "0.42032218", "text": "func (r *RouteListEntry) CopiesInRoute() string {\n\tif r.copiesInRoute == 0 {\n\t\treturn \"\"\n\t}\n\treturn fmt.Sprintf(\"+23%06d\", r.copiesInRoute)\n}", "title": "" }, { "docid": "d827eef39a43047a0a5dc25f49bcbd43", "score": "0.4198199", "text": "func (ref ostreeReference) manifestPath() string {\n\treturn filepath.Join(\"manifest\", \"manifest.json\")\n}", "title": "" }, { "docid": "8205a587c8fec3f3bd5f00c20150a0d3", "score": "0.4197801", "text": "func routeIdentifier(vrf uint32, destination string, nextHop string) string {\n\tif nextHop == \"<nil>\" {\n\t\tnextHop = \"\"\n\t}\n\treturn fmt.Sprintf(\"vrf%v-%v-%v\", vrf, destination, nextHop)\n}", "title": "" }, { "docid": "d1295296f5b7abd738f30d71c1221912", "score": "0.4191296", "text": "func (m *Manifest) GetReleaseImage(instanceGroupName, jobName string) (string, error) {\n\tvar instanceGroup *InstanceGroup\n\tfor i := range m.InstanceGroups {\n\t\tif m.InstanceGroups[i].Name == instanceGroupName {\n\t\t\tinstanceGroup = m.InstanceGroups[i]\n\t\t\tbreak\n\t\t}\n\t}\n\tif instanceGroup == nil {\n\t\treturn \"\", fmt.Errorf(\"instance group '%s' not found\", instanceGroupName)\n\t}\n\n\tvar stemcell *Stemcell\n\tfor i := range m.Stemcells {\n\t\tif m.Stemcells[i].Alias == instanceGroup.Stemcell {\n\t\t\tstemcell = m.Stemcells[i]\n\t\t}\n\t}\n\n\tvar job *Job\n\tfor i := range instanceGroup.Jobs {\n\t\tif instanceGroup.Jobs[i].Name == jobName {\n\t\t\tjob = &instanceGroup.Jobs[i]\n\t\t\tbreak\n\t\t}\n\t}\n\tif job == nil {\n\t\treturn \"\", fmt.Errorf(\"job '%s' not found in instance group '%s'\", jobName, instanceGroupName)\n\t}\n\n\tfor i := range m.Releases {\n\t\tif m.Releases[i].Name == job.Release {\n\t\t\trelease := m.Releases[i]\n\t\t\tname := strings.TrimRight(release.URL, \"/\")\n\n\t\t\tvar stemcellVersion string\n\n\t\t\tif release.Stemcell != nil {\n\t\t\t\tstemcellVersion = release.Stemcell.OS + \"-\" + release.Stemcell.Version\n\t\t\t} else {\n\t\t\t\tif stemcell == nil {\n\t\t\t\t\treturn \"\", fmt.Errorf(\"stemcell could not be resolved for instance group %s\", instanceGroup.Name)\n\t\t\t\t}\n\t\t\t\tstemcellVersion = stemcell.OS + \"-\" + stemcell.Version\n\t\t\t}\n\t\t\treturn fmt.Sprintf(\"%s/%s:%s-%s\", name, release.Name, stemcellVersion, release.Version), nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"release '%s' not found\", job.Release)\n}", "title": "" }, { "docid": "b63b07171eb25dcbd7740606b565bec7", "score": "0.4185759", "text": "func (*Route) Descriptor() ([]byte, []int) {\n\treturn file_route_api_route_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "bf488692ccb0184d64f0f5409d806e06", "score": "0.41844407", "text": "func buildRouteWithHost(name, namespace, serviceName, host string) *routev1.Route {\n\treturn &routev1.Route{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t},\n\t\tSpec: routev1.RouteSpec{\n\t\t\tHost: host,\n\t\t\tTo: routev1.RouteTargetReference{\n\t\t\t\tKind: \"Service\",\n\t\t\t\tName: serviceName,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "c74bc2aa89bd3075244c6853bc2a37c0", "score": "0.41793862", "text": "func clusteraction(cluster string) *v2.Route_Route {\n\treturn &v2.Route_Route{\n\t\tRoute: &v2.RouteAction{\n\t\t\tClusterSpecifier: &v2.RouteAction_Cluster{\n\t\t\t\tCluster: cluster,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "369cbe87bda5c5cc82d394867db87c7b", "score": "0.41782555", "text": "func (msg MsgCreatePeriodicVestingAccount) Route() string { return RouterKey }", "title": "" }, { "docid": "b57dfc8755f51bbc2df867403a241843", "score": "0.41769937", "text": "func PathNameToFullyQualified(path, name string) string {\n\t// The Path seems to use slash separators?!?!?\n\tif len(path) == 0 {\n\t\t// No scoping.\n\t\treturn name\n\t}\n\n\t// Replace \"std::__2\" prefixes which are standard library versioning stuff that the user\n\t// doesn't want to see.\n\tif strings.HasPrefix(path, \"std/__2\") {\n\t\tpath = strings.Replace(path, \"std/__2\", \"std\", 1)\n\t}\n\n\treturn strings.ReplaceAll(path, \"/\", \"::\") + \"::\" + name\n}", "title": "" }, { "docid": "c8fc7fa1df258ff99f250349f8bb736f", "score": "0.4172124", "text": "func (*Route) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{26}\n}", "title": "" }, { "docid": "5644d5b22b93063098312a9c8d09acc0", "score": "0.4166864", "text": "func (hs host) HostRouting(ctx *raptor.Context) error {\n\t// Check if a http.Handler is registered for the given host.\n\t// If yes, use it to handle the request.\n\tif cb := hosts[string(ctx.Host())]; cb != nil {\n\t\treturn cb(ctx)\n\t}\n\n\treturn ctx.Response().Forbidden(fmt.Errorf(\"not able to access\"))\n}", "title": "" }, { "docid": "e17aa052ae8c78ff8a0359533b888a0b", "score": "0.4162249", "text": "func ManifestFileName(fileNumber table.FileNumber) string {\n\treturn fmt.Sprintf(\"%s%06d\", ManifestPrefix, fileNumber)\n}", "title": "" }, { "docid": "68aaf17f6158df1921ec1d00bca7e1e4", "score": "0.41614103", "text": "func (*Route) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "c89d7c17d32848bc3a944f1c52871f18", "score": "0.41549566", "text": "func (msg MsgRemoveMember) Route() string { return RouterKey }", "title": "" }, { "docid": "bc738b6a373b0554b13fcb0f556bd773", "score": "0.41521508", "text": "func (*Routes) Descriptor() ([]byte, []int) {\n\treturn file_src_nap_nap_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "43f7a3cde7ba2d56190a451725297dbd", "score": "0.41504037", "text": "func getGVKFromCR(cr *olm.CRDDescription) (group, version, kind string, err error) {\n\tkind = cr.Kind\n\tversion = cr.Version\n\n\tgr := strings.SplitN(cr.Name, \".\", 2)\n\tif len(gr) != 2 {\n\t\terr = fmt.Errorf(\"Couldn't split Custom Resource's name into two: %s\", cr.Name)\n\t\treturn\n\t}\n\tgroup = gr[1]\n\n\treturn\n}", "title": "" }, { "docid": "dde137fb78428374589f9475d8fac8cd", "score": "0.41480887", "text": "func (msg MsgAuctionName) Route() string { return RouterKey }", "title": "" }, { "docid": "2ec74607dad4cc751b777ee1ab933ec4", "score": "0.41437066", "text": "func createRegistryKeyAndNamespace(cType reflect.Type) (string, string) {\n\tnamespace := cType.PkgPath()\n\tif idx := strings.Index(namespace, \"controllers\"); idx > -1 {\n\t\tnamespace = namespace[idx+11:]\n\t}\n\n\tif ess.IsStrEmpty(namespace) {\n\t\treturn strings.ToLower(cType.Name()), \"\"\n\t}\n\n\treturn strings.ToLower(path.Join(namespace[1:], cType.Name())), namespace[1:]\n}", "title": "" }, { "docid": "91ffe88b185482fd73aefc8c7aaac517", "score": "0.41380224", "text": "func TranslateRoute(route string) (string, error) {\n\t// Create a regular expression object to replace the /fact/ route.\n\tre1, err := regexp.Compile(\"/fact/\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// Replace the /fact/ route.\n\treroute := re1.ReplaceAllString(route, \"\")\n\t// Create another regular expression object to replace all \"/\" with \".\".\n\tre2, err := regexp.Compile(\"/\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// Replace all /.\n\tfactCmd := re2.ReplaceAllString(reroute, \".\")\n\tfmt.Println(factCmd)\n\t// Return the newly created command.\n\treturn factCmd, nil\n}", "title": "" }, { "docid": "f93eaa76c6c36b3efe51244d513a6fee", "score": "0.4137263", "text": "func nameFromResourceUrl(link string) string {\n\tparts := strings.Split(link, \"/\")\n\treturn parts[len(parts)-1]\n}", "title": "" }, { "docid": "d4534162339e55675d5637561ac89d68", "score": "0.41284075", "text": "func ConstructManifestWorkName(instance *agentv1.KlusterletAddonConfig, addon KlusterletAddon) string {\n\treturn instance.Name + manifestworkMidName + addon.GetAddonName()\n}", "title": "" }, { "docid": "fa50a194ca324b7aebae29dcd700ba25", "score": "0.41241696", "text": "func getStackName(input *commands.BucketInput) string {\n\treturn strings.Replace(input.FullDomainName, \".\", \"-\", -1) + \"-cdn\"\n}", "title": "" }, { "docid": "3eb04f712cf53a3e69d7622f3fd1c1f7", "score": "0.41109544", "text": "func buildManifestResourceMeta(\n\tindex int,\n\tmanifest workapiv1.Manifest,\n\trestMapper meta.RESTMapper) (resourceMeta workapiv1.ManifestResourceMeta, gvr schema.GroupVersionResource, err error) {\n\terrs := []error{}\n\n\tvar object runtime.Object\n\n\t// try to get resource meta from manifest if the one got from apply result is incompleted\n\tswitch {\n\tcase manifest.Object != nil:\n\t\tobject = manifest.Object\n\tdefault:\n\t\tunstructuredObj := &unstructured.Unstructured{}\n\t\tif err = unstructuredObj.UnmarshalJSON(manifest.Raw); err != nil {\n\t\t\terrs = append(errs, err)\n\t\t\treturn resourceMeta, gvr, utilerrors.NewAggregate(errs)\n\t\t}\n\t\tobject = unstructuredObj\n\t}\n\tresourceMeta, gvr, err = buildResourceMeta(index, object, restMapper)\n\tif err == nil {\n\t\treturn resourceMeta, gvr, nil\n\t}\n\n\treturn resourceMeta, gvr, utilerrors.NewAggregate(errs)\n}", "title": "" }, { "docid": "f95f77a66ed2dba4d1af7902d8715181", "score": "0.4106018", "text": "func swaggify(name string) string {\n\tname = strings.Replace(name, \"github.com/openkruise/kruise/apis\", \"kruise\", -1)\n\tparts := strings.Split(name, \"/\")\n\thostParts := strings.Split(parts[0], \".\")\n\t// reverses something like k8s.io to io.k8s\n\tfor i, j := 0, len(hostParts)-1; i < j; i, j = i+1, j-1 {\n\t\thostParts[i], hostParts[j] = hostParts[j], hostParts[i]\n\t}\n\tparts[0] = strings.Join(hostParts, \".\")\n\treturn strings.Join(parts, \".\")\n}", "title": "" } ]
9647b873210526979d097a3177472b54
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
[ { "docid": "aab855bfd8cb5ca52e5308fcaf1d1be5", "score": "0.0", "text": "func (in *ClusterMicroFrontendList) DeepCopyInto(out *ClusterMicroFrontendList) {\n\t*out = *in\n\tout.TypeMeta = in.TypeMeta\n\tin.ListMeta.DeepCopyInto(&out.ListMeta)\n\tif in.Items != nil {\n\t\tin, out := &in.Items, &out.Items\n\t\t*out = make([]ClusterMicroFrontend, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "1c2d70d782e9a1af879ef1c56794f835", "score": "0.8241005", "text": "func (in *Data) DeepCopyInto(out *Data) {\n\t*out = *in\n}", "title": "" }, { "docid": "da106d983b586b057f03d7a4a40c0ad7", "score": "0.8175346", "text": "func (in *Info) DeepCopyInto(out *Info) {\n\t*out = *in\n}", "title": "" }, { "docid": "fdea5f2ac6cc2ce2c38000e1d09d0d61", "score": "0.81511194", "text": "func (in *Binary) DeepCopyInto(out *Binary) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "0649f53a95cb6619607d3d1a0f4ddd1b", "score": "0.81382865", "text": "func (in *InterfacePasst) DeepCopyInto(out *InterfacePasst) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "96e806fc2839c14e1c5e0b59cb549799", "score": "0.80947465", "text": "func (id *ObjectId) DeepCopyInto(out *ObjectId) {\n\t*out = *id\n}", "title": "" }, { "docid": "96e806fc2839c14e1c5e0b59cb549799", "score": "0.80947465", "text": "func (id *ObjectId) DeepCopyInto(out *ObjectId) {\n\t*out = *id\n}", "title": "" }, { "docid": "8bde1b1cbaa096356e20c921603ac232", "score": "0.8040165", "text": "func (in *DatadogConfiugration) DeepCopyInto(out *DatadogConfiugration) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3f5da2ac6cfa7bd05112672385c886d2", "score": "0.80317825", "text": "func (in *DataExport) DeepCopyInto(out *DataExport) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8e7a3b08ebd7c00b7f2a3efdede21d3a", "score": "0.80277765", "text": "func (in *Selection) DeepCopyInto(out *Selection) {\n\t*out = *in\n\tif in.UseAllDevices != nil {\n\t\tin, out := &in.UseAllDevices, &out.UseAllDevices\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Devices != nil {\n\t\tin, out := &in.Devices, &out.Devices\n\t\t*out = make([]Device, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Directories != nil {\n\t\tin, out := &in.Directories, &out.Directories\n\t\t*out = make([]Directory, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.VolumeClaimTemplates != nil {\n\t\tin, out := &in.VolumeClaimTemplates, &out.VolumeClaimTemplates\n\t\t*out = make([]v1.PersistentVolumeClaim, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "eb90b1072cf91df16d578f58e7621cd0", "score": "0.8021358", "text": "func (in *ImpersonationProxyTLSSpec) DeepCopyInto(out *ImpersonationProxyTLSSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "ea03285e84e15a7cf1c08625d0146a63", "score": "0.8016487", "text": "func (in *FS) DeepCopyInto(out *FS) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "175c70831781dd23d04328f4bd884fc0", "score": "0.80046266", "text": "func (in *Hugepages) DeepCopyInto(out *Hugepages) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f27556289b17f8999672f1a5d66f41e9", "score": "0.7991963", "text": "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\r\n\t*out = *in\r\n\treturn\r\n}", "title": "" }, { "docid": "943731dcc5b0dd132eeb06116f982bdd", "score": "0.7986056", "text": "func (in *TestResult) DeepCopyInto(out *TestResult) {\n\t*out = *in\n}", "title": "" }, { "docid": "9e3fc04a6e6836d14ea52df87ac56ff7", "score": "0.7985898", "text": "func (in *TargetPath) DeepCopyInto(out *TargetPath) {\n\t*out = *in\n}", "title": "" }, { "docid": "1bd357ab02d89fa3997e03fbf4690533", "score": "0.798583", "text": "func (in *PVC) DeepCopyInto(out *PVC) {\n\t*out = *in\n}", "title": "" }, { "docid": "20912e92eb84ea1ec41dde40b691cafc", "score": "0.7982707", "text": "func (in *FloppyTarget) DeepCopyInto(out *FloppyTarget) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8da051a527c97b23131359841bf49407", "score": "0.7979259", "text": "func (in *ESIdle) DeepCopyInto(out *ESIdle) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "32411e48b0c41369a3b37f1f34c69604", "score": "0.79750234", "text": "func (in *Heapster) DeepCopyInto(out *Heapster) {\n\t*out = *in\n\tout.Addon = in.Addon\n\treturn\n}", "title": "" }, { "docid": "02e3fed7ff65a26076a354a53d6c154b", "score": "0.797314", "text": "func (in *Arguments) DeepCopyInto(out *Arguments) {\n\t*out = *in\n}", "title": "" }, { "docid": "09a622ae41a2172d4fd07d376190f880", "score": "0.79726225", "text": "func (in *Runtime) DeepCopyInto(out *Runtime) {\n\t*out = *in\n}", "title": "" }, { "docid": "3952b8f895516a1de32d72864f8387d7", "score": "0.7971759", "text": "func (in *Input) DeepCopyInto(out *Input) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "dc25f670b9ab6635efd1a7f707841646", "score": "0.7969516", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "acbc3f1efee5aaa8d03be05054421061", "score": "0.79676837", "text": "func (in *Backup) DeepCopyInto(out *Backup) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f1ea9399c096cf0b72bcb8ea02d6e108", "score": "0.796267", "text": "func (in *Imagestruct) DeepCopyInto(out *Imagestruct) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "188ae490063dcfa8bb2af538536656b9", "score": "0.7960631", "text": "func (in *Unstash) DeepCopyInto(out *Unstash) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "012b1e8c186c8bb5d6be717d858c96b9", "score": "0.79574555", "text": "func (in *ArbitraryObject) DeepCopyInto(out *ArbitraryObject) {\n\t*out = *in\n}", "title": "" }, { "docid": "1d7086a38f14633785818609a374af11", "score": "0.7956687", "text": "func (in *HostAndPath) DeepCopyInto(out *HostAndPath) {\n\t*out = *in\n}", "title": "" }, { "docid": "2c96afbae72d9d09403592d10a75dd2e", "score": "0.7953585", "text": "func (in *Incompatibility) DeepCopyInto(out *Incompatibility) {\n\t*out = *in\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.79455185", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.79455185", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "03b47d22a5efb39d6ec384531900b624", "score": "0.7942046", "text": "func (in *Ovs) DeepCopyInto(out *Ovs) {\n\t*out = *in\n}", "title": "" }, { "docid": "d9295895700ce483b375539279ecb7a0", "score": "0.79335976", "text": "func (in *Multus) DeepCopyInto(out *Multus) {\n\t*out = *in\n}", "title": "" }, { "docid": "ae8320d666daf42f7b276f91c508dfdb", "score": "0.7929629", "text": "func (in *File) DeepCopyInto(out *File) {\n\t*out = *in\n}", "title": "" }, { "docid": "736b857be3d993b086b590e39732d911", "score": "0.79283494", "text": "func (in *CleanupOptions) DeepCopyInto(out *CleanupOptions) {\n\t*out = *in\n}", "title": "" }, { "docid": "7f0d45d14df063a02ea85d0b366a2d3d", "score": "0.79271865", "text": "func (in *DynamoDBOutput) DeepCopyInto(out *DynamoDBOutput) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "e23b9d84f4323f0fc171205cc84e6f0b", "score": "0.79251206", "text": "func (in *General) DeepCopyInto(out *General) {\n\t*out = *in\n}", "title": "" }, { "docid": "614438a35d37b46a31778669cb3ed687", "score": "0.7918627", "text": "func (in *ImpersonationProxyInfo) DeepCopyInto(out *ImpersonationProxyInfo) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7f9d90d9468991d878220396a544f96e", "score": "0.7916139", "text": "func (in *Step) DeepCopyInto(out *Step) {\n\t*out = *in\n\tif in.Arguments != nil {\n\t\tin, out := &in.Arguments, &out.Arguments\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Options != nil {\n\t\tin, out := &in.Options, &out.Options\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.Loop != nil {\n\t\tin, out := &in.Loop, &out.Loop\n\t\t*out = new(Loop)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.Agent != nil {\n\t\tin, out := &in.Agent, &out.Agent\n\t\t*out = new(Agent)\n\t\t**out = **in\n\t}\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]v1.EnvVar, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Steps != nil {\n\t\tin, out := &in.Steps, &out.Steps\n\t\t*out = make([]*Step, len(*in))\n\t\tfor i := range *in {\n\t\t\tif (*in)[i] != nil {\n\t\t\t\tin, out := &(*in)[i], &(*out)[i]\n\t\t\t\t*out = new(Step)\n\t\t\t\t(*in).DeepCopyInto(*out)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "e8a780c4f533b75c3c678fa3003c7322", "score": "0.79145586", "text": "func (in *DataTarget) DeepCopyInto(out *DataTarget) {\n\t*out = *in\n}", "title": "" }, { "docid": "a38ef85c8eb850f5d0a0d92d3f4503d1", "score": "0.79142165", "text": "func (in *Workspace) DeepCopyInto(out *Workspace) {\n\t*out = *in\n}", "title": "" }, { "docid": "70c5f5879e07637980a325527fff4749", "score": "0.7911678", "text": "func (in *Check) DeepCopyInto(out *Check) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "cfc737b2f967c736e30dd8ee07d84b31", "score": "0.7910369", "text": "func (in *TupDBFrom) DeepCopyInto(out *TupDBFrom) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "b37eac6da40504e302f650ddd06037ad", "score": "0.7905837", "text": "func (in *CHVersion) DeepCopyInto(out *CHVersion) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "eae9a043ce1412b2407a7ae6b28a5fa1", "score": "0.79057217", "text": "func (in *Variable) DeepCopyInto(out *Variable) {\n\t*out = *in\n}", "title": "" }, { "docid": "1c8cc8d41acead0d4873c0186a5de6db", "score": "0.79053825", "text": "func (in *Container) DeepCopyInto(out *Container) {\n\t*out = *in\n\tif in.Command != nil {\n\t\tin, out := &in.Command, &out.Command\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Args != nil {\n\t\tin, out := &in.Args, &out.Args\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]EnvVar, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "5c9e6a5011797fcea0d83be108d0bb74", "score": "0.7904484", "text": "func (in *Command) DeepCopyInto(out *Command) {\n\t*out = *in\n}", "title": "" }, { "docid": "f8ee01c3ea1b08bcc0ba7b79af0aae57", "score": "0.79039085", "text": "func (in *InterfaceMacvtap) DeepCopyInto(out *InterfaceMacvtap) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "ebde97abbe9aa8149c7ca6159e15bd33", "score": "0.7901529", "text": "func (in *CPUAndMem) DeepCopyInto(out *CPUAndMem) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "da814d21ab5e82f1dded2d914bd0d7db", "score": "0.78990203", "text": "func (in *Maplet) DeepCopyInto(out *Maplet) {\n\t*out = *in\n}", "title": "" }, { "docid": "be1c2a75c97d2e1a1dc1b1b6323a206f", "score": "0.7895292", "text": "func (in *TupWasGit) DeepCopyInto(out *TupWasGit) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "b00adcbd292725cda24745b58102a425", "score": "0.78949636", "text": "func (in *RecyclingStrategy_Stable) DeepCopyInto(out *RecyclingStrategy_Stable) {\n\t*out = *in\n\tout.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral\n\tif in.XXX_unrecognized != nil {\n\t\tin, out := &in.XXX_unrecognized, &out.XXX_unrecognized\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "fa34b7a912adaa8fa8376df86845b6a8", "score": "0.7887936", "text": "func (in *VirtualMachineInstanceFileSystem) DeepCopyInto(out *VirtualMachineInstanceFileSystem) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "9a0aef88d71c929767eb4a0816465544", "score": "0.7887669", "text": "func (in *G1) DeepCopyInto(out *G1) {\n\t*out = *in\n}", "title": "" }, { "docid": "80574d29b6649e47f2a18a9ed7366cd8", "score": "0.78848225", "text": "func (in *TupDBTo) DeepCopyInto(out *TupDBTo) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "864f91224a6eb3d2308114ac2e729916", "score": "0.7883737", "text": "func (in *Commit) DeepCopyInto(out *Commit) {\n\t*out = *in\n}", "title": "" }, { "docid": "39ce8c74909b19176d16e3d69414e86a", "score": "0.78835493", "text": "func (in *BaseImage) DeepCopyInto(out *BaseImage) {\n\t*out = *in\n}", "title": "" }, { "docid": "a0004460d3beb4ca076e6ec2f48364a9", "score": "0.78806406", "text": "func (in *Grafana) DeepCopyInto(out *Grafana) {\n\t*out = *in\n}", "title": "" }, { "docid": "f52e07466bf5b35c939262569e273970", "score": "0.78801256", "text": "func (in *CheckoutFrom) DeepCopyInto(out *CheckoutFrom) {\n\t*out = *in\n}", "title": "" }, { "docid": "21cb77fa3d58ef3d1a2dc5850f634acc", "score": "0.7878023", "text": "func (in *ExtractionSource) DeepCopyInto(out *ExtractionSource) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f4f8255c221465ab5155dffb2fa7bd9f", "score": "0.78762114", "text": "func (in *NavigationNode) DeepCopyInto(out *NavigationNode) {\n\t*out = *in\n\tif in.Settings != nil {\n\t\tin, out := &in.Settings, &out.Settings\n\t\t*out = new(runtime.RawExtension)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.RequiredPermissions != nil {\n\t\tin, out := &in.RequiredPermissions, &out.RequiredPermissions\n\t\t*out = make([]RequiredPermission, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "28c1f4101022b22d6ae98fbe0d4ae73c", "score": "0.7873936", "text": "func (in *CreateJenkinsfileArguments) DeepCopyInto(out *CreateJenkinsfileArguments) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8497b8e7f460bc68e010890c739cb813", "score": "0.7867407", "text": "func (in *Machine) DeepCopyInto(out *Machine) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8497b8e7f460bc68e010890c739cb813", "score": "0.7867407", "text": "func (in *Machine) DeepCopyInto(out *Machine) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8497b8e7f460bc68e010890c739cb813", "score": "0.7867407", "text": "func (in *Machine) DeepCopyInto(out *Machine) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "b7d2317b7d71a72506d5e952c7d6ac1a", "score": "0.7867227", "text": "func (in *Detail) DeepCopyInto(out *Detail) {\n\t*out = *in\n\tif in.StringValue != nil {\n\t\tin, out := &in.StringValue, &out.StringValue\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.FloatValue != nil {\n\t\tin, out := &in.FloatValue, &out.FloatValue\n\t\t*out = new(float64)\n\t\t**out = **in\n\t}\n\tif in.BooleanValue != nil {\n\t\tin, out := &in.BooleanValue, &out.BooleanValue\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\treturn\n}", "title": "" }, { "docid": "f8f9d1e1517b16db1fb1e4dc33762f0b", "score": "0.7866757", "text": "func (in *VMSelector) DeepCopyInto(out *VMSelector) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "1e1088954cae99b323e1b34730ad0490", "score": "0.78638864", "text": "func (in *Proxy) DeepCopyInto(out *Proxy) {\n\t*out = *in\n}", "title": "" }, { "docid": "60f2c810f51132cc5295ed2b35dac8ab", "score": "0.78637475", "text": "func (in *Action) DeepCopyInto(out *Action) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "e39896940442e2145aef5b05f65f5935", "score": "0.78610134", "text": "func (in *PodInfo) DeepCopyInto(out *PodInfo) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7e85603bf93dd9729dd3185e72119127", "score": "0.7859668", "text": "func (in *FilesystemVirtiofs) DeepCopyInto(out *FilesystemVirtiofs) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "a510fbe7bc41427b104d0eaa08202270", "score": "0.78592116", "text": "func (in *Host) DeepCopyInto(out *Host) {\n\t*out = *in\n}", "title": "" }, { "docid": "d77a09323414bb5ead85df58d20c21f1", "score": "0.7858898", "text": "func (in *Match) DeepCopyInto(out *Match) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "4e37b1e20e1e9cfe9a36a9c44de31c56", "score": "0.78525716", "text": "func (in *ResultsAPIProperties) DeepCopyInto(out *ResultsAPIProperties) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "4c52e751685f7d72e9ecfa8aaa132ad2", "score": "0.78508145", "text": "func (in *VersionedObjectReference) DeepCopyInto(out *VersionedObjectReference) {\n\t*out = *in\n\tout.ObjectReference = in.ObjectReference\n\treturn\n}", "title": "" }, { "docid": "9c7a70c686477c87992e082ae028c122", "score": "0.78496075", "text": "func (in *ChaosTestSpec) DeepCopyInto(out *ChaosTestSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "e34b21a8afba2d52e3ecd2992cdcf0f8", "score": "0.78492355", "text": "func (in *ContainerRuntime) DeepCopyInto(out *ContainerRuntime) {\n\t*out = *in\n}", "title": "" }, { "docid": "7b05167b456af5c9293243358ed34ad7", "score": "0.7849049", "text": "func (in *PrestoNode) DeepCopyInto(out *PrestoNode) {\n\t*out = *in\n}", "title": "" }, { "docid": "e4913de28c2145467caf2d40a4f1654c", "score": "0.78480315", "text": "func (in *ConsoleType) DeepCopyInto(out *ConsoleType) {\n\t*out = *in\n}", "title": "" }, { "docid": "514cd9b91bbcfa62b3eaca4ea029adb6", "score": "0.7846557", "text": "func (in *TupWasFrom) DeepCopyInto(out *TupWasFrom) {\n\t*out = *in\n\tout.Git = in.Git\n\treturn\n}", "title": "" }, { "docid": "0661c6d1870948cb6bc664ce3e28ee0d", "score": "0.78450793", "text": "func (in *Action) DeepCopyInto(out *Action) {\n\t*out = *in\n\tout.FillInterval.Seconds = in.FillInterval.Seconds\n\tout.FillInterval.Nanos = in.FillInterval.Nanos\n\tout.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral\n\tif in.XXX_unrecognized != nil {\n\t\tin, out := &in.XXX_unrecognized, &out.XXX_unrecognized\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "73f5ed585bd057adce08054c75e5e8a8", "score": "0.7844685", "text": "func (in *TriggerStep) DeepCopyInto(out *TriggerStep) {\n\t*out = *in\n\tif in.Args != nil {\n\t\tin, out := &in.Args, &out.Args\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.SecretEnv != nil {\n\t\tin, out := &in.SecretEnv, &out.SecretEnv\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Volumes != nil {\n\t\tin, out := &in.Volumes, &out.Volumes\n\t\t*out = make([]TriggerVolumes, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.WaitFor != nil {\n\t\tin, out := &in.WaitFor, &out.WaitFor\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "647f1524647108952ee31ce014c689dc", "score": "0.7840403", "text": "func (in *HelmTiller) DeepCopyInto(out *HelmTiller) {\n\t*out = *in\n\tout.Addon = in.Addon\n\treturn\n}", "title": "" }, { "docid": "174cc360588a08f07c703c24bc1de03c", "score": "0.7840257", "text": "func (in *ContainerBuildArtifacts) DeepCopyInto(out *ContainerBuildArtifacts) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "179b49839cac1113f009dc3570408eef", "score": "0.78396666", "text": "func (in *DiskTarget) DeepCopyInto(out *DiskTarget) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "179b49839cac1113f009dc3570408eef", "score": "0.78396666", "text": "func (in *DiskTarget) DeepCopyInto(out *DiskTarget) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "65b584585f6b71b70a2827141b1486f1", "score": "0.7838594", "text": "func (in *Default) DeepCopyInto(out *Default) {\n\t*out = *in\n\tif in.Scopes != nil {\n\t\tin, out := &in.Scopes, &out.Scopes\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "6af44f744e22e8c655f8c2045f82edd7", "score": "0.78349966", "text": "func (in *ImageBase) DeepCopyInto(out *ImageBase) {\n\t*out = *in\n}", "title": "" }, { "docid": "6e978e1552da1d32ee8f9c02cf0d4490", "score": "0.78339195", "text": "func (in *DiskSetup) DeepCopyInto(out *DiskSetup) {\n\t*out = *in\n\tif in.Partitions != nil {\n\t\tin, out := &in.Partitions, &out.Partitions\n\t\t*out = make([]Partition, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Filesystems != nil {\n\t\tin, out := &in.Filesystems, &out.Filesystems\n\t\t*out = make([]Filesystem, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9bcd5d1a4cfca66ff5fcc4ffb7729ebc", "score": "0.78312325", "text": "func (in *AmazonESProxy) DeepCopyInto(out *AmazonESProxy) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "66d2580ffb856b04e5d00a44ee008ce0", "score": "0.7830344", "text": "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "bd7141db523e31824019287f9024dba2", "score": "0.7829019", "text": "func (in *EchoSpec) DeepCopyInto(out *EchoSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f8b0e375a7b6ee42eb30959578613752", "score": "0.78282225", "text": "func (in *DirectorSpec) DeepCopyInto(out *DirectorSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "ffc8735ea7a860548c18f550515167fb", "score": "0.78277117", "text": "func (in *ScreenshotOptions) DeepCopyInto(out *ScreenshotOptions) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8e14ffa5d59641d2c993b17ea5ba3246", "score": "0.78276914", "text": "func (in *Delegate) DeepCopyInto(out *Delegate) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7d0dadb0d8227a97ac91b35e66fd7cfc", "score": "0.7826223", "text": "func (in *FileDiscovery) DeepCopyInto(out *FileDiscovery) {\n\t*out = *in\n}", "title": "" }, { "docid": "783f47424c191839399d4e44b906dd71", "score": "0.78256017", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "783f47424c191839399d4e44b906dd71", "score": "0.78256017", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "783f47424c191839399d4e44b906dd71", "score": "0.78256017", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "783f47424c191839399d4e44b906dd71", "score": "0.78256017", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8ff4edb62aac78b649c6382f24a79f61", "score": "0.78242946", "text": "func (in *Database) DeepCopyInto(out *Database) {\n\t*out = *in\n\treturn\n}", "title": "" } ]
b587ad894b4174ffcd2b0adfb1bf9e0e
WithFirstNumber adds the firstNumber to the post racks params
[ { "docid": "f00dffb1291ac09c6b2b62f8b126c3d3", "score": "0.6341402", "text": "func (o *PostRacksParams) WithFirstNumber(firstNumber *string) *PostRacksParams {\n\to.SetFirstNumber(firstNumber)\n\treturn o\n}", "title": "" } ]
[ { "docid": "083755caf55a147e0f669c2a22203765", "score": "0.70455307", "text": "func (o *PostRacksParams) SetFirstNumber(firstNumber *string) {\n\to.FirstNumber = firstNumber\n}", "title": "" }, { "docid": "fbedbde9266b8a886c62f8bcd15c2555", "score": "0.5167111", "text": "func (app *standardOperationBuilder) WithFirst(first string) StandardOperationBuilder {\n\tapp.first = first\n\treturn app\n}", "title": "" }, { "docid": "2fc2fa2665d11b0d4c08389adcbc3d6e", "score": "0.48200333", "text": "func WithStartNum(start uint64) Option {\n\treturn func(m *BulkReq) { m.last = start }\n}", "title": "" }, { "docid": "6b8496fd329dace5404b9788694b915a", "score": "0.4767492", "text": "func (app *remainingOperationBuilder) WithFirst(first string) RemainingOperationBuilder {\n\tapp.first = first\n\treturn app\n}", "title": "" }, { "docid": "69f0a718acb8aa1967a14916b811cddc", "score": "0.46965075", "text": "func (o *PostRacksParams) WithNumberingStartFromBottom(numberingStartFromBottom *string) *PostRacksParams {\n\to.SetNumberingStartFromBottom(numberingStartFromBottom)\n\treturn o\n}", "title": "" }, { "docid": "6e87b084319bc40a443f485e33248091", "score": "0.45216542", "text": "func (m *Item) SetFirst(val string) {\n\tm.First = val\n}", "title": "" }, { "docid": "50c905237d58ae042f2354934a29bb26", "score": "0.45002326", "text": "func (f NumberField) NullsFirst() NumberField {\n\tnullsfirst := true\n\tf.nullsfirst = &nullsfirst\n\treturn f\n}", "title": "" }, { "docid": "ae55b4811fcce4f7509b7770728ed9e4", "score": "0.44975224", "text": "func (rnc *RoutingNumberCreate) SetNumber(s string) *RoutingNumberCreate {\n\trnc.mutation.SetNumber(s)\n\treturn rnc\n}", "title": "" }, { "docid": "0b1d5ffc31d853818f249293f2d02673", "score": "0.44593832", "text": "func PhoneNumbers(nums []string) Param {\n\treturn Param{f: func(v url.Values) {\n\t\tv.Set(\"PhoneNumbers\", GenPhoneNumbersStr(nums))\n\t}}\n}", "title": "" }, { "docid": "4ac18a1fe867886279ca86d77f0b7097", "score": "0.44593355", "text": "func (w *Worker) StartWithFirstRequest(ctx context.Context, URL string) error {\n\trequestPipeline, err := w.subscribe(ctx)\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"fail to subscribe request: %v\", err)\n\t}\n\tresponsePipeline, err := w.doRequest(requestPipeline)\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"fail to initialize request pipeline: %v\", err)\n\t}\n\tnextRequestPipeline, err := w.applySpider(responsePipeline)\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"fail to initialize spider pipeline: %v\", err)\n\t}\n\n\trequest, err := NewGetRequest(URL)\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"fail to create initial request: %v\", err)\n\t}\n\tnextRequestPipeline <- request\n\n\terr = w.publishRequest(nextRequestPipeline)\n\treturn xerrors.Errorf(\"fail to publish request: %v\", err)\n}", "title": "" }, { "docid": "bca07fe188a1374edfdb8afed8248fee", "score": "0.43964964", "text": "func (o *SearchSLOResponseLinks) SetFirst(v string) {\n\to.First = &v\n}", "title": "" }, { "docid": "a8d3425fd4f0adc053b78856455fedc6", "score": "0.43962857", "text": "func (o *PostRacksParams) SetNumberingStartFromBottom(numberingStartFromBottom *string) {\n\to.NumberingStartFromBottom = numberingStartFromBottom\n}", "title": "" }, { "docid": "73b352e20fea9543ab81128d7b9e0aef", "score": "0.43755615", "text": "func (p *IssueBuilder) Number(number int) *IssueBuilder {\n\tp.Value.Number = github.Int(number)\n\treturn p\n}", "title": "" }, { "docid": "c8b87818d7fd83179527d1ea01a1ee63", "score": "0.43631738", "text": "func (client BaseClient) GetFirstListOfPublishedNodesPreparer(ctx context.Context, endpointID string, body PublishedItemListRequestAPIModel) (*http.Request, error) {\n pathParameters := map[string]interface{} {\n \"endpointId\": autorest.Encode(\"path\",endpointID),\n }\n\n preparer := autorest.CreatePreparer(\n autorest.AsContentType(\"application/json-patch+json; charset=utf-8\"),\n autorest.AsPost(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPathParameters(\"/v2/publish/{endpointId}\",pathParameters),\n autorest.WithJSON(body))\n return preparer.Prepare((&http.Request{}).WithContext(ctx))\n }", "title": "" }, { "docid": "c0073d5cc4335b3678375baf2bf1bdbf", "score": "0.43608898", "text": "func (dp *DPeer) RequestHeadersByNumber(origin uint64, amount int, skip int, reverse bool) error {\n\treturn dp.p.requestHeadersByNumber(origin, amount, skip, reverse)\n}", "title": "" }, { "docid": "57a890245ae07845cc26b754541434f0", "score": "0.43140748", "text": "func (h *stockRouteHandler) AddStockNumber(ctx *fasthttp.RequestCtx) {\n\titemID := ctx.UserValue(\"item_id\").(string)\n\tnumber, err := strconv.Atoi(ctx.UserValue(\"number\").(string))\n\tif err != nil {\n\t\tctx.SetStatusCode(fasthttp.StatusBadRequest)\n\t\tctx.SetBodyString(\"number should be an integer\")\n\t\treturn\n\t}\n\n\th.stockStore.AddStock(ctx, itemID, number)\n}", "title": "" }, { "docid": "3158aee9c5f624a2308028665f78ec8d", "score": "0.42998937", "text": "func (o *TeamsResponseLinks) SetFirst(v string) {\n\to.First = &v\n}", "title": "" }, { "docid": "119f7892bcf943e8a6a353a2b3175743", "score": "0.4274333", "text": "func (p Params) SetNumber(path string, f float64) {\n\tp.Set(path, f)\n}", "title": "" }, { "docid": "c5421c023326e077a1c31ed5f4a0c261", "score": "0.42453936", "text": "func (response HouseResponse) First() (HouseRequest, error) {\n\treturn response.getRequestForURL(response.links[\"first\"])\n}", "title": "" }, { "docid": "2b9d977da3ca3bd2087fd007b79ffbeb", "score": "0.42348713", "text": "func IncrementNews(rw http.ResponseWriter, req *http.Request) {\n\tdecoder := json.NewDecoder(req.Body)\n\n\tvar parameter NewsIncrementParameter\n\terr := decoder.Decode(&parameter)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tfmt.Println(parameter.Id)\n\tdatabase.IncrementNewsScore(parameter.Id)\n}", "title": "" }, { "docid": "e73366e79fcf040059eea1128c6c5bf4", "score": "0.4233855", "text": "func (ruo *ResearchUpdateOne) AddPAGENUMBER(i int) *ResearchUpdateOne {\n\truo.mutation.AddPAGENUMBER(i)\n\treturn ruo\n}", "title": "" }, { "docid": "3ba2e450b1b46724c60df69bf10bf02e", "score": "0.41949868", "text": "func (_DexBot *DexBotTransactor) SetNumber(opts *bind.TransactOpts, newNumber *big.Int) (*types.Transaction, error) {\n\treturn _DexBot.contract.Transact(opts, \"setNumber\", newNumber)\n}", "title": "" }, { "docid": "cca4d57da7a050066052e14758d74d16", "score": "0.41669926", "text": "func (api *AudistoAPIClient) SetNextChunkNumber(number uint64) {\n\tapi.ChunkNumber = number\n}", "title": "" }, { "docid": "48fcc41af8fde78b29e7f08fe9a22664", "score": "0.41459596", "text": "func (rnq *RoutingNumberQuery) FirstX(ctx context.Context) *RoutingNumber {\n\tnode, err := rnq.First(ctx)\n\tif err != nil && !IsNotFound(err) {\n\t\tpanic(err)\n\t}\n\treturn node\n}", "title": "" }, { "docid": "aa4d9b58d169e7ccde40b0510d7625cd", "score": "0.41384044", "text": "func (o *Session) SetFirst(v string) {\n\to.First = &v\n}", "title": "" }, { "docid": "93cfbf5f0a1db9abf60ea75a1bdf57f0", "score": "0.41047975", "text": "func (device *Device) AddNumber(name string) (*Asset, error) {\n\tasset := NewSensor(name, profile.Number())\n\treturn asset, device.Add(asset)\n}", "title": "" }, { "docid": "4f30df48bfa068d27c1bfa7c8f986b50", "score": "0.41010243", "text": "func (c *ReportsQueryCall) StartIndex(startIndex int64) *ReportsQueryCall {\n\tc.urlParams_.Set(\"start-index\", fmt.Sprint(startIndex))\n\treturn c\n}", "title": "" }, { "docid": "fbfb76d8ca1416454e5147d7b9f9a758", "score": "0.4100228", "text": "func (r ApiCustomerGetRequest) PageNumber(pageNumber int32) ApiCustomerGetRequest {\n\tr.pageNumber = &pageNumber\n\treturn r\n}", "title": "" }, { "docid": "3322e7e63f0cdf97f41d267693112139", "score": "0.40982202", "text": "func (c QueryKeysClient) preparerForListBySearchServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) {\n\turi, err := url.Parse(nextLink)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing nextLink %q: %+v\", nextLink, err)\n\t}\n\tqueryParameters := map[string]interface{}{}\n\tfor k, v := range uri.Query() {\n\t\tif len(v) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tval := v[0]\n\t\tval = autorest.Encode(\"query\", val)\n\t\tqueryParameters[k] = val\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPost(),\n\t\tautorest.WithBaseURL(c.baseUri),\n\t\tautorest.WithPath(uri.Path),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "8d5def4b38482d875892ce48eedc87d8", "score": "0.4094942", "text": "func (ru *ResearchUpdate) AddPAGENUMBER(i int) *ResearchUpdate {\n\tru.mutation.AddPAGENUMBER(i)\n\treturn ru\n}", "title": "" }, { "docid": "4b275daef11a80f161a98ac5df2ea4ad", "score": "0.40935636", "text": "func (client BaseClient) StartPublishingValuesPreparer(ctx context.Context, endpointID string, body PublishStartRequestAPIModel) (*http.Request, error) {\n pathParameters := map[string]interface{} {\n \"endpointId\": autorest.Encode(\"path\",endpointID),\n }\n\n preparer := autorest.CreatePreparer(\n autorest.AsContentType(\"application/json-patch+json; charset=utf-8\"),\n autorest.AsPost(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPathParameters(\"/v2/publish/{endpointId}/start\",pathParameters),\n autorest.WithJSON(body))\n return preparer.Prepare((&http.Request{}).WithContext(ctx))\n }", "title": "" }, { "docid": "fd8923ddea8c3b28501926d9f98a0b95", "score": "0.40804484", "text": "func setRequestNumber(ctx context.Context) context.Context {\n\t// `WithValue` ritorna un contesto \"arricchito\" da un nuovo valore.\n\t// In questo caso, poichè le richieste possono essere concorrenti,\n\t// utilizziamo `atomic` per assicurare la consistenza del counter generale.\n\treturn context.WithValue(ctx, counterKey, atomic.AddUint64(&counter, 1))\n}", "title": "" }, { "docid": "ef78683078ae7c946becaad0df69a4cb", "score": "0.40596506", "text": "func (o *PostRacksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Building != nil {\n\n\t\t// form param building\n\t\tvar frBuilding string\n\t\tif o.Building != nil {\n\t\t\tfrBuilding = *o.Building\n\t\t}\n\t\tfBuilding := frBuilding\n\t\tif fBuilding != \"\" {\n\t\t\tif err := r.SetFormParam(\"building\", fBuilding); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ColSize != nil {\n\n\t\t// form param col_size\n\t\tvar frColSize string\n\t\tif o.ColSize != nil {\n\t\t\tfrColSize = *o.ColSize\n\t\t}\n\t\tfColSize := frColSize\n\t\tif fColSize != \"\" {\n\t\t\tif err := r.SetFormParam(\"col_size\", fColSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.FirstNumber != nil {\n\n\t\t// form param first_number\n\t\tvar frFirstNumber string\n\t\tif o.FirstNumber != nil {\n\t\t\tfrFirstNumber = *o.FirstNumber\n\t\t}\n\t\tfFirstNumber := frFirstNumber\n\t\tif fFirstNumber != \"\" {\n\t\t\tif err := r.SetFormParam(\"first_number\", fFirstNumber); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Groups != nil {\n\n\t\t// form param groups\n\t\tvar frGroups string\n\t\tif o.Groups != nil {\n\t\t\tfrGroups = *o.Groups\n\t\t}\n\t\tfGroups := frGroups\n\t\tif fGroups != \"\" {\n\t\t\tif err := r.SetFormParam(\"groups\", fGroups); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Manufacturer != nil {\n\n\t\t// form param manufacturer\n\t\tvar frManufacturer string\n\t\tif o.Manufacturer != nil {\n\t\t\tfrManufacturer = *o.Manufacturer\n\t\t}\n\t\tfManufacturer := frManufacturer\n\t\tif fManufacturer != \"\" {\n\t\t\tif err := r.SetFormParam(\"manufacturer\", fManufacturer); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Name != nil {\n\n\t\t// form param name\n\t\tvar frName string\n\t\tif o.Name != nil {\n\t\t\tfrName = *o.Name\n\t\t}\n\t\tfName := frName\n\t\tif fName != \"\" {\n\t\t\tif err := r.SetFormParam(\"name\", fName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.NewName != nil {\n\n\t\t// form param new_name\n\t\tvar frNewName string\n\t\tif o.NewName != nil {\n\t\t\tfrNewName = *o.NewName\n\t\t}\n\t\tfNewName := frNewName\n\t\tif fNewName != \"\" {\n\t\t\tif err := r.SetFormParam(\"new_name\", fNewName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Notes != nil {\n\n\t\t// form param notes\n\t\tvar frNotes string\n\t\tif o.Notes != nil {\n\t\t\tfrNotes = *o.Notes\n\t\t}\n\t\tfNotes := frNotes\n\t\tif fNotes != \"\" {\n\t\t\tif err := r.SetFormParam(\"notes\", fNotes); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.NumberingStartFromBottom != nil {\n\n\t\t// form param numbering_start_from_bottom\n\t\tvar frNumberingStartFromBottom string\n\t\tif o.NumberingStartFromBottom != nil {\n\t\t\tfrNumberingStartFromBottom = *o.NumberingStartFromBottom\n\t\t}\n\t\tfNumberingStartFromBottom := frNumberingStartFromBottom\n\t\tif fNumberingStartFromBottom != \"\" {\n\t\t\tif err := r.SetFormParam(\"numbering_start_from_bottom\", fNumberingStartFromBottom); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Orientation != nil {\n\n\t\t// form param orientation\n\t\tvar frOrientation string\n\t\tif o.Orientation != nil {\n\t\t\tfrOrientation = *o.Orientation\n\t\t}\n\t\tfOrientation := frOrientation\n\t\tif fOrientation != \"\" {\n\t\t\tif err := r.SetFormParam(\"orientation\", fOrientation); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.RackID != nil {\n\n\t\t// form param rack_id\n\t\tvar frRackID int64\n\t\tif o.RackID != nil {\n\t\t\tfrRackID = *o.RackID\n\t\t}\n\t\tfRackID := swag.FormatInt64(frRackID)\n\t\tif fRackID != \"\" {\n\t\t\tif err := r.SetFormParam(\"rack_id\", fRackID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Room != nil {\n\n\t\t// form param room\n\t\tvar frRoom string\n\t\tif o.Room != nil {\n\t\t\tfrRoom = *o.Room\n\t\t}\n\t\tfRoom := frRoom\n\t\tif fRoom != \"\" {\n\t\t\tif err := r.SetFormParam(\"room\", fRoom); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.RoomID != nil {\n\n\t\t// form param room_id\n\t\tvar frRoomID string\n\t\tif o.RoomID != nil {\n\t\t\tfrRoomID = *o.RoomID\n\t\t}\n\t\tfRoomID := frRoomID\n\t\tif fRoomID != \"\" {\n\t\t\tif err := r.SetFormParam(\"room_id\", fRoomID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Row != nil {\n\n\t\t// form param row\n\t\tvar frRow string\n\t\tif o.Row != nil {\n\t\t\tfrRow = *o.Row\n\t\t}\n\t\tfRow := frRow\n\t\tif fRow != \"\" {\n\t\t\tif err := r.SetFormParam(\"row\", fRow); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.RowSize != nil {\n\n\t\t// form param row_size\n\t\tvar frRowSize string\n\t\tif o.RowSize != nil {\n\t\t\tfrRowSize = *o.RowSize\n\t\t}\n\t\tfRowSize := frRowSize\n\t\tif fRowSize != \"\" {\n\t\t\tif err := r.SetFormParam(\"row_size\", fRowSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Size != nil {\n\n\t\t// form param size\n\t\tvar frSize int64\n\t\tif o.Size != nil {\n\t\t\tfrSize = *o.Size\n\t\t}\n\t\tfSize := swag.FormatInt64(frSize)\n\t\tif fSize != \"\" {\n\t\t\tif err := r.SetFormParam(\"size\", fSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.StartCol != nil {\n\n\t\t// form param start_col\n\t\tvar frStartCol string\n\t\tif o.StartCol != nil {\n\t\t\tfrStartCol = *o.StartCol\n\t\t}\n\t\tfStartCol := frStartCol\n\t\tif fStartCol != \"\" {\n\t\t\tif err := r.SetFormParam(\"start_col\", fStartCol); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.StartRow != nil {\n\n\t\t// form param start_row\n\t\tvar frStartRow string\n\t\tif o.StartRow != nil {\n\t\t\tfrStartRow = *o.StartRow\n\t\t}\n\t\tfStartRow := frStartRow\n\t\tif fStartRow != \"\" {\n\t\t\tif err := r.SetFormParam(\"start_row\", fStartRow); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9914b27adbec1db74d72ae61025e12a7", "score": "0.4039537", "text": "func (a *DecodersBinaryApiService) PostUsingPOST10(ctx _context.Context) ApiPostUsingPOST10Request {\n\treturn ApiPostUsingPOST10Request{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "1f7efbd33f3ef1e8139ceb80be29e404", "score": "0.40241018", "text": "func (m *ItemItemsItemWorkbookFunctionsRriPostRequestBody) SetNper(value iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Jsonable)() {\n err := m.GetBackingStore().Set(\"nper\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "970ba8eeec85ed5b33dda190eb7f3376", "score": "0.39899108", "text": "func (o *GetInstrumentCandlesParams) SetIncludeFirst(includeFirst *bool) {\n\to.IncludeFirst = includeFirst\n}", "title": "" }, { "docid": "d2a638cdca6001bfe74136d068a5a626", "score": "0.3986338", "text": "func (f *BusFilter) ByNums(nums ...string) *BusFilter {\n\tf.Nums = nums\n\treturn f\n}", "title": "" }, { "docid": "3aa13069767a5fbf544cedfbc023565d", "score": "0.39606813", "text": "func (c GetRecommendationsClient) preparerForRecommendationsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) {\n\turi, err := url.Parse(nextLink)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing nextLink %q: %+v\", nextLink, err)\n\t}\n\tqueryParameters := map[string]interface{}{}\n\tfor k, v := range uri.Query() {\n\t\tif len(v) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tval := v[0]\n\t\tval = autorest.Encode(\"query\", val)\n\t\tqueryParameters[k] = val\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(c.baseUri),\n\t\tautorest.WithPath(uri.Path),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "97c54c6a59425e78ba47a41af0b3a830", "score": "0.3949647", "text": "func (p *Preference) SetFirstIndex(index int) {\n\tif index < 0 || index >= p.count {\n\t\tpanic(\"required: 0 <= index < p.count\")\n\t}\n\tp.setFirstIndex(index)\n}", "title": "" }, { "docid": "e0b9e8c3f990714b629687a8c39b2d7a", "score": "0.39343542", "text": "func ScaleFirstR(in RResult, scaler RResult) RResult {\n\tf := scaler.Output()[0]\n\tfR := scaler.ROutput()[0]\n\treturn &scaleFirstRResult{\n\t\tOutputVec: in.Output().Copy().Scale(f),\n\t\tROutputVec: in.Output().Copy().Scale(fR).Add(in.ROutput().Copy().Scale(f)),\n\t\tScaler: scaler,\n\t\tInput: in,\n\t}\n}", "title": "" }, { "docid": "fe87995366fa7bcc8b96086f1acff288", "score": "0.39284068", "text": "func WithFirstCreate() []OpOption { return withTop(SortByCreateRevision, SortAscend) }", "title": "" }, { "docid": "1dd1c7249b6210ef9bfed7d1727ae5ae", "score": "0.39267886", "text": "func (pc *PrescriptionCreate) SetPrescripNumber(s string) *PrescriptionCreate {\n\tpc.mutation.SetPrescripNumber(s)\n\treturn pc\n}", "title": "" }, { "docid": "4291e538671c6df1cd95bd36fcb2e693", "score": "0.39170024", "text": "func (_TribeChief_0_0_6 *TribeChief_0_0_6Raw) CallWithNumber(opts *bind.CallOptsWithNumber, result interface{}, method string, params ...interface{}) error {\n\treturn _TribeChief_0_0_6.Contract.TribeChief_0_0_6Caller.contract.CallWithNumber(opts, result, method, params...)\n}", "title": "" }, { "docid": "906fe235853b313a59da716d3be83f74", "score": "0.3896022", "text": "func (s *PricingCandlesRequest) WithIncludeFirst(includeFirst bool) *PricingCandlesRequest {\n\ts.IncludeFirst = includeFirst\n\treturn s\n}", "title": "" }, { "docid": "95ef58f95ece382057235fa2c2d46c3c", "score": "0.38912818", "text": "func (m *Message) SetFieldByNumber(tagNumber int, val interface{}) {\n\tif err := m.TrySetFieldByNumber(tagNumber, val); err != nil {\n\t\tpanic(err.Error())\n\t}\n}", "title": "" }, { "docid": "203323eb63b0d7a873706e8b29cd14c8", "score": "0.38909265", "text": "func (rc *RpcClient) HeaderByNumber(number *big.Int) (*types.MiniHeader, error) {\n\tvar blockParam string\n\tif number == nil {\n\t\tblockParam = \"latest\"\n\t} else {\n\t\tblockParam = hexutil.EncodeBig(number)\n\t}\n\tshouldIncludeTransactions := false\n\n\t// Note(fabio): We use a raw RPC call here instead of `EthClient`'s\n\t// `BlockByNumber()` method because block hashes are computed differently\n\t// on Kovan vs. mainnet, resulting in the wrong block hash being returned\n\t// by `BlockByNumber` when using Kovan. By doing a raw RPC call, we can\n\t// simply use the blockHash returned in the RPC response rather than\n\t// re-compute it from the block header.\n\t// Source: https://github.com/ethereum/go-ethereum/pull/18166\n\tvar header GetBlockByNumberResponse\n\tctx, cancel := context.WithTimeout(rc.ctx, requestTimeout)\n\tdefer cancel()\n\terr := rc.ethRPCClient.CallContext(ctx, &header, \"eth_getBlockByNumber\", blockParam, shouldIncludeTransactions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// If it returned an empty struct\n\tif header.Number == \"\" {\n\t\t// Add block number to error so it gets logged\n\t\treturn nil, UnknownBlockNumberError{\n\t\t\tMessage: ethereum.NotFound.Error(),\n\t\t\tBlockNumber: number,\n\t\t}\n\t}\n\n\tblockNum, ok := math.ParseBig256(header.Number)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(bigIntParsingErrorString, \"block timestamp\", \"eth_getBlockByNumber\")\n\t}\n\tblockTimestamp, ok := math.ParseBig256(header.Timestamp)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(bigIntParsingErrorString, \"block timestamp\", \"eth_getBlockByNumber\")\n\t}\n\tminiHeader := &types.MiniHeader{\n\t\tHash: header.Hash,\n\t\tParent: header.ParentHash,\n\t\tNumber: blockNum,\n\t\tTimestamp: time.Unix(blockTimestamp.Int64(), 0),\n\t}\n\treturn miniHeader, nil\n}", "title": "" }, { "docid": "228f5db49d00eb171c170437b284ee08", "score": "0.3887137", "text": "func (m *PurchaseInvoice) SetNumber(value *string)() {\n err := m.GetBackingStore().Set(\"number\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "e94b350645fc932bf916d0cf7b41ef41", "score": "0.38866472", "text": "func (client Client) AddPreparer(ctx context.Context, ID string, twin interface{}, ifNoneMatch string) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"id\": autorest.Encode(\"path\", ID),\n\t}\n\n\tconst APIVersion = \"2020-05-31-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/digitaltwins/{id}\", pathParameters),\n\t\tautorest.WithJSON(twin),\n\t\tautorest.WithQueryParameters(queryParameters))\n\tif len(string(ifNoneMatch)) > 0 {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithHeader(\"If-None-Match\", autorest.String(ifNoneMatch)))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "3fe907251f96fad1199dcac753124248", "score": "0.38809887", "text": "func (head *node) addFirst(value int) *node {\n\tnewNode := &node{value, nil}\n\n\tif head == nil {\n\t\thead = newNode\n\t} else {\n\t\tnewNode.next = head\n\t\thead = newNode\n\t}\n\treturn head\n}", "title": "" }, { "docid": "ab7c4206922733454b2711aabe6d0ef2", "score": "0.38743502", "text": "func (ruo *ResearchUpdateOne) SetPAGENUMBER(i int) *ResearchUpdateOne {\n\truo.mutation.ResetPAGENUMBER()\n\truo.mutation.SetPAGENUMBER(i)\n\treturn ruo\n}", "title": "" }, { "docid": "c454f5d09b7758c46fd32d57addec1f0", "score": "0.3872619", "text": "func WithFirstKey() []OpOption { return withTop(SortByKey, SortAscend) }", "title": "" }, { "docid": "9a1d7a5516814cd632cf2acb8a804dab", "score": "0.38685197", "text": "func (ruo *ResearchUpdateOne) AddYEARNUMBER(i int) *ResearchUpdateOne {\n\truo.mutation.AddYEARNUMBER(i)\n\treturn ruo\n}", "title": "" }, { "docid": "67539349702f78a7203e512e71547235", "score": "0.38635552", "text": "func (p *plexConnector) fillDefaultHeaders(req *http.Request) {\n\treq.Header.Add(\"X-Plex-Client-Identifier\", fmt.Sprintf(\"rclone (%v)\", p.f.String()))\n\treq.Header.Add(\"X-Plex-Product\", fmt.Sprintf(\"rclone (%v)\", p.f.Name()))\n\treq.Header.Add(\"X-Plex-Version\", fs.Version)\n\treq.Header.Add(\"Accept\", \"application/json\")\n\tif p.token != \"\" {\n\t\treq.Header.Add(\"X-Plex-Token\", p.token)\n\t}\n}", "title": "" }, { "docid": "1e2a78b8dc953071e7ce763bf9c4526c", "score": "0.3862563", "text": "func appendGenericResourceFilterOnNumber(name string, nb int) (labelsutil.Filter, error) {\n\tvar f string\n\t// host.resource.<name> contains at least <nb> elements for nb > 1\n\tif nb > 1 {\n\t\tf = fmt.Sprintf(`%s.%s ~= \"^([^,]*,){%d}.*$\"`, genericResourceLabelPrefix, name, nb-1)\n\t} else {\n\t\tf = fmt.Sprintf(`%s.%s ~= \"^(.+)$\"`, genericResourceLabelPrefix, name)\n\t}\n\n\treturn labelsutil.CreateFilter(f)\n}", "title": "" }, { "docid": "1d0756516c2053fd9cb6c73c70269b09", "score": "0.38605767", "text": "func (_m *Indexer) PrepareReindex(from uint64, to uint64, isFirstReindex bool) {\n\t_m.Called(from, to, isFirstReindex)\n}", "title": "" }, { "docid": "5916b9d826365e6c1b06d67d4a8765af", "score": "0.3844571", "text": "func (m Model) PageFirst() Model {\n\tm.pageFirst()\n\n\treturn m\n}", "title": "" }, { "docid": "5eb55d720a415e75913c3da1d97cfef9", "score": "0.38343957", "text": "func (m *ItemAgentGroupsItemPublishedResourcesItemAgentGroupsRequestBuilder) ByOnPremisesAgentGroupId1(onPremisesAgentGroupId1 string)(*ItemAgentGroupsItemPublishedResourcesItemAgentGroupsOnPremisesAgentGroupItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.BaseRequestBuilder.PathParameters {\n urlTplParams[idx] = item\n }\n if onPremisesAgentGroupId1 != \"\" {\n urlTplParams[\"onPremisesAgentGroup%2Did1\"] = onPremisesAgentGroupId1\n }\n return NewItemAgentGroupsItemPublishedResourcesItemAgentGroupsOnPremisesAgentGroupItemRequestBuilderInternal(urlTplParams, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "d5e7de8fe72f0a3f50dcd063674badc0", "score": "0.38270226", "text": "func (_DexBot *DexBotTransactorSession) SetNumber(newNumber *big.Int) (*types.Transaction, error) {\n\treturn _DexBot.Contract.SetNumber(&_DexBot.TransactOpts, newNumber)\n}", "title": "" }, { "docid": "d0c425a73aaa42f7449419ea07ca8eec", "score": "0.38252252", "text": "func (ci *CreditItem) PostingBankRoutingNumberField() string {\n\treturn ci.stringField(ci.PostingBankRoutingNumber, 9)\n}", "title": "" }, { "docid": "3d0fcabd2a98f0e4953955951c002791", "score": "0.3825094", "text": "func (s *TypeString) RangeFirst(n int) *TypeString {\n\treturn s.Range(0, n)\n}", "title": "" }, { "docid": "20fa426ae40c0ab82be10116c4c6c993", "score": "0.3823188", "text": "func AddFirstR(v1 RResult, v2 RResult) RResult {\n\tinVec := v1.Output()\n\tinVecR := v1.ROutput()\n\toutVec := make(linalg.Vector, len(inVec))\n\toutVecR := make(linalg.Vector, len(inVec))\n\tscaler := v2.Output()[0]\n\tscalerR := v2.ROutput()[0]\n\tfor i, x := range inVec {\n\t\toutVec[i] = scaler + x\n\t}\n\tfor i, x := range inVecR {\n\t\toutVecR[i] = scalerR + x\n\t}\n\treturn &addFirstRResult{\n\t\tOutputVec: outVec,\n\t\tROutputVec: outVecR,\n\t\tInput: v1,\n\t\tScaler: v2,\n\t}\n}", "title": "" }, { "docid": "88fc13ac4bd52799a63ea862895e620c", "score": "0.38228533", "text": "func (client IntClient) PutMin32Preparer(ctx context.Context, intBody int32) (*http.Request, error) {\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/int/min/32\"),\n\t\tautorest.WithJSON(intBody))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "ceb0787e9c00e73373d2ef875bd63505", "score": "0.38159987", "text": "func (ab *APIBuilder) AddDispatchNodeDefaultValueHeaderWithIndex(cluster uint64, idx int, name, value string) *APIBuilder {\n\tnode := ab.getNode(cluster, idx)\n\tif nil == node {\n\t\tab.value.Nodes = append(ab.value.Nodes, &metapb.DispatchNode{\n\t\t\tClusterID: cluster,\n\t\t\tDefaultValue: &metapb.HTTPResult{\n\t\t\t\tHeaders: []*metapb.PairValue{\n\t\t\t\t\t&metapb.PairValue{\n\t\t\t\t\t\tName: name,\n\t\t\t\t\t\tValue: value,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t} else {\n\t\tif node.DefaultValue == nil {\n\t\t\tnode.DefaultValue = &metapb.HTTPResult{\n\t\t\t\tHeaders: []*metapb.PairValue{\n\t\t\t\t\t&metapb.PairValue{\n\t\t\t\t\t\tName: name,\n\t\t\t\t\t\tValue: value,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\t\t} else {\n\t\t\tnode.DefaultValue.Headers = append(node.DefaultValue.Headers, &metapb.PairValue{\n\t\t\t\tName: name,\n\t\t\t\tValue: value,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn ab\n}", "title": "" }, { "docid": "0fc6cde3227b8a4fdf1343119f13cf10", "score": "0.3806306", "text": "func addInt(v *url.Values, name string, value int) {\n\tif value > 0 {\n\t\tv.Add(name, strconv.Itoa(value))\n\t}\n}", "title": "" }, { "docid": "1bc0e161b6c37ad1f278d2c9c0404ef9", "score": "0.3805205", "text": "func (cur *Cursor) AddNumber(amount number) {\n\tcur.update.PutNumber(commit.Add, cur.idx, amount)\n}", "title": "" }, { "docid": "7a491896dddc3d10af9927279b964021", "score": "0.38050687", "text": "func WithJSONNumber() ParserOption {\n\treturn func(p *Parser) {\n\t\tp.useJSONNumber = true\n\t}\n}", "title": "" }, { "docid": "b584be602f9e7d6f11291374da6e59ca", "score": "0.38039157", "text": "func (client BaseClient) QueryPublisherPreparer(ctx context.Context, body PublisherQueryAPIModel, onlyServerState *bool, pageSize *int32) (*http.Request, error) {\n queryParameters := map[string]interface{} {\n }\n if onlyServerState != nil {\n queryParameters[\"onlyServerState\"] = autorest.Encode(\"query\",*onlyServerState)\n }\n if pageSize != nil {\n queryParameters[\"pageSize\"] = autorest.Encode(\"query\",*pageSize)\n }\n\n preparer := autorest.CreatePreparer(\n autorest.AsContentType(\"application/json-patch+json; charset=utf-8\"),\n autorest.AsPost(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPath(\"/v2/publishers/query\"),\n autorest.WithJSON(body),\n autorest.WithQueryParameters(queryParameters))\n return preparer.Prepare((&http.Request{}).WithContext(ctx))\n }", "title": "" }, { "docid": "212e17d552f87a34c583449672197f7a", "score": "0.38025466", "text": "func MakeFirstPageToken(t time.Time, idx int) (string, error) {\n\ttsp, err := ptypes.TimestampProto(t)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn MakeNextPageToken(&drghs_v1.PageToken{\n\t\tFirstRequestTimeUsec: tsp,\n\t\tOffset: int32(idx),\n\t}, idx)\n}", "title": "" }, { "docid": "f079585b4c93a0967263c7346f17c072", "score": "0.37946108", "text": "func (ll *SingleLinkedList) AddFirst(val int) {\n\tnewHead := &Node{val: val}\n\tif ll.IsEmpty() {\n\t\tll.head = newHead\n\t} else {\n\t\tprevHead := ll.head\n\t\tnewHead.next = prevHead\n\t\tll.head = newHead\n\t}\n\tll.size += 1\n}", "title": "" }, { "docid": "6880d376dd65eeb4c159aace4bc7a1e2", "score": "0.37909356", "text": "func (smuo *SFModelUpdateOne) AddPhoneNumber(i int64) *SFModelUpdateOne {\n\tsmuo.mutation.AddPhoneNumber(i)\n\treturn smuo\n}", "title": "" }, { "docid": "396b20f41c95da397ac54c7891fd482b", "score": "0.37857932", "text": "func (kcc *KqiComparatorCreate) SetNumber(f float64) *KqiComparatorCreate {\n\tkcc.mutation.SetNumber(f)\n\treturn kcc\n}", "title": "" }, { "docid": "4fc1e3bc7d744827fb2d3565848a3b97", "score": "0.37784773", "text": "func CreateAccount(customerId string, accountType string, nickname string, rewards int, balance int, account_number string) string {\n\n url := baseUrl + \"/customers/\" + customerId + \"/accounts?key=\" + apiKey\n\n //fmt.Println(\"URL:>\", url)\n\n rewardsString := strconv.Itoa(rewards)\n balanceString := strconv.Itoa(balance)\n \n var payloadStr = \"\"\n\n if len(account_number) > 0 {\n payloadStr = `{\"type\":\"` + accountType + `\",\"nickname\":\"` + nickname + `\",\"rewards\":` + rewardsString + `, \"balance\":` + balanceString + `, \"account_number\":\"` + account_number + `\"}`\n } else{\n payloadStr = `{\"type\":\"` + accountType + `\",\"nickname\":\"` + nickname + `\",\"rewards\":` + rewardsString + `, \"balance\":` + balanceString + `}`\n }\n \n \n fmt.Println(string(payloadStr))\n var jsonStr = []byte(payloadStr)\n req, err := http.NewRequest(\"POST\", url, bytes.NewBuffer(jsonStr))\n req.Header.Set(\"Content-Type\", \"application/json\")\n\n client := &http.Client{}\n resp, err := client.Do(req)\n if err != nil {\n panic(err)\n }\n defer resp.Body.Close()\n\n body, _ := ioutil.ReadAll(resp.Body)\n fmt.Println(\"Response Status:\", resp.Status)\n var response = string(body)\n //fmt.Println(\"Response Body:\", response)\n return response\n}", "title": "" }, { "docid": "c4db4760b7b5947e3997cff1b20f73cd", "score": "0.37778553", "text": "func (dlr *DefaultRequestLog) FirstAndSecond(_ context.Context, f, s int64) {\n\tklog.V(vLevel).Infof(\"RL: First: %d Second: %d\", f, s)\n}", "title": "" }, { "docid": "e2399c4141ad0314380ab002c1715eb3", "score": "0.37657073", "text": "func EncodeHTTPRecommendsOneRequest(_ context.Context, r *http.Request, request interface{}) error {\n\tstrval := \"\"\n\t_ = strval\n\treq := request.(*pb.RecommendsRequest)\n\t_ = req\n\n\tr.Header.Set(\"transport\", \"HTTPJSON\")\n\tr.Header.Set(\"request-url\", r.URL.Path)\n\n\t// Set the path parameters\n\tpath := strings.Join([]string{\n\t\t\"\",\n\t\t\"recommends\",\n\t}, \"/\")\n\tu, err := url.Parse(path)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"couldn't unmarshal path %q\", path)\n\t}\n\tr.URL.RawPath = u.RawPath\n\tr.URL.Path = u.Path\n\n\t// Set the query parameters\n\tvalues := r.URL.Query()\n\tvar tmp []byte\n\t_ = tmp\n\n\tvalues.Add(\"category_id\", fmt.Sprint(req.CategoryId))\n\n\tvalues.Add(\"tag_id\", fmt.Sprint(req.TagId))\n\n\tvalues.Add(\"type\", fmt.Sprint(req.Type))\n\n\tvalues.Add(\"page\", fmt.Sprint(req.Page))\n\n\tvalues.Add(\"sort_type\", fmt.Sprint(req.SortType))\n\n\tr.URL.RawQuery = values.Encode()\n\treturn nil\n}", "title": "" }, { "docid": "cbe4d4b1c4b529e90e6d84b98ffc91b9", "score": "0.37649652", "text": "func getNewRmaNumber() string {\n\n\t// Init\n\tvar rma RMA\n\n\t// Get data form DB\n\terr := Vault.Mongo.C(\"RMAs\").Find(bson.M{}).Sort(\"-RmaNumber\").One(&rma)\n\tCheckError(err)\n\tfmt.Println(\"RMA: \", rma.Company)\n\tfmt.Println(\"RMA Number: \", rma.RmaNumber)\n\tfmt.Println(\"RMA Orig Sales Order: \", rma.OrigSalesOrder)\n\n\tnum, err := strconv.Atoi(rma.RmaNumber)\n\n\treturn strconv.Itoa(num + 1)\n}", "title": "" }, { "docid": "45d37ab756cf0300d008ef8ab5fe8404", "score": "0.37616366", "text": "func getNumberParamDefault(ctx *gin.Context, name string, def int) (int, error) {\n\tv, set, err := getNumberParam(ctx, name)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tif !set {\n\t\treturn def, nil\n\t}\n\n\treturn v, nil\n}", "title": "" }, { "docid": "4d01e85c7fe93a695b70a0725ceb9b26", "score": "0.37567273", "text": "func (o *SearchRecipes200Response) SetNumber(v int32) {\n\to.Number = v\n}", "title": "" }, { "docid": "5787bec2d1dd388478afac06a7a33e5d", "score": "0.37550315", "text": "func (c *varbitChunk) addFirstSample(s model.SamplePair) {\n\tbinary.BigEndian.PutUint64(\n\t\t(*c)[varbitFirstTimeOffset:],\n\t\tuint64(s.Timestamp),\n\t)\n\tbinary.BigEndian.PutUint64(\n\t\t(*c)[varbitFirstValueOffset:],\n\t\tmath.Float64bits(float64(s.Value)),\n\t)\n\tc.setLastSample(s) // To simplify handling of single-sample chunks.\n\tc.setNextSampleOffset(varbitSecondSampleBitOffset)\n}", "title": "" }, { "docid": "66e6240818558da2c47899b242a0e118", "score": "0.37507161", "text": "func First(first string) ColumnOption {\n\treturn func(column *ColumnSchema) {\n\t\tcolumn.first = first\n\t}\n}", "title": "" }, { "docid": "8c4e9818ac75f1a14f9ab7345b03a2ed", "score": "0.3747358", "text": "func (s *Service) createFirstRequestForAllSubprotocols() (*rawRequest, error) {\n\tmetadata := []json.RawMessage{}\n\tfor _, sid := range s.preferredSubprotocols {\n\t\tsubp, _ := s.subprotocolSet[sid]\n\t\tm, err := subp.GenerateFirstRequestMetadata()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmetadata = append(metadata, m)\n\t}\n\tencodedMetadata, err := json.Marshal(FirstRequestsForSubprotocols{\n\t\tMetadataForSubprotocol: metadata,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rawRequest{\n\t\tType: TypeRequest,\n\t\tSubprotocols: s.preferredSubprotocols,\n\t\tMetadata: encodedMetadata,\n\t}, nil\n}", "title": "" }, { "docid": "97126415f63b7ba95f0c348977926e69", "score": "0.37447807", "text": "func (client BaseClient) StartNewKeyPairRequestPreparer(ctx context.Context, body StartNewKeyPairRequestAPIModel) (*http.Request, error) {\n preparer := autorest.CreatePreparer(\n autorest.AsContentType(\"application/json-patch+json; charset=utf-8\"),\n autorest.AsPut(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPath(\"/v2/requests/keypair\"),\n autorest.WithJSON(body))\n return preparer.Prepare((&http.Request{}).WithContext(ctx))\n }", "title": "" }, { "docid": "e278cf392d1b5fb9569dc2623437635e", "score": "0.3737401", "text": "func (r ApiListSiteMapsRequest) PageNumber(pageNumber int32) ApiListSiteMapsRequest {\n\tr.pageNumber = &pageNumber\n\treturn r\n}", "title": "" }, { "docid": "86e9784fb11832e3e62b733537c977f2", "score": "0.3735714", "text": "func (o *TicketsListParams) SetNumber(number *string) {\n\to.Number = number\n}", "title": "" }, { "docid": "2f375608ae80c3818532a38e73c9aa52", "score": "0.37337768", "text": "func (client ManagementClient) PutSimpleProductWithGroupingPreparer(name string, simpleBodyProduct *SimpleProduct) (*http.Request, error) {\n pathParameters := map[string]interface{} {\n \"name\": autorest.Encode(\"path\",name),\n }\n\n preparer := autorest.CreatePreparer(\n autorest.AsJSON(),\n autorest.AsPut(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPathParameters(\"/model-flatten/customFlattening/parametergrouping/{name}/\",pathParameters))\n if simpleBodyProduct != nil {\n preparer = autorest.DecoratePreparer(preparer,\n autorest.WithJSON(simpleBodyProduct))\n }\n return preparer.Prepare(&http.Request{})\n}", "title": "" }, { "docid": "a5638257c5a5a0c380ba5a5455b96d24", "score": "0.3723143", "text": "func NumberFieldFromInstance(i interface{}, fieldNo int, name string) *Field {\n\tret := NumberField(name)\n\t// check tags\n\tt := reflect.TypeOf(i).Field(fieldNo).Tag\n\tif v := t.Get(\"form_min\"); v != \"\" {\n\t\tret.SetParam(\"min\", v)\n\t}\n\tif v := t.Get(\"form_max\"); v != \"\" {\n\t\tret.SetParam(\"max\", v)\n\t}\n\tif v := t.Get(\"form_value\"); v != \"\" {\n\t\tret.SetValue(v)\n\t} else {\n\t\tret.SetValue(fmt.Sprintf(\"%v\", reflect.ValueOf(i).Field(fieldNo).Interface()))\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "09b4ce3a23df4f8051b8130280be3c80", "score": "0.37222415", "text": "func (ab *APIBuilder) AddDispatchNodeDefaultValueWithIndex(cluster uint64, idx int, value []byte) *APIBuilder {\n\tnode := ab.getNode(cluster, idx)\n\tif nil == node {\n\t\tab.value.Nodes = append(ab.value.Nodes, &metapb.DispatchNode{\n\t\t\tClusterID: cluster,\n\t\t\tDefaultValue: &metapb.HTTPResult{\n\t\t\t\tBody: value,\n\t\t\t},\n\t\t})\n\t} else {\n\t\tif node.DefaultValue == nil {\n\t\t\tnode.DefaultValue = &metapb.HTTPResult{\n\t\t\t\tBody: value,\n\t\t\t}\n\t\t} else {\n\t\t\tnode.DefaultValue.Body = value\n\t\t}\n\t}\n\n\treturn ab\n}", "title": "" }, { "docid": "124acbac95dbe7032f97e97cc1349934", "score": "0.37183723", "text": "func (client BaseClient) QueryGatewayPreparer(ctx context.Context, body GatewayQueryAPIModel, pageSize *int32) (*http.Request, error) {\n queryParameters := map[string]interface{} {\n }\n if pageSize != nil {\n queryParameters[\"pageSize\"] = autorest.Encode(\"query\",*pageSize)\n }\n\n preparer := autorest.CreatePreparer(\n autorest.AsContentType(\"application/json-patch+json; charset=utf-8\"),\n autorest.AsPost(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPath(\"/v2/gateways/query\"),\n autorest.WithJSON(body),\n autorest.WithQueryParameters(queryParameters))\n return preparer.Prepare((&http.Request{}).WithContext(ctx))\n }", "title": "" }, { "docid": "ca275bcef43775fb6e3313afe5d2d603", "score": "0.37171134", "text": "func (b *Bench) Number(n int) dataflow.Bencher {\n\tb.Task.Number = n\n\treturn b\n}", "title": "" }, { "docid": "5a5e5742d294e25fbd48d5328725da4d", "score": "0.37122288", "text": "func (response CharacterResponse) First() (CharacterRequest, error) {\n\treturn response.getRequestForURL(response.links[\"first\"])\n}", "title": "" }, { "docid": "d3d454b4d5d82eaea6b2efb2e8ffe3bc", "score": "0.37085515", "text": "func cleanFieldNumber(number int) string {\n\tvar n string\n\n\tif number < 10 {\n\t\tn = \"0\" + strconv.Itoa(number)\n\t}\n\n\treturn n\n}", "title": "" }, { "docid": "004d29ee93d1bea43b981d4505e5c175", "score": "0.37083653", "text": "func (client BaseClient) StartSigningRequestPreparer(ctx context.Context, body StartSigningRequestAPIModel) (*http.Request, error) {\n preparer := autorest.CreatePreparer(\n autorest.AsContentType(\"application/json-patch+json; charset=utf-8\"),\n autorest.AsPut(),\n autorest.WithBaseURL(client.BaseURI),\n autorest.WithPath(\"/v2/requests/sign\"),\n autorest.WithJSON(body))\n return preparer.Prepare((&http.Request{}).WithContext(ctx))\n }", "title": "" }, { "docid": "3ba77b023e6e7509e9f2630f7c560a09", "score": "0.37054402", "text": "func (r ApiListTlsIngestProfilesRequest) PageNumber(pageNumber int32) ApiListTlsIngestProfilesRequest {\n\tr.pageNumber = &pageNumber\n\treturn r\n}", "title": "" }, { "docid": "63a478055813bdee12c833f6328a0fca", "score": "0.3702584", "text": "func (rnq *RoutingNumberQuery) FirstIDX(ctx context.Context) int {\n\tid, err := rnq.FirstID(ctx)\n\tif err != nil && !IsNotFound(err) {\n\t\tpanic(err)\n\t}\n\treturn id\n}", "title": "" }, { "docid": "20d138c2445ae6f5aa8002969a7fd554", "score": "0.37021452", "text": "func (ru *ResearchUpdate) AddYEARNUMBER(i int) *ResearchUpdate {\n\tru.mutation.AddYEARNUMBER(i)\n\treturn ru\n}", "title": "" }, { "docid": "f019812b76e30f3f8079c57445d86f55", "score": "0.37015983", "text": "func (self *PostFX) SetParameter1(name string, x float32) {\n C.sfPostFX_SetParameter1(self.Cref, C.CString(name), C.float(x))\n}", "title": "" }, { "docid": "322716415fe058d0db0dcaef6c51b636", "score": "0.37010065", "text": "func (ru *ResearchUpdate) SetPAGENUMBER(i int) *ResearchUpdate {\n\tru.mutation.ResetPAGENUMBER()\n\tru.mutation.SetPAGENUMBER(i)\n\treturn ru\n}", "title": "" }, { "docid": "e5166b91ce4da13f3792cdad7ddd7ac5", "score": "0.36982146", "text": "func (_DexBot *DexBotSession) SetNumber(newNumber *big.Int) (*types.Transaction, error) {\n\treturn _DexBot.Contract.SetNumber(&_DexBot.TransactOpts, newNumber)\n}", "title": "" }, { "docid": "e8085d2cb4150d2a9621231e068a68c0", "score": "0.3695431", "text": "func (brq *BarRecordQuery) FirstX(ctx context.Context) *BarRecord {\n\tnode, err := brq.First(ctx)\n\tif err != nil && !IsNotFound(err) {\n\t\tpanic(err)\n\t}\n\treturn node\n}", "title": "" }, { "docid": "8a380e247f6d346e9b252d023f19ba1e", "score": "0.36946544", "text": "func (a *Assembler) AddRegisterNumber(registerNameTo string, number uint64) {\n\tif registerNameTo == \"al\" {\n\t\ta.WriteBytes(0x04, byte(number))\n\t\treturn\n\t}\n\n\ta.numberToRegister(&addRegisterNumber, registerNameTo, number)\n}", "title": "" }, { "docid": "1d844f6e1ced5e62ae2bdeb46887f993", "score": "0.36945343", "text": "func (client *QueriesClient) getIntOneMillionCreateRequest(ctx context.Context, options *QueriesClientGetIntOneMillionOptions) (*policy.Request, error) {\n\turlPath := \"/queries/int/1000000\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"intQuery\", \"1000000\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" } ]
02144ff19da37dfa42cd296f032e9f28
RepositoryNameContainsTag checks if the repository name includes a tag
[ { "docid": "88a35f2e727dd1ff1e5ce519b16c9c0b", "score": "0.87344354", "text": "func RepositoryNameContainsTag(name string) bool {\n\tsplit := strings.Split(name, \"/\")\n\treturn strings.Contains(split[len(split)-1], \":\")\n}", "title": "" } ]
[ { "docid": "f13893b32c6f59c38c807fd806e8a29b", "score": "0.7046816", "text": "func Tag(repo *git.Repository) (tag string, isTag bool, err error) {\n\tvar ref *plumbing.Reference\n\tvar tags storer.ReferenceIter\n\n\tif ref, err = repo.Head(); err != nil {\n\t\treturn\n\t}\n\n\tif tags, err = repo.Tags(); err != nil {\n\t\treturn\n\t}\n\n\tif err = tags.ForEach(func(_ref *plumbing.Reference) error {\n\t\tif _ref.Hash().String() == ref.Hash().String() {\n\t\t\tisTag = true\n\t\t\ttag = _ref.Name().Short()\n\t\t\treturn nil\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\treturn\n\t}\n\t// err = ErrNotFound\n\treturn\n}", "title": "" }, { "docid": "7f6affb4b8c40c614376f6a43b3ae11a", "score": "0.6763331", "text": "func IsTagExist(repoPath, name string) bool {\n\treturn IsReferenceExist(repoPath, TAG_PREFIX+name)\n}", "title": "" }, { "docid": "7f6affb4b8c40c614376f6a43b3ae11a", "score": "0.6763331", "text": "func IsTagExist(repoPath, name string) bool {\n\treturn IsReferenceExist(repoPath, TAG_PREFIX+name)\n}", "title": "" }, { "docid": "83dd247cc4b65f52fb71f8ecabac07db", "score": "0.6657976", "text": "func (d *RegistryService) ExistsTag(repoName string, tag string) bool {\n\texists := false\n\trepoResult := is.RegistryService.GetRepository(repoName)\n\tif repoResult.Tags != nil && len(repoResult.Tags) > 0 {\n\t\tfor _, t := range repoResult.Tags {\n\t\t\tif t.Name == tag {\n\t\t\t\texists = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn exists\n}", "title": "" }, { "docid": "fde423c6eba0fd7ae82c574147bf02b0", "score": "0.6557344", "text": "func (repo *Repository) IsTagExist(name string) bool {\n\tif repo == nil || name == \"\" {\n\t\treturn false\n\t}\n\n\treturn repo.IsReferenceExist(TagPrefix + name)\n}", "title": "" }, { "docid": "cf76811cd08b3d1dcd40cdc5ac8ebf20", "score": "0.6492656", "text": "func (s *DockerSuite) TestTagUnprefixedRepoByName(c *check.C) {\n\tdockerCmd(c, \"tag\", \"busybox:latest\", \"testfoobarbaz\")\n}", "title": "" }, { "docid": "2358d03280c829fa1dcaca42d6607054", "score": "0.638896", "text": "func validateTag(rawRepo string) (string, error) {\n\t_, err := reference.ParseNormalizedNamed(rawRepo)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn rawRepo, nil\n}", "title": "" }, { "docid": "1a4f155168a5dc14099f032b78f799fa", "score": "0.63520545", "text": "func addRepoTagToImageName(imgName string) string {\n\tif !strings.Contains(imgName, \".io/\") {\n\t\treturn \"docker.io/\" + imgName\n\t} // else it already has repo name dont add anything\n\treturn imgName\n}", "title": "" }, { "docid": "9bd628d1155a1acad38283b2b0e19819", "score": "0.63204426", "text": "func validateTag(rawRepo string) error {\n\t_, err := reference.ParseNormalizedNamed(rawRepo)\n\n\treturn err\n}", "title": "" }, { "docid": "298a830878648a0376bb806a8d2faab9", "score": "0.61646664", "text": "func (r *Ref) IsTag() bool {\n\treturn strings.HasPrefix(r.Path, \"refs/tags/\")\n}", "title": "" }, { "docid": "d9b71583e65518f537bf9245d5365b11", "score": "0.61355853", "text": "func (containerRepository *ContainerRepository) IsTag(column string) bool {\n\tfor _, tag := range recommendation_entity.ContainerTags {\n\t\tif column == string(tag) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "636604d1cae734a66826a90a2d888aac", "score": "0.6057042", "text": "func validateTag(repo string) (string, error) {\n\tnamed, err := reference.ParseNormalizedNamed(repo)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Add the latest tag if they did not provide one.\n\treturn reference.TagNameOnly(named).String(), nil\n}", "title": "" }, { "docid": "1446408a4cc6220ad527cee0ef5a82fe", "score": "0.5990646", "text": "func ParseRepositoryTag(repos string) (string, string) {\n\tn := strings.LastIndex(repos, \":\")\n\tif n < 0 {\n\t\treturn repos, \"\"\n\t}\n\tif tag := repos[n+1:]; !strings.Contains(tag, \"/\") {\n\t\treturn repos[:n], tag\n\t}\n\treturn repos, \"\"\n}", "title": "" }, { "docid": "8515acdba64ab3be4b28e553bfb68de8", "score": "0.5976846", "text": "func ParseRepositoryTag(repos string) (string, string) {\n\tn := strings.Index(repos, \"@\")\n\tif n >= 0 {\n\t\tparts := strings.Split(repos, \"@\")\n\t\treturn parts[0], parts[1]\n\t}\n\tn = strings.LastIndex(repos, \":\")\n\tif n < 0 {\n\t\treturn repos, \"\"\n\t}\n\tif tag := repos[n+1:]; !strings.Contains(tag, \"/\") {\n\t\treturn repos[:n], tag\n\t}\n\treturn repos, \"\"\n}", "title": "" }, { "docid": "8515acdba64ab3be4b28e553bfb68de8", "score": "0.5976846", "text": "func ParseRepositoryTag(repos string) (string, string) {\n\tn := strings.Index(repos, \"@\")\n\tif n >= 0 {\n\t\tparts := strings.Split(repos, \"@\")\n\t\treturn parts[0], parts[1]\n\t}\n\tn = strings.LastIndex(repos, \":\")\n\tif n < 0 {\n\t\treturn repos, \"\"\n\t}\n\tif tag := repos[n+1:]; !strings.Contains(tag, \"/\") {\n\t\treturn repos[:n], tag\n\t}\n\treturn repos, \"\"\n}", "title": "" }, { "docid": "344dc64137b215feda74cbfae52394fb", "score": "0.59418184", "text": "func (opts PushUpdateOptions) IsTag() bool {\n\treturn strings.HasPrefix(opts.RefFullName, git.TagPrefix)\n}", "title": "" }, { "docid": "25c9589a72308ce4967aa017346bfd82", "score": "0.59099203", "text": "func (c *Client) TagExists(tag string) (bool, error) {\n\trepo, err := git.PlainOpen(c.Path)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t_, err = repo.Tag(tag)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "e3636c01e7e62671cfd85299344fffc5", "score": "0.5883523", "text": "func (r *Repository) HasTag(tag string, opts ...ShowRefVerifyOptions) bool {\n\treturn HasTag(r.path, tag, opts...)\n}", "title": "" }, { "docid": "1f638f6da48376102da7c9291886f7a2", "score": "0.5881941", "text": "func Tag(s string) error {\n\t// todo check tag with regex\n\tif s == \"\" {\n\t\treturn fmt.Errorf(\"git tag command invalid: %s\", s)\n\t}\n\targs := strings.Split(s, \" \")\n\tcommand := strings.TrimSpace(args[0])\n\n\tfmt.Printf(\"command: %s\", command)\n\n\ttag := s[1:]\n\treturn zsh.Status(fmt.Sprintf(\"git tag %s\", tag))\n}", "title": "" }, { "docid": "c5fc4bf2a66690ad2f1d40c0b22edb3e", "score": "0.5793984", "text": "func parseRepositoryTag(repos string) (string, string, string) {\n\tn := strings.Index(repos, \"@\")\n\tif n >= 0 {\n\t\tparts := strings.Split(repos, \"@\")\n\t\treturn parts[0], \"\", parts[1]\n\t}\n\tn = strings.LastIndex(repos, \":\")\n\tif n < 0 {\n\t\treturn repos, \"\", \"\"\n\t}\n\tif tag := repos[n+1:]; !strings.Contains(tag, \"/\") {\n\t\treturn repos[:n], tag, \"\"\n\t}\n\treturn repos, \"\", \"\"\n}", "title": "" }, { "docid": "93b5f2cd88eef24423375751bc2fb0a5", "score": "0.57888466", "text": "func TagRepo(manifest model.Manifest, repo string) error {\n\theadSha, err := GetSha(repo, \"HEAD\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get HEAD SHA: %v\", err)\n\t}\n\tcurrentTagSha, _ := GetSha(repo, manifest.Version)\n\tif currentTagSha != \"\" {\n\t\tif currentTagSha == headSha {\n\t\t\tlog.Infof(\"Tag %v already exists, but points to the right place.\", manifest.Version)\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"tag %v already exists, retagging would move from %v to %v\", manifest.Version, currentTagSha, headSha)\n\t}\n\tcmd := util.VerboseCommand(\"git\", \"tag\", manifest.Version)\n\tcmd.Dir = repo\n\treturn cmd.Run()\n}", "title": "" }, { "docid": "7d204a711c51dd27f94bca46e4b1d02a", "score": "0.5782623", "text": "func containsTag(tags []string, value string) string {\n\tfor _, v := range tags {\n\t\tif v == value {\n\t\t\treturn v\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "5337e971121418d8c47100ae4d138063", "score": "0.5777952", "text": "func (s *DockerSuite) TestTagInvalidPrefixedRepo(c *check.C) {\n\tlongTag := stringutils.GenerateRandomAlphaOnlyString(121)\n\n\tinvalidTags := []string{\"repo:fo$z$\", \"repo:Foo@3cc\", \"repo:Foo$3\", \"repo:Foo*3\", \"repo:Fo^3\", \"repo:Foo!3\", \"repo:%goodbye\", \"repo:#hashtagit\", \"repo:F)xcz(\", \"repo:-foo\", \"repo:..\", longTag}\n\n\tfor _, repotag := range invalidTags {\n\t\tout, _, err := dockerCmdWithError(\"tag\", \"busybox\", repotag)\n\t\tc.Assert(err, checker.NotNil, check.Commentf(\"tag busybox %v should have failed : %v\", repotag, out))\n\t}\n}", "title": "" }, { "docid": "6629fc14339c37b2d4e3c75a07a75013", "score": "0.5743158", "text": "func parseRepositoryTag(repos string) (string, string) {\n\tn := strings.Index(repos, \"@\")\n\tif n >= 0 {\n\t\tparts := strings.Split(repos, \"@\")\n\t\treturn parts[0], parts[1]\n\t}\n\tn = strings.LastIndex(repos, \":\")\n\tif n < 0 {\n\t\treturn repos, \"latest\"\n\t}\n\tif tag := repos[n+1:]; !strings.Contains(tag, \"/\") {\n\t\treturn repos[:n], tag\n\t}\n\treturn repos, \"latest\"\n}", "title": "" }, { "docid": "bd21c9e5dac03d3ecaf1cdeee80bdc9d", "score": "0.57210517", "text": "func RepoHasTag(repoPath, tag string, opts ...ShowRefVerifyOptions) bool {\n\treturn HasTag(repoPath, tag, opts...)\n}", "title": "" }, { "docid": "08ef3472c550ea9ba533563d556c832c", "score": "0.5711443", "text": "func (s *DockerSuite) TestTagValidPrefixedRepo(c *check.C) {\n\tvalidRepos := []string{\"fooo/bar\", \"fooaa/test\", \"foooo:t\", \"HOSTNAME.DOMAIN.COM:443/foo/bar\"}\n\n\tfor _, repo := range validRepos {\n\t\t_, _, err := dockerCmdWithError(\"tag\", \"busybox:latest\", repo)\n\t\tif err != nil {\n\t\t\tc.Errorf(\"tag busybox %v should have worked: %s\", repo, err)\n\t\t\tcontinue\n\t\t}\n\t\tdeleteImages(repo)\n\t}\n}", "title": "" }, { "docid": "412a266835e33068c99e7fa8c2e73b63", "score": "0.5708955", "text": "func HasTag(repoPath, tag string, opts ...ShowRefVerifyOptions) bool {\n\treturn RepoHasReference(repoPath, RefsTags+tag, opts...)\n}", "title": "" }, { "docid": "fd568fe06e37cf06e2d4f96be843e8bf", "score": "0.5699846", "text": "func tagExists(mgr connmgri.ConnManager, p peer.ID, tag string) bool {\n\tinfo := mgr.GetTagInfo(p)\n\tif info == nil {\n\t\treturn false\n\t}\n\t_, exists := info.Tags[tag]\n\treturn exists\n}", "title": "" }, { "docid": "92ef07156c8642cdf5142efebae5ea7d", "score": "0.5660918", "text": "func (s *DockerSuite) TestTagInvalidUnprefixedRepo(c *check.C) {\n\tinvalidRepos := []string{\"fo$z$\", \"Foo@3cc\", \"Foo$3\", \"Foo*3\", \"Fo^3\", \"Foo!3\", \"F)xcz(\", \"fo%asd\", \"FOO/bar\"}\n\n\tfor _, repo := range invalidRepos {\n\t\tout, _, err := dockerCmdWithError(\"tag\", \"busybox\", repo)\n\t\tc.Assert(err, checker.NotNil, check.Commentf(\"tag busybox %v should have failed : %v\", repo, out))\n\t}\n}", "title": "" }, { "docid": "be21b62fe9d56d75213dfd391fcb5c3e", "score": "0.5626403", "text": "func repositoryName(name string) string {\n\treturn fmt.Sprintf(\"%s/%s\", name, componentName)\n}", "title": "" }, { "docid": "e65d5284eaca1692254e62b7c51e0462", "score": "0.5618073", "text": "func imageName(name, tag string) string {\n\treturn fmt.Sprintf(\"%s:%s\", repositoryName(name), tag)\n}", "title": "" }, { "docid": "7d5db8a29efe112a0738a9e96326173a", "score": "0.5605122", "text": "func tagContains(tag, optionName []byte) bool {\n\tif len(tag) == 0 {\n\t\treturn false\n\t}\n\n\ttmp := tag\n\tfor len(tmp) > 0 {\n\t\tvar next []byte\n\t\ti := bytes.IndexByte(tmp, comma)\n\t\tif i >= 0 {\n\t\t\ttmp, next = tmp[:i], tmp[i+1:]\n\t\t}\n\t\tif bytes.Equal(tmp, optionName) {\n\t\t\treturn true\n\t\t}\n\t\ttmp = next\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a1dafebf2edca189c210536dc5a9d498", "score": "0.5556874", "text": "func (c Comments) hasTag(name string) bool {\n\tfor _, c := range c {\n\t\tprefix := fmt.Sprintf(\"+%s\", name)\n\t\tif strings.HasPrefix(c, prefix) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "422a672d43104d438e7b9156168e79eb", "score": "0.5551593", "text": "func (instance label) IsTag(ctx context.Context) (bool, fail.Error) {\n\tvar out bool\n\txerr := instance.Inspect(ctx, func(clonable data.Clonable, _ *serialize.JSONProperties) fail.Error {\n\t\talabel, ok := clonable.(*abstract.Label)\n\t\tif !ok {\n\t\t\treturn fail.InconsistentError(\"'*abstract.Label' expected, '%s' provided\", reflect.TypeOf(clonable).String())\n\t\t}\n\n\t\tout = !alabel.HasDefault\n\t\treturn nil\n\t})\n\tif xerr != nil {\n\t\treturn false, xerr\n\t}\n\n\treturn out, nil\n}", "title": "" }, { "docid": "cbaf0a241f9867571aa508862a428e7d", "score": "0.5543285", "text": "func TestRepo_LocalTag(t *testing.T) {\n\texecCommand = fakeExecCommand\n\n\t// Restore exec command behavior at the end of the test.\n\tdefer func() { execCommand = exec.Command }()\n\n\t// Checks with valid paths\n\tfor _, tp := range okPathTests {\n\t\tif r, err := NewRepo(tp.path); err != nil {\n\t\t\tt.Errorf(\"Expected no error with valid path '%v', got: %v\", tp.path, err)\n\t\t} else if tag, err := r.LocalTag(); err != nil {\n\t\t\tt.Errorf(\"Expected no error, got '%v'\", err)\n\t\t} else if tag != tagTest {\n\t\t\tt.Errorf(\"Expected tag '%v', got '%v'\", tagTest, tag)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b6fd15a11caa004f385833084ccc71e1", "score": "0.5540685", "text": "func (g *GitLab) TagExists(project, tag string) (bool, error) {\n\tns := fmt.Sprintf(\"%s/%s\", g.group, project)\n\n\t_, resp, err := g.client.Tags.GetTag(ns, tag)\n\tif err != nil {\n\t\tif resp != nil {\n\t\t\tswitch resp.StatusCode {\n\t\t\tcase http.StatusNotFound:\n\t\t\t\treturn false, nil\n\t\t\tcase http.StatusUnauthorized:\n\t\t\t\treturn false, fmt.Errorf(invalidGitLabToken, g.group)\n\t\t\t}\n\t\t}\n\t\treturn false, fmt.Errorf(\"Error retrieving tags of project %s: %v\", project, err)\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "4fbd8f3e196791e473da0a4c3b2e22ed", "score": "0.5532114", "text": "func (s *Server) HasTag(tag string) bool {\n\tfor _, t := range s.Tags {\n\t\tif t == tag {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "17eb2b54ef8f4a4e341c5ce4455c7b9a", "score": "0.5525256", "text": "func (s *DockerSuite) TestTagExistedNameWithoutForce(c *check.C) {\n\tdockerCmd(c, \"tag\", \"busybox:latest\", \"busybox:test\")\n}", "title": "" }, { "docid": "5905af4dd340a61dd31ecf4633ed5358", "score": "0.55191284", "text": "func isTag(token html.Token, tag string) bool {\n\treturn token.Data == tag\n}", "title": "" }, { "docid": "2c0200cbc8c9c5598fe848a5012ea89d", "score": "0.5515907", "text": "func tagForRefName(ref string, specific bool) string {\n\ttag := ref\n\tif specific {\n\t\ttag = fmt.Sprintf(\"%s\", os.Getenv(\"CI_BUILD_REF\")[0:8])\n\t} else if tag == \"master\" {\n\t\ttag = \"latest\"\n\t} else if tag == \"develop\" {\n\t\ttag = \"unstable\"\n\t} else if strings.HasPrefix(tag, \"release/\") {\n\t\ttag = strings.Replace(tag, \"release/\", \"\", 1)\n\t}\n\treturn strings.Replace(tag, \"/\", \"-\", -1)\n}", "title": "" }, { "docid": "a92b04397988fa62a19cbbce164381d1", "score": "0.5458542", "text": "func HandleFindTags(\n\trepos core.RepositoryStore,\n\tgits model.GitService,\n) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvar (\n\t\t\tctx = r.Context()\n\t\t\tname = chi.URLParam(r, \"name\")\n\t\t\tnamespace = chi.URLParam(r, \"owner\")\n\t\t)\n\t\tslug := namespace + \"/\" + name\n\t\ttags, err := gits.FindTags(ctx, nil, slug)\n\t\tif err != nil {\n\t\t\trender.InternalError(w, err)\n\t\t\treturn\n\t\t}\n\t\trender.JSON(w, tags, 200)\n\t}\n}", "title": "" }, { "docid": "0ed34cfbb6802fd4f045b2bacfaabfef", "score": "0.54428107", "text": "func TagExists(exec boil.Executor, iD int64) (bool, error) {\n\tvar exists bool\n\tsql := \"select exists(select 1 from \\\"tags\\\" where \\\"id\\\"=$1 limit 1)\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, iD)\n\t}\n\trow := exec.QueryRow(sql, iD)\n\n\terr := row.Scan(&exists)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"mdbmodels: unable to check if tags exists\")\n\t}\n\n\treturn exists, nil\n}", "title": "" }, { "docid": "b756bb6767d8b83ceb0060e23ddc7e51", "score": "0.54249114", "text": "func (r repository) ResolveTag(name string) (vcs.CommitID, error) {\n\tstart := time.Now()\n\ttag, err := r.r.ResolveTag(name)\n\tr.rec.Child().Event(GoVCS{\n\t\tName: \"vcs.Repository.ResolveTag\",\n\t\tArgs: fmt.Sprintf(\"%#v\", name),\n\t\tStartTime: start,\n\t\tEndTime: time.Now(),\n\t})\n\treturn tag, err\n}", "title": "" }, { "docid": "13c6d44a780d8a47202e83abb8c9b323", "score": "0.5417823", "text": "func (lib *Library) ShouldTag() (shouldTag bool) {\n\t// Check if tag is up to date\n\tstdout, err := lib.File.CmdOutput(\"git-tagger\", \"--action=get\")\n\tif err != nil {\n\t\t// No tag set. skip tag\n\t\tlib.File.Output(\"No tag set. Skipping tag.\")\n\t\treturn\n\t}\n\ttag := strings.TrimSpace(string(stdout))\n\n\tstdout, err = lib.File.CmdOutput(\"git\", \"rev-list\", \"-n\", \"1\", tag)\n\tif err != nil {\n\t\t// No tag set. skip tag\n\t\tlib.File.Output(\"No revision history. Skipping tag.\")\n\t\treturn\n\t}\n\ttagCommit := string(stdout)\n\n\tstdout, err = lib.File.CmdOutput(\"git\", \"rev-parse\", \"HEAD\")\n\tif err != nil {\n\t\t// No tag set. skip tag\n\t\tlib.File.Output(\"No revision head. Skipping tag.\")\n\t\treturn\n\t}\n\theadCommit := string(stdout)\n\n\tif tagCommit != headCommit {\n\t\t// Tag out of date\n\t\tlib.File.Output(\"Tag outdated...\")\n\t\treturn true\n\t}\n\n\tlib.File.Output(\"Tag up to date @ \" + tag + \"!\")\n\treturn\n}", "title": "" }, { "docid": "96dff8631685367d329cee11279d6f75", "score": "0.540732", "text": "func (s *DockerSuite) TestTagUnprefixedRepoByID(c *check.C) {\n\timageID := inspectField(c, \"busybox\", \"Id\")\n\tdockerCmd(c, \"tag\", imageID, \"testfoobarbaz\")\n}", "title": "" }, { "docid": "a1da34d20073496f2b58f28012a48007", "score": "0.5397858", "text": "func (r *Repository) Tag(h plumbing.Hash) (*object.Tag, error) {\n\treturn object.GetTag(r.s, h)\n}", "title": "" }, { "docid": "0d51d1c915c2a937bc04dbe6f089b7a1", "score": "0.53961945", "text": "func ImageExistByTag(imgName string, tagName string) (bool, string) {\n\tidb := utils.ImagesDB{}\n\tparseImagesMetadata(&idb)\n\tfor k, v := range idb {\n\t\tif k == imgName {\n\t\t\tfor k, v := range v {\n\t\t\t\tif k == tagName {\n\t\t\t\t\treturn true, v\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn false, \"\"\n}", "title": "" }, { "docid": "12bd45aacaa10b88ea04215fde7aa96a", "score": "0.5379283", "text": "func NameContains(v string) predicate.GithubRepository {\n\treturn predicate.GithubRepository(sql.FieldContains(FieldName, v))\n}", "title": "" }, { "docid": "1eee3522fb0f869864b8ef65ebed0af9", "score": "0.53590614", "text": "func (t *templateFunctions) hasTag(tag string) bool {\n\t_, found := t.tags[tag]\n\treturn found\n}", "title": "" }, { "docid": "7bb94dca182c934720cf248c680cfa89", "score": "0.5318737", "text": "func (req *ProxyRequest) CheckTag(tag string) bool {\n\treturn req.tags.Contains(tag)\n}", "title": "" }, { "docid": "1811cf0ba86284a23d53812cb293e988", "score": "0.53152853", "text": "func (s *DockerSuite) TestTagOfficialNames(c *check.C) {\n\tnames := []string{\n\t\t\"docker.io/busybox\",\n\t\t\"index.docker.io/busybox\",\n\t\t\"library/busybox\",\n\t\t\"docker.io/library/busybox\",\n\t\t\"index.docker.io/library/busybox\",\n\t}\n\n\tfor _, name := range names {\n\t\tout, exitCode, err := dockerCmdWithError(\"tag\", \"busybox:latest\", name+\":latest\")\n\t\tif err != nil || exitCode != 0 {\n\t\t\tc.Errorf(\"tag busybox %v should have worked: %s, %s\", name, err, out)\n\t\t\tcontinue\n\t\t}\n\n\t\t// ensure we don't have multiple tag names.\n\t\tout, _, err = dockerCmdWithError(\"images\")\n\t\tif err != nil {\n\t\t\tc.Errorf(\"listing images failed with errors: %v, %s\", err, out)\n\t\t} else if strings.Contains(out, name) {\n\t\t\tc.Errorf(\"images should not have listed '%s'\", name)\n\t\t\tdeleteImages(name + \":latest\")\n\t\t}\n\t}\n\n\tfor _, name := range names {\n\t\t_, exitCode, err := dockerCmdWithError(\"tag\", name+\":latest\", \"fooo/bar:latest\")\n\t\tif err != nil || exitCode != 0 {\n\t\t\tc.Errorf(\"tag %v fooo/bar should have worked: %s\", name, err)\n\t\t\tcontinue\n\t\t}\n\t\tdeleteImages(\"fooo/bar:latest\")\n\t}\n}", "title": "" }, { "docid": "7abc514903074797ab778af7e7a83c32", "score": "0.530691", "text": "func tagIgnoredGeneric(k string) bool {\n\tfilter := []string{\"^aws:\"}\n\tfor _, v := range filter {\n\t\tlog.Printf(\"[DEBUG] Matching %v with %v\\n\", v, k)\n\t\tif r, _ := regexp.MatchString(v, k); r == true {\n\t\t\tlog.Printf(\"[DEBUG] Found AWS specific tag %s, ignoring.\\n\", k)\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "64e7fab8913b70a4a82dc99d330961ad", "score": "0.53013307", "text": "func (t *Tag) Target(source string, dryRun bool) (changed bool, err error) {\n\tif len(t.VersionFilter.Pattern) == 0 {\n\t\tt.VersionFilter.Pattern = source\n\t}\n\n\tif len(t.Path) == 0 {\n\t\tlogrus.Errorf(\"At least path settings required\")\n\t}\n\n\terr = t.Validate()\n\n\tif err != nil {\n\t\tlogrus.Errorln(err)\n\t\treturn changed, err\n\t}\n\n\ttags, err := generic.Tags(t.Path)\n\n\tif err != nil {\n\t\tlogrus.Errorln(err)\n\t\treturn false, err\n\t}\n\n\texistingTag, err := t.VersionFilter.Search(tags)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// A matching git tag has been found\n\tif len(existingTag) != 0 {\n\t\tlogrus.Printf(\"\\u2714 git tag %q already exist, nothing else todo\", existingTag)\n\t\treturn changed, nil\n\t}\n\n\tnewTag := t.VersionFilter.Pattern\n\n\tlogrus.Printf(\"\\u2714 git tag %q not found, will create it\", newTag)\n\n\tif dryRun {\n\t\treturn changed, err\n\t}\n\n\tchanged, err = generic.NewTag(newTag, t.Message, t.Path)\n\n\tif err != nil {\n\t\treturn changed, err\n\t}\n\tlogrus.Printf(\"\\u2714 git tag %q created\", newTag)\n\n\tscm := git.Git{\n\t\tDirectory: t.Path,\n\t}\n\n\terr = scm.PushTag(newTag)\n\n\tif err != nil {\n\t\tlogrus.Errorf(\"Git push tag error: %s\", err)\n\t\treturn changed, err\n\t}\n\n\tlogrus.Printf(\"\\u2714 git tag %q pushed\", newTag)\n\n\treturn changed, err\n\n}", "title": "" }, { "docid": "62ba7729902eb97232be908611270e78", "score": "0.5297236", "text": "func TestRepo_CheckoutTag(t *testing.T) {\n\texecCommand = fakeExecCommand\n\n\t// Restore exec command behavior at the end of the test.\n\tdefer func() { execCommand = exec.Command }()\n\n\t// Checks with valid paths\n\tfor _, tp := range okPathTests {\n\t\tif r, err := NewRepo(tp.path); err != nil {\n\t\t\tt.Errorf(\"Expected no error with valid path '%v', got: %v\", tp.path, err)\n\t\t} else if err := r.CheckoutTag(\"\"); err == nil {\n\t\t\tt.Error(\"Expected error with empty commit\")\n\t\t} else if err := r.CheckoutTag(remoteTagTest); err != nil {\n\t\t\tt.Errorf(\"Expected no error with valid tag '%v', got: %v\", remoteTagTest, err)\n\t\t} else if err := r.CheckoutTag(tagTest); err == nil {\n\t\t\tt.Error(\"Expected error with unknown tag on local repository\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "76321e02c4d0626fd38bda04e5e9e40f", "score": "0.52908796", "text": "func isRepoUrl(s string) bool {\n\tif strings.HasPrefix(s, \"https://\") {\n\t\treturn true\n\t}\n\tif strings.HasPrefix(s, \"git::\") {\n\t\treturn true\n\t}\n\thost := strings.SplitN(s, \"/\", 2)[0]\n\treturn strings.Contains(host, \".com\") || strings.Contains(host, \".org\")\n}", "title": "" }, { "docid": "ba6564a685663706617ffdb80245bf95", "score": "0.52867055", "text": "func tagIgnoredCodeBuild(t *codebuild.Tag) bool {\n\tfilter := []string{\"^aws:\"}\n\tfor _, v := range filter {\n\t\tlog.Printf(\"[DEBUG] Matching %v with %v\\n\", v, *t.Key)\n\t\tif r, _ := regexp.MatchString(v, *t.Key); r == true {\n\t\t\tlog.Printf(\"[DEBUG] Found AWS specific tag %s (val: %s), ignoring.\\n\", *t.Key, *t.Value)\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f20e1964fa475a2d672fd6f32f05e699", "score": "0.52845067", "text": "func isIgnoredTag(tag string) bool {\n\tif tag == \"cgo\" || tag == \"race\" || tag == \"msan\" {\n\t\treturn true\n\t}\n\tif len(tag) < 5 || !strings.HasPrefix(tag, \"go\") {\n\t\treturn false\n\t}\n\tif tag[2] < '0' || tag[2] > '9' || tag[3] != '.' {\n\t\treturn false\n\t}\n\tfor _, c := range tag[4:] {\n\t\tif c < '0' || c > '9' {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "ee14ede89be6409616600194cd214855", "score": "0.5281854", "text": "func (k *Key) HasTag(tag string) bool {\n\tfor _, v := range k.Tags {\n\t\tif v == tag {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f6deffe5f39f6a2e523c8dc89a5a7356", "score": "0.528123", "text": "func (o *ContainerProjectRegistryCreate) HasTag() bool {\n\tif o != nil && o.Tag != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fa33c4819bc30c34a58358a76ec75bf3", "score": "0.5262239", "text": "func (a *DefaultApiService) GetTag(ctx context.Context, name string, projectKey string, repositorySlug string, name_ string) (string, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue string\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/1.0/projects/{projectKey}/repos/{repositorySlug}/tags/{name:.*}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"projectKey\"+\"}\", fmt.Sprintf(\"%v\", projectKey), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"repositorySlug\"+\"}\", fmt.Sprintf(\"%v\", repositorySlug), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name:.*\"+\"}\", fmt.Sprintf(\"%v\", name_), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\tif err == nil { \n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v string\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "24c0825af9172ca84109de61c906fa86", "score": "0.5258284", "text": "func (r *Repo) LocalTag() (string, error) {\n\treturn r.gitDescribe(\"\")\n}", "title": "" }, { "docid": "8d6e9df61249f4620fad09fc26d7714f", "score": "0.5255699", "text": "func (o *StorageProjectImageCreate) HasTag() bool {\n\tif o != nil && o.Tag != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7b8ac3eed16ffc413beaa24425300046", "score": "0.525008", "text": "func RepoWithTag(t *testing.T) *Repo {\n\tr := RepoWithCommit(t)\n\tr.tag(\"v0.0.1\")\n\tr.checkout(\"v0.0.1\")\n\n\treturn r\n}", "title": "" }, { "docid": "7b8ac3eed16ffc413beaa24425300046", "score": "0.525008", "text": "func RepoWithTag(t *testing.T) *Repo {\n\tr := RepoWithCommit(t)\n\tr.tag(\"v0.0.1\")\n\tr.checkout(\"v0.0.1\")\n\n\treturn r\n}", "title": "" }, { "docid": "6e6ae81715e679c033d11491b9ee7d46", "score": "0.5248969", "text": "func Tag(name, space string) Match {\n\treturn func(e *dom.Element) bool {\n\t\treturn (space == \"*\" || space == e.Name.Space) &&\n\t\t\t(name == \"*\" || name == e.Name.Local)\n\t}\n}", "title": "" }, { "docid": "cacb11e7efed9a5b16c2f64ce0abad8f", "score": "0.52482396", "text": "func isCloudTagKey(tagKey string) bool {\n\treturn strings.HasPrefix(tagKey, key.KeyCloudPrefix)\n}", "title": "" }, { "docid": "5dd53789bf15a0f32e84a0773af8f7dc", "score": "0.52324176", "text": "func (e Entry) HasTag(tag string) error {\n\talias := convertToCharStar(e.alias)\n\tdefer releaseCharStar(alias)\n\tcTag := convertToCharStar(tag)\n\tdefer releaseCharStar(cTag)\n\terr := C.qdb_has_tag(e.handle, alias, cTag)\n\treturn makeErrorOrNil(err)\n}", "title": "" }, { "docid": "ab199a172da9f1376af486feb6d03a1f", "score": "0.5229761", "text": "func tag() string {\n\ts, _ := sh.Output(\"git\", \"describe\", \"--tags\", \"--dirty\")\n\treturn s\n}", "title": "" }, { "docid": "f464263e76444b9ae7b671e1abff599e", "score": "0.5219776", "text": "func (r *Repo) Tag(name string, base interface{}) (ref *Ref, err error) {\n\tref, err = r.makeRef(\"tag\", name, base)\n\treturn\n}", "title": "" }, { "docid": "8eac6e29eda33daa904be947f90bc0f9", "score": "0.52073836", "text": "func TestVersionMatchesTag(t *testing.T) {\n\ttag := os.Getenv(\"TRAVIS_TAG\")\n\tif tag == \"\" {\n\t\tt.SkipNow()\n\t}\n\tif tag[0] != 'v' {\n\t\tt.Fatalf(\"Expected tag to start with `v`, got %+v\", tag)\n\t}\n\tif Version != tag[1:] {\n\t\tt.Fatalf(\"Expected version %+v, got %+v\", Version, tag[1:])\n\t}\n}", "title": "" }, { "docid": "21aa666579e0c675913b497c735ce49d", "score": "0.52070254", "text": "func (r Repos) HasName(repoName string) bool {\n\tfor _, x := range r {\n\t\tif x.Name == repoName {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bfa4cb96657b742fd0c91f73de4a13b2", "score": "0.5193473", "text": "func (o FactoryVstsConfigurationOutput) RepositoryName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FactoryVstsConfiguration) string { return v.RepositoryName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4b5ac4c6acc3f8e90e4a1ab3259dc635", "score": "0.5184673", "text": "func (g *GitLab) TagRepo(project, tag string, usr *User) error {\n\tns := fmt.Sprintf(\"%s/%s\", g.group, project)\n\tmessage := fmt.Sprint(\"Tagged by Chef-Guard\\n\")\n\n\topts := &gitlab.CreateTagOptions{\n\t\tTagName: gitlab.String(tag),\n\t\tRef: gitlab.String(\"master\"),\n\t\tMessage: gitlab.String(message),\n\t}\n\t_, resp, err := g.client.Tags.CreateTag(ns, opts)\n\tif err != nil {\n\t\tif resp != nil && resp.StatusCode == http.StatusUnauthorized {\n\t\t\treturn fmt.Errorf(invalidGitLabToken, g.group)\n\t\t}\n\t\treturn fmt.Errorf(\"Error creating tag for project %s: %v\", project, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bd49c84a3934d4bd2bab400d1e333319", "score": "0.51796", "text": "func ValidRepoName(name string) bool {\n\tif len(name) == 0 {\n\t\treturn false\n\t}\n\tif len(name) > 256 {\n\t\tblog.Error(\"Invalid repo name, too long: %s\", name)\n\t\treturn false\n\t}\n\tfor _, c := range name {\n\t\tswitch {\n\t\tcase c >= 'a' && c <= 'z':\n\t\t\tcontinue\n\t\tcase c >= 'A' && c <= 'Z':\n\t\t\tcontinue\n\t\tcase c >= '0' && c <= '9':\n\t\t\tcontinue\n\t\tcase c == '/' || c == '_' || c == '-' || c == '.':\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tblog.Error(\"Invalid repo name %s\", name)\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "637fcd00f60eeb789002f1f1cb347fba", "score": "0.51775825", "text": "func NameHasSuffix(v string) predicate.GithubRepository {\n\treturn predicate.GithubRepository(sql.FieldHasSuffix(FieldName, v))\n}", "title": "" }, { "docid": "5f3812772e4113957714bfb10ebfa665", "score": "0.5171605", "text": "func (ri *remoteInfo) Tag(key string) (value string, exist bool) {\n\tri.RLock()\n\tdefer ri.RUnlock()\n\n\tvalue, exist = ri.tags[key]\n\tif !exist && ri.instance != nil {\n\t\tvalue, exist = ri.instance.Tag(key)\n\t}\n\treturn\n}", "title": "" }, { "docid": "0d30352a65149801b312165ee1d2aec0", "score": "0.51682156", "text": "func (c *Commit) Tag() string {\n\tparts := strings.Split(c.Refs, \", \")\n\tfor _, p := range parts {\n\t\tif strings.HasPrefix(p, \"tag: \") {\n\t\t\treturn strings.Replace(p, \"tag: \", \"\", 1)\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "f648b43c3881c587341c81badd34672e", "score": "0.5157652", "text": "func (d *RegistryService) GetRepository(repoName string) *model.RepositoryResult {\n\n\trepositoryRaw := &model.RepositoryRaw{}\n\trepositoryResult := &model.RepositoryResult{}\n\n\tpath := fmt.Sprintf(urlconst.PathRegistryTagList, repoName)\n\n\ttoken, err := d.Authorization(&scope.Scope{\n\t\tType: scope.TypeRepository,\n\t\tResource: repoName,\n\t\tAction: scope.ActionPull,\n\t})\n\tif err != nil {\n\t\treturn repositoryResult\n\t}\n\treq, err := http.NewRequest(\"GET\", GetRegistryURL(path), nil)\n\tif err != nil {\n\t\treturn repositoryResult\n\t}\n\n\treq.Header.Add(\"Authorization\", token)\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn repositoryResult\n\t}\n\n\tdefer resp.Body.Close()\n\n\tr, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn repositoryResult\n\t}\n\n\t// logger.DEBUG(\"service/docker-registry.go\", \"GetRepository\", string(r))\n\n\t// err ignore\n\tjson.Unmarshal(r, repositoryRaw)\n\trepositoryResult.Name = repositoryRaw.Name\n\ttags := []model.TagResult{}\n\tif repositoryRaw.Tags != nil && len(repositoryRaw.Tags) > 0 {\n\t\tfor _, tagName := range repositoryRaw.Tags {\n\t\t\tdigest := d.GetDigest(repoName, tagName)\n\t\t\t// logger.DEBUG(\"service/docker-registry.go\", \"GetRepository\", fmt.Sprintf(\"%s:%s : digest [%s]\", repoName, tagName, digest))\n\t\t\ttag := &model.TagResult{\n\t\t\t\tName: tagName,\n\t\t\t\tDigest: digest,\n\t\t\t}\n\t\t\ttags = append(tags, *tag)\n\t\t}\n\t}\n\trepositoryResult.Tags = tags\n\n\treturn repositoryResult\n}", "title": "" }, { "docid": "a6ad14774f79cf17ba925d0eba4af745", "score": "0.51503956", "text": "func (m *MockUserStore) HasTag(v0 context.Context, v1 int32, v2 string) (bool, error) {\n\tr0, r1 := m.HasTagFunc.nextHook()(v0, v1, v2)\n\tm.HasTagFunc.appendCall(UserStoreHasTagFuncCall{v0, v1, v2, r0, r1})\n\treturn r0, r1\n}", "title": "" }, { "docid": "8bd497ec73aeed91dbe16958591a62b1", "score": "0.51471084", "text": "func DeleteTag(registryName string, repositoryName string, tag string) (bool, error) {\n\n\trepositoryName, _ = url.QueryUnescape(repositoryName)\n\n\t// Check if the registry is listed as active\n\tif _, ok := ActiveRegistries[registryName]; !ok {\n\t\treturn false, errors.New(registryName + \" was not found within the active list of registries.\")\n\t}\n\tr := ActiveRegistries[registryName]\n\n\t// Check if the tag exists. If it does not we cannot get the digest from it\n\tclient := &http.Client{}\n\treq, _ := http.NewRequest(\"HEAD\", r.GetURI()+\"/\"+repositoryName+\"/manifests/\"+tag, nil)\n\n\t// Note When deleting a manifest from a registry version 2.3 or later, the following header must be used when HEAD or GET-ing the manifest to obtain the correct digest to delete:\n\t// Accept: application/vnd.docker.distribution.manifest.v2+json\n\treq.Header.Set(\"Accept\", \"application/vnd.docker.distribution.manifest.v2+json\")\n\n\t// Execute the request\n\tresp, existsErr := client.Do(req)\n\tif existsErr != nil {\n\t\tutils.Log.WithFields(logrus.Fields{\n\t\t\t\"Request\": resp.Request,\n\t\t\t\"Error\": existsErr,\n\t\t\t\"Tag\": tag,\n\t\t\t\"Response\": resp,\n\t\t}).Error(\"Could not delete tag! Could not head the tag.\")\n\t\treturn false, existsErr\n\t}\n\n\t// Make sure the digest exists in the header. If it does, attempt the deletion\n\tif _, ok := resp.Header[\"Docker-Content-Digest\"]; ok {\n\n\t\tif len(resp.Header[\"Docker-Content-Digest\"]) > 0 {\n\t\t\t// Create and execute DELETE request\n\t\t\tdigest := resp.Header[\"Docker-Content-Digest\"][0]\n\t\t\tclient := &http.Client{}\n\t\t\treq, _ := http.NewRequest(\"DELETE\", r.GetURI()+\"/\"+repositoryName+\"/manifests/\"+digest, nil)\n\t\t\treq.Header.Set(\"Accept\", \"application/vnd.docker.distribution.manifest.v2+json\")\n\t\t\tresp, err := client.Do(req)\n\t\t\tif err != nil || resp.StatusCode != 200 {\n\t\t\t\tutils.Log.WithFields(logrus.Fields{\n\t\t\t\t\t\"Error\": err,\n\t\t\t\t\t\"Tag\": tag,\n\t\t\t\t\t\"Response\": resp,\n\t\t\t\t}).Error(\"Could not delete tag!\")\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t}\n\n\t\t// Error if there was nothing in the Docker-Content-Digest field\n\t\tutils.Log.WithFields(logrus.Fields{\n\t\t\t\"Error\": errors.New(\"No digest gotten from response header\"),\n\t\t\t\"Tag\": tag,\n\t\t\t\"Response\": resp,\n\t\t}).Error(\"Could not delete tag!\")\n\t\treturn false, errors.New(\"No digest gotten from response header\")\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "c347380243ce5b9d018effc19c75b965", "score": "0.5142183", "text": "func NodeHasTag(tag string) Predicate {\n\treturn func(j *tes.Task, n *Node) error {\n\t\tif _, ok := n.Metadata[tag]; !ok {\n\t\t\treturn fmt.Errorf(\"fail node has tag: %s\", tag)\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7464de6427e04e026f2d87e90250d5fa", "score": "0.5134385", "text": "func (o GetFactoryVstsConfigurationOutput) RepositoryName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetFactoryVstsConfiguration) string { return v.RepositoryName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0610f0b0315daa35d5c538e11accb9e8", "score": "0.5132478", "text": "func (d DefaultImageMetadataService) Tag(imageName, tarImageName string) error {\n\timageMetadata, err := d.imageStore.GetImageMetadataItem(imageName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tnamed, err := reference.ParseToNamed(tarImageName)\n\tif err != nil {\n\t\treturn err\n\t}\n\timageMetadata.Name = named.Raw()\n\tif err := d.imageStore.SetImageMetadataItem(imageMetadata); err != nil {\n\t\treturn fmt.Errorf(\"failed to add tag %s, %s\", tarImageName, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7118867581e9e5c3d6da85dbf5f569cd", "score": "0.51324326", "text": "func (o RepositoryOutput) RepositoryName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Repository) pulumi.StringOutput { return v.RepositoryName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2fcca91b1eb52391dea895664303fd38", "score": "0.5131133", "text": "func (mc *MemCache) HasTag(imageName string, tagName string) bool {\n\ttag, err := mc.GetTag(imageName, tagName)\n\tif err != nil || tag == nil {\n\t\treturn false\n\t} else {\n\t\treturn true\n\t}\n}", "title": "" }, { "docid": "06c6b4d7e530a61ca8fbca1a0b635b81", "score": "0.51217055", "text": "func (cert Certificate) HasTag(tag string) bool {\n\tfor _, t := range cert.Tags {\n\t\tif t == tag {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "eee80e818e0f03dd3519dccb3fc8e4fa", "score": "0.5112936", "text": "func (u *UbuntuOS) IsToolVerInRepo(toolName, version string) (bool, error) {\n\t//Check if requested Docker or K8S components said version is available in OS repo or not\n\n\tchkToolVer := fmt.Sprintf(\"apt-cache madison '%s' | grep -w %s | head -1 | awk '{$1=$1};1' | cut -d' ' -f 3\", toolName, version)\n\tcmd := &Command{Cmd: exec.Command(\"sh\", \"-c\", chkToolVer)}\n\tcmd.ExecuteCommand()\n\tstdout := cmd.GetStdOutput()\n\terrout := cmd.GetStdErr()\n\n\tif errout != \"\" {\n\t\treturn false, fmt.Errorf(\"%s\", errout)\n\t}\n\n\tif stdout != \"\" {\n\t\tfmt.Println(toolName, stdout, \"is available in OS repo\")\n\t\treturn true, nil\n\t}\n\n\tfmt.Println(toolName, \"version\", version, \"not found in OS repo\")\n\treturn false, nil\n}", "title": "" }, { "docid": "0053cfd39a2cbd388b95f8d47ce7f719", "score": "0.5111123", "text": "func (a *Article) taggedWith(tag Tag) bool {\n\tfor _, t := range a.Tags {\n\t\tif t == tag {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "73f48331648438b8b6861754a356a692", "score": "0.5106557", "text": "func validTag(name string) bool {\n\tif len(name) < 1 {\n\t\treturn false\n\t}\n\n\t// Allow user tags to be passed to validTag.\n\tif len(name) >= 2 && name[0] == prefixUserTag {\n\t\tname = name[1:]\n\t}\n\n\tfor i := 0; i < len(name); i++ {\n\t\t// A-Z, a-z, 0-9, -/._\n\t\tif (name[i] < 'A' || name[i] > 'Z') && (name[i] < 'a' || name[i] > 'z') && (name[i] < '-' || name[i] > '9') && name[i] != '_' {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "33c01651ff107d66d8cd167b40e880f4", "score": "0.5102371", "text": "func (pusher Pusher) HasTag(sender string) bool {\n\tfor _, s := range pusher.Tags {\n\t\tif sender == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "83dc0d5f8e781833678d9b5ba529804e", "score": "0.5102037", "text": "func (r *Repository) Tag(name string, opts ...TagOptions) (*Tag, error) {\n\tvar opt TagOptions\n\tif len(opts) > 0 {\n\t\topt = opts[0]\n\t}\n\n\trefsepc := RefsTags + name\n\trefs, err := r.ShowRef(ShowRefOptions{\n\t\tTags: true,\n\t\tPatterns: []string{refsepc},\n\t\tTimeout: opt.Timeout,\n\t\tCommandOptions: opt.CommandOptions,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t} else if len(refs) == 0 {\n\t\treturn nil, ErrReferenceNotExist\n\t}\n\n\tid, err := NewIDFromString(refs[0].ID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttag, err := r.getTag(opt.Timeout, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttag.refspec = refsepc\n\treturn tag, nil\n}", "title": "" }, { "docid": "fe61601635f047c0a184c89bc711b1a0", "score": "0.50974554", "text": "func (s *Store) Tag(ctx context.Context, desc ocispec.Descriptor, reference string) error {\n\tif err := validateReference(reference); err != nil {\n\t\treturn err\n\t}\n\n\texists, err := s.storage.Exists(ctx, desc)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !exists {\n\t\treturn fmt.Errorf(\"%s: %s: %w\", desc.Digest, desc.MediaType, errdef.ErrNotFound)\n\t}\n\n\treturn s.tag(ctx, desc, reference)\n}", "title": "" }, { "docid": "68bda78fad6c716854c90c75c3a81e3b", "score": "0.5093736", "text": "func (p *Post) HasTag(tag string) bool {\n\tfor i := range p.Tags {\n\t\tif p.Tags[i] == tag {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ad384dc8546db444f77e54e13e30253e", "score": "0.5074853", "text": "func ImageExists(name string) (bool, error) {\r\n\tcli, err := docker.NewEnvClient()\r\n\tif err != nil {\r\n\t\treturn false, err\r\n\t}\r\n\r\n\tctx := context.Background()\r\n\r\n\t// Iterate over all the images on the host\r\n\t// in the look for a matching image\r\n\tconts, err := cli.ImageList(ctx, types.ImageListOptions{})\r\n\tfor _, cont := range conts {\r\n\t\tif len(cont.RepoTags) > 0 {\r\n\t\t\tif cont.RepoTags[0] == name {\r\n\t\t\t\treturn true, nil\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false, err\r\n}", "title": "" }, { "docid": "c0e0a53bc15431b69201afb2fc1cfa1b", "score": "0.50625455", "text": "func (t DocTags) Contain(tag string) bool {\n\ttag = strings.ToLower(tag)\n\tfor _, docTag := range t {\n\t\tif docTag == tag {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a3b2a538534d703e47726d9352c93c2c", "score": "0.50266635", "text": "func (opts PushUpdateOptions) TagName() string {\n\treturn opts.RefFullName[len(git.TagPrefix):]\n}", "title": "" }, { "docid": "bf87ee1e4ccceadd6e0a4b341dc1d763", "score": "0.5025252", "text": "func (store *Store) GetTag(repository, mapName, tagName string) (Tag, error) {\n\tpath := fmt.Sprintf(tagPath, store.basePath, repository, mapName, tagName)\n\n\tblob, err := store.get(path)\n\tif err != nil {\n\t\treturn Tag{}, err\n\t}\n\n\tvar tag Tag\n\tif err := json.Unmarshal(blob, &tag); err != nil {\n\t\treturn Tag{}, err\n\t}\n\n\treturn tag, nil\n}", "title": "" }, { "docid": "24885af2c85cf740a11107239470c62e", "score": "0.50123537", "text": "func checkTag(defs []*ecs.TaskDefinition, tag string) bool {\n\tfor i, d := range defs {\n\t\tif len(d.ContainerDefinitions) != 1 {\n\t\t\tlog.Fatalln(\"Multi-container tasks are not currently supported!\")\n\t\t}\n\t\tt := esu.ParseARN(*d.ContainerDefinitions[0].Image)\n\t\tlog.Printf(\"Task %d at revision %d, running %s\", i, *d.Revision, t.ShortName())\n\t\tif t.Revision != tag {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "48a3f518f33f34128476eec67e07d187", "score": "0.50104403", "text": "func isPrerelease(tag string) bool {\n\treturn strings.Contains(tag, \"-alpha\") ||\n\t\tstrings.Contains(tag, \"-beta\") ||\n\t\tstrings.Contains(tag, \"-pre\") ||\n\t\tstrings.Contains(tag, \"-rc\")\n}", "title": "" }, { "docid": "25d5fc579d0dd992c1ec349488b0a4c9", "score": "0.5008952", "text": "func matchByTag(i *ec2.Image, key string, value string) bool {\n\tfor _, tag := range i.Tags {\n\t\tif strings.EqualFold(*tag.Key, key) && matchByRegex(value, *tag.Value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" } ]
c55c6c7047d65e653d4b4d15c2dce553
/ SlidesApiServiceTests Render shape to specified picture format. Test for SlidesApi.DownloadSpecialSlideShape method with invalid storage
[ { "docid": "215bbe40b9fa24c9e2a209730ce1c1d2", "score": "0.6436498", "text": "func TestDownloadSpecialSlideShapeInvalidStorage(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(teststorage, \"DownloadSpecialSlideShape\", \"storage\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n teststorage = nullValue\n } else {\n teststorage, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadSpecialSlideShape\", \"storage\", teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadSpecialSlideShape\", \"storage\", \"string\", teststorage, int32(statusCode), e)\n}", "title": "" } ]
[ { "docid": "df17af580a0ed9e5e2d4ac8588f523e7", "score": "0.66467524", "text": "func TestDownloadSpecialSlideShape(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"subShape\", \"string\").(string)\n e := InitializeTest(\"DownloadSpecialSlideShape\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n r, _, e := c.SlidesApi.DownloadSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n assertBinaryResponse(r, t)\n}", "title": "" }, { "docid": "bbcd667da9f9ea93391029acac6faad1", "score": "0.6523721", "text": "func TestDownloadSpecialSlideShapeInvalidFormat(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testformat, \"DownloadSpecialSlideShape\", \"format\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testformat = nullValue\n } else {\n testformat, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadSpecialSlideShape\", \"format\", testformat)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadSpecialSlideShape\", \"format\", \"string\", testformat, int32(statusCode), e)\n}", "title": "" }, { "docid": "1cd8a976f808e2109568d7bb3e0a3aa4", "score": "0.6471393", "text": "func TestDownloadShapeInvalidFormat(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testformat, \"DownloadShape\", \"format\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testformat = nullValue\n } else {\n testformat, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadShape\", \"format\", testformat)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShape(testname, testslideIndex, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShape\", \"format\", \"string\", testformat, int32(statusCode), e)\n}", "title": "" }, { "docid": "ead87f0524f15265c1b9225b9a6caeaa", "score": "0.64298576", "text": "func TestDownloadShapeOnline(t *testing.T) {\n testdocument, _ := createTestParamValue(\"DownloadShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShapeOnline\", \"format\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n e := InitializeTest(\"DownloadShapeOnline\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n r, _, e := c.SlidesApi.DownloadShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n assertBinaryResponse(r, t)\n}", "title": "" }, { "docid": "cbc4692dce5a7c3c539b5e6691473429", "score": "0.64151454", "text": "func TestDownloadShape(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadShape\", \"subShape\", \"string\").(string)\n e := InitializeTest(\"DownloadShape\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n r, _, e := c.SlidesApi.DownloadShape(testname, testslideIndex, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n assertBinaryResponse(r, t)\n}", "title": "" }, { "docid": "96c342c35c5f2e2e1bb38c89b6ea8955", "score": "0.63892275", "text": "func TestDownloadSpecialSlideShapeInvalidSubShape(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testsubShape, \"DownloadSpecialSlideShape\", \"subShape\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testsubShape = nullValue\n } else {\n testsubShape, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadSpecialSlideShape\", \"subShape\", testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadSpecialSlideShape\", \"subShape\", \"string\", testsubShape, int32(statusCode), e)\n}", "title": "" }, { "docid": "92576f458c2ba03f73b22a0b5abc9754", "score": "0.63757086", "text": "func TestSaveShape(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveShape\", \"subShape\", \"string\").(string)\n e := InitializeTest(\"SaveShape\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, e = c.SlidesApi.SaveShape(testname, testslideIndex, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "582ff97ecd95461fc3f7f905de651824", "score": "0.6373297", "text": "func TestSaveSpecialSlideShapeInvalidFormat(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testformat, \"SaveSpecialSlideShape\", \"format\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testformat = nullValue\n } else {\n testformat, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveSpecialSlideShape\", \"format\", testformat)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveSpecialSlideShape\", \"format\", \"string\", testformat, int32(statusCode), e)\n}", "title": "" }, { "docid": "4e893f3a1c1490f3be30ebfbceb2b0fd", "score": "0.63731575", "text": "func TestSaveShapeOnlineInvalidFormat(t *testing.T) {\n testdocument, _ := createTestParamValue(\"SaveShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShapeOnline\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShapeOnline\", \"outPath\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(testformat, \"SaveShapeOnline\", \"format\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testformat = nullValue\n } else {\n testformat, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveShapeOnline\", \"format\", testformat)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testoutPath, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShapeOnline\", \"format\", \"string\", testformat, int32(statusCode), e)\n}", "title": "" }, { "docid": "9864f85da38afd6eeb7b91bfb79dfa91", "score": "0.636849", "text": "func TestSaveShapeOnline(t *testing.T) {\n testdocument, _ := createTestParamValue(\"SaveShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShapeOnline\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShapeOnline\", \"outPath\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n e := InitializeTest(\"SaveShapeOnline\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, e = c.SlidesApi.SaveShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testoutPath, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "c232392e4e48a2e3e31ea479ba225e26", "score": "0.6365081", "text": "func TestDownloadSpecialSlideShapeInvalidBounds(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testbounds, \"DownloadSpecialSlideShape\", \"bounds\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testbounds = nullValue\n } else {\n testbounds, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadSpecialSlideShape\", \"bounds\", testbounds)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadSpecialSlideShape\", \"bounds\", \"string\", testbounds, int32(statusCode), e)\n}", "title": "" }, { "docid": "52db16b4bf8c3e6f9585e9cb9e528f58", "score": "0.63627434", "text": "func TestDownloadSpecialSlideShapeInvalidSlideType(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideType, \"DownloadSpecialSlideShape\", \"slideType\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testslideType = nullValue\n } else {\n testslideType, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadSpecialSlideShape\", \"slideType\", testslideType)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadSpecialSlideShape\", \"slideType\", \"string\", testslideType, int32(statusCode), e)\n}", "title": "" }, { "docid": "88be240a1b9ff6fd8bccb58e7189e69d", "score": "0.6356802", "text": "func TestSaveSpecialSlideShape(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"subShape\", \"string\").(string)\n e := InitializeTest(\"SaveSpecialSlideShape\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, e = c.SlidesApi.SaveSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "8c31abecbd5e7a4b9a1f615cf64cd932", "score": "0.634518", "text": "func TestDownloadShapeInvalidStorage(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(teststorage, \"DownloadShape\", \"storage\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n teststorage = nullValue\n } else {\n teststorage, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadShape\", \"storage\", teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShape(testname, testslideIndex, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShape\", \"storage\", \"string\", teststorage, int32(statusCode), e)\n}", "title": "" }, { "docid": "628f42d79367db2f147e974e96f04e20", "score": "0.6336806", "text": "func TestDownloadShapeOnlineInvalidFormat(t *testing.T) {\n testdocument, _ := createTestParamValue(\"DownloadShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShapeOnline\", \"format\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(testformat, \"DownloadShapeOnline\", \"format\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testformat = nullValue\n } else {\n testformat, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadShapeOnline\", \"format\", testformat)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShapeOnline\", \"format\", \"string\", testformat, int32(statusCode), e)\n}", "title": "" }, { "docid": "5330f8a5b149994abfc25fe20a7f90a3", "score": "0.6334816", "text": "func TestDownloadSpecialSlideShapeInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DownloadSpecialSlideShape\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DownloadSpecialSlideShape\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadSpecialSlideShape\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "62916ab998cfa8d5c9c082045969e0c9", "score": "0.62992245", "text": "func TestSaveSpecialSlideShapeInvalidStorage(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(teststorage, \"SaveSpecialSlideShape\", \"storage\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n teststorage = nullValue\n } else {\n teststorage, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveSpecialSlideShape\", \"storage\", teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveSpecialSlideShape\", \"storage\", \"string\", teststorage, int32(statusCode), e)\n}", "title": "" }, { "docid": "12780030868e9269545bcb91a411a011", "score": "0.62840474", "text": "func TestDownloadShapeInvalidBounds(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testbounds, \"DownloadShape\", \"bounds\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testbounds = nullValue\n } else {\n testbounds, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadShape\", \"bounds\", testbounds)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShape(testname, testslideIndex, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShape\", \"bounds\", \"string\", testbounds, int32(statusCode), e)\n}", "title": "" }, { "docid": "76a5c75d38eea99247acec585937bece", "score": "0.6271572", "text": "func TestSaveSpecialSlideShapeInvalidSlideType(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideType, \"SaveSpecialSlideShape\", \"slideType\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testslideType = nullValue\n } else {\n testslideType, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveSpecialSlideShape\", \"slideType\", testslideType)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveSpecialSlideShape\", \"slideType\", \"string\", testslideType, int32(statusCode), e)\n}", "title": "" }, { "docid": "6bebc0ebc4b978807a0aa0b785fa64a1", "score": "0.6261747", "text": "func TestSaveShapeOnlineInvalidDocument(t *testing.T) {\n testdocument, _ := createTestParamValue(\"SaveShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShapeOnline\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShapeOnline\", \"outPath\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(testdocument, \"SaveShapeOnline\", \"document\", \"[]byte\")\n if (invalidValue == nil) {\n testdocument = nil\n } else {\n testdocument, _ = invalidValue.([]byte)\n }\n\n e := InitializeTest(\"SaveShapeOnline\", \"document\", testdocument)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testoutPath, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShapeOnline\", \"document\", \"[]byte\", testdocument, int32(statusCode), e)\n}", "title": "" }, { "docid": "0491ff0b29e2b2a751cffb1ab3612a5b", "score": "0.62386996", "text": "func TestSaveShapeOnlineInvalidStorage(t *testing.T) {\n testdocument, _ := createTestParamValue(\"SaveShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShapeOnline\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShapeOnline\", \"outPath\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(teststorage, \"SaveShapeOnline\", \"storage\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n teststorage = nullValue\n } else {\n teststorage, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveShapeOnline\", \"storage\", teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testoutPath, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShapeOnline\", \"storage\", \"string\", teststorage, int32(statusCode), e)\n}", "title": "" }, { "docid": "ce0c458a7c058fbd5e7dd5e32d307f8d", "score": "0.6219295", "text": "func TestDownloadSpecialSlideShapeInvalidName(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testname, \"DownloadSpecialSlideShape\", \"name\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testname = nullValue\n } else {\n testname, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadSpecialSlideShape\", \"name\", testname)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadSpecialSlideShape\", \"name\", \"string\", testname, int32(statusCode), e)\n}", "title": "" }, { "docid": "d520c98911a99ae23db07aec5298ed1a", "score": "0.6216587", "text": "func TestDownloadShapeFromDto(t *testing.T) {\n testformat, _ := createTestParamValue(\"DownloadShapeFromDto\", \"format\", \"string\").(string)\n testdto, _ := createTestParamValue(\"DownloadShapeFromDto\", \"dto\", \"ShapeBase\").(IShapeBase)\n e := InitializeTest(\"DownloadShapeFromDto\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n r, _, e := c.SlidesApi.DownloadShapeFromDto(testformat, testdto)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n assertBinaryResponse(r, t)\n}", "title": "" }, { "docid": "0a005ed263eebadfd1a614610832169f", "score": "0.62094027", "text": "func TestDownloadShapeOnlineInvalidStorage(t *testing.T) {\n testdocument, _ := createTestParamValue(\"DownloadShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShapeOnline\", \"format\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(teststorage, \"DownloadShapeOnline\", \"storage\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n teststorage = nullValue\n } else {\n teststorage, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadShapeOnline\", \"storage\", teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShapeOnline\", \"storage\", \"string\", teststorage, int32(statusCode), e)\n}", "title": "" }, { "docid": "a7721f244cdd38fb7330b17a65ebac4b", "score": "0.6203044", "text": "func TestDownloadShapeOnlineInvalidDocument(t *testing.T) {\n testdocument, _ := createTestParamValue(\"DownloadShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShapeOnline\", \"format\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(testdocument, \"DownloadShapeOnline\", \"document\", \"[]byte\")\n if (invalidValue == nil) {\n testdocument = nil\n } else {\n testdocument, _ = invalidValue.([]byte)\n }\n\n e := InitializeTest(\"DownloadShapeOnline\", \"document\", testdocument)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShapeOnline\", \"document\", \"[]byte\", testdocument, int32(statusCode), e)\n}", "title": "" }, { "docid": "8fe916559e15dde1cea1c8caa8f8f948", "score": "0.6190505", "text": "func TestSaveShapeOnlineInvalidSlideIndex(t *testing.T) {\n testdocument, _ := createTestParamValue(\"SaveShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShapeOnline\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShapeOnline\", \"outPath\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"SaveShapeOnline\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"SaveShapeOnline\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testoutPath, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShapeOnline\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "9b7eb98ee411fe9897300941a33df295", "score": "0.6186785", "text": "func TestSaveShapeOnlineInvalidOutPath(t *testing.T) {\n testdocument, _ := createTestParamValue(\"SaveShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShapeOnline\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShapeOnline\", \"outPath\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(testoutPath, \"SaveShapeOnline\", \"outPath\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testoutPath = nullValue\n } else {\n testoutPath, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveShapeOnline\", \"outPath\", testoutPath)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testoutPath, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShapeOnline\", \"outPath\", \"string\", testoutPath, int32(statusCode), e)\n}", "title": "" }, { "docid": "1ac7d5d60fcb0e57550d4fc32863726a", "score": "0.61853963", "text": "func TestDownloadSpecialSlideShapeInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"DownloadSpecialSlideShape\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DownloadSpecialSlideShape\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadSpecialSlideShape\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "2d16da8cf7f45208a3351d84a1411be7", "score": "0.61718947", "text": "func TestSaveSpecialSlideShapeInvalidOutPath(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testoutPath, \"SaveSpecialSlideShape\", \"outPath\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testoutPath = nullValue\n } else {\n testoutPath, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveSpecialSlideShape\", \"outPath\", testoutPath)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveSpecialSlideShape\", \"outPath\", \"string\", testoutPath, int32(statusCode), e)\n}", "title": "" }, { "docid": "228bf2e261498e8cfbdee51e28b5399f", "score": "0.6159178", "text": "func TestDownloadSpecialSlideShapeInvalidOptions(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testoptions, \"DownloadSpecialSlideShape\", \"options\", \"IShapeExportOptions\")\n if (invalidValue == nil) {\n testoptions = nil\n } else {\n testoptions, _ = invalidValue.(IIShapeExportOptions)\n }\n\n e := InitializeTest(\"DownloadSpecialSlideShape\", \"options\", testoptions)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadSpecialSlideShape\", \"options\", \"IShapeExportOptions\", testoptions, int32(statusCode), e)\n}", "title": "" }, { "docid": "c12b3e437752c0702113090ce02b9f66", "score": "0.6153302", "text": "func TestSaveSpecialSlideShapeInvalidSubShape(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testsubShape, \"SaveSpecialSlideShape\", \"subShape\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testsubShape = nullValue\n } else {\n testsubShape, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveSpecialSlideShape\", \"subShape\", testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveSpecialSlideShape\", \"subShape\", \"string\", testsubShape, int32(statusCode), e)\n}", "title": "" }, { "docid": "8d9396251986b719f5d5f32f666301ee", "score": "0.6144338", "text": "func TestSaveSpecialSlideShapeInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"SaveSpecialSlideShape\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "4b893762c9219c9b0e475965a95c0d6a", "score": "0.6138593", "text": "func TestSaveSpecialSlideShapeInvalidBounds(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testbounds, \"SaveSpecialSlideShape\", \"bounds\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testbounds = nullValue\n } else {\n testbounds, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveSpecialSlideShape\", \"bounds\", testbounds)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveSpecialSlideShape\", \"bounds\", \"string\", testbounds, int32(statusCode), e)\n}", "title": "" }, { "docid": "dc533cb7f2ea5dbb6c2faa02583fd305", "score": "0.61364853", "text": "func TestDownloadShapeOnlineInvalidShapeIndex(t *testing.T) {\n testdocument, _ := createTestParamValue(\"DownloadShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShapeOnline\", \"format\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DownloadShapeOnline\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DownloadShapeOnline\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShapeOnline\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "bb28a53fbfe4fdc3dcb38e576ce0641a", "score": "0.61187196", "text": "func TestSaveShapeOnlineInvalidShapeIndex(t *testing.T) {\n testdocument, _ := createTestParamValue(\"SaveShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShapeOnline\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShapeOnline\", \"outPath\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"SaveShapeOnline\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"SaveShapeOnline\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testoutPath, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShapeOnline\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "68ebafdf6634f722a426a53c1fd6da3f", "score": "0.6111277", "text": "func TestDownloadShapeInvalidName(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testname, \"DownloadShape\", \"name\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testname = nullValue\n } else {\n testname, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadShape\", \"name\", testname)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShape(testname, testslideIndex, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShape\", \"name\", \"string\", testname, int32(statusCode), e)\n}", "title": "" }, { "docid": "e10351ed296fb39bd2c27b3408a07616", "score": "0.611127", "text": "func TestSaveShapeOnlineInvalidBounds(t *testing.T) {\n testdocument, _ := createTestParamValue(\"SaveShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShapeOnline\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShapeOnline\", \"outPath\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(testbounds, \"SaveShapeOnline\", \"bounds\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testbounds = nullValue\n } else {\n testbounds, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveShapeOnline\", \"bounds\", testbounds)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testoutPath, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShapeOnline\", \"bounds\", \"string\", testbounds, int32(statusCode), e)\n}", "title": "" }, { "docid": "c083af6cedc695dbb78b50fc8798c7b0", "score": "0.6108559", "text": "func TestDownloadSpecialSlideShapeInvalidFolder(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testfolder, \"DownloadSpecialSlideShape\", \"folder\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testfolder = nullValue\n } else {\n testfolder, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadSpecialSlideShape\", \"folder\", testfolder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadSpecialSlideShape\", \"folder\", \"string\", testfolder, int32(statusCode), e)\n}", "title": "" }, { "docid": "c8f6b1661a3e9f02c6aea4bf071b623a", "score": "0.6105206", "text": "func TestSaveSpecialSlideShapeInvalidName(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testname, \"SaveSpecialSlideShape\", \"name\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testname = nullValue\n } else {\n testname, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveSpecialSlideShape\", \"name\", testname)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveSpecialSlideShape\", \"name\", \"string\", testname, int32(statusCode), e)\n}", "title": "" }, { "docid": "848c711c7ff4154724fe5a3a09eb8e52", "score": "0.6103938", "text": "func TestDownloadShapeInvalidSubShape(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testsubShape, \"DownloadShape\", \"subShape\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testsubShape = nullValue\n } else {\n testsubShape, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadShape\", \"subShape\", testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShape(testname, testslideIndex, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShape\", \"subShape\", \"string\", testsubShape, int32(statusCode), e)\n}", "title": "" }, { "docid": "ac8204ef1ed7bf2bf2c9e312fd003266", "score": "0.6102763", "text": "func TestDownloadShapeOnlineInvalidBounds(t *testing.T) {\n testdocument, _ := createTestParamValue(\"DownloadShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShapeOnline\", \"format\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(testbounds, \"DownloadShapeOnline\", \"bounds\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testbounds = nullValue\n } else {\n testbounds, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadShapeOnline\", \"bounds\", testbounds)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShapeOnline\", \"bounds\", \"string\", testbounds, int32(statusCode), e)\n}", "title": "" }, { "docid": "1ada9fea1aacb6f5c26b4248fb54ca51", "score": "0.6074482", "text": "func TestDownloadShapeOnlineInvalidSlideIndex(t *testing.T) {\n testdocument, _ := createTestParamValue(\"DownloadShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShapeOnline\", \"format\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"DownloadShapeOnline\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DownloadShapeOnline\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShapeOnline\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "713c6d33815ee3dc77a2ae46ca1aefb4", "score": "0.6066154", "text": "func TestDownloadShapeInvalidFolder(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testfolder, \"DownloadShape\", \"folder\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testfolder = nullValue\n } else {\n testfolder, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadShape\", \"folder\", testfolder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShape(testname, testslideIndex, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShape\", \"folder\", \"string\", testfolder, int32(statusCode), e)\n}", "title": "" }, { "docid": "d33b2b32287c1e7423f85076262586c0", "score": "0.6058844", "text": "func TestDownloadShapeInvalidOptions(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testoptions, \"DownloadShape\", \"options\", \"IShapeExportOptions\")\n if (invalidValue == nil) {\n testoptions = nil\n } else {\n testoptions, _ = invalidValue.(IIShapeExportOptions)\n }\n\n e := InitializeTest(\"DownloadShape\", \"options\", testoptions)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShape(testname, testslideIndex, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShape\", \"options\", \"IShapeExportOptions\", testoptions, int32(statusCode), e)\n}", "title": "" }, { "docid": "de7a7d78ee05ec41f3d2d7711055bea3", "score": "0.60535187", "text": "func TestDownloadSpecialSlideShapeInvalidFontsFolder(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testfontsFolder, \"DownloadSpecialSlideShape\", \"fontsFolder\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testfontsFolder = nullValue\n } else {\n testfontsFolder, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadSpecialSlideShape\", \"fontsFolder\", testfontsFolder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadSpecialSlideShape\", \"fontsFolder\", \"string\", testfontsFolder, int32(statusCode), e)\n}", "title": "" }, { "docid": "f1b8139625c57ffe3a5f7ebdad3ec800", "score": "0.6053079", "text": "func TestSaveShapeInvalidFormat(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testformat, \"SaveShape\", \"format\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testformat = nullValue\n } else {\n testformat, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveShape\", \"format\", testformat)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShape(testname, testslideIndex, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShape\", \"format\", \"string\", testformat, int32(statusCode), e)\n}", "title": "" }, { "docid": "632c015faf5084bdd2350cbd842b0585", "score": "0.6052184", "text": "func TestSaveSpecialSlideShapeInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"SaveSpecialSlideShape\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"SaveSpecialSlideShape\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveSpecialSlideShape\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "a44c4016bb9e0a3ce4c21905e0a27044", "score": "0.6032271", "text": "func TestDownloadShapeInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"DownloadShape\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DownloadShape\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShape(testname, testslideIndex, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShape\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "6087b52fa95d8692fcd8ad0d6a873a88", "score": "0.602592", "text": "func TestSaveSpecialSlideShapeInvalidFolder(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testfolder, \"SaveSpecialSlideShape\", \"folder\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testfolder = nullValue\n } else {\n testfolder, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveSpecialSlideShape\", \"folder\", testfolder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveSpecialSlideShape\", \"folder\", \"string\", testfolder, int32(statusCode), e)\n}", "title": "" }, { "docid": "264f4af793948212eae3e8f5da63ea87", "score": "0.6012001", "text": "func TestSaveShapeOnlineInvalidOptions(t *testing.T) {\n testdocument, _ := createTestParamValue(\"SaveShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShapeOnline\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShapeOnline\", \"outPath\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(testoptions, \"SaveShapeOnline\", \"options\", \"IShapeExportOptions\")\n if (invalidValue == nil) {\n testoptions = nil\n } else {\n testoptions, _ = invalidValue.(IIShapeExportOptions)\n }\n\n e := InitializeTest(\"SaveShapeOnline\", \"options\", testoptions)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testoutPath, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShapeOnline\", \"options\", \"IShapeExportOptions\", testoptions, int32(statusCode), e)\n}", "title": "" }, { "docid": "730acb7c6331a5d2bfda67f48d87389f", "score": "0.60060835", "text": "func TestUpdateSpecialSlideShape(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testdto, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"dto\", \"ShapeBase\").(IShapeBase)\n testpassword, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"subShape\", \"string\").(string)\n e := InitializeTest(\"UpdateSpecialSlideShape\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.UpdateSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testdto, testpassword, testfolder, teststorage, testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "74a0b936aa98cc1220afb20118828b96", "score": "0.59667367", "text": "func TestDownloadShapeInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"DownloadShape\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"DownloadShape\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShape(testname, testslideIndex, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShape\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "d0840eaa044d81878c2c1a902ebead4e", "score": "0.5951525", "text": "func TestSaveSpecialSlideShapeInvalidOptions(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testoptions, \"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\")\n if (invalidValue == nil) {\n testoptions = nil\n } else {\n testoptions, _ = invalidValue.(IIShapeExportOptions)\n }\n\n e := InitializeTest(\"SaveSpecialSlideShape\", \"options\", testoptions)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\", testoptions, int32(statusCode), e)\n}", "title": "" }, { "docid": "acb4ffd396cdf1b08c94c08bef188244", "score": "0.5949962", "text": "func TestSaveShapeInvalidStorage(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(teststorage, \"SaveShape\", \"storage\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n teststorage = nullValue\n } else {\n teststorage, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveShape\", \"storage\", teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShape(testname, testslideIndex, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShape\", \"storage\", \"string\", teststorage, int32(statusCode), e)\n}", "title": "" }, { "docid": "63c041e20210558d5fb40ec03d948350", "score": "0.59495384", "text": "func TestDownloadShapeOnlineInvalidOptions(t *testing.T) {\n testdocument, _ := createTestParamValue(\"DownloadShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShapeOnline\", \"format\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(testoptions, \"DownloadShapeOnline\", \"options\", \"IShapeExportOptions\")\n if (invalidValue == nil) {\n testoptions = nil\n } else {\n testoptions, _ = invalidValue.(IIShapeExportOptions)\n }\n\n e := InitializeTest(\"DownloadShapeOnline\", \"options\", testoptions)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShapeOnline\", \"options\", \"IShapeExportOptions\", testoptions, int32(statusCode), e)\n}", "title": "" }, { "docid": "73276bdb20e20e89db9e7865dcc1c283", "score": "0.59386325", "text": "func TestSaveShapeOnlineInvalidFontsFolder(t *testing.T) {\n testdocument, _ := createTestParamValue(\"SaveShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShapeOnline\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShapeOnline\", \"outPath\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(testfontsFolder, \"SaveShapeOnline\", \"fontsFolder\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testfontsFolder = nullValue\n } else {\n testfontsFolder, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveShapeOnline\", \"fontsFolder\", testfontsFolder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testoutPath, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShapeOnline\", \"fontsFolder\", \"string\", testfontsFolder, int32(statusCode), e)\n}", "title": "" }, { "docid": "fbafddfc4330e9bc3bdb5439dcd691cd", "score": "0.5910112", "text": "func TestSaveSpecialSlideShapeInvalidFontsFolder(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testfontsFolder, \"SaveSpecialSlideShape\", \"fontsFolder\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testfontsFolder = nullValue\n } else {\n testfontsFolder, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveSpecialSlideShape\", \"fontsFolder\", testfontsFolder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveSpecialSlideShape\", \"fontsFolder\", \"string\", testfontsFolder, int32(statusCode), e)\n}", "title": "" }, { "docid": "dcdf525a75e2dbfd445824fffebd9ef0", "score": "0.58947456", "text": "func TestDownloadSpecialSlideShapeInvalidScaleX(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"subShape\", \"string\").(string)\n testscaleX = new(float64)\n\n invalidValue := invalidizeTestParamValue(testscaleX, \"DownloadSpecialSlideShape\", \"scaleX\", \"float64\")\n if (invalidValue == nil) {\n var nullValue *float64\n testscaleX = nullValue\n } else {\n *testscaleX, _ = invalidValue.(float64)\n }\n\n e := InitializeTest(\"DownloadSpecialSlideShape\", \"scaleX\", testscaleX)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadSpecialSlideShape\", \"scaleX\", \"float64\", testscaleX, int32(statusCode), e)\n}", "title": "" }, { "docid": "16d8a0c69fe1c3e77d7fe01362d0137f", "score": "0.5884984", "text": "func TestSaveShapeInvalidSlideIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideIndex, \"SaveShape\", \"slideIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testslideIndex = nullValue\n } else {\n testslideIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"SaveShape\", \"slideIndex\", testslideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShape(testname, testslideIndex, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShape\", \"slideIndex\", \"int32\", testslideIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "5decdc7d4d02cf4ac0d6036e77d60f53", "score": "0.58542585", "text": "func TestGetSpecialSlideShape(t *testing.T) {\n testname, _ := createTestParamValue(\"GetSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"GetSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"GetSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"GetSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"GetSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"GetSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"GetSpecialSlideShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"GetSpecialSlideShape\", \"subShape\", \"string\").(string)\n e := InitializeTest(\"GetSpecialSlideShape\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.GetSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testpassword, testfolder, teststorage, testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "c049a8a459cb38122d7e63164f2cefcc", "score": "0.58500826", "text": "func TestCreateSpecialSlideShapeInvalidStorage(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"slideType\", \"string\").(string)\n testdto, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"dto\", \"ShapeBase\").(IShapeBase)\n var testshapeToClone *int32\n testshapeToCloneValue := createTestParamValue(\"CreateSpecialSlideShape\", \"shapeToClone\", \"int32\")\n if (testshapeToCloneValue != nil) {\n testshapeToClone = new(int32)\n *testshapeToClone, _ = testshapeToCloneValue.(int32)\n }\n var testposition *int32\n testpositionValue := createTestParamValue(\"CreateSpecialSlideShape\", \"position\", \"int32\")\n if (testpositionValue != nil) {\n testposition = new(int32)\n *testposition, _ = testpositionValue.(int32)\n }\n testpassword, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(teststorage, \"CreateSpecialSlideShape\", \"storage\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n teststorage = nullValue\n } else {\n teststorage, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"CreateSpecialSlideShape\", \"storage\", teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateSpecialSlideShape(testname, testslideIndex, testslideType, testdto, testshapeToClone, testposition, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateSpecialSlideShape\", \"storage\", \"string\", teststorage, int32(statusCode), e)\n}", "title": "" }, { "docid": "c571ca86d8200ff44e4ef3442c50e6e5", "score": "0.5816901", "text": "func TestDownloadShapeOnlineInvalidFontsFolder(t *testing.T) {\n testdocument, _ := createTestParamValue(\"DownloadShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShapeOnline\", \"format\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(testfontsFolder, \"DownloadShapeOnline\", \"fontsFolder\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testfontsFolder = nullValue\n } else {\n testfontsFolder, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadShapeOnline\", \"fontsFolder\", testfontsFolder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShapeOnline\", \"fontsFolder\", \"string\", testfontsFolder, int32(statusCode), e)\n}", "title": "" }, { "docid": "89a8eb08cd494beb4460fcb326b7e6fe", "score": "0.5799131", "text": "func TestSaveShapeInvalidBounds(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testbounds, \"SaveShape\", \"bounds\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testbounds = nullValue\n } else {\n testbounds, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveShape\", \"bounds\", testbounds)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShape(testname, testslideIndex, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShape\", \"bounds\", \"string\", testbounds, int32(statusCode), e)\n}", "title": "" }, { "docid": "ab5f4ca454eb419f081294f79a73d0ed", "score": "0.57759917", "text": "func TestSaveShapeInvalidSubShape(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testsubShape, \"SaveShape\", \"subShape\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testsubShape = nullValue\n } else {\n testsubShape, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveShape\", \"subShape\", testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShape(testname, testslideIndex, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShape\", \"subShape\", \"string\", testsubShape, int32(statusCode), e)\n}", "title": "" }, { "docid": "a4365c23ffd58b6cf01571121b01d48a", "score": "0.57699645", "text": "func TestSaveShapeInvalidOutPath(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testoutPath, \"SaveShape\", \"outPath\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testoutPath = nullValue\n } else {\n testoutPath, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveShape\", \"outPath\", testoutPath)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShape(testname, testslideIndex, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShape\", \"outPath\", \"string\", testoutPath, int32(statusCode), e)\n}", "title": "" }, { "docid": "d4e6135d6c870e088fd5dd30333586af", "score": "0.5765209", "text": "func TestDownloadShapeInvalidFontsFolder(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testfontsFolder, \"DownloadShape\", \"fontsFolder\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testfontsFolder = nullValue\n } else {\n testfontsFolder, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadShape\", \"fontsFolder\", testfontsFolder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShape(testname, testslideIndex, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShape\", \"fontsFolder\", \"string\", testfontsFolder, int32(statusCode), e)\n}", "title": "" }, { "docid": "df659d3390a29bc52fe3bf89f197caa8", "score": "0.5751396", "text": "func TestCreateSpecialSlideShape(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"slideType\", \"string\").(string)\n testdto, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"dto\", \"ShapeBase\").(IShapeBase)\n var testshapeToClone *int32\n testshapeToCloneValue := createTestParamValue(\"CreateSpecialSlideShape\", \"shapeToClone\", \"int32\")\n if (testshapeToCloneValue != nil) {\n testshapeToClone = new(int32)\n *testshapeToClone, _ = testshapeToCloneValue.(int32)\n }\n var testposition *int32\n testpositionValue := createTestParamValue(\"CreateSpecialSlideShape\", \"position\", \"int32\")\n if (testpositionValue != nil) {\n testposition = new(int32)\n *testposition, _ = testpositionValue.(int32)\n }\n testpassword, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"subShape\", \"string\").(string)\n e := InitializeTest(\"CreateSpecialSlideShape\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.CreateSpecialSlideShape(testname, testslideIndex, testslideType, testdto, testshapeToClone, testposition, testpassword, testfolder, teststorage, testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "89ccfee48404b283ba84e62dd9c83654", "score": "0.57400143", "text": "func TestDownloadSpecialSlideShapeInvalidScaleY(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"subShape\", \"string\").(string)\n testscaleY = new(float64)\n\n invalidValue := invalidizeTestParamValue(testscaleY, \"DownloadSpecialSlideShape\", \"scaleY\", \"float64\")\n if (invalidValue == nil) {\n var nullValue *float64\n testscaleY = nullValue\n } else {\n *testscaleY, _ = invalidValue.(float64)\n }\n\n e := InitializeTest(\"DownloadSpecialSlideShape\", \"scaleY\", testscaleY)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadSpecialSlideShape\", \"scaleY\", \"float64\", testscaleY, int32(statusCode), e)\n}", "title": "" }, { "docid": "96dc376c363f85fd78aa0b7e7d4e4db1", "score": "0.5732054", "text": "func TestCreateSpecialSlideShapeInvalidSubShape(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"slideType\", \"string\").(string)\n testdto, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"dto\", \"ShapeBase\").(IShapeBase)\n var testshapeToClone *int32\n testshapeToCloneValue := createTestParamValue(\"CreateSpecialSlideShape\", \"shapeToClone\", \"int32\")\n if (testshapeToCloneValue != nil) {\n testshapeToClone = new(int32)\n *testshapeToClone, _ = testshapeToCloneValue.(int32)\n }\n var testposition *int32\n testpositionValue := createTestParamValue(\"CreateSpecialSlideShape\", \"position\", \"int32\")\n if (testpositionValue != nil) {\n testposition = new(int32)\n *testposition, _ = testpositionValue.(int32)\n }\n testpassword, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testsubShape, \"CreateSpecialSlideShape\", \"subShape\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testsubShape = nullValue\n } else {\n testsubShape, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"CreateSpecialSlideShape\", \"subShape\", testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateSpecialSlideShape(testname, testslideIndex, testslideType, testdto, testshapeToClone, testposition, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateSpecialSlideShape\", \"subShape\", \"string\", testsubShape, int32(statusCode), e)\n}", "title": "" }, { "docid": "801d3762093b93fed0fa4014f6a34393", "score": "0.57302153", "text": "func TestGetShape(t *testing.T) {\n testname, _ := createTestParamValue(\"GetShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"GetShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"GetShape\", \"shapeIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"GetShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"GetShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"GetShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"GetShape\", \"subShape\", \"string\").(string)\n e := InitializeTest(\"GetShape\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.GetShape(testname, testslideIndex, testshapeIndex, testpassword, testfolder, teststorage, testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "4504acc9d704930502a36b79d52f1234", "score": "0.57153034", "text": "func TestCreateShapeInvalidStorage(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateShape\", \"slideIndex\", \"int32\").(int32)\n testdto, _ := createTestParamValue(\"CreateShape\", \"dto\", \"ShapeBase\").(IShapeBase)\n var testshapeToClone *int32\n testshapeToCloneValue := createTestParamValue(\"CreateShape\", \"shapeToClone\", \"int32\")\n if (testshapeToCloneValue != nil) {\n testshapeToClone = new(int32)\n *testshapeToClone, _ = testshapeToCloneValue.(int32)\n }\n var testposition *int32\n testpositionValue := createTestParamValue(\"CreateShape\", \"position\", \"int32\")\n if (testpositionValue != nil) {\n testposition = new(int32)\n *testposition, _ = testpositionValue.(int32)\n }\n testpassword, _ := createTestParamValue(\"CreateShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"CreateShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(teststorage, \"CreateShape\", \"storage\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n teststorage = nullValue\n } else {\n teststorage, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"CreateShape\", \"storage\", teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateShape(testname, testslideIndex, testdto, testshapeToClone, testposition, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateShape\", \"storage\", \"string\", teststorage, int32(statusCode), e)\n}", "title": "" }, { "docid": "ef521e11d78003899171fad9b7f988dc", "score": "0.571499", "text": "func TestCreateSpecialSlideShapeInvalidSlideType(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"slideType\", \"string\").(string)\n testdto, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"dto\", \"ShapeBase\").(IShapeBase)\n var testshapeToClone *int32\n testshapeToCloneValue := createTestParamValue(\"CreateSpecialSlideShape\", \"shapeToClone\", \"int32\")\n if (testshapeToCloneValue != nil) {\n testshapeToClone = new(int32)\n *testshapeToClone, _ = testshapeToCloneValue.(int32)\n }\n var testposition *int32\n testpositionValue := createTestParamValue(\"CreateSpecialSlideShape\", \"position\", \"int32\")\n if (testpositionValue != nil) {\n testposition = new(int32)\n *testposition, _ = testpositionValue.(int32)\n }\n testpassword, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testslideType, \"CreateSpecialSlideShape\", \"slideType\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testslideType = nullValue\n } else {\n testslideType, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"CreateSpecialSlideShape\", \"slideType\", testslideType)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateSpecialSlideShape(testname, testslideIndex, testslideType, testdto, testshapeToClone, testposition, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateSpecialSlideShape\", \"slideType\", \"string\", testslideType, int32(statusCode), e)\n}", "title": "" }, { "docid": "76fc4885a47e8e9a1159d38406faf2af", "score": "0.57121986", "text": "func TestUpdateShape(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"UpdateShape\", \"shapeIndex\", \"int32\").(int32)\n testdto, _ := createTestParamValue(\"UpdateShape\", \"dto\", \"ShapeBase\").(IShapeBase)\n testpassword, _ := createTestParamValue(\"UpdateShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"UpdateShape\", \"subShape\", \"string\").(string)\n e := InitializeTest(\"UpdateShape\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.UpdateShape(testname, testslideIndex, testshapeIndex, testdto, testpassword, testfolder, teststorage, testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "45d63142b6d4f38e0937517a004c2b8d", "score": "0.570827", "text": "func TestSaveShapeInvalidName(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testname, \"SaveShape\", \"name\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testname = nullValue\n } else {\n testname, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveShape\", \"name\", testname)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShape(testname, testslideIndex, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShape\", \"name\", \"string\", testname, int32(statusCode), e)\n}", "title": "" }, { "docid": "408543178b3f20bda776051f9b415c2a", "score": "0.57039833", "text": "func TestSaveSpecialSlideShapeInvalidScaleX(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"subShape\", \"string\").(string)\n testscaleX = new(float64)\n\n invalidValue := invalidizeTestParamValue(testscaleX, \"SaveSpecialSlideShape\", \"scaleX\", \"float64\")\n if (invalidValue == nil) {\n var nullValue *float64\n testscaleX = nullValue\n } else {\n *testscaleX, _ = invalidValue.(float64)\n }\n\n e := InitializeTest(\"SaveSpecialSlideShape\", \"scaleX\", testscaleX)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveSpecialSlideShape\", \"scaleX\", \"float64\", testscaleX, int32(statusCode), e)\n}", "title": "" }, { "docid": "036a0a5e84f05249f2e3ac8024251082", "score": "0.570052", "text": "func TestCreateWatermarkOnlineInvalidShape(t *testing.T) {\n testdocument, _ := createTestParamValue(\"CreateWatermarkOnline\", \"document\", \"[]byte\").([]byte)\n testshape, _ := createTestParamValue(\"CreateWatermarkOnline\", \"shape\", \"Shape\").(IShape)\n var testfontHeight *float64\n testfontHeightValue := createTestParamValue(\"CreateWatermarkOnline\", \"fontHeight\", \"float64\")\n if (testfontHeightValue != nil) {\n testfontHeight = new(float64)\n *testfontHeight, _ = testfontHeightValue.(float64)\n }\n testtext, _ := createTestParamValue(\"CreateWatermarkOnline\", \"text\", \"string\").(string)\n testfontName, _ := createTestParamValue(\"CreateWatermarkOnline\", \"fontName\", \"string\").(string)\n testfontColor, _ := createTestParamValue(\"CreateWatermarkOnline\", \"fontColor\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"CreateWatermarkOnline\", \"password\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshape, \"CreateWatermarkOnline\", \"shape\", \"Shape\")\n if (invalidValue == nil) {\n testshape = nil\n } else {\n testshape, _ = invalidValue.(IShape)\n }\n\n e := InitializeTest(\"CreateWatermarkOnline\", \"shape\", testshape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateWatermarkOnline(testdocument, testshape, testfontHeight, testtext, testfontName, testfontColor, testpassword)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateWatermarkOnline\", \"shape\", \"Shape\", testshape, int32(statusCode), e)\n}", "title": "" }, { "docid": "048495cc4e4ab5b7622cf83cd039d3af", "score": "0.5693738", "text": "func TestSaveShapeInvalidShapeIndex(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshapeIndex, \"SaveShape\", \"shapeIndex\", \"int32\")\n if (invalidValue == nil) {\n var nullValue int32\n testshapeIndex = nullValue\n } else {\n testshapeIndex, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"SaveShape\", \"shapeIndex\", testshapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShape(testname, testslideIndex, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShape\", \"shapeIndex\", \"int32\", testshapeIndex, int32(statusCode), e)\n}", "title": "" }, { "docid": "bd5beb183f257916070230f45cf2c3df", "score": "0.56933516", "text": "func TestDownloadShapeOnlineInvalidScaleX(t *testing.T) {\n testdocument, _ := createTestParamValue(\"DownloadShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShapeOnline\", \"format\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n testscaleX = new(float64)\n\n invalidValue := invalidizeTestParamValue(testscaleX, \"DownloadShapeOnline\", \"scaleX\", \"float64\")\n if (invalidValue == nil) {\n var nullValue *float64\n testscaleX = nullValue\n } else {\n *testscaleX, _ = invalidValue.(float64)\n }\n\n e := InitializeTest(\"DownloadShapeOnline\", \"scaleX\", testscaleX)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShapeOnline\", \"scaleX\", \"float64\", testscaleX, int32(statusCode), e)\n}", "title": "" }, { "docid": "8447daaaef36a89f9e803690a9319369", "score": "0.56850713", "text": "func TestDownloadShapeInvalidPassword(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testpassword, \"DownloadShape\", \"password\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testpassword = nullValue\n } else {\n testpassword, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadShape\", \"password\", testpassword)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShape(testname, testslideIndex, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShape\", \"password\", \"string\", testpassword, int32(statusCode), e)\n}", "title": "" }, { "docid": "e132086f337306bbeb30867d9831e7f4", "score": "0.5683934", "text": "func TestUpdateSpecialSlideShapeInvalidStorage(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testdto, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"dto\", \"ShapeBase\").(IShapeBase)\n testpassword, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(teststorage, \"UpdateSpecialSlideShape\", \"storage\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n teststorage = nullValue\n } else {\n teststorage, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"UpdateSpecialSlideShape\", \"storage\", teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.UpdateSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testdto, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"UpdateSpecialSlideShape\", \"storage\", \"string\", teststorage, int32(statusCode), e)\n}", "title": "" }, { "docid": "50aeac24014e1005529f98571c56ae9c", "score": "0.5683735", "text": "func TestDownloadSpecialSlideShapeInvalidPassword(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testpassword, \"DownloadSpecialSlideShape\", \"password\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testpassword = nullValue\n } else {\n testpassword, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadSpecialSlideShape\", \"password\", testpassword)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadSpecialSlideShape\", \"password\", \"string\", testpassword, int32(statusCode), e)\n}", "title": "" }, { "docid": "113ee4b8d5d8844243e79b920916b3fe", "score": "0.5670328", "text": "func TestSaveSpecialSlideShapeInvalidPassword(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testpassword, \"SaveSpecialSlideShape\", \"password\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testpassword = nullValue\n } else {\n testpassword, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveSpecialSlideShape\", \"password\", testpassword)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveSpecialSlideShape\", \"password\", \"string\", testpassword, int32(statusCode), e)\n}", "title": "" }, { "docid": "846d95f32b0838f9af317a82e3263b43", "score": "0.5664035", "text": "func TestCreateWatermarkInvalidShape(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateWatermark\", \"name\", \"string\").(string)\n testshape, _ := createTestParamValue(\"CreateWatermark\", \"shape\", \"Shape\").(IShape)\n var testfontHeight *float64\n testfontHeightValue := createTestParamValue(\"CreateWatermark\", \"fontHeight\", \"float64\")\n if (testfontHeightValue != nil) {\n testfontHeight = new(float64)\n *testfontHeight, _ = testfontHeightValue.(float64)\n }\n testtext, _ := createTestParamValue(\"CreateWatermark\", \"text\", \"string\").(string)\n testfontName, _ := createTestParamValue(\"CreateWatermark\", \"fontName\", \"string\").(string)\n testfontColor, _ := createTestParamValue(\"CreateWatermark\", \"fontColor\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"CreateWatermark\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateWatermark\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateWatermark\", \"storage\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testshape, \"CreateWatermark\", \"shape\", \"Shape\")\n if (invalidValue == nil) {\n testshape = nil\n } else {\n testshape, _ = invalidValue.(IShape)\n }\n\n e := InitializeTest(\"CreateWatermark\", \"shape\", testshape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.CreateWatermark(testname, testshape, testfontHeight, testtext, testfontName, testfontColor, testpassword, testfolder, teststorage)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateWatermark\", \"shape\", \"Shape\", testshape, int32(statusCode), e)\n}", "title": "" }, { "docid": "c503827edb39093f644c015bd2f2c468", "score": "0.56562674", "text": "func TestCreateShape(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateShape\", \"slideIndex\", \"int32\").(int32)\n testdto, _ := createTestParamValue(\"CreateShape\", \"dto\", \"ShapeBase\").(IShapeBase)\n var testshapeToClone *int32\n testshapeToCloneValue := createTestParamValue(\"CreateShape\", \"shapeToClone\", \"int32\")\n if (testshapeToCloneValue != nil) {\n testshapeToClone = new(int32)\n *testshapeToClone, _ = testshapeToCloneValue.(int32)\n }\n var testposition *int32\n testpositionValue := createTestParamValue(\"CreateShape\", \"position\", \"int32\")\n if (testpositionValue != nil) {\n testposition = new(int32)\n *testposition, _ = testpositionValue.(int32)\n }\n testpassword, _ := createTestParamValue(\"CreateShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"CreateShape\", \"subShape\", \"string\").(string)\n e := InitializeTest(\"CreateShape\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.CreateShape(testname, testslideIndex, testdto, testshapeToClone, testposition, testpassword, testfolder, teststorage, testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "48cdebc3fbeb550aee52acf13b83d88e", "score": "0.5655941", "text": "func TestSaveShapeInvalidFolder(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testfolder, \"SaveShape\", \"folder\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testfolder = nullValue\n } else {\n testfolder, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveShape\", \"folder\", testfolder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShape(testname, testslideIndex, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShape\", \"folder\", \"string\", testfolder, int32(statusCode), e)\n}", "title": "" }, { "docid": "88110fe21d7c1f0da8ce690d232eb061", "score": "0.56248486", "text": "func TestSaveShapeOnlineInvalidScaleX(t *testing.T) {\n testdocument, _ := createTestParamValue(\"SaveShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShapeOnline\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShapeOnline\", \"outPath\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n testscaleX = new(float64)\n\n invalidValue := invalidizeTestParamValue(testscaleX, \"SaveShapeOnline\", \"scaleX\", \"float64\")\n if (invalidValue == nil) {\n var nullValue *float64\n testscaleX = nullValue\n } else {\n *testscaleX, _ = invalidValue.(float64)\n }\n\n e := InitializeTest(\"SaveShapeOnline\", \"scaleX\", testscaleX)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testoutPath, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShapeOnline\", \"scaleX\", \"float64\", testscaleX, int32(statusCode), e)\n}", "title": "" }, { "docid": "99a247f0ef9eecf3437346afac4ad32d", "score": "0.5615566", "text": "func TestDownloadShapeFromDtoInvalidFormat(t *testing.T) {\n testformat, _ := createTestParamValue(\"DownloadShapeFromDto\", \"format\", \"string\").(string)\n testdto, _ := createTestParamValue(\"DownloadShapeFromDto\", \"dto\", \"ShapeBase\").(IShapeBase)\n\n invalidValue := invalidizeTestParamValue(testformat, \"DownloadShapeFromDto\", \"format\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testformat = nullValue\n } else {\n testformat, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"DownloadShapeFromDto\", \"format\", testformat)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShapeFromDto(testformat, testdto)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShapeFromDto\", \"format\", \"string\", testformat, int32(statusCode), e)\n}", "title": "" }, { "docid": "cbf1432145eee81a78a5a5352c5425f8", "score": "0.5606766", "text": "func TestSaveSpecialSlideShapeInvalidScaleY(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveSpecialSlideShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveSpecialSlideShape\", \"subShape\", \"string\").(string)\n testscaleY = new(float64)\n\n invalidValue := invalidizeTestParamValue(testscaleY, \"SaveSpecialSlideShape\", \"scaleY\", \"float64\")\n if (invalidValue == nil) {\n var nullValue *float64\n testscaleY = nullValue\n } else {\n *testscaleY, _ = invalidValue.(float64)\n }\n\n e := InitializeTest(\"SaveSpecialSlideShape\", \"scaleY\", testscaleY)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveSpecialSlideShape\", \"scaleY\", \"float64\", testscaleY, int32(statusCode), e)\n}", "title": "" }, { "docid": "394c9ac7ebd3bb5b4d99488c857ebf15", "score": "0.559854", "text": "func TestSaveShapeInvalidOptions(t *testing.T) {\n testname, _ := createTestParamValue(\"SaveShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"SaveShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShape\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShape\", \"outPath\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"SaveShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"SaveShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testoptions, \"SaveShape\", \"options\", \"IShapeExportOptions\")\n if (invalidValue == nil) {\n testoptions = nil\n } else {\n testoptions, _ = invalidValue.(IIShapeExportOptions)\n }\n\n e := InitializeTest(\"SaveShape\", \"options\", testoptions)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShape(testname, testslideIndex, testshapeIndex, testformat, testoutPath, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShape\", \"options\", \"IShapeExportOptions\", testoptions, int32(statusCode), e)\n}", "title": "" }, { "docid": "26713f24565046e1e5b9928686b2b62f", "score": "0.55774933", "text": "func TestSaveShapeOnlineInvalidPassword(t *testing.T) {\n testdocument, _ := createTestParamValue(\"SaveShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShapeOnline\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShapeOnline\", \"outPath\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n\n invalidValue := invalidizeTestParamValue(testpassword, \"SaveShapeOnline\", \"password\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testpassword = nullValue\n } else {\n testpassword, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"SaveShapeOnline\", \"password\", testpassword)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testoutPath, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShapeOnline\", \"password\", \"string\", testpassword, int32(statusCode), e)\n}", "title": "" }, { "docid": "342370067ec1f1dfa30bb29cc3b1cc22", "score": "0.55753595", "text": "func TestCreateSpecialSlideParagraphInvalidSubShape(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateSpecialSlideParagraph\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateSpecialSlideParagraph\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"CreateSpecialSlideParagraph\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"CreateSpecialSlideParagraph\", \"shapeIndex\", \"int32\").(int32)\n testdto, _ := createTestParamValue(\"CreateSpecialSlideParagraph\", \"dto\", \"Paragraph\").(IParagraph)\n var testposition *int32\n testpositionValue := createTestParamValue(\"CreateSpecialSlideParagraph\", \"position\", \"int32\")\n if (testpositionValue != nil) {\n testposition = new(int32)\n *testposition, _ = testpositionValue.(int32)\n }\n testpassword, _ := createTestParamValue(\"CreateSpecialSlideParagraph\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateSpecialSlideParagraph\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateSpecialSlideParagraph\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"CreateSpecialSlideParagraph\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testsubShape, \"CreateSpecialSlideParagraph\", \"subShape\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testsubShape = nullValue\n } else {\n testsubShape, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"CreateSpecialSlideParagraph\", \"subShape\", testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateSpecialSlideParagraph(testname, testslideIndex, testslideType, testshapeIndex, testdto, testposition, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateSpecialSlideParagraph\", \"subShape\", \"string\", testsubShape, int32(statusCode), e)\n}", "title": "" }, { "docid": "f4e31d1c10bb0822ca026e064d9425b2", "score": "0.5569046", "text": "func TestDownloadShapeOnlineInvalidScaleY(t *testing.T) {\n testdocument, _ := createTestParamValue(\"DownloadShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShapeOnline\", \"format\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n testscaleY = new(float64)\n\n invalidValue := invalidizeTestParamValue(testscaleY, \"DownloadShapeOnline\", \"scaleY\", \"float64\")\n if (invalidValue == nil) {\n var nullValue *float64\n testscaleY = nullValue\n } else {\n *testscaleY, _ = invalidValue.(float64)\n }\n\n e := InitializeTest(\"DownloadShapeOnline\", \"scaleY\", testscaleY)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShapeOnline\", \"scaleY\", \"float64\", testscaleY, int32(statusCode), e)\n}", "title": "" }, { "docid": "25706c6d3c1acbab251acf0e40fe6b9d", "score": "0.55601776", "text": "func TestUpdateSpecialSlideShapeInvalidSubShape(t *testing.T) {\n testname, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testdto, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"dto\", \"ShapeBase\").(IShapeBase)\n testpassword, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"UpdateSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testsubShape, \"UpdateSpecialSlideShape\", \"subShape\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testsubShape = nullValue\n } else {\n testsubShape, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"UpdateSpecialSlideShape\", \"subShape\", testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.UpdateSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testdto, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"UpdateSpecialSlideShape\", \"subShape\", \"string\", testsubShape, int32(statusCode), e)\n}", "title": "" }, { "docid": "b4e07e9a30ca5d3c853d7bfd4c30b19f", "score": "0.55594534", "text": "func TestSaveShapeOnlineInvalidScaleY(t *testing.T) {\n testdocument, _ := createTestParamValue(\"SaveShapeOnline\", \"document\", \"[]byte\").([]byte)\n testslideIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"SaveShapeOnline\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"SaveShapeOnline\", \"format\", \"string\").(string)\n testoutPath, _ := createTestParamValue(\"SaveShapeOnline\", \"outPath\", \"string\").(string)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"SaveShapeOnline\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"SaveShapeOnline\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"SaveShapeOnline\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"SaveShapeOnline\", \"password\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"SaveShapeOnline\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"SaveShapeOnline\", \"fontsFolder\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"SaveShapeOnline\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n testscaleY = new(float64)\n\n invalidValue := invalidizeTestParamValue(testscaleY, \"SaveShapeOnline\", \"scaleY\", \"float64\")\n if (invalidValue == nil) {\n var nullValue *float64\n testscaleY = nullValue\n } else {\n *testscaleY, _ = invalidValue.(float64)\n }\n\n e := InitializeTest(\"SaveShapeOnline\", \"scaleY\", testscaleY)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, e := GetTestApiClient().SlidesApi.SaveShapeOnline(testdocument, testslideIndex, testshapeIndex, testformat, testoutPath, testscaleX, testscaleY, testbounds, testpassword, teststorage, testfontsFolder, testoptions)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"SaveShapeOnline\", \"scaleY\", \"float64\", testscaleY, int32(statusCode), e)\n}", "title": "" }, { "docid": "a5c31bd07df0f7103b677b77ebfa9053", "score": "0.55592316", "text": "func TestCreateSpecialSlideShapeInvalidFolder(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"slideType\", \"string\").(string)\n testdto, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"dto\", \"ShapeBase\").(IShapeBase)\n var testshapeToClone *int32\n testshapeToCloneValue := createTestParamValue(\"CreateSpecialSlideShape\", \"shapeToClone\", \"int32\")\n if (testshapeToCloneValue != nil) {\n testshapeToClone = new(int32)\n *testshapeToClone, _ = testshapeToCloneValue.(int32)\n }\n var testposition *int32\n testpositionValue := createTestParamValue(\"CreateSpecialSlideShape\", \"position\", \"int32\")\n if (testpositionValue != nil) {\n testposition = new(int32)\n *testposition, _ = testpositionValue.(int32)\n }\n testpassword, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testfolder, \"CreateSpecialSlideShape\", \"folder\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testfolder = nullValue\n } else {\n testfolder, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"CreateSpecialSlideShape\", \"folder\", testfolder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateSpecialSlideShape(testname, testslideIndex, testslideType, testdto, testshapeToClone, testposition, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateSpecialSlideShape\", \"folder\", \"string\", testfolder, int32(statusCode), e)\n}", "title": "" }, { "docid": "1485e220e8ce4a49e28f8f62d38963b7", "score": "0.55555475", "text": "func TestDownloadShapeInvalidScaleX(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"DownloadShape\", \"slideIndex\", \"int32\").(int32)\n testshapeIndex, _ := createTestParamValue(\"DownloadShape\", \"shapeIndex\", \"int32\").(int32)\n testformat, _ := createTestParamValue(\"DownloadShape\", \"format\", \"string\").(string)\n testoptions, _ := createTestParamValue(\"DownloadShape\", \"options\", \"IShapeExportOptions\").(IIShapeExportOptions)\n var testscaleX *float64\n testscaleXValue := createTestParamValue(\"DownloadShape\", \"scaleX\", \"float64\")\n if (testscaleXValue != nil) {\n testscaleX = new(float64)\n *testscaleX, _ = testscaleXValue.(float64)\n }\n var testscaleY *float64\n testscaleYValue := createTestParamValue(\"DownloadShape\", \"scaleY\", \"float64\")\n if (testscaleYValue != nil) {\n testscaleY = new(float64)\n *testscaleY, _ = testscaleYValue.(float64)\n }\n testbounds, _ := createTestParamValue(\"DownloadShape\", \"bounds\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadShape\", \"storage\", \"string\").(string)\n testfontsFolder, _ := createTestParamValue(\"DownloadShape\", \"fontsFolder\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"DownloadShape\", \"subShape\", \"string\").(string)\n testscaleX = new(float64)\n\n invalidValue := invalidizeTestParamValue(testscaleX, \"DownloadShape\", \"scaleX\", \"float64\")\n if (invalidValue == nil) {\n var nullValue *float64\n testscaleX = nullValue\n } else {\n *testscaleX, _ = invalidValue.(float64)\n }\n\n e := InitializeTest(\"DownloadShape\", \"scaleX\", testscaleX)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.DownloadShape(testname, testslideIndex, testshapeIndex, testformat, testoptions, testscaleX, testscaleY, testbounds, testpassword, testfolder, teststorage, testfontsFolder, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"DownloadShape\", \"scaleX\", \"float64\", testscaleX, int32(statusCode), e)\n}", "title": "" }, { "docid": "0a0a1bd2fda5d1cd89e0ae5896e3fa85", "score": "0.5554751", "text": "func TestCreateSpecialSlideShapeInvalidDto(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"slideType\", \"string\").(string)\n testdto, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"dto\", \"ShapeBase\").(IShapeBase)\n var testshapeToClone *int32\n testshapeToCloneValue := createTestParamValue(\"CreateSpecialSlideShape\", \"shapeToClone\", \"int32\")\n if (testshapeToCloneValue != nil) {\n testshapeToClone = new(int32)\n *testshapeToClone, _ = testshapeToCloneValue.(int32)\n }\n var testposition *int32\n testpositionValue := createTestParamValue(\"CreateSpecialSlideShape\", \"position\", \"int32\")\n if (testpositionValue != nil) {\n testposition = new(int32)\n *testposition, _ = testpositionValue.(int32)\n }\n testpassword, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testdto, \"CreateSpecialSlideShape\", \"dto\", \"ShapeBase\")\n if (invalidValue == nil) {\n testdto = nil\n } else {\n testdto, _ = invalidValue.(IShapeBase)\n }\n\n e := InitializeTest(\"CreateSpecialSlideShape\", \"dto\", testdto)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateSpecialSlideShape(testname, testslideIndex, testslideType, testdto, testshapeToClone, testposition, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateSpecialSlideShape\", \"dto\", \"ShapeBase\", testdto, int32(statusCode), e)\n}", "title": "" }, { "docid": "d038b904f6cebd611c2a7eec05544b3b", "score": "0.5549777", "text": "func TestGetSpecialSlideParagraphInvalidSubShape(t *testing.T) {\n testname, _ := createTestParamValue(\"GetSpecialSlideParagraph\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"GetSpecialSlideParagraph\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"GetSpecialSlideParagraph\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"GetSpecialSlideParagraph\", \"shapeIndex\", \"int32\").(int32)\n testparagraphIndex, _ := createTestParamValue(\"GetSpecialSlideParagraph\", \"paragraphIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"GetSpecialSlideParagraph\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"GetSpecialSlideParagraph\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"GetSpecialSlideParagraph\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"GetSpecialSlideParagraph\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testsubShape, \"GetSpecialSlideParagraph\", \"subShape\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testsubShape = nullValue\n } else {\n testsubShape, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"GetSpecialSlideParagraph\", \"subShape\", testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.GetSpecialSlideParagraph(testname, testslideIndex, testslideType, testshapeIndex, testparagraphIndex, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"GetSpecialSlideParagraph\", \"subShape\", \"string\", testsubShape, int32(statusCode), e)\n}", "title": "" }, { "docid": "307db4de22f8db761c76127c17ba2b1b", "score": "0.5531432", "text": "func TestCreateSpecialSlideShapeInvalidShapeToClone(t *testing.T) {\n testname, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"slideType\", \"string\").(string)\n testdto, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"dto\", \"ShapeBase\").(IShapeBase)\n var testshapeToClone *int32\n testshapeToCloneValue := createTestParamValue(\"CreateSpecialSlideShape\", \"shapeToClone\", \"int32\")\n if (testshapeToCloneValue != nil) {\n testshapeToClone = new(int32)\n *testshapeToClone, _ = testshapeToCloneValue.(int32)\n }\n var testposition *int32\n testpositionValue := createTestParamValue(\"CreateSpecialSlideShape\", \"position\", \"int32\")\n if (testpositionValue != nil) {\n testposition = new(int32)\n *testposition, _ = testpositionValue.(int32)\n }\n testpassword, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"CreateSpecialSlideShape\", \"subShape\", \"string\").(string)\n testshapeToClone = new(int32)\n\n invalidValue := invalidizeTestParamValue(testshapeToClone, \"CreateSpecialSlideShape\", \"shapeToClone\", \"int32\")\n if (invalidValue == nil) {\n var nullValue *int32\n testshapeToClone = nullValue\n } else {\n *testshapeToClone, _ = invalidValue.(int32)\n }\n\n e := InitializeTest(\"CreateSpecialSlideShape\", \"shapeToClone\", testshapeToClone)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.CreateSpecialSlideShape(testname, testslideIndex, testslideType, testdto, testshapeToClone, testposition, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"CreateSpecialSlideShape\", \"shapeToClone\", \"int32\", testshapeToClone, int32(statusCode), e)\n}", "title": "" }, { "docid": "5b1cfba9e7a5f7741208e1d2e7ebed92", "score": "0.5526469", "text": "func TestGetSpecialSlideShapeInvalidSubShape(t *testing.T) {\n testname, _ := createTestParamValue(\"GetSpecialSlideShape\", \"name\", \"string\").(string)\n testslideIndex, _ := createTestParamValue(\"GetSpecialSlideShape\", \"slideIndex\", \"int32\").(int32)\n testslideType, _ := createTestParamValue(\"GetSpecialSlideShape\", \"slideType\", \"string\").(string)\n testshapeIndex, _ := createTestParamValue(\"GetSpecialSlideShape\", \"shapeIndex\", \"int32\").(int32)\n testpassword, _ := createTestParamValue(\"GetSpecialSlideShape\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"GetSpecialSlideShape\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"GetSpecialSlideShape\", \"storage\", \"string\").(string)\n testsubShape, _ := createTestParamValue(\"GetSpecialSlideShape\", \"subShape\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testsubShape, \"GetSpecialSlideShape\", \"subShape\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testsubShape = nullValue\n } else {\n testsubShape, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"GetSpecialSlideShape\", \"subShape\", testsubShape)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.GetSpecialSlideShape(testname, testslideIndex, testslideType, testshapeIndex, testpassword, testfolder, teststorage, testsubShape)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"GetSpecialSlideShape\", \"subShape\", \"string\", testsubShape, int32(statusCode), e)\n}", "title": "" } ]
d4d708f2785e7381380bf6786f815ccf
Readable return the number of bytes that can be read.
[ { "docid": "87fb92f9ee0368b69807d0beaf5bdcd8", "score": "0.7341591", "text": "func (b *ByteBuf) Readable() int {\r\n\treturn b.writerIndex - b.readerIndex\r\n}", "title": "" } ]
[ { "docid": "ddbbc0d095db8e6eef125bfbf185d538", "score": "0.66475254", "text": "func (r Reader) Len() int {\n\treturn r.reader.Len()\n}", "title": "" }, { "docid": "aef63b8f0e0e5c8c1d0f9dd66a574614", "score": "0.6599707", "text": "func (q *queue) readableSize(ctx context.Context, io usermem.IO, args arch.SyscallArguments) error {\n\tvar size int32\n\tif q.readable {\n\t\tsize = int32(q.readBuf.Len())\n\t}\n\n\t_, err := usermem.CopyObjectOut(ctx, io, args[2].Pointer(), size, usermem.IOOpts{\n\t\tAddressSpaceActive: true,\n\t})\n\treturn err\n\n}", "title": "" }, { "docid": "052e2d242a3dc90050c0c36942e38510", "score": "0.6537964", "text": "func (b *buffer) ReadSize() int {\n\treturn b.write - b.read\n}", "title": "" }, { "docid": "3c47fd1666b987a6ed1aca8b9f2ac3e8", "score": "0.6521665", "text": "func (reader BinaryBufferReader) Len() int {\n\treturn reader.Len()\n}", "title": "" }, { "docid": "e4af177f5e1579b7e5cfbfb72ea83864", "score": "0.65093243", "text": "func (l *LimitedStrictReadCloser) Read(p []byte) (n int, err error) {\n\tif l.Err != nil {\n\t\treturn 0, l.Err\n\t}\n\n\tif len(p) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif int64(len(p)) > l.N+1 {\n\t\tp = p[:l.N+1]\n\t}\n\n\tn, err = l.R.Read(p)\n\n\tif int64(n) <= l.N {\n\t\tl.N -= int64(n)\n\t\tl.Err = err\n\t\treturn n, err\n\t}\n\n\tn = int(l.N)\n\tl.N = 0\n\n\tl.Err = errors.New(\"input stream too large\")\n\treturn n, l.Err\n}", "title": "" }, { "docid": "7fe137116339fe82892b91c874daefb2", "score": "0.6404759", "text": "func (r *Reader) NumRead() int64 {\n\treturn r.num\n}", "title": "" }, { "docid": "875b798f99681678ec64c7571a12a43b", "score": "0.63976467", "text": "func (r *Reader) Size() (int64, bool) {\n\treturn r.s.b.Size()\n}", "title": "" }, { "docid": "38a566f94063a952cc7e7070722f4dd0", "score": "0.6377028", "text": "func (r *ReadSeeker) BytesRead() int {\n\treturn r.r.position\n}", "title": "" }, { "docid": "1dadba0c6460d89714678086fbfdf3a1", "score": "0.6328434", "text": "func (h *Hessian) len() (l int) {\n\th.peek(1) // read the resources in order to get the length of buffer\n\tl = h.reader.Buffered()\n\treturn\n}", "title": "" }, { "docid": "6f0fff97e60d93433d3d371240cb831b", "score": "0.6295877", "text": "func (l *LimitedReadCloser) Read(ctx context.Context, p []byte) (int, error) {\n\tvar n int\n\tvar err error\n\n\tif l.N <= 0 {\n\t\treturn 0, io.EOF\n\t}\n\tif int64(len(p)) > l.N {\n\t\tp = p[0:l.N]\n\t}\n\tn, err = l.R.Read(ctx, p)\n\tl.N -= int64(n)\n\treturn n, err\n}", "title": "" }, { "docid": "85a346a95e107dbda908e78236fc4cb9", "score": "0.62639743", "text": "func (r *Readable) Read(out []byte) (n int, e error) {\n\tr.mutex.Lock()\n\tif r.nextError != nil {\n\t\te = r.nextError\n\t\tr.nextError = nil\n\t\tr.mutex.Unlock()\n\t\treturn\n\t}\n\tlen := r.buffer.Len()\n\tif len == 0 {\n\t\tr.mutex.Unlock()\n\t\t<-r.available\n\t\tr.mutex.Lock()\n\t\tif r.nextError != nil {\n\t\t\te = r.nextError\n\t\t\tr.nextError = nil\n\t\t\tr.mutex.Unlock()\n\t\t\tif len == 0 {\n\t\t\t\tr.consumed <- struct{}{}\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\tn, e = r.buffer.Read(out)\n\tr.mutex.Unlock()\n\tif len == 0 {\n\t\t// len == 0 means that we got a signal from available.\n\t\t// Which means that signalWrite() is now waiting\n\t\t// for a signal on consumed.\n\t\tr.consumed <- struct{}{}\n\t}\n\tif e == io.EOF {\n\t\te = nil\n\t}\n\treturn\n}", "title": "" }, { "docid": "3872b374740eae264acc482c97be142e", "score": "0.6247239", "text": "func (errReader) Read([]byte) (int, error) { return 0, errEAGAIN }", "title": "" }, { "docid": "9dc31951f02348bbb8360e777e7562fc", "score": "0.61667156", "text": "func (r *Reader) Buffered() int { return len(r.data) - r.n }", "title": "" }, { "docid": "1b8ceeee6e2def1c628d0ba9489f7e91", "score": "0.6134948", "text": "func (w *Writer) AvailableSize() int { return len(w.buf) - w.n }", "title": "" }, { "docid": "f952bd3ddef98a2b26e214664920ee19", "score": "0.61303467", "text": "func (r *Reader) BufferSize() int { return cap(r.data) }", "title": "" }, { "docid": "4d89f2d4b8744b575977c645a1e0d170", "score": "0.61272264", "text": "func (r *Reader) Read(p []byte) (n int, err error) {\n\tn, err = io.ReadFull(r.reader, p)\n\tr.n += uint64(n)\n\treturn n, err\n}", "title": "" }, { "docid": "f527bf1411a18ee7829a61a4824e8e5e", "score": "0.61018056", "text": "func (m *Reader) BufferSize() int { return m.R.BufferSize() }", "title": "" }, { "docid": "81403ed73c8a85eb5fdea44155145ff0", "score": "0.60863835", "text": "func (self *BitReader) Len() (int, byte) {\n\treturn self.reader.Len(), self.count\n}", "title": "" }, { "docid": "b8621e28b93dad80cd785d04282ff19a", "score": "0.60830307", "text": "func Read(b []byte) (n int, err error) {}", "title": "" }, { "docid": "edb1d9058357b393c70c0a29766d323c", "score": "0.6081858", "text": "func (m *Reader) Buffered() int { return m.R.Buffered() }", "title": "" }, { "docid": "7067b6b82fe2a348f6cb40e5de1105c9", "score": "0.6058646", "text": "func Read(b []byte) (n int, err error) {\n\tr := reader{}\n\treturn r.Read(b)\n}", "title": "" }, { "docid": "9e0269cb710fc633ffb83f15a8a46f5e", "score": "0.60542357", "text": "func (w *Writer) Available() int { return len(w.buf) - w.off }", "title": "" }, { "docid": "5481d9b7a0aac4bdd9606cdbe434a293", "score": "0.60537237", "text": "func (b *Buffer) Len() int {\n\tb.Lock()\n\tdefer b.Unlock()\n\n\treturn b.length()\n}", "title": "" }, { "docid": "ff9f288953af1239c6e5573a40797635", "score": "0.6036254", "text": "func (b *BufferedPipe) Len() int {\n\tb.Lock()\n\tdefer b.Unlock()\n\n\treturn b.buffer.Len()\n}", "title": "" }, { "docid": "904eaf1e189d9527c4bc9fd9e31ed8c4", "score": "0.6027287", "text": "func (r *reader) Read(p []byte) (int, error) {\n\tn, err := r.r.Read(p)\n\tif uint64(n) > r.n {\n\t\treturn 0, fmt.Errorf(\"reading more than expected\")\n\t}\n\tr.n -= uint64(n)\n\treturn n, err\n}", "title": "" }, { "docid": "c7573f89629bff8e4098621c5cb5fd89", "score": "0.6003786", "text": "func (cr *CountingReader) Read(p []byte) (int, error) {\n\tn, err := cr.RS.Read(p)\n\t*cr.N += int64(n)\n\treturn n, err\n}", "title": "" }, { "docid": "07cf8aef26b572738e44c1304f8ebe9a", "score": "0.6000333", "text": "func Read(readable io.Reader) ([]byte, error) {\n\tvar buffer []byte\n\tvar n int\n\tvar err error\n\treceived := make([]byte, 0)\n\n\tfor {\n\t\tbuffer = make([]byte, 512)\n\t\tn, err = readable.Read(buffer[:])\n\t\tif n > 0 {\n\t\t\treceived = append(received, buffer[:n]...)\n\t\t}\n\t\tif n == 0 || n < len(buffer) {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tif netErr, ok := err.(net.Error); ok && netErr.Timeout() {\n\t\t\t\terr = NewTimeoutError(read, len(received))\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn received, err\n}", "title": "" }, { "docid": "35cb90e6ce0fccd2dc5a695d05640947", "score": "0.59944195", "text": "func (sr *SecureReader) readLength() (length uint64) {\n\tif sr.err != nil {\n\t\treturn\n\t}\n\tsr.err = binary.Read(sr.r, binary.LittleEndian, &length)\n\treturn\n}", "title": "" }, { "docid": "ec0c918a0a77d51ebe87425a08ae8e10", "score": "0.599009", "text": "func (r *ReaderAt) Len() int {\n\treturn len(r.data)\n}", "title": "" }, { "docid": "d9a933a61e8d273d5a303f36a19bbcbc", "score": "0.5971706", "text": "func (l *LimitedReadCloser) Read(p []byte) (int, error) {\n\treturn l.Reader.Read(p)\n}", "title": "" }, { "docid": "432db9f2397bbcc953efca7d8a9266b6", "score": "0.59683275", "text": "func (rc *ReadCacheItem) Size() int {\n\treturn rc.Data.Len()\n}", "title": "" }, { "docid": "300d7ba02e8e8b87ec6ecb2c02413069", "score": "0.5961499", "text": "func (l *LimitedStrictReader) Read(p []byte) (n int, err error) {\n\tif l.N <= 0 {\n\t\treturn 0, errors.New(\"input stream too large\")\n\t}\n\tif int64(len(p)) > l.N {\n\t\tp = p[0:l.N]\n\t}\n\tn, err = l.R.Read(p)\n\tl.N -= int64(n)\n\treturn\n}", "title": "" }, { "docid": "179649bb5dc616ef2e4ea471137d2de2", "score": "0.5953043", "text": "func (readWriter localFileReadWriter) Read(p []byte) (int, error) {\n\tif readWriter.readPartSize == 0 {\n\t\treturn readWriter.descriptor.Read(p)\n\t}\n\n\ttotalBytesRead := 0\n\tfor totalBytesRead < len(p) {\n\t\tblockSize := readWriter.readPartSize\n\t\tif remaining := len(p) - totalBytesRead; remaining < blockSize {\n\t\t\tblockSize = remaining\n\t\t}\n\t\tn, err := readWriter.descriptor.Read(p[totalBytesRead : totalBytesRead+blockSize])\n\t\ttotalBytesRead += n\n\t\tif err != nil {\n\t\t\treturn totalBytesRead, err\n\t\t}\n\t}\n\treturn totalBytesRead, nil\n}", "title": "" }, { "docid": "96cf5cf168ef4e18a3a5dfe017f77440", "score": "0.5950746", "text": "func (r *ReaderWithSize) Read(p []byte) (n int, err error) {\n\tn, err = r.Reader.Read(p)\n\tr.Size += uint64(n)\n\treturn n, err\n}", "title": "" }, { "docid": "96bde9819df96a754d8382103606ff24", "score": "0.59388083", "text": "func (r *ReadSeeker) Size() int64 {\n\tinitialPos, err := r.CurPos()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer r.MoveTo(initialPos)\n\tn, err := r.readSeeker.Seek(0, io.SeekEnd)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn n\n}", "title": "" }, { "docid": "5f3aadf731d687c17b7d8a3d2a888035", "score": "0.5923317", "text": "func (sr *SliceReader) Size() int64 {\n\treturn int64(len(sr.s))\n}", "title": "" }, { "docid": "1ce3b7630aa00fef2403ae171e5b2119", "score": "0.59137857", "text": "func Read(b []byte) (int, error) {\n\treturn io.ReadFull(Reader, b)\n}", "title": "" }, { "docid": "ab6ff426534497f11fec1f976a6f134f", "score": "0.5886794", "text": "func (r *Resource) Size() uint64 {\n\treturn r.Length\n}", "title": "" }, { "docid": "74133bb7900dd6b79a0fd8f7d85b528c", "score": "0.5869438", "text": "func (b *BlobIO) Len() int {\n\treturn b.len\n}", "title": "" }, { "docid": "a01e448951433d60dacd637742c00334", "score": "0.58501595", "text": "func (c *Conn) BytesReceived() uint64 {\n\treturn c.bc.Reader.Count()\n}", "title": "" }, { "docid": "8ce3359454344668c11682f6c71fdd64", "score": "0.58488894", "text": "func (b *RingBuf) ReadAvail() int {\n\treturn int(atomic.LoadUint64(&b.bits) & uint64(low31bits))\n}", "title": "" }, { "docid": "1d5a38ef17b98ddb8f28a5507dc21e71", "score": "0.583316", "text": "func (rb *Buffer) Len() int {\n\treturn len(rb.buf)\n}", "title": "" }, { "docid": "0ded3480c88bf0ed7ae526077cf944ed", "score": "0.58315337", "text": "func (e *ErrorReadSeeker) Read(b []byte) (n int, err error) {\n\tif e.current >= e.Skip {\n\t\treturn 0, errors.New(\"broken reader\")\n\t}\n\te.current++\n\treturn len(b), nil\n}", "title": "" }, { "docid": "c141fa8e18290aa180da2c87805442d3", "score": "0.5825558", "text": "func (readWriter localFileReadWriter) Size() int64 {\n\t// Use file entry instead of descriptor, because descriptor could have been closed.\n\tfileInfo, err := readWriter.entry.GetStat()\n\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn fileInfo.Size()\n}", "title": "" }, { "docid": "961dde2ebfb93d9d2a6879ce0109c931", "score": "0.5819173", "text": "func (s *StoreMode) IsReadable() bool {\n\treturn s.Read\n}", "title": "" }, { "docid": "2f1e89a1cc0dbce107e9db63a5e8c56a", "score": "0.58179617", "text": "func (r ReaderSeekerCloser) Read(p []byte) (int, error) {\n\tswitch t := r.r.(type) {\n\tcase io.Reader:\n\t\treturn t.Read(p)\n\t}\n\treturn 0, nil\n}", "title": "" }, { "docid": "9092702b2d90379e04726c733d03f739", "score": "0.5798592", "text": "func (e *ErrorReadSeekerAt) Read(b []byte) (n int, err error) {\n\tif e.current >= e.Skip {\n\t\treturn 0, errors.New(\"broken reader\")\n\t}\n\te.current++\n\treturn len(b), nil\n}", "title": "" }, { "docid": "41b9c3874bc744bd51c878fbad830c80", "score": "0.5794854", "text": "func (b *ByteBuf) Writeable() int {\r\n\treturn b.capacity() - b.writerIndex\r\n}", "title": "" }, { "docid": "5ead651853011c2495caf810f871b387", "score": "0.5791007", "text": "func (r *passThruReader) Read(p []byte) (int, error) {\n\tn, err := r.Reader.Read(p)\n\n\tif n > 0 {\n\t\tr.bar.Add(n)\n\t}\n\n\treturn n, err\n}", "title": "" }, { "docid": "96d3561bf9a7e9a51c8fbbce0e35f4ed", "score": "0.5789687", "text": "func (r *RingBuffer) Len() int {\n\treturn r.length\n}", "title": "" }, { "docid": "7f8661dcff4cf6058697eb1ed3361238", "score": "0.5778072", "text": "func (r *RingBuffer) Len() int {\n\treturn len(r.buf)\n}", "title": "" }, { "docid": "5ceb580b4a344c531da197d21712cedd", "score": "0.57767504", "text": "func (w *ByteWriter) Len() int {\n\treturn len(w.buf)\n}", "title": "" }, { "docid": "439c08a8ad8595b00ea2cd7118ae00ea", "score": "0.57687056", "text": "func (b *LineWriter) Available() int { return len(b.buf) - b.n }", "title": "" }, { "docid": "3c764f441312b3312cb59ef1a28c96fe", "score": "0.576208", "text": "func (nopReadWriteCloser) Read(p []byte) (n int, err error) { return 0, io.EOF }", "title": "" }, { "docid": "dfbfd9726db3e7cecfe54200c7f14a79", "score": "0.5761639", "text": "func ReaderSize(b *bufio.Reader,) int", "title": "" }, { "docid": "f9f3b0888501bee35cf728da4c45bc8a", "score": "0.5761403", "text": "func (mr *MultipartReader) Read(p []byte) (n int, err error) {\n\tn, err = mr.multiReader.Read(p)\n\tatomic.AddInt64(&mr.count, int64(n))\n\treturn n, err\n}", "title": "" }, { "docid": "2ed6c7baa061f046c05cec1d441117e3", "score": "0.57570004", "text": "func Read(p []byte) (n int, err error) {\n\tif len(p) > 0 {\n\t\t_wyread(Uint32(), p)\n\t}\n\treturn len(p), nil\n}", "title": "" }, { "docid": "a73cbbd671ebdb294bf9bca66bc33047", "score": "0.57500786", "text": "func (r *RingBuffer) Len() int {\n\treturn r.size\n}", "title": "" }, { "docid": "06da1199473416adf28fd48993754f25", "score": "0.57467407", "text": "func (b *BitmapReader) Len() int64 { return b.len }", "title": "" }, { "docid": "038aaf0eaee624662a803c70bace7d39", "score": "0.57439953", "text": "func (cw *ConnWrapper) Read(b []byte) (n int, err error) {\n\tn, err = cw.r.Read(b)\n\treturn n, err\n}", "title": "" }, { "docid": "5d2d3d8260f375cd491070960df36039", "score": "0.5734577", "text": "func (b *reader) Read(p []byte) (int, error) {\n\tsize, err := b.reader.Read(p)\n\tb.readBytes = b.readBytes + int64(size)\n\tif err == io.EOF {\n\t\t// check/save size\n\t\tif b.cl == 0 {\n\t\t\tb.cl = b.readBytes\n\t\t} else if b.readBytes != b.cl {\n\t\t\terr = fmt.Errorf(\"Expected size mismatch [expected %d, received %d]: %w\", b.cl, b.readBytes, err)\n\t\t}\n\t\t// check/save digest\n\t\tif b.digest == \"\" {\n\t\t\tb.digest = b.digester.Digest()\n\t\t} else if b.digest != b.digester.Digest() {\n\t\t\terr = fmt.Errorf(\"Expected digest mismatch [expected %s, calculated %s]: %w\", b.digest.String(), b.digester.Digest().String(), err)\n\t\t}\n\t}\n\treturn size, err\n}", "title": "" }, { "docid": "cfe2dec1d38fe1369c53fce3c7af3985", "score": "0.5723938", "text": "func (r *ProgressReader) Read(p []byte) (n int, err error) {\n\tn, err = r.src.Read(p)\n\tatomic.AddInt64(&r.bytesCopied, int64(n))\n\treturn\n}", "title": "" }, { "docid": "42bd2a3731c7a9dcf00f8a0694b9512b", "score": "0.57220024", "text": "func (self *BitReader) BitLen() uint {\n\treturn (uint(self.reader.Len()) * 8) + uint(self.count)\n}", "title": "" }, { "docid": "9742e77a361e0e6b7da49faeb3676d00", "score": "0.5719852", "text": "func (n Noop) Read([]byte) (int, error) { return 0, nil }", "title": "" }, { "docid": "358db6352b9ae9b9d892610ef91f0594", "score": "0.5709615", "text": "func (sr *SliceReader) Len() int {\n\treturn int(sr.Size() - int64(sr.i))\n}", "title": "" }, { "docid": "4c1ccde53ae34cee2622dac4639aa437", "score": "0.57066536", "text": "func (r *Reader) Read(p []byte) (n int, err error) {\n\treturn copy(p, r.Bytes), nil\n}", "title": "" }, { "docid": "4e7e180b3c1c76f16361d7584c120cf5", "score": "0.5702296", "text": "func (r *LimitedReader) Read(p []byte) (n int, err error) {\n\tif r.src == nil {\n\t\treturn 0, errors.New(\"no data source\")\n\t}\n\tif r.limit > 0 && r.n >= r.limit {\n\t\treturn 0, io.EOF\n\t}\n\tn, err = r.src.Read(p)\n\tif err != nil {\n\t\treturn n, err\n\t}\n\tr.n += n\n\treturn\n}", "title": "" }, { "docid": "10b2ebeb83e4377539303988943e3847", "score": "0.57022035", "text": "func (r *BufferedPipeReader) Capacity() int {\n\treturn r.bp.capacity()\n}", "title": "" }, { "docid": "cb3c24b23fa4c636df24341ef0cf66b7", "score": "0.56941646", "text": "func (s *SecureConnection) Read(p []byte) (n int, err error) {\n\treturn s.reader.Read(p)\n}", "title": "" }, { "docid": "332793fccd7c6512d2d2d0a03d006b24", "score": "0.5681323", "text": "func (r *readCount) Read(p []byte) (n int, err error) {\n\tn, err = r.reader.Read(p)\n\tr.setValues(int64(n))\n\treturn\n}", "title": "" }, { "docid": "60e11eb67b7e91914d6f75ce70efd2a4", "score": "0.567867", "text": "func (a alwaysFailReadCloser) Read([]byte) (int, error) { return 0, a.err }", "title": "" }, { "docid": "b4d27f5779a3915c25e6733756eb5a7e", "score": "0.56771946", "text": "func (b *Reader) Buffered() int { return b.w - b.r }", "title": "" }, { "docid": "97838bde9599cd69bc162b9fd2aa65d8", "score": "0.5676429", "text": "func (bp *bufferedPipe) buffered() int {\n\tbp.lock.Lock()\n\tdefer bp.lock.Unlock()\n\n\treturn bp.sz\n}", "title": "" }, { "docid": "745591cf6b5e4d0bfa98e488a2e23cc0", "score": "0.56635946", "text": "func (s *Shard) Len() int {\n\treturn int(atomic.LoadInt32(&s.length))\n}", "title": "" }, { "docid": "41a22e7184ad25c486ee292ee18c46ac", "score": "0.56444675", "text": "func (r *reader) Read(n int) (b []byte, err error) {\n\tif bn := r.buffered(); bn < n {\n\t\tif err = r.readmore(n - bn); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\tb = r.bytes()[:n:n]\n\tr.r += n\n\treturn\n}", "title": "" }, { "docid": "d4dfc72195996c0c50e44500eaeff0a3", "score": "0.56431955", "text": "func (c *Conn) Read(buffer []byte) (int, error) {\n\tif err := c.Handshake(); err != nil {\n\t\treturn 0, err\n\t}\n\n\t// Lock the input channel\n\tc.in.Lock()\n\tdefer c.in.Unlock()\n\n\tn := len(buffer)\n\terr := c.extendBuffer(n)\n\tvar read int\n\tif len(c.readBuffer) < n {\n\t\tbuffer = buffer[:len(c.readBuffer)]\n\t\tcopy(buffer, c.readBuffer)\n\t\tread = len(c.readBuffer)\n\t\tc.readBuffer = c.readBuffer[:0]\n\t} else {\n\t\tlogf(logTypeIO, \"read buffer larger than than input buffer\")\n\t\tcopy(buffer[:n], c.readBuffer[:n])\n\t\tc.readBuffer = c.readBuffer[n:]\n\t\tread = n\n\t}\n\n\treturn read, err\n}", "title": "" }, { "docid": "99938db7e374523caaa29c225b98a496", "score": "0.56390023", "text": "func (i *Buffer) Len() int {\n\treturn len(*i)\n}", "title": "" }, { "docid": "41ffcb7901a5cd916b169debde5604d9", "score": "0.5634584", "text": "func (r *ReadResponse) Len() int {\n\tlength := 0\n\n\tif r.TypeID != nil {\n\t\tlength += r.TypeID.Len()\n\t}\n\n\tif r.ResponseHeader != nil {\n\t\tlength += r.ResponseHeader.Len()\n\t}\n\n\tif r.Results != nil {\n\t\tlength += r.Results.Len()\n\t}\n\n\tif r.DiagnosticInfos != nil {\n\t\tlength += r.DiagnosticInfos.Len()\n\t}\n\n\treturn length\n}", "title": "" }, { "docid": "8492e45a6d1cbc7a269105e82d876b76", "score": "0.56315434", "text": "func (i *Inbox) GetBytesRead() int64 {\n\treturn atomic.LoadInt64(&i.statsAtomics.bytesRead)\n}", "title": "" }, { "docid": "2ebddcdb4fdf7d98645f3d92c1fc4859", "score": "0.5631432", "text": "func (w *Writer) Len() int {\n\treturn len(w.buf)\n}", "title": "" }, { "docid": "8c526064c76ed6020427557fdd29bb8c", "score": "0.56286144", "text": "func (file *ObjectOpenFile) Length() (int64, error) {\n\tif !file.lengthOk {\n\t\tinfo, _, err := file.connection.Object(file.container, file.objectName)\n\t\tfile.length = info.Bytes\n\t\tfile.lengthOk = (err == nil)\n\t\treturn file.length, err\n\t}\n\treturn file.length, nil\n}", "title": "" }, { "docid": "70812118f9d762bd0d0e154c924a4b10", "score": "0.56269574", "text": "func (r *ReadCloser) Read(p []byte) (n int, err error) {\n\treturn r.r.Read(p)\n}", "title": "" }, { "docid": "0d10007bbae8c3fa694510aadd4eb391", "score": "0.56268334", "text": "func (r *Response) Size() int64 {\n\treturn r.written\n}", "title": "" }, { "docid": "37d420cc167470d88c8f4d7141d456ba", "score": "0.5625079", "text": "func (p Bytes) Len() int {\n\treturn len(p.buf)\n}", "title": "" }, { "docid": "5a7316581aa2a527f4ab807cae483d8f", "score": "0.5620671", "text": "func (c *client) Read(b []byte) (n int, err error) {\n\treturn c.r.Read(b)\n}", "title": "" }, { "docid": "52a55a54c3622fc8d4d10aca87e0d96c", "score": "0.5609935", "text": "func (pt *passThru) Read(p []byte) (int, error) {\n\tn, err := pt.Reader.Read(p)\n\tatomic.AddInt64(&pt.progress, int64(n))\n\treturn n, err\n}", "title": "" }, { "docid": "e190e7364e140c1d926bdbbe96474713", "score": "0.5606434", "text": "func (r *ReadCounter) Read(p []byte) (int, error) {\n\tn, err := r.r.Read(p)\n\tr.n += int64(n)\n\treturn n, err\n}", "title": "" }, { "docid": "9910e067e0ec49751cac5392af8cdabb", "score": "0.56057686", "text": "func (buf *Buffer) Size() int64 { return buf.runes.Size() }", "title": "" }, { "docid": "8220c502c95921bfd500e8306679d07f", "score": "0.56006205", "text": "func (b *ByteBuf) Read(dst []byte) (int, error) {\r\n\tif len(dst) == 0 {\r\n\t\treturn 0, nil\r\n\t}\r\n\tn := b.Readable()\r\n\tif n == 0 {\r\n\t\treturn 0, io.EOF\r\n\t}\r\n\tif n > len(dst) {\r\n\t\tn = len(dst)\r\n\t}\r\n\tcopy(dst, b.buf[b.readerIndex:b.readerIndex+n])\r\n\tb.readerIndex += n\r\n\treturn n, nil\r\n}", "title": "" }, { "docid": "d7753da97e0fb5138ad7c521e2a82626", "score": "0.56003857", "text": "func (d *Descriptor) Read(dest io.Writer, n int64) (int64, error) {\n\tn, err := io.CopyN(dest, d.reader, n)\n\treturn n, err\n}", "title": "" }, { "docid": "8af3e5bc5b52b04626847cb65c939cbf", "score": "0.5599707", "text": "func (r *WriteFile) Size() int64 {\n\treturn int64(r.buf.Len())\n}", "title": "" }, { "docid": "01134305519badfe3e6a89b4bd9c9570", "score": "0.55966324", "text": "func (r *BufferedPipeReader) Read(data []byte, least int) (n int, err error) {\n\treturn r.bp.read(data, least)\n}", "title": "" }, { "docid": "099a84c2dea09e115c5785e1211f0088", "score": "0.5596438", "text": "func (r *safeReadCloser) Read(p []byte) (n int, err error) {\n\tr.mtx.Lock()\n\tdefer r.mtx.Unlock()\n\tif r.closed {\n\t\treturn 0, io.EOF\n\t}\n\n\treturn r.readCloser.Read(p)\n}", "title": "" }, { "docid": "162b8f11c713cc4f9e950427efceb7b8", "score": "0.5593968", "text": "func (bp *bufferedPipe) read(b []byte, blockSize int) (int, error) {\n\tif blockSize > bp.cp {\n\t\treturn 0, ErrTooLargeDemand\n\t}\n\n\tbp.lock.Lock()\n\tdefer bp.lock.Unlock()\n\n\tfor {\n\t\tif bp.rerr != nil {\n\t\t\treturn 0, bp.rerr\n\t\t}\n\n\t\tif bp.sz >= blockSize {\n\t\t\tbreak\n\t\t}\n\n\t\tif bp.werr != nil {\n\t\t\treturn 0, bp.werr\n\t\t}\n\n\t\tbp.canRead.Wait()\n\t}\n\n\tn := copy(b, bp.data[:bp.sz])\n\tbp.sz -= n\n\tcopy(bp.data[:bp.sz], bp.data[n:n+bp.sz])\n\n\tif bp.sz < bp.cp {\n\t\tbp.canWrite.Signal()\n\t}\n\n\treturn n, nil\n}", "title": "" }, { "docid": "d517a9a7a6590976b4a41477c062fba4", "score": "0.558677", "text": "func (dh *DockerHost) Length() int {\n\tdh.RLock()\n\tdefer dh.RUnlock()\n\n\treturn cap(dh.cStats)\n}", "title": "" }, { "docid": "4e20d85fd9dde20b10236b3431b8b54a", "score": "0.55845386", "text": "func (rb *Buffer) Available() int {\n\tif rb.r == rb.w {\n\t\tif rb.isEmpty {\n\t\t\treturn rb.size\n\t\t}\n\t\treturn 0\n\t}\n\n\tif rb.w < rb.r {\n\t\treturn rb.r - rb.w\n\t}\n\n\treturn rb.size - rb.w + rb.r\n}", "title": "" }, { "docid": "4b1479649779167384ff4b7646ddb640", "score": "0.55840915", "text": "func (b *retryableRequestBody) Read(p []byte) (n int, err error) {\n\treturn b.body.Read(p)\n}", "title": "" }, { "docid": "74844d56abe859ddad67f1ad17ab597e", "score": "0.5572176", "text": "func (r *Reader) Read(p []byte) (int, error) {\n\tif r == nil {\n\t\treturn 0, errReaderNil\n\t}\n\tif r.err != nil {\n\t\treturn 0, r.err\n\t}\n\ti, err := r.Reader.Read(p)\n\tr.read += i\n\tif err != nil {\n\t\tr.err = err\n\t}\n\treturn i, err\n}", "title": "" }, { "docid": "98154df98ee7f71f423cc2bc8ae7efdb", "score": "0.5561306", "text": "func (b *PCMBuffer) Len() int {\n\tif b == nil {\n\t\treturn 0\n\t}\n\n\tswitch b.DataType {\n\tcase Integer:\n\t\treturn len(b.Ints)\n\tcase Float:\n\t\treturn len(b.Floats)\n\tcase Byte:\n\t\treturn len(b.Bytes)\n\tdefault:\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "5aa9eb00e5c1332343faebe8824a10cf", "score": "0.5559464", "text": "func (r *EBSPReader) NrBytesRead() int {\n\treturn r.pos\n}", "title": "" } ]
cb93435b5d08b8f87f8e6e04184edca2
WithPayload adds the payload to the get route train Id not found response
[ { "docid": "049682203be7e0a2bcda0feb382f2686", "score": "0.7318758", "text": "func (o *GetRouteTrainIDNotFound) WithPayload(payload *models.StatusResponse) *GetRouteTrainIDNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" } ]
[ { "docid": "1ed704161da652148bf035e46b6bb6c0", "score": "0.71123064", "text": "func (o *GetRouteTrainIDInternalServerError) WithPayload(payload *models.StatusResponse) *GetRouteTrainIDInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "b2dd18fce67199d2c5e7c6df290505f0", "score": "0.68547446", "text": "func (o *GetRouteTrainIDBadRequest) WithPayload(payload *models.StatusResponse) *GetRouteTrainIDBadRequest {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "448937f67c3be32374bdcfc651bcf170", "score": "0.66441464", "text": "func (o *GetRouteTrainIDOK) WithPayload(payload *models.RouteResponse) *GetRouteTrainIDOK {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "528dbcd090234b662c01eaf4dfd7fd8a", "score": "0.6089807", "text": "func (o *GetRouteTrainIDNotFound) SetPayload(payload *models.StatusResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "922b84eab7076bdc823d29e3401d1774", "score": "0.60379463", "text": "func (o *GetRouteTrainIDOK) SetPayload(payload *models.RouteResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "e86e2ac7ccedad0c911588fabde32182", "score": "0.5719857", "text": "func (o *GetAttackByIDNotFound) WithPayload(payload *models.Error) *GetAttackByIDNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "f02ba1b6636a90c08fef9eb91c476af5", "score": "0.5579484", "text": "func (o *GetRouteTrainIDInternalServerError) SetPayload(payload *models.StatusResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "7b91ec2ab731403af38b43b66ca3d034", "score": "0.5575317", "text": "func (o *GetRostersIDNotFound) WithPayload(payload *models.Error) *GetRostersIDNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "3924f6c475327a1880d24483b7dc6b35", "score": "0.55526614", "text": "func (o *GetAttackByIDNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "84c9c333be6ef9032c58383bfc63c17d", "score": "0.55114263", "text": "func (o *PutRecorderIDFailure) WithPayload(payload models.Error) *PutRecorderIDFailure {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "be723a7bccc38f742a9fa1b13883b5de", "score": "0.5471565", "text": "func (o *GetRuntimeAppServicesNotFound) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "bf6d218d24d66ec1d3567b5809f33d21", "score": "0.5447963", "text": "func (o *GetNodesNotFound) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "3162ba4c9005a31c32d3674d43c11655", "score": "0.53949904", "text": "func (o *GetIBAMappingByGateAndMountNotFound) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "dc30ea81d2c08c8c9bb81983ee7f4c7a", "score": "0.5393961", "text": "func (o *NodesGetClassNotFound) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "b96cd08822b16a721478ff29ed09795d", "score": "0.53684133", "text": "func (o *GetByNameNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "108c6e60ef7b623073ea194885339d8d", "score": "0.5367026", "text": "func (o *GetRostersIDNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "d4db9fc1c6c1c3fbba35de5de443ec77", "score": "0.53500634", "text": "func (o *GetSectionsForSchoolNotFound) SetPayload(payload *models.NotFound) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "0dec95efe9097a127062d7ef126cf88a", "score": "0.532046", "text": "func (o *AddNetworkNotFound) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "169b4a4290c5e4f5e138dad2dbb8da26", "score": "0.53071356", "text": "func (o *GetRouteTrainIDBadRequest) SetPayload(payload *models.StatusResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "158012a71172cd534b0face66442dbcb", "score": "0.5285154", "text": "func (o *GetWorkflowExecutionStepStatusNotFound) SetPayload(payload *models.MissingResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "fcc028ff79b130391de46ad705cafc96", "score": "0.52848995", "text": "func (o *GetByNameNotFound) WithPayload(payload *models.Error) *GetByNameNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "74b85328617a8a4a50a20e749987a2d0", "score": "0.5274015", "text": "func (o *PutAttackByIDCancelNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "b8bb2364c08461e7f60d49d12bf58c95", "score": "0.5270777", "text": "func (o *JobListerNotFound) SetPayload(payload *weles.ErrResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "e3ada5b1420f16c7f930962d02ba8f9b", "score": "0.5265767", "text": "func (o *GetRolesNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "05fb1a236581fe54aee18f0f78ee3b91", "score": "0.5260248", "text": "func (o *GetDirectoryNotFound) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "2f0f1e0714b484c4f629f35a14f76c2c", "score": "0.52591556", "text": "func (o *GetDocumentDidOrDidDocumentNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "fe3a1e5553c1522c8b147dfc4cb397f5", "score": "0.52417517", "text": "func (o *PostRostersIDRearrangeNotFound) WithPayload(payload *models.Error) *PostRostersIDRearrangeNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "03260d02b5aacc953359501b866fc79b", "score": "0.5241157", "text": "func (o *GetDashboardDetailsEmailTypeNotFound) SetPayload(payload *models.GeneralResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "c57ed665ea033c5a76b0ec8b7b74d8c8", "score": "0.52271366", "text": "func (o *GetProjectNotFound) SetPayload(payload *models.MissingResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "9042d73f0f69d1bc01a78394319d318d", "score": "0.52143157", "text": "func (o *GetDirectoryNotFound) WithPayload(payload *models.ErrorResponse) *GetDirectoryNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "5e63ceb841cbc9e8f3578846da8ce73f", "score": "0.5207738", "text": "func (o *GetWorkflowExecutionDetailNotFound) SetPayload(payload *models.MissingResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "b7c2203671e3fee3d06ddcffa170982a", "score": "0.52052826", "text": "func (o *AddNetworkNotFound) WithPayload(payload *models.APIResponse) *AddNetworkNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "2dd7945e74ada4393a0fcb508b3e0553", "score": "0.51960737", "text": "func (o *PatientProfileViewNotFound) SetPayload(payload *PatientProfileViewNotFoundBody) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "5668bf2f7760f9dc6c70324cca33cbca", "score": "0.5183584", "text": "func (o *GetRecipeNotFound) SetPayload(payload *models.ReturnCode) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "7dfa3644b8912aba610ebf216fde72f4", "score": "0.51619005", "text": "func (o *GetV1DevicesDeviceNotFound) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "cb4e2c476938aefbd3568f574eaad5be", "score": "0.5156655", "text": "func (o *UpdateWeightTicketNotFound) SetPayload(payload *ghcmessages.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "a0c34b5787572904f937ada39407058f", "score": "0.51564544", "text": "func (o *GetUniverseTypesTypeIDNotFound) SetPayload(payload *models.GetUniverseTypesTypeIDNotFoundBody) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "a6d6d73204bd99fffb8af0d55f127080", "score": "0.5138845", "text": "func (o *GetProjectProjectNameStageStageNameResourceNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "d230e187efb8da5c2818863aba76d93c", "score": "0.5123568", "text": "func (o *SetFinancialReviewFlagNotFound) SetPayload(payload *ghcmessages.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "a6c9603ff04e956006f1922ac3e494cf", "score": "0.5120719", "text": "func (o *PatchMeetupIDAttendeeNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "dc8005e660da7f54a8d2f43e33b97595", "score": "0.5117541", "text": "func (o *RegisterUserDetailsNotFound) SetPayload(payload *models.GeneralResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "b3007cc979d9254d5759dce3885580c9", "score": "0.5109581", "text": "func (o *GetNodeByNameNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "e1c9a7a2e97c29283d05100992cec8bf", "score": "0.510722", "text": "func (o *GetDefaultsSectionNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "aba319fb915d354bf6e57b3a0943f772", "score": "0.51071316", "text": "func (o *PIDNotFound) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "df91ddeb7b163a8f394dc06304ec9cb0", "score": "0.5091893", "text": "func (o *GetUserIDNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "df4c3ca3102d28797d319edc4a758817", "score": "0.508797", "text": "func (o *UpdateWeightTicketNotFound) WithPayload(payload *ghcmessages.Error) *UpdateWeightTicketNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "204879ca278bd34fa3ea3a2eff65addb", "score": "0.5049341", "text": "func (o *RouteCollectionNotFound) SetPayload(payload *RouteCollectionNotFoundBody) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "effd214b9dc9b5e599b991d112b48b56", "score": "0.50409555", "text": "func (o *GetRostersIDBenchedNotFound) WithPayload(payload *models.Error) *GetRostersIDBenchedNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "334da2433fdcdddf0ea502ecff2f63bf", "score": "0.503247", "text": "func (o *GetPaymentRequestNotFound) SetPayload(payload *ghcmessages.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "46600bbfbdda34a62cd191e4dbd04286", "score": "0.50316876", "text": "func (o *GetRostersIDBenchedNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "f5abf870c85f28b87ee374a6148d99fd", "score": "0.5025223", "text": "func (o *PIDNotFound) WithPayload(payload *models.ErrorResponse) *PIDNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "47a7e0da909afef24531be15c41bf39c", "score": "0.50095785", "text": "func (o *AddmovieratingInternalServerError) WithPayload(payload *models.Error) *AddmovieratingInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "6ea6b04d4aebe118dbac19b81405d008", "score": "0.5006297", "text": "func (o *GetPrimeEntitlementsNotFound) SetPayload(payload interface{}) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "815832afe1a8ae4ef20e2d2672b6e479", "score": "0.49997878", "text": "func (o *NodesGetClassNotFound) WithPayload(payload *models.ErrorResponse) *NodesGetClassNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "4fbeebe5ab8b96ebb6198359d2ed213f", "score": "0.4998436", "text": "func (o *UpdateMTOServiceItemStatusNotFound) SetPayload(payload *supportmessages.ClientError) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "dfcd704d46008f73cabaf30de2f73d4f", "score": "0.49975696", "text": "func (o *GetReloadNotFound) WithPayload(payload *models.Error) *GetReloadNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "7be5773e89f3a258ceab9a0eecb3e65b", "score": "0.49905702", "text": "func (o *GetAPIV1CompaniesCompanyIDNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "f1754fa4bf634f29bdcd4e36f981894f", "score": "0.4989779", "text": "func (o *ListOperatorPropertiesNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "aa7e88b965e040686683a9f15605d7ac", "score": "0.49869952", "text": "func (o *DeleteUserbyIDNotFound) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "0bb732702f35a1fda08f6975457238df", "score": "0.49856746", "text": "func (o *PutIndexDocIDNotFound) SetPayload(payload *PutIndexDocIDNotFoundBody) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "1f0ae48e387312beebbb3e7a30ffe0eb", "score": "0.49845976", "text": "func (o *GetResetPasswordConfirmationTokenNotFound) SetPayload(payload *models.GeneralResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "7af30fa09bf07bfbadfb7230287c9fe6", "score": "0.49783963", "text": "func (o *GetRostersIDInternalServerError) WithPayload(payload *models.Error) *GetRostersIDInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "b851ec61cb079ad44539bbb4e3b4e1a3", "score": "0.49750757", "text": "func (o *GetWorkflowExecutionDetailNotFound) WithPayload(payload *models.MissingResponse) *GetWorkflowExecutionDetailNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "d3721773d3336ec81b25ab37b6b7f690", "score": "0.4971469", "text": "func (o *GetStorageByPathNotFound) WithPayload(payload *models.Error) *GetStorageByPathNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "b80ba066f623eb34390f26602e047adf", "score": "0.4965224", "text": "func (o *KeyDeleteNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "3356bd89973c8e417851588827566dc8", "score": "0.49620542", "text": "func (o *AddmovieratingDefault) WithPayload(payload *models.Error) *AddmovieratingDefault {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "8b55dd645b27b1ee16aa6d143acb6074", "score": "0.4956821", "text": "func (o *GetSchoolsForUserNotFound) SetPayload(payload *models.NotFound) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "f0cbac51e8927b8ba8531ab35b2d7301", "score": "0.4951072", "text": "func (o *SetDebugStepNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "319b8767312a211820cfc287de46d99d", "score": "0.4949007", "text": "func (o *GetAttackByIDInternalServerError) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "3fc0d1aee2a9c4726e7dc17d7e740cc6", "score": "0.4938605", "text": "func (o *GetRecipeNotFound) WithPayload(payload *models.ReturnCode) *GetRecipeNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "99ab86113b39614fe58ab1e1bf95422c", "score": "0.49349207", "text": "func (o *TransformClusterToAddingHostsNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "97e8ebc41053d09857d7459147287e83", "score": "0.49277124", "text": "func (o *DeleteProgramNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "640b689621023adb39eac57f34244355", "score": "0.49247336", "text": "func (o *GetV1DevicesDeviceCommandsCommandNotFound) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "17a42e7d08b0d2dc9e2a4d67dc4e2b5b", "score": "0.49245274", "text": "func (o *PutAttackByIDCancelNotFound) WithPayload(payload *models.Error) *PutAttackByIDCancelNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "20aa37b6b6d7fc0b44e1ae683cbf44b7", "score": "0.49210268", "text": "func (o *PutRolesRoleIDNotFound) SetPayload(payload *PutRolesRoleIDNotFoundBody) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "e449bd4aadaebdd5044f019513543524", "score": "0.49106807", "text": "func (o *GetStorageByPathNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "721324e7480720dc515cfccbaa9a821a", "score": "0.49105176", "text": "func (o *GetIBAMappingByGateAndMountInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "cbaf96107a7ae0957458f804c25ed547", "score": "0.49099404", "text": "func (o *ReplaceLogTargetNotFound) WithPayload(payload *models.Error) *ReplaceLogTargetNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "1c67ebf974b7576a0b659c8120407674", "score": "0.49068806", "text": "func (o *GetReloadNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "2423910fb40eeb71389c0bce766f9ca3", "score": "0.490428", "text": "func (o *RegisterUserDetailsNotFound) WithPayload(payload *models.GeneralResponse) *RegisterUserDetailsNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "804a1962d40581fcc0cfa1447f280938", "score": "0.48977414", "text": "func (o *AddmovieratingOK) WithPayload(payload *AddmovieratingOKBody) *AddmovieratingOK {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "961a8888f4be711801c96b24848f9202", "score": "0.48973906", "text": "func (o *GetItemIDOK) WithPayload(payload *models.Item) *GetItemIDOK {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "58eb671e88927bd69c8d8335645ea547", "score": "0.48959798", "text": "func (o *GetUserIDNotFound) WithPayload(payload *models.Error) *GetUserIDNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "8a67fdba650229c2fec1dbb771fea752", "score": "0.4895071", "text": "func (o *GetAttackByIDOK) SetPayload(payload *models.AttackResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "ba97b5912a11ac85263141106c0b30ff", "score": "0.4895043", "text": "func (o *GetRuntimeAppServicesNotFound) WithPayload(payload string) *GetRuntimeAppServicesNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "af2ead6be6abd5b516349c4b20e661b5", "score": "0.4886268", "text": "func (o *PostRostersIDRearrangeNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "8f2b651cfebc212bb7b4699c0750af31", "score": "0.4880727", "text": "func (o *GetV1DevicesDeviceNotFound) WithPayload(payload string) *GetV1DevicesDeviceNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "a9777d6f0e8edb09458ffb0a3d913059", "score": "0.48789743", "text": "func (o *SetDebugStepNotFound) WithPayload(payload *models.Error) *SetDebugStepNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "2c6b3a387f06cbe24369432891822bbf", "score": "0.48777172", "text": "func (o *GetAttackByIDInternalServerError) WithPayload(payload *models.Error) *GetAttackByIDInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "76e4f8e0a2bd0ef771883d50b17304ba", "score": "0.4874804", "text": "func (o *NodesGetClassForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "0e8eb21a64d29af058d1cd3839fa8d8d", "score": "0.4868273", "text": "func (o *GetOneStorageGeneralFileNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "4b9735b96b510336ed8a51a302bccd0d", "score": "0.48675182", "text": "func (o *GetDashboardDetailsEmailTypeNotFound) WithPayload(payload *models.GeneralResponse) *GetDashboardDetailsEmailTypeNotFound {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "a40f35aa0e428bb8bb4e3b675ef0542c", "score": "0.48591775", "text": "func (o *DeleteMovieNotFound) SetPayload(payload *models.Result) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "acd586492a0d984a3e1adcfc970f8d99", "score": "0.4857626", "text": "func (o *GetByNameOK) SetPayload(payload *models.Result) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "7dec258a128e075647b5e6be68325d2a", "score": "0.48561722", "text": "func (o *GetPreTestingForbidden) WithPayload(payload *models.Error) *GetPreTestingForbidden {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "bd5f8c437342436cf1c635bfaf9bf4b0", "score": "0.48531255", "text": "func (o *GetIBAMappingByGateAndMountUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "3ec7f809101eeea129b06174f95b14ea", "score": "0.48519856", "text": "func (o *AddCellKeypairMethodNotAllowed) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "04b514ee3e7bc519e3011e2aec86866f", "score": "0.48509264", "text": "func (o *GetRuntimeJobsNotFound) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "2fb7c986d5979963959f977d0b5b8110", "score": "0.48465428", "text": "func (o *RegisterUserNotFound) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "7ff64327354c9fe1f8c98a09d2ad0a9f", "score": "0.4842387", "text": "func (o *DeleteTodoItemNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" } ]
cb9e4c1c787076fc7af3926f9573ae61
UnmarshalJSON implements the json.Unmarshaller interface for type InsightQueryItemProperties.
[ { "docid": "b50c656443de4603399bbae910db97b7", "score": "0.8618916", "text": "func (i *InsightQueryItemProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"additionalQuery\":\n\t\t\terr = unpopulate(val, \"AdditionalQuery\", &i.AdditionalQuery)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"baseQuery\":\n\t\t\terr = unpopulate(val, \"BaseQuery\", &i.BaseQuery)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"chartQuery\":\n\t\t\terr = unpopulate(val, \"ChartQuery\", &i.ChartQuery)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dataTypes\":\n\t\t\terr = unpopulate(val, \"DataTypes\", &i.DataTypes)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"defaultTimeRange\":\n\t\t\terr = unpopulate(val, \"DefaultTimeRange\", &i.DefaultTimeRange)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &i.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"displayName\":\n\t\t\terr = unpopulate(val, \"DisplayName\", &i.DisplayName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"entitiesFilter\":\n\t\t\terr = unpopulate(val, \"EntitiesFilter\", &i.EntitiesFilter)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"inputEntityType\":\n\t\t\terr = unpopulate(val, \"InputEntityType\", &i.InputEntityType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"referenceTimeRange\":\n\t\t\terr = unpopulate(val, \"ReferenceTimeRange\", &i.ReferenceTimeRange)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"requiredInputFieldsSets\":\n\t\t\terr = unpopulate(val, \"RequiredInputFieldsSets\", &i.RequiredInputFieldsSets)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tableQuery\":\n\t\t\terr = unpopulate(val, \"TableQuery\", &i.TableQuery)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "c696ffb6bf1331ff668084cbc639d86a", "score": "0.8095895", "text": "func (i *InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"projectedName\":\n\t\t\terr = unpopulate(val, \"ProjectedName\", &i.ProjectedName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"Query\":\n\t\t\terr = unpopulate(val, \"Query\", &i.Query)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f3afc3863f473933623cc25f72fd7acc", "score": "0.80574846", "text": "func (i *InsightQueryItemPropertiesTableQuery) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"columnsDefinitions\":\n\t\t\terr = unpopulate(val, \"ColumnsDefinitions\", &i.ColumnsDefinitions)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"queriesDefinitions\":\n\t\t\terr = unpopulate(val, \"QueriesDefinitions\", &i.QueriesDefinitions)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b868de17b55d6415fd0629e132f2a403", "score": "0.79764974", "text": "func (i *InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"filter\":\n\t\t\terr = unpopulate(val, \"Filter\", &i.Filter)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"linkColumnsDefinitions\":\n\t\t\terr = unpopulate(val, \"LinkColumnsDefinitions\", &i.LinkColumnsDefinitions)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"project\":\n\t\t\terr = unpopulate(val, \"Project\", &i.Project)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"summarize\":\n\t\t\terr = unpopulate(val, \"Summarize\", &i.Summarize)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3792556bd443fe12eade9f74106e34ea", "score": "0.7889236", "text": "func (i *InsightQueryItem) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &i.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"kind\":\n\t\t\terr = unpopulate(val, \"Kind\", &i.Kind)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &i.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &i.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &i.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c6c5c1816e252e4cd6c76525d8b07df0", "score": "0.77485824", "text": "func (i *InsightQueryItemPropertiesAdditionalQuery) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"query\":\n\t\t\terr = unpopulate(val, \"Query\", &i.Query)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"text\":\n\t\t\terr = unpopulate(val, \"Text\", &i.Text)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "406ff79ed16bb17963d551f45d6ab2ad", "score": "0.7687119", "text": "func (i *InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"header\":\n\t\t\terr = unpopulate(val, \"Header\", &i.Header)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"outputType\":\n\t\t\terr = unpopulate(val, \"OutputType\", &i.OutputType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"supportDeepLink\":\n\t\t\terr = unpopulate(val, \"SupportDeepLink\", &i.SupportDeepLink)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "534a654f49d1131269e1419878925afe", "score": "0.7448959", "text": "func (c *CodelessUIConnectorConfigPropertiesSampleQueriesItem) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", c, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &c.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"query\":\n\t\t\terr = unpopulate(val, \"Query\", &c.Query)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", c, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "29ca10853556180be8f9c4961f8f5542", "score": "0.73277134", "text": "func (a *AzureQueryProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"locations\":\n\t\t\terr = unpopulate(val, \"Locations\", &a.Locations)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"scope\":\n\t\t\terr = unpopulate(val, \"Scope\", &a.Scope)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tagSettings\":\n\t\t\terr = unpopulate(val, \"TagSettings\", &a.TagSettings)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "734e3b0da0bdc5279d3e693acc4558a3", "score": "0.72993594", "text": "func (e *EntityInsightItem) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", e, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"chartQueryResults\":\n\t\t\terr = unpopulate(val, \"ChartQueryResults\", &e.ChartQueryResults)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"queryId\":\n\t\t\terr = unpopulate(val, \"QueryID\", &e.QueryID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"queryTimeInterval\":\n\t\t\terr = unpopulate(val, \"QueryTimeInterval\", &e.QueryTimeInterval)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tableQueryResults\":\n\t\t\terr = unpopulate(val, \"TableQueryResults\", &e.TableQueryResults)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", e, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "da76ebb0f95fc02e67ee2ad43440dec4", "score": "0.7087384", "text": "func (c *CodelessUIConnectorConfigPropertiesGraphQueriesItem) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", c, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"baseQuery\":\n\t\t\terr = unpopulate(val, \"BaseQuery\", &c.BaseQuery)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"legend\":\n\t\t\terr = unpopulate(val, \"Legend\", &c.Legend)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"metricName\":\n\t\t\terr = unpopulate(val, \"MetricName\", &c.MetricName)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", c, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "53d1264c08a9dd6826f9e5f2ea1c9c5c", "score": "0.6997152", "text": "func (n *NonAzureQueryProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", n, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"functionAlias\":\n\t\t\terr = unpopulate(val, \"FunctionAlias\", &n.FunctionAlias)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"workspaceId\":\n\t\t\terr = unpopulate(val, \"WorkspaceID\", &n.WorkspaceID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", n, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0088f2007dd9f0342175e66a2cc38b8c", "score": "0.6994898", "text": "func (e *EntityQueryItem) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", e, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &e.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"kind\":\n\t\t\terr = unpopulate(val, \"Kind\", &e.Kind)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &e.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &e.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", e, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "22c497f4eea8609a1f7a7c5e5c708489", "score": "0.69506216", "text": "func (e *EntityQueryItemPropertiesDataTypesItem) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", e, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"dataType\":\n\t\t\terr = unpopulate(val, \"DataType\", &e.DataType)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", e, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6b3f30dfd799a4dcab9d4abe12c572d5", "score": "0.66888964", "text": "func (i *InsightsTableResultColumnsItem) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &i.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &i.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "172d2c12162414908bd8343f9dd55132", "score": "0.6636882", "text": "func (t *TargetProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", t, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"azureQueries\":\n\t\t\terr = unpopulate(val, \"AzureQueries\", &t.AzureQueries)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"nonAzureQueries\":\n\t\t\terr = unpopulate(val, \"NonAzureQueries\", &t.NonAzureQueries)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", t, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f3163c9037562ff755aa51eb5da267f0", "score": "0.65987676", "text": "func (e *ExpansionEntityQueriesProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", e, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"dataSources\":\n\t\t\terr = unpopulate(val, \"DataSources\", &e.DataSources)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"displayName\":\n\t\t\terr = unpopulate(val, \"DisplayName\", &e.DisplayName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"inputEntityType\":\n\t\t\terr = unpopulate(val, \"InputEntityType\", &e.InputEntityType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"inputFields\":\n\t\t\terr = unpopulate(val, \"InputFields\", &e.InputFields)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"outputEntityTypes\":\n\t\t\terr = unpopulate(val, \"OutputEntityTypes\", &e.OutputEntityTypes)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"queryTemplate\":\n\t\t\terr = unpopulate(val, \"QueryTemplate\", &e.QueryTemplate)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", e, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6398d064e743c825cb770d8a8878280a", "score": "0.6571617", "text": "func (a *ActivityEntityQueriesPropertiesQueryDefinitions) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"query\":\n\t\t\terr = unpopulate(val, \"Query\", &a.Query)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "858be85fe582c3b4ac73469d9b1a58b1", "score": "0.6530022", "text": "func (i *InsightQueryItemPropertiesReferenceTimeRange) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"beforeRange\":\n\t\t\terr = unpopulate(val, \"BeforeRange\", &i.BeforeRange)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6d5523c863ce81c8a31e8b30b8e2b81b", "score": "0.6524337", "text": "func (i *IPEntityProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"additionalData\":\n\t\t\terr = unpopulate(val, \"AdditionalData\", &i.AdditionalData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"address\":\n\t\t\terr = unpopulate(val, \"Address\", &i.Address)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"friendlyName\":\n\t\t\terr = unpopulate(val, \"FriendlyName\", &i.FriendlyName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &i.Location)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"threatIntelligence\":\n\t\t\terr = unpopulate(val, \"ThreatIntelligence\", &i.ThreatIntelligence)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ae489e223d5f7b5fca5df3a4ea8a6434", "score": "0.64316875", "text": "func (a *ActivityEntityQueryTemplatePropertiesQueryDefinitions) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"query\":\n\t\t\terr = unpopulate(val, \"Query\", &a.Query)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"summarizeBy\":\n\t\t\terr = unpopulate(val, \"SummarizeBy\", &a.SummarizeBy)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e5d2ccfd9654264d38c181ee3ab0c1e5", "score": "0.6384066", "text": "func (e *EntityInsightItemQueryTimeInterval) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", e, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"endTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"EndTime\", &e.EndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"StartTime\", &e.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", e, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "98fbcea845ac6aae094735da4a966877", "score": "0.63671213", "text": "func (s *SubscriptionQuotaItemProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"current\":\n\t\t\terr = unpopulate(val, \"Current\", &s.Current)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"default\":\n\t\t\terr = unpopulate(val, \"Default\", &s.Default)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "873382856be83d715742cbd6702ec15c", "score": "0.6341643", "text": "func (w *WatchlistItemProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"created\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"Created\", &w.Created)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"createdBy\":\n\t\t\terr = unpopulate(val, \"CreatedBy\", &w.CreatedBy)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"entityMapping\":\n\t\t\terr = unpopulate(val, \"EntityMapping\", &w.EntityMapping)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"isDeleted\":\n\t\t\terr = unpopulate(val, \"IsDeleted\", &w.IsDeleted)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"itemsKeyValue\":\n\t\t\terr = unpopulate(val, \"ItemsKeyValue\", &w.ItemsKeyValue)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &w.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"updated\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"Updated\", &w.Updated)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"updatedBy\":\n\t\t\terr = unpopulate(val, \"UpdatedBy\", &w.UpdatedBy)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"watchlistItemId\":\n\t\t\terr = unpopulate(val, \"WatchlistItemID\", &w.WatchlistItemID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"watchlistItemType\":\n\t\t\terr = unpopulate(val, \"WatchlistItemType\", &w.WatchlistItemType)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1e9fe02df48f72a10bbad9995368994d", "score": "0.62858075", "text": "func (u *URLEntityProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", u, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"additionalData\":\n\t\t\terr = unpopulate(val, \"AdditionalData\", &u.AdditionalData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"friendlyName\":\n\t\t\terr = unpopulate(val, \"FriendlyName\", &u.FriendlyName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"url\":\n\t\t\terr = unpopulate(val, \"URL\", &u.URL)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", u, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4bc693ab8bcdf192602854afb200592b", "score": "0.6279042", "text": "func (a *ActivityEntityQueryTemplateProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"content\":\n\t\t\terr = unpopulate(val, \"Content\", &a.Content)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dataTypes\":\n\t\t\terr = unpopulate(val, \"DataTypes\", &a.DataTypes)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &a.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"entitiesFilter\":\n\t\t\terr = unpopulate(val, \"EntitiesFilter\", &a.EntitiesFilter)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"inputEntityType\":\n\t\t\terr = unpopulate(val, \"InputEntityType\", &a.InputEntityType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"queryDefinitions\":\n\t\t\terr = unpopulate(val, \"QueryDefinitions\", &a.QueryDefinitions)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"requiredInputFieldsSets\":\n\t\t\terr = unpopulate(val, \"RequiredInputFieldsSets\", &a.RequiredInputFieldsSets)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"title\":\n\t\t\terr = unpopulate(val, \"Title\", &a.Title)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ec2336189adf69331ffdce890764870f", "score": "0.6277422", "text": "func (a *ActivityEntityQueriesProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"content\":\n\t\t\terr = unpopulate(val, \"Content\", &a.Content)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"createdTimeUtc\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"CreatedTimeUTC\", &a.CreatedTimeUTC)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &a.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"enabled\":\n\t\t\terr = unpopulate(val, \"Enabled\", &a.Enabled)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"entitiesFilter\":\n\t\t\terr = unpopulate(val, \"EntitiesFilter\", &a.EntitiesFilter)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"inputEntityType\":\n\t\t\terr = unpopulate(val, \"InputEntityType\", &a.InputEntityType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"lastModifiedTimeUtc\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"LastModifiedTimeUTC\", &a.LastModifiedTimeUTC)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"queryDefinitions\":\n\t\t\terr = unpopulate(val, \"QueryDefinitions\", &a.QueryDefinitions)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"requiredInputFieldsSets\":\n\t\t\terr = unpopulate(val, \"RequiredInputFieldsSets\", &a.RequiredInputFieldsSets)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"templateName\":\n\t\t\terr = unpopulate(val, \"TemplateName\", &a.TemplateName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"title\":\n\t\t\terr = unpopulate(val, \"Title\", &a.Title)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d38b24e0ec6b25f2c306a61684fd8005", "score": "0.6265834", "text": "func (b *BackupItemProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", b, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"BackupID\", &b.BackupID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"blobName\":\n\t\t\terr = unpopulate(val, \"BlobName\", &b.BlobName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"correlationId\":\n\t\t\terr = unpopulate(val, \"CorrelationID\", &b.CorrelationID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"created\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"Created\", &b.Created)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"databases\":\n\t\t\terr = unpopulate(val, \"Databases\", &b.Databases)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"finishedTimeStamp\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"FinishedTimeStamp\", &b.FinishedTimeStamp)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"lastRestoreTimeStamp\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"LastRestoreTimeStamp\", &b.LastRestoreTimeStamp)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"log\":\n\t\t\terr = unpopulate(val, \"Log\", &b.Log)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &b.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"scheduled\":\n\t\t\terr = unpopulate(val, \"Scheduled\", &b.Scheduled)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sizeInBytes\":\n\t\t\terr = unpopulate(val, \"SizeInBytes\", &b.SizeInBytes)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &b.Status)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"storageAccountUrl\":\n\t\t\terr = unpopulate(val, \"StorageAccountURL\", &b.StorageAccountURL)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"websiteSizeInBytes\":\n\t\t\terr = unpopulate(val, \"WebsiteSizeInBytes\", &b.WebsiteSizeInBytes)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", b, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "04e08e2d2a1aef58607d24769963cf5e", "score": "0.6255299", "text": "func (m *MSTICheckRequirementsProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &m.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "74f70dbcb3137d14210dcc679dfa66b9", "score": "0.6248998", "text": "func (j *JobCollectionItemProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", j, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"creationTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"CreationTime\", &j.CreationTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"endTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"EndTime\", &j.EndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"jobId\":\n\t\t\terr = unpopulate(val, \"JobID\", &j.JobID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"lastModifiedTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"LastModifiedTime\", &j.LastModifiedTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"provisioningState\":\n\t\t\terr = unpopulate(val, \"ProvisioningState\", &j.ProvisioningState)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"runOn\":\n\t\t\terr = unpopulate(val, \"RunOn\", &j.RunOn)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"runbook\":\n\t\t\terr = unpopulate(val, \"Runbook\", &j.Runbook)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"StartTime\", &j.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &j.Status)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", j, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "74f70dbcb3137d14210dcc679dfa66b9", "score": "0.6248998", "text": "func (j *JobCollectionItemProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", j, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"creationTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"CreationTime\", &j.CreationTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"endTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"EndTime\", &j.EndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"jobId\":\n\t\t\terr = unpopulate(val, \"JobID\", &j.JobID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"lastModifiedTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"LastModifiedTime\", &j.LastModifiedTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"provisioningState\":\n\t\t\terr = unpopulate(val, \"ProvisioningState\", &j.ProvisioningState)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"runOn\":\n\t\t\terr = unpopulate(val, \"RunOn\", &j.RunOn)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"runbook\":\n\t\t\terr = unpopulate(val, \"Runbook\", &j.Runbook)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"StartTime\", &j.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &j.Status)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", j, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "815ce7a8b6cbe0765dc8f8c580b7bda1", "score": "0.61742854", "text": "func (u *UpdateProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", u, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &u.Description)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", u, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6d3831089fa9bc0e4a9f6ecbf5789cde", "score": "0.61696404", "text": "func (i *IoTCheckRequirementsProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"subscriptionId\":\n\t\t\terr = unpopulate(val, \"SubscriptionID\", &i.SubscriptionID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "102d1db42c4428ccd3183a8249c7bf49", "score": "0.61544055", "text": "func (o *OfficeIRMCheckRequirementsProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", o, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &o.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", o, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9e83bab207590b8a3bd6ec9f0e273df2", "score": "0.6149263", "text": "func (s *SoftwareUpdateConfigurationCollectionItemProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"creationTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"CreationTime\", &s.CreationTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"frequency\":\n\t\t\terr = unpopulate(val, \"Frequency\", &s.Frequency)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"lastModifiedTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"LastModifiedTime\", &s.LastModifiedTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"nextRun\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"NextRun\", &s.NextRun)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"provisioningState\":\n\t\t\terr = unpopulate(val, \"ProvisioningState\", &s.ProvisioningState)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"StartTime\", &s.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tasks\":\n\t\t\terr = unpopulate(val, \"Tasks\", &s.Tasks)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"updateConfiguration\":\n\t\t\terr = unpopulate(val, \"UpdateConfiguration\", &s.UpdateConfiguration)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9e83bab207590b8a3bd6ec9f0e273df2", "score": "0.6149263", "text": "func (s *SoftwareUpdateConfigurationCollectionItemProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"creationTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"CreationTime\", &s.CreationTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"frequency\":\n\t\t\terr = unpopulate(val, \"Frequency\", &s.Frequency)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"lastModifiedTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"LastModifiedTime\", &s.LastModifiedTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"nextRun\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"NextRun\", &s.NextRun)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"provisioningState\":\n\t\t\terr = unpopulate(val, \"ProvisioningState\", &s.ProvisioningState)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"StartTime\", &s.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tasks\":\n\t\t\terr = unpopulate(val, \"Tasks\", &s.Tasks)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"updateConfiguration\":\n\t\t\terr = unpopulate(val, \"UpdateConfiguration\", &s.UpdateConfiguration)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dea6af21941a0aa4484fa012667060f6", "score": "0.6120648", "text": "func (v *Properties) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson3e8ab7adDecodeGithubComHumansNetMapboxSdkGoMapbox(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "af82a246495de56f25e7a8c332ef72ee", "score": "0.60898393", "text": "func (i *InstanceProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"accountName\":\n\t\t\terr = unpopulate(val, \"AccountName\", &i.AccountName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"diagnosticStorageProperties\":\n\t\t\terr = unpopulate(val, \"DiagnosticStorageProperties\", &i.DiagnosticStorageProperties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"enableDiagnostics\":\n\t\t\terr = unpopulate(val, \"EnableDiagnostics\", &i.EnableDiagnostics)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"iotHubs\":\n\t\t\terr = unpopulate(val, \"IotHubs\", &i.IotHubs)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"provisioningState\":\n\t\t\terr = unpopulate(val, \"ProvisioningState\", &i.ProvisioningState)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f3fc8e0f18a225cd2f597966fabdf497", "score": "0.60765713", "text": "func (i InsightQueryItemProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"additionalQuery\", i.AdditionalQuery)\n\tpopulate(objectMap, \"baseQuery\", i.BaseQuery)\n\tpopulate(objectMap, \"chartQuery\", &i.ChartQuery)\n\tpopulate(objectMap, \"dataTypes\", i.DataTypes)\n\tpopulate(objectMap, \"defaultTimeRange\", i.DefaultTimeRange)\n\tpopulate(objectMap, \"description\", i.Description)\n\tpopulate(objectMap, \"displayName\", i.DisplayName)\n\tpopulate(objectMap, \"entitiesFilter\", &i.EntitiesFilter)\n\tpopulate(objectMap, \"inputEntityType\", i.InputEntityType)\n\tpopulate(objectMap, \"referenceTimeRange\", i.ReferenceTimeRange)\n\tpopulate(objectMap, \"requiredInputFieldsSets\", i.RequiredInputFieldsSets)\n\tpopulate(objectMap, \"tableQuery\", i.TableQuery)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5d13e4d6a2742a689148066353870bc2", "score": "0.60593593", "text": "func (c *CustomEntityQuery) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", c, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"etag\":\n\t\t\terr = unpopulate(val, \"Etag\", &c.Etag)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &c.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"kind\":\n\t\t\terr = unpopulate(val, \"Kind\", &c.Kind)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &c.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &c.SystemData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &c.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", c, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f74dae2df3f392fb285aafa1e0bcad7e", "score": "0.6049505", "text": "func (u *UserIdentityProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", u, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"clientId\":\n\t\t\terr = unpopulate(val, \"ClientID\", &u.ClientID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"principalId\":\n\t\t\terr = unpopulate(val, \"PrincipalID\", &u.PrincipalID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", u, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6818ea358f1d4060994df6e7ddf91586", "score": "0.6043659", "text": "func (p *Properties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &p.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"provisioningState\":\n\t\t\terr = unpopulate(val, \"ProvisioningState\", &p.ProvisioningState)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0faa22fa177a8368949b5d8669cc5933", "score": "0.6040706", "text": "func (o *MetricsQueryMetadata) UnmarshalJSON(bytes []byte) (err error) {\n\traw := map[string]interface{}{}\n\tall := struct {\n\t\tAggr NullableString `json:\"aggr,omitempty\"`\n\t\tDisplayName *string `json:\"display_name,omitempty\"`\n\t\tEnd *int64 `json:\"end,omitempty\"`\n\t\tExpression *string `json:\"expression,omitempty\"`\n\t\tInterval *int64 `json:\"interval,omitempty\"`\n\t\tLength *int64 `json:\"length,omitempty\"`\n\t\tMetric *string `json:\"metric,omitempty\"`\n\t\tPointlist [][]*float64 `json:\"pointlist,omitempty\"`\n\t\tQueryIndex *int64 `json:\"query_index,omitempty\"`\n\t\tScope *string `json:\"scope,omitempty\"`\n\t\tStart *int64 `json:\"start,omitempty\"`\n\t\tTagSet []string `json:\"tag_set,omitempty\"`\n\t\tUnit []MetricsQueryUnit `json:\"unit,omitempty\"`\n\t}{}\n\terr = json.Unmarshal(bytes, &all)\n\tif err != nil {\n\t\terr = json.Unmarshal(bytes, &raw)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\to.UnparsedObject = raw\n\t\treturn nil\n\t}\n\to.Aggr = all.Aggr\n\to.DisplayName = all.DisplayName\n\to.End = all.End\n\to.Expression = all.Expression\n\to.Interval = all.Interval\n\to.Length = all.Length\n\to.Metric = all.Metric\n\to.Pointlist = all.Pointlist\n\to.QueryIndex = all.QueryIndex\n\to.Scope = all.Scope\n\to.Start = all.Start\n\to.TagSet = all.TagSet\n\to.Unit = all.Unit\n\treturn nil\n}", "title": "" }, { "docid": "97a70e221d616fa4b891567e5a31a5a5", "score": "0.60404825", "text": "func (s *ScriptCmdletProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &s.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"parameters\":\n\t\t\terr = unpopulate(val, \"Parameters\", &s.Parameters)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"timeout\":\n\t\t\terr = unpopulate(val, \"Timeout\", &s.Timeout)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c3e3c809401824603c8872ce254104dc", "score": "0.60281575", "text": "func (s *MetaItem) UnmarshalJson(data []byte) error {\n\treturn json.Unmarshal(data, s)\n}", "title": "" }, { "docid": "c3e3c809401824603c8872ce254104dc", "score": "0.60281575", "text": "func (s *MetaItem) UnmarshalJson(data []byte) error {\n\treturn json.Unmarshal(data, s)\n}", "title": "" }, { "docid": "19cfc718e38c47495e0ea763f5ea1fc0", "score": "0.6011739", "text": "func (m *MalwareEntityProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"additionalData\":\n\t\t\terr = unpopulate(val, \"AdditionalData\", &m.AdditionalData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"category\":\n\t\t\terr = unpopulate(val, \"Category\", &m.Category)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"fileEntityIds\":\n\t\t\terr = unpopulate(val, \"FileEntityIDs\", &m.FileEntityIDs)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"friendlyName\":\n\t\t\terr = unpopulate(val, \"FriendlyName\", &m.FriendlyName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"malwareName\":\n\t\t\terr = unpopulate(val, \"MalwareName\", &m.MalwareName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"processEntityIds\":\n\t\t\terr = unpopulate(val, \"ProcessEntityIDs\", &m.ProcessEntityIDs)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "758f7ef9ca6e60badd77b9438b79db69", "score": "0.59859484", "text": "func (c *CodelessUIConnectorConfigPropertiesDataTypesItem) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", c, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"lastDataReceivedQuery\":\n\t\t\terr = unpopulate(val, \"LastDataReceivedQuery\", &c.LastDataReceivedQuery)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &c.Name)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", c, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "36ad4acf62a2671f788e99a2969f1d92", "score": "0.5977287", "text": "func (m *MigrateSQLServerSQLDbTaskProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"clientData\":\n\t\t\terr = unpopulate(val, \"ClientData\", &m.ClientData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"commands\":\n\t\t\tm.Commands, err = unmarshalCommandPropertiesClassificationArray(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"errors\":\n\t\t\terr = unpopulate(val, \"Errors\", &m.Errors)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"input\":\n\t\t\terr = unpopulate(val, \"Input\", &m.Input)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"output\":\n\t\t\tm.Output, err = unmarshalMigrateSQLServerSQLDbTaskOutputClassificationArray(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"state\":\n\t\t\terr = unpopulate(val, \"State\", &m.State)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"taskType\":\n\t\t\terr = unpopulate(val, \"TaskType\", &m.TaskType)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "af2f57b6bd49f35e22f22b1645d3a248", "score": "0.59738344", "text": "func (i *IdentifierProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"Value\", &i.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3f904741432c0b19df60894a77e883be", "score": "0.59696954", "text": "func (m *MailboxEntityProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"additionalData\":\n\t\t\terr = unpopulate(val, \"AdditionalData\", &m.AdditionalData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"displayName\":\n\t\t\terr = unpopulate(val, \"DisplayName\", &m.DisplayName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"externalDirectoryObjectId\":\n\t\t\terr = unpopulate(val, \"ExternalDirectoryObjectID\", &m.ExternalDirectoryObjectID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"friendlyName\":\n\t\t\terr = unpopulate(val, \"FriendlyName\", &m.FriendlyName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"mailboxPrimaryAddress\":\n\t\t\terr = unpopulate(val, \"MailboxPrimaryAddress\", &m.MailboxPrimaryAddress)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"upn\":\n\t\t\terr = unpopulate(val, \"Upn\", &m.Upn)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2e97e7522c1a5e30ab2b5e83b7000e40", "score": "0.5944113", "text": "func (m *MigrateSQLServerSQLMISyncTaskProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"clientData\":\n\t\t\terr = unpopulate(val, \"ClientData\", &m.ClientData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"commands\":\n\t\t\tm.Commands, err = unmarshalCommandPropertiesClassificationArray(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"errors\":\n\t\t\terr = unpopulate(val, \"Errors\", &m.Errors)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"input\":\n\t\t\terr = unpopulate(val, \"Input\", &m.Input)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"output\":\n\t\t\tm.Output, err = unmarshalMigrateSQLServerSQLMISyncTaskOutputClassificationArray(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"state\":\n\t\t\terr = unpopulate(val, \"State\", &m.State)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"taskType\":\n\t\t\terr = unpopulate(val, \"TaskType\", &m.TaskType)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1db67964c55bc395365663aa7257bfe2", "score": "0.59329575", "text": "func (o *OfficePowerBICheckRequirementsProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", o, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &o.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", o, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cb7889ce7247f65318e513624b6d80b8", "score": "0.59259814", "text": "func (i *InsightQueryItemPropertiesDefaultTimeRange) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"afterRange\":\n\t\t\terr = unpopulate(val, \"AfterRange\", &i.AfterRange)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"beforeRange\":\n\t\t\terr = unpopulate(val, \"BeforeRange\", &i.BeforeRange)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "00ad2ab8cf98d9f39f0757a92771546a", "score": "0.59224033", "text": "func (c *CacheUpdateProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", c, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"connectionString\":\n\t\t\terr = unpopulate(val, \"ConnectionString\", &c.ConnectionString)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &c.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"resourceId\":\n\t\t\terr = unpopulate(val, \"ResourceID\", &c.ResourceID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"useFromLocation\":\n\t\t\terr = unpopulate(val, \"UseFromLocation\", &c.UseFromLocation)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", c, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6f46de39bed5bdbb4f92b21f8e4ad92b", "score": "0.5921389", "text": "func (r *ResourceHealthMetadataProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"category\":\n\t\t\terr = unpopulate(val, \"Category\", &r.Category)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"signalAvailability\":\n\t\t\terr = unpopulate(val, \"SignalAvailability\", &r.SignalAvailability)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e4f20832a70067e96551999fc1c19968", "score": "0.59207857", "text": "func (t *TICheckRequirementsProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", t, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &t.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", t, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d0dba492eee78c2c7406d1a287475b4c", "score": "0.58974296", "text": "func (m *MDATPCheckRequirementsProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &m.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "430850ebd5da05edc61df3d82c0083f8", "score": "0.5896543", "text": "func (w *WebhookUpdateProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &w.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"isEnabled\":\n\t\t\terr = unpopulate(val, \"IsEnabled\", &w.IsEnabled)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"parameters\":\n\t\t\terr = unpopulate(val, \"Parameters\", &w.Parameters)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"runOn\":\n\t\t\terr = unpopulate(val, \"RunOn\", &w.RunOn)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f4dce54616be0701309a71c3ed30d7ab", "score": "0.58964217", "text": "func (r *ResourceIDListResultValueItem) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &r.ID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "937b7415e0d8c336a5c5f008d3e61d35", "score": "0.5893893", "text": "func (i *IncidentProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"additionalData\":\n\t\t\terr = unpopulate(val, \"AdditionalData\", &i.AdditionalData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"classification\":\n\t\t\terr = unpopulate(val, \"Classification\", &i.Classification)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"classificationComment\":\n\t\t\terr = unpopulate(val, \"ClassificationComment\", &i.ClassificationComment)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"classificationReason\":\n\t\t\terr = unpopulate(val, \"ClassificationReason\", &i.ClassificationReason)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"createdTimeUtc\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"CreatedTimeUTC\", &i.CreatedTimeUTC)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &i.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"firstActivityTimeUtc\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"FirstActivityTimeUTC\", &i.FirstActivityTimeUTC)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"incidentNumber\":\n\t\t\terr = unpopulate(val, \"IncidentNumber\", &i.IncidentNumber)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"incidentUrl\":\n\t\t\terr = unpopulate(val, \"IncidentURL\", &i.IncidentURL)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"labels\":\n\t\t\terr = unpopulate(val, \"Labels\", &i.Labels)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"lastActivityTimeUtc\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"LastActivityTimeUTC\", &i.LastActivityTimeUTC)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"lastModifiedTimeUtc\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"LastModifiedTimeUTC\", &i.LastModifiedTimeUTC)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"owner\":\n\t\t\terr = unpopulate(val, \"Owner\", &i.Owner)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"providerIncidentId\":\n\t\t\terr = unpopulate(val, \"ProviderIncidentID\", &i.ProviderIncidentID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"providerName\":\n\t\t\terr = unpopulate(val, \"ProviderName\", &i.ProviderName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"relatedAnalyticRuleIds\":\n\t\t\terr = unpopulate(val, \"RelatedAnalyticRuleIDs\", &i.RelatedAnalyticRuleIDs)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"severity\":\n\t\t\terr = unpopulate(val, \"Severity\", &i.Severity)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &i.Status)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"teamInformation\":\n\t\t\terr = unpopulate(val, \"TeamInformation\", &i.TeamInformation)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"title\":\n\t\t\terr = unpopulate(val, \"Title\", &i.Title)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1dc671b207df568ebb49cccb2f14a8e7", "score": "0.58902097", "text": "func (i *IdentityProviderUpdateProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"allowedTenants\":\n\t\t\terr = unpopulate(val, \"AllowedTenants\", &i.AllowedTenants)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"authority\":\n\t\t\terr = unpopulate(val, \"Authority\", &i.Authority)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"clientId\":\n\t\t\terr = unpopulate(val, \"ClientID\", &i.ClientID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"clientLibrary\":\n\t\t\terr = unpopulate(val, \"ClientLibrary\", &i.ClientLibrary)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"clientSecret\":\n\t\t\terr = unpopulate(val, \"ClientSecret\", &i.ClientSecret)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"passwordResetPolicyName\":\n\t\t\terr = unpopulate(val, \"PasswordResetPolicyName\", &i.PasswordResetPolicyName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"profileEditingPolicyName\":\n\t\t\terr = unpopulate(val, \"ProfileEditingPolicyName\", &i.ProfileEditingPolicyName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"signinPolicyName\":\n\t\t\terr = unpopulate(val, \"SigninPolicyName\", &i.SigninPolicyName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"signinTenant\":\n\t\t\terr = unpopulate(val, \"SigninTenant\", &i.SigninTenant)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"signupPolicyName\":\n\t\t\terr = unpopulate(val, \"SignupPolicyName\", &i.SignupPolicyName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &i.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "60e6d5ae3ef8e87bb7b9551aba5aa513", "score": "0.58884495", "text": "func (g *GetUserTablesSQLTaskProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", g, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"clientData\":\n\t\t\terr = unpopulate(val, \"ClientData\", &g.ClientData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"commands\":\n\t\t\tg.Commands, err = unmarshalCommandPropertiesClassificationArray(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"errors\":\n\t\t\terr = unpopulate(val, \"Errors\", &g.Errors)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"input\":\n\t\t\terr = unpopulate(val, \"Input\", &g.Input)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"output\":\n\t\t\terr = unpopulate(val, \"Output\", &g.Output)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"state\":\n\t\t\terr = unpopulate(val, \"State\", &g.State)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"taskType\":\n\t\t\terr = unpopulate(val, \"TaskType\", &g.TaskType)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", g, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "41ddb8eaa12d48862960202794b05b23", "score": "0.587929", "text": "func (p *ProcessInfoProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"children\":\n\t\t\terr = unpopulate(val, \"Children\", &p.Children)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"command_line\":\n\t\t\terr = unpopulate(val, \"CommandLine\", &p.CommandLine)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"deployment_name\":\n\t\t\terr = unpopulate(val, \"DeploymentName\", &p.DeploymentName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &p.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"environment_variables\":\n\t\t\terr = unpopulate(val, \"EnvironmentVariables\", &p.EnvironmentVariables)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"file_name\":\n\t\t\terr = unpopulate(val, \"FileName\", &p.FileName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"handle_count\":\n\t\t\terr = unpopulate(val, \"HandleCount\", &p.HandleCount)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"href\":\n\t\t\terr = unpopulate(val, \"Href\", &p.Href)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"identifier\":\n\t\t\terr = unpopulate(val, \"Identifier\", &p.Identifier)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"iis_profile_timeout_in_seconds\":\n\t\t\terr = unpopulate(val, \"IisProfileTimeoutInSeconds\", &p.IisProfileTimeoutInSeconds)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"is_iis_profile_running\":\n\t\t\terr = unpopulate(val, \"IsIisProfileRunning\", &p.IsIisProfileRunning)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"is_profile_running\":\n\t\t\terr = unpopulate(val, \"IsProfileRunning\", &p.IsProfileRunning)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"is_scm_site\":\n\t\t\terr = unpopulate(val, \"IsScmSite\", &p.IsScmSite)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"is_webjob\":\n\t\t\terr = unpopulate(val, \"IsWebjob\", &p.IsWebjob)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"minidump\":\n\t\t\terr = unpopulate(val, \"Minidump\", &p.Minidump)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"module_count\":\n\t\t\terr = unpopulate(val, \"ModuleCount\", &p.ModuleCount)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"modules\":\n\t\t\terr = unpopulate(val, \"Modules\", &p.Modules)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"non_paged_system_memory\":\n\t\t\terr = unpopulate(val, \"NonPagedSystemMemory\", &p.NonPagedSystemMemory)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"open_file_handles\":\n\t\t\terr = unpopulate(val, \"OpenFileHandles\", &p.OpenFileHandles)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"paged_memory\":\n\t\t\terr = unpopulate(val, \"PagedMemory\", &p.PagedMemory)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"paged_system_memory\":\n\t\t\terr = unpopulate(val, \"PagedSystemMemory\", &p.PagedSystemMemory)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"parent\":\n\t\t\terr = unpopulate(val, \"Parent\", &p.Parent)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"peak_paged_memory\":\n\t\t\terr = unpopulate(val, \"PeakPagedMemory\", &p.PeakPagedMemory)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"peak_virtual_memory\":\n\t\t\terr = unpopulate(val, \"PeakVirtualMemory\", &p.PeakVirtualMemory)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"peak_working_set\":\n\t\t\terr = unpopulate(val, \"PeakWorkingSet\", &p.PeakWorkingSet)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"private_memory\":\n\t\t\terr = unpopulate(val, \"PrivateMemory\", &p.PrivateMemory)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"privileged_cpu_time\":\n\t\t\terr = unpopulate(val, \"PrivilegedCPUTime\", &p.PrivilegedCPUTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"start_time\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"StartTime\", &p.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"thread_count\":\n\t\t\terr = unpopulate(val, \"ThreadCount\", &p.ThreadCount)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"threads\":\n\t\t\terr = unpopulate(val, \"Threads\", &p.Threads)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"time_stamp\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"TimeStamp\", &p.TimeStamp)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"total_cpu_time\":\n\t\t\terr = unpopulate(val, \"TotalCPUTime\", &p.TotalCPUTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"user_cpu_time\":\n\t\t\terr = unpopulate(val, \"UserCPUTime\", &p.UserCPUTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"user_name\":\n\t\t\terr = unpopulate(val, \"UserName\", &p.UserName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"virtual_memory\":\n\t\t\terr = unpopulate(val, \"VirtualMemory\", &p.VirtualMemory)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"working_set\":\n\t\t\terr = unpopulate(val, \"WorkingSet\", &p.WorkingSet)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fd348c4eb4136e6a1efb4aecf196a8bf", "score": "0.58743244", "text": "func (c *CodelessUIConnectorConfigPropertiesInstructionStepsItem) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", c, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &c.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"instructions\":\n\t\t\terr = unpopulate(val, \"Instructions\", &c.Instructions)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"title\":\n\t\t\terr = unpopulate(val, \"Title\", &c.Title)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", c, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9d83144f3bd84e832e292bf8b405b45a", "score": "0.58681583", "text": "func (a *AgentUpdateProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &a.Description)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "029bbd6f44bbd8bc38d40ec270e9af29", "score": "0.5867319", "text": "func (i *InstructionStepsInstructionsItem) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"parameters\":\n\t\t\terr = unpopulate(val, \"Parameters\", &i.Parameters)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &i.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e637a5ee435085685576fe06cbe9007b", "score": "0.5864441", "text": "func (g *GetInsightsResultsMetadata) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", g, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"errors\":\n\t\t\terr = unpopulate(val, \"Errors\", &g.Errors)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"totalCount\":\n\t\t\terr = unpopulate(val, \"TotalCount\", &g.TotalCount)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", g, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8eec8925ffa19ee51d1fef7861b332a1", "score": "0.5863309", "text": "func (b *BookmarkProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", b, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"created\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"Created\", &b.Created)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"createdBy\":\n\t\t\terr = unpopulate(val, \"CreatedBy\", &b.CreatedBy)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"displayName\":\n\t\t\terr = unpopulate(val, \"DisplayName\", &b.DisplayName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"entityMappings\":\n\t\t\terr = unpopulate(val, \"EntityMappings\", &b.EntityMappings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"eventTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"EventTime\", &b.EventTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"incidentInfo\":\n\t\t\terr = unpopulate(val, \"IncidentInfo\", &b.IncidentInfo)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"labels\":\n\t\t\terr = unpopulate(val, \"Labels\", &b.Labels)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"notes\":\n\t\t\terr = unpopulate(val, \"Notes\", &b.Notes)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"query\":\n\t\t\terr = unpopulate(val, \"Query\", &b.Query)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"queryEndTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"QueryEndTime\", &b.QueryEndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"queryResult\":\n\t\t\terr = unpopulate(val, \"QueryResult\", &b.QueryResult)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"queryStartTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"QueryStartTime\", &b.QueryStartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tactics\":\n\t\t\terr = unpopulate(val, \"Tactics\", &b.Tactics)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"techniques\":\n\t\t\terr = unpopulate(val, \"Techniques\", &b.Techniques)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"updated\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"Updated\", &b.Updated)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"updatedBy\":\n\t\t\terr = unpopulate(val, \"UpdatedBy\", &b.UpdatedBy)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", b, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "efc35de2aab1d11336fa7db97c993756", "score": "0.5862856", "text": "func (p *ProjectUpdateProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &p.Description)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c09e0bf0dc37d358a5474cc9ca89fe69", "score": "0.58541965", "text": "func (s *ServiceSKUProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"capacity\":\n\t\t\terr = unpopulate(val, \"Capacity\", &s.Capacity)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &s.Name)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bbdaa1267fc06bef692dc0ffe947ae5b", "score": "0.58527976", "text": "func (m *MTPCheckRequirementsProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &m.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b05c6ce7150724b1f002f980ef4c9cb8", "score": "0.5852627", "text": "func (w *WatcherUpdateProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"executionFrequencyInSeconds\":\n\t\t\terr = unpopulate(val, \"ExecutionFrequencyInSeconds\", &w.ExecutionFrequencyInSeconds)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e94a32ca61885a208cb6c0fc65bce17b", "score": "0.5850136", "text": "func (t *TiTaxiiCheckRequirementsProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", t, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &t.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", t, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f09d03570fd8c0bfc340f0f00731d257", "score": "0.5846811", "text": "func (w *WindowsProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"excludedKbNumbers\":\n\t\t\terr = unpopulate(val, \"ExcludedKbNumbers\", &w.ExcludedKbNumbers)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"includedKbNumbers\":\n\t\t\terr = unpopulate(val, \"IncludedKbNumbers\", &w.IncludedKbNumbers)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"includedUpdateClassifications\":\n\t\t\terr = unpopulate(val, \"IncludedUpdateClassifications\", &w.IncludedUpdateClassifications)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"rebootSetting\":\n\t\t\terr = unpopulate(val, \"RebootSetting\", &w.RebootSetting)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c5f505ee354442e56c4047eb8ab25c7a", "score": "0.5838894", "text": "func (p *ProductUpdateProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"approvalRequired\":\n\t\t\terr = unpopulate(val, \"ApprovalRequired\", &p.ApprovalRequired)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &p.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"displayName\":\n\t\t\terr = unpopulate(val, \"DisplayName\", &p.DisplayName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"state\":\n\t\t\terr = unpopulate(val, \"State\", &p.State)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"subscriptionRequired\":\n\t\t\terr = unpopulate(val, \"SubscriptionRequired\", &p.SubscriptionRequired)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"subscriptionsLimit\":\n\t\t\terr = unpopulate(val, \"SubscriptionsLimit\", &p.SubscriptionsLimit)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"terms\":\n\t\t\terr = unpopulate(val, \"Terms\", &p.Terms)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "572a3df9ffd5c43045edf64eedd46df7", "score": "0.5827919", "text": "func (m *MSTIDataConnectorProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"dataTypes\":\n\t\t\terr = unpopulate(val, \"DataTypes\", &m.DataTypes)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &m.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "43038775d8d09df727ce8d719ac4d01b", "score": "0.5821967", "text": "func (s *SecurityAlertPropertiesConfidenceReasonsItem) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"reason\":\n\t\t\terr = unpopulate(val, \"Reason\", &s.Reason)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"reasonType\":\n\t\t\terr = unpopulate(val, \"ReasonType\", &s.ReasonType)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7be44f17c0d243c3cbd632f5300903b6", "score": "0.581827", "text": "func (v *VirtualMachineProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"displayName\":\n\t\t\terr = unpopulate(val, \"DisplayName\", &v.DisplayName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"folderPath\":\n\t\t\terr = unpopulate(val, \"FolderPath\", &v.FolderPath)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"moRefId\":\n\t\t\terr = unpopulate(val, \"MoRefID\", &v.MoRefID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"restrictMovement\":\n\t\t\terr = unpopulate(val, \"RestrictMovement\", &v.RestrictMovement)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ec481fbfc68af6b3e37ae4e4e6733793", "score": "0.58145994", "text": "func (s *SiteConfigurationSnapshotInfoProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"snapshotId\":\n\t\t\terr = unpopulate(val, \"SnapshotID\", &s.SnapshotID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"time\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"Time\", &s.Time)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8d3dd3c3e2b42282b15cdd96f091c7e5", "score": "0.5810227", "text": "func (p *PremierAddOnProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"marketplaceOffer\":\n\t\t\terr = unpopulate(val, \"MarketplaceOffer\", &p.MarketplaceOffer)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"marketplacePublisher\":\n\t\t\terr = unpopulate(val, \"MarketplacePublisher\", &p.MarketplacePublisher)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"product\":\n\t\t\terr = unpopulate(val, \"Product\", &p.Product)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sku\":\n\t\t\terr = unpopulate(val, \"SKU\", &p.SKU)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"vendor\":\n\t\t\terr = unpopulate(val, \"Vendor\", &p.Vendor)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "23e054235eac85a7475cc88b232f6545", "score": "0.58082753", "text": "func (m *MigrateSchemaSQLServerSQLDbTaskProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"clientData\":\n\t\t\terr = unpopulate(val, \"ClientData\", &m.ClientData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"commands\":\n\t\t\tm.Commands, err = unmarshalCommandPropertiesClassificationArray(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"errors\":\n\t\t\terr = unpopulate(val, \"Errors\", &m.Errors)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"input\":\n\t\t\terr = unpopulate(val, \"Input\", &m.Input)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"output\":\n\t\t\tm.Output, err = unmarshalMigrateSchemaSQLServerSQLDbTaskOutputClassificationArray(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"state\":\n\t\t\terr = unpopulate(val, \"State\", &m.State)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"taskType\":\n\t\t\terr = unpopulate(val, \"TaskType\", &m.TaskType)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "594f688d166131ee58a8b3710b5ae091", "score": "0.5808112", "text": "func (m *MigrateMySQLRequestProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"connectionString\":\n\t\t\terr = unpopulate(val, \"ConnectionString\", &m.ConnectionString)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"migrationType\":\n\t\t\terr = unpopulate(val, \"MigrationType\", &m.MigrationType)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7d7fc548d1184abf71b08d1b04c9c1ed", "score": "0.5803362", "text": "func (a *ActivityCustomEntityQuery) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"etag\":\n\t\t\terr = unpopulate(val, \"Etag\", &a.Etag)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &a.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"kind\":\n\t\t\terr = unpopulate(val, \"Kind\", &a.Kind)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &a.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &a.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &a.SystemData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &a.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "44c2d2c081f9fef4e92f439d543d0cce", "score": "0.5803287", "text": "func (m *MCASCheckRequirementsProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &m.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c30af575a16541d68a18cfd9cbf15cd5", "score": "0.58002275", "text": "func (u *UserProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", u, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"publishingPassword\":\n\t\t\terr = unpopulate(val, \"PublishingPassword\", &u.PublishingPassword)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"publishingPasswordHash\":\n\t\t\terr = unpopulate(val, \"PublishingPasswordHash\", &u.PublishingPasswordHash)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"publishingPasswordHashSalt\":\n\t\t\terr = unpopulate(val, \"PublishingPasswordHashSalt\", &u.PublishingPasswordHashSalt)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"publishingUserName\":\n\t\t\terr = unpopulate(val, \"PublishingUserName\", &u.PublishingUserName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"scmUri\":\n\t\t\terr = unpopulate(val, \"ScmURI\", &u.ScmURI)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", u, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7f33d2b5add3b9aa5a73d1b86a917cf5", "score": "0.5793116", "text": "func (i *IssueContractBaseProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"apiId\":\n\t\t\terr = unpopulate(val, \"APIID\", &i.APIID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"createdDate\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"CreatedDate\", &i.CreatedDate)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"state\":\n\t\t\terr = unpopulate(val, \"State\", &i.State)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6684fefcbbd675723874b3a45b57a264", "score": "0.5792675", "text": "func (r *RegistryKeyEntityProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"additionalData\":\n\t\t\terr = unpopulate(val, \"AdditionalData\", &r.AdditionalData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"friendlyName\":\n\t\t\terr = unpopulate(val, \"FriendlyName\", &r.FriendlyName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"hive\":\n\t\t\terr = unpopulate(val, \"Hive\", &r.Hive)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"key\":\n\t\t\terr = unpopulate(val, \"Key\", &r.Key)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4862fa10181917da7520f1029907a94c", "score": "0.57881784", "text": "func (i *IdentityProviderUpdateParameters) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &i.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f49283cd0e5f69225c698babdac692f8", "score": "0.5783143", "text": "func (u *UserUpdateParametersProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", u, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"email\":\n\t\t\terr = unpopulate(val, \"Email\", &u.Email)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"firstName\":\n\t\t\terr = unpopulate(val, \"FirstName\", &u.FirstName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"identities\":\n\t\t\terr = unpopulate(val, \"Identities\", &u.Identities)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"lastName\":\n\t\t\terr = unpopulate(val, \"LastName\", &u.LastName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"note\":\n\t\t\terr = unpopulate(val, \"Note\", &u.Note)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"password\":\n\t\t\terr = unpopulate(val, \"Password\", &u.Password)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"state\":\n\t\t\terr = unpopulate(val, \"State\", &u.State)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", u, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2703e9dc3f61d3628f95ab8b10fdf4b8", "score": "0.57688534", "text": "func (a *AddonSrmProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"addonType\":\n\t\t\terr = unpopulate(val, \"AddonType\", &a.AddonType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"licenseKey\":\n\t\t\terr = unpopulate(val, \"LicenseKey\", &a.LicenseKey)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"provisioningState\":\n\t\t\terr = unpopulate(val, \"ProvisioningState\", &a.ProvisioningState)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9010164cc67da9d7acda67f55af811f2", "score": "0.5767325", "text": "func (s *StaticSiteUserARMResourceProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"displayName\":\n\t\t\terr = unpopulate(val, \"DisplayName\", &s.DisplayName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"provider\":\n\t\t\terr = unpopulate(val, \"Provider\", &s.Provider)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"roles\":\n\t\t\terr = unpopulate(val, \"Roles\", &s.Roles)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"userId\":\n\t\t\terr = unpopulate(val, \"UserID\", &s.UserID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "95e80e677778d85117750f4c7167e0e1", "score": "0.57634073", "text": "func (o *MonitorSearchCountItem) UnmarshalJSON(bytes []byte) (err error) {\n\traw := map[string]interface{}{}\n\tall := struct {\n\t\tCount *int64 `json:\"count,omitempty\"`\n\t\tName interface{} `json:\"name,omitempty\"`\n\t}{}\n\terr = json.Unmarshal(bytes, &all)\n\tif err != nil {\n\t\terr = json.Unmarshal(bytes, &raw)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\to.UnparsedObject = raw\n\t\treturn nil\n\t}\n\to.Count = all.Count\n\to.Name = all.Name\n\treturn nil\n}", "title": "" }, { "docid": "d8cb7d2abbea610020ff39b0d49c8aaa", "score": "0.5759913", "text": "func (d *Dynamics365CheckRequirementsProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", d, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &d.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", d, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ba82680788533058323834569acd9afd", "score": "0.5752845", "text": "func (d *DeletedAppRestoreRequestProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", d, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"deletedSiteId\":\n\t\t\terr = unpopulate(val, \"DeletedSiteID\", &d.DeletedSiteID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoverConfiguration\":\n\t\t\terr = unpopulate(val, \"RecoverConfiguration\", &d.RecoverConfiguration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"snapshotTime\":\n\t\t\terr = unpopulate(val, \"SnapshotTime\", &d.SnapshotTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"useDRSecondary\":\n\t\t\terr = unpopulate(val, \"UseDRSecondary\", &d.UseDRSecondary)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", d, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b814880c411cd4d917256bd02b8072e1", "score": "0.57512635", "text": "func (p *PlaybookActionProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"logicAppResourceId\":\n\t\t\terr = unpopulate(val, \"LogicAppResourceID\", &p.LogicAppResourceID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &p.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9165863e46c4fe7ab257c4b0e2b7bfb2", "score": "0.5745508", "text": "func (v *Property) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC0e5e3f1DecodeGithubComSkydiveProjectSkydiveGraffitiStorageOrientdb(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "8e47d43e06ca023f3e961c447664b91b", "score": "0.57448095", "text": "func (w *WebJobProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"error\":\n\t\t\terr = unpopulate(val, \"Error\", &w.Error)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"extra_info_url\":\n\t\t\terr = unpopulate(val, \"ExtraInfoURL\", &w.ExtraInfoURL)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"run_command\":\n\t\t\terr = unpopulate(val, \"RunCommand\", &w.RunCommand)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"settings\":\n\t\t\terr = unpopulate(val, \"Settings\", &w.Settings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"url\":\n\t\t\terr = unpopulate(val, \"URL\", &w.URL)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"using_sdk\":\n\t\t\terr = unpopulate(val, \"UsingSdk\", &w.UsingSdk)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"web_job_type\":\n\t\t\terr = unpopulate(val, \"WebJobType\", &w.WebJobType)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0465c8eb8dcc670561b24145f3996621", "score": "0.5744184", "text": "func (d *DatastoreProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", d, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"diskPoolVolume\":\n\t\t\terr = unpopulate(val, \"DiskPoolVolume\", &d.DiskPoolVolume)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"netAppVolume\":\n\t\t\terr = unpopulate(val, \"NetAppVolume\", &d.NetAppVolume)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"provisioningState\":\n\t\t\terr = unpopulate(val, \"ProvisioningState\", &d.ProvisioningState)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &d.Status)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", d, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ca8318a2184adc042ae74a80eae9e6ed", "score": "0.5744077", "text": "func (e *EntityQueryList) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", e, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &e.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\te.Value, err = unmarshalEntityQueryClassificationArray(val)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", e, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e04827644f01121431c707b696572f4a", "score": "0.5743497", "text": "func (a *AccountUpdateProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"disableLocalAuth\":\n\t\t\terr = unpopulate(val, \"DisableLocalAuth\", &a.DisableLocalAuth)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"encryption\":\n\t\t\terr = unpopulate(val, \"Encryption\", &a.Encryption)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"publicNetworkAccess\":\n\t\t\terr = unpopulate(val, \"PublicNetworkAccess\", &a.PublicNetworkAccess)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sku\":\n\t\t\terr = unpopulate(val, \"SKU\", &a.SKU)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
1c85fcc7061032292b6121bd6d445f49
Test: hello world, the web server
[ { "docid": "c980af9298d5dbbe437407dbecd5af0c", "score": "0.6447234", "text": "func HelloServer(w http.ResponseWriter, req *http.Request) {\n\tw.Write([]byte(\"hello back\"))\n}", "title": "" } ]
[ { "docid": "a92619b9fb96023169b17afc9d6f2deb", "score": "0.7447166", "text": "func startTestWebServer() {\n\thttp.HandleFunc(\"/\", handler)\n\tgo func() {\n\t\thttp.ListenAndServe(\":5000\", nil)\n\t}()\n}", "title": "" }, { "docid": "7c29a213abca6b01df93d8362bebfab5", "score": "0.72157454", "text": "func main() {\r\n\thttp.HandleFunc(\"/\", handlerIndex)\r\n\thttp.HandleFunc(\"/index\", handlerIndex)\r\n\thttp.HandleFunc(\"/hello\", handlerHello)\r\n\r\n\tvar server = \"localhost:9000\"\r\n\tfmt.Println(\"server started at\", server)\r\n\terr := http.ListenAndServe(server, nil)\r\n\tif err != nil {\r\n\t\tfmt.Println(err.Error())\r\n\t}\r\n}", "title": "" }, { "docid": "dba7beb273ab1e69c5a7c2d613c6f809", "score": "0.7193965", "text": "func main() {\n\thttp.HandleFunc(\"/\", HelloServer)\n\tlog.Fatal(http.ListenAndServe(\":80\", nil))\n}", "title": "" }, { "docid": "4cb5c484e9ec4eccc1c95dc937116a61", "score": "0.71711934", "text": "func main() {\n\tlistenAddr := fmt.Sprintf(\":%v\", defaultPort)\n\t// check ENV PORT for the PORT to use for listening to connection\n\tval, exist := os.LookupEnv(\"PORT\")\n\tif exist {\n\t\tport, err := strconv.Atoi(val)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"ERROR: CONFIG ENV PORT should contain a valid integer value !\")\n\t\t}\n\t\tlistenAddr = fmt.Sprintf(\":%v\", port)\n\t}\n\n\t/* section above is to illustrate and test the template\n\tmsg, err := getHelloMsg(\"toto\")\n\tif err != nil {\n\t\tfmt.Errorf(\"ERROR doing getHelloMsg : %q\", err)\n\t}\n\tfmt.Println(msg)\n\t*/\n\n\thttp.HandleFunc(\"/hello\", helloWorldHandler)\n\tlog.Printf(\" ### Starting server... try navigating to http://localhost%v/hello to be greeted\", listenAddr)\n\tlog.Fatal(http.ListenAndServe(listenAddr, nil))\n}", "title": "" }, { "docid": "4283df7e491eaa2e31c898b7dd17ad4b", "score": "0.71590996", "text": "func main() {\n\thttp.HandleFunc(\"/hello\", func(writer http.ResponseWriter, request *http.Request) {\n\t\twriter.Write([]byte(\"hello world!\\n\"))\n\t})\n\n\tif err := http.ListenAndServe(\":8080\", nil); err != nil {\n\t\tpanic(err)\n\t}\n\n}", "title": "" }, { "docid": "f75c38f10c9a51ec58c2a9324889d90a", "score": "0.7128752", "text": "func main() {\n\thttp.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Write([]byte(\"Hello World\"))\n\t})\n\n\thttp.ListenAndServe(\":8888\", nil)\n}", "title": "" }, { "docid": "57ee547f224c35a342c03d5704187e7e", "score": "0.70249254", "text": "func main() {\n\thandler := func(resp http.ResponseWriter, req *http.Request) {\n\t\tresp.Header().Add(\"Content-Type\", \"text/html\")\n\t\tresp.WriteHeader(http.StatusOK)\n\t\tfmt.Fprint(resp, \"Hello from Go!\")\n\t}\n\n\tfmt.Println(\"running on port 4040\")\n\thttp.ListenAndServe(\":4040\", http.HandlerFunc(handler))\n}", "title": "" }, { "docid": "76bab4051b74485222dd2c4a1b0fd153", "score": "0.702097", "text": "func main() {\n\tvar h Hello\n\terr := http.ListenAndServe(\"localhost:4000\", h) // 第二个参数为: handler Handler\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "c5cea7e6367907adde285901af042eb0", "score": "0.6965461", "text": "func TestGetHelloWorldRoute(t *testing.T) {\n\n\tts := httptest.NewServer(Handler())\n\tdefer ts.Close()\n\n\tres, err := http.Get(fmt.Sprintf(\"%s/helloworld\", ts.URL))\n\tassert.NoError(t, err, \"Could not GET /helloworld\")\n\tdefer res.Body.Close()\n\n\tassert.Equal(t, http.StatusOK, res.StatusCode)\n\n\tb, err := ioutil.ReadAll(res.Body)\n\tassert.NoError(t, err, \"Could read response\")\n\n\tassert.Equal(t, \"\\\"Hello world\\\"\\n\", string(b))\n}", "title": "" }, { "docid": "df13d55b7820fc1a0facae34a1e6edb7", "score": "0.69654363", "text": "func startTestServer(c chan bool) {\n\tm := http.NewServeMux()\n\n\tm.HandleFunc(\"/index\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"X-Request-Method\", r.Method)\n\t\tw.WriteHeader(http.StatusOK)\n\n\t\tif r.Method == http.MethodPost {\n\t\t\tb, err := ioutil.ReadAll(r.Body)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tfmt.Fprintf(w, \"POST %s\", b)\n\t\t} else {\n\t\t\tfmt.Fprintf(w, \"%s Hello World\", r.Method)\n\t\t}\n\n\t})\n\n\tm.HandleFunc(\"/error\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(404)\n\t\tfmt.Fprint(w, \"oops\")\n\t})\n\n\tm.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Println(r.URL.Path)\n\t})\n\n\tc <- true\n\n\thttp.ListenAndServe(\":3000\", m)\n}", "title": "" }, { "docid": "5b3a62874d7f944bfd91888c5e863534", "score": "0.696178", "text": "func TestIndex(t *testing.T) {\n\tr := SetupRouter()\n\tw := Get(\"/\", r)\n\tassert.Equal(t, 200, w.Code)\n\tassert.Equal(t, \"hello world\", w.Body.String())\n}", "title": "" }, { "docid": "4db5dba28f8e3225ebe6deaf066e24d2", "score": "0.68957394", "text": "func TestMain(m *testing.M) {\n\thttpServer = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tdata, _ := ioutil.ReadAll(r.Body)\n\t\tdefer r.Body.Close()\n\t\t// put request and body to channel for the client to investigate them\n\t\trequestChan <- &RequestData{r, string(data)}\n\n\t\tfmt.Fprintf(w, responseBody)\n\t}))\n\tdefer httpServer.Close()\n\n\tos.Exit(m.Run())\n}", "title": "" }, { "docid": "91bbc0978c98fce5c7e4a9c38918d40e", "score": "0.6816681", "text": "func helloWorld(w http.ResponseWriter, r *http.Request) {\r\n\tfmt.Fprintf(w, \"Welcome World!\")\r\n\tfmt.Println(\"Endpoint Hit: homePage\")\r\n}", "title": "" }, { "docid": "1375d92e0948d1be3483bad44ae14819", "score": "0.681186", "text": "func TestMainHandler(t *testing.T) {\n\tr := httptest.NewRequest(\"GET\", \"http://0.0.0.0:5000/\", nil)\n\tw := httptest.NewRecorder()\n\n\tmainHandler(w, r)\n\n\tif w.Code != http.StatusOK {\n\t\tt.Errorf(\"Invalid code on requesting /. %d\", w.Code)\n\t}\n\n\ttitle, _, _ := getHTMLTag(w.Result().Body, \"title\")\n\tif title != \"uAdmin - Login\" {\n\t\tt.Errorf(\"Invalid page returned. Expected Login, got (%s)\", title)\n\t}\n}", "title": "" }, { "docid": "3efd99859f1431f9165665c37ac2e0e5", "score": "0.679227", "text": "func\tmain() {\n http.HandleFunc(\"/hello\", ft_hello)\n\thttp.HandleFunc(\"/weather/\", ft_weather)\n\thttp.HandleFunc(\"/test/\", func (w http.ResponseWriter, r *http.Request){\n\t\tw.Write([]byte(\"It's working!\"))\n\t})\n http.ListenAndServe(\":8080\", nil)\n}", "title": "" }, { "docid": "0f52e8baaddec7710c21326e25ef13a4", "score": "0.6785286", "text": "func main() {\n\thttp.Handle(\"/echo\", websocket.Handler(EchoServer))\n\taddr := \":12345\"\n\tfmt.Printf(\"server handling /echo, listening on '%s'\\n\", addr)\n\terr := http.ListenAndServe(addr, nil)\n\tif err != nil {\n\t\tpanic(\"ListenAndServe: \" + err.Error())\n\t}\n}", "title": "" }, { "docid": "235cdd0679cdf535aeeec9d4ccff1866", "score": "0.6771059", "text": "func HelloServerMain() {\n\thttp.HandleFunc(\"/\", hello)\n\thttp.ListenAndServe(\"localhost:4000\", nil)\n\tfmt.Println(\"Server listening on port 4000...\")\n}", "title": "" }, { "docid": "38f4ecd3affa13d808a3286025ede4d8", "score": "0.6763001", "text": "func main() {\n\thttp.HandleFunc(\"/\", requestHandler)\n\tlog.Fatal(http.ListenAndServe(\"localhost:8000\", nil))\n}", "title": "" }, { "docid": "fd3e3d32dbb51870bc3e4d6e7987873b", "score": "0.67519814", "text": "func main() {\n\tl := log.New(os.Stdout, \"product-api\", log.LstdFlags)\n\thh := handlers.NewHello(l) //reference to the new handler\n\tgh := handlers.Goodbye(l)\n\n\t//new servemux and implements handler interface\n\tsm := http.NewServeMux()\n\tsm.Handle(\"/\", hh)\n\tsm.Handle(\"/goodbye\", gh)\n\n\ts := &http.Server{}\n\n\t// Listen for connections on all ip addresses (0.0.0.0)\n\t// port 9090\n\tlog.Println(\"Starting Server\")\n\terr := http.ListenAndServe(\":9090\", nil)\n\tlog.Fatal(err)\n}", "title": "" }, { "docid": "dda4cd4f4f5772b1eb43e22de7ce964b", "score": "0.67350173", "text": "func main() {\n\t// Router\n\tr := &http.ServeMux{}\n\tr.HandleFunc(\"/\", rootHandler)\n\tr.HandleFunc(\"/api\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Write([]byte(\"API\"))\n\t})\n\tr.Handle(\"/hello\", &helloHandler{})\n\n\t// Start the HTTP server\n\thttp.ListenAndServe(\":8080\", r)\n\t// l, _ := net.Listen(\"tcp\", \":8080\")\n\t// http.Serve(l, r)\n}", "title": "" }, { "docid": "7e805d4da8ab775574ca6450c2008d2d", "score": "0.67160547", "text": "func main() {\n\t\n\thost := os.Getenv(\"HOST\")\n\tport := os.Getenv(\"PORT\")\n\t\n\t// Default to port:\n\tif port == \"\" { port = \"8080\" }\n\t\n\t// Set the hostname provided by the URL shortening service\n\tif host == \"\" {\n\t\tfmt.Println(\"No HOST env variable given; setting localhost as host on port \" + port)\n\t\thandlers.SetHost(\"http://localhost:\" + port + \"/\")\n\t} else {\n\t\tfmt.Println(\"Setting host: \" + host)\n\t\thandlers.SetHost(host)\n\t}\n\t\n\tregisterRoutes()\n\n // (Try to) Start the web server\n fmt.Println(\"Starting server on port \" + port)\n err := http.ListenAndServe(\":\" + port, nil)\n if err != nil {\n\t\tpanic(err)\n }\n}", "title": "" }, { "docid": "3508d0d02df1627173c8bfbf08a2e2f3", "score": "0.67153203", "text": "func TestServer(t *testing.T) {\n\n}", "title": "" }, { "docid": "f735f5c0eb47112049103c03b71d4374", "score": "0.6684176", "text": "func main() {\n\taddr := httpd.ProvideListeningAddr()\n\tvar port string\n\n\tif len(os.Args) > 1 {\n\t\tport = os.Args[1]\n\t} else {\n\t\tport = httpd.ListeningPort\n\t}\n\n\tlog.Println(\"Listening: \" + addr + \":\" + port)\n\techo := httpd.Echo{ addr }\n\n\thttp.Handle(\"/string\", httpd.String(httpd.Always))\n\thttp.Handle(\"/echo\", &echo)\n\n\terr := http.ListenAndServe(addr + \":\" + port, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "42d0a4d50fca53646426b1db4f258c85", "score": "0.66783625", "text": "func (s *Server) Run(port int) {\n\ts.router.Methods(\"GET\").Path(\"/\").Name(\"hello\").Handler(http.HandlerFunc(helloworld))\n\ts.server = &http.Server{Addr: fmt.Sprintf(\":%d\", port), Handler: s.router}\n\terr := s.server.ListenAndServe()\n\tif err != nil {\n\t\tfmt.Print(\"init fail :\", err)\n\t}\n}", "title": "" }, { "docid": "17404cf4efc9f52dd340eaa8678f6c6e", "score": "0.66699886", "text": "func main() {\n\t// First, we create a new Cookoo app.\n\treg, router, cxt := cookoo.Cookoo()\n\n\t// We declare a route that answers GET requests for the path /\n\t//\n\t// By default, this will be running on http://localhost:8080/\n\treg.Route(\"GET /\", \"Simple test route.\").\n\t\tDoes(web.Flush, \"out\").\n\t\t\tUsing(\"content\").WithDefault(\"OH HAI!\")\n\n\t// We declare a route that answers GET requests for the path /test\n\t// This one uses a basic template.\n\t//\n\t// By default, this will be running on http://localhost:8080/\n\t//\n\t// Because we use `query:you`, try hitting the app on this URL:\n\t// http://localhost:8080/test?you=Matt\n\treg.Route(\"GET /test\", \"Simple test route.\").\n\t\tDoes(fmt.Template, \"content\").\n\t\t\tUsing(\"template\").WithDefault(\"Hello {{.you}}\").\n\t\tUsing(\"you\").WithDefault(\"test\").From(\"query:you\").\n\t\tDoes(web.Flush, \"out\").\n\t\t\tUsing(\"content\").From(\"cxt:content\")\n\n\t// Start the server.\n\tweb.Serve(reg, router, cxt)\n}", "title": "" }, { "docid": "5c4bd35df93e69c62438ef0b65ccc869", "score": "0.66690534", "text": "func main() {\n\tfmt.Println(\"Hi\")\n\tu := models.User{\n\t\tID: 2,\n\t}\n\n\tfmt.Println(u)\n\n\tport := 3000\n\tretry := 2\n\n\tstartWebServer(port, retry)\n\tstartWebServerWithShortInitSyntax(port, retry)\n\n\tsumOfNumbers := sum(1, 2)\n\tfmt.Println(\"Sum of two numbers is : \", sumOfNumbers)\n\n}", "title": "" }, { "docid": "9e20ae88aa77c83feff2d4bc9aaba296", "score": "0.6652733", "text": "func main() {\n\n\thandlerfunc := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintf(w, \"DevopsBH for Golang simple two %s\\n\", r.URL.Path)\n\t\t//w.Write([]byte(\"outra forma de escrever..\"))\n\t\t//io.WriteString(w, \"outra forma de escrever..\")\n\t})\n\n\tlog.Printf(\"\\nServer run 8080\\n\")\n\terr := http.ListenAndServe(\":8080\", handlerfunc)\n\tlog.Fatal(err)\n}", "title": "" }, { "docid": "9ca4704dcead52188b7d17d20ede2ef6", "score": "0.6643965", "text": "func main() {\n\tfmt.Println(\"APPLICATION BEGIN\")\n\twebserver := new(service.Webserver)\n\tregisterConfig()\n\tregisterErrors()\n\tregisterAllApis()\n\twebserver.Start()\n}", "title": "" }, { "docid": "ef0eb81628fa298267cfa531af5ef71a", "score": "0.6614019", "text": "func TestServer(t *testing.T) {\n\tws := new(restful.WebService)\n\tws.Route(ws.GET(\"/secret\").Filter(authJWT).To(secretJWT))\n\trestful.Add(ws)\n\tgenJWT(\"admin\")\n\tlog.Fatal(http.ListenAndServe(\":8080\", nil))\n}", "title": "" }, { "docid": "d2658eae146731ac92c2679cecaadacb", "score": "0.66089314", "text": "func main() {\n\te := echo.New()\n\te.GET(\"/\", hello)\n\te.GET(\"/cats/:data\", getCats)\n\te.Start(\":1323\")\n}", "title": "" }, { "docid": "0743934fb4a8c0597bea5366d4d41031", "score": "0.6599112", "text": "func TestMain(m *testing.M) {\n\tgoTest = true\n\trouter := NewRouter()\n\tgo http.ListenAndServe(\":\"+localport, router)\n\tos.Exit(m.Run())\n}", "title": "" }, { "docid": "193b56c857f972bcfe38d4287d968000", "score": "0.65983087", "text": "func TestMain_Index(t *testing.T) {\n\trouter := SetUpRouter()\n\tw := performRequest(router, \"GET\", \"/\")\n\n\tassert.Equal(t, http.StatusOK, w.Code)\n}", "title": "" }, { "docid": "c5f5103f6ec37a4ab7b4324df70f835b", "score": "0.6589041", "text": "func main() {\n\n\tr := mux.NewRouter()\n\tr.HandleFunc(\"/\", HomeHandler)\n\n\t//Pass mux to http\n\thttp.Handle(\"/\", r)\n\tportStr := strconv.Itoa(port)\n\n\tlog.Print(\"Starting web service on \" + portStr + \" ... \")\n\n\terr := http.ListenAndServe(\":\"+portStr, nil)\n\n\tif err != nil {\n\t\tlog.Fatal(\"Could not start the web service: \", err)\n\t}\n}", "title": "" }, { "docid": "ecfe40d73f944331a8b9f4792660199a", "score": "0.65824807", "text": "func main(){\n\n\thttp.HandleFunc(\"/\", func (w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintf(w, \"Welcome to my website!\")\n\t})\n\n\tfs := http.FileServer(http.Dir(\"static/\"))\n\thttp.Handle(\"/static/\", http.StripPrefix(\"/static/\", fs))\n\n\thttp.ListenAndServe(\":8080\", nil)\n\n}", "title": "" }, { "docid": "2f576c8217fabb7016f7ffe6ce49be72", "score": "0.65793663", "text": "func main() {\n\tview.StartServer()\n}", "title": "" }, { "docid": "f7f548f90dde2914649ab6f311f9cabf", "score": "0.6577503", "text": "func main() {\n\tdata := \"Test\"\n\twriteFile(\"html/test.html\", data)\n\t// router := mux.NewRouter()\n\t// router.HandleFunc(\"/\", renderTemplate).Methods(\"GET\")\n\t// log.Fatal(http.ListenAndServe(\":8000\", router))\n}", "title": "" }, { "docid": "cd0f2b0cd7c1287309784fcde713df26", "score": "0.65670115", "text": "func (d *HelloWorld) Main(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"Hello world\"))\n}", "title": "" }, { "docid": "63ec2d87dcc381c5922c37aa000fe5e2", "score": "0.6564727", "text": "func main() {\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"/\", home)\n\n\tlog.Println(\"Starting server on :4455\")\n\terr := http.ListenAndServe(\":4455\", mux)\n\tlog.Fatal(err)\n}", "title": "" }, { "docid": "f6bb5fa88750cfa32732ec47064b397f", "score": "0.65548885", "text": "func startDynamicTestWebServer() {\n\n\thttp.HandleFunc(\"/dyn\", handler)\n\tgo func() {\n\t\thttp.ListenAndServe(\":9090\", nil)\n\t}()\n}", "title": "" }, { "docid": "4ff25a0eb5fb6918d09c5ced52880a5c", "score": "0.65507746", "text": "func HelloServer(w http.ResponseWriter, req *http.Request) {\n\tio.WriteString(w, \"hello, \"+req.URL.Query().Get(\":name\")+\"!\\n\")\n}", "title": "" }, { "docid": "001405821da7893633c7bd7ab5e86c72", "score": "0.6549369", "text": "func main() {\n\tserver := http.Server{\n\t\tAddr: \"127.0.0.1:8080\",\n\t}\n\thttp.HandleFunc(\"/body\", body)\n\tserver.ListenAndServe()\n}", "title": "" }, { "docid": "f437ac3fa4beb505f3fd46bbfb52c52c", "score": "0.65469164", "text": "func main() {\n\thttp.HandleFunc(\"/\", serveTemplate)\n\thttp.ListenAndServe(\":8080\", nil)\n}", "title": "" }, { "docid": "000e14c02e03e7e0675ad7ebc33bb830", "score": "0.6544086", "text": "func main() {\n\tr := setupRouter()\n\tr.Run(\":8080\")\n}", "title": "" }, { "docid": "bc3711cd8f46a8ed253ecd9369dd885f", "score": "0.6543008", "text": "func main() {\n\trunserver()\n}", "title": "" }, { "docid": "1d4c5d380cac8e48f0c5337bacc9dfc9", "score": "0.6538048", "text": "func main() {\n\tctx := context.Background()\n\n\ts := newServer(ctx)\n\n\ts.mux.GET(\"/\", s.index())\n\t\n\tport := \":8050\"\n\tif os.Getenv(\"PRODUCTION\") == \"true\" {\n\t\tport = \":80\"\n\t}\n\n s.log.Fatal(http.ListenAndServe(port, s.mux))\n}", "title": "" }, { "docid": "c6907cdd7f028d7c483941ae2668edb8", "score": "0.65338004", "text": "func main() {\n\t// define the URL handler\n\ta := App{}\n\ta.Init()\n\t// launch the http server\n\tmyport := os.Getenv(\"PORT\")\n\tif myport == \"\" {\n\t\tmyport = \":8080\"\n\t} else {\n\t\tmyport = \":\" + myport\n\t}\n\tlog.Printf(\"Server started on %s \\n\", myport)\n\tlog.Fatal(http.ListenAndServe(myport, a.router))\n}", "title": "" }, { "docid": "eb8c2b10dbc948769dbe950094c70fcb", "score": "0.65321654", "text": "func main() {\n\tr := &http.ServeMux{}\n\tr.HandleFunc(\"/\", indexHandler)\n\thttp.ListenAndServe(\":8080\", r)\n}", "title": "" }, { "docid": "edb51d8aee5924a3ef46b5119115dbcf", "score": "0.65309304", "text": "func TestHandler(t *testing.T) {\n\t_, err := db.DbInit() // DBコネクションをとっておく\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdb.InitRedis() // Redisコネクションをとっておく\n\tdb.InitMemcache() // Memcachedコネクションをとっておく\n\tdata.InitSession() // Sessionコネクションをとっておく\n\tcommon.InitValidater() // Valideterコネクションをとっておく\n\thttp.Handle(\"/resources/\", http.StripPrefix(\"/resources/\", http.FileServer(http.Dir(\"resources/\"))))\n\n\tt.Run(\"controller.HelloViewHandler\", func(t *testing.T) {\n\t\tt.Parallel()\n\n\t\ts := httptest.NewServer(http.HandlerFunc(controller.HelloViewHandler))\n\t\tdefer s.Close()\n\n\t\tres, err := http.Get(s.URL)\n\t\tassert.NoError(t, err)\n\t\tassert.Equal(t, \"text/plain\", res.Header.Get(\"Content-Type\"))\n\t\tassert.Equal(t, 200, res.StatusCode)\n\t\tdefer res.Body.Close()\n\t\tbody, err := ioutil.ReadAll(res.Body)\n\t\tassert.NoError(t, err)\n\t\tassert.Equal(t, \"pong\", string(body))\n\t})\n\n}", "title": "" }, { "docid": "420ea90b158ef80a1063f828e0af10f0", "score": "0.6527941", "text": "func HelloServer(w http.ResponseWriter, req *http.Request) {\n\tio.WriteString(w, \"Well hello, world!\\n\")\n}", "title": "" }, { "docid": "9fa571cbd4488c934270e3259a526822", "score": "0.65238476", "text": "func main() {\n\t// URL handlers\n\thttp.HandleFunc(\"/\", indexHandler)\n\thttp.HandleFunc(\"/get_url/\", getUrlHandler)\n\thttp.HandleFunc(\"/minskew/\", minskewHandler)\n\n\t// file server: provides CSS/JS/img files + plots generated by the server\n\t_ = os.MkdirAll(Plots, 0o755)\n\thttp.Handle(PlotRoot, http.StripPrefix(PlotRoot, http.FileServer(http.Dir(\"./\"+Plots))))\n\thttp.Handle(SiteRoot, http.StripPrefix(SiteRoot, http.FileServer(http.Dir(\"./\"+SiteAssets))))\n\n\t// set up port\n\tport, ok := os.LookupEnv(\"PORT\")\n\tif !ok {\n\t\tport = \"8080\"\n\t}\n\tport = \":\" + port\n\n\t// output\n\tfmt.Println(\"Now running on http://localhost\" + port)\n\tfmt.Println()\n\tfmt.Println(\"HTTP Actions:\")\n\n\t// start the web server\n\thttp.ListenAndServe(port, nil)\n}", "title": "" }, { "docid": "ad34faba357e3900b049a19c1d8d519c", "score": "0.65205985", "text": "func (h *Handler) HelloWorld(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprint(w, \"Hello World with a simple Golang web server.\")\n}", "title": "" }, { "docid": "916ac42562f25d1a1a0d83ffe33098fc", "score": "0.65119183", "text": "func main() {\n\thttp.Handle(\"/echo\", websocket.Handler(EchoServer))\n\thttp.Handle(\"/nonstop\", websocket.Handler(nonStop))\n\terr := http.ListenAndServe(\":12345\", nil)\n\tif err != nil {\n\t\tpanic(\"ListenAndServe: \" + err.Error())\n\t}\n}", "title": "" }, { "docid": "8f8355e71d25004483d2087916778a27", "score": "0.65091896", "text": "func HelloServer(w http.ResponseWriter, req *http.Request) {\n\tio.WriteString(w, \"hello, world!\\n\")\n}", "title": "" }, { "docid": "2a56621b96ecd4db55d140d1eec88d44", "score": "0.65011024", "text": "func main() {\n\thttp.HandleFunc(\"/\", handler)\n\thttp.ListenAndServe(\":8080\", nil)\n}", "title": "" }, { "docid": "2a56621b96ecd4db55d140d1eec88d44", "score": "0.65011024", "text": "func main() {\n\thttp.HandleFunc(\"/\", handler)\n\thttp.ListenAndServe(\":8080\", nil)\n}", "title": "" }, { "docid": "a7ae610ef9428f8dab557fe864b10d46", "score": "0.6491752", "text": "func main() {\n\thttp.Handle(\"/\", websocket.Handler(EchoServer))\n\terr := http.ListenAndServe(\":80\", nil)\n\tif err != nil {\n\t\tpanic(\"ListenAndServe: \" + err.Error())\n\t}\n}", "title": "" }, { "docid": "b620b3e4297dcd559124607d2a391a10", "score": "0.64900064", "text": "func main() {\n\thttp.HandleFunc(\"/\", fizzBuzzHandler)\n\n\tlog.Println(\"Starting server on port\", port)\n\n\tlog.Fatal(http.ListenAndServe(\":\" + strconv.Itoa(port), nil))\n}", "title": "" }, { "docid": "0028901676f733de75b20c69faa37f36", "score": "0.6468286", "text": "func HelloServer(w http.ResponseWriter, r *http.Request) {\n\tbody, _ := ioutil.ReadAll(r.Body)\n\tdefer r.Body.Close()\n\tbody_str := string(body)\n\tfmt.Println(body_str)\n\tw.Write([]byte(\"Hello World!\"))\n}", "title": "" }, { "docid": "4bc026fdefe8c960003cea61a7d554b4", "score": "0.64512503", "text": "func main() {\n\thttp.HandleFunc(\"/\", indexHandler)\n\tappengine.Main() // Starts the server to receive requests\n}", "title": "" }, { "docid": "1fb201e0cceac8a5500b82074fc7c427", "score": "0.64504576", "text": "func main() {\n\tloadEnv()\n\tr := gin.Default()\n\n\tr.GET(\"/pucsd\", myResponse) // endpoint\n\n\tr.Run(\":8080\") // server is starting at 8080 port\n}", "title": "" }, { "docid": "cd387c9c788524dcb65971875dd7350b", "score": "0.64473796", "text": "func main() {\n\tport := os.Getenv(\"PORT\")\n\tif port == \"\" {\n\t\tport = \"9090\"\n\t\tlog.Printf(\"Defaulting to port %s\", port)\n\t}\n\n\tlog.Printf(\"Listening on port %s\", port)\n\tlog.Printf(\"Start here: http://localhost:%s/signup\", port)\n\tlog.Fatal(http.ListenAndServe(fmt.Sprintf(\":%s\", port), nil))\n}", "title": "" }, { "docid": "2251f1502b71f4deb122d69e372f2811", "score": "0.6447019", "text": "func main() {\n\thttp.HandleFunc(\"/\", Home)\n\thttp.HandleFunc(\"/about\", About)\n\n\tfmt.Println(fmt.Sprintf(\"Starting application on prot %s\", portNumber))\n\t_ = http.ListenAndServe(portNumber, nil)\n}", "title": "" }, { "docid": "8d6f0912c57858026f73d69778eac587", "score": "0.64372087", "text": "func TestHelloName(t *testing.T) {\n\tmain()\n}", "title": "" }, { "docid": "85aceaf2979134cbfaf50b540770503a", "score": "0.64250386", "text": "func runApiTest() {\n\tresp, err := http.Get(\"http://localhost:8080/time\")\n\tif err != nil {\n\t\tlog.Fatal(\"got error in running test, err: \" + err.Error())\n\t}\n\tif resp != nil {\n\t\tdefer resp.Body.Close()\n\t}\n}", "title": "" }, { "docid": "1e5535c02150ad6370a5dd2c945e2f57", "score": "0.6423014", "text": "func main() {\n\thttp.HandleFunc(\"/\", someFunc)\n\thttp.ListenAndServe(\":8080\", nil)\n}", "title": "" }, { "docid": "4ed71be2023e1b4e9e646eb7caa70aa5", "score": "0.64153016", "text": "func TestServer(t *testing.T) {\n\tif testing.Short() {\n\t\tt.Skip()\n\t}\n\n\ttestServer(t)\n}", "title": "" }, { "docid": "42e4ea6bd0493e1229f86f2c69132bc1", "score": "0.6408663", "text": "func main() {\n\n\tfmt.Println(\"Starting Restful services...\")\n\tfmt.Println(\"Using port:8080\")\n\thandleRequests()\n}", "title": "" }, { "docid": "1fa5c116c52195a73737a13fb31cd30f", "score": "0.64084023", "text": "func main() {\n\terr := http.ListenAndServe(\":51234\", Handler())\n\tif err != nil {\n\t\tlog.Fatalf(\"[ERROR] %v\\n\", err)\n\t}\n}", "title": "" }, { "docid": "68a7b56f9effc3ef1ebb8880b0e0d7dd", "score": "0.6402855", "text": "func main() {\n\t// serve the client.html\n\thttp.Handle(\"/\", http.FileServer(http.Dir(\"static\")))\n\n\twsSever := websocket.Server{\n\t\tHandler: ChatServer,\n\t}\n\thttp.Handle(\"/ws\", wsSever)\n\n\tlog.Println(\"Listening on :8080...\")\n\terr := http.ListenAndServe(\":8080\", nil)\n\tif err != nil {\n\t\tpanic(\"ListenAndServe: \" + err.Error())\n\t}\n}", "title": "" }, { "docid": "ca2cfbec0ca136c62ff182863cfdcd7b", "score": "0.64009583", "text": "func main() {\n\tstartServer(nil)\n}", "title": "" }, { "docid": "ed987566831c731d5a0e69a0eca966c2", "score": "0.63957494", "text": "func main() {\n\t// Set this threshold low for demonstration purposes.\n\tsched.OversleepThreshold = time.Microsecond\n\thttp.HandleFunc(\"/\", handler)\n\terr := http.ListenAndServe(\"127.0.0.1:8000\", nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "f8bde369e1f90e63c2b19daa52ac4579", "score": "0.6392242", "text": "func runHTTPServer() error {\n\te := echo.New()\n\tsetHTTPHandler(autodoc.NewGroup(e)) // 原代码:setHTTPHandler(e)\n\treturn e.Start(\":8008\")\n}", "title": "" }, { "docid": "ca8944ee2f3f4512293b2077e4137d89", "score": "0.6384645", "text": "func main() {\n\thttp.Handle(\"/fight\", websocket.Handler(FightServer))\n\terr := http.ListenAndServe(\":8080\", nil)\n\tif err != nil {\n\t\tpanic(\"ListenAndServe: \" + err.Error())\n\t}\n}", "title": "" }, { "docid": "5956236792cd977da6449c0ff360ee29", "score": "0.6375547", "text": "func run() error {\n\tmux := makeMuxRouter()\n\tlog.Println(\"Listening on 8080\")\n\ts := &http.Server{\n\t\tAddr:\t\t\":\" + \"8080\",\n\t\tHandler:\tmux,\n\t\tReadTimeout:\t10 * time.Second,\n\t\tWriteTimeout:\t10 * time.Second,\n\t\tMaxHeaderBytes: 1 << 20,\n\t}\n\t\n\tif err := s.ListenAndServe(); err != nil {\n\t\treturn err\n\t}\n\t\n\treturn nil\n}", "title": "" }, { "docid": "4b17987c5106338f28a692f588252492", "score": "0.63731235", "text": "func main() {\n\tprintln(\"Starting server at :8080...\")\n\thttp.HandleFunc(\"/\", transformer)\n\thttp.HandleFunc(\"/healthcheck\", healthcheck)\n\tlog.Fatal(http.ListenAndServe(\":8080\", nil))\n}", "title": "" }, { "docid": "84e5849aacbdcb37cc065a5a6c474d5b", "score": "0.636785", "text": "func Test(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"This is the RESTful api\")\n}", "title": "" }, { "docid": "7c4801b5df902a3b3490528f2ea1054d", "score": "0.6367672", "text": "func main() {\n\t// To handle web socket requests we simply register a different type of handler - a web socket handler.\n\t// Which handler the server uses is based on the URL pattern.\n\n\thttp.Handle(\"/\", websocket.Handler(WSHandler))\n\terr := http.ListenAndServe(\":12345\", nil)\n\tcheckError(err)\n}", "title": "" }, { "docid": "a022d5bdad3986c8d992cf097516c640", "score": "0.6367457", "text": "func main() {\n\terr := run()\n\n\tif err != nil {\n\t\t// log.Fatal, writes to console and stops application\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Printf(\"Staring application on port %s \\n\", portNumber)\n\n\t// Start a webserver\n\n\tsrv := &http.Server{\n\t\tAddr: portNumber,\n\t\tHandler: routes(&app),\n\t}\n\n\terr = srv.ListenAndServe()\n\t// If theres an error\n\tlog.Fatal(err)\n\n}", "title": "" }, { "docid": "7b0432c72281fee8523d114f7cba42ea", "score": "0.636395", "text": "func main() {\n\thttp.Handle(\"/echo\", websocket.Handler(EchoServer))\n\thttp.Handle(\"/\", websocket.Handler(MainServer))\n\terr := http.ListenAndServe(\":5000\", nil)\n\tif err != nil {\n\t\tpanic(\"ListenAndServe: \" + err.Error())\n\t}\n}", "title": "" }, { "docid": "44b4444e2f4ecaf87647bdd44c5212f2", "score": "0.63591033", "text": "func main() {\n http.HandleFunc(\"/\", handler)\n log.Fatal(http.ListenAndServe(\":80\", nil))\n}", "title": "" }, { "docid": "bf428e36cbb5f7e2850c441ec9e0d77f", "score": "0.63529736", "text": "func MainHTTP() {\n\t// testHTTPGet()\n\t// testHTTPPost()\n\t// testClientHTTP()\n\n\t// testHTTPStreamRead()\n\n\tfmt.Println(\"golang http client examples DONE.\")\n}", "title": "" }, { "docid": "c95ca3636edfe2e44270b58e0b06c726", "score": "0.63494724", "text": "func main() {\n\tloadServices() // loadServices() handles error checking\n\trand.Seed(time.Now().UnixNano()) // used to generate random ids for new services\n\n\tr := mux.NewRouter()\n\tr.HandleFunc(\"/services\", getServices).Methods(\"GET\")\n\tr.HandleFunc(\"/service_detail/{id}\", getServiceDetails).Methods(\"GET\")\n\tr.HandleFunc(\"/service_create\", createService).Methods(\"POST\")\n\thttp.Handle(\"/\", r)\n\tlog.Println(\"Start Web Server...\")\n\thttp.ListenAndServe(\":8080\", nil)\n}", "title": "" }, { "docid": "aafcc6ab4a7afc07c4023f4b9cb67673", "score": "0.63479483", "text": "func main() {\n\tlog.Println(\"Server started on: http://localhost:8080\")\n\thttp.HandleFunc(\"/\", Index)\n\thttp.HandleFunc(\"/show\", Show)\n\thttp.HandleFunc(\"/new\", New)\n\thttp.HandleFunc(\"/edit\", Edit)\n\thttp.HandleFunc(\"/insert\", Insert)\n\thttp.HandleFunc(\"/update\", Update)\n\thttp.HandleFunc(\"/delete\", Delete)\n\thttp.ListenAndServe(\":8080\", nil)\n}", "title": "" }, { "docid": "7355fc55c4803fbb57500384bb298a23", "score": "0.63461393", "text": "func main() {\n\thttp.HandleFunc(\"/\", handler)\n\thttp.ListenAndServe(\":3000\", nil)\n}", "title": "" }, { "docid": "3be880276063fbf71cbedacefaf99be8", "score": "0.6338135", "text": "func runServer() {\n\t// Figure out which port we want to listen on.\n\tvar port string = strconv.Itoa(config.LocalPort)\n\tif port == \"0\" {\n\t\t// Port was invalid or not provided, so use port 4000\n\t\t// by default\n\t\tfmt.Println(\"WARNING: Port was invalid or not provided. Using port 4000.\")\n\t\tport = \"4000\"\n\t}\n\n\t// We need some routes for our API.\n\tfmt.Println(\"Assigning HTTP route handlers.\")\n\trouter := NewRouter()\n\n\t// Start HTTP server.\n\tfmt.Println(\"Listening on \" + config.LocalHost + \":\" + port)\n\thttp.ListenAndServe(config.LocalHost+\":\"+port, router)\n}", "title": "" }, { "docid": "c80571654c5d6977dbb64be8ad25e739", "score": "0.63333607", "text": "func main() {\n\tconst SERVER_PORT string = \":8080\"\n\n\tlogger.Info.Println(\"\\n PHONE NUMBER VALIDATOR SERVER IS RUNNING... \")\n\n\terr := http.ListenAndServe(SERVER_PORT, webService.GetRouter())\n\n\tif err != nil {\n\t\tlogger.Info.Println(err)\n\t}\n}", "title": "" }, { "docid": "cdbdfeeb460fc2a1888e834a220cac4c", "score": "0.63295275", "text": "func main(){\n fmt.Println(\"Rodando servidor na porta 8080\")\n router := mux.NewRouter()\n router.HandleFunc(\"/\", home).Methods(\"GET\")\n log.Fatal(http.ListenAndServe(\":8080\", router))\n}", "title": "" }, { "docid": "9171a5062f38689deb98bea23ae6fb14", "score": "0.63206464", "text": "func StartWeb() {\n\tc := cors.New(cors.Options{\n\t\tAllowedOrigins: []string{\"*\"},\n\t})\n\tlog.Println(\"Port .. \" + port)\n\tflag.StringVar(&listenAddr, \"listen-addr\", port, \"server listen address\")\n\tflag.Parse()\n\tlogger := log.New(os.Stdout, \"http: \", log.LstdFlags)\n\tlogger.Println(\"Starting HTTP Server. .. \")\n\trouter := http.NewServeMux()\n\trouter.Handle(\"/\", index())\n\trouter.Handle(\"/file/\", getResource())\n\trouter.Handle(\"/iepd/\", getResource())\n\trouter.Handle(\"/dload\", dload())\n\trouter.Handle(\"/validate\", validate())\n\trouter.Handle(\"/transform\", transform())\n\trouter.Handle(\"/verify\", verify())\n\tnextRequestID := func() string {\n\t\treturn fmt.Sprintf(\"%d\", time.Now().UnixNano())\n\t}\n\tserver := &http.Server{\n\t\tAddr: listenAddr,\n\t\tHandler: tracing(nextRequestID)(logging(logger)(c.Handler(router))),\n\t\tErrorLog: logger,\n\t\tReadTimeout: 5 * time.Second,\n\t\tWriteTimeout: 10 * time.Second,\n\t\tIdleTimeout: 15 * time.Second,\n\t}\n\tdone := make(chan bool)\n\tquit := make(chan os.Signal, 1)\n\tsignal.Notify(quit, os.Interrupt)\n\tgo func() {\n\t\t<-quit\n\t\tlogger.Println(\"Server is shutting down...\")\n\t\tatomic.StoreInt32(&healthy, 0)\n\n\t\tctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\n\t\tdefer cancel()\n\n\t\tserver.SetKeepAlivesEnabled(false)\n\t\tif err := server.Shutdown(ctx); err != nil {\n\t\t\tlogger.Fatalf(\"Could not gracefully shutdown the server: %v\\n\", err)\n\t\t}\n\t\tclose(done)\n\t}()\n\tlogger.Println(\"Server is ready to handle requests at\", listenAddr)\n\tatomic.StoreInt32(&healthy, 1)\n\tif err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {\n\t\tlogger.Fatalf(\"Could not listen on %s: %v\\n\", listenAddr, err)\n\t}\n\t<-done\n\tlogger.Println(\"Server stopped\")\n}", "title": "" }, { "docid": "7a64d6b9c18bb7a5a9de5163d64527cf", "score": "0.6317104", "text": "func main(){\n\tfmt.Println(\"hello from time service\")\n\t// Creates a gin router with default middleware:\n\t// logger and recovery (crash-free) middleware\n\trouter := gin.Default()\n\t// mount router \n\trouter.GET(\"/getTime\", giveMeTime)\n\t\n\n\t// By default it serves on :8015 unless a\n\t// PORT environment variable was defined.\n\trouter.Run(\":8015\")\n}", "title": "" }, { "docid": "2b6a3a8a67222a593ce7bee2dfb56043", "score": "0.631406", "text": "func runWebserver() {\n\tslogger.Info(\"Starting webserver...\")\n\n\trouter := httprouter.New()\n\n\tslogger.Debug(\"Registering routes...\")\n\tapi.RegisterHomeHandler(router)\n\tapi.RegisterWatcherHandler(router)\n\tapi.RegisterPriceHandler(router)\n\tapi.RegisterQueueHandler(router)\n\n\trouterWithMiddleWare := middleware.NewLogMiddleWare(router)\n\n\tslogger.Info(\n\t\tfmt.Sprintf(\"Server started on %s\", viper.GetString(\"webserver.address\")),\n\t)\n\n\taddress := strings.ReplaceAll(\n\t\tstrings.ReplaceAll(\n\t\t\tviper.GetString(\"webserver.address\"),\n\t\t\t\"https://\",\n\t\t\t\"\",\n\t\t),\n\t\t\"http://\",\n\t\t\"\",\n\t)\n\n\tslogger.Fatal(\n\t\thttp.ListenAndServe(address, routerWithMiddleWare).Error(),\n\t)\n}", "title": "" }, { "docid": "3bc5fe8a8e318531007459198e60b294", "score": "0.6312121", "text": "func main() {\n\n\tps := map[string]Processor{\n\t\t\"testHttp\": &ProcHttp{},\n\t\t\"testThrift\": &ProcThrift{},\n\t}\n\n\terr := Serve(ps)\n\tif err != nil {\n\t\tslog.Errorf(\"serve err:%s\", err)\n\t}\n\n}", "title": "" }, { "docid": "872e902cc87c190a725d259a896c0c8e", "score": "0.63074595", "text": "func main() {\n\t// Step 4: requests to the \"/\" route runs the \"dogs\" func\n\thttp.HandleFunc(\"/\", dogs)\n\t// Step 6: index.gohtml templates made calls to \"/resources/\", which then served up all files in the public dir.\n\t// the root is \"/resources/\" in the project but StripPrefix removes that and services everything from \"public\"\n\thttp.Handle(\"/resources/\", http.StripPrefix(\"/resources\", http.FileServer(http.Dir(\"public\"))))\n\t// Step 7: start the server\n\thttp.ListenAndServe(\":8080\", nil)\n}", "title": "" }, { "docid": "0952e81cd0aa1ce2106efbbb02cd0790", "score": "0.63023955", "text": "func main() {\n\tif len(os.Args) != 2 {\n\t\tlog.Fatal(\"Usage: ./server-go [server port]\")\n\t}\n\tserverPort := os.Args[1]\n\tserver(serverPort)\n}", "title": "" }, { "docid": "cc8156bffb459076f72e7f9e44408f19", "score": "0.6293437", "text": "func main() {\n\tsettings, err := config.Init()\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\taddr, err := server.Serve()\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tw := webview.New(webview.Settings{\n\t\tWidth: settings.Width,\n\t\tHeight: settings.Height,\n\t\tTitle: \"Dailies\",\n\t\tResizable: true,\n\t\tURL: \"http://\" + addr.String() + \"/index.html\",\n\t})\n\tdefer w.Exit()\n\tw.Run()\n}", "title": "" }, { "docid": "ba1cc0a0673782943d3da33bb5cbdd5c", "score": "0.62876153", "text": "func main() {\n\thttp.HandleFunc(\"/\", homeHandler)\n\n\terr := http.ListenAndServe(\":38000\", nil)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n}", "title": "" }, { "docid": "f06deab443819e9032f9a5240cf3739d", "score": "0.6285058", "text": "func Run() {\n\t//\n\t// Initialize Go Mock Yourself e2e Testing Server\n\t//\n\n\tRouter := gin.Default()\n\n\tfor _, method := range e2e_helpers.SupportedHTTPMethods {\n\t\tRouter.Handle(method, \"/*url\", e2eTestingServerHandler(method))\n\t}\n\n\t//\n\t// Start Testing Server\n\t//\n\n\tgo Router.Run()\n\n\t//\n\t// Let's give Gin enough time to run\n\t//\n\n\ttime.Sleep(time.Second * 10)\n}", "title": "" }, { "docid": "8408fd904833acb97d45c3ed941c041c", "score": "0.6279939", "text": "func main() {\n\tport := flag.String(\"port\", \":8080\", \"The port the webserver should run on.\")\n\tflag.Parse()\n\tif err := storage.Connect(); err != nil {\n\t\tlog.Println(\"Cannot connect to elastic..\")\n\t}\n\tapp.StartServer(*port)\n}", "title": "" }, { "docid": "bbb59f7a0e90fe6cce3af5bc2e130020", "score": "0.62793833", "text": "func main() {\n\t// Create a new gorilla router.\n\tr := mux.NewRouter()\n\tr.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintf(w, \"Welcome to to the go-docker API.\\nAvailable on Github oder auch nicht.\")\n\t})\n\n\t// TODO: implement TLS\n\t// At this stage we only accept http requests.\n\tfmt.Println(\"Server listening on port 80\")\n\thttp.ListenAndServe(\":80\", r)\n}", "title": "" }, { "docid": "cfff49b14e844ad5679d57593dc65cf9", "score": "0.6271126", "text": "func main() {\n\tport := flag.String(\"port\", \"1234\", \"Port where the server should listen\")\n\tflag.Parse()\n\thttp.Handle(\"/assets/\", http.StripPrefix(\"/assets/\", http.FileServer(http.Dir(\"./assets\"))))\n\thttp.HandleFunc(\"/favicon.ico\", favicon)\n\thttp.HandleFunc(\"/search\", search)\n\thttp.HandleFunc(\"/start\", start)\n\thttp.HandleFunc(\"/stop\", stop)\n\thttp.HandleFunc(\"/\", index)\n\tlog.Printf(\"Listening on port %s\\n\", *port)\n\taddr := \":\" + *port\n\tlog.Fatal(http.ListenAndServe(addr, nil))\n}", "title": "" }, { "docid": "b0ec0414c555aba2b68a4afb5a027aed", "score": "0.62702155", "text": "func main() {\n\trouter := r2router.NewSeeforRouter()\n\t\n\t// basic auth for entire router\n\trouter.Before(httpauth.SimpleBasicAuth(\"testuser\", \"testpw\"))\n\t\n\trouter.Get(\"/hello/:name\", func(w http.ResponseWriter, r *http.Request, p r2router.Params) {\n\t\tw.Write([]byte( p.Get(\"name\")))\n\t})\n\n\thttp.ListenAndServe(\"127.0.0.1:8080\", router)\n}", "title": "" } ]
d4b6fc3159d3abf914a718ae03cfcd01
WriteBlockSync is same as WriteBlock, but commits block synchronously. Note: WriteConfigBlock should use WriteBlockSync instead of WriteBlock. If the block contains a transaction that remove the node from consenters, the node will switch to follower and pull blocks from other nodes. Suppose writing block asynchronously, the block maybe not persist to disk when the follower chain starts working. The follower chain will read a block before the config block, in which the node is still a consenter, so the follower chain will switch to the consensus chain. That's a dead loop! So WriteConfigBlock should use WriteBlockSync instead of WriteBlock.
[ { "docid": "838fbb9617b2f2b094585f1c1552de08", "score": "0.8185714", "text": "func (bw *BlockWriter) WriteBlockSync(block *cb.Block, encodedMetadataValue []byte) {\n\tbw.committingBlock.Lock()\n\tbw.lastBlock = block\n\n\tdefer bw.committingBlock.Unlock()\n\tbw.commitBlock(encodedMetadataValue)\n}", "title": "" } ]
[ { "docid": "5553aa019a666d3dfaf4777b1a009bbd", "score": "0.72163707", "text": "func (bw *BlockWriter) WriteConfigBlock(block *cb.Block, encodedMetadataValue []byte) {\n\tctx, err := protoutil.ExtractEnvelope(block, 0)\n\tif err != nil {\n\t\tlogger.Panicf(\"Told to write a config block, but could not get configtx: %s\", err)\n\t}\n\n\tpayload, err := protoutil.UnmarshalPayload(ctx.Payload)\n\tif err != nil {\n\t\tlogger.Panicf(\"Told to write a config block, but configtx payload is invalid: %s\", err)\n\t}\n\n\tif payload.Header == nil {\n\t\tlogger.Panicf(\"Told to write a config block, but configtx payload header is missing\")\n\t}\n\n\tchdr, err := protoutil.UnmarshalChannelHeader(payload.Header.ChannelHeader)\n\tif err != nil {\n\t\tlogger.Panicf(\"Told to write a config block with an invalid channel header: %s\", err)\n\t}\n\n\tswitch chdr.Type {\n\tcase int32(cb.HeaderType_ORDERER_TRANSACTION):\n\t\tlogger.Panicf(\"[channel: %s] Told to write a config block of type HeaderType_ORDERER_TRANSACTION, but the system channel is no longer supported\", bw.support.ChannelID())\n\n\tcase int32(cb.HeaderType_CONFIG):\n\t\tconfigEnvelope, err := configtx.UnmarshalConfigEnvelope(payload.Data)\n\t\tif err != nil {\n\t\t\tlogger.Panicf(\"Told to write a config block with new channel, but did not have config envelope encoded: %s\", err)\n\t\t}\n\n\t\terr = bw.support.Validate(configEnvelope)\n\t\tif err != nil {\n\t\t\tlogger.Panicf(\"Told to write a config block with new config, but could not apply it: %s\", err)\n\t\t}\n\n\t\tbundle, err := bw.support.CreateBundle(chdr.ChannelId, configEnvelope.Config)\n\t\tif err != nil {\n\t\t\tlogger.Panicf(\"Told to write a config block with a new config, but could not convert it to a bundle: %s\", err)\n\t\t}\n\n\t\toc, ok := bundle.OrdererConfig()\n\t\tif !ok {\n\t\t\tlogger.Panicf(\"[channel: %s] OrdererConfig missing from bundle\", bw.support.ChannelID())\n\t\t}\n\n\t\tcurrentType := bw.support.SharedConfig().ConsensusType()\n\t\tnextType := oc.ConsensusType()\n\t\tif currentType != nextType {\n\t\t\tencodedMetadataValue = nil\n\t\t\tlogger.Debugf(\"[channel: %s] Consensus-type migration: maintenance mode, change from %s to %s, setting metadata to nil\",\n\t\t\t\tbw.support.ChannelID(), currentType, nextType)\n\t\t}\n\n\t\t// Avoid Bundle update before the go-routine in WriteBlock() finished writing the previous block.\n\t\t// We do this (in particular) to prevent bw.support.Sequence() from advancing before the go-routine reads it.\n\t\t// In general, this prevents the StableBundle from changing before the go-routine in WriteBlock() finishes.\n\t\tbw.committingBlock.Lock()\n\t\tbw.committingBlock.Unlock()\n\t\tbw.support.Update(bundle)\n\tdefault:\n\t\tlogger.Panicf(\"Told to write a config block with unknown header type: %v\", chdr.Type)\n\t}\n\n\tbw.WriteBlockSync(block, encodedMetadataValue)\n}", "title": "" }, { "docid": "be50b713356dbbd53c56723f5173c0c4", "score": "0.663358", "text": "func WithSyncBlock(sync [16]byte) EncoderFunc {\n\treturn func(cfg *encoderConfig) {\n\t\tcfg.Sync = sync\n\t}\n}", "title": "" }, { "docid": "98d8a090288b5e9d8b5f056115987403", "score": "0.6633315", "text": "func (bw *BlockWriter) WriteBlock(block *cb.Block, encodedMetadataValue []byte) {\n\tbw.committingBlock.Lock()\n\tbw.lastBlock = block\n\n\tgo func() {\n\t\tdefer bw.committingBlock.Unlock()\n\t\tbw.commitBlock(encodedMetadataValue)\n\t}()\n}", "title": "" }, { "docid": "ada9aab7c027bf8e2c57e3c6efbe8ac8", "score": "0.6190505", "text": "func (bc *blockchain) AddBlockSync(blk *Block) error {\n\t// directly commit block into blockchain DB\n\treturn bc.commitBlock(blk)\n}", "title": "" }, { "docid": "f5f28850b09e593f2f22ba9f99facb95", "score": "0.6171132", "text": "func WriteSync(sync bool) Option {\n\treturn func(args *Options) {\n\t\targs.sync = sync\n\t}\n}", "title": "" }, { "docid": "f36407b9832f712779c108ceb4bfe38f", "score": "0.5987733", "text": "func (bw *BlockWriter) commitBlock(encodedMetadataValue []byte) {\n\tbw.addLastConfig(bw.lastBlock)\n\n\tif len(bw.lastBlock.Metadata.Metadata[cb.BlockMetadataIndex_SIGNATURES]) == 0 {\n\t\tbw.addBlockSignature(bw.lastBlock, encodedMetadataValue)\n\t}\n\n\terr := bw.support.Append(bw.lastBlock)\n\tif err != nil {\n\t\tlogger.Panicf(\"[channel: %s] Could not append block: %s\", bw.support.ChannelID(), err)\n\t}\n\tlogger.Debugf(\"[channel: %s] Wrote block [%d]\", bw.support.ChannelID(), bw.lastBlock.GetHeader().Number)\n}", "title": "" }, { "docid": "220e07e11a3f49aa413735c724626ac2", "score": "0.5717947", "text": "func SyncBlockchain() {\n\tchannel() <- blockchain\n}", "title": "" }, { "docid": "01b46c50a96e927f3be6bc399325a5a4", "score": "0.5649179", "text": "func (blockStore *BlockStore) WriteBlock(block *types.Block) error {\n\tlog.Info(\"Start writing block %v to database.\", block)\n\tblockByte, err := encodeBlock(block)\n\tif err != nil {\n\t\tlog.Error(\"Failed to encode block %v to byte, as: %v \", block, err)\n\t\treturn fmt.Errorf(\"Failed to encode block %v to byte, as: %v \", block, err)\n\t}\n\t// write block\n\tblockHash := common.BlockHash(block)\n\terr = blockStore.store.Put(util.HashToBytes(blockHash), blockByte)\n\tif err != nil {\n\t\tlog.Error(\"Failed to write block %s to database, as: %v \", blockHash, err)\n\t\treturn fmt.Errorf(\"Failed to write block %s to database, as: %v \", blockHash, err)\n\t}\n\t// write block height and hash mapping\n\terr = blockStore.store.Put(encodeBlockHeight(block.Header.Height), util.HashToBytes(blockHash))\n\tif err != nil {\n\t\tlog.Error(\"Failed to record the mapping between block and height\")\n\t\treturn fmt.Errorf(\"Failed to record the mapping between block and height \")\n\t}\n\t// update current block\n\tblockStore.recordCurrentBlock(block)\n\t// update latest block\n\terr = blockStore.store.Put([]byte(latestBlockKey), util.HashToBytes(blockHash))\n\tif err != nil {\n\t\tlog.Warn(\"Failed to record latest block, as: %v. we will still use the previous latest block as current latest block \", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "de4841badb77b0260fdfb5b0314850e4", "score": "0.56457174", "text": "func (bc *BlockChain) WriteBlock(block *types.Block, receipts []*types.Receipt) error {\n\tbc.debug.Infof(\"WriteBlock (%d, %v) parent: %v\", block.Number().Uint64(), block.Hash(), block.ParentHash())\n\t// Make sure no inconsistent state is leaked during insertion\n\tbc.mu.Lock()\n\tdefer bc.mu.Unlock()\n\n\trawdb.WriteBlock(bc.db, block)\n\t// Write the metadata for transaction/receipt lookups and preimages\n\trawdb.WriteReceipts(bc.db, block.Hash(), block.Number().Uint64(), receipts)\n\t// TODO: rawdb.WriteTxLookupEntries(batch, block) # USING A batch !!\n\n\tbc.insert(block)\n\treturn nil\n}", "title": "" }, { "docid": "7e2d6b5eee2f362794349d4ed74852d1", "score": "0.56273466", "text": "func (b *Buffer) WriteBlock() safemem.Block {\n\treturn safemem.BlockFromSafeSlice(b.data[b.write:])\n}", "title": "" }, { "docid": "e27102fcba3509b43ff2e258bc66956e", "score": "0.5472762", "text": "func MarshalBlock(r *bytes.Buffer, b *block.Block) error {\n\tif err := MarshalHeader(r, b.Header); err != nil {\n\t\treturn err\n\t}\n\n\tlenTxs := uint64(len(b.Txs))\n\tif err := encoding.WriteVarInt(r, lenTxs); err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: parallelize transaction serialization\n\tfor _, tx := range b.Txs {\n\t\tif err := transactions.Marshal(r, tx); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "aa10d382fce3ec85a6a62df973a97ed3", "score": "0.54175884", "text": "func (xc *XChainCore) SyncBlocks() {\n\txc.SyncBatchBlocks()\n}", "title": "" }, { "docid": "62644953416adb882d0cb6a449f53bf7", "score": "0.53740203", "text": "func (p *Peer) AsyncSendNewBlock(block *types.Block, td *big.Int, blockPrivateData *qlight.BlockPrivateData) {\n\tselect {\n\tcase p.queuedBlocks <- &blockPropagation{block: block, td: td, blockPrivateData: blockPrivateData}:\n\t\t// Mark all the block hash as known, but ensure we don't overflow our limits\n\t\tfor p.knownBlocks.Cardinality() >= maxKnownBlocks {\n\t\t\tp.knownBlocks.Pop()\n\t\t}\n\t\tp.knownBlocks.Add(block.Hash())\n\tdefault:\n\t\tp.Log().Debug(\"Dropping block propagation\", \"number\", block.NumberU64(), \"hash\", block.Hash())\n\t}\n}", "title": "" }, { "docid": "754153f05dddc5477e01bfa04cfb992c", "score": "0.5372618", "text": "func (w *Writer) writeBlock() error {\n\terr := w.block.WriteBlock(w.bw)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tw.crc = ((w.crc << 1) | (w.crc >> 31)) ^ w.block.crc\n\tw.block = newBlock(w.block.size)\n\treturn nil\n}", "title": "" }, { "docid": "d4730cb9ef591acdc9c3f2a057d56bae", "score": "0.5353552", "text": "func (cs *ChainService) BlockSync() blocksync.BlockSync {\n\treturn cs.blocksync\n}", "title": "" }, { "docid": "8b2c4951d456aedfddb5555fb720eb86", "score": "0.52913266", "text": "func SetupGenesisBlock(db bgmdbPtr.Database, genesis *Genesis) (*bgmparam.ChainConfig, bgmcommon.Hash, error) {\n\tif genesis != nil && genesis.Config == nil {\n\t\treturn bgmparam.DposChainConfig, bgmcommon.Hash{}, errGenesisNoConfig\n\t}\n\n\t// Just commit the new block if there is no stored genesis block.\n\tstored := GetCanonicalHash(db, 0)\n\tif (stored == bgmcommon.Hash{}) {\n\t\tif genesis == nil {\n\t\t\tbgmlogs.Info(\"Writing default main-net genesis block\")\n\t\t\tgenesis = DefaultGenesisBlock()\n\t\t} else {\n\t\t\tbgmlogs.Info(\"Writing custom genesis block\")\n\t\t}\n\t\tblock, err := genesis.Commit(db)\n\t\treturn genesis.Config, block.Hash(), err\n\t}\n\n\t// Check whbgmchain the genesis block is already written.\n\tif genesis != nil {\n\t\tblock, _ := genesis.ToBlock()\n\t\thash := block.Hash()\n\t\tif hash != stored {\n\t\t\treturn genesis.Config, block.Hash(), &GenesisMismatchError{stored, hash}\n\t\t}\n\t}\n\n\t// Get the existing chain configuration.\n\tnewcfg := genesis.configOrDefault(stored)\n\tstoredcfg, err := GetChainConfig(db, stored)\n\tif err != nil {\n\t\tif err == ErrChainConfigNotFound {\n\t\t\t// This case happens if a genesis write was interrupted.\n\t\t\tbgmlogs.Warn(\"Found genesis block without chain config\")\n\t\t\terr = WriteChainConfig(db, stored, newcfg)\n\t\t}\n\t\treturn newcfg, stored, err\n\t}\n\t// Special case: don't change the existing config of a non-mainnet chain if no new\n\t// if we just continued here.\n\tif genesis == nil && stored != bgmparam.MainnetGenesisHash {\n\t\treturn storedcfg, stored, nil\n\t}\n\n\t// Check config compatibility and write the config. Compatibility errors\n\t// are returned to the Called unless we're already at block zero.\n\theight := Getnumber(db, GetHeadHeaderHash(db))\n\tif height == missingNumber {\n\t\treturn newcfg, stored, fmt.Errorf(\"missing block number for head Header hash\")\n\t}\n\tcompatErr := storedcfg.CheckCompatible(newcfg, height)\n\tif compatErr != nil && height != 0 && compatErr.RewindTo != 0 {\n\t\treturn newcfg, stored, compatErr\n\t}\n\treturn newcfg, stored, WriteChainConfig(db, stored, newcfg)\n}", "title": "" }, { "docid": "6577a02c71dd0c2b95a3d419ce4b1601", "score": "0.5281849", "text": "func (s *blockStore) syncBlocks() error {\n\twc := s.writeCursor\n\twc.RLock()\n\tdefer wc.RUnlock()\n\n\t// Nothing to do if there is no current file associated with the write\n\t// cursor.\n\twc.curFile.RLock()\n\tdefer wc.curFile.RUnlock()\n\tif wc.curFile.file == nil {\n\t\treturn nil\n\t}\n\n\t// Sync the file to disk.\n\tif err := wc.curFile.file.Sync(); err != nil {\n\t\tstr := fmt.Sprintf(\"failed to sync file %d: %v\", wc.curFileNum,\n\t\t\terr)\n\t\treturn makeDbErr(database.ErrDriverSpecific, str, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9ddf8cdb74afcab7bdb8850037925652", "score": "0.5280696", "text": "func (s *blockStore) writeBlock(rawBlock []byte) (blockLocation, error) {\n\t// Compute how many bytes will be written.\n\t// 4 bytes each for block network + 4 bytes for block length +\n\t// length of raw block + 4 bytes for checksum.\n\tblockLen := uint32(len(rawBlock))\n\tfullLen := blockLen + 12\n\n\t// Move to the next block file if adding the new block would exceed the\n\t// max allowed size for the current block file. Also detect overflow\n\t// to be paranoid, even though it isn't possible currently, numbers\n\t// might change in the future to make it possible.\n\t//\n\t// NOTE: The writeCursor.offset field isn't protected by the mutex\n\t// since it's only read/changed during this function which can only be\n\t// called during a write transaction, of which there can be only one at\n\t// a time.\n\twc := s.writeCursor\n\tfinalOffset := wc.curOffset + fullLen\n\tif finalOffset < wc.curOffset || finalOffset > s.maxBlockFileSize {\n\t\t// This is done under the write cursor lock since the curFileNum\n\t\t// field is accessed elsewhere by readers.\n\t\t//\n\t\t// Close the current write file to force a read-only reopen\n\t\t// with LRU tracking. The close is done under the write lock\n\t\t// for the file to prevent it from being closed out from under\n\t\t// any readers currently reading from it.\n\t\twc.Lock()\n\t\twc.curFile.Lock()\n\t\tif wc.curFile.file != nil {\n\t\t\t_ = wc.curFile.file.Close()\n\t\t\twc.curFile.file = nil\n\t\t}\n\t\twc.curFile.Unlock()\n\n\t\t// Start writes into next file.\n\t\twc.curFileNum++\n\t\twc.curOffset = 0\n\t\twc.Unlock()\n\t}\n\n\t// All writes are done under the write lock for the file to ensure any\n\t// readers are finished and blocked first.\n\twc.curFile.Lock()\n\tdefer wc.curFile.Unlock()\n\n\t// Open the current file if needed. This will typically only be the\n\t// case when moving to the next file to write to or on initial database\n\t// load. However, it might also be the case if rollbacks happened after\n\t// file writes started during a transaction commit.\n\tif wc.curFile.file == nil {\n\t\tfile, err := s.openWriteFileFunc(wc.curFileNum)\n\t\tif err != nil {\n\t\t\treturn blockLocation{}, err\n\t\t}\n\t\twc.curFile.file = file\n\t}\n\n\t// Bitcoin network.\n\torigOffset := wc.curOffset\n\thasher := crc32.New(castagnoli)\n\tvar scratch [4]byte\n\tbyteOrder.PutUint32(scratch[:], uint32(s.network))\n\tif err := s.writeData(scratch[:], \"network\"); err != nil {\n\t\treturn blockLocation{}, err\n\t}\n\t_, _ = hasher.Write(scratch[:])\n\n\t// Block length.\n\tbyteOrder.PutUint32(scratch[:], blockLen)\n\tif err := s.writeData(scratch[:], \"block length\"); err != nil {\n\t\treturn blockLocation{}, err\n\t}\n\t_, _ = hasher.Write(scratch[:])\n\n\t// Serialized block.\n\tif err := s.writeData(rawBlock, \"block\"); err != nil {\n\t\treturn blockLocation{}, err\n\t}\n\t_, _ = hasher.Write(rawBlock)\n\n\t// Castagnoli CRC-32 as a checksum of all the previous.\n\tif err := s.writeData(hasher.Sum(nil), \"checksum\"); err != nil {\n\t\treturn blockLocation{}, err\n\t}\n\n\tloc := blockLocation{\n\t\tblockFileNum: wc.curFileNum,\n\t\tfileOffset: origOffset,\n\t\tblockLen: fullLen,\n\t}\n\treturn loc, nil\n}", "title": "" }, { "docid": "d2e45457069eab4218d54564cff93539", "score": "0.52676123", "text": "func (p *mobileAppProxy) CommitBlock(block hashgraph.Block) ([]byte, error) {\n\tblockBytes, err := block.Marshal()\n\tif err != nil {\n\t\tp.logger.Debug(\"mobileAppProxy error marhsalling Block\")\n\t\treturn nil, err\n\t}\n\tstateHash := p.commitHandler.OnCommit(blockBytes)\n\treturn stateHash, nil\n}", "title": "" }, { "docid": "89a85fe7a723d153b8f340543e7f0cc3", "score": "0.5207739", "text": "func (m *manager) SaveBlock(hash []byte, serializedBlock []byte, blockMetadata *BlockMetadata) error {\n\n\tpath, err := m.fs.SaveBlock(serializedBlock, blockMetadata.Height)\n\tif err != nil {\n\t\treturn err\n\t}\n\tblockMetadata.Path = path\n\n\terr = m.db.SaveBlockMetadata(hash, blockMetadata)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "620fb50840192a08c0d619bb9f95dbd5", "score": "0.5186046", "text": "func (blockExec *BlockExecutor) ApplyBlock(\n\tctx context.Context,\n\tstate State,\n\tblockID types.BlockID, block *types.Block) (State, error) {\n\t// validate the block if we haven't already\n\tif err := blockExec.ValidateBlock(ctx, state, block); err != nil {\n\t\treturn state, ErrInvalidBlock(err)\n\t}\n\tstartTime := time.Now().UnixNano()\n\tpbh := block.Header.ToProto()\n\tfinalizeBlockResponse, err := blockExec.appClient.FinalizeBlock(\n\t\tctx,\n\t\tabci.RequestFinalizeBlock{\n\t\t\tHash: block.Hash(),\n\t\t\tHeader: *pbh,\n\t\t\tTxs: block.Txs.ToSliceOfBytes(),\n\t\t\tDecidedLastCommit: buildLastCommitInfo(block, blockExec.store, state.InitialHeight),\n\t\t\tByzantineValidators: block.Evidence.ToABCI(),\n\t\t},\n\t)\n\tendTime := time.Now().UnixNano()\n\tblockExec.metrics.BlockProcessingTime.Observe(float64(endTime-startTime) / 1000000)\n\tif err != nil {\n\t\treturn state, ErrProxyAppConn(err)\n\t}\n\n\tabciResponses := &tmstate.ABCIResponses{\n\t\tFinalizeBlock: finalizeBlockResponse,\n\t}\n\n\t// Save the results before we commit.\n\tif err := blockExec.store.SaveABCIResponses(block.Height, abciResponses); err != nil {\n\t\treturn state, err\n\t}\n\n\t// validate the validator updates and convert to tendermint types\n\terr = validateValidatorUpdates(finalizeBlockResponse.ValidatorUpdates, state.ConsensusParams.Validator)\n\tif err != nil {\n\t\treturn state, fmt.Errorf(\"error in validator updates: %w\", err)\n\t}\n\n\tvalidatorUpdates, err := types.PB2TM.ValidatorUpdates(finalizeBlockResponse.ValidatorUpdates)\n\tif err != nil {\n\t\treturn state, err\n\t}\n\tif len(validatorUpdates) > 0 {\n\t\tblockExec.logger.Debug(\"updates to validators\", \"updates\", types.ValidatorListString(validatorUpdates))\n\t}\n\n\t// Update the state with the block and responses.\n\trs, err := abci.MarshalTxResults(finalizeBlockResponse.TxResults)\n\tif err != nil {\n\t\treturn state, fmt.Errorf(\"marshaling TxResults: %w\", err)\n\t}\n\th := merkle.HashFromByteSlices(rs)\n\tstate, err = state.Update(blockID, &block.Header, h, finalizeBlockResponse.ConsensusParamUpdates, validatorUpdates)\n\tif err != nil {\n\t\treturn state, fmt.Errorf(\"commit failed for application: %w\", err)\n\t}\n\n\t// Lock mempool, commit app state, update mempoool.\n\tappHash, retainHeight, err := blockExec.Commit(ctx, state, block, finalizeBlockResponse.TxResults)\n\tif err != nil {\n\t\treturn state, fmt.Errorf(\"commit failed for application: %w\", err)\n\t}\n\n\t// Update evpool with the latest state.\n\tblockExec.evpool.Update(ctx, state, block.Evidence)\n\n\t// Update the app hash and save the state.\n\tstate.AppHash = appHash\n\tif err := blockExec.store.Save(state); err != nil {\n\t\treturn state, err\n\t}\n\n\t// Prune old heights, if requested by ABCI app.\n\tif retainHeight > 0 {\n\t\tpruned, err := blockExec.pruneBlocks(retainHeight)\n\t\tif err != nil {\n\t\t\tblockExec.logger.Error(\"failed to prune blocks\", \"retain_height\", retainHeight, \"err\", err)\n\t\t} else {\n\t\t\tblockExec.logger.Debug(\"pruned blocks\", \"pruned\", pruned, \"retain_height\", retainHeight)\n\t\t}\n\t}\n\n\t// reset the verification cache\n\tblockExec.cache = make(map[string]struct{})\n\n\t// Events are fired after everything else.\n\t// NOTE: if we crash between Commit and Save, events wont be fired during replay\n\tfireEvents(ctx, blockExec.logger, blockExec.eventBus, block, blockID, finalizeBlockResponse, validatorUpdates)\n\n\treturn state, nil\n}", "title": "" }, { "docid": "1b62f4f1f5160be79aaa8cf1f49351ea", "score": "0.517111", "text": "func (c *Configuration) WriteAsync(ctx context.Context, arg *State) error {\n\treturn c.writeAsync(ctx, arg)\n}", "title": "" }, { "docid": "aa48fc1480e23ffc8553f3a2b232b205", "score": "0.5165176", "text": "func (p *InmemProxy) CommitBlock(block hashgraph.Block) (proxy.CommitResponse, error) {\n\n\tcoinbaseAddress, err := p.getCoinbase(block)\n\tif err != nil {\n\t\treturn proxy.CommitResponse{}, err\n\t}\n\n\tp.logger.WithFields(logrus.Fields{\n\t\t\"coinbase\": coinbaseAddress.String(),\n\t\t\"block\": block.Index(),\n\t}).Info(\"Commit\")\n\n\tblockHashBytes, err := block.Hash()\n\tblockHash := ethCommon.BytesToHash(blockHashBytes)\n\n\tfor i, tx := range block.Transactions() {\n\t\tif err := p.state.ApplyTransaction(tx, i, blockHash, coinbaseAddress); err != nil {\n\t\t\tp.logger.WithError(err).Errorf(\"Failed to apply tx %d of %d\", i+1, len(block.Transactions()))\n\t\t}\n\t}\n\n\thash, err := p.state.Commit()\n\tif err != nil {\n\t\treturn proxy.CommitResponse{}, err\n\t}\n\n\tinternalTransactionReceipts := p.processInternalTransactions(block.InternalTransactions())\n\n\tevictionReceipts := p.processEvictions(block)\n\n\treceipts := append(internalTransactionReceipts, evictionReceipts...)\n\n\tres := proxy.CommitResponse{\n\t\tStateHash: hash.Bytes(),\n\t\tInternalTransactionReceipts: receipts,\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "1c9a33a3343c1e0df28c09fa263ac8bf", "score": "0.51640606", "text": "func (s *service) SyncBlockchain(nodeURL string) error {\n\treq, _ := http.NewRequest(\"GET\", nodeURL, nil)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := http.Client{}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tvar bc Blockchain\n\tjson.NewDecoder(resp.Body).Decode(&bc)\n\n\tvar blocks []mining.Block\n\tfor _, b := range bc.Chain {\n\t\tblocks = append(blocks, mining.Block{\n\t\t\tTimestamp: b.Timestamp,\n\t\t\tLastHash: b.LastHash,\n\t\t\tHash: b.Hash,\n\t\t\tData: toMiningTransactions(b.Data),\n\t\t\tNonce: b.Nonce,\n\t\t\tDifficulty: b.Difficulty,\n\t\t})\n\t}\n\tmbc := &mining.Blockchain{Chain: blocks}\n\n\treturn s.m.ReplaceChain(mbc)\n}", "title": "" }, { "docid": "4bcc3ff888cb12052f2826e16ec41052", "score": "0.5161448", "text": "func HandleWriteBlock(s *service.Service) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvar m Message\n\n\t\tdecoder := json.NewDecoder(r.Body)\n\t\tif err := decoder.Decode(&m); err != nil {\n\t\t\trespondWithJSON(w, r, http.StatusBadRequest, r.Body)\n\t\t\treturn\n\t\t}\n\t\tdefer r.Body.Close()\n\n\t\tnewBlock, err := s.InsertNewBlock(r.Context(), m.Value)\n\t\tif err != nil {\n\t\t\trespondWithJSON(w, r, http.StatusInternalServerError, m)\n\t\t\treturn\n\t\t}\n\n\t\trespondWithJSON(w, r, http.StatusCreated, *newBlock)\n\t}\n}", "title": "" }, { "docid": "719978c71b1a2e0e6413692e9925ff45", "score": "0.51513875", "text": "func (sdb *stateDB) PutBlock(ctx context.Context, blk *block.Block) error {\n\tsdb.mutex.Lock()\n\ttimer := sdb.timerFactory.NewTimer(\"Commit\")\n\tsdb.mutex.Unlock()\n\tdefer timer.End()\n\tproducer := blk.PublicKey().Address()\n\tif producer == nil {\n\t\treturn errors.New(\"failed to get address\")\n\t}\n\tg := genesis.MustExtractGenesisContext(ctx)\n\tctx = protocol.WithBlockCtx(\n\t\tprotocol.WithRegistry(ctx, sdb.registry),\n\t\tprotocol.BlockCtx{\n\t\t\tBlockHeight: blk.Height(),\n\t\t\tBlockTimeStamp: blk.Timestamp(),\n\t\t\tGasLimit: g.BlockGasLimit,\n\t\t\tProducer: producer,\n\t\t},\n\t)\n\tctx = protocol.WithFeatureCtx(ctx)\n\tkey := generateWorkingSetCacheKey(blk.Header, blk.Header.ProducerAddress())\n\tws, isExist, err := sdb.getFromWorkingSets(ctx, key)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !isExist {\n\t\tif !sdb.skipBlockValidationOnPut {\n\t\t\terr = ws.ValidateBlock(ctx, blk)\n\t\t} else {\n\t\t\terr = ws.Process(ctx, blk.RunnableActions().Actions())\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.L().Error(\"Failed to update state.\", zap.Error(err))\n\t\t\treturn err\n\t\t}\n\t}\n\tsdb.mutex.Lock()\n\tdefer sdb.mutex.Unlock()\n\treceipts, err := ws.Receipts()\n\tif err != nil {\n\t\treturn err\n\t}\n\tblk.Receipts = receipts\n\th, _ := ws.Height()\n\tif sdb.currentChainHeight+1 != h {\n\t\t// another working set with correct version already committed, do nothing\n\t\treturn fmt.Errorf(\n\t\t\t\"current state height %d + 1 doesn't match working set height %d\",\n\t\t\tsdb.currentChainHeight, h,\n\t\t)\n\t}\n\n\tif err := ws.Commit(ctx); err != nil {\n\t\treturn err\n\t}\n\tsdb.currentChainHeight = h\n\treturn nil\n}", "title": "" }, { "docid": "bbdadd00fdf055d4a3944a57bacb52d3", "score": "0.51510257", "text": "func (b *Block) MarshalBlock() ([]byte, error) {\n\treturn proto.Marshal(b)\n}", "title": "" }, { "docid": "43c2b939ab29f02eeb62b0cea5ab22f3", "score": "0.5150999", "text": "func SendUpdateBlock(conn net.Conn, block *Block) {\n\tencoder := gob.NewEncoder(conn)\n\tgossipMesg := \"UPDATEBLOCK\" + \"\\n\"\n\tfmt.Fprintf(conn, gossipMesg)\n\tencoder.Encode(*block)\n}", "title": "" }, { "docid": "f889935e0a1c620ec633f372e6c4599e", "score": "0.51506025", "text": "func SendBlock(conn net.Conn, block *Block) {\n\tencoder := gob.NewEncoder(conn)\n\tgossipMesg := \"BLOCK\" + \"\\n\"\n\tfmt.Fprintf(conn, gossipMesg)\n\tencoder.Encode(*block)\n}", "title": "" }, { "docid": "733cbfa1f50996518a3aa5da76b0c61c", "score": "0.51501906", "text": "func handleCommentWriteBlock(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tvar t StdInput\n\n\tdecoder := json.NewDecoder(r.Body)\n\tif err := decoder.Decode(&t); err != nil {\n\t\trespondWithJSON(w, r, http.StatusBadRequest, r.Body)\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\tmutex.Lock()\n\tnewBlock := generateBlock(Blockchain[len(Blockchain)-1], t.Comment, \"\", 0)\n\tmutex.Unlock()\n\n\tif isBlockValid(newBlock, Blockchain[len(Blockchain)-1]) {\n\t\tmutex.Lock()\n\t\tBlockchain = append(Blockchain, newBlock)\n\t\t// save2File()\n\t\tmutex.Unlock()\n\t\tspew.Dump(Blockchain)\n\t}\n\n\trespondWithJSON(w, r, http.StatusCreated, newBlock)\n}", "title": "" }, { "docid": "590e600b8f9e71398b2228b53c760fb2", "score": "0.51296985", "text": "func (this *boltConnImpl) SendSync() {\n\tthis.EmitGeneric(\"sync\", \"\", \"\", \"\", nil, 0, false)\n\tthis.Flush()\n}", "title": "" }, { "docid": "735db6bdd0e8f4b4d9077046eb0cc0ea", "score": "0.5122504", "text": "func (w *SyncWriter) Write(b []byte) error {\n\tif _, err := w.w.Write(b); err != nil {\n\t\treturn err\n\t}\n\treturn w.syncFn()\n}", "title": "" }, { "docid": "c8ddcd55021df45fa677ce31a6845eea", "score": "0.51209277", "text": "func SendBlock(addr string, b *blockchain.Block) {\n\t// create the block to send and seralize the actual block\n\tdata := Block{nodeAddress, b.Serialize()}\n\n\t// convert it to bytes\n\tpayload := GobEncode(data)\n\n\t//prepend the command in bytes\n\trequest := append(CmdToBytes(\"block\"), payload...)\n\n\tSendData(addr, request)\n}", "title": "" }, { "docid": "0e8cfaa657890223fdc5e99e31ca51c7", "score": "0.5110012", "text": "func (be *FlushingBackend) FlushSync(ctx context.Context) error {\n\treturn be.Flush()\n}", "title": "" }, { "docid": "4d990042cba03fa6ca998da63a7f928d", "score": "0.5107222", "text": "func (chain *Chain) StoreBlock(b *Block) {\n\t// print(\"writing block to disk, depth:\", b.Depth)\n\n\tblockData, err := json.Marshal(b)\n\tutil.CheckErr(err)\n\n\tblockFileName := strconv.FormatInt(b.Depth, 10)\n\n\tif ok, _ := util.Exists(CHAINDIR + blockFileName); ok {\n\t\tprint(\"duplicate block depth detected!\")\n\t\treturn\n\t}\n\n\tioutil.WriteFile(CHAINDIR + blockFileName, blockData, 0644)\n\tchain.updateIndex(b)\n\tchain.Blocks = append(chain.Blocks, b)\n\n\tprint(\"new block written, depth:\",\n\t\tb.Depth, \"Epoch:\", b.Ts / util.EPOCHLEN)\n}", "title": "" }, { "docid": "8cab87399317b8703a16915868a82806", "score": "0.51065147", "text": "func (cfg *Config) Sync() (err error) {\n\tif !filepath.IsAbs(cfg.ConfigPath) {\n\t\tcfg.ConfigPath, err = filepath.Abs(cfg.ConfigPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvar d []byte\n\td, err = yaml.Marshal(cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn ioutil.WriteFile(cfg.ConfigPath, d, 0600)\n}", "title": "" }, { "docid": "96611c1fe22358a02a8f5cc28a2f5157", "score": "0.5105917", "text": "func (consensus *Consensus) BlocksSynchronized() {\n\tconsensus.syncReadyChan <- struct{}{}\n}", "title": "" }, { "docid": "a607d6c32f689d44a5b778617f5ab6fd", "score": "0.50910604", "text": "func (wstream *UnorderedStream) WriteSync(bytes []byte) {\n}", "title": "" }, { "docid": "908bfb7ea84b9ef5983a3290f69d517c", "score": "0.5076807", "text": "func handleWriteBlock(w http.ResponseWriter, r *http.Request) {\n\tvar m Message\n\n\tdecoder := json.NewDecoder(r.Body)\n\tif err := decoder.Decode(&m); err != nil {\n\t\trespondWithJSON(w, r, http.StatusBadRequest, r.Body)\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\tnewBlock, err := generateBlock(FullBlockchain[len(FullBlockchain)-1], m.Item)\n\tif err != nil {\n\t\trespondWithJSON(w, r, http.StatusInternalServerError, m)\n\t\treturn\n\t}\n\tif isBlockValid(newBlock, FullBlockchain[len(FullBlockchain)-1]) {\n\t\tnewBlockchain := append(FullBlockchain, newBlock)\n\t\treplaceChain(newBlockchain)\n\t\tspew.Dump(FullBlockchain)\n\t}\n\n\trespondWithJSON(w, r, http.StatusCreated, newBlock)\n\n}", "title": "" }, { "docid": "014c6becabbdf5427c9d669a7d2d02a7", "score": "0.50596476", "text": "func (s *Store) SaveBlock(block *BlockInfo) {\n\tkey := fmt.Sprintf(\"%s/%s\", poolBlocksKeyPrefix, block.Start)\n\n\tbuf := &bytes.Buffer{}\n\tenc := json.NewEncoder(buf)\n\tenc.SetEscapeHTML(false)\n\tif err := enc.Encode(block); err != nil {\n\t\tpanic(err)\n\t}\n\n\ts.SaveRecord(key, buf.Bytes())\n}", "title": "" }, { "docid": "f383a0da9c5028ff36377508ee820bc8", "score": "0.5021597", "text": "func (db *BlockDB) Sync() {\n\tdb.blockindx.Sync()\n\tdb.blockdata.Sync()\n}", "title": "" }, { "docid": "fd021f446b1b9f0c615209294ee89fb8", "score": "0.5014069", "text": "func ExecCommitBlock(\n\tctx context.Context,\n\tbe *BlockExecutor,\n\tappConn abciclient.Client,\n\tblock *types.Block,\n\tlogger log.Logger,\n\tstore Store,\n\tinitialHeight int64,\n\ts State,\n) ([]byte, error) {\n\tpbh := block.Header.ToProto()\n\tfinalizeBlockResponse, err := appConn.FinalizeBlock(\n\t\tctx,\n\t\tabci.RequestFinalizeBlock{\n\t\t\tHash: block.Hash(),\n\t\t\tHeader: *pbh,\n\t\t\tTxs: block.Txs.ToSliceOfBytes(),\n\t\t\tDecidedLastCommit: buildLastCommitInfo(block, store, initialHeight),\n\t\t\tByzantineValidators: block.Evidence.ToABCI(),\n\t\t},\n\t)\n\n\tif err != nil {\n\t\tlogger.Error(\"executing block\", \"err\", err)\n\t\treturn nil, err\n\t}\n\tlogger.Info(\"executed block\", \"height\", block.Height)\n\n\t// the BlockExecutor condition is using for the final block replay process.\n\tif be != nil {\n\t\terr = validateValidatorUpdates(finalizeBlockResponse.ValidatorUpdates, s.ConsensusParams.Validator)\n\t\tif err != nil {\n\t\t\tlogger.Error(\"validating validator updates\", \"err\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tvalidatorUpdates, err := types.PB2TM.ValidatorUpdates(finalizeBlockResponse.ValidatorUpdates)\n\t\tif err != nil {\n\t\t\tlogger.Error(\"converting validator updates to native types\", \"err\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tbps, err := block.MakePartSet(types.BlockPartSizeBytes)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tblockID := types.BlockID{Hash: block.Hash(), PartSetHeader: bps.Header()}\n\t\tfireEvents(ctx, be.logger, be.eventBus, block, blockID, finalizeBlockResponse, validatorUpdates)\n\t}\n\n\t// Commit block, get hash back\n\tres, err := appConn.Commit(ctx)\n\tif err != nil {\n\t\tlogger.Error(\"client error during proxyAppConn.Commit\", \"err\", res)\n\t\treturn nil, err\n\t}\n\n\t// ResponseCommit has no error or log, just data\n\treturn res.Data, nil\n}", "title": "" }, { "docid": "9bbf79a5849152be9ecd74e0bc5a2c81", "score": "0.50054985", "text": "func (n *Node) Synchronize(p *d.SyncParams, stream d.DistributionService_SynchronizeServer) error {\n\tlog.Infof(\"Synchronization started. Sending all Blocks to another Node.\")\n\th := n.PostChain.LastHash()\n\tb := n.PostChain.Get(h)\n\n\tc := [32]byte{}\n\tvar blst list.List\n\tfor {\n\t\tblst.PushBack(b.Content)\n\t\tif b.PrevHash == c {\n\t\t\tbreak\n\t\t}\n\t\tb = n.PostChain.Get(b.PrevHash)\n\t}\n\tblk := []*chain.Block{}\n\tblk, _ = n.PostChain.DumpChain()\n\n\tfor i := len(blk) - 2; i >= 0; i-- {\n\t\terr := stream.Send(&d.Block{\n\t\t\tContent: blk[i].Content,\n\t\t\tNonce: blk[i].Nonce,\n\t\t\tPrevious: blk[i].PrevHash[:],\n\t\t\tType: blk[i].Type,\n\t\t\tPubKey: blk[i].PubKey,\n\t\t\tDate: blk[i].Date.Unix(),\n\t\t\tSignature: blk[i].Signature,\n\t\t})\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t}\n\t}\n\tlog.Infof(\"Synchronization finished successfully.\")\n\treturn nil\n}", "title": "" }, { "docid": "f1021b1985b9a1a1cd868fbb2eab0e57", "score": "0.50053245", "text": "func (s *Service) SaveBlock(req model.CreateBlockRequest) error {\n\tcount, err := s.Node1.Count()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlastBlock, err := s.Node1.GetLastBlock()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tprevID := count\n\tprevHash := lastBlock.Hash\n\ttimestamp := time.Now().String()\n\n\tblock, err := model.GenerateNewBlock(\n\t\tprevID+1,\n\t\ttimestamp,\n\t\tprevHash,\n\t\treq.Data,\n\t)\n\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\treturn err\n\t}\n\n\t// Saving to Node1\n\terr = s.Node1.SaveBlock(*block)\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\treturn err\n\t}\n\n\t// Saving to Node2\n\terr = s.Node2.SaveBlock(*block)\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\treturn err\n\t}\n\n\t// Saving to Node3\n\terr = s.Node3.SaveBlock(*block)\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "43ced7a68714f1d445e529ed82d83a53", "score": "0.49925196", "text": "func (chunk *Chunk) SetBlock(x, y, z int, bs level.BlockState) error {\n\trbs, err := FromRawBlockState(bs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn chunk.SetBlockAtStorage(x, y, z, DefaultStorageIndex, rbs)\n}", "title": "" }, { "docid": "b0f8acc066debc57584e8990afbb8108", "score": "0.49771893", "text": "func (t *Torrent) writeBlock(data []byte, piece, begin int) error {\n\toff := int64(piece*t.mi.Info.PieceLen + begin)\n\t_, err := t.storage.WriteBlock(data, off)\n\treturn err\n}", "title": "" }, { "docid": "6778f670e807bcbcda7bc6f326b2dfc7", "score": "0.49605155", "text": "func (w *Wallet) connectBlock(dbtx walletdb.ReadWriteTx, b wtxmgr.BlockMeta) error {\n\taddrmgrNs := dbtx.ReadWriteBucket(waddrmgrNamespaceKey)\n\ttxmgrNs := dbtx.ReadWriteBucket(wtxmgrNamespaceKey)\n\n\tchainClient, err := w.requireChainClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbs := waddrmgr.BlockStamp{\n\t\tHeight: b.Height,\n\t\tHash: b.Hash,\n\t}\n\tlog.Infof(\"Connecting block %v, height %v\", bs.Hash, bs.Height)\n\n\terr = w.Manager.SetSyncedTo(addrmgrNs, &bs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Handle automatic ticket purchasing if enabled. This function should\n\t// not error due to an error purchasing tickets (several tickets may be\n\t// have been purhcased and successfully published, as well as addresses\n\t// created and used), so just log it instead.\n\terr = w.handleTicketPurchases(dbtx)\n\tswitch err.(type) {\n\tcase nil:\n\tcase txauthor.InsufficientFundsError:\n\t\tlog.Debugf(\"Insufficient funds to auto-purchase maximum number \" +\n\t\t\t\"of tickets\")\n\tdefault:\n\t\tlog.Errorf(\"Failed to perform automatic picket purchasing: %v\", err)\n\t}\n\n\t// Insert the block if we haven't already through a relevant tx.\n\terr = w.TxStore.InsertBlock(txmgrNs, &b)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Couldn't insert block %v into database: %v\",\n\t\t\tb.Hash, err)\n\t\treturn err\n\t}\n\n\t// Rollback testing for simulation network, if enabled.\n\tif b.Height < rollbackTestHeight && w.rollbackTesting {\n\t\tdbd, err := w.TxStore.DatabaseDump(txmgrNs, addrmgrNs, b.Height, nil)\n\t\tif err != nil {\n\t\t\tpanicStr := fmt.Sprintf(\"Failed to dump database at connection \"+\n\t\t\t\t\"of block %v (height %v): %v\",\n\t\t\t\tb.Hash,\n\t\t\t\tb.Height,\n\t\t\t\terr.Error())\n\t\t\tpanic(panicStr)\n\t\t}\n\n\t\tif dbd.OneConfBalance != dbd.OneConfCalcBalance {\n\t\t\tlog.Warnf(\"Balance calculations incongruent. The spendable \"+\n\t\t\t\t\"balance was %v, but the recalculated spendable balance \"+\n\t\t\t\t\"was %v\",\n\t\t\t\tdbd.OneConfBalance,\n\t\t\t\tdbd.OneConfCalcBalance)\n\t\t}\n\n\t\tw.rollbackBlockDB[uint32(b.Height)] = dbd\n\t}\n\n\t// We've reached the height to begin the rollback testing from.\n\tif b.Height == rollbackTestHeight && w.rollbackTesting {\n\t\tlog.Infof(\"Height for rollback testing reached, beginning \" +\n\t\t\t\"database evaluations.\")\n\t\tfinalHeight := rollbackTestHeight - rollbackTestDepth\n\t\tfor i := rollbackTestHeight; i >= finalHeight; i-- {\n\t\t\terr := w.TxStore.Rollback(txmgrNs, addrmgrNs, int32(i))\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Error rolling back block at height %v: %v\",\n\t\t\t\t\ti, err)\n\t\t\t}\n\n\t\t\trolledbackDb, err := w.TxStore.DatabaseDump(txmgrNs, addrmgrNs, int32(i-1),\n\t\t\t\tw.rollbackBlockDB[uint32(i-1)].BucketUnminedInputs)\n\t\t\tif err != nil {\n\t\t\t\tpanicStr := fmt.Sprintf(\"Failed to dump database at \"+\n\t\t\t\t\t\"disconnection of block height %v: %v\",\n\t\t\t\t\ti,\n\t\t\t\t\terr.Error())\n\t\t\t\tpanic(panicStr)\n\t\t\t}\n\t\t\tis, errStr := w.rollbackBlockDB[uint32(i-1)].Equals(rolledbackDb,\n\t\t\t\ttrue)\n\t\t\tif !is {\n\t\t\t\tlog.Errorf(\"Database incongruencies detected after rolling \"+\n\t\t\t\t\t\"back to block %v!\\n\"+\n\t\t\t\t\t\"%v\",\n\t\t\t\t\ti-1,\n\t\t\t\t\terrStr)\n\t\t\t} else {\n\t\t\t\tlog.Infof(\"Rollback to height %v proceeded without error.\",\n\t\t\t\t\ti-1)\n\t\t\t}\n\t\t}\n\n\t\tw.Stop()\n\t}\n\n\t// Prune all expired transactions and all stake tickets that no longer\n\t// meet the minimum stake difficulty.\n\tblock, err := chainClient.GetBlock(&b.Hash)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstakeDifficulty := dcrutil.Amount(block.MsgBlock().Header.SBits)\n\terr = w.TxStore.PruneUnconfirmed(txmgrNs, bs.Height, int64(stakeDifficulty))\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to prune unconfirmed transactions when \"+\n\t\t\t\"connecting block height %v: %s\", bs.Height, err.Error())\n\t\treturn err\n\t}\n\n\tw.reorganizingLock.Lock()\n\tisReorganizing, topHash := w.reorganizing, w.reorganizeToHash\n\t// If we've made it to the height where the reorganization is finished,\n\t// revert our reorganization state.\n\tif isReorganizing && bs.Hash == topHash {\n\t\tlog.Infof(\"Wallet reorganization to block %v complete\", topHash)\n\t\tw.reorganizing = false\n\t}\n\tw.reorganizingLock.Unlock()\n\n\t// Notify interested clients of the connected block.\n\t//\n\t// TODO: move all notifications outside of the database transaction.\n\tw.NtfnServer.notifyAttachedBlock(dbtx, &b)\n\treturn nil\n}", "title": "" }, { "docid": "425a0f6e6a4429773c996cc881223b2e", "score": "0.49579206", "text": "func (c *channel) CommitConfig(blockNumber uint64, envelope []byte) error {\n\tcommitConfigMutex.Lock()\n\tdefer commitConfigMutex.Unlock()\n\n\tc.applyLock.Lock()\n\tdefer c.applyLock.Unlock()\n\n\tif len(envelope) == 0 {\n\t\treturn errors.Errorf(\"channel config found nil\")\n\t}\n\n\tenv, err := protoutil.UnmarshalEnvelope(envelope)\n\tif err != nil {\n\t\tlogger.Panicf(\"Cannot get payload from config transaction [%s]: [%s]\", blockNumber, err)\n\t}\n\n\tpayload, err := protoutil.UnmarshalPayload(env.Payload)\n\tif err != nil {\n\t\tlogger.Panicf(\"Cannot get payload from config transaction [%s]: [%s]\", blockNumber, err)\n\t}\n\n\tctx, err := configtx.UnmarshalConfigEnvelope(payload.Data)\n\tif err != nil {\n\t\terr = errors.WithMessage(err, \"error unmarshalling config which passed initial validity checks\")\n\t\tlogger.Criticalf(\"%+v\", err)\n\t\treturn err\n\t}\n\n\ttxid := committer.ConfigTXPrefix + strconv.FormatUint(ctx.Config.Sequence, 10)\n\tvc, err := c.vault.Status(txid)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"failed getting tx's status [%s], with err [%s]\", txid, err))\n\t}\n\tswitch vc {\n\tcase driver.Valid:\n\t\treturn nil\n\tcase driver.Unknown:\n\t\t// this is okay\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"invalid configtx's [%s] status [%d]\", txid, vc))\n\t}\n\n\tvar bundle *channelconfig.Bundle\n\tif c.Resources() == nil {\n\t\t// setup the genesis block\n\t\tbundle, err = channelconfig.NewBundle(c.name, ctx.Config, factory.GetDefault())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tconfigTxValidator := c.Resources().ConfigtxValidator()\n\t\terr := configTxValidator.Validate(ctx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbundle, err = channelconfig.NewBundle(configTxValidator.ChannelID(), ctx.Config, factory.GetDefault())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tchannelconfig.LogSanityChecks(bundle)\n\t\tcapabilitiesSupportedOrPanic(bundle)\n\t}\n\n\tif err := c.commitConfig(txid, blockNumber, ctx.Config.Sequence, envelope); err != nil {\n\t\treturn errors.Wrapf(err, \"failed committing configtx to the vault\")\n\t}\n\n\tc.lock.Lock()\n\tc.resources = bundle\n\tc.lock.Unlock()\n\n\treturn nil\n}", "title": "" }, { "docid": "770f94f805515c85682081b999b4ffc7", "score": "0.4955125", "text": "func NewMockBlockSync(ctrl *gomock.Controller) *MockBlockSync {\n\tmock := &MockBlockSync{ctrl: ctrl}\n\tmock.recorder = &MockBlockSyncMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "e997f840f773321c91e001f49097ece8", "score": "0.49299142", "text": "func (s *Server) PutBlock(blockData Block, succ *bool) error {\n\treturn s.BlockStore.PutBlock(blockData, succ)\n}", "title": "" }, { "docid": "9f655c0a9fd8feeedca084761e8d4d8c", "score": "0.49148527", "text": "func (app *BaseApp) FinalizeBlock(req *abci.RequestFinalizeBlock) (*abci.ResponseFinalizeBlock, error) {\n\tvar events []abci.Event\n\n\tif err := app.checkHalt(req.Height, req.Time); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := app.validateFinalizeBlockHeight(req); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif app.cms.TracingEnabled() {\n\t\tapp.cms.SetTracingContext(storetypes.TraceContext(\n\t\t\tmap[string]any{\"blockHeight\": req.Height},\n\t\t))\n\t}\n\n\theader := cmtproto.Header{\n\t\tChainID: app.chainID,\n\t\tHeight: req.Height,\n\t\tTime: req.Time,\n\t\tProposerAddress: req.ProposerAddress,\n\t\tNextValidatorsHash: req.NextValidatorsHash,\n\t\tAppHash: app.LastCommitID().Hash,\n\t}\n\n\t// finalizeBlockState should be set on InitChain or ProcessProposal. If it is\n\t// nil, it means we are replaying this block and we need to set the state here\n\t// given that during block replay ProcessProposal is not executed by CometBFT.\n\tif app.finalizeBlockState == nil {\n\t\tapp.setState(execModeFinalize, header)\n\t}\n\n\t// Context is now updated with Header information.\n\tapp.finalizeBlockState.ctx = app.finalizeBlockState.ctx.\n\t\tWithBlockHeader(header).\n\t\tWithHeaderHash(req.Hash).\n\t\tWithHeaderInfo(coreheader.Info{\n\t\t\tChainID: app.chainID,\n\t\t\tHeight: req.Height,\n\t\t\tTime: req.Time,\n\t\t\tHash: req.Hash,\n\t\t\tAppHash: app.LastCommitID().Hash,\n\t\t}).\n\t\tWithConsensusParams(app.GetConsensusParams(app.finalizeBlockState.ctx)).\n\t\tWithVoteInfos(req.DecidedLastCommit.Votes).\n\t\tWithExecMode(sdk.ExecModeFinalize).\n\t\tWithCometInfo(cometInfo{\n\t\t\tMisbehavior: req.Misbehavior,\n\t\t\tValidatorsHash: req.NextValidatorsHash,\n\t\t\tProposerAddress: req.ProposerAddress,\n\t\t\tLastCommit: req.DecidedLastCommit,\n\t\t})\n\n\t// GasMeter must be set after we get a context with updated consensus params.\n\tgasMeter := app.getBlockGasMeter(app.finalizeBlockState.ctx)\n\tapp.finalizeBlockState.ctx = app.finalizeBlockState.ctx.WithBlockGasMeter(gasMeter)\n\n\tif app.checkState != nil {\n\t\tapp.checkState.ctx = app.checkState.ctx.\n\t\t\tWithBlockGasMeter(gasMeter).\n\t\t\tWithHeaderHash(req.Hash)\n\t}\n\n\tif app.preFinalizeBlockHook != nil {\n\t\tif err := app.preFinalizeBlockHook(app.finalizeBlockState.ctx, req); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tbeginBlock, err := app.beginBlock(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tevents = append(events, beginBlock.Events...)\n\n\t// Iterate over all raw transactions in the proposal and attempt to execute\n\t// them, gathering the execution results.\n\t//\n\t// NOTE: Not all raw transactions may adhere to the sdk.Tx interface, e.g.\n\t// vote extensions, so skip those.\n\ttxResults := make([]*abci.ExecTxResult, 0, len(req.Txs))\n\tfor _, rawTx := range req.Txs {\n\t\tvar response *abci.ExecTxResult\n\n\t\tif _, err := app.txDecoder(rawTx); err == nil {\n\t\t\tresponse = app.deliverTx(rawTx)\n\t\t} else {\n\t\t\t// In the case where a transaction included in a block proposal is malformed,\n\t\t\t// we still want to return a default response to comet. This is because comet\n\t\t\t// expects a response for each transaction included in a block proposal.\n\t\t\tresponse = sdkerrors.ResponseExecTxResultWithEvents(\n\t\t\t\tsdkerrors.ErrTxDecode,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t\tnil,\n\t\t\t\tfalse,\n\t\t\t)\n\t\t}\n\n\t\ttxResults = append(txResults, response)\n\t}\n\n\tif app.finalizeBlockState.ms.TracingEnabled() {\n\t\tapp.finalizeBlockState.ms = app.finalizeBlockState.ms.SetTracingContext(nil).(storetypes.CacheMultiStore)\n\t}\n\n\tendBlock, err := app.endBlock(app.finalizeBlockState.ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tevents = append(events, endBlock.Events...)\n\tcp := app.GetConsensusParams(app.finalizeBlockState.ctx)\n\n\treturn &abci.ResponseFinalizeBlock{\n\t\tEvents: events,\n\t\tTxResults: txResults,\n\t\tValidatorUpdates: endBlock.ValidatorUpdates,\n\t\tConsensusParamUpdates: &cp,\n\t\tAppHash: app.workingHash(),\n\t}, nil\n}", "title": "" }, { "docid": "d947fba4f51c4bdfd8ef81be071ec9c5", "score": "0.49100074", "text": "func IsConfigBlock(block *cb.Block) bool {\n\tenvelope, err := ExtractEnvelope(block, 0)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tpayload, err := UnmarshalPayload(envelope.Payload)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tif payload.Header == nil {\n\t\treturn false\n\t}\n\n\thdr, err := UnmarshalChannelHeader(payload.Header.ChannelHeader)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn cb.HeaderType(hdr.Type) == cb.HeaderType_CONFIG || cb.HeaderType(hdr.Type) == cb.HeaderType_ORDERER_TRANSACTION\n}", "title": "" }, { "docid": "0960081684a2fb0b6dc87695c93b47c8", "score": "0.4908494", "text": "func PutBlock(_db *gorm.DB, _block *types.Block) bool {\n\tstatus := true\n\n\tif err := _db.Create(&Blocks{\n\t\tHash: _block.Hash().Hex(),\n\t\tNumber: _block.NumberU64(),\n\t\tTime: _block.Time(),\n\t\tParentHash: _block.ParentHash().Hex(),\n\t\tDifficulty: _block.Difficulty().String(),\n\t\tGasUsed: _block.GasUsed(),\n\t\tGasLimit: _block.GasLimit(),\n\t\tNonce: _block.Nonce(),\n\t\tMiner: _block.Coinbase().Hex(),\n\t\tSize: float64(_block.Size()),\n\t\tTransactionRootHash: _block.TxHash().Hex(),\n\t\tReceiptRootHash: _block.ReceiptHash().Hex(),\n\t}).Error; err != nil {\n\t\tstatus = false\n\t\tlog.Printf(\"[!] Failed to persist block : %d : %s\\n\", _block.NumberU64(), err.Error())\n\t}\n\n\treturn status\n}", "title": "" }, { "docid": "c9dce7157cec8c841910b24c3839bd01", "score": "0.48961967", "text": "func Sync() error {\n\treturn DefaultConfig.Sync()\n}", "title": "" }, { "docid": "b1f5e817834a49ba7d554b15263b7bfd", "score": "0.48942336", "text": "func (ledgerTestWrapper *ledgerTestWrapper) PutRawBlock(block *protos.Block, blockNumber uint64) {\n\terr := ledgerTestWrapper.ledger.PutBlock(blockNumber, block)\n\ttestutil.AssertNoError(ledgerTestWrapper.tb, err, \"error while verifying chain\")\n}", "title": "" }, { "docid": "a0d95051d04b6933262f2ba1da877ff3", "score": "0.48905137", "text": "func (node *Node) BroadcastNewBlock(newBlock *types.Block) {\n\tgroups := []nodeconfig.GroupID{node.NodeConfig.GetClientGroupID()}\n\tutils.Logger().Info().Msgf(\"broadcasting new block %d, group %s\", newBlock.NumberU64(), groups[0])\n\tmsg := host.ConstructP2pMessage(byte(0), proto_node.ConstructBlocksSyncMessage([]*types.Block{newBlock}))\n\tif err := node.host.SendMessageToGroups(groups, msg); err != nil {\n\t\tutils.Logger().Warn().Err(err).Msg(\"cannot broadcast new block\")\n\t}\n}", "title": "" }, { "docid": "9157cf40b19d23910ee9afa26463de31", "score": "0.4886478", "text": "func writeBlock(b wire.MsgBlock, height int, f *os.File,\n\tbatchan chan *leveldb.Batch, wg *sync.WaitGroup) error {\n\n\tvar s string\n\tblockBatch := new(leveldb.Batch)\n\n\tfor blockindex, tx := range b.Transactions {\n\t\tfor _, in := range tx.TxIn {\n\t\t\tif blockindex > 0 { // skip coinbase \"spend\"\n\t\t\t\topString := in.PreviousOutPoint.String()\n\t\t\t\ts += \"-\" + opString + \"\\n\"\n\t\t\t\th := HashFromString(opString)\n\t\t\t\tblockBatch.Put(h[:], U32tB(uint32(height)))\n\t\t\t}\n\t\t}\n\n\t\t// creates all txos up to index indicated\n\t\ts += \"+\" + wire.OutPoint{tx.TxHash(), uint32(len(tx.TxOut))}.String()\n\n\t\tfor i, out := range tx.TxOut {\n\t\t\tif IsUnspendable(out) {\n\t\t\t\ts += \"z\" + fmt.Sprintf(\"%d\", i)\n\t\t\t}\n\t\t}\n\t\ts += \"\\n\"\n\t}\n\n\t//\tfmt.Printf(\"--- sending off %d dels at height %d\\n\", batch.Len(), height)\n\twg.Add(1)\n\tbatchan <- blockBatch\n\n\ts += fmt.Sprintf(\"h: %d\\n\", height)\n\t_, err := f.WriteString(s)\n\n\treturn err\n}", "title": "" }, { "docid": "5cc891278d778af07a3fc7b9ff0602a6", "score": "0.48800838", "text": "func TestSynchronizeSynced(t *testing.T) {\n\tcs, eb, _ := setupSynchronizer(t)\n\n\t// subscribe to topics.Block\n\tblockChan := make(chan *bytes.Buffer, 1)\n\t_ = eb.Subscribe(string(topics.Block), blockChan)\n\n\t// Make a block which should follow our genesis block\n\tblk := randomBlockBuffer(t, 1, 20)\n\n\tif err := cs.Synchronize(blk); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// The synchronizer should put this block on the blockChan\n\t<-blockChan\n}", "title": "" }, { "docid": "2f411811525ec01aa11cf42f0856492f", "score": "0.48780963", "text": "func (instance *fbftCore) blockSyncHandler() {\n\t// obtain blockchain instance to used to get current block\n\tbchain, err := repository.NewLatestStateRepository()\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"failed to create blockchain as: %v\", err))\n\t}\n\t// start loop to wait for sync request\n\tfor {\n\t\tsyncReq := <-instance.blockSyncChan\n\t\tinstance.doSyncBlock(bchain, syncReq)\n\t}\n}", "title": "" }, { "docid": "116594d5d0dc59bb0d74cffe932c0fb6", "score": "0.48748925", "text": "func (b *Blockchain) CommitBlock() (*flowgo.Block, error) {\n\tb.mu.Lock()\n\tdefer b.mu.Unlock()\n\n\tblock, err := b.commitBlock()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn block, nil\n}", "title": "" }, { "docid": "fe51db32ec7bab0602d8ea183f76b426", "score": "0.48741138", "text": "func (p *ChainMonitor) BlockConnectedSync(hash *chainhash.Hash) {\n\t// Connections go one at a time so signals cannot be mixed\n\tp.syncConnect.Lock()\n\tdefer p.syncConnect.Unlock()\n\t// lock with buffered channel, accepting handoff in BlockConnectedHandler\n\tp.ConnectingLock <- struct{}{}\n\tp.blockChan <- hash\n\t// wait\n\t<-p.DoneConnecting\n}", "title": "" }, { "docid": "1a15747848cee9cb9461d2fc20fca2d9", "score": "0.48516515", "text": "func (f *Frame) SetBlock(x, y, z int, b Block) {\n\tp := pos{x / ncx, y / ncy, z / ncz}\n\tc := f.chunks[p]\n\tc[x%ncx][y%ncy][z%ncz] = b\n\tif b.IsEmpty() && c.isEmpty() {\n\t\tdelete(f.chunks, p)\n\t} else {\n\t\tf.chunks[p] = c\n\t}\n}", "title": "" }, { "docid": "002a04e7f042185501be89262aed00b6", "score": "0.48466346", "text": "func (s *Server) WriteWireGuardConfigFile(device string) error {\n\tif s.config.WG.ConfigDirectoryPath == \"\" {\n\t\treturn nil // writing disabled\n\t}\n\tif err := syscall.Access(s.config.WG.ConfigDirectoryPath, syscall.O_RDWR); err != nil {\n\t\treturn errors.Wrap(err, \"failed to check WireGuard config access rights\")\n\t}\n\n\tdev := s.peers.GetDevice(device)\n\tcfg, err := dev.GetConfigFile(s.peers.GetActivePeers(device))\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"failed to get config file\")\n\t}\n\tfilePath := path.Join(s.config.WG.ConfigDirectoryPath, dev.DeviceName+\".conf\")\n\tif err := ioutil.WriteFile(filePath, cfg, 0644); err != nil {\n\t\treturn errors.Wrap(err, \"failed to write WireGuard config file\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9550bc85ab060f6b74c386484abc602d", "score": "0.4824329", "text": "func (c *Chain) TryNextConsecutiveBlockOutSync(blk block.Block, kadcastHeight byte) error {\n\tlog.WithField(\"height\", blk.Header.Height).Trace(\"accepting sync block\")\n\treturn c.AcceptBlock(blk)\n}", "title": "" }, { "docid": "6633062d9e9fb5a507e454f0a3d1bae0", "score": "0.482257", "text": "func (p *ChainMonitor) BlockConnectedSync(hash *chainhash.Hash) {\n\t// Connections go one at a time so signals cannot be mixed\n\tp.syncConnect.Lock()\n\tdefer p.syncConnect.Unlock()\n\t// lock with buffered channel\n\tp.ConnectingLock <- struct{}{}\n\tp.blockChan <- hash\n\t// wait\n\t<-p.DoneConnecting\n}", "title": "" }, { "docid": "e78ae0e59c970dc18ca6996d694bef7d", "score": "0.4821923", "text": "func (c *columnInfo) SetSync(b bool) {\n\tc._isSync = b\n}", "title": "" }, { "docid": "957ec428ed660acba36a3080be329198", "score": "0.48198912", "text": "func (be *FlushingBackend) SendSync(ctx context.Context, span *ssf.SSFSpan) error {\n\tif be.sendErrorSrc != nil {\n\t\tif err := be.sendErrorSrc(span); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tbe.mutex.Lock()\n\tdefer be.mutex.Unlock()\n\n\tbe.batch = append(be.batch, span)\n\treturn nil\n}", "title": "" }, { "docid": "1dbd929ed579896663640b21c45e5b2d", "score": "0.481864", "text": "func (w *HotCache) CheckWritePeerSync(peer *core.PeerInfo, region *core.RegionInfo) *HotPeerStat {\n\treturn w.writeCache.checkPeerFlow(peer, region)\n}", "title": "" }, { "docid": "9c4090fcf21e6ccd04ba76c0c18d29d7", "score": "0.4815014", "text": "func (mc *Chain) UpdateFinalizedBlock(ctx context.Context, b *block.Block) {\n\tlogging.Logger.Info(\"update finalized block\", zap.Int64(\"round\", b.Round), zap.String(\"block\", b.Hash), zap.Int64(\"lf_round\", mc.GetLatestFinalizedBlock().Round), zap.Int64(\"current_round\", mc.GetCurrentRound()), zap.Float64(\"weight\", b.Weight()), zap.Float64(\"chain_weight\", b.ChainWeight))\n\tif config.Development() {\n\t\tfor _, t := range b.Txns {\n\t\t\tif !t.DebugTxn() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlogging.Logger.Info(\"update finalized block (debug transaction)\", zap.String(\"txn\", t.Hash), zap.String(\"block\", b.Hash))\n\t\t}\n\t}\n\tmc.FinalizeBlock(ctx, b)\n\tgo mc.SendFinalizedBlock(ctx, b)\n\tfr := mc.GetRound(b.Round)\n\tif fr != nil {\n\t\tfr.Finalize(b)\n\t}\n\tmc.DeleteRoundsBelow(ctx, b.Round)\n}", "title": "" }, { "docid": "faebd703b0654191441f8b3495a4e533", "score": "0.48054016", "text": "func NewMsgSyncSlimBlock(s shard.Index, block *SlimBlock) *MsgSyncSlimBlock {\n\tmsg := MsgSyncSlimBlock{}\n\tmsg.ReqShardIdx = s\n\tmsg.SlimBlock = block\n\treturn &msg\n}", "title": "" }, { "docid": "c70916f91a878de5a5d08966b8c24d5e", "score": "0.48051995", "text": "func (s *blockStore) writeBlock(rawBlock []byte) (blockLocation, error) {\n\tblockLen := uint32(len(rawBlock))\n\tfullLen := blockLen + 8\n\n\twc := s.writeCursor\n\tfinalOffset := wc.curOffset + fullLen\n\tif finalOffset < wc.curOffset || finalOffset > s.maxBlockFileSize {\n\t\twc.Lock()\n\t\twc.curFile.Lock()\n\t\tif wc.curFile.file != nil {\n\t\t\t_ = wc.curFile.file.Close()\n\t\t\twc.curFile.file = nil\n\t\t}\n\t\twc.curFile.Unlock()\n\n\t\twc.curFileNum++\n\t\twc.curOffset = 0\n\t\twc.Unlock()\n\t}\n\n\twc.curFile.Lock()\n\tdefer wc.curFile.Unlock()\n\n\tif wc.curFile.file == nil {\n\t\tfile, err := s.openWriteFileFunc(wc.curFileNum)\n\t\tif err != nil {\n\t\t\treturn blockLocation{}, err\n\t\t}\n\t\twc.curFile.file = file\n\t}\n\n\torigOffset := wc.curOffset\n\thasher := crc32.New(castagnoli)\n\tvar scratch [4]byte\n\n\t// Block length\n\tbyteOrder.PutUint32(scratch[:], blockLen)\n\tif err := s.writeData(scratch[:], \"block length\"); err != nil {\n\t\treturn blockLocation{}, err\n\t}\n\t_, _ = hasher.Write(scratch[:])\n\n\t// Serialized block\n\tif err := s.writeData(rawBlock[:], \"block\"); err != nil {\n\t\treturn blockLocation{}, err\n\t}\n\t_, _ = hasher.Write(rawBlock)\n\n\t// checksum\n\tif err := s.writeData(hasher.Sum(nil), \"checksum\"); err != nil {\n\t\treturn blockLocation{}, err\n\t}\n\n\tloc := blockLocation{\n\t\tblockFileNum: wc.curFileNum,\n\t\tfileOffset: origOffset,\n\t\tblockLen: fullLen,\n\t}\n\treturn loc, nil\n}", "title": "" }, { "docid": "92bb7eca744ecc634efc7028b8046963", "score": "0.4798246", "text": "func (b *Buffer) WriteBlock(p []byte, tag BlockTag) (int, error) {\n\tlenp := len(p)\n\tif lenp+BlockHeaderSize > b.Cap() {\n\t\treturn 0, bytes.ErrTooLarge\n\t}\n\tfor lenp+BlockHeaderSize > b.Cap()-b.Len() {\n\t\theader, _, err := b.WriteBlockTo(ioutil.Discard)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tb.Evicted(header)\n\t}\n\tb.headerbuf[0] = uint8(tag)\n\tbinary.LittleEndian.PutUint32(b.headerbuf[1:], uint32(lenp))\n\tif n := copy(b.buf[b.write:], b.headerbuf[:]); n < len(b.headerbuf) {\n\t\tb.write = copy(b.buf, b.headerbuf[n:])\n\t} else {\n\t\tb.write = (b.write + n) % b.Cap()\n\t}\n\tif n := copy(b.buf[b.write:], p); n < lenp {\n\t\tb.write = copy(b.buf, p[n:])\n\t} else {\n\t\tb.write = (b.write + n) % b.Cap()\n\t}\n\tb.len += lenp + BlockHeaderSize\n\treturn lenp, nil\n}", "title": "" }, { "docid": "3f749c074eac1806e063bfbd851e07c3", "score": "0.47956955", "text": "func (gco *globalConfigOwner) CommitUpdate(config *Config) {\n\toldConf := gco.Get()\n\tGCO.c.Store(unsafe.Pointer(config))\n\n\t// TODO: Notify listeners is protected by GCO lock to make sure\n\t// that config updates are done in correct order. But it has\n\t// performance impact and it needs to be revisited.\n\tgco.notifyListeners(oldConf)\n\n\tgco.mtx.Unlock()\n}", "title": "" }, { "docid": "ee80a6afae5b49a25f2d527637dacfa1", "score": "0.47853756", "text": "func (bc *blockchain) commitBlock(blk *Block) error {\n\tif err := bc.dao.putBlock(blk); err != nil {\n\t\treturn err\n\t}\n\t// update tip hash and height\n\tbc.mu.Lock()\n\tdefer bc.mu.Unlock()\n\tbc.tipHeight = blk.Header.height\n\tbc.tipHash = blk.HashBlock()\n\t// update UTXO pool\n\tbc.utk.UpdateUtxoPool(blk)\n\treturn nil\n}", "title": "" }, { "docid": "525010dcc6166c64017e4c8c8624ab9e", "score": "0.47811636", "text": "func PutBlock(_db *gorm.DB, _block *types.Block) {\n\tif err := _db.Create(&Blocks{\n\t\tHash: _block.Hash().Hex(),\n\t\tNumber: _block.NumberU64(),\n\t\tTime: _block.Time(),\n\t\tParentHash: _block.ParentHash().Hex(),\n\t\tDifficulty: _block.Difficulty().String(),\n\t\tGasUsed: _block.GasUsed(),\n\t\tGasLimit: _block.GasLimit(),\n\t\tNonce: _block.Nonce(),\n\t}).Error; err != nil {\n\t\tlog.Printf(\"[!] Failed to persist block : %d : %s\\n\", _block.NumberU64(), err.Error())\n\t}\n}", "title": "" }, { "docid": "c2a35a223e20ef6a3793a75326129a42", "score": "0.47797772", "text": "func (t *Trans) SetSync(syncStmt string) {\n\tt.syncStmt = syncStmt\n}", "title": "" }, { "docid": "20639459815b764f884e4775a8d56435", "score": "0.4772048", "text": "func (oasis *Oasis) syncChain(block *Block) error {\n\tctx := context.Background()\n\tapi := staking.NewStakingClient(oasis.conn)\n\tgen, err := api.StateToGenesis(ctx, block.Height)\n\tif err != nil {\n\t\tlog.Fatalf(\"syncChain: Failed to sync, %v\\n\", err)\n\t\treturn err\n\t}\n\n\t// Update New State Atomically\n\tcurrState := (*unsafe.Pointer)(unsafe.Pointer(&oasis.State))\n\tnextState := unsafe.Pointer(&chainState{\n\t\tBlock: block,\n\t\tHeight: block.Height,\n\t\tSnapshot: gen,\n\t})\n\n\tatomic.StorePointer(currState, nextState)\n\treturn nil\n}", "title": "" }, { "docid": "f08525a64aae14b168bb070d9559394c", "score": "0.4761447", "text": "func (d *OPRBlockStore) WriteOPRBlock(opr *OprBlock) error {\n\t// And opr block has both a graded component and sorted by difficulty component.\n\t// To save space, we can just keep the graded component, and resort the oprs when we pull them.\n\n\tobj := OPRBlockDatabaseObject{\n\t\tGradedOprs: opr.GradedOPRs,\n\t\tDblockHeight: opr.Dbht,\n\t\tEmptyOPRBlock: opr.EmptyOPRBlock,\n\t\tTotalNumberRecords: opr.TotalNumberRecords,\n\t}\n\n\tdata, err := database.Encode(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// The multiple indexes. First we write the OPR block to the first index by height. This is where\n\t// the raw data will live\n\terr = d.DB.Put(database.BUCKET_OPR_HEIGHT, database.HeightToBytes(obj.DblockHeight), data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: Add more indexing if you need more\n\n\treturn nil\n}", "title": "" }, { "docid": "9db55fe0be1c4df6e79428f1152c0829", "score": "0.47596326", "text": "func (p *peer) AsyncSendNewBlockHash(block *types.Block) {\n\tselect {\n\tcase p.queuedBlockAnns <- block:\n\t\t// Mark all the block hash as known, but ensure we don't overflow our limits\n\t\tfor p.knownBlocks.Cardinality() >= maxKnownBlocks {\n\t\t\tp.knownBlocks.Pop()\n\t\t}\n\t\tp.knownBlocks.Add(block.Hash())\n\tdefault:\n\t\tp.Log().Debug(\"Dropping block announcement\", \"number\", block.NumberU64(), \"hash\", block.Hash())\n\t}\n}", "title": "" }, { "docid": "d869bdb20253d8276b4015138281b20b", "score": "0.4757715", "text": "func (sw *SyncWriter) Write(ctx context.Context, name string, input []byte) error {\n\tsw.Lock()\n\tdefer sw.Unlock()\n\tif ctx.Err() != nil {\n\t\treturn ctx.Err()\n\t}\n\tq, ok := sw.data[name]\n\tif !ok {\n\t\tsw.data[name] = sw.open(name)\n\t\tq = sw.data[name]\n\t}\n\td := q.Prep(input)\n\tif ctx.Err() != nil {\n\t\treturn ctx.Err()\n\t}\n\t// Simulate slow writes\n\tsw.data[name].Write(d)\n\treturn nil\n}", "title": "" }, { "docid": "c3777780d0ec3cf99b5beeaab2947ad0", "score": "0.4748038", "text": "func UpdateBlock(_db *gorm.DB, _block *types.Block) bool {\n\tstatus := true\n\n\tif err := _db.Where(\"number = ?\", _block.NumberU64()).Updates(&Blocks{\n\t\tHash: _block.Hash().Hex(),\n\t\tTime: _block.Time(),\n\t\tParentHash: _block.ParentHash().Hex(),\n\t\tDifficulty: _block.Difficulty().String(),\n\t\tGasUsed: _block.GasUsed(),\n\t\tGasLimit: _block.GasLimit(),\n\t\tNonce: _block.Nonce(),\n\t\tMiner: _block.Coinbase().Hex(),\n\t\tSize: float64(_block.Size()),\n\t\tTransactionRootHash: _block.TxHash().Hex(),\n\t\tReceiptRootHash: _block.ReceiptHash().Hex(),\n\t}).Error; err != nil {\n\t\tstatus = false\n\t\tlog.Printf(\"[!] Failed to update block : %d : %s\\n\", _block.NumberU64(), err.Error())\n\t}\n\n\treturn status\n}", "title": "" }, { "docid": "bb059ea39965f2ff6d64a6cc68270e98", "score": "0.4740753", "text": "func (cs *chunkserver) CommitWrite(chunk apis.ChunkNum, hash apis.CommitHash, oldVersion apis.Version, newVersion apis.Version) error {\n\tcs.mu.Lock()\n\tdefer cs.mu.Unlock()\n\n\tif newVersion <= oldVersion {\n\t\treturn errors.New(\"cannot rewrite history\")\n\t}\n\n\tlatest, err := cs.Storage.GetLatestVersion(chunk)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif latest != oldVersion {\n\t\treturn fmt.Errorf(\"attempt to write to mismatched version (%d/%d -> %d/%d) when latest is %d/%d\",\n\t\t\tchunk, oldVersion, chunk, newVersion, chunk, latest)\n\t}\n\n\twrite, found := cs.Hashes[hash]\n\tif !found {\n\t\treturn errors.New(\"could not locate write by commit hash\")\n\t}\n\n\tdata, err := cs.Storage.ReadVersion(chunk, oldVersion)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdataLen := int(write.Offset) + len(write.Data)\n\tif dataLen < len(data) {\n\t\tdataLen = len(data)\n\t}\n\tif dataLen > int(apis.MaxChunkSize) {\n\t\tpanic(\"invariant broken: length of block should never exceed MaxChunkSize\")\n\t}\n\n\tnewData := make([]byte, dataLen)\n\tcopy(newData, data)\n\tcopy(newData[write.Offset:], write.Data)\n\n\treturn cs.Storage.WriteVersion(chunk, newVersion, newData)\n}", "title": "" }, { "docid": "d5b115270c77da948a71e7edbb165019", "score": "0.47370905", "text": "func (sync *SyncService) syncBlocks() {\n\tchannelInfo, err := sync.fabClient.Ledger().QueryInfo()\n\tif err != nil {\n\t\tlogger.Error(\"failed to fetch channel info when syncing blocks\")\n\t\treturn\n\t}\n\t// fetch the latest height of fabric network\n\tblockHeight := channelInfo.BCI.Height - 1\n\tlogger.Debugf(\"now the block of fabric is %d\", blockHeight)\n\tsyncedMaxBlockHeight := model.GetMaxBlockHeight(sync.channelId)\n\tlogger.Debugf(\"now the block height of db is %d\", syncedMaxBlockHeight)\n\tif blockHeight != 0 && blockHeight > syncedMaxBlockHeight {\n\t\tif syncedMaxBlockHeight != 0 {\n\t\t\tsyncedMaxBlockHeight++\n\t\t}\n\t\tfor i := syncedMaxBlockHeight; i <= blockHeight; i++ {\n\t\t\tlogger.WithField(\"block_id\", i).Debug(\"start syncing block\")\n\t\t\t// begin session\n\t\t\tsession := model.BeginSession()\n\t\t\t// sync blocks\n\t\t\t_ = sync.syncBlock(session, i)\n\t\t\tsession.Commit()\n\n\t\t\tlogger.WithField(\"block_id\", i).Debug(\"finish syncing block\")\n\t\t}\n\t\tlogger.Info(\"finish syncing blocks\")\n\t} else {\n\t\t// nothing to sync\n\t\tlogger.WithField(\"synced_block_height\", syncedMaxBlockHeight).Info(\"no blocks need to be synchronized\")\n\t}\n}", "title": "" }, { "docid": "0c9baa11acae1c625b9e4a6bf4060ea8", "score": "0.47345856", "text": "func (this *spoutConnImpl) SendSync() {\n\tthis.EmitGeneric(\"sync\", \"\", \"\", \"\", nil, 0, false)\n\tthis.readyToSend = false\n\tthis.Flush()\n}", "title": "" }, { "docid": "a915a2e02d2878e61c62f944a83dcede", "score": "0.47276258", "text": "func (d *chainDB) CommitBlock(block *util.Block, newTip bool) (fps uint32, err error) {\n\terr = d.h.Put(&block.Header, newTip)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tif newTip {\n\t\treturn d.t.PutTxs(block.Transactions, block.Height)\n\t}\n\n\thash := block.Hash()\n\treturn 0, d.t.PutForkTxs(block.Transactions, &hash)\n}", "title": "" }, { "docid": "5abc0621c34d56dbcb2aa0357dacd715", "score": "0.4723279", "text": "func (c *Config) Sync() error {\n\t// if config file exist, read it\n\tif com.IsFile(CONFIG_FILE) {\n\t\tfile, err := ini.Load(CONFIG_FILE)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn file.MapTo(c)\n\t}\n\t// create file\n\tc.IsNew = true\n\tfile := ini.Empty()\n\tif err := file.ReflectFrom(c); err != nil {\n\t\treturn err\n\t}\n\tf, err := os.OpenFile(CONFIG_FILE, os.O_CREATE|os.O_RDWR|os.O_TRUNC, os.ModePerm)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = file.WriteToIndent(f, \" \")\n\treturn err\n}", "title": "" }, { "docid": "0b17ae5f9a0902e37b69a0f944963414", "score": "0.47224206", "text": "func (n *Nimbus) Writeblock(b, x, y int) {\n\t// Retrieve image block and draw it\n\timg := n.imageBlocks[b]\n\t_, height := img.Size()\n\tex, ey := n.convertPos(x, y, height)\n\top := &ebiten.DrawImageOptions{}\n\top.GeoM.Translate(ex, ey)\n\tn.paper.DrawImage(img, op)\n}", "title": "" }, { "docid": "5ac29ba13eac259d06d13152075b4e01", "score": "0.47090176", "text": "func (s *Store) SetBlock(b *BlockInfo) {\n\ts.set(s.table.Blocks, b.Index.Bytes(), b)\n\n\t// Add to LRU cache.\n\tif b != nil && s.cache.Blocks != nil {\n\t\ts.cache.Blocks.Add(b.Index, b)\n\t}\n}", "title": "" }, { "docid": "43d1627d20b488eed429fca5ef33a42c", "score": "0.46990818", "text": "func (blockExec *BlockExecutor) Commit(\n\tctx context.Context,\n\tstate State,\n\tblock *types.Block,\n\ttxResults []*abci.ExecTxResult,\n) ([]byte, int64, error) {\n\tblockExec.mempool.Lock()\n\tdefer blockExec.mempool.Unlock()\n\n\t// while mempool is Locked, flush to ensure all async requests have completed\n\t// in the ABCI app before Commit.\n\terr := blockExec.mempool.FlushAppConn(ctx)\n\tif err != nil {\n\t\tblockExec.logger.Error(\"client error during mempool.FlushAppConn\", \"err\", err)\n\t\treturn nil, 0, err\n\t}\n\n\t// Commit block, get hash back\n\tres, err := blockExec.appClient.Commit(ctx)\n\tif err != nil {\n\t\tblockExec.logger.Error(\"client error during proxyAppConn.Commit\", \"err\", err)\n\t\treturn nil, 0, err\n\t}\n\n\t// ResponseCommit has no error code - just data\n\tblockExec.logger.Info(\n\t\t\"committed state\",\n\t\t\"height\", block.Height,\n\t\t\"num_txs\", len(block.Txs),\n\t\t\"app_hash\", fmt.Sprintf(\"%X\", res.Data),\n\t)\n\n\t// Update mempool.\n\terr = blockExec.mempool.Update(\n\t\tctx,\n\t\tblock.Height,\n\t\tblock.Txs,\n\t\ttxResults,\n\t\tTxPreCheckForState(state),\n\t\tTxPostCheckForState(state),\n\t)\n\n\treturn res.Data, res.RetainHeight, err\n}", "title": "" }, { "docid": "a7c50c91910af4528f0006f7a945d515", "score": "0.46956047", "text": "func WriteSync(fpath string, data []byte, perm os.FileMode) error {\n\tf, err := os.OpenFile(fpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\n\tif err == nil {\n\t\terr = f.Sync()\n\t}\n\n\tif e := f.Close(); err == nil {\n\t\terr = e\n\t}\n\treturn err\n}", "title": "" }, { "docid": "b8d833c966775b367f50ecaf89f72e28", "score": "0.46667448", "text": "func (s *Session) WriteSyncFrame(ctx context.Context, f frame.Frame) bool {\n\treturn s.WriteFrame(ctx, f) && s.FlushWriter(ctx)\n}", "title": "" }, { "docid": "f6340009d4d814e547d556b92c762961", "score": "0.4655411", "text": "func (i *Initializer) CommitConfig() {}", "title": "" }, { "docid": "03adf48b83c694a25914c36897e5b55d", "score": "0.4642472", "text": "func (node *Node) PostConsensusProcessing(newBlock *types.Block, commitSigAndBitmap []byte) {\n\tif _, err := node.Blockchain().InsertChain([]*types.Block{newBlock}, true); err != nil {\n\t\tutils.Logger().Error().\n\t\t\tErr(err).\n\t\t\tUint64(\"blockNum\", newBlock.NumberU64()).\n\t\t\tStr(\"parentHash\", newBlock.Header().ParentHash().Hex()).\n\t\t\tStr(\"hash\", newBlock.Header().Hash().Hex()).\n\t\t\tMsg(\"Error Adding new block to blockchain\")\n\t\treturn\n\t}\n\tutils.Logger().Info().\n\t\tUint64(\"blockNum\", newBlock.NumberU64()).\n\t\tStr(\"hash\", newBlock.Header().Hash().Hex()).\n\t\tMsg(\"Added New Block to Blockchain!!!\")\n\n\t// Update last consensus time for metrics\n\t// TODO: randomly selected a few validators to broadcast messages instead of only leader broadcast\n\t// TODO: refactor the asynchronous calls to separate go routine.\n\tnode.lastConsensusTime = time.Now().Unix()\n\tif node.Consensus.PubKey.IsEqual(node.Consensus.LeaderPubKey) {\n\t\tif node.NodeConfig.ShardID == 0 {\n\t\t\tnode.BroadcastNewBlock(newBlock)\n\t\t}\n\t\tif node.NodeConfig.ShardID != shard.BeaconChainShardID && node.Blockchain().Config().IsCrossLink(newBlock.Epoch()) {\n\t\t\tnode.BroadcastCrossLink(newBlock)\n\t\t}\n\t\tnode.BroadcastCXReceipts(newBlock, commitSigAndBitmap)\n\t} else {\n\t\tutils.Logger().Info().\n\t\t\tUint64(\"blockNum\", newBlock.NumberU64()).\n\t\t\tUint64(\"epochNum\", newBlock.Epoch().Uint64()).\n\t\t\tUint64(\"ViewId\", newBlock.Header().ViewID().Uint64()).\n\t\t\tStr(\"blockHash\", newBlock.Hash().String()).\n\t\t\tInt(\"numTxns\", len(newBlock.Transactions())).\n\t\t\tInt(\"numStakingTxns\", len(newBlock.StakingTransactions())).\n\t\t\tMsg(\"BINGO !!! Reached Consensus\")\n\t\t// 15% of the validator also need to do broadcasting\n\t\trand.Seed(time.Now().UTC().UnixNano())\n\t\trnd := rand.Intn(100)\n\t\tif rnd < 0 {\n\t\t\t// Beacon validators also broadcast new blocks to make sure beacon sync is strong.\n\t\t\tif node.NodeConfig.ShardID == 0 {\n\t\t\t\tnode.BroadcastNewBlock(newBlock)\n\t\t\t}\n\t\t\tnode.BroadcastCXReceipts(newBlock, commitSigAndBitmap)\n\t\t}\n\t}\n\n\t// Broadcast client requested missing cross shard receipts if there is any\n\tnode.BroadcastMissingCXReceipts()\n\n\t// Update consensus keys at last so the change of leader status doesn't mess up normal flow\n\tif len(newBlock.Header().ShardState()) > 0 {\n\t\tnode.Consensus.UpdateConsensusInformation()\n\t}\n\n\t// TODO chao: uncomment this after beacon syncing is stable\n\t// node.Blockchain().UpdateCXReceiptsCheckpointsByBlock(newBlock)\n}", "title": "" }, { "docid": "7742446bcb0ab3e3dbc534bbf136f52f", "score": "0.46388024", "text": "func (bw *BlockWriter) Flush() error {\n\tif bw.flushed {\n\t\tpanic(\"flush called again\")\n\t} else {\n\t\tbw.flushed = true\n\t}\n\tif len(bw.block) > 0 {\n\t\tbw.total += uint64(len(bw.block)) + checksumSize\n\t\tif err := bw.processNewBlock(bw.block, bw.h.Sum(nil)); err != nil {\n\t\t\tplog.Infof(\"onNewBlock failed %v\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\ttotalbs := make([]byte, 8)\n\tbinary.LittleEndian.PutUint64(totalbs, uint64(bw.total))\n\ttailBlock := append(totalbs, writerMagicNumber...)\n\tif err := bw.processNewBlock(tailBlock, nil); err != nil {\n\t\tplog.Infof(\"process tail block failed %v\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a3ee70c8a8721c30f9d9196b409efdaa", "score": "0.4636269", "text": "func (p *DsyncPlugin) WriteConfig() error {\n\tdata, err := json.MarshalIndent(p, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ioutil.WriteFile(p.configPath, data, os.ModePerm)\n}", "title": "" }, { "docid": "95738cc5f192caf6b081739e5a2acfee", "score": "0.4635434", "text": "func (s *Store) SetBlock(b *inter.Block) {\n\ts.set(s.table.Blocks, b.Index.Bytes(), b)\n\n\t// Add to LRU cache.\n\tif b != nil && s.cache.Blocks != nil {\n\t\ts.cache.Blocks.Add(string(b.Index.Bytes()), b)\n\t}\n}", "title": "" }, { "docid": "89510951f3686b0aa68f67f8bafe8770", "score": "0.46311176", "text": "func (d *Device) SmbusWriteBlockData(command uint8, length uint8, value []byte) (err error) {\n\td.Lock()\n\tdefer d.Unlock()\n\n\treturn i2c_smbus_write_block_data(d.f, command, length, value)\n}", "title": "" }, { "docid": "f32b506100442daa890d56899ef552bc", "score": "0.4621714", "text": "func NewBlockWriter(blockSize uint64,\n\tonNewBlock func(data []byte, crc []byte) error,\n\tt pb.ChecksumType) *BlockWriter {\n\treturn newBlockWriter(blockSize, onNewBlock, t)\n}", "title": "" }, { "docid": "3cf5831326902c5f298161dfe05fc201", "score": "0.46193126", "text": "func (surfClient *RPCClient) PutBlock(block Block, succ *bool) error {\n\t// connect to the server\n\tconn, e := rpc.DialHTTP(\"tcp\", surfClient.ServerAddr)\n\tif e != nil {\n\t\treturn e\n\t}\n\n\t// perform the call\n\te = conn.Call(\"Server.PutBlock\", block, succ)\n\tif e != nil {\n\t\tconn.Close()\n\t\treturn e\n\t}\n\n\t// close the connection\n\treturn conn.Close()\n}", "title": "" }, { "docid": "d722dc069a9db1e47f8d406a9a3c821e", "score": "0.46173507", "text": "func (l *Ledger) ConfirmBlock(block *pb.InternalBlock, isRoot bool) ConfirmStatus {\n\tl.mutex.Lock()\n\tdefer l.mutex.Unlock()\n\tblkTimer := global.NewXTimer()\n\tl.xlog.Info(\"start to confirm block\", \"blockid\", fmt.Sprintf(\"%x\", block.Blockid), \"txCount\", len(block.Transactions))\n\tvar confirmStatus ConfirmStatus\n\tdummyTransactions := []*pb.Transaction{}\n\trealTransactions := block.Transactions // 真正的交易转存到局部变量\n\tblock.Transactions = dummyTransactions // block表不保存transaction详情\n\n\tbatchWrite := l.baseDB.NewBatch()\n\tnewMeta := proto.Clone(l.meta).(*pb.LedgerMeta)\n\tsplitHeight := newMeta.TrunkHeight\n\tif isRoot { //确认创世块\n\t\tif block.PreHash != nil && len(block.PreHash) > 0 {\n\t\t\tconfirmStatus.Succ = false\n\t\t\tl.xlog.Warn(\"genesis block shoud has no prehash\")\n\t\t\treturn confirmStatus\n\t\t}\n\t\tif len(l.meta.RootBlockid) > 0 {\n\t\t\tconfirmStatus.Succ = false\n\t\t\tconfirmStatus.Error = ErrRootBlockAlreadyExist\n\t\t\tl.xlog.Warn(\"already hash genesis block\")\n\t\t\treturn confirmStatus\n\t\t}\n\t\tnewMeta.RootBlockid = block.Blockid\n\t\tnewMeta.TrunkHeight = 0 //代表主干上块的最大高度\n\t\tnewMeta.TipBlockid = block.Blockid\n\t\tblock.InTrunk = true\n\t\tblock.Height = 0 // 创世纪块是第0块\n\t} else { //非创世块,需要判断是在主干还是分支\n\t\tpreHash := block.PreHash\n\t\tpreBlock, findErr := l.fetchBlock(preHash)\n\t\tif findErr != nil {\n\t\t\tl.xlog.Warn(\"find pre block fail\", \"findErr\", findErr)\n\t\t\tconfirmStatus.Succ = false\n\t\t\treturn confirmStatus\n\t\t}\n\t\tblock.Height = preBlock.Height + 1 //不管是主干还是分支,height都是++\n\t\tif bytes.Equal(preBlock.Blockid, newMeta.TipBlockid) {\n\t\t\t//在主干上添加\n\t\t\tblock.InTrunk = true\n\t\t\tpreBlock.NextHash = block.Blockid\n\t\t\tnewMeta.TipBlockid = block.Blockid\n\t\t\tnewMeta.TrunkHeight++\n\t\t\t//因为改了pre_block的next_hash值,所以也要写回存储\n\t\t\tif !DisableTxDedup {\n\t\t\t\tsaveErr := l.saveBlock(preBlock, batchWrite)\n\t\t\t\tl.blockCache.Del(string(preBlock.Blockid))\n\t\t\t\tif saveErr != nil {\n\t\t\t\t\tl.xlog.Warn(\"save block fail\", \"saveErr\", saveErr)\n\t\t\t\t\tconfirmStatus.Succ = false\n\t\t\t\t\treturn confirmStatus\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t//在分支上\n\t\t\tif preBlock.Height+1 > newMeta.TrunkHeight {\n\t\t\t\t//分支要变成主干了\n\t\t\t\toldTip := append([]byte{}, newMeta.TipBlockid...)\n\t\t\t\tnewMeta.TrunkHeight = preBlock.Height + 1\n\t\t\t\tnewMeta.TipBlockid = block.Blockid\n\t\t\t\tblock.InTrunk = true\n\t\t\t\tsplitBlock, splitErr := l.handleFork(oldTip, preBlock.Blockid, block.Blockid, batchWrite) //处理分叉\n\t\t\t\tsplitHeight = splitBlock.Height\n\t\t\t\tconfirmStatus.Split = true\n\t\t\t\tconfirmStatus.TrunkSwitch = true\n\t\t\t\tif splitErr != nil {\n\t\t\t\t\tl.xlog.Warn(\"handle split failed\", \"splitErr\", splitErr)\n\t\t\t\t\tconfirmStatus.Succ = false\n\t\t\t\t\treturn confirmStatus\n\t\t\t\t}\n\t\t\t\tl.xlog.Info(\"handle split successfully\", \"splitBlock\", fmt.Sprintf(\"%x\", splitBlock.Blockid))\n\t\t\t} else {\n\t\t\t\t// 添加在分支上, 对preblock没有影响\n\t\t\t\tblock.InTrunk = false\n\t\t\t\tconfirmStatus.Split = true\n\t\t\t\tconfirmStatus.TrunkSwitch = false\n\t\t\t\tconfirmStatus.Orphan = true\n\t\t\t}\n\t\t}\n\t}\n\tsaveErr := l.saveBlock(block, batchWrite)\n\tblkTimer.Mark(\"saveHeader\")\n\tif saveErr != nil {\n\t\tconfirmStatus.Succ = false\n\t\tl.xlog.Warn(\"save current block fail\", \"saveErr\", saveErr)\n\t\treturn confirmStatus\n\t}\n\ttxExist, txData := l.parallelCheckTx(realTransactions, block)\n\tcbNum := 0\n\tfor _, tx := range realTransactions {\n\t\tif tx.Coinbase {\n\t\t\tcbNum = cbNum + 1\n\t\t}\n\t\tif cbNum > 1 {\n\t\t\tconfirmStatus.Succ = false\n\t\t\tl.xlog.Warn(\"The num of Coinbase tx should not exceed one when confirm block\",\n\t\t\t\t\"BlockID\", global.F(tx.Blockid), \"Miner\", string(block.Proposer))\n\t\t\treturn confirmStatus\n\t\t}\n\n\t\tpbTxBuf := txData[string(tx.Txid)]\n\t\tif pbTxBuf == nil {\n\t\t\tconfirmStatus.Succ = false\n\t\t\tl.xlog.Warn(\"marshal trasaction failed when confirm block\")\n\t\t\treturn confirmStatus\n\t\t}\n\t\thasTx := txExist[string(tx.Txid)]\n\t\t//l.xlog.Debug(\"save tx to confirmed table\", \"txid\", fmt.Sprintf(\"%x\", tx.Txid), \"hasTx\", hasTx)\n\t\tif !hasTx {\n\t\t\tbatchWrite.Put(append([]byte(pb.ConfirmedTablePrefix), tx.Txid...), pbTxBuf)\n\t\t} else {\n\t\t\t//confirm表已经存在这个交易了,需要检查一下是否存在多个主干block包含同样trasnaction的情况\n\t\t\toldPbTxBuf, _ := l.confirmedTable.Get(tx.Txid)\n\t\t\toldTx := &pb.Transaction{}\n\t\t\tparserErr := proto.Unmarshal(oldPbTxBuf, oldTx)\n\t\t\tif parserErr != nil {\n\t\t\t\tconfirmStatus.Succ = false\n\t\t\t\tconfirmStatus.Error = parserErr\n\t\t\t}\n\t\t\toldPbBlockBuf, blockErr := l.blocksTable.Get(oldTx.Blockid)\n\t\t\tif blockErr != nil {\n\t\t\t\tconfirmStatus.Succ = false\n\t\t\t\tconfirmStatus.Error = blockErr\n\t\t\t}\n\t\t\toldBlock := &pb.InternalBlock{}\n\t\t\tparserErr = proto.Unmarshal(oldPbBlockBuf, oldBlock)\n\t\t\tif parserErr != nil {\n\t\t\t\tconfirmStatus.Succ = false\n\t\t\t\tconfirmStatus.Error = parserErr\n\t\t\t}\n\t\t\tif oldBlock.InTrunk && block.InTrunk && oldBlock.Height <= splitHeight {\n\t\t\t\tconfirmStatus.Succ = false\n\t\t\t\tconfirmStatus.Error = ErrTxDuplicated\n\t\t\t\tl.xlog.Warn(\"transaction duplicated in previous trunk block\",\n\t\t\t\t\t\"txid\", fmt.Sprintf(\"%x\", tx.Txid),\n\t\t\t\t\t\"blockid\", fmt.Sprintf(\"%x\", oldBlock.Blockid))\n\t\t\t\treturn confirmStatus\n\t\t\t} else if block.InTrunk {\n\t\t\t\tl.xlog.Warn(\"change blockid of tx\", \"txid\", fmt.Sprintf(\"%x\", tx.Txid), \"blockid\", fmt.Sprintf(\"%x\", block.Blockid))\n\t\t\t\tbatchWrite.Put(append([]byte(pb.ConfirmedTablePrefix), tx.Txid...), pbTxBuf)\n\t\t\t}\n\t\t}\n\t}\n\tblkTimer.Mark(\"saveAllTxs\")\n\t//删除pendingBlock中对应的数据\n\tbatchWrite.Delete(append([]byte(pb.PendingBlocksTablePrefix), block.Blockid...))\n\t//改meta\n\tmetaBuf, pbErr := proto.Marshal(newMeta)\n\tif pbErr != nil {\n\t\tl.xlog.Warn(\"marshal meta fail\", \"pbErr\", pbErr)\n\t\tconfirmStatus.Succ = false\n\t\treturn confirmStatus\n\t}\n\tbatchWrite.Put([]byte(pb.MetaTablePrefix), metaBuf)\n\tl.xlog.Debug(\"print block size when confirm block\", \"blockSize\", batchWrite.ValueSize(), \"blockid\", fmt.Sprintf(\"%x\", block.Blockid))\n\tkvErr := batchWrite.Write() // blocks, confirmed_transaction两张表原子写入\n\tblkTimer.Mark(\"saveToDisk\")\n\tif kvErr != nil {\n\t\tconfirmStatus.Succ = false\n\t\tconfirmStatus.Error = kvErr\n\t\tl.xlog.Warn(\"batch write failed when confirm block\", \"kvErr\", kvErr)\n\t} else {\n\t\tconfirmStatus.Succ = true\n\t\tl.meta = newMeta\n\t}\n\tblock.Transactions = realTransactions\n\tif isRoot { //首次confirm 创始块的时候\n\t\tlErr := l.loadGenesisBlock()\n\t\tif lErr != nil {\n\t\t\tconfirmStatus.Succ = false\n\t\t\tconfirmStatus.Error = lErr\n\t\t}\n\t}\n\tl.blockCache.Add(string(block.Blockid), block)\n\tl.xlog.Debug(\"confirm block cost\", \"blkTimer\", blkTimer.Print())\n\treturn confirmStatus\n}", "title": "" } ]
dd34d469e055f5d7158f67b0ab57900a
SetTaskArns sets the TaskArns field's value.
[ { "docid": "087b2004240f70eefab56077751a5875", "score": "0.8502739", "text": "func (s *ListTasksOutput) SetTaskArns(v []*string) *ListTasksOutput {\n\ts.TaskArns = v\n\treturn s\n}", "title": "" } ]
[ { "docid": "c5a243b3ad900691e5e847bcad0b52e1", "score": "0.74017894", "text": "func (s *ListTaskDefinitionsOutput) SetTaskDefinitionArns(v []*string) *ListTaskDefinitionsOutput {\n\ts.TaskDefinitionArns = v\n\treturn s\n}", "title": "" }, { "docid": "be08a293d105f43c10a16131b276f5d9", "score": "0.69512093", "text": "func (o GetTaskExecutionResultOutput) TaskArns() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetTaskExecutionResult) []string { return v.TaskArns }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "f1958cefdac3963ce3842410433cba10", "score": "0.6331555", "text": "func (s *BatchGetViewInput) SetViewArns(v []*string) *BatchGetViewInput {\n\ts.ViewArns = v\n\treturn s\n}", "title": "" }, { "docid": "8bf4df62b0d3987f07045a99924780df", "score": "0.58605057", "text": "func (s *ListResourcesInput) SetResourceArns(v []*string) *ListResourcesInput {\n\ts.ResourceArns = v\n\treturn s\n}", "title": "" }, { "docid": "23ef6da0b661ec320afbae3cdcc07dac", "score": "0.57537043", "text": "func (s *Filter) SetResourceArns(v []*string) *Filter {\n\ts.ResourceArns = v\n\treturn s\n}", "title": "" }, { "docid": "e8028279344522b5b753724cbbdb90f5", "score": "0.56706953", "text": "func (s *CreateResourceShareInput) SetResourceArns(v []*string) *CreateResourceShareInput {\n\ts.ResourceArns = v\n\treturn s\n}", "title": "" }, { "docid": "0e4666598eb5619ee6705582e4142461", "score": "0.56397295", "text": "func (s *DisassociateResourceShareInput) SetResourceArns(v []*string) *DisassociateResourceShareInput {\n\ts.ResourceArns = v\n\treturn s\n}", "title": "" }, { "docid": "b5a7db4272c3fee13ef0dcd0da4ec7da", "score": "0.5607189", "text": "func (s *AssociateResourceShareInput) SetResourceArns(v []*string) *AssociateResourceShareInput {\n\ts.ResourceArns = v\n\treturn s\n}", "title": "" }, { "docid": "bff5e4095fbea1d8b8a4102df5e3000b", "score": "0.5577672", "text": "func (s *TaskSet) SetTaskSetArn(v string) *TaskSet {\n\ts.TaskSetArn = &v\n\treturn s\n}", "title": "" }, { "docid": "12cab6b5907b55159194ca973a90de53", "score": "0.55151904", "text": "func (s *GetResourcePoliciesInput) SetResourceArns(v []*string) *GetResourcePoliciesInput {\n\ts.ResourceArns = v\n\treturn s\n}", "title": "" }, { "docid": "d4cedf0d996ea3051e0e69918c265541", "score": "0.5281239", "text": "func (m *Printer) SetTaskTriggers(value []PrintTaskTriggerable)() {\n err := m.GetBackingStore().Set(\"taskTriggers\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "6a1c4e13d7b8673926c323e872f4e335", "score": "0.5279429", "text": "func SetIds(t *Task) {\n\tt.Id = str2md5(t.Name+t.Text)\n\t\n\tfor _, subTask := range t.SubTasks {\n\t\tSetIds(subTask)\n\t}\n}", "title": "" }, { "docid": "b796afb29255d3abae56f2b1e34da750", "score": "0.52105016", "text": "func (s *ListServicesOutput) SetServiceArns(v []*string) *ListServicesOutput {\n\ts.ServiceArns = v\n\treturn s\n}", "title": "" }, { "docid": "92c68cb0d3371c2a4e86e0e952a4b37e", "score": "0.49858776", "text": "func (s *ProtectedTask) SetTaskArn(v string) *ProtectedTask {\n\ts.TaskArn = &v\n\treturn s\n}", "title": "" }, { "docid": "09e810033a34a76f656e4489ec3c024b", "score": "0.498109", "text": "func (s *ExecuteCommandOutput) SetTaskArn(v string) *ExecuteCommandOutput {\n\ts.TaskArn = &v\n\treturn s\n}", "title": "" }, { "docid": "2788fd4c9743e105a4064a4573965c8a", "score": "0.49322063", "text": "func (s *ListClustersOutput) SetClusterArns(v []*string) *ListClustersOutput {\n\ts.ClusterArns = v\n\treturn s\n}", "title": "" }, { "docid": "2e9c016094feee41abaf13630f09b6e1", "score": "0.49283066", "text": "func (s *Task) SetTaskArn(v string) *Task {\n\ts.TaskArn = &v\n\treturn s\n}", "title": "" }, { "docid": "bb4b100df77ff3e8592b0dd44bcaa61f", "score": "0.49246517", "text": "func (s *GetResourceSharesInput) SetResourceShareArns(v []*string) *GetResourceSharesInput {\n\ts.ResourceShareArns = v\n\treturn s\n}", "title": "" }, { "docid": "8755f2a4368f47f3b209b047c948edfc", "score": "0.4910778", "text": "func (s *ListResourcesInput) SetResourceShareArns(v []*string) *ListResourcesInput {\n\ts.ResourceShareArns = v\n\treturn s\n}", "title": "" }, { "docid": "85ea61d8425cd9e22334bda670e931fe", "score": "0.49093407", "text": "func (s *GetResourceShareAssociationsInput) SetResourceShareArns(v []*string) *GetResourceShareAssociationsInput {\n\ts.ResourceShareArns = v\n\treturn s\n}", "title": "" }, { "docid": "444c731f1f774f1ad93b4f4b41596c41", "score": "0.4864047", "text": "func (o GetSecretsResultOutput) Arns() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetSecretsResult) []string { return v.Arns }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "606286287462add41f3a1acca41a3c27", "score": "0.48589322", "text": "func (s *AssumeRoleInput) SetPolicyArns(v []*PolicyDescriptorType) *AssumeRoleInput {\n\ts.PolicyArns = v\n\treturn s\n}", "title": "" }, { "docid": "e6991d2e20e8419416a72bfb2cd72308", "score": "0.48585376", "text": "func (s *GetResourceShareInvitationsInput) SetResourceShareArns(v []*string) *GetResourceShareInvitationsInput {\n\ts.ResourceShareArns = v\n\treturn s\n}", "title": "" }, { "docid": "c17b87426c19654be7595dc6dc21fedf", "score": "0.48523816", "text": "func (o TaskOutput) Arn() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Task) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d8e866b0c4f41a484d061716cccf9fcb", "score": "0.48043084", "text": "func (p *Patch) SetVariantsTasks(variantsTasks []VariantTasks) error {\n\tp.SyncVariantsTasks(variantsTasks)\n\treturn UpdateOne(\n\t\tbson.M{IdKey: p.Id},\n\t\tbson.M{\n\t\t\t\"$set\": bson.M{\n\t\t\t\tVariantsTasksKey: variantsTasks,\n\t\t\t\tBuildVariantsKey: p.BuildVariants,\n\t\t\t\tTasksKey: p.Tasks,\n\t\t\t},\n\t\t},\n\t)\n}", "title": "" }, { "docid": "1c0409c6699a0ba5edc0bf0c99be6f24", "score": "0.47380933", "text": "func (p *Patch) SetVariantsTasks(variantsTasks []VariantTasks) error {\n\tp.UpdateVariantsTasks(variantsTasks)\n\treturn UpdateOne(\n\t\tbson.M{IdKey: p.Id},\n\t\tbson.M{\n\t\t\t\"$set\": bson.M{\n\t\t\t\tVariantsTasksKey: variantsTasks,\n\t\t\t\tBuildVariantsKey: p.BuildVariants,\n\t\t\t\tTasksKey: p.Tasks,\n\t\t\t},\n\t\t},\n\t)\n}", "title": "" }, { "docid": "13e461a5c563f299fd3bd7e9294595af", "score": "0.47362852", "text": "func NewTaskIDs(ids ...TaskIDer) TaskIDs {\n\tset := make(TaskIDs)\n\tset.Insert(ids...)\n\treturn set\n}", "title": "" }, { "docid": "75ac674c6ad5f9e935fe61060bfae711", "score": "0.47295263", "text": "func (s *GetFederationTokenInput) SetPolicyArns(v []*PolicyDescriptorType) *GetFederationTokenInput {\n\ts.PolicyArns = v\n\treturn s\n}", "title": "" }, { "docid": "735915b64c929209f29766ac962a6df7", "score": "0.4720819", "text": "func (s *Container) SetTaskArn(v string) *Container {\n\ts.TaskArn = &v\n\treturn s\n}", "title": "" }, { "docid": "62be60830fd66f0c38f39a4f21861346", "score": "0.47114205", "text": "func (s *HumanLoopConfig) SetTaskKeywords(v []*string) *HumanLoopConfig {\n\ts.TaskKeywords = v\n\treturn s\n}", "title": "" }, { "docid": "51d166bce75c3bba43d0c56f83c3d845", "score": "0.46658328", "text": "func (s *QueryLineageInput) SetStartArns(v []*string) *QueryLineageInput {\n\ts.StartArns = v\n\treturn s\n}", "title": "" }, { "docid": "f69347da95f2ad982e8ad5658bc1d9e4", "score": "0.4655973", "text": "func (s *HumanTaskConfig) SetTaskKeywords(v []*string) *HumanTaskConfig {\n\ts.TaskKeywords = v\n\treturn s\n}", "title": "" }, { "docid": "00e14c51d43a4dfe5bd35e02a4d631c7", "score": "0.4649989", "text": "func (s *AssumeRoleWithWebIdentityInput) SetPolicyArns(v []*PolicyDescriptorType) *AssumeRoleWithWebIdentityInput {\n\ts.PolicyArns = v\n\treturn s\n}", "title": "" }, { "docid": "6ae6a47cb4fa2383c058e52aedcf9262", "score": "0.46424723", "text": "func (o TaskDefinitionOutput) Arn() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *TaskDefinition) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6d554e6e6f7ad3dcef188bcf6839945e", "score": "0.46182296", "text": "func (s *AssumeRoleWithSAMLInput) SetPolicyArns(v []*PolicyDescriptorType) *AssumeRoleWithSAMLInput {\n\ts.PolicyArns = v\n\treturn s\n}", "title": "" }, { "docid": "8d7b0d32e1e88ef64ddec601b1f10ce4", "score": "0.45753783", "text": "func (s *ListServicesByNamespaceOutput) SetServiceArns(v []*string) *ListServicesByNamespaceOutput {\n\ts.ServiceArns = v\n\treturn s\n}", "title": "" }, { "docid": "0f0297bca21c3a3fa57198a15561cd51", "score": "0.45722902", "text": "func (s *ListPrincipalsInput) SetResourceShareArns(v []*string) *ListPrincipalsInput {\n\ts.ResourceShareArns = v\n\treturn s\n}", "title": "" }, { "docid": "494c3b6b094dee1372ca599486c7b91d", "score": "0.45689234", "text": "func (s *Runner) SetRegionsPerTask(regionsPerTask int) {\n\tif regionsPerTask < 1 {\n\t\tpanic(\"RangeTaskRunner: regionsPerTask should be at least 1\")\n\t}\n\ts.regionsPerTask = regionsPerTask\n}", "title": "" }, { "docid": "ea06e4abee9d7aa78e5d6656eebabcfb", "score": "0.45619097", "text": "func (m *Planner) SetTasks(value []PlannerTaskable)() {\n m.tasks = value\n}", "title": "" }, { "docid": "274335560094a1c5877b824833a26b4f", "score": "0.4534391", "text": "func (o SecurityProfileOutput) TargetArns() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *SecurityProfile) pulumi.StringArrayOutput { return v.TargetArns }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "ab602a3ee42f2d8ad298b5ef44e2d728", "score": "0.45111203", "text": "func SetTaskRoutes(router *mux.Router) *mux.Router {\n\trouter.HandleFunc(\"/api/tasks\", middleware.AuthMiddleware(controllers.GetTasks)).Methods(\"GET\")\n\trouter.HandleFunc(\"/api/tasks\", middleware.AuthMiddleware(controllers.CreateTask)).Methods(\"POST\")\n\trouter.HandleFunc(\"/api/tasks/{id}\", middleware.AuthMiddleware(controllers.GetSingleTask)).Methods(\"GET\")\n\trouter.HandleFunc(\"/api/tasks/{id}\", middleware.AuthMiddleware(controllers.UpdateTask)).Methods(\"PUT\")\n\trouter.HandleFunc(\"/api/tasks/{id}\", middleware.AuthMiddleware(controllers.DeleteTask)).Methods(\"DELETE\")\n\n\treturn router\n}", "title": "" }, { "docid": "e438111904088abb936c2737d6d8f7ad", "score": "0.45108378", "text": "func (r ecsRunning) getTaskARNs(cluster string, svc arn) []arn {\n\tsvcTaskMap, ok := r.svcTasks[cluster]\n\tif !ok {\n\t\treturn nil\n\t}\n\n\treturn svcTaskMap[svc]\n}", "title": "" }, { "docid": "d71c8c4eaac3a023b231c7026c40dc50", "score": "0.4491452", "text": "func (s *TaskOverride) SetTaskRoleArn(v string) *TaskOverride {\n\ts.TaskRoleArn = &v\n\treturn s\n}", "title": "" }, { "docid": "c712c8ebba72f937172e5c9bf0552d6e", "score": "0.4474002", "text": "func (vs *volumeSet) reserveTaskVolumes(task *api.Task) {\n\tfor _, va := range task.Volumes {\n\t\t// we shouldn't need to handle non-container tasks because those tasks\n\t\t// won't have any entries in task.Volumes.\n\t\tfor _, mount := range task.Spec.GetContainer().Mounts {\n\t\t\tif mount.Source == va.Source && mount.Target == va.Target {\n\t\t\t\tvs.reserveVolume(va.ID, task.ID, task.NodeID, mount.ReadOnly)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3099c27612877676444381ca67ca7f97", "score": "0.4470584", "text": "func (o NetworkInsightsAnalysisOutput) FilterInArns() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *NetworkInsightsAnalysis) pulumi.StringArrayOutput { return v.FilterInArns }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "43aa11d8a3a93c1a45adbf18a11a7e0d", "score": "0.44405198", "text": "func SetNodes(ns []string) {\n\tnodes = ns\n}", "title": "" }, { "docid": "a55096b7cd0872cb30d97e1034f539b9", "score": "0.44293523", "text": "func (o SecretBackendRoleOutput) RoleArns() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *SecretBackendRole) pulumi.StringArrayOutput { return v.RoleArns }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "7c97522d0771f1203aa861c5c4f2a2a3", "score": "0.44277757", "text": "func (o GetInfrastructureConfigurationsResultOutput) Arns() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetInfrastructureConfigurationsResult) []string { return v.Arns }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "003daa63456e06770c3b897bcf6619fb", "score": "0.4408243", "text": "func (s *arangoTaskLister) ArangoTasks(namespace string) ArangoTaskNamespaceLister {\n\treturn arangoTaskNamespaceLister{indexer: s.indexer, namespace: namespace}\n}", "title": "" }, { "docid": "eabd0c8e2f41b08906e138c2745e1794", "score": "0.43881792", "text": "func (r *StorageImpl) PutTaskIdToBuriedSet(ctx context.Context, qid, tid string) error {\n\tif err := retry(ctx, func() error {\n\t\tif err := r.client.SAdd(keySetBuried(qid), tid).Err(); err != nil {\n\t\t\treturn newTempError(err)\n\t\t}\n\t\treturn nil\n\t}, defaultRetryLimit); err != nil {\n\t\treturn errors.Wrap(err, \"SADD\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8e9bf64dda3da87ea7e937afa4e23563", "score": "0.43802145", "text": "func (t TaskIDSlice) TaskIDs() []TaskID {\n\treturn t\n}", "title": "" }, { "docid": "b8a92d534d7c1c5dffd9cc3e7c080b1b", "score": "0.43359542", "text": "func (s *TaskDefinition) SetTaskRoleArn(v string) *TaskDefinition {\n\ts.TaskRoleArn = &v\n\treturn s\n}", "title": "" }, { "docid": "873f435b9749163b0a78b1c6563532e8", "score": "0.43350098", "text": "func (s *CreateResourceShareInput) SetPermissionArns(v []*string) *CreateResourceShareInput {\n\ts.PermissionArns = v\n\treturn s\n}", "title": "" }, { "docid": "5d9edd19ce51c7ad889b0cc4708c1579", "score": "0.43093035", "text": "func (m *BusinessScenarioPlanner) SetTasks(value []BusinessScenarioTaskable)() {\n err := m.GetBackingStore().Set(\"tasks\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1e3007c9a1242933d8f67560af86754a", "score": "0.4293739", "text": "func (o WirelessDeviceImportTaskOutput) Arn() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *WirelessDeviceImportTask) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "cfaedc4f77314ef327719e386d3c9c9c", "score": "0.42819202", "text": "func (o ClusterOutput) SnapshotArns() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Cluster) pulumi.StringPtrOutput { return v.SnapshotArns }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2b03f058c19097c761ce90a6eca62703", "score": "0.4262944", "text": "func (o SecretBackendRoleOutput) PolicyArns() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *SecretBackendRole) pulumi.StringArrayOutput { return v.PolicyArns }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "9ade293cf719c081bffb68aa1890d657", "score": "0.42605734", "text": "func TasksTask() {\n\tfmt.Println(\"Tasks:\")\n\tfmt.Print(\" \")\n\tfor key := range tasks {\n\t\tfmt.Print(\" \", key)\n\t}\n\tfmt.Println(\"\")\n\tfmt.Println(\"Switches:\")\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "ece5efede7c4c120edbf8a860b47d794", "score": "0.42589703", "text": "func (s *LocalStorage) SetTask(t *task.Task) int {\n\tvar tasks []task.Task\n\n\tc := config.LoadConfig()\n\n\treadBs, readErr := ioutil.ReadFile(c.TaskFile)\n\tif readErr != nil {\n\t\t// TODO: error handling\n\t\tpanic(readErr)\n\t}\n\n\t// TODO: this breaks unless there is a file there already, with at least []\n\tif unmarshErr := json.Unmarshal(readBs, &tasks); unmarshErr != nil {\n\t\tpanic(unmarshErr)\n\t}\n\n\t// when adding a new task, its id will be automatically assigned based on the length of tasks\n\tid := len(tasks) + 1\n\tt.ID = id\n\n\ttasks = append(tasks, *t)\n\n\twriteBs, marshErr := json.Marshal(tasks)\n\tif marshErr != nil {\n\t\tpanic(marshErr)\n\t}\n\n\t// TODO: understand this permission\n\tif writeErr := ioutil.WriteFile(c.TaskFile, writeBs, 0666); writeErr != nil {\n\t\t// TODO: error handling\n\t\tpanic(writeErr)\n\t}\n\n\treturn id\n}", "title": "" }, { "docid": "fbadf6ce9378c427d2198ff4abcc18d9", "score": "0.42526552", "text": "func (o LookupTaskDefinitionResultOutput) Arn() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LookupTaskDefinitionResult) *string { return v.Arn }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "6a69374d867c07e2e71a07448154f33c", "score": "0.42478898", "text": "func InitiateRakeTask(taskName string, settings *models.Settings) {\n\trakeTask := map[string]string{}\n\tb, err := json.Marshal(rakeTask)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tos.Exit(1)\n\t}\n\tencodedTaskName, err := url.Parse(taskName)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tos.Exit(1)\n\t}\n\thttpclient.Post(b, fmt.Sprintf(\"%s/v1/environments/%s/services/%s/rake/%s\", settings.PaasHost, settings.EnvironmentID, settings.ServiceID, encodedTaskName), true, settings)\n}", "title": "" }, { "docid": "c346fe2df7e793cef0f2760d1ef889e0", "score": "0.42448026", "text": "func (s *RegisterTaskDefinitionInput) SetTaskRoleArn(v string) *RegisterTaskDefinitionInput {\n\ts.TaskRoleArn = &v\n\treturn s\n}", "title": "" }, { "docid": "d972b7875f81832feaa1c3b33a3598dc", "score": "0.4233485", "text": "func (o LookupAuthorizerResultOutput) ProviderArns() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v LookupAuthorizerResult) []string { return v.ProviderArns }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "bfbd718b99dd682e0e1e8359ce487c77", "score": "0.42309636", "text": "func (tuo *TeamUpdateOne) AddTaskIDs(ids ...int) *TeamUpdateOne {\n\ttuo.mutation.AddTaskIDs(ids...)\n\treturn tuo\n}", "title": "" }, { "docid": "4dce18d43b07ea56876daf4234fcb3f3", "score": "0.42307347", "text": "func (o ReplicationSetOutput) Arn() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ReplicationSet) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "541f66983aec2504ac2fd7b000e800d5", "score": "0.42181647", "text": "func (tu *TeamUpdate) AddTaskIDs(ids ...int) *TeamUpdate {\n\ttu.mutation.AddTaskIDs(ids...)\n\treturn tu\n}", "title": "" }, { "docid": "420f786219c34f830b38b6b9ca44d120", "score": "0.42077965", "text": "func (o RegexPatternSetOutput) Arn() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *RegexPatternSet) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "420f786219c34f830b38b6b9ca44d120", "score": "0.42077965", "text": "func (o RegexPatternSetOutput) Arn() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *RegexPatternSet) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ab853060e6c6fd452626eaa39579f8e2", "score": "0.41858315", "text": "func (o *Tasks) SetTasks(v []Task) {\n\to.Tasks = &v\n}", "title": "" }, { "docid": "8a71fcd01eca4d6fc23f4db7231a157d", "score": "0.41843486", "text": "func (s *Alert) SetRelatedResourceArns(v []*string) *Alert {\n\ts.RelatedResourceArns = v\n\treturn s\n}", "title": "" }, { "docid": "e6b39aa7d1e773f3a232a8c16a142579", "score": "0.4167213", "text": "func regionFromTaskARN(taskARN string) string {\n\ta, err := arn.Parse(taskARN)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\treturn a.Region\n}", "title": "" }, { "docid": "ae37fbf22801badb8f121c30f808cc93", "score": "0.41654843", "text": "func (d *Dispatcher) AddTaskExecs(execs ...*TaskExec) {\n\td.Tasks = append(d.Tasks, execs...)\n}", "title": "" }, { "docid": "8e1c8769cb4e7f69429cfdce1e46dbbe", "score": "0.41521928", "text": "func (r Ref) SetTask(task string) Ref {\n\tout := \"\"\n\tif r.GetWorkspace() != \"\" {\n\t\tout += r.GetWorkspace() + \":\"\n\t}\n\n\tout += \"//\" + r.GetPath() + \":\" + task\n\treturn Ref(out)\n}", "title": "" }, { "docid": "6c6b1931a75d49289873179c1615d30f", "score": "0.412602", "text": "func (a *assignmentSet) releaseTaskDependencies(readTx store.ReadTx, t *api.Task) bool {\n\tvar modified bool\n\n\tfor _, resourceRef := range t.Spec.ResourceReferences {\n\t\tvar assignment *api.Assignment\n\t\tswitch resourceRef.ResourceType {\n\t\tcase api.ResourceType_SECRET:\n\t\t\tassignment = &api.Assignment{\n\t\t\t\tItem: &api.Assignment_Secret{\n\t\t\t\t\tSecret: &api.Secret{ID: resourceRef.ResourceID},\n\t\t\t\t},\n\t\t\t}\n\t\tcase api.ResourceType_CONFIG:\n\t\t\tassignment = &api.Assignment{\n\t\t\t\tItem: &api.Assignment_Config{\n\t\t\t\t\tConfig: &api.Config{ID: resourceRef.ResourceID},\n\t\t\t\t},\n\t\t\t}\n\t\tdefault:\n\t\t\ta.log.WithField(\n\t\t\t\t\"resource.type\", resourceRef.ResourceType,\n\t\t\t).Debug(\"invalid resource type for a task dependency, skipping\")\n\t\t\tcontinue\n\t\t}\n\n\t\tmapKey := typeAndID{objType: resourceRef.ResourceType, id: resourceRef.ResourceID}\n\t\tif a.releaseDependency(mapKey, assignment, t.ID) {\n\t\t\tmodified = true\n\t\t}\n\t}\n\n\tcontainer := t.Spec.GetContainer()\n\n\tvar secrets []*api.SecretReference\n\tif container != nil {\n\t\tsecrets = container.Secrets\n\t}\n\n\tfor _, secretRef := range secrets {\n\t\tsecretID := secretRef.SecretID\n\t\tmapKey := typeAndID{objType: api.ResourceType_SECRET, id: secretID}\n\t\tassignment := &api.Assignment{\n\t\t\tItem: &api.Assignment_Secret{\n\t\t\t\tSecret: &api.Secret{ID: secretID},\n\t\t\t},\n\t\t}\n\t\tif a.releaseDependency(mapKey, assignment, t.ID) {\n\t\t\tmodified = true\n\t\t}\n\t}\n\n\tvar configs []*api.ConfigReference\n\tif container != nil {\n\t\tconfigs = container.Configs\n\t}\n\n\tfor _, configRef := range configs {\n\t\tconfigID := configRef.ConfigID\n\t\tmapKey := typeAndID{objType: api.ResourceType_CONFIG, id: configID}\n\t\tassignment := &api.Assignment{\n\t\t\tItem: &api.Assignment_Config{\n\t\t\t\tConfig: &api.Config{ID: configID},\n\t\t\t},\n\t\t}\n\t\tif a.releaseDependency(mapKey, assignment, t.ID) {\n\t\t\tmodified = true\n\t\t}\n\t}\n\n\treturn modified\n}", "title": "" }, { "docid": "a5e123f39fb188a0cc18f2c2a5483151", "score": "0.4110347", "text": "func (s *ListContainerInstancesOutput) SetContainerInstanceArns(v []*string) *ListContainerInstancesOutput {\n\ts.ContainerInstanceArns = v\n\treturn s\n}", "title": "" }, { "docid": "7fe367bb82cb5237cfc810d9eb0a6e72", "score": "0.40748912", "text": "func (s *HumanLoopConfig) SetHumanTaskUiArn(v string) *HumanLoopConfig {\n\ts.HumanTaskUiArn = &v\n\treturn s\n}", "title": "" }, { "docid": "bb2aa4c8d43fe7cfb88a342a38beeeef", "score": "0.40628475", "text": "func (tuo *TeamUpdateOne) RemoveTaskIDs(ids ...int) *TeamUpdateOne {\n\ttuo.mutation.RemoveTaskIDs(ids...)\n\treturn tuo\n}", "title": "" }, { "docid": "48e487cc430ae38d1d0fa437440ec150", "score": "0.4056322", "text": "func (r *ModifyTaskRequest) SetTaskId(taskId string) {\n r.TaskId = taskId\n}", "title": "" }, { "docid": "e7091f44c7d636a89c8750ac73d7a3e7", "score": "0.40560633", "text": "func (s *BatchDeleteImportDataInput) SetImportTaskIds(v []*string) *BatchDeleteImportDataInput {\n\ts.ImportTaskIds = v\n\treturn s\n}", "title": "" }, { "docid": "902e6cd098621e3782cbd4c54a7c313c", "score": "0.40473536", "text": "func (o TaskDefinitionOutput) TaskRoleArn() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TaskDefinition) pulumi.StringPtrOutput { return v.TaskRoleArn }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5f5b8aec0ed4f7118dc549a2bc3d6904", "score": "0.40406442", "text": "func (o LookupTaskTemplateResultOutput) Arn() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LookupTaskTemplateResult) *string { return v.Arn }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "6419c17fd7d134adc03aa3e9e5c1bfd8", "score": "0.40382218", "text": "func (o *V0037JobProperties) SetTasks(v int32) {\n\to.Tasks = &v\n}", "title": "" }, { "docid": "dc226532677324d6347e74d8b91a6f12", "score": "0.40294236", "text": "func (o LookupDatasetGroupResultOutput) DatasetArns() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v LookupDatasetGroupResult) []string { return v.DatasetArns }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "58f46c513f7a50a86b06260a395ee7ea", "score": "0.40232164", "text": "func (s *DeleteTaskDefinitionsInput) SetTaskDefinitions(v []*string) *DeleteTaskDefinitionsInput {\n\ts.TaskDefinitions = v\n\treturn s\n}", "title": "" }, { "docid": "5a04fb92fc20752de606c51296f86dec", "score": "0.40222296", "text": "func (tu *TeamUpdate) RemoveTaskIDs(ids ...int) *TeamUpdate {\n\ttu.mutation.RemoveTaskIDs(ids...)\n\treturn tu\n}", "title": "" }, { "docid": "9b6abd51bf4a771b679595afa327193f", "score": "0.40219653", "text": "func (t TaskIDs) TaskIDs() []TaskID {\n\treturn t.UnsortedList()\n}", "title": "" }, { "docid": "4d89dfccbf24ac3facd14bcef6ca7b24", "score": "0.40111154", "text": "func (p *Patch) UpdateVariantsTasks(variantsTasks []VariantTasks) {\n\tbvs, tasks := ResolveVariantTasks(variantsTasks)\n\tp.BuildVariants = bvs\n\tp.Tasks = tasks\n\tp.VariantsTasks = variantsTasks\n}", "title": "" }, { "docid": "f41d45ce597e84ec898663322789091c", "score": "0.4009288", "text": "func (m *notification) SetTask(val string) {\n\tm.taskField = val\n}", "title": "" }, { "docid": "6aef73bb2696449dc66075ffd19b5af9", "score": "0.4002264", "text": "func (o GetClustersResultOutput) ClusterArns() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetClustersResult) []string { return v.ClusterArns }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "e4223c24a28e8c530f02fad0450a1c6f", "score": "0.4001398", "text": "func updateTaskOrders(c *gin.Context) {\r\n\treq, serr := getUpdateTaskOrdersRequest(c)\r\n\tif serr != nil {\r\n\t\tapi.SetErrorStatus(c, serr)\r\n\t\treturn\r\n\t}\r\n\ttx := orm.GetDB().Begin()\r\n\tsrvc := service.NewTaskService(tx)\r\n\tserr = srvc.UpdateTaskOrders(\r\n\t\treq.TaskID, req.FromBoardID, req.FromDispOrder, req.ToBoardID, req.ToDispOrder,\r\n\t)\r\n\tif serr != nil {\r\n\t\tapi.Rollback(tx)\r\n\t\tapi.SetErrorStatus(c, serr)\r\n\t\treturn\r\n\t}\r\n\tserr = api.Commit(tx)\r\n\tif serr != nil {\r\n\t\tapi.SetErrorStatus(c, serr)\r\n\t\treturn\r\n\t}\r\n\tc.Status(http.StatusOK)\r\n}", "title": "" }, { "docid": "69c35e0dcfe1ac0ba6675087198b04e4", "score": "0.39935845", "text": "func (o *TemplateSummaryResources) SetTasks(v []TemplateSummaryTask) {\n\to.Tasks = v\n}", "title": "" }, { "docid": "637c2a9d4202bf50ce9539fdc468c14a", "score": "0.39924648", "text": "func (b *taskBuilder) envPrefixes(key string, values ...string) {\n\tif b.Spec.EnvPrefixes == nil {\n\t\tb.Spec.EnvPrefixes = map[string][]string{}\n\t}\n\tfor _, value := range values {\n\t\tif !In(value, b.Spec.EnvPrefixes[key]) {\n\t\t\tb.Spec.EnvPrefixes[key] = append(b.Spec.EnvPrefixes[key], value)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7399fc8709a5a0e39633ebd8d1be1989", "score": "0.3984977", "text": "func (o PermissionSetOutput) Arn() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *PermissionSet) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "da5d6cf31d08122249e1907779e88445", "score": "0.39810348", "text": "func prepareruntaskparams(params map[string]string, runtask Runtask, Region string) {\n\tif Region != \"\" {\n\t\tparams[\"Region\"] = Region\n\t}\n\tparams[\"amztarget\"] = \"AmazonEC2ContainerServiceV20141113.RunTask\"\n}", "title": "" }, { "docid": "752de024e86c69e90e63684220615fa8", "score": "0.39802054", "text": "func (ref *Config) SetTopics(topics string) {\n\tref.Topics = strings.Split(topics, \",\")\n}", "title": "" }, { "docid": "2bda8b1fcfad2122c83c7dadfe240b3c", "score": "0.39705417", "text": "func (o *ViewCustomFieldTask) SetTaskId(v int32) {\n\to.TaskId = &v\n}", "title": "" }, { "docid": "cfaee4c9abe2773da003e54beb6ff02c", "score": "0.39590693", "text": "func (o LookupManagedPrefixListResultOutput) Arn() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupManagedPrefixListResult) string { return v.Arn }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "fdf60aa4044d55a264f5df9eb72c8fdd", "score": "0.39585686", "text": "func (m *Task) UnmarshalJSON(raw []byte) error {\n\n\tvar aO0 NewTask\n\tif err := swag.ReadJSON(raw, &aO0); err != nil {\n\t\treturn err\n\t}\n\tm.NewTask = aO0\n\n\tvar data struct {\n\t\tCompletedAt strfmt.DateTime `json:\"completed_at,omitempty\"`\n\n\t\tCreatedAt strfmt.DateTime `json:\"created_at,omitempty\"`\n\n\t\tEnvVars map[string]string `json:\"env_vars,omitempty\"`\n\n\t\tError string `json:\"error,omitempty\"`\n\n\t\tGroupName string `json:\"group_name,omitempty\"`\n\n\t\tReason string `json:\"reason,omitempty\"`\n\n\t\tRetryAt string `json:\"retry_at,omitempty\"`\n\n\t\tRetryOf string `json:\"retry_of,omitempty\"`\n\n\t\tStartedAt strfmt.DateTime `json:\"started_at,omitempty\"`\n\t}\n\tif err := swag.ReadJSON(raw, &data); err != nil {\n\t\treturn err\n\t}\n\n\tm.CompletedAt = data.CompletedAt\n\n\tm.CreatedAt = data.CreatedAt\n\n\tm.EnvVars = data.EnvVars\n\n\tm.Error = data.Error\n\n\tm.GroupName = data.GroupName\n\n\tm.Reason = data.Reason\n\n\tm.RetryAt = data.RetryAt\n\n\tm.RetryOf = data.RetryOf\n\n\tm.StartedAt = data.StartedAt\n\n\treturn nil\n}", "title": "" }, { "docid": "98b35b8834351e476d635ff3aab0c851", "score": "0.39556792", "text": "func (s *GetDefaultViewOutput) SetViewArn(v string) *GetDefaultViewOutput {\n\ts.ViewArn = &v\n\treturn s\n}", "title": "" }, { "docid": "e56d116ec530dedfe4623da57101d309", "score": "0.39449564", "text": "func (s *RenderUiTemplateInput) SetHumanTaskUiArn(v string) *RenderUiTemplateInput {\n\ts.HumanTaskUiArn = &v\n\treturn s\n}", "title": "" } ]
1875def98b29249570d370ca57af1f45
Convert_v1alpha1_VSwitch_To_tencentcloud_VSwitch is an autogenerated conversion function.
[ { "docid": "9a9ddefdebb9154d476e6a142e67d0de", "score": "0.85191834", "text": "func Convert_v1alpha1_VSwitch_To_tencentcloud_VSwitch(in *VSwitch, out *tencentcloud.VSwitch, s conversion.Scope) error {\n\treturn autoConvert_v1alpha1_VSwitch_To_tencentcloud_VSwitch(in, out, s)\n}", "title": "" } ]
[ { "docid": "033f90136210971df9202d8295ed3a97", "score": "0.7641072", "text": "func Convert_v1alpha1_VSwitch_To_alicloud_VSwitch(in *VSwitch, out *alicloud.VSwitch, s conversion.Scope) error {\n\treturn autoConvert_v1alpha1_VSwitch_To_alicloud_VSwitch(in, out, s)\n}", "title": "" }, { "docid": "986d1c9b99b730a556061c02a7853e0a", "score": "0.7388257", "text": "func Convert_tencentcloud_VSwitch_To_v1alpha1_VSwitch(in *tencentcloud.VSwitch, out *VSwitch, s conversion.Scope) error {\n\treturn autoConvert_tencentcloud_VSwitch_To_v1alpha1_VSwitch(in, out, s)\n}", "title": "" }, { "docid": "a1a56635b288760bc24264eec117f875", "score": "0.71675825", "text": "func Convert_alicloud_VSwitch_To_v1alpha1_VSwitch(in *alicloud.VSwitch, out *VSwitch, s conversion.Scope) error {\n\treturn autoConvert_alicloud_VSwitch_To_v1alpha1_VSwitch(in, out, s)\n}", "title": "" }, { "docid": "a3601bc9c285eb49f44c843b18b59b61", "score": "0.6664771", "text": "func (in *VSwitch) DeepCopy() *VSwitch {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VSwitch)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "35670735a12a1fcccd7e829c62f9c741", "score": "0.5790476", "text": "func (in *ClusterSwitch) DeepCopy() *ClusterSwitch {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ClusterSwitch)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b761a54464b25f3bdbfd06757c439776", "score": "0.5600689", "text": "func AddSwitch(params ...string) (*OVSSwitch, error) {\n\t// params[0] for brName\n\t// params[1] for controller remote IP and port\n\t// Create a Open vSwitch bridge\n\tsw, err := NewOVSSwitch(params[0])\n\tif err != nil {\n\t\tlog.Fatal(\"failed to NewOVSSwitch: \", err)\n\t}\n\tif len(params) == 2 {\n\t\tif err := sw.SetCtrl(params[1]); err != nil {\n\t\t\tlog.Warnf(\"failed to SetCtrl for %s: %v\", sw.BridgeName, err)\n\t\t\treturn nil, err\n\t\t}\n\t} else if len(params) > 2 {\n\t\treturn nil, fmt.Errorf(\"Too many arguments\")\n\t}\n\treturn sw, nil\n}", "title": "" }, { "docid": "d8557b6e1de8563018da2d8f7543ec19", "score": "0.5508697", "text": "func (t *SwitchTracer) Create(ctx context.Context, zone string, param *sacloud.SwitchCreateRequest) (*sacloud.Switch, error) {\n\tvar span trace.Span\n\toptions := append(t.config.SpanStartOptions, trace.WithAttributes(\n\t\tattribute.String(\"libsacloud.api.arguments.zone\", zone),\n\t\tattribute.String(\"libsacloud.api.arguments.param\", forceString(param)),\n\t))\n\tctx, span = t.config.Tracer.Start(ctx, \"SwitchAPI.Create\", options...)\n\tdefer func() {\n\t\tspan.End()\n\t}()\n\n\t// for http trace\n\tctx = httptrace.WithClientTrace(ctx, otelhttptrace.NewClientTrace(ctx))\n\tresultSwitch, err := t.Internal.Create(ctx, zone, param)\n\n\tif err != nil {\n\t\tspan.SetStatus(codes.Error, err.Error())\n\t} else {\n\t\tspan.SetStatus(codes.Ok, \"\")\n\t\tspan.SetAttributes(attribute.String(\"libsacloud.api.results.resultSwitch\", forceString(resultSwitch)))\n\n\t}\n\treturn resultSwitch, err\n}", "title": "" }, { "docid": "5d47d3357f222b88e299397fd6701e24", "score": "0.5347698", "text": "func NewSwitch() *Switch {\n\tc := &Switch{log: log.NewLogger()}\n\tc.flagSet = flagset.New(c.Name(), \"[OPTIONS] VERSION\")\n\tc.flagSet.BoolVar(&c.opts.ShowHelp, \"h\", false, \"Show command usage\")\n\treturn c\n}", "title": "" }, { "docid": "aefff4d6f6e68e2015e44bbd3b145d42", "score": "0.53129226", "text": "func (*Service) ListSwitches(c context.Context, req *crimson.ListSwitchesRequest) (*crimson.ListSwitchesResponse, error) {\n\tswitches, err := listSwitches(c, stringset.NewFromSlice(req.Names...), stringset.NewFromSlice(req.Racks...), stringset.NewFromSlice(req.Datacenters...))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &crimson.ListSwitchesResponse{\n\t\tSwitches: switches,\n\t}, nil\n}", "title": "" }, { "docid": "35fc3633a646c2c2fd95aa0e2f766b31", "score": "0.5290857", "text": "func NewSwitch(ident string) Switch {\n\ts := Switch{\n\t\tIdent: ident,\n\t}\n\treturn s\n}", "title": "" }, { "docid": "a2a261c4c260e46864b7a8a8bcdc55ca", "score": "0.5256306", "text": "func NewOVSSwitch(bridgeName string) (*OVSSwitch, error) {\n\tsw := new(OVSSwitch)\n\tsw.NodeType = \"OVSSwitch\"\n\tsw.BridgeName = bridgeName\n\n\tsw.ovsdb = ovsdb.NewOvsDriverWithUnix(bridgeName)\n\n\t// Check if port is already part of the OVS and add it\n\tif !sw.ovsdb.IsPortNamePresent(bridgeName) {\n\t\t// Create an internal port in OVS\n\t\terr := sw.ovsdb.CreatePort(bridgeName, \"internal\", 0)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\ttime.Sleep(300 * time.Millisecond)\n\t// log.Infof(\"Waiting for OVS bridge %s etup\", bridgeName)\n\n\t// ip link set ovs up\n\terr := setLinkUp(bridgeName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn sw, nil\n}", "title": "" }, { "docid": "72a08d30dbaf05cbe45819cdfc978f72", "score": "0.52385646", "text": "func (i *Input) Switch() error {\n\treturn i.tv.SwitchInput(i.ID)\n}", "title": "" }, { "docid": "a8f8e70f82f38567cf9657c196e7b5ef", "score": "0.5141505", "text": "func GetSwitch(switchID string) (model.Switch, error) {\n\tvar switchData model.Switch\n\tdata, err := db.Connector.Get(db.TableSwitch, switchID)\n\tif err != nil {\n\t\treturn switchData, err\n\t}\n\tif err = json.Unmarshal([]byte(data), &switchData); err != nil {\n\t\treturn switchData, fmt.Errorf(\"while trying to unmarshal switch data, got: %v\", err)\n\t}\n\treturn switchData, nil\n}", "title": "" }, { "docid": "14f85fdb44da04fdd66c79bd3940cdf1", "score": "0.51250076", "text": "func NewMockSwitch(ctrl *gomock.Controller) *MockSwitch {\n\tmock := &MockSwitch{ctrl: ctrl}\n\tmock.recorder = &MockSwitchMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "cacd632bf07f5a539bf54a500ca3d07d", "score": "0.5116312", "text": "func (o RdsDbProxyOutput) VswitchId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *RdsDbProxy) pulumi.StringOutput { return v.VswitchId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "fd6ac6be39f16dc1f436c9a507e6ca95", "score": "0.50979066", "text": "func SaveSwitch(switchID string, data *model.Switch) error {\n\treturn SaveToDB(db.TableSwitch, switchID, *data)\n}", "title": "" }, { "docid": "d47d418ba7a618119cd60b77897abb1e", "score": "0.5079986", "text": "func (o InstanceOutput) VswitchId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.VswitchId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "495335ca07167a807e7cb97bf8f037e3", "score": "0.5066426", "text": "func (t *InterfaceTracer) ConnectToSwitch(ctx context.Context, zone string, id types.ID, switchID types.ID) error {\n\tvar span trace.Span\n\toptions := append(t.config.SpanStartOptions, trace.WithAttributes(\n\t\tattribute.String(\"libsacloud.api.arguments.zone\", zone),\n\t\tattribute.String(\"libsacloud.api.arguments.id\", forceString(id)),\n\t\tattribute.String(\"libsacloud.api.arguments.switchID\", forceString(switchID)),\n\t))\n\tctx, span = t.config.Tracer.Start(ctx, \"InterfaceAPI.ConnectToSwitch\", options...)\n\tdefer func() {\n\t\tspan.End()\n\t}()\n\n\t// for http trace\n\tctx = httptrace.WithClientTrace(ctx, otelhttptrace.NewClientTrace(ctx))\n\terr := t.Internal.ConnectToSwitch(ctx, zone, id, switchID)\n\n\tif err != nil {\n\t\tspan.SetStatus(codes.Error, err.Error())\n\t} else {\n\t\tspan.SetStatus(codes.Ok, \"\")\n\n\t}\n\treturn err\n}", "title": "" }, { "docid": "308107438a795fcc3f12d2552f0e595a", "score": "0.5065129", "text": "func (t *VPCRouterTracer) ConnectToSwitch(ctx context.Context, zone string, id types.ID, nicIndex int, switchID types.ID) error {\n\tvar span trace.Span\n\toptions := append(t.config.SpanStartOptions, trace.WithAttributes(\n\t\tattribute.String(\"libsacloud.api.arguments.zone\", zone),\n\t\tattribute.String(\"libsacloud.api.arguments.id\", forceString(id)),\n\t\tattribute.String(\"libsacloud.api.arguments.nicIndex\", forceString(nicIndex)),\n\t\tattribute.String(\"libsacloud.api.arguments.switchID\", forceString(switchID)),\n\t))\n\tctx, span = t.config.Tracer.Start(ctx, \"VPCRouterAPI.ConnectToSwitch\", options...)\n\tdefer func() {\n\t\tspan.End()\n\t}()\n\n\t// for http trace\n\tctx = httptrace.WithClientTrace(ctx, otelhttptrace.NewClientTrace(ctx))\n\terr := t.Internal.ConnectToSwitch(ctx, zone, id, nicIndex, switchID)\n\n\tif err != nil {\n\t\tspan.SetStatus(codes.Error, err.Error())\n\t} else {\n\t\tspan.SetStatus(codes.Ok, \"\")\n\n\t}\n\treturn err\n}", "title": "" }, { "docid": "50280b16ac319149098888b3a01b5623", "score": "0.5048313", "text": "func (o GetInstancesResultOutput) VswitchId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GetInstancesResult) *string { return v.VswitchId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "db22c64518f0d0bcf9a32037c91c2b2d", "score": "0.50151056", "text": "func (a *Client) UpdateLogicalSwitch(params *UpdateLogicalSwitchParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateLogicalSwitchOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUpdateLogicalSwitchParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"UpdateLogicalSwitch\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/logical-switches/{lswitch-id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &UpdateLogicalSwitchReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*UpdateLogicalSwitchOK), nil\n\n}", "title": "" }, { "docid": "fa0934b9fe3b47b6fb0411f1e07b8b31", "score": "0.49963316", "text": "func listSwitches(c context.Context, names, racks, datacenters stringset.Set) ([]*crimson.Switch, error) {\n\tdb := database.Get(c)\n\trows, err := db.QueryContext(c, `\n\t\tSELECT s.name, s.description, s.ports, s.state, r.name, d.name\n\t\tFROM switches s, racks r, datacenters d\n\t\tWHERE s.rack_id = r.id\n\t\t\tAND r.datacenter_id = d.id\n\t`)\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"failed to fetch switches\").Err()\n\t}\n\tdefer rows.Close()\n\n\tvar switches []*crimson.Switch\n\tfor rows.Next() {\n\t\ts := &crimson.Switch{}\n\t\tif err = rows.Scan(&s.Name, &s.Description, &s.Ports, &s.State, &s.Rack, &s.Datacenter); err != nil {\n\t\t\treturn nil, errors.Annotate(err, \"failed to fetch switch\").Err()\n\t\t}\n\t\tif matches(s.Name, names) && matches(s.Rack, racks) && matches(s.Datacenter, datacenters) {\n\t\t\tswitches = append(switches, s)\n\t\t}\n\t}\n\treturn switches, nil\n}", "title": "" }, { "docid": "c7807fe65f28670dcc6dd6c68d145f4f", "score": "0.4980129", "text": "func (t *SwitchTracer) Update(ctx context.Context, zone string, id types.ID, param *sacloud.SwitchUpdateRequest) (*sacloud.Switch, error) {\n\tvar span trace.Span\n\toptions := append(t.config.SpanStartOptions, trace.WithAttributes(\n\t\tattribute.String(\"libsacloud.api.arguments.zone\", zone),\n\t\tattribute.String(\"libsacloud.api.arguments.id\", forceString(id)),\n\t\tattribute.String(\"libsacloud.api.arguments.param\", forceString(param)),\n\t))\n\tctx, span = t.config.Tracer.Start(ctx, \"SwitchAPI.Update\", options...)\n\tdefer func() {\n\t\tspan.End()\n\t}()\n\n\t// for http trace\n\tctx = httptrace.WithClientTrace(ctx, otelhttptrace.NewClientTrace(ctx))\n\tresultSwitch, err := t.Internal.Update(ctx, zone, id, param)\n\n\tif err != nil {\n\t\tspan.SetStatus(codes.Error, err.Error())\n\t} else {\n\t\tspan.SetStatus(codes.Ok, \"\")\n\t\tspan.SetAttributes(attribute.String(\"libsacloud.api.results.resultSwitch\", forceString(resultSwitch)))\n\n\t}\n\treturn resultSwitch, err\n}", "title": "" }, { "docid": "afe14ad9c273e93f759a8ef3df07ef44", "score": "0.4978794", "text": "func (o *PostIPAMMacsParams) SetSwitch(switchVar *string) {\n\to.Switch = switchVar\n}", "title": "" }, { "docid": "70680286706dd50286207bb5a2992520", "score": "0.49750596", "text": "func (n *Interface_Ethernet) SwitchedVlan() *Interface_Ethernet_SwitchedVlan {\n\treturn &Interface_Ethernet_SwitchedVlan{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"switched-vlan\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "cd308bc20527651d0e7c2e51354239c3", "score": "0.49742457", "text": "func (o *InventoryUemInfo) SetSwitchId(v string) {\n\to.SwitchId = &v\n}", "title": "" }, { "docid": "70680286706dd50286207bb5a2992520", "score": "0.4974053", "text": "func (n *Interface_Ethernet) SwitchedVlan() *Interface_Ethernet_SwitchedVlan {\n\treturn &Interface_Ethernet_SwitchedVlan{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"switched-vlan\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5a7e39b3eb836b92d08030b18b81b637", "score": "0.49264747", "text": "func UpdateSwitches(w http.ResponseWriter, r *http.Request) {\n\tconstants.RestLock.Lock()\n\tdefer constants.RestLock.Unlock()\n\tsuccess := true\n\tstatusMsg := \"\"\n\n\tvar UpdateSwitchParams Restmodel.UpdateSwitchParameters\n\n\talog := logging.AuditLog{Request: &logging.Request{Command: \"device credentials update\"}}\n\tctx := alog.LogMessageInit()\n\tdefer alog.LogMessageEnd(&success, &statusMsg)\n\n\tb, _ := ioutil.ReadAll(r.Body)\n\terr := json.Unmarshal(b, &UpdateSwitchParams)\n\tif err != nil {\n\t\tsuccess = false\n\t\treturn\n\t}\n\t//update Request object after all parameters are received\n\talog.Request.Params = map[string]interface{}{\n\t\t\"Devices\": UpdateSwitchParams.DeviceIpAddress,\n\t}\n\talog.LogMessageReceived()\n\n\tUpdateDeviceResponseList, err := infra.GetUseCaseInteractor().UpdateDevices(ctx, UpdateSwitchParams.DeviceIpAddress, UpdateSwitchParams.Username, UpdateSwitchParams.Password)\n\n\t//fmt.Println(UpdateDeviceResponseList)\n\n\t//Top level structure for Switches Response\n\tSwitchesUpdatedDataResponse := Restmodel.SwitchesUpdateResponse{}\n\tSwitchesUpdatedDataResponse.Items = make([]Restmodel.SwitchUpdateResponse, 0, len(UpdateSwitchParams.DeviceIpAddress))\n\n\tfor _, updateDeviceResponse := range UpdateDeviceResponseList {\n\t\t//Populate the Response Model\n\t\tresponse := Restmodel.SwitchUpdateResponse{\n\t\t\tIpAddress: updateDeviceResponse.IPAddress,\n\t\t\tDeviceCredentials: updateDeviceResponse.Status,\n\t\t}\n\t\tSwitchesUpdatedDataResponse.Items = append(SwitchesUpdatedDataResponse.Items, response)\n\t}\n\tbytes, _ := json.Marshal(&SwitchesUpdatedDataResponse)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(bytes)\n\n}", "title": "" }, { "docid": "0626745027c4c672abcef570e6713e72", "score": "0.49175376", "text": "func New(c Config, t vice.Transport, swtch rcswitch.Switch) *Lights {\n\treturn &Lights{transport: t, swtch: swtch, config: c}\n}", "title": "" }, { "docid": "8173c3e913799898ecef8749dfd55cfe", "score": "0.49061692", "text": "func (a *Client) CreateLogicalSwitch(params *CreateLogicalSwitchParams, authInfo runtime.ClientAuthInfoWriter) (*CreateLogicalSwitchCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewCreateLogicalSwitchParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"CreateLogicalSwitch\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/logical-switches\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &CreateLogicalSwitchReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*CreateLogicalSwitchCreated), nil\n\n}", "title": "" }, { "docid": "a30298c9c2a46202b9853dfbd042d057", "score": "0.4883692", "text": "func (t *MobileGatewayTracer) ConnectToSwitch(ctx context.Context, zone string, id types.ID, switchID types.ID) error {\n\tvar span trace.Span\n\toptions := append(t.config.SpanStartOptions, trace.WithAttributes(\n\t\tattribute.String(\"libsacloud.api.arguments.zone\", zone),\n\t\tattribute.String(\"libsacloud.api.arguments.id\", forceString(id)),\n\t\tattribute.String(\"libsacloud.api.arguments.switchID\", forceString(switchID)),\n\t))\n\tctx, span = t.config.Tracer.Start(ctx, \"MobileGatewayAPI.ConnectToSwitch\", options...)\n\tdefer func() {\n\t\tspan.End()\n\t}()\n\n\t// for http trace\n\tctx = httptrace.WithClientTrace(ctx, otelhttptrace.NewClientTrace(ctx))\n\terr := t.Internal.ConnectToSwitch(ctx, zone, id, switchID)\n\n\tif err != nil {\n\t\tspan.SetStatus(codes.Error, err.Error())\n\t} else {\n\t\tspan.SetStatus(codes.Ok, \"\")\n\n\t}\n\treturn err\n}", "title": "" }, { "docid": "a0e100186965b3e6faa302b34eb7e6eb", "score": "0.48742688", "text": "func (a *Client) ListLogicalSwitches(params *ListLogicalSwitchesParams, authInfo runtime.ClientAuthInfoWriter) (*ListLogicalSwitchesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListLogicalSwitchesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"ListLogicalSwitches\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/logical-switches\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ListLogicalSwitchesReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*ListLogicalSwitchesOK), nil\n\n}", "title": "" }, { "docid": "0f9f99f756d3c9cfb83477536f37767d", "score": "0.4861473", "text": "func Switch() {\n\ta := 4\n\n\tswitch a {\n\tcase 1:\n\t\tfmt.Println(\"a is 1 (Switch)\")\n\tcase 2:\n\t\tfmt.Println(\"a is 2 (Switch)\")\n\tcase 3:\n\t\tfmt.Println(\"a is 3 (Switch)\")\n\tcase 4:\n\t\tfmt.Println(\"a is 4 (Switch)\")\n\t}\n}", "title": "" }, { "docid": "b4bc12b3df0c7730297e61515f841af7", "score": "0.4824308", "text": "func NewHostVirtualSwitch(ctx *pulumi.Context,\n\tname string, args *HostVirtualSwitchArgs, opts ...pulumi.ResourceOption) (*HostVirtualSwitch, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ActiveNics == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ActiveNics'\")\n\t}\n\tif args.HostSystemId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'HostSystemId'\")\n\t}\n\tif args.NetworkAdapters == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'NetworkAdapters'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource HostVirtualSwitch\n\terr := ctx.RegisterResource(\"vsphere:index/hostVirtualSwitch:HostVirtualSwitch\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "9cee9eb3c18d11c9ec1005363ebd43be", "score": "0.4791177", "text": "func (a *Client) GetLogicalSwitch(params *GetLogicalSwitchParams, authInfo runtime.ClientAuthInfoWriter) (*GetLogicalSwitchOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetLogicalSwitchParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetLogicalSwitch\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/logical-switches/{lswitch-id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetLogicalSwitchReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetLogicalSwitchOK), nil\n\n}", "title": "" }, { "docid": "a0e26e06aac0e78ef61998d21efa1a22", "score": "0.47897816", "text": "func (in *VSwitchSpec) DeepCopy() *VSwitchSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VSwitchSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8a0eb690ea3ae0df931d393a29d91431", "score": "0.47574496", "text": "func (nc *client) ListLogicalSwitches() (*models.LogicalSwitchListResult, error) {\n\tparams := lsw.NewListLogicalSwitchesParams()\n\tres, err := nc.client.LogicalSwitching.ListLogicalSwitches(params, nc.auth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res.Payload, nil\n}", "title": "" }, { "docid": "22ff17fd8aea524d9809843efe724da4", "score": "0.47210497", "text": "func (h *HomeAutomation) SwitchList(sessionID string) {\n\treq, err := http.NewRequest(\"GET\", h.Config.HomeAutomationURL(), nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn //InvalidSessionId, err\n\t}\n\n\tquery := req.URL.Query()\n\n\tquery.Add(\"switchcmd\", \"getswitchlist\")\n\tquery.Add(\"sid\", sessionID)\n\n\treq.URL.RawQuery = query.Encode()\n\n\tvar client http.Client\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn //InvalidSessionId, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tlog.Printf(\"Got HTTP result %v.\", resp.StatusCode)\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn //InvalidSessionId, err\n\t}\n\n\tlog.Println(string(body))\n\n}", "title": "" }, { "docid": "b9e259885f338782715e9844741fa58b", "score": "0.47116068", "text": "func NewSwitch(device Device, timeout time.Duration) Switch {\n\tsw := &switchedDevice{Device: device, timeout: timeout}\n\tif linkable, ok := device.(LinkableDevice); ok {\n\t\treturn &linkableSwitch{LinkableDevice: linkable, switchedDevice: sw}\n\t}\n\treturn sw\n}", "title": "" }, { "docid": "3f3d3a5f550cfaebfb6baba0f87c3eb8", "score": "0.4708371", "text": "func (nc *client) CreateLogicalSwitch(logicalSwitchModel *models.LogicalSwitch) (*models.LogicalSwitch, error) {\n\tparams := lsw.NewCreateLogicalSwitchParams().WithLogicalSwitch(logicalSwitchModel)\n\tres, err := nc.client.LogicalSwitching.CreateLogicalSwitch(params, nc.auth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res.Payload, nil\n}", "title": "" }, { "docid": "b02cdf81eb22d324ae2afc3496a0421b", "score": "0.46985224", "text": "func TestSwitchToggle(t *testing.T) {\n\tfritz := New().Start()\n\tdefer fritz.Close()\n\tr, _ := (&http.Client{}).Get(fritz.Server.URL + \"/webservices/homeautoswitch.lua?switchcmd=setswitchtoggle\")\n\tassert2xxResponse(t, r)\n}", "title": "" }, { "docid": "effb65e3394eb7a2b8363f9c45f2dc78", "score": "0.46826002", "text": "func OVSByName(brName string) (*OVSSwitch, error) {\n\treturn NewOVSSwitch(brName)\n}", "title": "" }, { "docid": "979e2e75e8f1501aaa11173227e6d276", "score": "0.46644992", "text": "func (o DistributedVirtualSwitchOutput) Version() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *DistributedVirtualSwitch) pulumi.StringOutput { return v.Version }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6a207710f87ff4e96cc89766ece44b65", "score": "0.46616834", "text": "func Switch(switcher Switcher) ParserFunc {\n\treturn func(s Scanner) (Scanner, Node, error) {\n\t\tparser := switcher.Switch(s.First())\n\t\treturn parser(s)\n\t}\n}", "title": "" }, { "docid": "86b4a88ec4541368d89203f263d7a0b3", "score": "0.46237776", "text": "func GetSwitch(k string) *Switch {\n\tfor _, sw := range GlobalSwitches {\n\t\tif sw.Key == k {\n\t\t\treturn sw\n\t\t}\n\t}\n\treturn &Switch{} // default\n}", "title": "" }, { "docid": "b0f2d5cc1d3d73cddf7a73f5232c3d83", "score": "0.46204653", "text": "func (o *MobileGatewayOp) ConnectToSwitch(ctx context.Context, zone string, id types.ID, switchID types.ID) error {\n\tvalue, err := o.Read(ctx, zone, id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, nic := range value.Interfaces {\n\t\tif nic.Index == 1 {\n\t\t\treturn newErrorBadRequest(o.key, id, fmt.Sprintf(\"nic[%d] already connected to switch\", 1))\n\t\t}\n\t}\n\n\t// find switch\n\tswOp := NewSwitchOp()\n\t_, err = swOp.Read(ctx, zone, switchID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ConnectToSwitch is failed: %s\", err)\n\t}\n\n\t// create interface\n\tifOp := NewInterfaceOp()\n\tiface, err := ifOp.Create(ctx, zone, &sacloud.InterfaceCreateRequest{ServerID: id})\n\tif err != nil {\n\t\treturn newErrorConflict(o.key, types.ID(0), err.Error())\n\t}\n\n\tif err := ifOp.ConnectToSwitch(ctx, zone, iface.ID, switchID); err != nil {\n\t\treturn newErrorConflict(o.key, types.ID(0), err.Error())\n\t}\n\n\tiface, err = ifOp.Read(ctx, zone, iface.ID)\n\tif err != nil {\n\t\treturn newErrorConflict(o.key, types.ID(0), err.Error())\n\t}\n\n\tmobileGatewayInterface := &sacloud.MobileGatewayInterface{}\n\tcopySameNameField(iface, mobileGatewayInterface)\n\tmobileGatewayInterface.Index = 1 // 1固定\n\tvalue.Interfaces = append(value.Interfaces, mobileGatewayInterface)\n\n\tputMobileGateway(zone, value)\n\treturn nil\n}", "title": "" }, { "docid": "91fbbf43797d252cbc705b9d0e137262", "score": "0.46093908", "text": "func (c *Switch) Name() string {\n\treturn \"switch\"\n}", "title": "" }, { "docid": "b9e016aab4fb2189f973403b6d31e712", "score": "0.45872283", "text": "func (self *OfnetAgent) SwitchConnected(sw *ofctrl.OFSwitch) {\n log.Infof(\"Switch %v connected\", sw.DPID())\n\n // store it for future use.\n self.ofSwitch = sw\n\n // Inform the datapath\n self.datapath.SwitchConnected(sw)\n\n // add default vlan\n //self.AddVlan(1, 1)\n\n self.isConnected = true\n}", "title": "" }, { "docid": "02413b60992b63f826cfe577a0ad97eb", "score": "0.45820245", "text": "func NewSwitchHandler(clt Client) *SwitchHandler {\n\treturn &SwitchHandler{Client: clt}\n}", "title": "" }, { "docid": "9a9b4204565bd818704c00ef3fafe665", "score": "0.45654836", "text": "func (c *Connector) AddSwitch(baseSwitchID int) (switchID int) {\n\tswitchID = len(c.switches)\n\tsw := switching.SwitchBuilder{}.\n\t\tWithEngine(c.engine).\n\t\tWithFreq(c.freq).\n\t\tWithRoutingTable(routing.NewTable()).\n\t\tWithArbiter(arbitration.NewXBarArbiter()).\n\t\tBuild(fmt.Sprintf(\"%s.Switch%d\", c.networkName, switchID))\n\tc.network.AddSwitch(sw)\n\tc.switches = append(c.switches, sw)\n\n\tbaseSwitch := c.switches[baseSwitchID]\n\n\tbasePort, newPort := c.switchConnector.\n\t\tConnectSwitches(baseSwitch, sw, c.freq)\n\tsw.GetRoutingTable().DefineDefaultRoute(newPort)\n\tc.switchNodes = append(c.switchNodes, &switchNode{\n\t\tparentSwitchNode: c.switchNodes[baseSwitchID],\n\t\tcurrSwitch: sw,\n\t\tlocalPortToParent: newPort,\n\t\tremotePortToParent: basePort,\n\t})\n\n\treturn switchID\n}", "title": "" }, { "docid": "eff1d74aaea2d36c982a1a07a180e43f", "score": "0.4560814", "text": "func (cks *CKSProtocol) KeySwitch(combined CKSShare, ct *ckks.Ciphertext, ctOut *ckks.Ciphertext) {\n\tctOut.SetScale(ct.Scale())\n\tcks.dckksContext.ringQ.AddLvl(ct.Level(), ct.Value()[0], combined, ctOut.Value()[0])\n\tcks.dckksContext.ringQ.CopyLvl(ct.Level(), ct.Value()[1], ctOut.Value()[1])\n}", "title": "" }, { "docid": "b82357db42bf0d43ae4170105b1ae9ee", "score": "0.45564753", "text": "func (p *Cluster) SetSwitchType(attr SwitchType) {\n\tp.switchType = &attr\n}", "title": "" }, { "docid": "93a96fd23e9bbadb85c8df7a16cc88cc", "score": "0.45536286", "text": "func (n *Interface_Aggregation) SwitchedVlan() *Interface_Aggregation_SwitchedVlan {\n\treturn &Interface_Aggregation_SwitchedVlan{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"switched-vlan\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "74d6a1a4fbad5686ebf4783d0eb2df26", "score": "0.4553267", "text": "func (c Client) SwitchSlot() ([]model.SwitchSlot, base.ClientError) {\n\tvar (\n\t\tslots []model.SwitchSlot\n\t\tinserted int\n\t)\n\tfor i := 1; i <= 4; i++ {\n\t\tchassis := GetSwiChassisResponse{}\n\t\tsystem := GetSwiSystemResponse{}\n\t\tslot := model.SwitchSlot{}\n\t\tif err := c.Get(fmt.Sprintf(\"/redfish/v1/Chassis/Swi%d\", i), &chassis); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tslot.Index = i\n\t\tslot.Inserted = (chassis.Status.State == \"Enabled\")\n\t\tif slot.Inserted {\n\t\t\tinserted++\n\t\t\tif err := c.Get(fmt.Sprintf(\"/redfish/v1/Systems/Swi%d\", i), &system); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tslot.ProductName = chassis.Model\n\t\tslot.SerialNumber = system.SerialNumber\n\t\tslots = append(slots, slot)\n\t}\n\tlog.WithFields(log.Fields{\"inserted\": inserted, \"client\": c}).Info(\"Client get switch slot done.\")\n\treturn slots, nil\n}", "title": "" }, { "docid": "93a96fd23e9bbadb85c8df7a16cc88cc", "score": "0.45522588", "text": "func (n *Interface_Aggregation) SwitchedVlan() *Interface_Aggregation_SwitchedVlan {\n\treturn &Interface_Aggregation_SwitchedVlan{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"switched-vlan\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b7017f3487a3fdc49f30797374ac3365", "score": "0.4541496", "text": "func (o *InventoryUemInfo) GetSwitchId() string {\n\tif o == nil || o.SwitchId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.SwitchId\n}", "title": "" }, { "docid": "edd17d1b79daf83fede03d4474409d3b", "score": "0.45403692", "text": "func GetHostVirtualSwitch(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *HostVirtualSwitchState, opts ...pulumi.ResourceOption) (*HostVirtualSwitch, error) {\n\tvar resource HostVirtualSwitch\n\terr := ctx.ReadResource(\"vsphere:index/hostVirtualSwitch:HostVirtualSwitch\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "7ba3bf7bea391a2882c54017e7c050c7", "score": "0.4502715", "text": "func (p *Cluster) SwitchType() (SwitchType, bool) {\n\tif p.switchType != nil {\n\t\treturn *p.switchType, true\n\t}\n\tvar zero SwitchType\n\treturn zero, false\n}", "title": "" }, { "docid": "8cded6ae7ab9d8a020d479dc9f18f973", "score": "0.44899523", "text": "func NewVsw(ip_address string) (*Vsw, error) {\n\tif _vsw == nil {\n\t\tlog.Println(\"New Vsw for\", ip_address)\n\t\tconn, err := openTcp(ip_address)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t_vsw = new(Vsw)\n\t\t_vsw.conn = conn\n\t\treadBasicInfo(_vsw)\n\t\t_vsw.udpConn = openUdp(ip_address)\n\t\tgo monitorStatus(*_vsw)\n\t}\n\treturn _vsw, nil\n}", "title": "" }, { "docid": "25f3f5bde90787a24863adec695e03ac", "score": "0.44880405", "text": "func newSwitchTracer(in sacloud.SwitchAPI, cnf *config) sacloud.SwitchAPI {\n\treturn &SwitchTracer{\n\t\tInternal: in,\n\t\tconfig: cnf,\n\t}\n}", "title": "" }, { "docid": "ce7259bb43f20f857dbf3e47f94be75d", "score": "0.44828832", "text": "func (nc *client) UpdateLogicalSwitch(logicalSwitchModel *models.LogicalSwitch) (*models.LogicalSwitch, error) {\n\tparams := lsw.NewUpdateLogicalSwitchParams().WithLswitchID(logicalSwitchModel.ID).WithLogicalSwitch(logicalSwitchModel)\n\tres, err := nc.client.LogicalSwitching.UpdateLogicalSwitch(params, nc.auth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res.Payload, nil\n}", "title": "" }, { "docid": "a9e05b0e40f9ab716a76db9c37311ca3", "score": "0.44719484", "text": "func (n *Interface_EthernetAny) SwitchedVlan() *Interface_Ethernet_SwitchedVlanAny {\n\treturn &Interface_Ethernet_SwitchedVlanAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"switched-vlan\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1a52b429702d2d3d46f1c04ea8f3a862", "score": "0.4470676", "text": "func (f *FabricRPCs) GetFabricSwitch(ctx iris.Context) {\n\tdefer ctx.Next()\n\tctxt := ctx.Request().Context()\n\treq := getFabricRequest(ctx)\n\tl.LogWithFields(ctxt).Debugf(\"Incoming request received for creating fabric switch with request url %s\", req.URL)\n\tif req.SessionToken == \"\" {\n\t\terrorMessage := invalidAuthTokenErrorMsg\n\t\tcommon.SendInvalidSessionResponse(ctx, errorMessage)\n\t}\n\n\tresp, err := f.GetFabricResourceRPC(ctxt, req)\n\tif err != nil && resp == nil {\n\t\terrorMessage := rpcFailedErrMsg + err.Error()\n\t\tl.LogWithFields(ctxt).Error(errorMessage)\n\t\tcommon.SendFailedRPCCallResponse(ctx, errorMessage)\n\t\treturn\n\t}\n\tresp.Header = map[string]string{\n\t\t\"Allow\": `\"GET\"`,\n\t}\n\tl.LogWithFields(ctxt).Debugf(\"Outgoing response for creating fabric switch is %s with status code %d\", string(resp.Body), int(resp.StatusCode))\n\tsendFabricResponse(ctx, resp)\n}", "title": "" }, { "docid": "5b779950fe6b4be47312d7bfba51fa96", "score": "0.44533733", "text": "func (aha *ahaHTTP) SwitchOn(ain string) (string, error) {\n\treturn aha.switchForAin(ain, \"setswitchon\")\n}", "title": "" }, { "docid": "26164c2cf0d1ea56cb35bc76b109a279", "score": "0.444606", "text": "func (o HostVirtualSwitchOutput) NotifySwitches() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *HostVirtualSwitch) pulumi.BoolPtrOutput { return v.NotifySwitches }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "c4e63971bda792cc24581f99528b9826", "score": "0.443828", "text": "func (t *TasmotaT1) TurnOn() error {\n\t_, err := t.UpdateStatus()\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"err\": err,\n\t\t}).Error(\"failed to update status before turning on\")\n\t\treturn err\n\t}\n\n\ttimeout := time.Duration(5 * time.Second)\n\tclient := http.Client{\n\t\tTimeout: timeout,\n\t}\n\tresp, err := client.Get(fmt.Sprintf(\"%s/cm?cmnd=POWER%d%%20ON\", t.URI, t.SwitchNumber))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\trespBytes, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar switchStatusResp map[string]string\n\terr = json.Unmarshal(respBytes, &switchStatusResp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif status, ok := switchStatusResp[\"POWER\"+strconv.Itoa(t.SwitchNumber)]; ok {\n\t\tif status != \"ON\" {\n\t\t\terrorString := fmt.Sprintf(\"switch %d not reporting as ON after requesting to be ON\", t.SwitchNumber)\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"switchStatusResp\": switchStatusResp,\n\t\t\t\t\"switchNumber\": t.SwitchNumber,\n\t\t\t}).Error(errorString)\n\t\t\treturn fmt.Errorf(errorString)\n\t\t}\n\t} else {\n\t\terrorString := fmt.Sprintf(\"switch %d not reporting back after requesting to be ON\", t.SwitchNumber)\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"switchStatusResp\": switchStatusResp,\n\t\t\t\"switchNumber\": t.SwitchNumber,\n\t\t}).Error(errorString)\n\t\treturn fmt.Errorf(errorString)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c812d69a138d0777d02ec784f3882480", "score": "0.4430866", "text": "func SwitchStatus(s string) Option {\n\treturn func(o *Options) {\n\t\to.MetricSwitchStatus = s\n\t}\n}", "title": "" }, { "docid": "9090940404981fc6e23c571c091817be", "score": "0.43986693", "text": "func SaveSwitchChassis(chassisID string, data *model.Chassis) error {\n\treturn SaveToDB(db.TableSwitchChassis, chassisID, *data)\n}", "title": "" }, { "docid": "5156d382a025ea04d4f94c214b1ab5a4", "score": "0.43911323", "text": "func NewNotifySwitchOK() *NotifySwitchOK {\n\treturn &NotifySwitchOK{}\n}", "title": "" }, { "docid": "9a04572b52ebaa1d52417e2be02ac30c", "score": "0.4386923", "text": "func (a *Client) DeleteLogicalSwitch(params *DeleteLogicalSwitchParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteLogicalSwitchOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteLogicalSwitchParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"DeleteLogicalSwitch\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/logical-switches/{lswitch-id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteLogicalSwitchReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*DeleteLogicalSwitchOK), nil\n\n}", "title": "" }, { "docid": "9f4ffe748214d138c60e80edb799741c", "score": "0.43812242", "text": "func SetSwitchPoint(homeID uint32, valueID uint64, hours, minutes uint8, setback int8) error {\n\tcvalueid := C.valueid_create(C.uint32_t(homeID), C.uint64_t(valueID))\n\tdefer C.valueid_free(cvalueid)\n\tok := bool(C.manager_setSwitchPoint(cmanager, cvalueid, C.uint8_t(hours), C.uint8_t(minutes), C.int8_t(setback)))\n\tif ok == false {\n\t\treturn fmt.Errorf(\"value is not of schedule type\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "827df6205c13f09218fcf9f0f31dd98f", "score": "0.43811393", "text": "func (s *baseSwitcher) Switch() error {\n\tif len(s.provs) == 0 {\n\t\treturn fmt.Errorf(\"no providers available to switch\")\n\t}\n\trand.Seed(time.Now().Unix())\n\treturn s.switchWallpaper(s.provs[rand.Intn(len(s.provs))])\n}", "title": "" }, { "docid": "f91744a168809870052bdc26bddef527", "score": "0.43614405", "text": "func (a *DataSourcesApiService) EnableCiscoSwitch(ctx _context.Context, id string) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/data-sources/cisco-switches/{id}/enable\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.QueryEscape(parameterToString(id, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "8cf447838962df84ea573393e6b0746d", "score": "0.43567786", "text": "func (t *InterfaceTracer) DisconnectFromSwitch(ctx context.Context, zone string, id types.ID) error {\n\tvar span trace.Span\n\toptions := append(t.config.SpanStartOptions, trace.WithAttributes(\n\t\tattribute.String(\"libsacloud.api.arguments.zone\", zone),\n\t\tattribute.String(\"libsacloud.api.arguments.id\", forceString(id)),\n\t))\n\tctx, span = t.config.Tracer.Start(ctx, \"InterfaceAPI.DisconnectFromSwitch\", options...)\n\tdefer func() {\n\t\tspan.End()\n\t}()\n\n\t// for http trace\n\tctx = httptrace.WithClientTrace(ctx, otelhttptrace.NewClientTrace(ctx))\n\terr := t.Internal.DisconnectFromSwitch(ctx, zone, id)\n\n\tif err != nil {\n\t\tspan.SetStatus(codes.Error, err.Error())\n\t} else {\n\t\tspan.SetStatus(codes.Ok, \"\")\n\n\t}\n\treturn err\n}", "title": "" }, { "docid": "fa7225a7307d198e7cec0f2367826a59", "score": "0.43349928", "text": "func (p *parser) parseSwitchStmt() Stmt {\n\ts := new(SwitchStmt)\n\tp.expect(token.Switch)\n\tp.expect(token.Lparen)\n\ts.Tag = p.parseExpr()\n\tp.expect(token.Rparen)\n\ts.Body = p.parseCaseBlockStmt()\n\treturn s\n}", "title": "" }, { "docid": "59e38a42b2f7c9e60e9ad319b4c0b382", "score": "0.43313605", "text": "func (t *VPCRouterTracer) DisconnectFromSwitch(ctx context.Context, zone string, id types.ID, nicIndex int) error {\n\tvar span trace.Span\n\toptions := append(t.config.SpanStartOptions, trace.WithAttributes(\n\t\tattribute.String(\"libsacloud.api.arguments.zone\", zone),\n\t\tattribute.String(\"libsacloud.api.arguments.id\", forceString(id)),\n\t\tattribute.String(\"libsacloud.api.arguments.nicIndex\", forceString(nicIndex)),\n\t))\n\tctx, span = t.config.Tracer.Start(ctx, \"VPCRouterAPI.DisconnectFromSwitch\", options...)\n\tdefer func() {\n\t\tspan.End()\n\t}()\n\n\t// for http trace\n\tctx = httptrace.WithClientTrace(ctx, otelhttptrace.NewClientTrace(ctx))\n\terr := t.Internal.DisconnectFromSwitch(ctx, zone, id, nicIndex)\n\n\tif err != nil {\n\t\tspan.SetStatus(codes.Error, err.Error())\n\t} else {\n\t\tspan.SetStatus(codes.Ok, \"\")\n\n\t}\n\treturn err\n}", "title": "" }, { "docid": "116d0e9bb211b96dc8a1dbcb230beb34", "score": "0.432652", "text": "func GetSwitchChassis(chassisID string) (model.Chassis, error) {\n\tvar chassis model.Chassis\n\tdata, err := db.Connector.Get(db.TableSwitchChassis, chassisID)\n\tif err != nil {\n\t\treturn chassis, err\n\t}\n\tif err = json.Unmarshal([]byte(data), &chassis); err != nil {\n\t\treturn chassis, fmt.Errorf(\"while trying to unmarshal chassis data, got: %v\", err)\n\t}\n\treturn chassis, nil\n}", "title": "" }, { "docid": "3e08ca5574a6226526ddf0e8b4f4e6ee", "score": "0.43223277", "text": "func (o RdsDbProxyOutput) SwitchTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RdsDbProxy) pulumi.StringPtrOutput { return v.SwitchTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9d632bf8198353cd89f6456738c5eb08", "score": "0.43123242", "text": "func (a *automation) handleSwitch(name string, state *config.SensorState) {\n\tif name == config.BedroomSwitch {\n\t\tvalue := state.GetValueAttr(\"click\", \"\")\n\t\tif value == config.SwitchDoubleClick {\n\t\t\ta.presence.reportCausation(a.now)\n\t\t\ta.toggleDevice(config.BedroomLightMain)\n\t\t} else if value == config.SwitchSingleClick {\n\t\t\ta.presence.reportCausation(a.now)\n\t\t\ta.toggleDevice(config.BedroomLightStand)\n\t\t} else if value == config.SwitchTrippleClick {\n\t\t\ta.presence.reportCausation(a.now)\n\t\t}\n\t} else if name == config.SophiaRoomSwitch {\n\t\tvalue := state.GetValueAttr(\"click\", \"\")\n\t\tif value == config.SwitchSingleClick {\n\t\t\ta.presence.reportCausation(a.now)\n\t\t\ta.toggleDevice(config.SophiaRoomLightStand)\n\t\t} else if value == config.SwitchDoubleClick {\n\t\t\ta.presence.reportCausation(a.now)\n\t\t\ta.toggleDevice(config.SophiaRoomLightMain)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d3d321ed82d85c59b46f22ff7baf7fda", "score": "0.43107325", "text": "func (vswitch *Vswitch) initDefaultVswitch() error {\n\tvlan := 0\n\tcontainerPID := \"\"\n\ttaskID := \"\"\n\n\t// ad a vpc\n\tif _, err := vswitch.AddVPC(vlan); err != nil {\n\t\treturn err\n\t}\n\tif _, err := vswitch.AddPort(INTERFACE_INTERNAL, containerPID, taskID, vlan); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2cabaad56f24c8531bddcdd4dfdac986", "score": "0.43068826", "text": "func (c Client) SwitchSlot() ([]model.SwitchSlot, base.ClientError) {\n\ttime.Sleep(time.Duration(3) * time.Second)\n\tslots := make([]model.SwitchSlot, 0)\n\tfor i := 1; i <= 4; i++ {\n\t\tslot := model.SwitchSlot{}\n\t\tslot.Index = i\n\t\tslot.Inserted = true\n\t\tslot.ProductName = \"CX920\"\n\t\tslot.SerialNumber = base.RandString(10)\n\t\tslots = append(slots, slot)\n\t}\n\tlog.WithFields(log.Fields{\"client\": c}).Info(\"Client get switch slot.\")\n\treturn slots, nil\n}", "title": "" }, { "docid": "23f432d8f047e929974ecbed8a0c0670", "score": "0.42961687", "text": "func (client *Client) ModifyVpcFirewallCenSwitchStatus(request *ModifyVpcFirewallCenSwitchStatusRequest) (response *ModifyVpcFirewallCenSwitchStatusResponse, err error) {\n\tresponse = CreateModifyVpcFirewallCenSwitchStatusResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "88526050dc6cf15a5b32c69996c1921b", "score": "0.4256216", "text": "func (o DistributedVirtualSwitchOutput) NotifySwitches() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v *DistributedVirtualSwitch) pulumi.BoolOutput { return v.NotifySwitches }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "8a9657067a30c76f0e56b9df19838b03", "score": "0.42456517", "text": "func makeSwitchPair(t testing.TB, numChannels int, sendQueueCapacity int, recvBufferSize int, recvQueueCapacity int) (*Switch, *Switch, []*ChannelDescriptor) {\n\n\t// Make numChannels channels starting at byte(0x00)\n\tchIds := []byte{}\n\tfor i := 0; i < numChannels; i++ {\n\t\tchIds = append(chIds, byte(i))\n\t}\n\n\t// Make some channel descriptors.\n\tchDescs := []*ChannelDescriptor{}\n\tfor _, chId := range chIds {\n\t\tchDescs = append(chDescs, &ChannelDescriptor{\n\t\t\tId: chId,\n\t\t\tSendQueueCapacity: sendQueueCapacity,\n\t\t\tRecvBufferSize: recvBufferSize,\n\t\t\tRecvQueueCapacity: recvQueueCapacity,\n\t\t\tDefaultPriority: 1,\n\t\t})\n\t}\n\n\t// Create two switches that will be interconnected.\n\ts1 := NewSwitch(chDescs)\n\ts2 := NewSwitch(chDescs)\n\n\t// Create a listener for s1\n\tl := NewDefaultListener(\"tcp\", \":8001\")\n\n\t// Dial the listener & add the connection to s2.\n\tlAddr := l.ExternalAddress()\n\tconnOut, err := lAddr.Dial()\n\tif err != nil {\n\t\tt.Fatalf(\"Could not connect to listener address %v\", lAddr)\n\t} else {\n\t\tt.Logf(\"Created a connection to listener address %v\", lAddr)\n\t}\n\tconnIn, ok := <-l.Connections()\n\tif !ok {\n\t\tt.Fatalf(\"Could not get inbound connection from listener\")\n\t}\n\n\ts1.AddPeerWithConnection(connIn, false)\n\ts2.AddPeerWithConnection(connOut, true)\n\n\t// Wait for things to happen, peers to get added...\n\ttime.Sleep(100 * time.Millisecond)\n\n\t// Close the server, no longer needed.\n\tl.Stop()\n\n\treturn s1, s2, chDescs\n}", "title": "" }, { "docid": "ffd9042124f5f40515a35719a48e4cc2", "score": "0.4233187", "text": "func (v LogicalSwitch) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson774f72ecEncodeGithubComSkydiveProjectSkydiveTopologyProbesOvnOvnmodel(w, v)\n}", "title": "" }, { "docid": "6d02ef79873ce704fed04114eaaf51aa", "score": "0.42176673", "text": "func DoSwitchOperation(ctx context.Context, switchPortID uint32, nativeVlan uint32, req *iota.SwitchMsg) (err error) {\n\n\tif req.GetOp() == iota.SwitchOp_FLAP_PORTS {\n\t\tif err := portLinkFlap(ctx, req.DataSwitches, req.GetFlapInfo().GetCount(),\n\t\t\treq.GetFlapInfo().GetDownTime(),\n\t\t\treq.GetFlapInfo().GetInterval()); err != nil {\n\t\t\treturn errors.Wrap(err, \"Port up operation failed\")\n\t\t}\n\t\treturn nil\n\t}\n\n\tfor _, ds := range req.DataSwitches {\n\t\tn3k, err := dataswitch.NewSwitch(dataswitch.N3KSwitchType, ds.GetIp(), ds.GetUsername(), ds.GetPassword())\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"TOPO SVC | InitTestBed | Switch not found %s\", dataswitch.N3KSwitchType)\n\t\t\treturn err\n\t\t}\n\t\tdefer n3k.Disconnect()\n\n\t\tswitch req.GetOp() {\n\t\tcase iota.SwitchOp_SHUT_PORTS:\n\t\t\tif err := portLinkOp(n3k, ds.GetPorts(), true); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"Port shutdown operation failed\")\n\t\t\t}\n\t\tcase iota.SwitchOp_NO_SHUT_PORTS:\n\t\t\tif err := portLinkOp(n3k, ds.GetPorts(), false); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"Port up operation failed\")\n\t\t\t}\n\t\tcase iota.SwitchOp_VLAN_CONFIG:\n\t\t\tif err := doVlanConfiguration(n3k, ds.GetPorts(), req.GetVlanConfig()); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"Vlan config operation failed\")\n\t\t\t}\n\t\tcase iota.SwitchOp_PORT_QUEUING_CONFIG:\n\t\t\tif err := portQueuingOp(n3k, ds.GetPorts(), req.GetPortQueuing().GetEnable(), req.GetPortQueuing().GetParams()); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"Port queuing operation failed\")\n\t\t\t}\n\t\tcase iota.SwitchOp_PORT_QOS_CONFIG:\n\t\t\tif err := portQosOp(n3k, ds.GetPorts(), req.GetPortQos().GetEnable(), req.GetPortQos().GetParams()); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"Port qos operation failed\")\n\t\t\t}\n\t\tcase iota.SwitchOp_PORT_PAUSE_CONFIG:\n\t\t\tif err := portPauseOp(n3k, ds.GetPorts(), req.GetPortPause().GetEnable()); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"Port pause operation failed\")\n\t\t\t}\n\t\tcase iota.SwitchOp_PORT_PFC_CONFIG:\n\t\t\tif err := portPfcOp(n3k, ds.GetPorts(), req.GetPortPfc().GetEnable()); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"Port priority flow control operation failed\")\n\t\t\t}\n\t\tcase iota.SwitchOp_CREATE_QOS_CONFIG:\n\t\t\tif err := setSwitchQosConfig(n3k, ds.GetQos()); err != nil {\n\t\t\t\tlog.Errorf(\"TOPO SVC | InitTestBed | Set Switch QoS config failed to set netword-qos policy: %s\", err.Error())\n\t\t\t\treturn errors.Wrap(err, \"Configuring QOS on switch failed\")\n\t\t\t}\n\t\t\tif err := setSwitchDscpConfig(n3k, ds.GetDscp()); err != nil {\n\t\t\t\tlog.Errorf(\"TOPO SVC | InitTestBed | Set Switch QoS config failed to create classification policy: %s\", err.Error())\n\t\t\t\treturn errors.Wrap(err, \"Configuring DSCP on switch failed\")\n\t\t\t}\n\t\tcase iota.SwitchOp_CREATE_PORT_CHANNEL:\n\t\t\t// re-evaluate for port-channel configuration\n\t\t\tif nativeVlan == 0 {\n\t\t\t\tinBandVlans := constants.InbandVlanEnd - constants.InbandVlanStart\n\t\t\t\tnativeVlan = constants.InbandVlanStart + (switchPortID % (uint32)(inBandVlans))\n\t\t\t}\n\t\t\tstartTrunkVlan := (switchPortID * constants.VlansPerTestBed) % constants.MaxDataVlanRange\n\t\t\tif startTrunkVlan == 0 {\n\t\t\t\tstartTrunkVlan = 1\n\t\t\t}\n\t\t\tendTrunkVlan := startTrunkVlan + constants.VlansPerTestBed\n\t\t\ttrunkVlanRange := strconv.Itoa(int(startTrunkVlan)) + \"-\" + strconv.Itoa(int(endTrunkVlan))\n\n\t\t\tfor _, pcConfig := range req.PortChannelConfigs.GetConfigs() {\n\t\t\t\tif pcConfig.GetSwitchIp() == ds.GetIp() {\n\t\t\t\t\tif err := n3k.CreatePortChannel(pcConfig.GetChNumber(), ds.Mtu, nativeVlan, trunkVlanRange, pcConfig.GetPorts()); err != nil {\n\t\t\t\t\t\tlog.Errorf(\"TOPO SVC | InitTestBed | Failed to create port-channel\")\n\t\t\t\t\t\treturn errors.Wrap(err, \"PortChannel Creation Failed\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase iota.SwitchOp_DELETE_PORT_CHANNEL:\n\t\t\tfor _, pcConfig := range req.PortChannelConfigs.GetConfigs() {\n\t\t\t\tif pcConfig.GetSwitchIp() == ds.GetIp() {\n\t\t\t\t\tif err := n3k.DeletePortChannel(pcConfig.GetChNumber(), pcConfig.GetPorts()); err != nil {\n\t\t\t\t\t\t// return errors.Wrap(err, \"PortChannel deletion failed\")\n\t\t\t\t\t\tlog.Errorf(\"TOPO SVC | InitTestBed | Failed to delete port-channel\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase iota.SwitchOp_LLDP_INFO_GET:\n\t\t\treq.LldpInfo = &iota.LLDPInfo{}\n\t\t\tfor _, port := range ds.Ports {\n\t\t\t\tlldpInfo, err := n3k.GetLLDPOutput(port)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.Wrap(err, \"LLDP port get failed\")\n\t\t\t\t}\n\t\t\t\treq.LldpInfo.PortsLldpInfo = append(req.LldpInfo.PortsLldpInfo,\n\t\t\t\t\t&iota.PortLLDPInfo{\n\t\t\t\t\t\tMgmtAddr: lldpInfo.MgmtAddr,\n\t\t\t\t\t\tSysDesc: lldpInfo.SysDesc,\n\t\t\t\t\t\tSysName: lldpInfo.SysName,\n\t\t\t\t\t\tPortDesc: lldpInfo.PortDesc,\n\t\t\t\t\t\tSwitch: ds.Ip,\n\t\t\t\t\t\tPort: port,\n\t\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}", "title": "" }, { "docid": "3053299f694c8dc554669e3deadc81a5", "score": "0.42135528", "text": "func (n *Interface_AggregationAny) SwitchedVlan() *Interface_Aggregation_SwitchedVlanAny {\n\treturn &Interface_Aggregation_SwitchedVlanAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"switched-vlan\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "f4e38cc990a568308fc22a3e606eb324", "score": "0.4185098", "text": "func (v LogicalSwitch) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson774f72ecEncodeGithubComSkydiveProjectSkydiveTopologyProbesOvnOvnmodel(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "1ceef5a498be8633819dad1010ba8a71", "score": "0.41831163", "text": "func (t *MobileGatewayTracer) DisconnectFromSwitch(ctx context.Context, zone string, id types.ID) error {\n\tvar span trace.Span\n\toptions := append(t.config.SpanStartOptions, trace.WithAttributes(\n\t\tattribute.String(\"libsacloud.api.arguments.zone\", zone),\n\t\tattribute.String(\"libsacloud.api.arguments.id\", forceString(id)),\n\t))\n\tctx, span = t.config.Tracer.Start(ctx, \"MobileGatewayAPI.DisconnectFromSwitch\", options...)\n\tdefer func() {\n\t\tspan.End()\n\t}()\n\n\t// for http trace\n\tctx = httptrace.WithClientTrace(ctx, otelhttptrace.NewClientTrace(ctx))\n\terr := t.Internal.DisconnectFromSwitch(ctx, zone, id)\n\n\tif err != nil {\n\t\tspan.SetStatus(codes.Error, err.Error())\n\t} else {\n\t\tspan.SetStatus(codes.Ok, \"\")\n\n\t}\n\treturn err\n}", "title": "" }, { "docid": "f52fb76f342ac4281e1c7859f09dbeaa", "score": "0.41738078", "text": "func (r *RateEnforcer) Switch(n astiencoder.Node) {\n\tr.m.Lock()\n\tdefer r.m.Unlock()\n\tr.desiredNode = n\n}", "title": "" }, { "docid": "3f560db1328497b6230422b45cc65836", "score": "0.41721302", "text": "func (in *VSwitch) DeepCopyInto(out *VSwitch) {\n\t*out = *in\n}", "title": "" }, { "docid": "0962240d23dc2e30233eed82d04fe633", "score": "0.41627985", "text": "func (o *VirtualizationIweNetworkAllOf) SetDvswitch(v VirtualizationIweDvswitchRelationship) {\n\to.Dvswitch = &v\n}", "title": "" }, { "docid": "4075298e3a8c241d6f95274ba06001ea", "score": "0.4161526", "text": "func Switch[T comparable, R any](predicate T) *switchCase[T, R] {\n\tvar result R\n\n\treturn &switchCase[T, R]{\n\t\tpredicate,\n\t\tresult,\n\t\tfalse,\n\t}\n}", "title": "" }, { "docid": "3c79a65c0f510650c51a8744d03b27d0", "score": "0.4159785", "text": "func (o DistributedVirtualSwitchOutput) LacpApiVersion() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *DistributedVirtualSwitch) pulumi.StringOutput { return v.LacpApiVersion }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "002c99d52c9e5732841c6ab209f184a8", "score": "0.41092613", "text": "func (p *Parser) parseSwitch() ast.Expression {\n\texpression := &ast.Switch{Token: p.token}\n\tp.advance()\n\texpression.Control = p.parseExpression(LOWEST)\n\n\t// Control is required.\n\tif expression.Control != nil {\n\t\tp.advance()\n\t}\n\n\t// Ignore the optional DO token.\n\tif !p.match(token.DO, token.NEWLINE) {\n\t\tp.reportError(\"Missing DO statement in inline SWITCH\")\n\t}\n\n\tp.advance()\n\n\tvar cases []*ast.SwitchCase\n\t// Consume the switch until it ends, either with an\n\t// END or EOF token.\n\tfor !p.match(token.END, token.EOF) {\n\t\tswitch p.token.Type {\n\t\tcase token.CASE: // A case,\n\t\t\tswitchcase := &ast.SwitchCase{Token: p.token}\n\n\t\t\t// A case can have more than one parameter to\n\t\t\t// compare to.\n\t\t\tlist := &ast.ExpressionList{Token: p.token}\n\t\t\tp.advance()\n\t\t\tlist.Elements = p.parseDelimited(token.COMMA, token.NEWLINE, token.THEN)\n\n\t\t\t// A case should have at least one expression.\n\t\t\tif len(list.Elements) == 0 {\n\t\t\t\tp.reportError(\"Missing expression in SWITCH CASE\")\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tswitchcase.Values = list\n\t\t\tswitchcase.Body = p.parseSwitchCase()\n\n\t\t\tcases = append(cases, switchcase)\n\t\tcase token.DEFAULT: // Default case.\n\t\t\t// Anything except a THEN or a NEWLINE means there are\n\t\t\t// parameters, which the default case can't have.\n\t\t\tif !p.peekMatch(token.THEN, token.NEWLINE) {\n\t\t\t\tp.reportError(\"DEFAULT case in SWITCH can't have parameters\")\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tp.advance()\n\n\t\t\texpression.Default = p.parseSwitchCase()\n\n\t\t\tif len(expression.Default.Statements) == 0 {\n\t\t\t\tp.reportError(\"Missing DEFAULT case body in SWITCH\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\n\t\tp.advance()\n\t}\n\n\texpression.Cases = cases\n\n\t// Missing END token.\n\tif !p.match(token.END) {\n\t\tp.reportError(\"Missing END closing statement in SWITCH\")\n\t\treturn nil\n\t}\n\n\treturn expression\n}", "title": "" }, { "docid": "51e5de784c877beffea821a4cd595676", "score": "0.4106317", "text": "func (o *VirtualizationIweNetworkAllOf) GetDvswitch() VirtualizationIweDvswitchRelationship {\n\tif o == nil || o.Dvswitch == nil {\n\t\tvar ret VirtualizationIweDvswitchRelationship\n\t\treturn ret\n\t}\n\treturn *o.Dvswitch\n}", "title": "" }, { "docid": "fbeaea03cbca3e6e0f8fa8976c39c611", "score": "0.4101427", "text": "func TestSwitchingOn(t *testing.T) {\n\tfritz := New().Start()\n\tdefer fritz.Close()\n\tr, _ := (&http.Client{}).Get(fritz.Server.URL + \"/webservices/homeautoswitch.lua?switchcmd=setswitchon\")\n\tassert2xxResponse(t, r)\n}", "title": "" }, { "docid": "0910bdf1592e62afc30fc1b488bd4031", "score": "0.40791324", "text": "func (a *DataSourcesApiService) AddCiscoSwitch(ctx _context.Context, localVarOptionals *AddCiscoSwitchOpts) (CiscoSwitchDataSource, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue CiscoSwitchDataSource\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/data-sources/cisco-switches\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tif localVarOptionals != nil && localVarOptionals.Body.IsSet() {\n\t\tlocalVarOptionalBody, localVarOptionalBodyok := localVarOptionals.Body.Value().(CiscoSwitchDataSourceRequest)\n\t\tif !localVarOptionalBodyok {\n\t\t\treturn localVarReturnValue, nil, reportError(\"body should be CiscoSwitchDataSourceRequest\")\n\t\t}\n\t\tlocalVarPostBody = &localVarOptionalBody\n\t}\n\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 201 {\n\t\t\tvar v CiscoSwitchDataSource\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v ApiError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 412 {\n\t\t\tvar v ApiError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "4b13f900ae4bfdc47741b7a34c845bbd", "score": "0.40735698", "text": "func (c HSV) ToHSL() HSL {\n\th := c.H\n\ts := c.S / 100.0\n\tv := c.V / 100.0\n\tvmin := math.Max(v, 0.01)\n\tl := (2 - s) * v\n\tlmin := (2 - s) * vmin\n\tsl := s * vmin\n\n\tif lmin <= l {\n\t\tsl /= lmin\n\t} else {\n\t\tsl /= 2 - lmin\n\t}\n\n\tl /= 2\n\n\treturn HSL{h, sl * 100.0, l * 100.0}\n}", "title": "" }, { "docid": "c32172fac7ee7db2dbd080d4b65393fe", "score": "0.40717098", "text": "func (a *DataSourcesApiService) EnableJuniperSwitch(ctx _context.Context, id string) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/data-sources/juniper-switches/{id}/enable\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.QueryEscape(parameterToString(id, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" } ]
9f0988fcb1ca7ec1e9099de4d1fb8bf1
getAllOrdersByClientAndRestID : return orders
[ { "docid": "db227af73f331e588efb12cdec8edff9", "score": "0.8119905", "text": "func getAllOrdersByClientAndRestID(email string, restID int) ([]*Cart, FoulError) {\n\tvar m []*Cart\n\trows, err := config.DB.Query(\"SELECT * FROM CART WHERE rest_id = ? AND email = ? AND state_id != ?\", restID, email, CLOSED)\n\tif err != nil {\n\t\treturn m, &Foul{\"DB.QUERY ERROR\", err.Error(), TraceCall()}\n\t}\n\treturn scanRowsOrder(rows)\n}", "title": "" } ]
[ { "docid": "ea6c27260746ca755bd73d331e83dd57", "score": "0.74832594", "text": "func getOrdersByCustomerID(c *gin.Context) {\n\n\t// discover Java service...\n\tordAddress, err := disc.DiscoverService(discovery.DiscoverOptions{\n\t\tValue: \"java-service\",\n\t\tEnvironment: \"dev\",\n\t\tVersion: \"1.0.0\",\n\t\tAccessType: \"direct\",\n\t})\n\n\tif err != nil {\n\t\tc.JSON(http.StatusInternalServerError, ErrorResponse{\n\t\t\tStatus: http.StatusInternalServerError,\n\t\t\tMessage: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tcID := c.Param(\"id\")\n\torders := new([]OrderResponse)\n\n\t_, err = sling.New().Get(ordAddress).Path(\"/v1/orders?where=customerId:EQ:\" + cID).ReceiveSuccess(orders)\n\tif err != nil {\n\t\t// Java service returned something other than code 2xx\n\t\tc.JSON(http.StatusInternalServerError, ErrorResponse{\n\t\t\tStatus: http.StatusInternalServerError,\n\t\t\tMessage: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, orders)\n\treturn\n}", "title": "" }, { "docid": "063e09dd27462781e6c8daeb8ede68de", "score": "0.69012535", "text": "func getAllOrdersByRestIDAndState(rest_id int, state string) ([]*Cart, FoulError) {\n\tvar m []*Cart\n\trows, err := config.DB.Query(\"SELECT * FROM CART WHERE rest_id = ? AND state_id = ?\", rest_id, state)\n\tif err != nil {\n\t\treturn m, &Foul{\"DB.QUERY ERROR\", err.Error(), TraceCall()}\n\t}\n\treturn scanRowsOrder(rows)\n}", "title": "" }, { "docid": "d8012943c57d40d770b4e8ec9ebb442d", "score": "0.66116196", "text": "func GetSpecificOrdersByQuery(c *gin.Context) {\n\n\tcustomerid := c.Query(\"CustomerID\")\n\torder,err:=rules.ReturnJsonBasedOnCUSTID(customerid)\n\tif err!=nil{\n\t\tc.JSON(200, gin.H{\n\t\t\t\"message\":\"customer not found\",\n\t\t})\n\t}else {\n\t\tc.JSON(200,&order)\n\t}\n}", "title": "" }, { "docid": "830853f53e9380bfa817d82b2fc1ac4c", "score": "0.6582297", "text": "func GetSpecificOrdersByQuery(c *gin.Context) {\n\n\tconn, err := grpc.Dial(\"localhost:50051\", grpc.WithInsecure())\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error While calling GreetFullName : %v\", err)\n\t}\n\n\tdefer conn.Close()\n\n\tclient := orderspb.NewOrderServiceClient(conn)\n\n\tcustomerid := c.Query(\"CustomerID\")\n\n\treq := &orderspb.GetSpecificOrderRequest{\n\t\tOrderId:customerid,\n\t}\n\n\tres, err := client.GetSpecificOrder(context.Background(), req)\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error While calling GreetFullName : %v\", err)\n\t}\n\n\tif err!=nil{\n\t\tc.JSON(200, gin.H{\n\t\t\t\"message\":\"customer not found\",\n\t\t})\n\t}else {\n\t\tginRes := &csv.Order{\n\t\t\tCustomerID:res.GetOrder().CustomerId,\n\t\t\tCustomerName:res.GetOrder().CustomerName,\n\t\t\tRestsurantName:res.GetOrder().RestsurantName,\n\t\t\tVegCuisine:res.GetOrder().VegCuisine,\n\t\t\tNonVegCuisine:res.GetOrder().NonvegCuisine,\n\t\t\tState:res.GetOrder().State,\n\t\t}\n\t\tc.JSON(200,ginRes)\n\t}\n}", "title": "" }, { "docid": "9d7b096879d2130b3c7751e24511384a", "score": "0.6522689", "text": "func GetOrdersByClientid(rc *redis.Client, Clientid int) (oArray []*Order, err error) {\n\t// To keep data consistent, we always need a lock\n\terr = WithNxLock(rc, \"order\", func() (err1 error) {\n\t\tbucketKey := fmt.Sprintf(\"order-by-clientid.%d\", Clientid)\n\t\tvar bucketContents map[string]string\n\t\tbucketContents, err1 = rc.HGetAll(bucketKey).Result()\n\t\tif err1 != nil {\n\t\t\treturn\n\t\t}\n\t\tfor _, str := range bucketContents {\n\t\t\to := &Order{}\n\t\t\tbinary := []byte(str)\n\t\t\terr1 = o.UnmarshalBinary(binary)\n\t\t\tif err1 != nil {\n\t\t\t\toArray = []*Order{}\n\t\t\t\treturn\n\t\t\t}\n\t\t\toArray = append(oArray, o)\n\t\t}\n\t\treturn\n\t})\n\treturn\n}", "title": "" }, { "docid": "b214f32c2c255540464d08595f15119a", "score": "0.6522189", "text": "func (s *Server) getAllOrders() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tspan, ctx := ot.StartSpanFromContext(r.Context(), \"getAllOrders\")\n\t\tdefer span.Finish()\n\t\tlog := util.RequestIDLogger(s.logger, r)\n\n\t\tdefaultErrMsg := \"unable to retrieve orders\"\n\t\tkeys, err := s.RedisScanOrders(ctx)\n\t\tif err != nil {\n\t\t\tlog.Errorw(\"unable to SCAN redis for keys\",\n\t\t\t\t\"error\", err,\n\t\t\t)\n\t\t\ts.Respond(ctx, http.StatusInternalServerError, defaultErrMsg, 0, nil, w)\n\t\t\treturn\n\t\t}\n\n\t\tvar orders = []*Order{}\n\t\tfor _, k := range keys {\n\t\t\to, err := s.RedisGetOrder(ctx, k)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorw(\"unable to get get order\",\n\t\t\t\t\t\"key\", k,\n\t\t\t\t\t\"error\", err,\n\t\t\t\t)\n\t\t\t\ts.Respond(ctx, http.StatusInternalServerError, defaultErrMsg, 0, nil, w)\n\t\t\t\treturn\n\t\t\t}\n\t\t\torders = append(orders, o)\n\t\t}\n\n\t\tl := len(orders)\n\t\tif l == 0 {\n\t\t\ts.Respond(ctx, http.StatusNotFound, \"no orders present\", 0, nil, w)\n\t\t\treturn\n\t\t}\n\n\t\ts.Respond(ctx, http.StatusOK, \"orders retrieved\", l, orders, w)\n\t}\n}", "title": "" }, { "docid": "783156d2a1c4db9307d95c929ea36d37", "score": "0.64778423", "text": "func (h *Handler) GetOrders(c *gin.Context) {\n\tif h.db == nil {\n\t\treturn\n\t}\n\n\tp := c.Param(\"id\")\n\tid, err := strconv.Atoi(p)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\torders, err := h.db.GetCustomerOrdersByID(id)\n\tif err != nil {\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, orders)\n}", "title": "" }, { "docid": "6da7aae84ef294b9190ccc7fec0ea8b0", "score": "0.64434546", "text": "func (s *MockedApiService) GetOrders(ctx context.Context, productId string) (ordf.ImplResponse, error) {\n\torder := ordf.Order{\n\t\tItems: []ordf.OrderItems{\n\t\t\tordf.OrderItems{\n\t\t\t\tProductId: \"PROD-01D78XYFJ1PRM1WPBAOU8JQMNV\",\n\t\t\t\tQuantity: 4,\n\t\t\t},\n\t\t\tordf.OrderItems{\n\t\t\t\tProductId: \"PROD-01D78XYFJ1PRM1WPBCBT3VHMNV\",\n\t\t\t\tQuantity: 2,\n\t\t\t},\n\t\t},\n\t\tCustomer: ordf.OrderCustomer{\n\t\t\tDeliveryAddress: \"addr1\",\n\t\t},\n\t\tPayment: ordf.OrderPayment{\n\t\t\tPaymentAddress: \"addr1\",\n\t\t\tPriceCurrencyId: \"ada\",\n\t\t\tPriceAmount: 20,\n\t\t\tPaymentStatus: \"AWAITING_PAYMENT\",\n\t\t},\n\t\tOrderStatus: \"AWAITING_PAYMENT\",\n\t\tDescription: \"Occulta Novellia Presale Order\",\n\t\tOrderId: \"ORDER-01D78XYFJ1PRM1WPBCBT3VHMNV\",\n\t}\n\n\treturn ordf.Response(200, order), nil\n}", "title": "" }, { "docid": "e0869558d11df5a4603bc73622a2afa0", "score": "0.64414656", "text": "func (n *NiceHash) GetAllOrders() Orders {\n\tv := n.getAuthValues()\n\tv.Set(\"method\", \"orders.get\")\n\tv.Set(\"location\", \"1\")\n\tv.Set(\"algo\", \"1\")\n\n\tr := Send(v)\n\n\tresp := Response{}\n\tdec := json.NewDecoder(r.Body)\n\tdec.Decode(&resp)\n\n\treturn resp.Result.Orders\n}", "title": "" }, { "docid": "0a61ffb07c94e6b8ddc30838dda0e5d3", "score": "0.6420725", "text": "func GetClientWorkOrders(clientID string) ([]WorkOrder, error) {\n\tworders := []WorkOrder{}\n\tworderResponse := WorkOrderResponse{}\n\thttpclient := &http.Client{}\n\tlog.Info(\"get work orders for account!\")\n\n\tif !hasSecurityToken() {\n\t\terr := getSecurityToken()\n\t\tif err != nil {\n\t\t\treturn worders, err\n\t\t}\n\t}\n\n\tparams := map[string]string{}\n\tparams[\"clientID\"] = clientID\n\tparams[\"securityToken\"] = securityToken\n\tparams[\"isCompleteObject\"] = \"true\"\n\n\treqURL, err := buildURL(baseURL, \"api/v1/data/WorkOrders/\")\n\tif err != nil {\n\t\treturn worders, err\n\t}\n\tlog.Info(reqURL)\n\n\tbuf := new(bytes.Buffer)\n\tjson.NewEncoder(buf).Encode(params)\n\n\treq, err := http.NewRequest(\"POST\", reqURL, buf)\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\tresp, err := httpclient.Do(req)\n\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\n\terr = checkVonigoError(body)\n\n\tif err != nil {\n\t\treturn worders, err\n\t}\n\n\terr = json.Unmarshal(body, &worderResponse)\n\tif err != nil {\n\t\treturn worders, err\n\t}\n\treturn worderResponse.WorkOrders, nil\n}", "title": "" }, { "docid": "0a952441f30409fd263599f80a591b76", "score": "0.64020354", "text": "func AllOrdersEndpoint(w http.ResponseWriter, r *http.Request){\n\tsession, err := mgo.Dial(mongodb_server)\n\tif err != nil {\n\t\tpanic(err)\n\t return\n\t}\n\tdefer session.Close()\n\tsession.SetMode(mgo.Monotonic, true)\n\tc := session.DB(mongodb_database).C(mongodb_collection)\n\tvar orders []Order\n\terr = c.Find(bson.M{}).All(&orders)\n\tif err != nil {\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\trespondWithJson(w, http.StatusOK, orders)\t\n}", "title": "" }, { "docid": "a4647f016dac313ee1fa247182f1d1e8", "score": "0.6380042", "text": "func (order *Cart) GetDataByClientAndRestID(email string, restID string) ([]*Cart, FoulError) {\n\n\tusableID, _ := strconv.Atoi(restID)\n\n\tdata, err := getAllOrdersByClientAndRestID(email, usableID)\n\treturn data, err\n}", "title": "" }, { "docid": "6e3c6ec43d0938e5705abd718034dd4e", "score": "0.63468885", "text": "func FetchOrdersBybizID(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\to, err := dao.FetchOrdersBybizID(params[\"id\"])\n\tif err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, \"Invalid business ID\")\n\t\treturn\n\t}\n\trespondWithJson(w, http.StatusOK, o)\n}", "title": "" }, { "docid": "5fbfe52891c321a23e431416590a0d07", "score": "0.63355005", "text": "func (c *EcomClient) GetOrders(ctx context.Context) ([]*Order, error) {\n\turl := fmt.Sprintf(\"%s/orders\", c.endpoint)\n\tres, err := c.request(http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err,\n\t\t\t\"request(http.MethodGet, url=%q, nil)\", url)\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode >= 400 {\n\t\tvar e badRequestResponse\n\t\tdec := json.NewDecoder(res.Body)\n\t\t//dec.DisallowUnknownFields()\n\t\tif err := dec.Decode(&e); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"decode\")\n\t\t}\n\t\treturn nil, fmt.Errorf(\"status: %d, code: %s, message: %s\",\n\t\t\te.Status, e.Code, e.Message)\n\t}\n\n\tvar container OrderListContainer\n\tif err = json.NewDecoder(res.Body).Decode(&container); err != nil {\n\t\treturn nil, errors.Wrap(err, \"decode\")\n\t}\n\treturn container.Data, nil\n}", "title": "" }, { "docid": "b40e3f739a48386902d75546d5117bfd", "score": "0.63349247", "text": "func GetOrder(w http.ResponseWriter, r *http.Request){\t\n params := mux.Vars(r) \n orderID, err := strconv.Atoi(params[\"id\"])\n session, err :=mgo.Dial(mongodb_server)\n if err != nil {\n panic(err)\n return\n }\n defer session.Close()\n session.SetMode(mgo.Monotonic, true)\n c := session.DB(mongodb_database).C(mongodb_collection)\n var orders []Order\n \n err = c.Find(bson.M{\"order_id\": orderID}).All(&orders)\n if err != nil {\n respondWithError(w, http.StatusInternalServerError, err.Error())\n return\n }\n respondWithJson(w, http.StatusOK, orders)\n}", "title": "" }, { "docid": "bc7c4d5de31d6b4210608b8b97788db5", "score": "0.63318485", "text": "func (c *Client) Orders(ctx context.Context, p *OrdersPayload) (res *OrdersResult, err error) {\n\tvar ires interface{}\n\tires, err = c.OrdersEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*OrdersResult), nil\n}", "title": "" }, { "docid": "58f44add152d8ce2d60b32224e5083e5", "score": "0.627817", "text": "func GetOrdersHandler(w http.ResponseWriter, r *http.Request){\n w.Header().Set(\"Content-Type\", \"application/json\")\n if r.Method != \"GET\" {\n w.Header().Set(\"Allow\", \"GET\")\n http.Error(w, http.StatusText(405), 405)\n return\n }\n\n session, err := mgo.Dial(mongodb_server)\n if err != nil {\n panic(err)\n return\n }\n\n defer session.Close()\n session.SetMode(mgo.Monotonic, true)\n c := session.DB(mongodb_database).C(mongodb_collection)\n var orders []Order\n\n err = c.Find(bson.M{}).All(&orders)\n if err != nil {\n respondWithError(w, http.StatusInternalServerError, err.Error())\n return\n }\n\n respondWithJson(w, http.StatusOK, orders) \n}", "title": "" }, { "docid": "07ff228418fe54883d65a3ecf8f1097d", "score": "0.6245367", "text": "func (api *orderAPI) ApisrvList(ctx context.Context, opts *api.ListWatchOptions) ([]*bookstore.Order, error) {\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn apicl.BookstoreV1().Order().List(context.Background(), opts)\n\t}\n\n\t// List from local cache\n\tctkitObjs, err := api.List(ctx, opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar ret []*bookstore.Order\n\tfor _, obj := range ctkitObjs {\n\t\tret = append(ret, &obj.Order)\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "9def0a1d17fdbbbf58627b5ebb269fb7", "score": "0.62247515", "text": "func getAllOrders() ([]*Cart, FoulError) {\n\tvar m []*Cart\n\trows, err := config.DB.Query(\"SELECT * FROM CART\")\n\tif err != nil {\n\t\treturn m, &Foul{\"DB.QUERY ERROR\", err.Error(), TraceCall()}\n\t}\n\treturn scanRowsOrder(rows)\n}", "title": "" }, { "docid": "5e9ec53a571a80f5d4fe3a2d75e77261", "score": "0.62017125", "text": "func (oc OrderController) GetOrders(w http.ResponseWriter, r *http.Request) {\n\tuser := context.Get(r, \"user\").(*MyClaims)\n\tvar order models.Order\n\n\tdataOrder := order.GetOrders(strconv.Itoa(user.IDCustomer))\n\n\tmessage, _ := json.Marshal(&dataOrder)\n\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(`{\"order\":` + string(message) + `}`))\n}", "title": "" }, { "docid": "632ed79acee7b5eaa4bf25f2362f9213", "score": "0.62009144", "text": "func GetOrders(w http.ResponseWriter, r *http.Request) {\n\tdbURI := r.Header.Get(uri)\n\tlog.Debug(\"Retrieving orders\")\n\tdb, _ := InitDb(dbURI)\n\tdbRepo := &repository.OrderRepositorySQL{db, defaultTable}\n\torders, err := dbRepo.GetOrders()\n\tif err != nil {\n\t\tlog.Error(\"Error retrieving orders.\", err)\n\t\tresponse.WriteCodeAndMessage(http.StatusInternalServerError, \"Internal error.\", w)\n\t\treturn\n\t}\n\n\tif err = respondOrders(orders, w); err != nil {\n\t\tlog.Error(\"Error sending orders response.\", err)\n\t\tresponse.WriteCodeAndMessage(http.StatusInternalServerError, \"Internal error.\", w)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "3a8a692c92020e0dbba3155c737fa1bf", "score": "0.61861503", "text": "func GetCustomerOrders(w http.ResponseWriter, r *http.Request) {\n\n\tdb := database.DbConn\n\trepository := models.Repository{Conn: db}\n\tmuxVar := mux.Vars(r)\n\tstrID := muxVar[\"customer_number\"]\n\tcustomerNumber, err := strconv.Atoi(strID)\n\tif err != nil {\n\t\tlog.Printf(\"could not parse str to int: %v\", err)\n\t\thelpers.WriteErrorJSON(w, http.StatusInternalServerError, \"could not parse url\")\n\t\treturn\n\t}\n\n\torders, err := repository.GetCustomerOrders(customerNumber)\n\tif err != nil {\n\t\tlog.Printf(\"could not get orders: %v\", err)\n\t\thelpers.WriteErrorJSON(w, http.StatusInternalServerError, \"could not get orders\")\n\t\treturn\n\t}\n\n\tif len(orders) <= 0 {\n\t\thelpers.WriteErrorJSON(w, http.StatusNotFound, \"could not find any order\")\n\t\treturn\n\t}\n\n\thelpers.WriteJSON(w, http.StatusOK, orders)\n}", "title": "" }, { "docid": "df2966cf24045bc0b58b5336fe5f4fa4", "score": "0.61710006", "text": "func (orderH *OrderHTTPhandler) GetOrders(c echo.Context) error {\n\texample, err := orderH.OrderRepo.GetOrders()\n\tif err != nil {\n\t\treturn c.String(http.StatusInternalServerError, err.Error())\n\t}\n\treturn c.JSON(http.StatusOK, example)\n}", "title": "" }, { "docid": "dc1c6327dca127ad8d0e0d4291c5fde0", "score": "0.6111386", "text": "func (p *PlayerServiceClient) GetNewOrders() (r []*Order, err error) {\n if err = p.sendGetNewOrders(); err != nil { return }\n return p.recvGetNewOrders()\n}", "title": "" }, { "docid": "9db1b171bfcce5f3d378ff97d4bab546", "score": "0.610086", "text": "func (oc OrderController) GetOrdersToko(w http.ResponseWriter, r *http.Request) {\n\tposition := context.Get(r, \"position\").(map[string]interface{})\n\tvars := mux.Vars(r)\n\n\tidToko := vars[\"idToko\"]\n\tvar order models.Order\n\tvar dataOrder []models.Order\n\n\tif position[\"position\"].(string) == \"owner\" || position[\"position\"].(string) == \"admin\" {\n\t\tdataOrder = order.GetOrdersToko(idToko)\n\t} else if position[\"position\"] == \"editor\" {\n\t\tdataOrder = order.GetOrdersEditor(idToko, position[\"idKaryawan\"].(string))\n\t}\n\n\tmessage, _ := json.Marshal(&dataOrder)\n\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(`{\"order\":` + string(message) + `}`))\n}", "title": "" }, { "docid": "fe6fa895049f78488e9d766a9d0a7202", "score": "0.6025751", "text": "func GetOrdersByCustomerID(order *[]Order, CustomerId string) (err error) {\n\tif err = Config.DB.Where(\"customer_id = ?\", CustomerId).Find(order).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "48b37795641a003a9e2f7bd1d2e0a1da", "score": "0.6020463", "text": "func (i *ItBit) GetOrders(ctx context.Context, walletID, symbol, status string, page, perPage int64) ([]Order, error) {\n\tvar resp []Order\n\tparams := make(map[string]interface{})\n\tparams[\"walletID\"] = walletID\n\n\tif symbol != \"\" {\n\t\tparams[\"instrument\"] = symbol\n\t}\n\tif status != \"\" {\n\t\tparams[\"status\"] = status\n\t}\n\tif page > 0 {\n\t\tparams[\"page\"] = strconv.FormatInt(page, 10)\n\t}\n\tif perPage > 0 {\n\t\tparams[\"perPage\"] = strconv.FormatInt(perPage, 10)\n\t}\n\n\treturn resp, i.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodGet, itbitOrders, params, &resp)\n}", "title": "" }, { "docid": "155008d2e2a17fa11965c365585f144c", "score": "0.6017945", "text": "func (n *NiceHash) GetOrders() Orders {\n\tv := n.getAuthValues()\n\tv.Set(\"method\", \"orders.get\")\n\tv.Set(\"location\", \"1\")\n\tv.Set(\"algo\", \"1\")\n\tv.Set(\"my\", \"\")\n\n\tr := Send(v)\n\n\tresp := Response{}\n\tdec := json.NewDecoder(r.Body)\n\tdec.Decode(&resp)\n\n\treturn resp.Result.Orders\n}", "title": "" }, { "docid": "e67f53ea7e4dc3a4bebee5167b221c2d", "score": "0.6010954", "text": "func GetCustomersOrders(w http.ResponseWriter, r *http.Request) {\n\tparam := mux.Vars(r)\n\n\ttoken, err := r.Cookie(\"token\")\n\tif err != nil {\n\t\tif err == http.ErrNoCookie {\n\t\t\tw.Header().Set(\"content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t_, _ = w.Write([]byte(err.Error()))\n\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t_, _ = w.Write([]byte(err.Error()))\n\n\t\treturn\n\t}\n\n\t_, _, _, err = jwtToken.AuthenticationJwtToken(token.Value)\n\tif err != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t_, _ = w.Write([]byte(err.Error()))\n\n\t\treturn\n\t}\n\n\tordersInformation, err := orders.GetCustomersOrders(param[\"customer_id\"])\n\tif err != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t_, _ = w.Write([]byte(err.Error()))\n\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\t_ = json.NewEncoder(w).Encode(ordersInformation)\n\n\treturn\n}", "title": "" }, { "docid": "bd6e8389aaf60013f0fbd9f3fe53eba9", "score": "0.6010381", "text": "func GetOrders(symbol string, key string, skey string, baseURL string) (res bool, count int) {\r\n\tb := rest.New(nil, baseURL, key, skey, false)\r\n\torders, err := b.GetOrders(\"\", \"\", 1, 20, \"New\", symbol)\r\n\tif err != nil {\r\n\t\tlog.Printf(\"%v\", err)\r\n\t\treturn\r\n\t}\r\n\tfor i := 0; i < len(orders); i++ {\r\n\t\tif orders[i].OrderStatus == \"New\" {\r\n\t\t\tcount++\r\n\t\t}\r\n\t}\r\n\tif count > 0 {\r\n\t\treturn true, count\r\n\t}\r\n\treturn false, count\r\n}", "title": "" }, { "docid": "586e1024a7de2dfccbc72ce79169f421", "score": "0.60011894", "text": "func (client ManagementClient) GetOrderByIDResponder(resp *http.Response) (result Order, err error) {\n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusNotFound,http.StatusOK,http.StatusBadRequest),\n autorest.ByUnmarshallingJSON(&result),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n }", "title": "" }, { "docid": "8e340e6eda841b9c1bebc76af4e51570", "score": "0.59809023", "text": "func (c *Client) ListOrders(qp QueryParams) ([]Order, error) {\n\ttimestamp := unixTime()\n\tmethod := http.MethodGet\n\tpath := \"/orders\"\n\n\treq, sig, err := c.createAndSignRequest(timestamp, method, path, noBody, &qp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.listOrders(timestamp, sig, req)\n}", "title": "" }, { "docid": "9141edc6c6a30c26d781ca547f4d5c45", "score": "0.59594625", "text": "func RestAPIOrdersV1(dg *dgo.Dgraph) func(app iris.Party) {\n\tc := &Controller{}\n\tc.os = NewOrderService(dg)\n\treturn func(app iris.Party) {\n\t\tc.api = app\n\t\tc.registerRoutes()\n\t}\n}", "title": "" }, { "docid": "b3c9460862c53a4649051ad923c0b165", "score": "0.5954457", "text": "func GetRecentOrders(userToken string, locationID int) (response []Order) {\n\treq, _ := http.NewRequest(\"GET\", BaseURL+\"/api/order/recents/\"+strconv.Itoa(locationID), nil)\n\n\treq.Header.Add(\"content-type\", \"application/json\")\n\treq.Header.Add(\"cookie\", userToken)\n\n\tres, err := http.DefaultClient.Do(req)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdefer res.Body.Close()\n\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\trecentOrders := make([]Order, 0)\n\tjson.Unmarshal(body, &recentOrders)\n\n\treturn recentOrders\n\n}", "title": "" }, { "docid": "1caeebf882fe027110b2c5fef70d2d0b", "score": "0.58993053", "text": "func (client *Client) OrdersList(project_id string, page, perPage int, params *OrdersListParams) ([]*TranslationOrder, error) {\n\tretVal := []*TranslationOrder{}\n\terr := func() error {\n\n\t\turl := fmt.Sprintf(\"/v2/projects/%s/orders\", url.QueryEscape(project_id))\n\n\t\trc, err := client.sendGetRequestPaginated(url, params.QueryParams(), 200, page, perPage)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer rc.Close()\n\n\t\tvar reader io.Reader\n\t\tif client.debug {\n\t\t\treader = io.TeeReader(rc, os.Stderr)\n\t\t} else {\n\t\t\treader = rc\n\t\t}\n\n\t\treturn json.NewDecoder(reader).Decode(&retVal)\n\n\t}()\n\treturn retVal, err\n}", "title": "" }, { "docid": "795302aeb8b29f47cba771ab325e307f", "score": "0.58579785", "text": "func (h *Handler) GetOrdersByAccount(w http.ResponseWriter, r *http.Request) {\n\tacc, err := acme.AccountFromContext(r.Context())\n\tif err != nil {\n\t\tapi.WriteError(w, err)\n\t\treturn\n\t}\n\taccID := chi.URLParam(r, \"accID\")\n\tif acc.ID != accID {\n\t\tapi.WriteError(w, acme.UnauthorizedErr(errors.New(\"account ID does not match url param\")))\n\t\treturn\n\t}\n\torders, err := h.Auth.GetOrdersByAccount(r.Context(), acc.GetID())\n\tif err != nil {\n\t\tapi.WriteError(w, err)\n\t\treturn\n\t}\n\tapi.JSON(w, orders)\n\tlogOrdersByAccount(w, orders)\n}", "title": "" }, { "docid": "526ce2803591c4e1b94df7fe4ef90dcf", "score": "0.583605", "text": "func (app *App) GetOrders(page, perPage int, snapshotID string) (*rpc.GetOrdersResponse, error) {\n\tordersInfos := []*rpc.OrderInfo{}\n\tif perPage <= 0 {\n\t\treturn &rpc.GetOrdersResponse{\n\t\t\tOrdersInfos: ordersInfos,\n\t\t\tSnapshotID: snapshotID,\n\t\t}, nil\n\t}\n\n\tvar snapshot *db.Snapshot\n\tif snapshotID == \"\" {\n\t\t// Create a new snapshot\n\t\tsnapshotID = uuid.New().String()\n\t\tvar err error\n\t\tsnapshot, err = app.db.Orders.GetSnapshot()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\texpirationTimestamp := time.Now().Add(1 * time.Minute)\n\t\tapp.snapshotExpirationWatcher.Add(expirationTimestamp, snapshotID)\n\t\tapp.muIdToSnapshotInfo.Lock()\n\t\tapp.idToSnapshotInfo[snapshotID] = snapshotInfo{\n\t\t\tSnapshot: snapshot,\n\t\t\tExpirationTimestamp: expirationTimestamp,\n\t\t}\n\t\tapp.muIdToSnapshotInfo.Unlock()\n\t} else {\n\t\t// Try and find an existing snapshot\n\t\tapp.muIdToSnapshotInfo.Lock()\n\t\tinfo, ok := app.idToSnapshotInfo[snapshotID]\n\t\tif !ok {\n\t\t\tapp.muIdToSnapshotInfo.Unlock()\n\t\t\treturn nil, ErrSnapshotNotFound{id: snapshotID}\n\t\t}\n\t\tsnapshot = info.Snapshot\n\t\t// Reset the snapshot's expiry\n\t\tapp.snapshotExpirationWatcher.Remove(info.ExpirationTimestamp, snapshotID)\n\t\texpirationTimestamp := time.Now().Add(1 * time.Minute)\n\t\tapp.snapshotExpirationWatcher.Add(expirationTimestamp, snapshotID)\n\t\tapp.idToSnapshotInfo[snapshotID] = snapshotInfo{\n\t\t\tSnapshot: snapshot,\n\t\t\tExpirationTimestamp: expirationTimestamp,\n\t\t}\n\t\tapp.muIdToSnapshotInfo.Unlock()\n\t}\n\n\tnotRemovedFilter := app.db.Orders.IsRemovedIndex.ValueFilter([]byte{0})\n\tvar selectedOrders []*meshdb.Order\n\terr := snapshot.NewQuery(notRemovedFilter).Offset(page * perPage).Max(perPage).Run(&selectedOrders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, order := range selectedOrders {\n\t\tordersInfos = append(ordersInfos, &rpc.OrderInfo{\n\t\t\tOrderHash: order.Hash,\n\t\t\tSignedOrder: order.SignedOrder,\n\t\t\tFillableTakerAssetAmount: order.FillableTakerAssetAmount,\n\t\t})\n\t}\n\n\tgetOrdersResponse := &rpc.GetOrdersResponse{\n\t\tSnapshotID: snapshotID,\n\t\tOrdersInfos: ordersInfos,\n\t}\n\n\treturn getOrdersResponse, nil\n}", "title": "" }, { "docid": "91bce3e6d62ba7b959abc7f8ac753e1e", "score": "0.5831175", "text": "func (e *BIBOX) GetOrders(stockType string) interface{} {\n\tordersBid := e.getOrders(1, stockType).([]Order)\n\tordersAsk := e.getOrders(2, stockType).([]Order)\n\torders := append(ordersBid, ordersAsk...)\n\n\tfmt.Println(\"GetOrders orders: \", orders)\n\n\treturn orders\n}", "title": "" }, { "docid": "ec35a0b1511773185cdd70f941481230", "score": "0.5825034", "text": "func (c *CoinbasePro) GetOrders(ctx context.Context, status []string, currencyPair string) ([]GeneralizedOrderResponse, error) {\n\tvar resp []GeneralizedOrderResponse\n\tparams := url.Values{}\n\n\tfor _, individualStatus := range status {\n\t\tparams.Add(\"status\", individualStatus)\n\t}\n\tif currencyPair != \"\" {\n\t\tparams.Set(\"product_id\", currencyPair)\n\t}\n\n\tpath := common.EncodeURLValues(coinbaseproOrders, params)\n\treturn resp,\n\t\tc.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodGet, path, nil, &resp)\n}", "title": "" }, { "docid": "dbaafb66be3d3a949b5e2cf641e52999", "score": "0.5808504", "text": "func List(params *stripe.OrderListParams) *Iter {\n\treturn getC().List(params)\n}", "title": "" }, { "docid": "d5238dd775db1efcc4039b894b40b3dd", "score": "0.579234", "text": "func (e *Example) GetUserOrder(ctx context.Context, req *example.Request, rsp *example.Response) error {\n\tfmt.Println(\"获取房东/租户订单信息服务\tGET\tapi/v1.0/user/orders\tGetUserOrder\")\n\n\t//初始化返回值\n\trsp.Errno = utils.RECODE_OK\n\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\n\t//查询用户id\n\tsessionid := req.Sessionid\n\t//拼接key\n\tkey := sessionid + \"user_id\"\n\n\t//链接redis\n\tbm, err := utils.RedisOpen(utils.G_server_name, utils.G_redis_addr, utils.G_redis_port, utils.G_redis_dbnum)\n\tif err != nil {\n\t\tfmt.Println(\"链接redis错误,err:\", err)\n\t\trsp.Errno = utils.RECODE_DBERR\n\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\treturn nil\n\t}\n\n\t//查询用户id\n\tvalue_id := bm.Get(key)\n\tuserid, _ := redis.Int(value_id, nil)\n\tfmt.Println(\"userid :\", userid)\n\n\t//获取角色\n\trole := req.Role\n\tfmt.Println(\"Role :\", role)\n\n\t//链接mysql数据库查询信息,根据角色的不同,查询的方式也不同\n\to := orm.NewOrm()\n\t//创建容器,承载数据\n\torders := []models.OrderHouse{}\n\n\t//判断角色信息\n\tif role == \"landlord\" {\n\t\t/*角色为房东,查询自己已经发布的房屋的订单信息*/\n\t\t//通过userid获取自己房屋的id\n\t\tlandLordHouses := []models.House{}\n\n\t\t_, err := o.QueryTable(\"House\").Filter(\"User__Id\", userid).All(&landLordHouses)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"查询房东订单信息错误,err:\", err)\n\t\t\trsp.Errno = utils.RECODE_DBERR\n\t\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\t\treturn nil\n\t\t}\n\n\t\t//获取所有的房屋的房屋id,用于进行订单的查询\n\t\thouseids := []int{}\n\t\tfor _, house := range landLordHouses {\n\t\t\thouseids = append(houseids, house.Id)\n\t\t}\n\n\t\t//最后一步在订单表中查询房屋id为以上id的订单信息\n\t\to.QueryTable(\"OrderHouse\").Filter(\"House__Id__in\", houseids).OrderBy(\"Ctime\").All(&orders)\n\n\t\tfmt.Println(\"查询房东订单信息结束\")\n\t} else {\n\t\t/*角色为租客,查询已经下过的订单*/\n\t\t//通过用户id直接查订单即可\n\t\t_, err := o.QueryTable(\"OrderHouse\").Filter(\"User__Id\", userid).OrderBy(\"Ctime\").All(&orders)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"查询租客订单信息错误,err:\", err)\n\t\t\trsp.Errno = utils.RECODE_DBERR\n\t\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t//定义返回前端数据容器\n\torder_list := []interface{}{}\n\n\t//循环orders,将数据装进order_list中\n\tfor _, order := range orders {\n\t\t//先关联查询\n\t\to.LoadRelated(&order, \"User\")\n\t\to.LoadRelated(&order, \"House\")\n\t\t//追加进入切片中\n\t\torder_list = append(order_list, order)\n\t}\n\n\t//将数据进行json数据转换\n\tdata, err := json.Marshal(order_list)\n\tif err != nil {\n\t\tfmt.Println(\"json数据转换错误,err:\", err)\n\t\trsp.Errno = utils.RECODE_IOERR\n\t\trsp.Errmsg = utils.RecodeText(rsp.Errno)\n\t\treturn nil\n\t}\n\n\t//将数据返回web\n\trsp.Data = data\n\n\treturn nil\n}", "title": "" }, { "docid": "0fa3f6f382b7bd28a70b9ebd7388d51c", "score": "0.5776123", "text": "func GetCustomersOrder(w http.ResponseWriter, r *http.Request) {\n\tparam := mux.Vars(r)\n\n\ttoken, err := r.Cookie(\"token\")\n\tif err != nil {\n\t\tif err == http.ErrNoCookie {\n\t\t\tw.Header().Set(\"content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t_, _ = w.Write([]byte(err.Error()))\n\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t_, _ = w.Write([]byte(err.Error()))\n\n\t\treturn\n\t}\n\n\t_, _, _, err = jwtToken.AuthenticationJwtToken(token.Value)\n\tif err != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t_, _ = w.Write([]byte(err.Error()))\n\n\t\treturn\n\t}\n\n\torderInfo, err := orders.GetCustomersOrder(param[\"order_id\"])\n\tif err != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t_, _ = w.Write([]byte(err.Error()))\n\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\t_ = json.NewEncoder(w).Encode(orderInfo)\n\n\treturn\n}", "title": "" }, { "docid": "acca682a9434bb007db9a4d2affc9d8e", "score": "0.5774384", "text": "func (s *OrderService) All() (*bitfinex.OrderSnapshot, error) {\n\t// use no symbol, this will get all orders\n\treturn s.getActiveOrders(\"\")\n}", "title": "" }, { "docid": "24b96659dd6a5530400de80f9b71a7f7", "score": "0.5758955", "text": "func (a *SpotApiService) ListOrders(ctx context.Context, currencyPair string, status string, localVarOptionals *ListOrdersOpts) ([]Order, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue []Order\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/spot/orders\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tlocalVarQueryParams.Add(\"currency_pair\", parameterToString(currencyPair, \"\"))\n\tlocalVarQueryParams.Add(\"status\", parameterToString(status, \"\"))\n\tif localVarOptionals != nil && localVarOptionals.Page.IsSet() {\n\t\tlocalVarQueryParams.Add(\"page\", parameterToString(localVarOptionals.Page.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Limit.IsSet() {\n\t\tlocalVarQueryParams.Add(\"limit\", parameterToString(localVarOptionals.Limit.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Account.IsSet() {\n\t\tlocalVarQueryParams.Add(\"account\", parameterToString(localVarOptionals.Account.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.From.IsSet() {\n\t\tlocalVarQueryParams.Add(\"from\", parameterToString(localVarOptionals.From.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.To.IsSet() {\n\t\tlocalVarQueryParams.Add(\"to\", parameterToString(localVarOptionals.To.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Side.IsSet() {\n\t\tlocalVarQueryParams.Add(\"side\", parameterToString(localVarOptionals.Side.Value(), \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tif ctx.Value(ContextGateAPIV4) == nil {\n\t\t// for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present\n\t\tctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{\n\t\t\tKey: a.client.cfg.Key,\n\t\t\tSecret: a.client.cfg.Secret,\n\t\t})\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status + \", \" + string(localVarBody),\n\t\t}\n\t\tvar gateErr GateAPIError\n\t\tif e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\")); e == nil && gateErr.Label != \"\" {\n\t\t\tgateErr.APIError = newErr\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, gateErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "8ca44fc7aacb8fe81f19dcff4362dd4d", "score": "0.57316405", "text": "func Orders(exec boil.Executor, mods ...qm.QueryMod) orderQuery {\n\tmods = append(mods, qm.From(\"\\\"order\\\"\"))\n\treturn orderQuery{NewQuery(exec, mods...)}\n}", "title": "" }, { "docid": "4c9fd363a9ce7c33b94544d984f2fe9f", "score": "0.57261956", "text": "func getOrder(apiKey, apiSecret, orderId string) (OrderDetailResponse, error) {\n\tconstruct := url.Values{}\n\tconstruct.Add(\"orderId\", orderId)\n\tmessage := construct.Encode()\n\n\theaders := map[string]string{\n\t\t\"API-Key\": apiKey,\n\t\t\"Sign\": createSignature(message, apiSecret),\n\t}\n\n\tpath := fmt.Sprintf(\"%s/exchange/order?%s\", LiveCoinAPIURL, message)\n\tlog.Print(\"-- \", path)\n\tdata := OrderDetailResponse{}\n\treturn data, sendPayload(\"GET\", path, headers, nil, &data)\n}", "title": "" }, { "docid": "8bbd4dc32c5d65117e5ec80c07894ac3", "score": "0.5723261", "text": "func (api *Kraken) QueryOrders(needTrades bool, userRef string, txIDs ...string) (map[string]OrderInfo, error) {\n\tdata := url.Values{}\n\tif needTrades {\n\t\tdata.Set(\"trades\", \"true\")\n\t}\n\tif userRef != \"\" {\n\t\tdata.Set(\"userref\", userRef)\n\t}\n\n\tswitch {\n\tcase len(txIDs) > 50:\n\t\treturn nil, errors.New(\"maximum count of requested orders is 50\")\n\tcase len(txIDs) == 0:\n\t\treturn nil, errors.New(\"txIDs is required\")\n\tdefault:\n\t\tdata.Set(\"txid\", strings.Join(txIDs, \",\"))\n\t}\n\n\tresponse := make(map[string]OrderInfo)\n\tif err := api.request(\"QueryOrders\", true, data, &response); err != nil {\n\t\treturn nil, err\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "964b5e7063861b4dcb7453bcd0a7d3bd", "score": "0.5721627", "text": "func (a *SpotApiService) ListAllOpenOrders(ctx context.Context, localVarOptionals *ListAllOpenOrdersOpts) ([]OpenOrders, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue []OpenOrders\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/spot/open_orders\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.Page.IsSet() {\n\t\tlocalVarQueryParams.Add(\"page\", parameterToString(localVarOptionals.Page.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Limit.IsSet() {\n\t\tlocalVarQueryParams.Add(\"limit\", parameterToString(localVarOptionals.Limit.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Account.IsSet() {\n\t\tlocalVarQueryParams.Add(\"account\", parameterToString(localVarOptionals.Account.Value(), \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tif ctx.Value(ContextGateAPIV4) == nil {\n\t\t// for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present\n\t\tctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{\n\t\t\tKey: a.client.cfg.Key,\n\t\t\tSecret: a.client.cfg.Secret,\n\t\t})\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status + \", \" + string(localVarBody),\n\t\t}\n\t\tvar gateErr GateAPIError\n\t\tif e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\")); e == nil && gateErr.Label != \"\" {\n\t\t\tgateErr.APIError = newErr\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, gateErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "6e8b835f7674efb1cb771acaabe5300f", "score": "0.57104105", "text": "func FetchOrdersByuserID(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\to, err := dao.FetchOrdersByuserID(params[\"id\"])\n\tif err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, \"Invalid user ID\")\n\t\treturn\n\t}\n\trespondWithJson(w, http.StatusOK, o)\n}", "title": "" }, { "docid": "f0dbcc903d4cfd7dc1990241a05eb579", "score": "0.5701127", "text": "func (gandalf *Gandalf) GetUserOrders(userID string) ([]OrderModel, error) {\n\tvar orders []OrderModel\n\tdbc := gandalf.Db.Where(\"user_id = ?\", userID).Order(\"created_date DESC\").Find(&orders)\n\tif dbc.Error != nil {\n\t\treturn orders, NewGandalfError(KGandalfBackendError, dbc.Error.Error())\n\t}\n\treturn orders, nil\n}", "title": "" }, { "docid": "a11e4186f70b3c56cb9c0226530b222a", "score": "0.5693906", "text": "func GetOrder(c *gin.Context) {\n\tdb := c.MustGet(\"db\").(*gorm.DB)\n\tvar order []model.Order\n\tdb.Find(&order)\n\n\tc.JSON(http.StatusOK, gin.H{\"data\": order})\n}", "title": "" }, { "docid": "777ca568e0b8513abb636fdcd02096f0", "score": "0.56929785", "text": "func (s *mockStore) GetOrders() ([]Order, error) {\n\torders := make([]Order, 0, len(s.orders))\n\tfor _, o := range s.orders {\n\t\torders = append(orders, o)\n\t}\n\treturn orders, nil\n}", "title": "" }, { "docid": "23cff9d6cd6cb5ec7b91bc6e39510389", "score": "0.56807095", "text": "func (api *orderAPI) List(ctx context.Context, opts *api.ListWatchOptions) ([]*Order, error) {\n\tvar objlist []*Order\n\tobjs, err := api.ct.List(\"Order\", ctx, opts)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, obj := range objs {\n\t\tswitch tp := obj.(type) {\n\t\tcase *Order:\n\t\t\teobj := obj.(*Order)\n\t\t\tobjlist = append(objlist, eobj)\n\t\tdefault:\n\t\t\tlog.Fatalf(\"Got invalid object type %v while looking for Order\", tp)\n\t\t}\n\t}\n\n\treturn objlist, nil\n}", "title": "" }, { "docid": "b79ed71020dd81c30f812a8bdb62b3c5", "score": "0.567792", "text": "func (c *Client) Order(id int64) (Order, error) {\n\n\tvar req request\n\n\treq.Query = `\n\t\tquery GetOrder($id: Int!) {\n \t\t\torder(id: $id) {\n\t\t\t\tid\n \t\t\tstatus\n\t\t\t\tdealStock\n\t\t\t\tdealMoney\n\t\t\t\tamount\n\t\t\t\tprice\n \t\t\t}\n\t\t}\n\t`\n\n\treq.Variables = orderRequestVariables{id}\n\n\tresp := struct {\n\t\tresponseBase\n\t\tData struct {\n\t\t\tOrder Order\n\t\t}\n\t}{}\n\n\trespJSON, err := c.do(true, req)\n\tif err != nil {\n\t\treturn Order{}, errors.New(\"failed to do request: \" + err.\n\t\t\tError())\n\t}\n\n\tif err := json.Unmarshal(respJSON, &resp); err != nil {\n\t\treturn Order{}, errors.New(\"failed to json.Unmarshal resp: \" +\n\t\t\terr.Error())\n\t}\n\n\tif err := resp.Error(); err != nil {\n\t\treturn Order{}, errors.New(\"exchange error: \" + err.Error())\n\t}\n\n\treturn resp.Data.Order, nil\n}", "title": "" }, { "docid": "6de5beb412e8da50ec8016acfaac7358", "score": "0.5677865", "text": "func (c Client) List(listParams *stripe.OrderListParams) *Iter {\n\treturn &Iter{\n\t\tIter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) {\n\t\t\tlist := &stripe.OrderList{}\n\t\t\terr := c.B.CallRaw(http.MethodGet, \"/v1/orders\", c.Key, b, p, list)\n\n\t\t\tret := make([]interface{}, len(list.Data))\n\t\t\tfor i, v := range list.Data {\n\t\t\t\tret[i] = v\n\t\t\t}\n\n\t\t\treturn ret, list, err\n\t\t}),\n\t}\n}", "title": "" }, { "docid": "16f66bc16958497d27e0f5c288ef793f", "score": "0.5670588", "text": "func ObtenerArticulos(c *gin.Context) {\n\tvar artic []articulos.Articulo\n\n\tdatabase.DB.Order(\"articulo_id\").Find(&artic)\n\n\tc.Header(\"Access-Control-Allow-Origin\", \"*\")\n\n\tc.SecureJSON(http.StatusOK, gin.H{\"data\": artic})\n}", "title": "" }, { "docid": "adecc6e30d2b368181eb7f00be50dbc0", "score": "0.5667096", "text": "func (e *BIBOX) GetOrder(stockType, id string) interface{} {\n\tidInt, err := strconv.ParseInt(id, 10, 64)\n\tparam := OrderRequest{\n\t\tCmd: \"orderpending/order\",\n\t\tBody: OrderRequestBody{\n\t\t\tID: idInt,\n\t\t},\n\t}\n\tparams := []OrderRequest{}\n\tparams = append(params, param)\n\tcmds, _ := json.Marshal(&params)\n\n\tforms := []string{}\n\tcmdsItem := \"cmds=\" + string(cmds)\n\tkeyItem := \"apikey=\" + e.option.AccessKey\n\tsignItem := \"sign=\" + e.getSign(string(cmds))\n\tforms = append(forms, cmdsItem)\n\tforms = append(forms, keyItem)\n\tforms = append(forms, signItem)\n\n\tresp, err := post(e.host+\"orderpending\", forms)\n\tif err != nil {\n\t\te.logger.Log(constant.ERROR, \"\", 0.0, 0.0, \"GetOrder() error, \", err)\n\t\treturn false\n\t}\n\n\tfmt.Println(\"GetOrder resp: \", string(resp))\n\t/// get result:\n\tjsonResp, err := simplejson.NewJson(resp)\n\tif err != nil {\n\t\te.logger.Log(constant.ERROR, \"\", 0.0, 0.0, \"GetOrder() error, \", err)\n\t\treturn false\n\t}\n\n\tif result := jsonResp.Get(\"error\").Interface(); result != nil {\n\t\te.logger.Log(constant.ERROR, \"\", 0.0, 0.0, \"GetOrder() error, the error message => \", jsonResp.Get(\"error\").Get(\"msg\").MustString())\n\t\treturn false\n\t}\n\n\tjsons := jsonResp.Get(\"result\").GetIndex(0)\n\torderJSON := jsons.Get(\"result\")\n\torderID := orderJSON.Get(\"id\").MustInt64()\n\tprice := conver.Float64Must(orderJSON.Get(\"price\").Interface())\n\tamount := conver.Float64Must(orderJSON.Get(\"amount\").Interface())\n\tdealAmount := conver.Float64Must(orderJSON.Get(\"deal_amount\").Interface())\n\ttradeType := e.orderSideMap[orderJSON.Get(\"order_side\").MustInt64()]\n\tsymbol := orderJSON.Get(\"pair\").MustString()\n\n\treturn Order{\n\t\tID: fmt.Sprint(orderID),\n\t\tPrice: price,\n\t\tAmount: amount,\n\t\tDealAmount: dealAmount,\n\t\tTradeType: tradeType,\n\t\tStockType: symbol,\n\t}\n}", "title": "" }, { "docid": "de52823ffd52be7b7017dc521721ff70", "score": "0.56619656", "text": "func GetAllOrdersOfSpecificShop(w http.ResponseWriter, r *http.Request) {\n\tparam := mux.Vars(r)\n\n\ttoken, err := r.Cookie(\"token\")\n\tif err != nil {\n\t\tif err == http.ErrNoCookie {\n\t\t\tw.Header().Set(\"content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t_, _ = w.Write([]byte(err.Error()))\n\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t_, _ = w.Write([]byte(err.Error()))\n\n\t\treturn\n\t}\n\n\t_, _, _, err = jwtToken.AuthenticationJwtToken(token.Value)\n\tif err != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t_, _ = w.Write([]byte(err.Error()))\n\n\t\treturn\n\t}\n\n\tordersInformation, err := orders.GetAllOrdersOfSpecificShop(param[\"shop_id\"])\n\tif err != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t_, _ = w.Write([]byte(err.Error()))\n\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\t_ = json.NewEncoder(w).Encode(ordersInformation)\n\n\treturn\n}", "title": "" }, { "docid": "bd15598f9e4e2f230cd02bb816e0a1aa", "score": "0.56603426", "text": "func (c *Client) AllOrders() ([]entities.Order, error) {\n\tvar orders []entities.Order\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tcursor, err := c.mongoClient.Database(orderDB).Collection(orderCol).Find(ctx, bson.M{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = cursor.All(ctx, &orders)\n\n\treturn orders, err\n}", "title": "" }, { "docid": "bcea547e9f7b841774ae5b3770f646e4", "score": "0.56057394", "text": "func (orderRepo *OrderMockGormRepo) Orders() ([]entity.Order, []error) {\n\torders := []entity.Order{}\n\terrs := orderRepo.conn.Find(&orders).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn orders, errs\n}", "title": "" }, { "docid": "d82d9f58817e84ae282d982c58e2b594", "score": "0.560008", "text": "func TestWsGetOrderList(t *testing.T) {\n\tsetupWsTests(t)\n\tresp, err := h.wsGetOrdersList(1, currency.NewPairFromString(\"ethbtc\"))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif resp.ErrorCode > 0 {\n\t\tt.Error(resp.ErrorMessage)\n\t}\n}", "title": "" }, { "docid": "917ca54aceb51c50cffb6a6a23b41174", "score": "0.5591147", "text": "func (service *ActivityService) ListOrderItems(c *gin.Context) {\n\tuserID, err := strconv.Atoi(c.Param(\"id\"))\n\tif err != nil {\n\t\terrorJSON(c, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tvar orderItems []OrderItem\n\tif err := service.DB.ListOrderItems(&orderItems, userID); err != nil {\n\t\terrorJSON(c, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, orderItems)\n}", "title": "" }, { "docid": "b42df1ecf2efdae3397c5e15e2c2c04c", "score": "0.557587", "text": "func (ar *arangorepository) ListOrders(\n\tpls *order.ListParameters,\n) ([]*model.OrderDoc, error) {\n\tvar odr []*model.OrderDoc\n\tvar stmt string\n\tif len(pls.Filter) > 0 {\n\t\tstmt = ar.stmtWithFilter(pls)\n\t} else {\n\t\tstmt = ar.stmtWithOutFilter(pls)\n\t}\n\trsd, err := ar.database.Search(stmt)\n\tif err != nil {\n\t\treturn odr, fmt.Errorf(\"error in database searching %s\", err)\n\t}\n\tif rsd.IsEmpty() {\n\t\treturn odr, nil\n\t}\n\tfor rsd.Scan() {\n\t\tm := &model.OrderDoc{}\n\t\tif err := rsd.Read(m); err != nil {\n\t\t\treturn odr, fmt.Errorf(\"error in binding struct %s\", err)\n\t\t}\n\t\todr = append(odr, m)\n\t}\n\n\treturn odr, nil\n}", "title": "" }, { "docid": "edf96542165a99cac800d5463b613bab", "score": "0.5566891", "text": "func (p *websocketAPI) GetCallOrders(assetID types.GrapheneObject, limit int) (types.CallOrders, error) {\n\tif limit > GetCallOrdersLimit {\n\t\tlimit = GetCallOrdersLimit\n\t}\n\n\tresp, err := p.wsClient.CallAPI(0, \"get_call_orders\", assetID.ID(), limit)\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"CallAPI\")\n\t}\n\n\tlogging.DDumpJSON(\"get_call_orders <\", resp)\n\n\tret := types.CallOrders{}\n\tif err := ffjson.Unmarshal(*resp, &ret); err != nil {\n\t\treturn nil, errors.Annotate(err, \"Unmarshal [CallOrders]\")\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "b0e61f3e17234f5ba2d06065359dc57c", "score": "0.55652726", "text": "func (r *OrdersService) GetOrdersByQuery(accountID string) *OrdersGetOrdersByQueryCall {\n\tc := &OrdersGetOrdersByQueryCall{\n\t\tDefaultCall: DefaultCall{\n\t\t\ts: r.s,\n\t\t\turlParams: url.Values{},\n\t\t},\n\t}\n\tc.urlParams.Set(\"accountId\", accountID)\n\treturn c\n}", "title": "" }, { "docid": "5cd664fd764a94198ed232907fc520d6", "score": "0.5562277", "text": "func (suite *MainTestSuite) TestListOrders() {\n\treq, _ := http.NewRequest(\"GET\", \"/orders?page=1&limit=10\", nil)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tsuite.Router.ServeHTTP(suite.W, req)\n\n\tsuite.Equal(http.StatusOK, suite.W.Code)\n}", "title": "" }, { "docid": "06211235db5c4d25cc6430e062b90745", "score": "0.55526793", "text": "func (api *Kraken) GetOpenOrders(needTrades bool, userRef string) (OpenOrdersResponse, error) {\n\tdata := url.Values{}\n\tif needTrades {\n\t\tdata.Set(\"trades\", \"true\")\n\t}\n\tif userRef != \"\" {\n\t\tdata.Set(\"userref\", userRef)\n\t}\n\n\tresponse := OpenOrdersResponse{}\n\tif err := api.request(\"OpenOrders\", true, data, &response); err != nil {\n\t\treturn response, err\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "4843b122802dfc53ec5d45edab9007d5", "score": "0.5546302", "text": "func (c *Client) ListOrders(ctx context.Context, p *OrderQueryParams) (*ListOrdersResp, error) {\n\n\tresp := &ListOrdersResp{}\n\n\tvar vals url.Values\n\tif p != nil {\n\t\tvals = p.toValues()\n\t}\n\n\terr := c.request(ctx, \"GET\", \"orders\", nil, vals, resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "12420eb141dba4013472f16c7cc5f5e1", "score": "0.5536647", "text": "func GetClientes(w http.ResponseWriter, r *http.Request) {\n\n\terr := util.ValidarPermissaoAcesso(r)\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\tpagina := r.FormValue(\"pagina\")\n\tnumeroRegistros := r.FormValue(\"limit\")\n\tlistaClientes := modelo.ObterTodosClientes(pagina, numeroRegistros)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(listaClientes)\n}", "title": "" }, { "docid": "53d422ba1484d4a026ae0c9b1309d994", "score": "0.5531396", "text": "func GetOrderProducts(writer http.ResponseWriter, request *http.Request) {\n\tdb := database.DBCon\n\trepository := model.Repository{Conn: db}\n\n\tmuxVars := mux.Vars(request)\n\tID, err := strconv.ParseInt(muxVars[\"id\"], 10, 64)\n\tif err != nil {\n\t\tlog.Printf(\"could not parse string to int: %v\", err)\n\t\thelper.WriteJSONError(writer, http.StatusBadRequest, \"could not parse url\")\n\t\treturn\n\t}\n\n\tproducts, err := repository.GetOrderItems(ID)\n\tif err != nil {\n\t\tlog.Printf(\"could not get items from order with id: %d, %v\", ID, err)\n\t\thelper.WriteJSONError(writer, http.StatusInternalServerError, \"could not get items from order\")\n\t\treturn\n\t}\n\tif products == nil {\n\t\thelper.WriteJSON(writer, http.StatusNotFound, \"no order with this id\")\n\t\treturn\n\t}\n\n\thelper.WriteJSON(writer, http.StatusOK, products)\n}", "title": "" }, { "docid": "a00f6aa244bf440fccfa1436ab32fe79", "score": "0.55165875", "text": "func (a OrdersApi) FindOrders(page float32) (*Orders, *APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Get\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/orders/\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := make(map[string]string)\n\tvar localVarPostBody interface{}\n\tvar localVarFileName string\n\tvar localVarFileBytes []byte\n\t// authentication '(api_key)' required\n\t// set key with prefix in header\n\tlocalVarHeaderParams[\"authorization\"] = a.Configuration.GetAPIKeyWithPrefix(\"authorization\")\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\tlocalVarHeaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\tlocalVarQueryParams.Add(\"page\", a.Configuration.APIClient.ParameterToString(page, \"\"))\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tvar successPayload = new(Orders)\n\tlocalVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\n\tvar localVarURL, _ = url.Parse(localVarPath)\n\tlocalVarURL.RawQuery = localVarQueryParams.Encode()\n\tvar localVarAPIResponse = &APIResponse{Operation: \"FindOrders\", Method: localVarHttpMethod, RequestURL: localVarURL.String()}\n\tif localVarHttpResponse != nil {\n\t\tlocalVarAPIResponse.Response = localVarHttpResponse.RawResponse\n\t\tlocalVarAPIResponse.Payload = localVarHttpResponse.Body()\n\t}\n\n\tif err != nil {\n\t\treturn successPayload, localVarAPIResponse, err\n\t}\n\terr = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)\n\treturn successPayload, localVarAPIResponse, err\n}", "title": "" }, { "docid": "1c66d95b7d48e3421be983686483c106", "score": "0.5513821", "text": "func (cl *Client) ListOrders(ctx context.Context, req *ListOrdersRequest) (*ListOrdersResponse, error) {\n\tvar res ListOrdersResponse\n\terr := cl.do(ctx, \"GET\", \"/api/1/listorders\", req, &res, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &res, nil\n}", "title": "" }, { "docid": "639666ae7d0deeb5259a6f0401679906", "score": "0.5512464", "text": "func GetAllClientes(id int) ([]models.Factura, error) {\n\n\tfacturas := make([]models.Factura, 0)\n\tquery := \"SELECT c.id_factura, id_caja, id_empleado, fecha, precio, comentarioBaja, descuento, formaDePago FROM factura f INNER JOIN Cliente c ON f.id_factura = c.id_factura WHERE id_caja = $1\"\n\tdb := getConnection()\n\tdefer db.Close()\n\n\tstmt, err := db.Prepare(query)\n\tif err != nil {\n\t\treturn facturas, err\n\t}\n\n\trows, err := stmt.Query(id)\n\tif err != nil {\n\t\treturn facturas, err\n\t}\n\n\tfor rows.Next() {\n\t\tvar row models.Factura\n\t\terr := rows.Scan(&row.Id_factura, &row.Id_caja, &row.Id_empleado, &row.Fecha, &row.Precio, &row.ComentarioBaja, &row.Descuento, &row.FormaDePago)\n\t\tif err != nil {\n\t\t\treturn facturas, err\n\t\t}\n\n\t\trow.Renglones, err = GetAll(row.Id_factura)\n\t\tif err != nil {\n\t\t\treturn facturas, err\n\t\t}\n\t\tfacturas = append(facturas, row)\n\t}\n\n\treturn facturas, nil\n}", "title": "" }, { "docid": "8924c811060a738cd6ff379fd053e4fe", "score": "0.5506564", "text": "func (r *DatabaseRepository) GetOpenOrders() (orders []model.Order) {\n\trows, _ := database.Query(database.SelectOpenOrders)\n\tvar order model.Order\n\tfor rows.Next() {\n\t\t_ = rows.Scan(&order.OrderId, &order.UserId, &order.TableId, &order.TableStatus, &order.OpeningDate, &order.GeneralTotalAmount, &order.ClientId)\n\t\torder.Client = r.GetClient(order.ClientId)\n\t\torders = append(orders, order)\n\t}\n\treturn orders\n}", "title": "" }, { "docid": "b58e8ff454af6cd3761c8fcf5cc76907", "score": "0.55008215", "text": "func (b *BTSE) GetOrders(symbol string) ([]OpenOrder, error) {\n\treq := make(map[string]interface{})\n\tif symbol != \"\" {\n\t\treq[\"symbol\"] = symbol\n\t}\n\tvar o []OpenOrder\n\treturn o, b.SendAuthenticatedHTTPRequest(http.MethodGet, btsePendingOrders, req, &o)\n}", "title": "" }, { "docid": "7e70282b7332a5579486b8d7bc6d690f", "score": "0.5485991", "text": "func (order *Cart) GetDataByRestIDAndState(rest_id string, state string) ([]*Cart, FoulError) {\n\n\tusableID, _ := strconv.Atoi(rest_id)\n\n\tdata, err := getAllOrdersByRestIDAndState(usableID, state)\n\treturn data, err\n}", "title": "" }, { "docid": "1ea1e49fd3a328a8e5abd4add34ef2e2", "score": "0.54846823", "text": "func (s *Service) OrderList(c context.Context, orderID int64, phone int) (res *telecom.SucOrder, msg string, err error) {\n\tif res, err, msg = s.dao.SucOrderList(c, phone); err != nil || res == nil {\n\t\tlog.Error(\"telecom_s.dao.SucOrderList orderID (%v) phone (%v) error (%v)\", orderID, phone, err)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "dc9f6488ff953dac2dce552d9bd6978b", "score": "0.54793864", "text": "func GetAllOrdersOfOwnerShops(w http.ResponseWriter, r *http.Request) {\n\tparam := mux.Vars(r)\n\n\ttoken, err := r.Cookie(\"token\")\n\tif err != nil {\n\t\tif err == http.ErrNoCookie {\n\t\t\tw.Header().Set(\"content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t_, _ = w.Write([]byte(err.Error()))\n\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t_, _ = w.Write([]byte(err.Error()))\n\n\t\treturn\n\t}\n\n\t_, _, _, err = jwtToken.AuthenticationJwtToken(token.Value)\n\tif err != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t_, _ = w.Write([]byte(err.Error()))\n\n\t\treturn\n\t}\n\n\tordersList, err := orders.GetAllOrdersOfOwnerShops(param[\"owner_id\"])\n\tif err != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t_, _ = w.Write([]byte(err.Error()))\n\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\t_ = json.NewEncoder(w).Encode(ordersList)\n\n\treturn\n}", "title": "" }, { "docid": "627854cb2fc8191bcee2ff243ac22dc5", "score": "0.5462166", "text": "func (l *LocalBitcoins) GetActiveOrders(ctx context.Context, getOrdersRequest *order.GetOrdersRequest) ([]order.Detail, error) {\n\tif err := getOrdersRequest.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := l.GetDashboardInfo(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tformat, err := l.GetPairFormat(asset.Spot, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\torders := make([]order.Detail, len(resp))\n\tfor i := range resp {\n\t\tvar orderDate time.Time\n\t\torderDate, err = time.Parse(time.RFC3339, resp[i].Data.CreatedAt)\n\t\tif err != nil {\n\t\t\tlog.Errorf(log.ExchangeSys, \"Exchange %v Func %v Order %v Could not parse date to unix with value of %v\",\n\t\t\t\tl.Name,\n\t\t\t\t\"GetActiveOrders\",\n\t\t\t\tresp[i].Data.Advertisement.ID,\n\t\t\t\tresp[i].Data.CreatedAt)\n\t\t}\n\n\t\tside := order.Buy\n\t\tif resp[i].Data.IsSelling {\n\t\t\tside = order.Sell\n\t\t}\n\n\t\torders[i] = order.Detail{\n\t\t\tAmount: resp[i].Data.AmountBTC,\n\t\t\tPrice: resp[i].Data.Amount,\n\t\t\tOrderID: strconv.FormatInt(resp[i].Data.Advertisement.ID, 10),\n\t\t\tDate: orderDate,\n\t\t\tFee: resp[i].Data.FeeBTC,\n\t\t\tSide: side,\n\t\t\tPair: currency.NewPairWithDelimiter(currency.BTC.String(),\n\t\t\t\tresp[i].Data.Currency,\n\t\t\t\tformat.Delimiter),\n\t\t\tExchange: l.Name,\n\t\t}\n\t}\n\n\terr = order.FilterOrdersByTimeRange(&orders, getOrdersRequest.StartTime,\n\t\tgetOrdersRequest.EndTime)\n\tif err != nil {\n\t\tlog.Errorf(log.ExchangeSys, \"%s %v\", l.Name, err)\n\t}\n\torder.FilterOrdersBySide(&orders, getOrdersRequest.Side)\n\treturn orders, nil\n}", "title": "" }, { "docid": "d6725298debed5e0aef9318801146768", "score": "0.545329", "text": "func (b *Bitstamp) GetOpenOrders(currencyPair string) ([]Order, error) {\n\tvar resp []Order\n\tpath := fmt.Sprintf(\n\t\t\"%s/%s\", bitstampAPIOpenOrders, common.StringToLower(currencyPair),\n\t)\n\n\treturn resp, b.SendAuthenticatedHTTPRequest(path, true, nil, &resp)\n}", "title": "" }, { "docid": "0d663464a5afb4ab397132b2fd03e25f", "score": "0.5440025", "text": "func (r *OrdersService) GetOrdersByPath(accountID string) *OrdersGetOrdersByPathCall {\n\tc := &OrdersGetOrdersByPathCall{\n\t\tDefaultCall: DefaultCall{\n\t\t\ts: r.s,\n\t\t\turlParams: url.Values{},\n\t\t},\n\n\t\taccountID: accountID,\n\t}\n\treturn c\n}", "title": "" }, { "docid": "943264b8641dfb42cc88ea979607e7e7", "score": "0.5438378", "text": "func (o *Orderup) getOrderList(queueName []byte, bucket []byte) (*[]Order, error) {\n\tvar orderList []Order\n\n\terr := o.db.View(func(tx *bolt.Tx) (err error) {\n\t\t// Get bucket with queues.\n\t\tb := tx.Bucket([]byte(QUEUES))\n\n\t\tqueue := b.Bucket(queueName)\n\t\tif queue == nil {\n\t\t\treturn NonExistentQueue(string(queueName))\n\t\t}\n\n\t\torders := queue.Bucket(bucket)\n\t\tc := orders.Cursor()\n\n\t\t// Iterate over all orders, decode and store in the orders list\n\t\tfor k, v := c.First(); k != nil; k, v = c.Next() {\n\t\t\torder := Order{}\n\t\t\tif err := json.Unmarshal(v, &order); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\torderList = append(orderList, order)\n\t\t}\n\n\t\treturn\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &orderList, nil\n}", "title": "" }, { "docid": "e975bc23c621b9fd5c5544afdaaeda0d", "score": "0.54234827", "text": "func (h *HUOBI) GetActiveOrders(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error) {\n\terr := req.Validate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar orders []order.Detail\n\tswitch req.AssetType {\n\tcase asset.Spot:\n\t\tif len(req.Pairs) == 0 {\n\t\t\treturn nil, errors.New(\"currency must be supplied\")\n\t\t}\n\t\tside := \"\"\n\t\tif req.Side == order.Sell {\n\t\t\tside = req.Side.Lower()\n\t\t}\n\t\tif h.Websocket.CanUseAuthenticatedWebsocketForWrapper() {\n\t\t\tfor i := range req.Pairs {\n\t\t\t\tresp, err := h.wsGetOrdersList(ctx, -1, req.Pairs[i])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn orders, err\n\t\t\t\t}\n\t\t\t\tfor j := range resp.Data {\n\t\t\t\t\tsideData := strings.Split(resp.Data[j].OrderState, \"-\")\n\t\t\t\t\tside = sideData[0]\n\t\t\t\t\tvar orderID = strconv.FormatInt(resp.Data[j].OrderID, 10)\n\t\t\t\t\torderSide, err := order.StringToOrderSide(side)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\th.Websocket.DataHandler <- order.ClassificationError{\n\t\t\t\t\t\t\tExchange: h.Name,\n\t\t\t\t\t\t\tOrderID: orderID,\n\t\t\t\t\t\t\tErr: err,\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\torderType, err := order.StringToOrderType(sideData[1])\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\th.Websocket.DataHandler <- order.ClassificationError{\n\t\t\t\t\t\t\tExchange: h.Name,\n\t\t\t\t\t\t\tOrderID: orderID,\n\t\t\t\t\t\t\tErr: err,\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\torderStatus, err := order.StringToOrderStatus(resp.Data[j].OrderState)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\th.Websocket.DataHandler <- order.ClassificationError{\n\t\t\t\t\t\t\tExchange: h.Name,\n\t\t\t\t\t\t\tOrderID: orderID,\n\t\t\t\t\t\t\tErr: err,\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\torders = append(orders, order.Detail{\n\t\t\t\t\t\tExchange: h.Name,\n\t\t\t\t\t\tAccountID: strconv.FormatInt(resp.Data[j].AccountID, 10),\n\t\t\t\t\t\tOrderID: orderID,\n\t\t\t\t\t\tPair: req.Pairs[i],\n\t\t\t\t\t\tType: orderType,\n\t\t\t\t\t\tSide: orderSide,\n\t\t\t\t\t\tDate: time.UnixMilli(resp.Data[j].CreatedAt),\n\t\t\t\t\t\tStatus: orderStatus,\n\t\t\t\t\t\tPrice: resp.Data[j].Price,\n\t\t\t\t\t\tAmount: resp.Data[j].OrderAmount,\n\t\t\t\t\t\tExecutedAmount: resp.Data[j].FilledAmount,\n\t\t\t\t\t\tRemainingAmount: resp.Data[j].UnfilledAmount,\n\t\t\t\t\t\tFee: resp.Data[j].FilledFees,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tcreds, err := h.GetCredentials(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tfor i := range req.Pairs {\n\t\t\t\tresp, err := h.GetOpenOrders(ctx,\n\t\t\t\t\treq.Pairs[i],\n\t\t\t\t\tcreds.ClientID,\n\t\t\t\t\tside,\n\t\t\t\t\t500)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tfor x := range resp {\n\t\t\t\t\torderDetail := order.Detail{\n\t\t\t\t\t\tOrderID: strconv.FormatInt(resp[x].ID, 10),\n\t\t\t\t\t\tPrice: resp[x].Price,\n\t\t\t\t\t\tAmount: resp[x].Amount,\n\t\t\t\t\t\tExecutedAmount: resp[x].FilledAmount,\n\t\t\t\t\t\tRemainingAmount: resp[x].Amount - resp[x].FilledAmount,\n\t\t\t\t\t\tPair: req.Pairs[i],\n\t\t\t\t\t\tExchange: h.Name,\n\t\t\t\t\t\tDate: time.UnixMilli(resp[x].CreatedAt),\n\t\t\t\t\t\tAccountID: strconv.FormatInt(resp[x].AccountID, 10),\n\t\t\t\t\t\tFee: resp[x].FilledFees,\n\t\t\t\t\t}\n\t\t\t\t\tsetOrderSideStatusAndType(resp[x].State, resp[x].Type, &orderDetail)\n\t\t\t\t\torders = append(orders, orderDetail)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase asset.CoinMarginedFutures:\n\t\tfor x := range req.Pairs {\n\t\t\tvar currentPage int64\n\t\t\tfor done := false; !done; {\n\t\t\t\topenOrders, err := h.GetSwapOpenOrders(ctx,\n\t\t\t\t\treq.Pairs[x], currentPage, 50)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn orders, err\n\t\t\t\t}\n\n\t\t\t\tvar orderVars OrderVars\n\t\t\t\tfor x := range openOrders.Data.Orders {\n\t\t\t\t\torderVars, err = compatibleVars(openOrders.Data.Orders[x].Direction,\n\t\t\t\t\t\topenOrders.Data.Orders[x].OrderPriceType,\n\t\t\t\t\t\topenOrders.Data.Orders[x].Status)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn orders, err\n\t\t\t\t\t}\n\t\t\t\t\tp, err := currency.NewPairFromString(openOrders.Data.Orders[x].ContractCode)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn orders, err\n\t\t\t\t\t}\n\t\t\t\t\torders = append(orders, order.Detail{\n\t\t\t\t\t\tPostOnly: orderVars.OrderType == order.PostOnly,\n\t\t\t\t\t\tLeverage: openOrders.Data.Orders[x].LeverageRate,\n\t\t\t\t\t\tPrice: openOrders.Data.Orders[x].Price,\n\t\t\t\t\t\tAmount: openOrders.Data.Orders[x].Volume,\n\t\t\t\t\t\tExecutedAmount: openOrders.Data.Orders[x].TradeVolume,\n\t\t\t\t\t\tRemainingAmount: openOrders.Data.Orders[x].Volume - openOrders.Data.Orders[x].TradeVolume,\n\t\t\t\t\t\tFee: openOrders.Data.Orders[x].Fee,\n\t\t\t\t\t\tExchange: h.Name,\n\t\t\t\t\t\tAssetType: req.AssetType,\n\t\t\t\t\t\tOrderID: openOrders.Data.Orders[x].OrderIDString,\n\t\t\t\t\t\tSide: orderVars.Side,\n\t\t\t\t\t\tType: orderVars.OrderType,\n\t\t\t\t\t\tStatus: orderVars.Status,\n\t\t\t\t\t\tPair: p,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tcurrentPage++\n\t\t\t\tdone = currentPage == openOrders.Data.TotalPage\n\t\t\t}\n\t\t}\n\tcase asset.Futures:\n\t\tfor x := range req.Pairs {\n\t\t\tvar currentPage int64\n\t\t\tfor done := false; !done; {\n\t\t\t\topenOrders, err := h.FGetOpenOrders(ctx,\n\t\t\t\t\treq.Pairs[x].Base, currentPage, 50)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn orders, err\n\t\t\t\t}\n\t\t\t\tvar orderVars OrderVars\n\t\t\t\tfor x := range openOrders.Data.Orders {\n\t\t\t\t\torderVars, err = compatibleVars(openOrders.Data.Orders[x].Direction,\n\t\t\t\t\t\topenOrders.Data.Orders[x].OrderPriceType,\n\t\t\t\t\t\topenOrders.Data.Orders[x].Status)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn orders, err\n\t\t\t\t\t}\n\t\t\t\t\tp, err := currency.NewPairFromString(openOrders.Data.Orders[x].ContractCode)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn orders, err\n\t\t\t\t\t}\n\t\t\t\t\torders = append(orders, order.Detail{\n\t\t\t\t\t\tPostOnly: orderVars.OrderType == order.PostOnly,\n\t\t\t\t\t\tLeverage: openOrders.Data.Orders[x].LeverageRate,\n\t\t\t\t\t\tPrice: openOrders.Data.Orders[x].Price,\n\t\t\t\t\t\tAmount: openOrders.Data.Orders[x].Volume,\n\t\t\t\t\t\tExecutedAmount: openOrders.Data.Orders[x].TradeVolume,\n\t\t\t\t\t\tRemainingAmount: openOrders.Data.Orders[x].Volume - openOrders.Data.Orders[x].TradeVolume,\n\t\t\t\t\t\tFee: openOrders.Data.Orders[x].Fee,\n\t\t\t\t\t\tExchange: h.Name,\n\t\t\t\t\t\tAssetType: req.AssetType,\n\t\t\t\t\t\tOrderID: openOrders.Data.Orders[x].OrderIDString,\n\t\t\t\t\t\tSide: orderVars.Side,\n\t\t\t\t\t\tType: orderVars.OrderType,\n\t\t\t\t\t\tStatus: orderVars.Status,\n\t\t\t\t\t\tPair: p,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tcurrentPage++\n\t\t\t\tdone = currentPage == openOrders.Data.TotalPage\n\t\t\t}\n\t\t}\n\t}\n\treturn req.Filter(h.Name, orders), nil\n}", "title": "" }, { "docid": "603f3160a6bab113a8a30042d2d81048", "score": "0.54160625", "text": "func (client ManagementClient) GetOrderByIDSender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n }", "title": "" }, { "docid": "7f80bb0f7f814794c4c83665820ae577", "score": "0.5403663", "text": "func (a *OrdersApiService) BatchRetrieveOrders(ctx context.Context, body BatchRetrieveOrdersRequest) (BatchRetrieveOrdersResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue BatchRetrieveOrdersResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v2/orders/batch-retrieve\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &body\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\tif err == nil { \n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v BatchRetrieveOrdersResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "5b50fbd8297c699aa5ef8f8c4678b0a8", "score": "0.53856695", "text": "func (s *Service) OrderList(req *api.OrderListRequest) (*api.OrderListResponse, error) {\n\tpage := req.Page\n\tperPage := req.PerPage\n\tsortBy := req.SortBy\n\n\torderref, err := s.Store.ListKeys(\"order\", \"time\", page*perPage, perPage, sortBy != \"dateCreatedAsc\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//Pagnination - Show everything by default\n\tstart := 0\n\tstop := len(orderref)\n\n\tif perPage != 0 && page < len(orderref)/perPage && page*perPage < len(orderref) {\n\t\tstart = page\n\t\tstop = perPage\n\t}\n\n\treturn &api.OrderListResponse{\n\t\tOrderReference: orderref[start:stop],\n\t}, nil\n}", "title": "" }, { "docid": "2317dc5143e922f168fe4c5a24b86260", "score": "0.5373671", "text": "func (c Client) Get(id string, params *stripe.OrderParams) (*stripe.Order, error) {\n\tpath := stripe.FormatURLPath(\"/v1/orders/%s\", id)\n\torder := &stripe.Order{}\n\terr := c.B.Call(http.MethodGet, path, c.Key, params, order)\n\treturn order, err\n}", "title": "" }, { "docid": "342bdf241608bfe82c3e4a872ce44edb", "score": "0.5364444", "text": "func OrderRequest(w http.ResponseWriter, r *http.Request) {\r\n\tClientCode := r.URL.Query().Get(\"ClientCode\")\r\n\r\n\tconfig := CheckConfig()\r\n\turl := config.ServiceURL + \"OrderRequest\"\r\n\r\n\tmethod := \"POST\"\r\n\r\n\theader := Header{AppName: config.AppName, AppVer: config.AppVer, Key: config.Key, OsName: config.OsName, RequestCode: config.RequestCodeOrdReq, UserID: config.UserID, Password: config.Password}\r\n\r\n\tbody := OrderRequestBody{ClientCode: ClientCode, OrderFor: \"P\", Exchange: \"N\", ExchangeType: \"C\", Price: 190, OrderID: 1, OrderType: \"BUY\",\r\n\t\tQty: 1, OrderDateTime: \"/Date(1601880914379)/\", ScripCode: 3045, AtMarket: false, RemoteOrderID: \"s000220190\", ExchOrderID: \"0\", DisQty: 0,\r\n\t\tIsStopLossOrder: false, StopLossPrice: 0, IsVTD: false, IOCOrder: false, IsIntraday: false, PublicIP: \"192.168.84.215\", AHPlaced: \"N\",\r\n\t\tValidTillDate: \"/Date(1602880914379)/\", IOrderValidity: 0, OrderRequesterCode: \"96130000\", TradedQty: 0}\r\n\r\n\tOrderData := ReqDataRequest{Head: header, Body: body}\r\n\r\n\tOrderAPI := OrderRequestAPI{ReqData: OrderData, AppSource: 54}\r\n\r\n\tdata, _ := json.Marshal(OrderAPI)\r\n\r\n\tpayload := strings.NewReader(string(data))\r\n\r\n\tbodyString := HTTPClient(method, url, payload)\r\n\tjson.NewEncoder(w).Encode(bodyString)\r\n\r\n\tvar OrderRes OrderResponse\r\n\r\n\t// json to golang struct\r\n\tjson.Unmarshal([]byte(bodyString), &OrderRes)\r\n\tfmt.Printf(\"Message: %s, StatusDescription: %s\", OrderRes.Body.Message, OrderRes.Head.StatusDescription)\r\n\r\n}", "title": "" }, { "docid": "fab362b5c357f2328a7c3e6caba0320d", "score": "0.53576624", "text": "func (h *Handler) ReadOrders(ctx context.Context, req *proto.ReadOrdersRequest, rsp *proto.ReadOrdersResponse) error {\n\tshopID, err1 := shopkey.GetShopIDFrom(ctx, req.ShopId)\n\tif err1 != nil {\n\t\treturn err1\n\t}\n\n\torders, err := db.ReadOrders(shopID, req.State, req.CheckoutState, int(req.Offset), int(req.Limit))\n\tif err != nil {\n\t\treturn errors.NotFound(svrName + \".ReadOrders\", err.Error())\n\t}\n\n\trsp.Limit = req.Limit\n\trsp.Offset = req.Offset\n\trsp.Total = int32(len(*orders))\n\trsp.Records = *orders\n\treturn nil\n}", "title": "" }, { "docid": "117611d3cbbe3ffa7b786ad26c819921", "score": "0.53553265", "text": "func (oc OrderController) GetOrderByInvoice(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tidInvoice := vars[\"idInvoice\"]\n\tvar order models.Order\n\n\tdataOrder, err := order.GetOrderByInvoice(idInvoice)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tmessage, _ := json.Marshal(&dataOrder)\n\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(message)\n}", "title": "" }, { "docid": "0df627e354061366ccb02ba9d4c1c08a", "score": "0.5353448", "text": "func (p *Poloniex) GetOpenOrders(market string) (openOrders []OpenOrder, err error) {\n\trespCh := make(chan []byte)\n\terrCh := make(chan error)\n\n\tparameters := map[string]string{\"currencyPair\": strings.ToUpper(market)}\n\tgo p.tradingRequest(\"returnOpenOrders\", parameters, respCh, errCh)\n\n\tresp := <-respCh\n\terr = <-errCh\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(resp, &openOrders)\n\treturn\n}", "title": "" }, { "docid": "8320716617dc7d46579d0d3c8a583705", "score": "0.53530014", "text": "func (o Orders) ListOrders(others ...mws.Parameters) (*mws.Response, error) {\n\top := mws.OptionalParams([]string{\n\t\t\"CreatedAfter\", \"CreatedBefore\",\n\t\t\"LastUpdatedAfter\", \"LastUpdatedBefore\",\n\t\t\"OrderStatus\",\n\t\t\"FulfillmentChannel\", \"PaymentMethod\",\n\t\t\"SellerOrderId\", \"BuyerEmail\",\n\t\t\"TFMShipmentStatus\", \"MaxResultsPerPage\",\n\t}, others)\n\tparams := mws.Parameters{\n\t\t\"Action\": \"ListOrders\",\n\t\t\"MarketplaceId\": []string{o.MarketPlaceId},\n\t}.Merge(op)\n\n\tstructuredParams := params.StructureKeys(\"MarketplaceId\", \"Id\")\n\tif _, ok := structuredParams[\"OrderStatus\"]; ok {\n\t\tstructuredParams = params.StructureKeys(\"OrderStatus\", \"Status\")\n\t}\n\tif _, ok := structuredParams[\"FulfillmentChannel\"]; ok {\n\t\tstructuredParams = params.StructureKeys(\"FulfillmentChannel\", \"Channel\")\n\t}\n\tif _, ok := structuredParams[\"OrderStatus\"]; ok {\n\t\tstructuredParams = params.StructureKeys(\"PaymentMethod\", \"Method\")\n\t}\n\tif _, ok := structuredParams[\"OrderStatus\"]; ok {\n\t\tstructuredParams = params.StructureKeys(\"TFMShipmentStatus\", \"Status\")\n\t}\n\n\treturn o.SendRequest(structuredParams)\n}", "title": "" }, { "docid": "0dc56d7ce4d2161f4206558e04475d2e", "score": "0.5341799", "text": "func (os *OrderSide) Orders() (orders []*list.Element) {\n\tfor _, price := range os.prices {\n\t\titer := price.Head()\n\t\tfor iter != nil {\n\t\t\torders = append(orders, iter)\n\t\t\titer = iter.Next()\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "d40cd5d2994154939c46dab3d4dea493", "score": "0.5335807", "text": "func (c *COINUT) GetOpenOrders(instrumentID int) (GetOpenOrdersResponse, error) {\n\tvar result GetOpenOrdersResponse\n\tparams := make(map[string]interface{})\n\tparams[\"inst_id\"] = instrumentID\n\n\treturn result, c.SendHTTPRequest(coinutOrdersOpen, params, true, &result)\n}", "title": "" }, { "docid": "ab01a99ea467129f5de9a38a6d375907", "score": "0.5335007", "text": "func (o Orders) GetOrder(amazonOrderIds []string) (*mws.Response, error) {\n\tparams := mws.Parameters{\n\t\t\"Action\": \"GetOrder\",\n\t\t\"AmazonOrderId\": amazonOrderIds,\n\t}\n\tstructuredParams := params.StructureKeys(\"AmazonOrderId\", \"Id\")\n\n\treturn o.SendRequest(structuredParams)\n}", "title": "" }, { "docid": "fb981ad78f0af9647f98c4eee0c4379f", "score": "0.5332884", "text": "func (b *Bittrex) GetOpenOrders(market string) (openOrders []Order, err error) {\n\tressource := \"market/getopenorders\"\n\tif market != \"all\" {\n\t\tressource += \"?market=\" + strings.ToUpper(market)\n\t}\n\tr, err := b.client.do(\"GET\", ressource, \"\", true)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar response jsonResponse\n\tif err = json.Unmarshal(r, &response); err != nil {\n\t\treturn\n\t}\n\tif err = json.Unmarshal(r, &response); err != nil {\n\t\treturn\n\t}\n\terr = json.Unmarshal(response.Result, &openOrders)\n\treturn\n}", "title": "" }, { "docid": "f86bd10535a798b01742a69b6118e6ce", "score": "0.53322136", "text": "func (rs *restserver) clientsListByID(w http.ResponseWriter, r *http.Request) {\n\tvar req []struct {\n\t\tID string `json:\"id\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\trs.sendErrorJSON(w, r, 500, ErrInternal, err)\n\t\treturn\n\t}\n\tclientsID := make([]*model.Client, 0)\n\tfor _, rq := range req {\n\t\tclientsID = append(clientsID, &model.Client{ID: rq.ID})\n\t}\n\n\tclietns, err := rs.store.ClientsNames(clientsID)\n\tif err != nil {\n\t\trs.sendErrorJSON(w, r, 500, ErrInternal, err)\n\t\treturn\n\t}\n\trender.JSON(w, r, clietns)\n\n}", "title": "" }, { "docid": "b85e38dbf4ed5a13714d4b2ead2cfef9", "score": "0.5325917", "text": "func (k *Kraken) GetOpenOrders(showTrades bool, userref int64) (interface{}, error) {\n\tvalues := url.Values{}\n\n\tif showTrades {\n\t\tvalues.Set(\"trades\", \"true\")\n\t}\n\n\tif userref != 0 {\n\t\tvalues.Set(\"userref\", strconv.FormatInt(userref, 10))\n\t}\n\n\treturn k.SendAuthenticatedHTTPRequest(krakenOpenOrders, values)\n}", "title": "" }, { "docid": "5fb39cdb3295545d68274ea128fd1ada", "score": "0.53137594", "text": "func ObtenerClientes(c *fiber.Ctx) error {\n\tdb := database.DBConn\n\n\tvar clientes []Cliente\n\n\tdb.Find(&clientes)\n\n\trespuesta := fiber.Map{}\n\n\tif len(clientes) == 0 {\n\t\trespuesta[\"Cve_Error\"] = -1\n\t\trespuesta[\"Cve_Mensaje\"] = \"Error: no se encontraron clientes.\"\n\t\treturn c.Status(fiber.StatusNotFound).JSON(respuesta)\n\t}\n\n\trespuesta[\"Clientes\"] = clientes\n\trespuesta[\"Cve_Error\"] = 0\n\trespuesta[\"Cve_Mensaje\"] = \"Clientes encontrados con exito.\"\n\n\treturn c.Status(fiber.StatusOK).JSON(respuesta)\n}", "title": "" }, { "docid": "51dbb443d8cb6776e0a5581e1bb09a93", "score": "0.53110415", "text": "func (m *marketAPI) getMyOrders() (*pb.GetOrdersReply, error) {\n\treq := &pb.GetOrdersRequest{\n\t\tOrder: &pb.Order{\n\t\t\tByuerID: util.PubKeyToAddr(m.remotes.key.PublicKey).Hex(),\n\t\t\tOrderType: pb.OrderType_BID,\n\t\t},\n\t}\n\n\treturn m.remotes.market.GetOrders(m.ctx, req)\n}", "title": "" } ]
c10f460ed4735bab07ffd5008f552d78
GetFailureReason returns the FailureReason field value If the value is explicit nil, the zero value for TransferFailure will be returned
[ { "docid": "0ca5e391d054006443e076d6ef90f6a8", "score": "0.8443321", "text": "func (o *Transfer) GetFailureReason() TransferFailure {\n\tif o == nil || o.FailureReason.Get() == nil {\n\t\tvar ret TransferFailure\n\t\treturn ret\n\t}\n\n\treturn *o.FailureReason.Get()\n}", "title": "" } ]
[ { "docid": "a81f0e9dbb42f713d85bec0b91f16c27", "score": "0.7611202", "text": "func (o *VirtualizationIweHost) GetFailureReason() string {\n\tif o == nil || o.FailureReason == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.FailureReason\n}", "title": "" }, { "docid": "560bf9952622c0b6b058e64cf8c8fe9d", "score": "0.7572534", "text": "func (o *VirtualizationIweVirtualMachine) GetFailureReason() string {\n\tif o == nil || o.FailureReason == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.FailureReason\n}", "title": "" }, { "docid": "e9b4bd263572b7b9f1587448edde2c6f", "score": "0.7400875", "text": "func (o *UcsdBackupInfoAllOf) GetFailureReason() string {\n\tif o == nil || o.FailureReason == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.FailureReason\n}", "title": "" }, { "docid": "cba2aeffed46b8cab330c4b777aa20d0", "score": "0.7289088", "text": "func (o *OpenapiTaskGenerationResult) GetFailureReason() string {\n\tif o == nil || o.FailureReason == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.FailureReason\n}", "title": "" }, { "docid": "fe9eba9b87204e73666f9ca504eff2f3", "score": "0.7186154", "text": "func (o *VirtualizationIweClusterAllOf) GetFailureReason() string {\n\tif o == nil || o.FailureReason == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.FailureReason\n}", "title": "" }, { "docid": "6025e4fc06244e4d5bb7804e6491e5a5", "score": "0.7000342", "text": "func (o *OpenapiProcessFileAllOf) GetFailureReason() string {\n\tif o == nil || o.FailureReason == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.FailureReason\n}", "title": "" }, { "docid": "72e471e6438d59380fdc5ee8f0a2f39f", "score": "0.6871464", "text": "func (s *Endpoint) SetFailureReason(v string) *Endpoint {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "b0f7eee23bdaa55bf8cb6d3b67a4d78a", "score": "0.680019", "text": "func (s *Workforce) SetFailureReason(v string) *Workforce {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "e1eb03cafe9c189ae67946d6494377ce", "score": "0.6796436", "text": "func (s *EndpointMetadata) SetFailureReason(v string) *EndpointMetadata {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "d0d7bb692bd9957d53502feac2ba7674", "score": "0.6777416", "text": "func (o *Transfer) SetFailureReason(v TransferFailure) {\n\to.FailureReason.Set(&v)\n}", "title": "" }, { "docid": "f9d10969767dbdf4ca923aa3690a5f45", "score": "0.67688", "text": "func (s *Image) SetFailureReason(v string) *Image {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "143ddbbed644065832c60d1aead59fae", "score": "0.6759824", "text": "func (o *Transfer) GetFailureReasonOk() (*TransferFailure, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FailureReason.Get(), o.FailureReason.IsSet()\n}", "title": "" }, { "docid": "e079670f021abe3db90324b451c1ce31", "score": "0.67419523", "text": "func (o *VirtualizationIweVirtualMachine) SetFailureReason(v string) {\n\to.FailureReason = &v\n}", "title": "" }, { "docid": "738ae5e2c243eb33bd0bd6d310cc74d6", "score": "0.6738026", "text": "func (s *DescribeEndpointOutput) SetFailureReason(v string) *DescribeEndpointOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "370c26f3f0c1f8441c2107aa715592d0", "score": "0.6715346", "text": "func (s *DescribeHubOutput) SetFailureReason(v string) *DescribeHubOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "08399eb1bc08e5c5b7d1f6e7b509f6de", "score": "0.6692232", "text": "func (s *DescribeFlowDefinitionOutput) SetFailureReason(v string) *DescribeFlowDefinitionOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "c70eb711e075b6af345d7193fd71a0bc", "score": "0.6689808", "text": "func (s *DescribeUserProfileOutput) SetFailureReason(v string) *DescribeUserProfileOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "0ebef870150e5d4d2ece2c609c2d380a", "score": "0.66796476", "text": "func (s *ListMessageMoveTasksResultEntry) SetFailureReason(v string) *ListMessageMoveTasksResultEntry {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "7b20379ed21093eb5657e33eac6ec628", "score": "0.667699", "text": "func (s *DescribeImageOutput) SetFailureReason(v string) *DescribeImageOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "abe55388912c1b7d895ce67c70802c26", "score": "0.66751915", "text": "func (s *DescribeHubContentOutput) SetFailureReason(v string) *DescribeHubContentOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "ae2541f0027d900b95720c13cf4bd59e", "score": "0.66726273", "text": "func (o *VirtualizationIweHost) SetFailureReason(v string) {\n\to.FailureReason = &v\n}", "title": "" }, { "docid": "87451d9b14c5f6ac70b073a3e700fe6b", "score": "0.66723424", "text": "func (o *UcsdBackupInfoAllOf) SetFailureReason(v string) {\n\to.FailureReason = &v\n}", "title": "" }, { "docid": "d2f29d978ac8d1914688bd885823d1c3", "score": "0.66714126", "text": "func (s *DescribeModelCardExportJobOutput) SetFailureReason(v string) *DescribeModelCardExportJobOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "1869989eeab643a9954fd5175f1e3a68", "score": "0.6666961", "text": "func (s *DescribeFeatureGroupOutput) SetFailureReason(v string) *DescribeFeatureGroupOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "3cef259f5babe1a6da92604667a43636", "score": "0.66615826", "text": "func (s *ModelPackageStatusItem) SetFailureReason(v string) *ModelPackageStatusItem {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "d8763433d6e4883112c79707e7f18f86", "score": "0.6638307", "text": "func (s *LastUpdateStatus) SetFailureReason(v string) *LastUpdateStatus {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "82f7276587588b384522ebaf05ac619e", "score": "0.66337514", "text": "func (s *ImageVersion) SetFailureReason(v string) *ImageVersion {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "f7e922286d4db01aa16bc8e30b71721a", "score": "0.6625177", "text": "func (s *CallAnalyticsJob) SetFailureReason(v string) *CallAnalyticsJob {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "286bba1a544c13caacb576befe0d75b9", "score": "0.6623962", "text": "func (s *DescribeAppOutput) SetFailureReason(v string) *DescribeAppOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "e9b89e30a578eecd8e6b6c30b3510e44", "score": "0.66193926", "text": "func (s *DescribeImageVersionOutput) SetFailureReason(v string) *DescribeImageVersionOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "fd048ab9d2019c163959784a31bbea13", "score": "0.6612056", "text": "func (s *ModelDashboardMonitoringSchedule) SetFailureReason(v string) *ModelDashboardMonitoringSchedule {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "59cb5b7eea026809fcd4e45906933c12", "score": "0.6605765", "text": "func (s *PipelineExecution) SetFailureReason(v string) *PipelineExecution {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "703de9faeafbfe760a6fa1e7972019ee", "score": "0.66051865", "text": "func (s *FeatureGroup) SetFailureReason(v string) *FeatureGroup {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "f6e0778bce35b5c420a89ed4ca37f489", "score": "0.6600611", "text": "func (s *FlowDefinitionSummary) SetFailureReason(v string) *FlowDefinitionSummary {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "01fb45de60670198cc8aa68f97eda425", "score": "0.6584138", "text": "func (s *LanguageModel) SetFailureReason(v string) *LanguageModel {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "14a491497645513b0ae52437f5d8517c", "score": "0.657711", "text": "func (s *PipelineExecutionStep) SetFailureReason(v string) *PipelineExecutionStep {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "38030656abfe8a76af36e1fd84f9b7c1", "score": "0.6576694", "text": "func (s *TrainingJob) SetFailureReason(v string) *TrainingJob {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "60c2ed9e0483022bbc23b09a9bd6514e", "score": "0.6574588", "text": "func (s *CreateAccountStatus) SetFailureReason(v string) *CreateAccountStatus {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "6b1ad9b5de3b15ec87c1969d0f0ffbd2", "score": "0.65738326", "text": "func (s *CallAnalyticsJobSummary) SetFailureReason(v string) *CallAnalyticsJobSummary {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "4ebf37a270981acce6eea4a9c5f72666", "score": "0.65609413", "text": "func (s *DescribeDomainOutput) SetFailureReason(v string) *DescribeDomainOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "58d98303b358ede0f5a4bb6d2843e529", "score": "0.6558594", "text": "func (s *MonitoringSchedule) SetFailureReason(v string) *MonitoringSchedule {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "019a3399354fce132118b8765b05050b", "score": "0.65534586", "text": "func (s *DescribePipelineExecutionOutput) SetFailureReason(v string) *DescribePipelineExecutionOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "a0a6e168080abf962ba572e955b65bd2", "score": "0.6553399", "text": "func (s *GetVocabularyOutput) SetFailureReason(v string) *GetVocabularyOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "57be4b4c93497abf602187ede6974a25", "score": "0.65442556", "text": "func (s *DescribeAutoMLJobOutput) SetFailureReason(v string) *DescribeAutoMLJobOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "042ff08647759e0e21bd372a461d7182", "score": "0.65425366", "text": "func (s *SendPipelineExecutionStepFailureInput) SetFailureReason(v string) *SendPipelineExecutionStepFailureInput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "dde25f74277804bbf836613ec27616a4", "score": "0.65357184", "text": "func (s *HyperParameterTrainingJobSummary) SetFailureReason(v string) *HyperParameterTrainingJobSummary {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "a54ec0931c084315fc9ce0d0d440ba10", "score": "0.65262574", "text": "func (s *DescribeTrainingJobOutput) SetFailureReason(v string) *DescribeTrainingJobOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "43e8f2b1aa0652407048aa84c3ff42c5", "score": "0.652249", "text": "func (o *OpenapiTaskGenerationResult) SetFailureReason(v string) {\n\to.FailureReason = &v\n}", "title": "" }, { "docid": "63297718f4a99316e12ba2438c4a8c4d", "score": "0.65221274", "text": "func (s *DescribeSpaceOutput) SetFailureReason(v string) *DescribeSpaceOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "3959e0c3ea07b4506a807d9abcf03c38", "score": "0.65177447", "text": "func (s *TransformJob) SetFailureReason(v string) *TransformJob {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "b49fc8189ba5d584ea3dd958ecbdfb81", "score": "0.65135586", "text": "func (s *AutoMLJobSummary) SetFailureReason(v string) *AutoMLJobSummary {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "0a685964aea8fc2291441459f6caa269", "score": "0.6505677", "text": "func (s *Vocabulary) SetFailureReason(v string) *Vocabulary {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "d580cd7ea64f40f435fd5752787f9da9", "score": "0.6489439", "text": "func (s *CreateVocabularyOutput) SetFailureReason(v string) *CreateVocabularyOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "3377164380a3ed06900e6b57cf4103a4", "score": "0.6489231", "text": "func (s *AutoMLCandidate) SetFailureReason(v string) *AutoMLCandidate {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "1934149fd3ff251dbafe0e1de3441568", "score": "0.6482995", "text": "func (s *DescribeLabelingJobOutput) SetFailureReason(v string) *DescribeLabelingJobOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "4a6b674bf2ecb2d3affe06e27aee4550", "score": "0.64792365", "text": "func (o *VirtualizationIweClusterAllOf) SetFailureReason(v string) {\n\to.FailureReason = &v\n}", "title": "" }, { "docid": "a4f6917d020e58dccdc95d059628475f", "score": "0.64792347", "text": "func (s *DescribeMonitoringScheduleOutput) SetFailureReason(v string) *DescribeMonitoringScheduleOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "b8051acc5a6d19670ffc2cccd9c89b0b", "score": "0.6477908", "text": "func (s *VocabularySummary) SetFailureReason(v string) *VocabularySummary {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "66a9faebca889c2666797c63133582e2", "score": "0.6473843", "text": "func (s *DescribeTransformJobOutput) SetFailureReason(v string) *DescribeTransformJobOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "24955abe8268d3f626081663b726c620", "score": "0.6469418", "text": "func (s *DescribeAutoMLJobV2Output) SetFailureReason(v string) *DescribeAutoMLJobV2Output {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "2b6ba7cc3483e9776e4ea9cc0cf7ccb4", "score": "0.646248", "text": "func (s *InferenceRecommendationsJob) SetFailureReason(v string) *InferenceRecommendationsJob {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "cd0456512e5e5d604e601b8c86068355", "score": "0.64547193", "text": "func (s *MonitoringExecutionSummary) SetFailureReason(v string) *MonitoringExecutionSummary {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "7a3e48b4548b5bf7057f3f24bb2747be", "score": "0.64510965", "text": "func (s *DescribeNotebookInstanceOutput) SetFailureReason(v string) *DescribeNotebookInstanceOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "201c0a36ec74694ef91fb0abb98fe739", "score": "0.6439531", "text": "func (s *LabelingJobSummary) SetFailureReason(v string) *LabelingJobSummary {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "9dd949cd2dd98ee9d17c9469673a0e1a", "score": "0.64338726", "text": "func (s *TransformJobSummary) SetFailureReason(v string) *TransformJobSummary {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "e13aa91331e8206638717cd97962be3b", "score": "0.64261097", "text": "func (s *ProcessingJob) SetFailureReason(v string) *ProcessingJob {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "6484587e784b770af559ae7c24592f22", "score": "0.6415333", "text": "func (s *DescribeInferenceRecommendationsJobOutput) SetFailureReason(v string) *DescribeInferenceRecommendationsJobOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "aa43b922d7ce3b462ab112b88b64cf80", "score": "0.6411148", "text": "func (s *AlgorithmStatusItem) SetFailureReason(v string) *AlgorithmStatusItem {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "d9d0cf1d7c5fb14980c44c003bae4831", "score": "0.64069235", "text": "func (s *TranscriptionJob) SetFailureReason(v string) *TranscriptionJob {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "7a44cbfd7c5dc1b2b5c46cf587998d52", "score": "0.6406414", "text": "func (s *HyperParameterTuningJobSearchEntity) SetFailureReason(v string) *HyperParameterTuningJobSearchEntity {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "b03f808e02200f8bc238ec5812369967", "score": "0.6402633", "text": "func (s *RecommendationJobInferenceBenchmark) SetFailureReason(v string) *RecommendationJobInferenceBenchmark {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "7edaba0ebb6039e1b320a244a21cb24a", "score": "0.6384499", "text": "func (s *GetMedicalVocabularyOutput) SetFailureReason(v string) *GetMedicalVocabularyOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "3eafe0490e23abdd185e4e8c88da696f", "score": "0.6382693", "text": "func (s *JobPostLaunchActionsLaunchStatus) SetFailureReason(v string) *JobPostLaunchActionsLaunchStatus {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "2809f9657c09388fabb4d878d28e100e", "score": "0.6372777", "text": "func (s *CreateMedicalVocabularyOutput) SetFailureReason(v string) *CreateMedicalVocabularyOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "b17c4a7da940b68edd4da4e11331df1d", "score": "0.63650554", "text": "func (s *DescribeHyperParameterTuningJobOutput) SetFailureReason(v string) *DescribeHyperParameterTuningJobOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "64487e2c29e344a5a2490df2a3b6e992", "score": "0.6358251", "text": "func (s *TranscriptionJobSummary) SetFailureReason(v string) *TranscriptionJobSummary {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "1bfe83be3f35f2cbbba3804e8394ccce", "score": "0.6353008", "text": "func (s *ProcessingJobSummary) SetFailureReason(v string) *ProcessingJobSummary {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "82cbb9250bce9ac04bd14753a5ddcbf9", "score": "0.6324178", "text": "func (s *DescribeProcessingJobOutput) SetFailureReason(v string) *DescribeProcessingJobOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "b0e8b7a4b631d07b6941f94d750084dd", "score": "0.6321418", "text": "func (s *MedicalTranscriptionJob) SetFailureReason(v string) *MedicalTranscriptionJob {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "315941832943afe805d874c24140a8fb", "score": "0.63206404", "text": "func (o *VirtualizationIweHost) GetFailureReasonOk() (*string, bool) {\n\tif o == nil || o.FailureReason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FailureReason, true\n}", "title": "" }, { "docid": "3a05777fd4f6c6a509c44d4489f1721e", "score": "0.631681", "text": "func (s *DescribeCompilationJobOutput) SetFailureReason(v string) *DescribeCompilationJobOutput {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "3e69189c4fa898f086008b84115cf555", "score": "0.6310749", "text": "func (s *MedicalTranscriptionJobSummary) SetFailureReason(v string) *MedicalTranscriptionJobSummary {\n\ts.FailureReason = &v\n\treturn s\n}", "title": "" }, { "docid": "84760f9dcdebe5e2751d71effd44445c", "score": "0.6260451", "text": "func (c *SearchCall) FailureReason(failureReason string) *SearchCall {\n\tc.urlParams_.Set(\"failure_reason\", failureReason)\n\treturn c\n}", "title": "" }, { "docid": "2ea253765e5930eec713baa453f18274", "score": "0.62431777", "text": "func (o *OpenapiProcessFileAllOf) SetFailureReason(v string) {\n\to.FailureReason = &v\n}", "title": "" }, { "docid": "fceb783c92f91505098309d742825af4", "score": "0.61503816", "text": "func (biuo *BlockInstanceUpdateOne) SetFailureReason(s string) *BlockInstanceUpdateOne {\n\tbiuo.mutation.SetFailureReason(s)\n\treturn biuo\n}", "title": "" }, { "docid": "fef45b72b267ac222daab72d2c7d28c1", "score": "0.6124358", "text": "func (m *MachineScope) SetFailureReason(v capierrors.MachineStatusError) {\n\tm.AzureMachine.Status.FailureReason = &v\n}", "title": "" }, { "docid": "37f9706d9e30791b9000173e0e9aafbb", "score": "0.6035489", "text": "func (biu *BlockInstanceUpdate) SetFailureReason(s string) *BlockInstanceUpdate {\n\tbiu.mutation.SetFailureReason(s)\n\treturn biu\n}", "title": "" }, { "docid": "1e62ff7e1180b53095560566fc226b6c", "score": "0.5996422", "text": "func (o *VirtualizationIweVirtualMachine) GetFailureReasonOk() (*string, bool) {\n\tif o == nil || o.FailureReason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FailureReason, true\n}", "title": "" }, { "docid": "826d5a0cdac4c7913a440af2bd3ebd73", "score": "0.58849186", "text": "func (o *VirtualizationIweClusterAllOf) GetFailureReasonOk() (*string, bool) {\n\tif o == nil || o.FailureReason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FailureReason, true\n}", "title": "" }, { "docid": "bf5861c862615be68b120db7e07f91c0", "score": "0.5878988", "text": "func (o *AutoscalerScaleDownConfig) GetDelayAfterFailure() (value string, ok bool) {\n\tok = o != nil && o.bitmap_&4 != 0\n\tif ok {\n\t\tvalue = o.delayAfterFailure\n\t}\n\treturn\n}", "title": "" }, { "docid": "232284ca59d75ea0bde597e5128d8b84", "score": "0.58457416", "text": "func (e GetMessageResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "b9d20d989da90615f8078b34b41c48d8", "score": "0.58328277", "text": "func (o *AccessRequestData) GetReason() string {\n\tif o == nil || o.Reason == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Reason\n}", "title": "" }, { "docid": "c731cda1ad93309b5dece36fa6fec118", "score": "0.58157843", "text": "func (o *UcsdBackupInfoAllOf) GetFailureReasonOk() (*string, bool) {\n\tif o == nil || o.FailureReason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FailureReason, true\n}", "title": "" }, { "docid": "57727cb29448057a204f6385a0ad345e", "score": "0.5813967", "text": "func (e MessageFValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "8ef2b5e0b1510f9dfb39664ffa02f473", "score": "0.5799153", "text": "func (r *ReportStoryRequest) GetReason() (value ReportReasonClass) {\n\tif r == nil {\n\t\treturn\n\t}\n\treturn r.Reason\n}", "title": "" }, { "docid": "f34a2f49e0a7c9528d26101735f3f2b1", "score": "0.57977444", "text": "func (m *DirectoryAudit) GetResultReason()(*string) {\n return m.resultReason\n}", "title": "" }, { "docid": "d4f261ba008b9681fc7cc8cd5ebf4a70", "score": "0.57941544", "text": "func (e DescribeTableResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "3ffd0b59f73e328dcab1a076c409e77b", "score": "0.5792384", "text": "func (o *SecurityProblemEvent) GetReason() string {\n\tif o == nil || o.Reason == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Reason\n}", "title": "" }, { "docid": "ede8b6455091ed10d369d8e40dd32455", "score": "0.5782674", "text": "func (o *OpenapiProcessFileAllOf) GetFailureReasonOk() (*string, bool) {\n\tif o == nil || o.FailureReason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FailureReason, true\n}", "title": "" }, { "docid": "a83023f1d57f7497084638a8f87f973e", "score": "0.5725674", "text": "func (e TransactionValidationError) Reason() string { return e.reason }", "title": "" } ]
165674872fe9f5d000a1c5bf9d7d7e42
NewFS Returns a file system object for making a connection with
[ { "docid": "a5f5b670232467865dfbfb945d277905", "score": "0.70607257", "text": "func NewFS() *FS {\n// \tlog.Printf(\"NewFS\")\n\tfs := &FS{\n\t\tnodeCount: 1,\n\t}\n\tfs.root = fs.NewDir(\"\", os.ModeDir|0777, 0, time.Now())\n\tif fs.root.attr.Inode != 1 {\n\t\tpanic(\"Root node should have been assigned id 1\")\n\t}\n\treturn fs\n}", "title": "" } ]
[ { "docid": "6c1f55e9b6cf76c56685033356326db5", "score": "0.71179694", "text": "func NewFS(VFS *vfs.VFS, opt *mountlib.Options) *FS {\n\tfsys := &FS{\n\t\tVFS: VFS,\n\t\tf: VFS.Fs(),\n\t\topt: opt,\n\t}\n\treturn fsys\n}", "title": "" }, { "docid": "6c1f55e9b6cf76c56685033356326db5", "score": "0.71179694", "text": "func NewFS(VFS *vfs.VFS, opt *mountlib.Options) *FS {\n\tfsys := &FS{\n\t\tVFS: VFS,\n\t\tf: VFS.Fs(),\n\t\topt: opt,\n\t}\n\treturn fsys\n}", "title": "" }, { "docid": "85603b9a856157b77c08f7fa9c207988", "score": "0.7075803", "text": "func NewFS(config libkbfs.Config, log logger.Logger) keybase1.FsInterface {\n\treturn &fs{config: config, log: log}\n}", "title": "" }, { "docid": "3c7f121ede76d99216603926f489f838", "score": "0.69451123", "text": "func newFileSystem(cacheRoot string) cache.Backend {\n\treturn &filesystem{cacheRoot: cacheRoot}\n}", "title": "" }, { "docid": "5c08619bdd606776942382e1a1e49f76", "score": "0.6900187", "text": "func NewFS(key pyxtea.Key) *FS {\n\tfs := &FS{\n\t\tfilemap: map[string]*fsfile{},\n\t\tkey: key,\n\t}\n\n\tfs.rootdir = fs.adddir(\"\")\n\n\treturn fs\n}", "title": "" }, { "docid": "409afe3c36c6d9d96be980777bd3dd8c", "score": "0.68750775", "text": "func NewFS(procMountPoint string, sysMountPoint string) (FS, error) {\n\tif strings.TrimSpace(procMountPoint) == \"\" {\n\t\tprocMountPoint = fs.DefaultProcMountPoint\n\t}\n\tprocfs, err := fs.NewFS(procMountPoint)\n\tif err != nil {\n\t\treturn FS{}, err\n\t}\n\tif strings.TrimSpace(sysMountPoint) == \"\" {\n\t\tsysMountPoint = fs.DefaultSysMountPoint\n\t}\n\tsysfs, err := fs.NewFS(sysMountPoint)\n\tif err != nil {\n\t\treturn FS{}, err\n\t}\n\treturn FS{&procfs, &sysfs}, nil\n}", "title": "" }, { "docid": "96070b2c715bcca075f7c3dd6d8c1777", "score": "0.6839821", "text": "func newFileSystem(persistDir string, contractor contractManager, disrupter disrupter) *fileSystem {\n\t// create the fileSystem\n\treturn &fileSystem{\n\t\tfileRootDir: storage.SysPath(filepath.Join(persistDir, filesDirectory)),\n\t\tpersistDir: storage.SysPath(persistDir),\n\t\tcontractManager: contractor,\n\t\ttm: &threadmanager.ThreadManager{},\n\t\tlogger: log.New(\"module\", \"filesystem\"),\n\t\tdisrupter: disrupter,\n\t\tunfinishedUpdates: make(map[storage.DxPath]*dirMetadataUpdate),\n\t\trepairNeeded: make(chan struct{}, 1),\n\t\tstuckFound: make(chan struct{}, 1),\n\t}\n}", "title": "" }, { "docid": "62f96381353df6f363c8e51a8f1619f6", "score": "0.6796032", "text": "func New() http.FileSystem {\n\treturn &fileSystem{\n\t\tfiles: files,\n\t}\n}", "title": "" }, { "docid": "2d283ceac5112a3f03b325fdbf74a4ad", "score": "0.6794776", "text": "func NewFS(cfgMap map[string]interface{}, opts ...Option) (qfs.Filesystem, error) {\n\tcfg, err := mapToConfig(cfgMap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(cfg)\n\t}\n\n\treturn &FS{cfg: cfg}, nil\n}", "title": "" }, { "docid": "cd8784e9e05ce153283fe7f1a8b731df", "score": "0.67681503", "text": "func NewFileSystem() fs.FileSystem {\n\treturn fs.MakeRealFS()\n}", "title": "" }, { "docid": "b182c6949886918ce5183ca3c053fde9", "score": "0.6729271", "text": "func NewFs(ctx context.Context, name string, root string, m configmap.Mapper) (fs.Fs, error) {\n\topt := new(Options)\n\terr := configstruct.Set(m, opt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\topt.Endpoint = removeTrailingSlash(opt.Endpoint)\n\tclient := fshttp.NewClient(ctx)\n\n\tf := &Fs{\n\t\tname: name,\n\t\troot: root,\n\t\topt: *opt,\n\t\tapi: api.NewApi(client, opt.Endpoint),\n\t}\n\tf.features = (&fs.Features{\n\t\tCanHaveEmptyDirectories: true,\n\t}).Fill(ctx, f)\n\n\tsharedRoot.Lock()\n\tipfsRoot := sharedRoot.cache[*opt]\n\tif ipfsRoot == nil {\n\t\tipfsRoot, err = NewRoot(ctx, f)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsharedRoot.cache[*opt] = ipfsRoot\n\t}\n\tf.ipfsRoot = ipfsRoot\n\tsharedRoot.Unlock()\n\n\tvar fsError error = nil\n\tif root != \"\" {\n\t\t// Check to see if the root actually an existing file\n\t\tremote := path.Base(root)\n\t\tf.root = path.Dir(root)\n\t\tif f.root == \".\" {\n\t\t\tf.root = \"\"\n\t\t}\n\n\t\t_, err := f.NewObject(ctx, remote)\n\t\tif err != nil {\n\t\t\tif err == fs.ErrorObjectNotFound || errors.Cause(err) == fs.ErrorNotAFile || err == fs.ErrorNotAFile {\n\t\t\t\t// Remote is file or doesn't exist => reset root\n\t\t\t\tf.root = root\n\t\t\t} else {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t} else {\n\t\t\t// return an error with an fs which points to the parent\n\t\t\tfsError = fs.ErrorIsFile\n\t\t}\n\t}\n\n\treturn f, fsError\n}", "title": "" }, { "docid": "872eaf856f12aacc3341f610f91bb39a", "score": "0.6685082", "text": "func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error) {\n\t// Parse config into Options struct\n\topt := new(Options)\n\tif err := configstruct.Set(m, opt); err != nil {\n\t\treturn nil, err\n\t}\n\terr := setupRegion(m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\troot = parsePath(root)\n\toAuthClient, _, err := oauthutil.NewClient(ctx, name, m, oauthConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tf := &Fs{\n\t\tname: name,\n\t\troot: root,\n\t\topt: *opt,\n\t\tsrv: rest.NewClient(oAuthClient).SetRoot(rootURL),\n\t\tpacer: fs.NewPacer(ctx, pacer.NewDefault(pacer.MinSleep(minSleep), pacer.MaxSleep(maxSleep), pacer.DecayConstant(decayConstant))),\n\t}\n\tf.features = (&fs.Features{\n\t\tCanHaveEmptyDirectories: true,\n\t}).Fill(ctx, f)\n\n\t// Get rootFolderID\n\trootID := f.opt.RootFolderID\n\tf.dirCache = dircache.New(root, rootID, f)\n\n\t// Find the current root\n\terr = f.dirCache.FindRoot(ctx, false)\n\tif err != nil {\n\t\t// Assume it is a file\n\t\tnewRoot, remote := dircache.SplitPath(root)\n\t\ttempF := *f\n\t\ttempF.dirCache = dircache.New(newRoot, rootID, &tempF)\n\t\ttempF.root = newRoot\n\t\t// Make new Fs which is the parent\n\t\terr = tempF.dirCache.FindRoot(ctx, false)\n\t\tif err != nil {\n\t\t\t// No root so return old f\n\t\t\treturn f, nil\n\t\t}\n\t\t_, err := tempF.newObjectWithInfo(ctx, remote, nil)\n\t\tif err != nil {\n\t\t\tif err == fs.ErrorObjectNotFound {\n\t\t\t\t// File doesn't exist so return old f\n\t\t\t\treturn f, nil\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tf.features.Fill(ctx, &tempF)\n\t\tf.dirCache = tempF.dirCache\n\t\tf.root = tempF.root\n\t\t// return an error with an fs which points to the parent\n\t\treturn f, fs.ErrorIsFile\n\t}\n\treturn f, nil\n}", "title": "" }, { "docid": "140eeac56dac8e9dcd9e02b9d3239921", "score": "0.66497105", "text": "func NewFilesystem(_ context.Context, cfgMap map[string]interface{}) (qfs.Filesystem, error) {\n\treturn NewFS(cfgMap)\n}", "title": "" }, { "docid": "b6693b13cb25094cc1174575d89765b6", "score": "0.6604081", "text": "func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (f fs.Fs, err error) {\n\t// defer log.Trace(name, \"root=%v\", root)(\"f=%+v, err=%v\", &f, &err)\n\t// Parse config into Options struct\n\topt := new(Options)\n\terr = configstruct.Set(m, opt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\troot = parsePath(root)\n\thttpClient := fshttp.NewClient(ctx)\n\toAuthClient, _, err := oauthutil.NewClientWithBaseClient(ctx, name, m, putioConfig, httpClient)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to configure putio: %w\", err)\n\t}\n\tp := &Fs{\n\t\tname: name,\n\t\troot: root,\n\t\topt: *opt,\n\t\tpacer: fs.NewPacer(ctx, pacer.NewDefault(pacer.MinSleep(minSleep), pacer.MaxSleep(maxSleep), pacer.DecayConstant(decayConstant))),\n\t\tclient: putio.NewClient(oAuthClient),\n\t\thttpClient: httpClient,\n\t\toAuthClient: oAuthClient,\n\t}\n\tp.features = (&fs.Features{\n\t\tDuplicateFiles: true,\n\t\tReadMimeType: true,\n\t\tCanHaveEmptyDirectories: true,\n\t}).Fill(ctx, p)\n\tp.dirCache = dircache.New(root, \"0\", p)\n\t// Find the current root\n\terr = p.dirCache.FindRoot(ctx, false)\n\tif err != nil {\n\t\t// Assume it is a file\n\t\tnewRoot, remote := dircache.SplitPath(root)\n\t\ttempF := *p\n\t\ttempF.dirCache = dircache.New(newRoot, \"0\", &tempF)\n\t\ttempF.root = newRoot\n\t\t// Make new Fs which is the parent\n\t\terr = tempF.dirCache.FindRoot(ctx, false)\n\t\tif err != nil {\n\t\t\t// No root so return old f\n\t\t\treturn p, nil\n\t\t}\n\t\t_, err := tempF.NewObject(ctx, remote)\n\t\tif err != nil {\n\t\t\t// unable to list folder so return old f\n\t\t\treturn p, nil\n\t\t}\n\t\t// XXX: update the old f here instead of returning tempF, since\n\t\t// `features` were already filled with functions having *f as a receiver.\n\t\t// See https://github.com/rclone/rclone/issues/2182\n\t\tp.dirCache = tempF.dirCache\n\t\tp.root = tempF.root\n\t\treturn p, fs.ErrorIsFile\n\t}\n\t// fs.Debugf(p, \"Root id: %s\", p.dirCache.RootID())\n\treturn p, nil\n}", "title": "" }, { "docid": "f47d395d653cdb6179cdc3e68c3be6a1", "score": "0.6595011", "text": "func New(cfg *Config) pathfs.FileSystem {\n\tfs := &filesystem{\n\t\tFileSystem: pathfs.NewDefaultFileSystem(),\n\t\tConfig: cfg,\n\t}\n\n\treturn pathfs.NewReadonlyFileSystem(fs)\n}", "title": "" }, { "docid": "05741e46c828ae0f38d7a72b60e2b55f", "score": "0.658746", "text": "func newFs() *fs.MockFs {\n\treturn fs.NewMockFs(map[string][]byte{})\n}", "title": "" }, { "docid": "da096e8d49b57fd0774acaf8b00b5c69", "score": "0.6576487", "text": "func New(ns string) (http.FileSystem, error) {\n\tfn := nss[ns]\n\tif fn == nil {\n\t\treturn nil, ErrNsNotFound\n\t}\n\tfn()\n\treturn fs.New()\n}", "title": "" }, { "docid": "5043fd282aed66e3a58d36019a359822", "score": "0.6546935", "text": "func (c *Command) newFSService() servicespec.FSService {\n\treturn memory.New()\n}", "title": "" }, { "docid": "ecca082321cb73c850608f477f7d82af", "score": "0.6543709", "text": "func New(t *kernel.Task, family int, skType linux.SockType, protocol int, queue *waiter.Queue, endpoint tcpip.Endpoint) (*vfs.FileDescription, *syserr.Error) {\n\tif skType == linux.SOCK_STREAM {\n\t\tendpoint.SocketOptions().SetDelayOption(true)\n\t}\n\n\tmnt := t.Kernel().SocketMount()\n\td := sockfs.NewDentry(t, mnt)\n\tdefer d.DecRef(t)\n\n\tnamespace := t.NetworkNamespace()\n\ts := &sock{\n\t\tQueue: queue,\n\t\tfamily: family,\n\t\tEndpoint: endpoint,\n\t\tskType: skType,\n\t\tprotocol: protocol,\n\t\tnamespace: namespace,\n\t}\n\ts.LockFD.Init(&vfs.FileLocks{})\n\tvfsfd := &s.vfsfd\n\tif err := vfsfd.Init(s, linux.O_RDWR, mnt, d, &vfs.FileDescriptionOptions{\n\t\tDenyPRead: true,\n\t\tDenyPWrite: true,\n\t\tUseDentryMetadata: true,\n\t}); err != nil {\n\t\treturn nil, syserr.FromError(err)\n\t}\n\tnamespace.IncRef()\n\treturn vfsfd, nil\n}", "title": "" }, { "docid": "b6cf49bbc4b06ebc73314e606232cb36", "score": "0.6543073", "text": "func (fstype *FilesystemType) newFilesystem(ctx context.Context, vfsObj *vfs.VirtualFilesystem, creds *auth.Credentials) (*filesystem, *kernfs.Dentry, error) {\n\tdevMinor, err := vfsObj.GetAnonBlockDevMinor()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tfs := &filesystem{\n\t\tdevMinor: devMinor,\n\t}\n\tfs.Filesystem.VFSFilesystem().Init(vfsObj, fstype, fs)\n\n\t// Construct the root directory. This is always inode id 1.\n\troot := &rootInode{\n\t\treplicas: make(map[uint32]*replicaInode),\n\t}\n\troot.InodeAttrs.Init(ctx, creds, linux.UNNAMED_MAJOR, devMinor, 1, linux.ModeDirectory|0555)\n\troot.OrderedChildren.Init(kernfs.OrderedChildrenOptions{})\n\troot.InitRefs()\n\n\tvar rootD kernfs.Dentry\n\trootD.InitRoot(&fs.Filesystem, root)\n\n\t// Construct the pts master inode and dentry. Linux always uses inode\n\t// id 2 for ptmx. See fs/devpts/inode.c:mknod_ptmx.\n\tmaster := &masterInode{\n\t\troot: root,\n\t}\n\tmaster.InodeAttrs.Init(ctx, creds, linux.UNNAMED_MAJOR, devMinor, 2, linux.ModeCharacterDevice|0666)\n\n\t// Add the master as a child of the root.\n\tlinks := root.OrderedChildren.Populate(map[string]kernfs.Inode{\n\t\t\"ptmx\": master,\n\t})\n\troot.IncLinks(links)\n\n\treturn fs, &rootD, nil\n}", "title": "" }, { "docid": "c72a28e1642409632f7f76a4d35b1edf", "score": "0.6520708", "text": "func newFilesystemClient(url url.URL, p pipeline.Pipeline) filesystemClient {\n\treturn filesystemClient{newManagementClient(url, p)}\n}", "title": "" }, { "docid": "1cfe997ddc5ca6d5b54ef10108e0f8a0", "score": "0.651412", "text": "func NewFS(files ...*File) *FS {\n\tfs := &FS{\n\t\tl: make([]*File, len(files)),\n\t\tm: make(map[string]*File, len(files)),\n\t}\n\tfor i, file := range files {\n\t\t// Clone file so that the same file can be used with multiple FS instances.\n\t\tclone := &File{}\n\t\t*clone = *file\n\t\tclone.fs = fs\n\t\tfs.m[file.path] = clone\n\t\tfs.l[i] = clone\n\t}\n\treturn fs\n}", "title": "" }, { "docid": "f72b69fb7b9483402610e2e38af30999", "score": "0.64115494", "text": "func NewFs(path string) (Fs, error) {\n\tfsInfo, configName, fsPath, err := ParseRemote(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn fsInfo.NewFs(configName, fsPath)\n}", "title": "" }, { "docid": "95b6a13941f390d858459d1820b2cb16", "score": "0.6402928", "text": "func NewFSObject(\n\thash plumbing.Hash,\n\tfinalType plumbing.ObjectType,\n\toffset int64,\n\tcontentSize int64,\n\tindex idxfile.Index,\n\tfs billy.Filesystem,\n\tpath string,\n\tcache cache.Object,\n) *FSObject {\n\treturn &FSObject{\n\t\thash: hash,\n\t\toffset: offset,\n\t\tsize: contentSize,\n\t\ttyp: finalType,\n\t\tindex: index,\n\t\tfs: fs,\n\t\tpath: path,\n\t\tcache: cache,\n\t}\n}", "title": "" }, { "docid": "72f94c8a5fa6a09736bb86d59dbfa4d0", "score": "0.6361754", "text": "func New(fs afero.Fs, root string, debug bool) billy.Filesystem {\n\t// TODO: rewrite this\n\treturn &Afero{fs: fs, root: root, Debug: debug}\n}", "title": "" }, { "docid": "a190c8deda5d637045a8a17162143836", "score": "0.6282678", "text": "func New(p string) (vfs.FileSystem, error) {\n\tp, err := filepath.Abs(p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp, err = filepath.EvalSymlinks(p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Check if p is an existing directory\n\tst, err := os.Stat(p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !st.IsDir() {\n\t\treturn nil, vfs.ErrNotDirectory\n\t}\n\n\treturn &localFS{p}, nil\n}", "title": "" }, { "docid": "48039522e3827b1cb9c75964a70332a2", "score": "0.62748486", "text": "func NewFileSystem(mount string) (*FileSystem, error) {\n\tmount = filepath.Clean(mount)\n\tif mount == \"\" {\n\t\treturn nil, fmt.Errorf(\"needs a mount point\")\n\t}\n\tif err := mkdir(mount); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &FileSystem{mount: mount}, nil\n}", "title": "" }, { "docid": "4c41ae3547c2bd7d48f6726d75b3e5a7", "score": "0.62651837", "text": "func OSFS() VFS {\n\treturn osFS{}\n}", "title": "" }, { "docid": "1eae3ffab3241c26904cb72cb9487939", "score": "0.62517846", "text": "func NewFilesystemService(conf *config.Config, l gklog.Logger, metrics *statsd.Client, w utils.Wrapper) FSServicer {\n\treturn &fsService{\n\t\tlogger: l,\n\t\tconf: conf,\n\t\twrapper: w,\n\t\tmetrics: metrics,\n\t}\n}", "title": "" }, { "docid": "53969d97d1405bb953cb3918d83c6aeb", "score": "0.62510496", "text": "func New(fsType, device string) (Filesystem, error) {\n\tp, err := filepath.EvalSymlinks(device)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp, err = filepath.Abs(p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar st unix.Stat_t\n\tif err := unix.Stat(p, &st); err != nil {\n\t\treturn nil, err\n\t}\n\tif (st.Mode & unix.S_IFMT) != unix.S_IFBLK {\n\t\treturn nil, ErrNonBlockDevice\n\t}\n\n\tnewFS, ok := fsTypeMap[fsType]\n\tif !ok {\n\t\treturn nil, ErrUnsupportedFilesystem\n\t}\n\n\treturn newFS(p), nil\n}", "title": "" }, { "docid": "f30f69b832e0cd2ee9dc840f362081c1", "score": "0.6236046", "text": "func LocalFS() Filesystem {\n\treturn localFS{}\n}", "title": "" }, { "docid": "738763203930306ccb5824b8efc8c0c7", "score": "0.62351334", "text": "func New(device fs.BlockDevice) (*FileSystem, error) {\n\tbs, err := DecodeBootSector(device)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfat, err := DecodeFAT(device, bs, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar rootDir *DirectoryCluster\n\tif bs.FATType() == FAT32 {\n\t\tpanic(\"FAT32 not implemented yet\")\n\t} else {\n\t\trootDir, err = DecodeFAT16RootDirectoryCluster(device, bs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tresult := &FileSystem{\n\t\tbs: bs,\n\t\tdevice: device,\n\t\tfat: fat,\n\t\trootDir: rootDir,\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "7f2622899f87ad2f7d28081a6ced0eac", "score": "0.6220453", "text": "func New(ctx context.Context, path string) (Interface, error) {\n\tscheme := getScheme(path)\n\tmkfs, ok := registry[scheme]\n\tif !ok {\n\t\treturn nil, errorForMissingScheme(scheme, path)\n\t}\n\treturn mkfs(ctx), nil\n}", "title": "" }, { "docid": "edfc4a95d82ff6afe6d3240be9e17edf", "score": "0.62193656", "text": "func (mc *MCleanService) NewTFS(config []byte) error {\n\tvar fs filesystem\n\n\tif err := yaml.Unmarshal(config, &fs); err != nil {\n\t\treturn err\n\t}\n\n\t//for TimeFileSystem Get information for all files in log directory matching regex and add it to the slice of cleanservice interface\n\tfor _, item := range fs.Timefs {\n\t\titem.Log.setLogInfo()\n\t\t*mc = append(*mc, item)\n\t}\n\n\t//For ThresholdFileSystem Get information for all files in the log directories if the threshold of the mountpoint is exceeded\n\tfor _, item := range fs.Thresholdfs {\n\t\tif item.getPercentUsed() > item.Threshold {\n\t\t\titem.Log.setLogInfo()\n\t\t\t*mc = append(*mc, item)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d9d71a0a6d7073e6f62ff28f00dd4c70", "score": "0.62187207", "text": "func New(fs vfs.FileSystem, gateCh chan bool) vfs.FileSystem {\n\tif cap(gateCh) == 0 {\n\t\treturn fs\n\t}\n\treturn gatefs{fs, gate(gateCh)}\n}", "title": "" }, { "docid": "476cb4d5bc6e53c94a8c369ee0cc0f6b", "score": "0.6212537", "text": "func NewFilesystem(vfsObj *vfs.VirtualFilesystem) (*vfs.Filesystem, error) {\n\tdevMinor, err := vfsObj.GetAnonBlockDevMinor()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfs := &filesystem{\n\t\tdevMinor: devMinor,\n\t}\n\tfs.Filesystem.VFSFilesystem().Init(vfsObj, filesystemType{}, fs)\n\treturn fs.Filesystem.VFSFilesystem(), nil\n}", "title": "" }, { "docid": "19559331cf66a15f28ea21ac826ef8b5", "score": "0.6199563", "text": "func New(path string) (Client, error) {\n\troot, err := fs.MountRoot(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tname, err := getFsName(root.Path())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tid, err := getFsID(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &fsClient{root: root,\n\t\tfsName: name,\n\t\tfsID: id,\n\t}, nil\n}", "title": "" }, { "docid": "31debc492e1250e73373ca787184e298", "score": "0.61911976", "text": "func newFSLoaderFactory(namespaces []string, fs http.FileSystem) *fsLoaderFactory {\n\treturn &fsLoaderFactory{\n\t\tnamespaces: namespaces,\n\t\tfs: fs,\n\t}\n}", "title": "" }, { "docid": "3ddf63007945abb552d5d6e15fc0c8bb", "score": "0.61852473", "text": "func NewFileSystem() FileSystem {\n\treturn &fs{\n\t\tfileModes: make(map[string]os.FileMode),\n\t\tkeepSymlinks: false,\n\t}\n}", "title": "" }, { "docid": "3448060de67ca67e77e8a47110cae883", "score": "0.61796623", "text": "func NewFileSystem(basePath string) service.FileSystem {\n\treturn &fileSystem{basePath}\n}", "title": "" }, { "docid": "7992275305a9e937bfe8d45a598a6d12", "score": "0.61709785", "text": "func NewRealFilesystem() Filesystem {\n\treturn realFilesystem{}\n}", "title": "" }, { "docid": "ace1d8a165b227b4156643cce9eff749", "score": "0.6126128", "text": "func NewFSObj(path string, info os.FileInfo, root bool, logger *zap.Logger) (*FilesystemObject, error) {\n\tpathField := zap.String(PathKey, path)\n\tfso := FilesystemObject{\n\t\tPath: path,\n\t\tSize: info.Size(),\n\t\tModTime: info.ModTime(),\n\t\tMode: info.Mode(),\n\t\tRoot: root,\n\t\tIsDir: info.IsDir(),\n\t\tChildren: []*FilesystemObject{},\n\t\tlogger: logger,\n\t\tpathField: pathField,\n\t}\n\n\tif !fso.IsDir && fso.Mode.IsRegular() {\n\t\terr := fso.DetectContentType()\n\t\tif err != nil {\n\t\t\tlogger.Error(\"couldn't detect content-type\", pathField, zap.Error(err))\n\t\t\treturn &FilesystemObject{}, fmt.Errorf(\"couldn't detect content-type for %s: %w\", fso.Path, err)\n\t\t}\n\t}\n\n\treturn &fso, nil\n}", "title": "" }, { "docid": "e53181f24a7326972bb66ebf36f19b02", "score": "0.611913", "text": "func NewFileSystem(ctx *pulumi.Context,\n\tname string, args *FileSystemArgs, opts ...pulumi.ResourceOption) (*FileSystem, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.FileSystemName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'FileSystemName'\")\n\t}\n\tif args.ProtocolType == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ProtocolType'\")\n\t}\n\tif args.SpaceCapacity == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'SpaceCapacity'\")\n\t}\n\tif args.StorageType == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'StorageType'\")\n\t}\n\tif args.ZoneId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ZoneId'\")\n\t}\n\tif args.ThroughputMode != nil {\n\t\targs.ThroughputMode = pulumi.ToSecret(args.ThroughputMode).(pulumi.StringPtrInput)\n\t}\n\tsecrets := pulumi.AdditionalSecretOutputs([]string{\n\t\t\"throughputMode\",\n\t})\n\topts = append(opts, secrets)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource FileSystem\n\terr := ctx.RegisterResource(\"alicloud:dfs/fileSystem:FileSystem\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "5bfdb9471a4d38ae6e0e3e28e6f648e5", "score": "0.6081662", "text": "func New(name string) (fs *FileSystem, err error) {\n\tfs = new(FileSystem)\n\tif name == \"\" {\n\t\terr = errors.New(\"database must have name\")\n\t\treturn\n\t}\n\tfs.Name = name\n\n\tfs.DB, err = sql.Open(\"sqlite3\", fs.Name)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = fs.InitializeDB(true)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"could not initialize\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "bc65d5320943aff9b945f3668d0b5bfb", "score": "0.6057975", "text": "func NewFs(dir string, mode os.FileMode) (*StandardFS, error) {\n\tfs := &StandardFS{\n\t\troot: dir,\n\t\tinit: func() error {\n\t\t\treturn os.MkdirAll(dir, mode)\n\t\t},\n\t\tEncodeKey: B64OrMD5HashEncodeKey,\n\t\tDecodeKey: B64DecodeKey,\n\t}\n\treturn fs, fs.init()\n}", "title": "" }, { "docid": "db1490e8e6729ea21ccbf01af8108f34", "score": "0.60566884", "text": "func New(indexDir string, blobDir *fdio.Directory) (*Filesystem, error) {\n\tbm, err := blobfs.New(blobDir)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"pkgfs: open blobfs: %s\", err)\n\t}\n\n\tstatic := index.NewStatic()\n\tf := &Filesystem{\n\t\tstatic: static,\n\t\tindex: index.NewDynamic(indexDir, static),\n\t\tblobfs: bm,\n\t\tmountInfo: mountInfo{\n\t\t\tparentFd: -1,\n\t\t},\n\t}\n\n\tf.root = &rootDirectory{\n\t\tunsupportedDirectory: unsupportedDirectory(\"/\"),\n\t\tfs: f,\n\n\t\tdirs: map[string]fs.Directory{\n\t\t\t\"ctl\": &ctlDirectory{\n\t\t\t\tunsupportedDirectory: unsupportedDirectory(\"/ctl\"),\n\t\t\t\tfs: f,\n\t\t\t\tdirs: map[string]fs.Directory{\n\t\t\t\t\t\"garbage\": unsupportedDirectory(\"/ctl/garbage\"),\n\t\t\t\t\t\"validation\": &validationDir{\n\t\t\t\t\t\tunsupportedDirectory: unsupportedDirectory(\"/ctl/validation\"),\n\t\t\t\t\t\tfs: f,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"install\": &installDir{\n\t\t\t\tunsupportedDirectory: unsupportedDirectory(\"/install\"),\n\t\t\t\tfs: f,\n\t\t\t},\n\t\t\t\"needs\": &needsRoot{\n\t\t\t\tunsupportedDirectory: unsupportedDirectory(\"/needs\"),\n\t\t\t\tfs: f,\n\t\t\t},\n\t\t\t\"packages\": &packagesRoot{\n\t\t\t\tunsupportedDirectory: unsupportedDirectory(\"/packages\"),\n\t\t\t\tfs: f,\n\t\t\t},\n\t\t\t\"versions\": &versionsDirectory{\n\t\t\t\tunsupportedDirectory: unsupportedDirectory(\"/versions\"),\n\t\t\t\tfs: f,\n\t\t\t},\n\t\t\t\"system\": unsupportedDirectory(\"/system\"),\n\t\t},\n\t}\n\n\treturn f, nil\n}", "title": "" }, { "docid": "46f522e377568eec6ec87f9cdfa0561b", "score": "0.60485816", "text": "func FS() embed.FS { return fs }", "title": "" }, { "docid": "1112b0fee99c88f4413acd03e3608904", "score": "0.6042479", "text": "func TestNewFS(t *testing.T) {\n\t// Do not attempt to create this path, the test validates\n\t// so that newFSObjects initializes non existing paths\n\t// and successfully returns initialized object layer.\n\tdisk := filepath.Join(os.TempDir(), \"minio-\"+nextSuffix())\n\tdefer removeAll(disk)\n\n\t// Initializes single disk, validate if there is no error.\n\t_, err := newFSObjects(disk)\n\tif err != nil {\n\t\tt.Fatalf(\"Unable to initialize erasure, %s\", err)\n\t}\n}", "title": "" }, { "docid": "763b493e489537228c6113587d9dc788", "score": "0.60126024", "text": "func Open(filename string) FileSystem,error {\n\tresult := new(fileSystemImpl)\n\tresult.mFaile,err := mmapfile.NewFile(filename)\n\t\n\tif err != nil {\n\t\treturn nil,errors.New(\"Could not open filesystem: \" + err.Error())\n\t}\n\n\treturn result,nil\n}", "title": "" }, { "docid": "eb5fe216bf96d41627182cb53fc430d2", "score": "0.5995484", "text": "func FS(useLocal bool) http.FileSystem {\n\tif useLocal {\n\t\treturn local\n\t}\n\treturn static\n}", "title": "" }, { "docid": "eb5fe216bf96d41627182cb53fc430d2", "score": "0.5995484", "text": "func FS(useLocal bool) http.FileSystem {\n\tif useLocal {\n\t\treturn local\n\t}\n\treturn static\n}", "title": "" }, { "docid": "8bb43d1c99a7ae8e946530dbf110cab6", "score": "0.5989603", "text": "func New(fs afero.Fs) afero.Fs {\n\treturn &secureFs{\n\t\tfs: fs,\n\t}\n}", "title": "" }, { "docid": "948f233812d7dbf5f8a421f6faf8e098", "score": "0.5988649", "text": "func (frame *Framework) NewStaticFS(pattern string, fs http.FileSystem) *MuxAPI {\r\n\treturn frame.NewNamedStaticFS(\"\", pattern, fs)\r\n}", "title": "" }, { "docid": "c282b92aa48f14ad2159f0c3a661eb1e", "score": "0.5925221", "text": "func NewFileSystem() FileSystem {\n\tswitch os.Getenv(\"FILE_PROVIDER\") {\n\tcase \"s3\":\n\t\treturn NewS3FileSystem(\n\t\t\tsys.EnvOrDefault(\"S3_REGION\", \"eu-west-1\"),\n\t\t\tsys.EnvOrDefault(\"S3_BUCKET\", \"butter\"),\n\t\t\t&credentials.EnvProvider{},\n\t\t)\n\tcase \"os\":\n\t\treturn NewOSFileSystem()\n\t}\n\n\treturn NewOSFileSystem()\n}", "title": "" }, { "docid": "6b17ab5fb84dc084549f82e9f155d27f", "score": "0.59136146", "text": "func New() *Fs {\n\troot := &file{\n\t\tname: \"/\",\n\t\tpath: \"/\",\n\t\tisDir: true,\n\t\tchildren: make(Children),\n\t\tparent: nil,\n\t}\n\n\treturn &Fs{\n\t\troot: root,\n\t\tcurrentDir: root,\n\t}\n}", "title": "" }, { "docid": "d7cdc5f959c8c1da0d2e3db51d155957", "score": "0.58992857", "text": "func NewFilesystemWrapper() FilesystemWrapper {\n\treturn &filesystemWrapper{}\n}", "title": "" }, { "docid": "566e88ebdd52cc1fb7b8f2d82749351f", "score": "0.58930963", "text": "func NewFileSystem(hdfsAccessor HdfsAccessor, mountPoint string, allowedPrefixes []string, expandZips bool, clock Clock) (*FileSystem, error) {\n\treturn &FileSystem{HdfsAccessor: hdfsAccessor, MountPoint: mountPoint, Mounted: false, AllowedPrefixes: allowedPrefixes, ExpandZips: expandZips, Clock: clock}, nil\n}", "title": "" }, { "docid": "de41b1f9495e4f49719f2f19a0da758b", "score": "0.5880661", "text": "func NewFilesystemMachine(cfg *FsConfig) *FsMachine {\n\t// initialize the FsMachine with a filesystem struct that has bare minimum\n\t// information (just the filesystem id) required to get started\n\tzfsInter, err := zfs.NewZFS(cfg.ZFSPath, cfg.ZPoolPath, cfg.PoolName, cfg.MountZFS)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed initialising zfs interface, %s\", err.Error())\n\t}\n\treturn &FsMachine{\n\t\tconfig: cfg.Config,\n\t\tfilesystem: &types.Filesystem{\n\t\t\tId: cfg.FilesystemID,\n\t\t},\n\t\t// stored here as well to avoid excessive locking on filesystem struct,\n\t\t// which gets clobbered, just to read its id\n\t\tfilesystemId: cfg.FilesystemID,\n\t\trequests: make(chan *types.Event),\n\t\tinnerRequests: make(chan *types.Event),\n\t\tinnerResponses: make(chan *types.Event),\n\t\tfileInputIO: make(chan *types.InputFile),\n\t\tfileOutputIO: make(chan *types.OutputFile),\n\t\tfileStatIO: make(chan *types.OutputFile),\n\t\tresponses: map[string]chan *types.Event{},\n\t\tresponsesLock: &sync.Mutex{},\n\t\tsnapshotsModified: make(chan bool),\n\t\tcontainerClient: cfg.ContainerClient,\n\t\tregistryStore: cfg.RegistryStore,\n\t\tserverStore: cfg.ServerStore,\n\t\tfilesystemStore: cfg.FilesystemStore,\n\t\tstate: cfg.StateManager,\n\t\tuserManager: cfg.UserManager,\n\t\tregistry: cfg.Registry,\n\t\tnewSnapsOnMaster: cfg.NewSnapsOnMaster,\n\t\tlocalReceiveProgress: cfg.LocalReceiveProgress,\n\t\tsnapshotsLock: &sync.Mutex{},\n\t\tnewSnapsOnServers: observer.NewObserver(fmt.Sprintf(\"newSnapsOnServers:%s\", cfg.FilesystemID)),\n\t\tcurrentState: \"discovering\",\n\t\tstatus: \"\",\n\t\tlastTransitionTimestamp: time.Now().UnixNano(),\n\t\ttransitionObserver: observer.NewObserver(fmt.Sprintf(\"transitionObserver:%s\", cfg.FilesystemID)),\n\t\tlastTransferRequest: types.TransferRequest{},\n\t\tdeathObserver: cfg.DeathObserver,\n\n\t\tstateMachineMetadata: make(map[string]map[string]string),\n\t\tstateMachineMetadataMu: &sync.RWMutex{},\n\n\t\tsnapshotCache: make(map[string][]*types.Snapshot),\n\t\tsnapshotCacheMu: &sync.RWMutex{},\n\t\t// In the case where we're receiving a push (pushPeerState), it's the\n\t\t// POST handler on our http server which handles the receiving of the\n\t\t// snapshot. We need to coordinate with it so that we know when to\n\t\t// reload the list of snapshots, update etcd and coordinate our own\n\t\t// state changes, which we do via the POST handler sending on this\n\t\t// channel.\n\t\tpushCompleted: make(chan bool),\n\t\tdirtyDelta: 0,\n\t\tsizeBytes: 0,\n\t\ttransferUpdates: make(chan types.TransferUpdate),\n\n\t\tfilesystemMetadataTimeout: cfg.FilesystemMetadataTimeout,\n\t\tzfs: zfsInter,\n\t}\n}", "title": "" }, { "docid": "e52f6ac8b6352d88d82fef455afffffa", "score": "0.5879784", "text": "func NewFromFS(fsys fs.FS) (Context, error) {\n\tvar ctx Context\n\tctx.init(fsys)\n\n\tif _, err := fs.Stat(fsys, \"ls-R\"); err == nil {\n\t\tdb, err := fsys.Open(\"ls-R\")\n\t\tif err != nil {\n\t\t\treturn ctx, fmt.Errorf(\"kpath: could not open db file: %w\", err)\n\t\t}\n\t\tdefer db.Close()\n\t\treturn newFromDB(fsys, db)\n\t}\n\n\terr := fs.WalkDir(fsys, \".\", func(path string, d fs.DirEntry, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif d.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tfname := stdpath.Base(path)\n\t\tctx.db[fname] = append(ctx.db[fname], path)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn ctx, fmt.Errorf(\"kpath: could not walk fs: %w\", err)\n\t}\n\n\treturn ctx, nil\n}", "title": "" }, { "docid": "b143a726867eabc105c4dff2d5a3229b", "score": "0.58672035", "text": "func NewOSFileSystem() *OSFileSystem {\n\treturn &OSFileSystem{\n\t\t&osFS{},\n\t}\n}", "title": "" }, { "docid": "90266be559299915b6093533a480edbd", "score": "0.5851618", "text": "func NewFs(root string, pattern Pattern) *Fs {\n\treturn &Fs{\n\t\troot: root,\n\t\tpattern: pattern,\n\t}\n}", "title": "" }, { "docid": "ede0e30977b743c4d0f2aaa63b3343df", "score": "0.5841416", "text": "func newFilesystemMachine(filesystemId string, s *InMemoryState) *fsMachine {\n\t// initialize the fsMachine with a filesystem struct that has bare minimum\n\t// information (just the filesystem id) required to get started\n\treturn &fsMachine{\n\t\tfilesystem: &filesystem{\n\t\t\tid: filesystemId,\n\t\t},\n\t\t// stored here as well to avoid excessive locking on filesystem struct,\n\t\t// which gets clobbered, just to read its id\n\t\tfilesystemId: filesystemId,\n\t\trequests: make(chan *Event),\n\t\tinnerRequests: make(chan *Event),\n\t\tinnerResponses: make(chan *Event),\n\t\tfileIO: make(chan *File),\n\t\tresponses: map[string]chan *Event{},\n\t\tresponsesLock: &sync.Mutex{},\n\t\tsnapshotsModified: make(chan bool),\n\t\tstate: s,\n\t\tsnapshotsLock: &sync.Mutex{},\n\t\tnewSnapsOnServers: NewObserver(fmt.Sprintf(\"newSnapsOnServers:%s\", filesystemId)),\n\t\tcurrentState: \"discovering\",\n\t\tstatus: \"\",\n\t\tlastTransitionTimestamp: time.Now().UnixNano(),\n\t\ttransitionObserver: NewObserver(fmt.Sprintf(\"transitionObserver:%s\", filesystemId)),\n\t\tlastTransferRequest: types.TransferRequest{},\n\t\t// In the case where we're receiving a push (pushPeerState), it's the\n\t\t// POST handler on our http server which handles the receiving of the\n\t\t// snapshot. We need to coordinate with it so that we know when to\n\t\t// reload the list of snapshots, update etcd and coordinate our own\n\t\t// state changes, which we do via the POST handler sending on this\n\t\t// channel.\n\t\tpushCompleted: make(chan bool),\n\t\tdirtyDelta: 0,\n\t\tsizeBytes: 0,\n\t\ttransferUpdates: make(chan TransferUpdate),\n\t}\n}", "title": "" }, { "docid": "cf809f30926562391d46981b43033922", "score": "0.5840159", "text": "func NewMountedFS(localBuckets, cloudBuckets string) *MountedFS {\n\treturn &MountedFS{\n\t\tfsIDs: make(map[syscall.Fsid]string),\n\t\tcheckFsID: true,\n\t\tlocalBuckets: localBuckets,\n\t\tcloudBuckets: cloudBuckets,\n\t}\n}", "title": "" }, { "docid": "5ed857a8e0f0994708d459d6ca541948", "score": "0.58323485", "text": "func (fs *fServer) newRef(p string) (*FileRef, error) {\n\tfpath, err := fs.fullPath(p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinfo, err := os.Stat(fpath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &FileRef{fs: fs, Path: p, Info: dirFromInfo(info)}, nil\n}", "title": "" }, { "docid": "b522cbbc7bae9b3138543cd988dd62ce", "score": "0.58176106", "text": "func newVFs(c *K8sCniCncfIoV1Client) *vFs {\n\treturn &vFs{\n\t\tclient: c.RESTClient(),\n\t}\n}", "title": "" }, { "docid": "bd11e19cbc8a1cb97e68877584824dcf", "score": "0.58019835", "text": "func NewDefaultFS() (FS, error) {\n\treturn NewFS(fs.DefaultProcMountPoint, fs.DefaultSysMountPoint)\n}", "title": "" }, { "docid": "a95a932d47f34b39432bda5cabb2e7d5", "score": "0.57811177", "text": "func New() billy.Filesystem {\n\tfs := &Memory{s: NewMemoryStorage()}\n\treturn chroot.New(fs, string(separator))\n}", "title": "" }, { "docid": "94dcfc253157a02a164f061da566d3eb", "score": "0.5765738", "text": "func (c Creator) CreateFileSystem() *afero.Afero {\n\treturn c.fileSystem\n}", "title": "" }, { "docid": "8455a5251d9e0620108eba722eea5245", "score": "0.5719381", "text": "func getNewAPI(path string, anonymous bool) API {\n\t// ignore errors for now\n\tfs, err := fs.New(path)\n\tfatalIf(err.Trace(), \"Instantiating filesystem failed.\", nil)\n\n\treturn API{\n\t\tFilesystem: fs,\n\t\tAnonymous: anonymous,\n\t}\n}", "title": "" }, { "docid": "8176bcfae8be455307d390ed88535d1a", "score": "0.57131886", "text": "func NewMultiFS(fs ...FS) FS {\n\treturn MultiFS(fs)\n}", "title": "" }, { "docid": "a0002c61c69e7056f162edd34a6991f7", "score": "0.5690557", "text": "func New(opts *Options, checker sys.SystemChecker, fs Fs, command Commander) *FsRepo {\n\toptions := DefaultOptions\n\n\tif opts != nil {\n\t\t_ = mergo.Merge(&options, opts, mergo.WithOverride)\n\t}\n\n\tutil.Must(fs.MkdirAll(options.BasePath, os.ModePerm))\n\n\tr := FsRepo{\n\t\tstoreID: util.GenerateKey(),\n\t\toptions: &options,\n\t\tsys: checker,\n\t\tfs: fs,\n\t\tcommand: command,\n\t\tpermStore: make(map[string]string),\n\t\tvolumes: make(map[string]*Volume),\n\t\tstoreLocks: make(map[string]chan struct{}),\n\t}\n\n\tr.fileCache = cache.NewLRUCache(\n\t\ttrue,\n\t\tcache.WithTTL(options.TTL),\n\t\tcache.WithCleanupInterval(options.CleanupInterval),\n\t\tcache.WithCapacity(options.Capacity),\n\t)\n\n\tr.fileCache.OnValueEvicted(r.onValueEvictedHandler)\n\n\treturn &r\n}", "title": "" }, { "docid": "0ecd30df4886273aba3b539b6a92e89b", "score": "0.567505", "text": "func (rfs *FilesystemOperation) FSCreate(name, namespace string, callAPI bool, k8sh *utils.K8sHelper) error {\n\tcreateFilesystem := model.FilesystemRequest{\n\t\tName: name,\n\t\tMetadataPool: model.Pool{ReplicatedConfig: model.ReplicatedPoolConfig{Size: 1}},\n\t\tDataPools: []model.Pool{\n\t\t\t{ReplicatedConfig: model.ReplicatedPoolConfig{Size: 1}},\n\t\t},\n\t\tMetadataServer: model.MetadataServer{\n\t\t\tActiveCount: 1,\n\t\t},\n\t}\n\n\tif callAPI {\n\t\tlogger.Infof(\"creating the filesystem via the rest API\")\n\t\tif _, err := rfs.restClient.CreateFilesystem(createFilesystem); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tlogger.Infof(\"creating the filesystem via CRD\")\n\t\tfsSpec := fmt.Sprintf(`apiVersion: rook.io/v1alpha1\nkind: Filesystem\nmetadata:\n name: %s\n namespace: %s\nspec:\n metadataPool:\n replicated:\n size: 1\n dataPools:\n - replicated:\n size: 1\n metadataServer:\n activeCount: 1\n activeStandby: true\n`, name, namespace)\n\n\t\tif _, err := k8sh.ResourceOperation(\"create\", fsSpec); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlogger.Infof(\"Make sure rook-ceph-mds pod is running\")\n\tassert.True(k8sh.T(), k8sh.IsPodWithLabelRunning(fmt.Sprintf(\"rook_file_system=%s\", name), namespace))\n\n\tassert.True(k8sh.T(), k8sh.CheckPodCountAndState(\"rook-ceph-mds\", namespace, 2, \"Running\"),\n\t\t\"Make sure there are two rook-ceph-mds pods present in Running state\")\n\n\treturn nil\n}", "title": "" }, { "docid": "fc0a068aa57188d48f5072cbf5115da6", "score": "0.5672926", "text": "func New(path string) (client.Client, *probe.Error) {\n\tif strings.TrimSpace(path) == \"\" {\n\t\treturn nil, probe.NewError(client.EmptyPath{})\n\t}\n\treturn &fsClient{\n\t\tPathURL: client.NewURL(normalizePath(path)),\n\t}, nil\n}", "title": "" }, { "docid": "55b8fdfe890944e9ba2ef0472dbb2ae6", "score": "0.5659916", "text": "func NewVFileSystem(ctx context.Context, fsOps spacefs.FSOps) *VFS {\n\treturn &VFS{\n\t\t// storing ctx here to be used in the Root request\n\t\t// as FUSE doesn't provide one there\n\t\tctx: ctx,\n\t\tfsOps: fsOps,\n\t\tmountConnection: nil,\n\t}\n}", "title": "" }, { "docid": "cc3969463b01d6b213e0411b2c63a307", "score": "0.5652474", "text": "func (dfs DFSInstance) Open(fname string, mode FileMode) (f DFSFile, err error) {\n\t//check if fname is valid\n\t//check if file exists locally\n\tvar newFile DFSFile\n\tvar fileExistsGlobal bool\n\n\tswitch mode {\n\n\tcase READ:\n\t\tfmt.Println(\"In READ\")\n\t\tfileExistsGlobal, err = dfs.GlobalFileExists(fname)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif fileExistsGlobal == false {\n\t\t\treturn nil, FileUnavailableError(fname)\n\t\t}\n\t\tnewFile, err = dfs.fetchFile(fname, mode)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"2\", err)\n\t\t\treturn nil, err\n\n\t\t}\n\t\t// return file handle\n\t\treturn newFile, nil\n\n\tcase WRITE:\n\t\t//create file if file does not exist locally\n\t\tfmt.Println(\"In WRITE\")\n\t\tfileExistsGlobal, err = dfs.GlobalFileExists(fname)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif fileExistsGlobal == true {\n\t\t\tnewFile, err = dfs.fetchFile(fname, mode)\n\t\t\tif newFile == nil {\n\t\t\t\tnewFile, err = createFile(fname, &dfs, mode)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tnewFile, err = createFile(fname, &dfs, mode)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\terr = dfs.checkWriteContention(fname, mode)\n\t\tcheckError(\"checkWriteContention\", err, false)\n\t\t// return file handle\n\t\treturn newFile, nil\n\n\tdefault:\n\t\tfmt.Println(\"In DREAD\")\n\t\tvar fileExistsLocal bool\n\t\tfileExistsLocal, err = dfs.LocalFileExists(fname)\n\t\tif err != nil {\n\t\t\treturn nil, FileUnavailableError(fname)\n\t\t}\n\t\t// file does not exist locally, throw error\n\t\tif fileExistsLocal == false {\n\t\t\treturn nil, FileDoesNotExistError(fname)\n\t\t}\n\t\t//fetch local copy\n\t\tnewFile, err = openLocalFile(fname, dfs.LocalPath, &dfs, mode)\n\t\tif err != nil {\n\t\t}\n\t\t//= FileInstance{Name: fname, Copy: nil, DFS: &dfs, Mode: mode}\n\t\treturn newFile, nil\n\t}\n}", "title": "" }, { "docid": "38acbd023a889cc337aa4f0571830805", "score": "0.56461716", "text": "func NewNFS(path string) Blobstore {\n\treturn &nfsStore{\n\t\tpath: path,\n\t}\n}", "title": "" }, { "docid": "4bdc2d8cbe04b1064a28401ad642df4c", "score": "0.5635471", "text": "func NewFSObjectClient(cfg FSConfig) (chunk.ObjectClient, error) {\n\tif err := ensureDirectory(cfg.Directory); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &fsObjectClient{\n\t\tcfg: cfg,\n\t}, nil\n}", "title": "" }, { "docid": "e8af65c661f2bedebef51e46d8036279", "score": "0.56321806", "text": "func NewFSWatcher(svcSet *handlers.ServiceSet, generateID handlers.IDGenerator) (*FSWatcher, error) {\n\twatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &FSWatcher{\n\t\twatcher: watcher,\n\t\tsvcSet: svcSet,\n\t\tgenerateID: generateID,\n\t}, nil\n}", "title": "" }, { "docid": "e48193e60d289fd96ed5a0d0a24e903f", "score": "0.560431", "text": "func Create() *FileSystem {\n\treturn &FileSystem{\n\t\tobjs: map[string]object{},\n\t\tdirs: map[string][]string{\".\": nil},\n\t}\n}", "title": "" }, { "docid": "68850f527f9240afb38814deb254cf95", "score": "0.5596377", "text": "func newFUSEConnection(_ context.Context, fd *vfs.FileDescription, maxInFlightRequests uint64) (*connection, error) {\n\t// Mark the device as ready so it can be used. /dev/fuse can only be used if the FD was used to\n\t// mount a FUSE filesystem.\n\tfuseFD := fd.Impl().(*DeviceFD)\n\tfuseFD.mounted = true\n\n\t// Create the writeBuf for the header to be stored in.\n\thdrLen := uint32((*linux.FUSEHeaderOut)(nil).SizeBytes())\n\tfuseFD.writeBuf = make([]byte, hdrLen)\n\tfuseFD.completions = make(map[linux.FUSEOpID]*futureResponse)\n\tfuseFD.fullQueueCh = make(chan struct{}, maxInFlightRequests)\n\tfuseFD.writeCursor = 0\n\n\treturn &connection{\n\t\tfd: fuseFD,\n\t\tmaxBackground: fuseDefaultMaxBackground,\n\t\tcongestionThreshold: fuseDefaultCongestionThreshold,\n\t\tmaxPages: fuseDefaultMaxPagesPerReq,\n\t\tinitializedChan: make(chan struct{}),\n\t\tconnected: true,\n\t}, nil\n}", "title": "" }, { "docid": "3842e1e94d6dfce01d0a93f2600c0dcf", "score": "0.55815274", "text": "func (l *Local) Fs() filesystem.Interface {\n\treturn l.fs\n}", "title": "" }, { "docid": "e05ba288d94668448f3b907d2cdef243", "score": "0.55813235", "text": "func NewStaticFS(pattern string, fs http.FileSystem) *MuxAPI {\r\n\treturn defaultFramework.NewStaticFS(pattern, fs)\r\n}", "title": "" }, { "docid": "521eef3750184c287270d886bcd8fff0", "score": "0.55717826", "text": "func newFile(d *Dir, o fs.Object) *File {\n\treturn &File{\n\t\td: d,\n\t\to: o,\n\t}\n}", "title": "" }, { "docid": "0d3ae708db8ca3804053fb3e213bf6ac", "score": "0.55607975", "text": "func New(accessToken string, cacheTimeout time.Duration) *DropboxFileSystem {\n\tdbfs := &DropboxFileSystem{\n\t\tprefix: Prefix + fsimpl.RandomString(),\n\t\tclient: dropbox.New(dropbox.NewConfig(accessToken)),\n\t\tfileInfoCache: fs.NewFileInfoCache(cacheTimeout),\n\t}\n\tfs.Register(dbfs)\n\treturn dbfs\n}", "title": "" }, { "docid": "b6085ce32ea65f5fd1da02f1be2de63f", "score": "0.555768", "text": "func getNewCloudStorageAPI(conf cloudServerConfig) CloudStorageAPI {\n\tfs, err := fs.New()\n\tfatalIf(err.Trace(), \"Instantiating filesystem failed.\", nil)\n\n\tfs.SetRootPath(conf.Path)\n\tfs.SetMinFreeDisk(conf.MinFreeDisk)\n\tif conf.Expiry > 0 {\n\t\tgo fs.AutoExpiryThread(conf.Expiry)\n\t}\n\treturn CloudStorageAPI{\n\t\tFilesystem: fs,\n\t\tAnonymous: conf.Anonymous,\n\t\tAccessLog: conf.AccessLog,\n\t}\n}", "title": "" }, { "docid": "066c4afd2895f7c2fef556fec9adae8b", "score": "0.5549973", "text": "func New(url string) (*S3FileSystem, error) {\n\tauth, err := auth()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconfig, err := config(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tregion := aws.Regions[config.region]\n\tservice := s3.New(*auth, region)\n\n\ts3fs := &S3FileSystem{\n\t\tauth: auth,\n\t\ts3service: service,\n\t\turl: url,\n\t\tconfig: config,\n\t\tbucket: service.Bucket(config.bucket),\n\t}\n\treturn s3fs, nil\n}", "title": "" }, { "docid": "81bc001156471b3f6a2af071e4f35db3", "score": "0.55393887", "text": "func (cfs CFS) newFileNode() *Node {\n\treturn &Node{\n\t\tcfs: cfs,\n\t\tID: cfs.newUniqueID(),\n\t\tMode: defaultPerms,\n\t}\n}", "title": "" }, { "docid": "7083a88f8fea424c7b27053d2af602e1", "score": "0.5527327", "text": "func New(fs http.FileSystem, t time.Time) http.FileSystem {\n\treturn &timefs{fs: fs, t: t}\n}", "title": "" }, { "docid": "b69b4bfb8afcbcd29f6739fc42b97586", "score": "0.549434", "text": "func NewMemFS() *MemFS {\n\treturn &MemFS{\n\t\tcontent: make(map[string]*memFile),\n\t}\n}", "title": "" }, { "docid": "c58e0f469d4c86f25f8764be18300100", "score": "0.5490195", "text": "func (chapiClient *Client) CreateFilesystem(device *model.Device, vol *model.Volume, filesystem string) (err error) {\n\tlog.Tracef(\"CreateFilesystem called for %s and filesystem %s\", device.MpathName, filesystem)\n\t// fetch host ID\n\terr = chapiClient.cacheHostID()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcreateFSURI := fmt.Sprintf(CreateFSURIfmt, fmt.Sprintf(HostURIfmt, chapiClient.hostID), device.SerialNumber, filesystem)\n\n\tvar errResp *ErrorResponse\n\tvar dev *model.Device\n\tvar chapiResp Response\n\tchapiResp.Data = &dev\n\tchapiResp.Err = &errResp\n\t_, err = chapiClient.client.DoJSON(&connectivity.Request{Action: \"PUT\", Path: createFSURI, Header: chapiClient.header, Payload: nil, Response: &chapiResp, ResponseError: &chapiResp})\n\tif err != nil {\n\t\tif errResp != nil {\n\t\t\tlog.Error(errResp.Info)\n\t\t\treturn errors.New(errResp.Info)\n\t\t}\n\t\tlog.Error(\"CreateFilesystem Err :\", err.Error())\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d172bbb35771ce9130690874e7174e2f", "score": "0.54548895", "text": "func (f *FS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.StatfsResponse) (err error) {\n\tdefer log.Trace(\"\", \"\")(\"stat=%+v, err=%v\", resp, &err)\n\tconst blockSize = 4096\n\ttotal, _, free := f.VFS.Statfs()\n\tresp.Blocks = uint64(total) / blockSize // Total data blocks in file system.\n\tresp.Bfree = uint64(free) / blockSize // Free blocks in file system.\n\tresp.Bavail = resp.Bfree // Free blocks in file system if you're not root.\n\tresp.Files = 1e9 // Total files in file system.\n\tresp.Ffree = 1e9 // Free files in file system.\n\tresp.Bsize = blockSize // Block size\n\tresp.Namelen = 255 // Maximum file name length?\n\tresp.Frsize = blockSize // Fragment size, smallest addressable data size in the file system.\n\tmountlib.ClipBlocks(&resp.Blocks)\n\tmountlib.ClipBlocks(&resp.Bfree)\n\tmountlib.ClipBlocks(&resp.Bavail)\n\treturn nil\n}", "title": "" }, { "docid": "470f45511b2420dbd5df67cd06c2dde1", "score": "0.5452504", "text": "func New(root string, schema *schema.Instance, config *converter.Config) (runtime.Source, error) {\n\tfs := &source{\n\t\tconfig: config,\n\t\troot: root,\n\t\tkinds: map[string]bool{},\n\t\tshas: map[fileResourceKey][sha1.Size]byte{},\n\t\tworker: util.NewWorker(\"fs source\", log.Scope),\n\t\tversion: 0,\n\t}\n\tfor _, spec := range schema.All() {\n\t\tfs.kinds[spec.Kind] = true\n\t}\n\treturn fs, nil\n}", "title": "" }, { "docid": "9ebaa3c3163f955641d01a66d7728d38", "score": "0.54441214", "text": "func New(logger log.Logger, c Config) (*Backend, error) {\n\tif strings.TrimRight(path.Clean(c.Root), \"/\") == \"\" {\n\t\treturn nil, errors.Errorf(\"empty or root path given, <%s> as root\", c.Root)\n\t}\n\n\tif _, err := os.Stat(c.Root); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"make sure volume is mounted, <%s> as root\", c.Root)\n\t}\n\n\tlogger.Debug(\"msg\", \"fs backend\", \"config\", fmt.Sprintf(\"%#v\", c))\n\n\treturn &Backend{logger: logger, root: c.Root}, nil\n}", "title": "" }, { "docid": "e78103830c7e1ea3e35d296beab877ce", "score": "0.5438348", "text": "func NewFSObjectClient(cfg FSConfig) (*FSObjectClient, error) {\n\tif err := ensureDirectory(cfg.Directory); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &FSObjectClient{\n\t\tcfg: cfg,\n\t}, nil\n}", "title": "" }, { "docid": "1129c11218239c6dc159f1f7fa25fc8d", "score": "0.54364663", "text": "func New(fs billy.Basic, base string) billy.Filesystem {\n\treturn &ChrootHelper{\n\t\tunderlying: polyfill.New(fs),\n\t\tbase: base,\n\t}\n}", "title": "" }, { "docid": "fca028d15f9b5cad67bd987a99a85a94", "score": "0.54351616", "text": "func (s *Socket) StatFS(context.Context) (fs.Info, error) {\n\treturn fsInfo, nil\n}", "title": "" }, { "docid": "1b5ca4926af56fb67c1bc24a0afe221d", "score": "0.5434937", "text": "func (tfs *TemplateService) LookupFS(fs *lookupfs.LookupFileSystem) *TemplateService {\n\ttfs.lfs = fs\n\treturn tfs\n}", "title": "" }, { "docid": "d238ca3ac67da251416d1faae88f7928", "score": "0.54337096", "text": "func newFileServer(id, path, fileSystemPath string) http.Handler {\n\treturn &fileServer{\n\t\tupstream: id,\n\t\thandler: newFileServerForPath(path, fileSystemPath),\n\t}\n}", "title": "" }, { "docid": "c45482e473e77741f5462b286ce569ab", "score": "0.5432546", "text": "func newFile(rootNode *rootNode, driveFile *drive.File) nodefs.File {\n\tf := &file{\n\t\tnil,\n\t\trootNode,\n\t\tdriveFile,\n\t\tnewLoggingFile(true).(*loggingFile),\n\t}\n\tf.setLogPrefix(\"BaseFile\")\n\n\treturn f\n}", "title": "" }, { "docid": "184414b6b255b1b0e1fc77168510e1b1", "score": "0.5428458", "text": "func (f *FS) Statfs(ctx context.Context,\n\treq *fuse.StatfsRequest, resp *fuse.StatfsResponse) (err error) {\n\tdefer func() { f.logger.Printf(\"FS.Statfs(): error=%v\", err) }()\n\tvar stat syscall.Statfs_t\n\tif err := syscall.Statfs(f.rootPath, &stat); err != nil {\n\t\treturn translateError(err)\n\t}\n\tresp.Blocks = stat.Blocks\n\tresp.Bfree = stat.Bfree\n\tresp.Bavail = stat.Bavail\n\tresp.Files = stat.Files\n\tresp.Ffree = stat.Ffree\n\tresp.Bsize = uint32(stat.Bsize)\n\tresp.Namelen = 255 // (Maximum file name length?)\n\tresp.Frsize = 8 // (Fragment size...)\n\n\treturn nil\n}", "title": "" } ]
1ad518bd4dee3212311d96b45c4162f5
Init fill pointers and return string for select statement
[ { "docid": "2bf49dfa7fccd46823447505acb9e257", "score": "0.54511", "text": "func (q QueryRow) Init() string {\n\tcount := len(q.Columns)\n\tfor i := 0; i < count; i++ {\n\t\tq.ValuePtrs[i] = &q.Values[i]\n\t}\n\treturn strings.Join(q.Columns, \", \")\n}", "title": "" } ]
[ { "docid": "db878d1a57e6c299c0eba9b5e1ed551b", "score": "0.665973", "text": "func generateSelect(selectVal []string, q *Query) (selectString string) {\n\tselectString = \"SELECT \"\n\tif len(selectVal) == 0 {\n\t\tselectString += \"AS inst\"\n\t} else {\n\t\t//code to handle nested select in SQL without row_to_json Format\n\t\tselectString += \"(SELECT (tbl.\"\n\t\tfor id, selectStmt := range q.Select {\n\t\t\tif id != 0 {\n\t\t\t\tselectString += \", tbl.\"\n\t\t\t}\n\t\t\tselectString += selectStmt\n\t\t}\n\t\tselectString += \") AS mainQuery\"\n\t}\n\treturn\n}", "title": "" }, { "docid": "867b1d67ffdfc8cfd23fc929c87e1d3d", "score": "0.59386396", "text": "func buildSelectQuery(opts *hostQuery) string {\n\treturn fmt.Sprintf(\"select * from %s where %s\", opts.table, buildSpecifiedValuesWhere(opts))\n}", "title": "" }, { "docid": "01dd5f4c65e387ea3d5f7d115e5601c4", "score": "0.58880115", "text": "func newSelectStmt(conn conn, cols ...string) *SelectStmt {\n\tsel := &clause.Select{}\n\tif len(cols) == 0 {\n\t\tsel.AddColumns(\"*\")\n\t} else {\n\t\tsel.AddColumns(cols...)\n\t}\n\ts := &SelectStmt{}\n\ts.conn = conn\n\ts.cmd = sel\n\treturn s\n}", "title": "" }, { "docid": "b7dd0cddcbe883cff0cbdb3837d674fd", "score": "0.58853495", "text": "func (st SelectStatement) String() string {\n\tval := fmt.Sprintf(\"Off(%d):\", st.Off)\n\tif st.Select != nil {\n\t\tval += st.Select.String()\n\t}\n\tif st.From != nil {\n\t\tval += \" \" + st.From.String()\n\t}\n\tif st.Where != nil {\n\t\tval += \" \" + st.Where.String()\n\t}\n\tif st.Escape != nil {\n\t\tval += \" \" + st.Escape.String()\n\t}\n\tif st.Limit != nil {\n\t\tval += \" \" + st.Limit.String()\n\t}\n\tif st.ResultsOffset != nil {\n\t\tval += \" \" + st.ResultsOffset.String()\n\t}\n\treturn val\n}", "title": "" }, { "docid": "6a388b5d216c024e91de61a964d59a90", "score": "0.5873285", "text": "func (s SelectQuery) Construct() string {\n\treturn fmt.Sprintf(\"SELECT %s FROM %s;\", s.columnString(), s.table)\n}", "title": "" }, { "docid": "04e13ad0b8f36cb7c04d3c23cdf14185", "score": "0.5791915", "text": "func SelectString(connection *utils.DBConn, query string) string {\n\tresults := make([]QuerySingleString, 0)\n\terr := connection.Select(&results, query)\n\tutils.CheckError(err)\n\tif len(results) == 1 {\n\t\treturn results[0].String\n\t} else if len(results) > 1 {\n\t\tlogger.Fatal(errors.Errorf(\"Too many rows returned from query: got %d rows, expected 1 row\", len(results)), \"\")\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e4cb4ea44ca6f9a84206e5afe72714ed", "score": "0.5753869", "text": "func CreateQuery(src interface{}, where string) string {\n\tvar b bytes.Buffer\n\tb.WriteString(\"SELECT \")\n\ts := reflect.Indirect(reflect.ValueOf(src))\n\tt := s.Type()\n\tif s.Kind() == reflect.Slice {\n\t\tt = t.Elem()\n\t}\n\tif t.Kind() != reflect.Struct {\n\t\treturn \"\"\n\t}\n\tvar fields []string\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tfields = append(fields, t.Field(i).Name)\n\t}\n\tb.WriteString(strings.Join(fields, \", \"))\n\tb.WriteString(\" FROM \")\n\tb.WriteString(t.Name())\n\tb.WriteString(\" \" + where)\n\treturn b.String()\n}", "title": "" }, { "docid": "abcbba8ad23e689fe2e3e50847f4b18e", "score": "0.57348305", "text": "func Select(cols ...string) SelectStmt { return SelectStmt{columns: cols} }", "title": "" }, { "docid": "70f5e0f8cceca1e96592069dbc58c2db", "score": "0.5719327", "text": "func queryGenerator(fields []string) string {\n\tvar fieldString string\n\tfieldString += \"SELECT \"\n\tfor _, f := range fields {\n\t\tfieldString += \"[\" + f + \"],\"\n\t}\n\tfieldString = strings.TrimSuffix(fieldString, \",\")\n\tfieldString += \" FROM [Contact] WHERE PTID=?\"\n\treturn fieldString\n}", "title": "" }, { "docid": "e9477dcd1fffc2964975d2125f48ba3b", "score": "0.56348807", "text": "func SelectDATA(psqlInfo string) {\n\n\tdb, err := sql.Open(DB_DRIVER, psqlInfo)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = db.Ping()\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tvar id int\n\tvar name, email string\n\trows, err := db.Query(`SELECT id, first_name, email\tFROM users ;`)\n\t//fmt.Println(rows.Next())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor rows.Next() {\n\t\trows.Scan(&id,&name,&email)\n\t\tfmt.Println(\"ID:\", id, \"Name:\", name, \"Email:\", email)\n\n\t}\n\tfmt.Println(\"Successfully connected!\")\n\tdb.Close()\n return\n\n}", "title": "" }, { "docid": "0d400fb553499c26148c275552dc6638", "score": "0.5601873", "text": "func (m *MSSqlGenerator) GenSelect(table *TableMetadata, sqls sqlClauseList) (string, []interface{}) {\r\n\tbuf := m.getBuf()\r\n\tdefer m.putBuf(buf)\r\n\tvar args []interface{}\r\n\tvar colNames string\r\n\tvar omitCols []string\r\n\tsqls = append(sqls, sqlClause{op: opType_table, clause: m.wrapColumn(table.Name)})\r\n\tsort.Sort(sqls)\r\n\tisPaging := false\r\n\tpagingOrder := table.IdColumn.name\r\n\thasWhere := false\r\n\tvar pagingParam []interface{}\r\n\tbuf.WriteString(\"select \")\r\n\tfor _, s := range sqls {\r\n\t\tswitch s.op {\r\n\t\tcase opType_rawQuery:\r\n\t\t\treturn s.clause, s.params\r\n\t\tcase opType_top:\r\n\t\t\tbuf.WriteString(fmt.Sprintf(\"top %v \", s.params...))\r\n\t\tcase opType_cols:\r\n\t\t\tcolNames = s.clause\r\n\t\tcase opType_omit:\r\n\t\t\tomitCols = strings.Split(strings.ToLower(s.clause), \",\")\r\n\t\tcase opType_table:\r\n\t\t\tbuf.WriteString(\"%s\")\r\n\t\t\tbuf.WriteString(fmt.Sprintf(\" from %v\", s.clause))\r\n\t\tcase opType_unlockTable:\r\n\t\t\tbuf.WriteString(\" with(nolock) \")\r\n\t\tcase opType_id:\r\n\t\t\tif hasWhere {\r\n\t\t\t\tbuf.WriteString(fmt.Sprintf(\" and %s=?\", table.IdColumn.name))\r\n\t\t\t} else {\r\n\t\t\t\tbuf.WriteString(fmt.Sprintf(\" where %s=?\", table.IdColumn.name))\r\n\t\t\t\thasWhere = true\r\n\t\t\t}\r\n\t\t\targs = append(args, s.params...)\r\n\t\tcase opType_where:\r\n\t\t\tif hasWhere {\r\n\t\t\t\tbuf.WriteString(fmt.Sprintf(\" and %s\", s.clause))\r\n\t\t\t} else {\r\n\t\t\t\tbuf.WriteString(fmt.Sprintf(\" where %s\", s.clause))\r\n\t\t\t\thasWhere = true\r\n\t\t\t}\r\n\t\t\targs = append(args, s.params...)\r\n\t\tcase opType_and:\r\n\t\t\tbuf.WriteString(fmt.Sprintf(\" and %s\", s.clause))\r\n\t\t\targs = append(args, s.params...)\r\n\t\tcase opType_or:\r\n\t\t\tbuf.WriteString(fmt.Sprintf(\" or (%s)\", s.clause))\r\n\t\t\targs = append(args, s.params...)\r\n\t\tcase opType_in:\r\n\t\t\tif len(s.params) > 0 {\r\n\t\t\t\tif hasWhere {\r\n\t\t\t\t\tbuf.WriteString(fmt.Sprintf(\" and %s in (%s)\", s.clause, m.makeInArgs(s.params)))\r\n\t\t\t\t} else {\r\n\t\t\t\t\tbuf.WriteString(fmt.Sprintf(\" where %s in (%s)\", s.clause, m.makeInArgs(s.params)))\r\n\t\t\t\t\thasWhere = true\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\tcase opType_in_or:\r\n\t\t\tif len(s.params) > 0 {\r\n\t\t\t\tbuf.WriteString(fmt.Sprintf(\" or(%s in (%s))\", s.clause, m.makeInArgs(s.params)))\r\n\t\t\t}\r\n\t\tcase opType_between:\r\n\t\t\tif hasWhere {\r\n\t\t\t\tbuf.WriteString(fmt.Sprintf(\" and %s between ? and ?\", s.clause))\r\n\t\t\t} else {\r\n\t\t\t\tbuf.WriteString(fmt.Sprintf(\" where %s between ? and ?\", s.clause))\r\n\t\t\t\thasWhere = true\r\n\t\t\t}\r\n\r\n\t\t\targs = append(args, s.params...)\r\n\t\tcase opType_between_or:\r\n\t\t\tbuf.WriteString(fmt.Sprintf(\" or (%s between ? and ?)\", s.clause))\r\n\t\t\targs = append(args, s.params...)\r\n\t\tcase opType_limit:\r\n\t\t\tbuf.WriteString(\"ROW_NUMBER() OVER (order by %s) as row,\")\r\n\t\t\tisPaging = true\r\n\t\t\tpagingParam = s.params\r\n\t\tcase opType_orderby:\r\n\t\t\tif isPaging {\r\n\t\t\t\tpagingOrder = s.clause\r\n\t\t\t} else {\r\n\t\t\t\tbuf.WriteString(\" order by \")\r\n\t\t\t\tbuf.WriteString(s.clause)\r\n\t\t\t}\r\n\t\tdefault:\r\n\t\t\tbreak\r\n\t\t}\r\n\t}\r\n\r\n\tif len(colNames) <= 0 {\r\n\t\tcols := make([]string, 0, len(table.Columns))\r\n\t\ttable.Columns.Foreach(func(colKey string, col *columnMetadata) {\r\n\t\t\tif col.rwType&io_type_ro == io_type_ro {\r\n\t\t\t\tif len(omitCols) > 0 {\r\n\t\t\t\t\tfor i := range omitCols {\r\n\t\t\t\t\t\tif colKey == omitCols[i] {\r\n\t\t\t\t\t\t\treturn\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tcols = append(cols, m.wrapColumn(col.name))\r\n\t\t\t}\r\n\t\t})\r\n\t\tcolNames = strings.Join(cols, \",\")\r\n\t}\r\n\tif isPaging {\r\n\t\tsqlStr := fmt.Sprintf(\"select top %[3]v * from (%[1]s) t where t.row > %[2]v\",\r\n\t\t\tfmt.Sprintf(buf.String(), pagingOrder, colNames), pagingParam[0], pagingParam[1])\r\n\t\treturn sqlStr, args\r\n\t}\r\n\treturn fmt.Sprintf(buf.String(), colNames), args\r\n}", "title": "" }, { "docid": "42b23109cb9f157e14829062707e8883", "score": "0.5513501", "text": "func (cm *Command) Select(table string, columns []string) *Command {\n\tcm.command = \"select\"\n\tcm.table = table\n\tcm.from = \"from\"\n\tcount := len(columns)\n\tif count == 0 {\n\t\tcm.what = \" * \"\n\t} else {\n\t\tfor i, v := range columns {\n\t\t\tcm.what += v\n\t\t\tif count > 1 && i != count-1 {\n\t\t\t\tcm.what += \",\"\n\t\t\t}\n\t\t}\n\t}\n\treturn cm\n}", "title": "" }, { "docid": "3e6ecde982dfad9e97fca83ed9cf1061", "score": "0.5499053", "text": "func (d *selectData) toSQL() (string, error) {\n\tif len(d.Columns) == 0 && len(d.Prefixes) == 0 && len(d.Suffixes) == 0 {\n\t\treturn \"\", fmt.Errorf(\"select statements must have at least one column\")\n\t}\n\n\tsql := &bytes.Buffer{}\n\n\tif len(d.Prefixes) > 0 {\n\t\tif err := appendToSQL(d.Prefixes, sql, \" \"); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"%w\", err)\n\t\t}\n\n\t\tsql.WriteString(\" \")\n\t}\n\n\tif len(d.Columns) > 0 {\n\t\tsql.WriteString(\"SELECT \")\n\t}\n\n\tif len(d.Options) > 0 {\n\t\tsql.WriteString(strings.Join(d.Options, \" \"))\n\t\tsql.WriteString(\" \")\n\t}\n\n\tif len(d.Columns) > 0 {\n\t\tif err := appendToSQL(d.Columns, sql, \", \"); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"%w\", err)\n\t\t}\n\t}\n\n\tif d.From != nil {\n\t\tsql.WriteString(\" FROM \")\n\t\tif err := appendToSQL([]SQLizer{d.From}, sql, \"\"); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"%w\", err)\n\t\t}\n\t}\n\n\tif len(d.WhereParts) > 0 {\n\t\tsql.WriteString(\" WHERE \")\n\t\tif err := appendToSQL(d.WhereParts, sql, \" AND \"); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"%w\", err)\n\t\t}\n\t}\n\n\tif len(d.GroupBys) > 0 {\n\t\tsql.WriteString(\" GROUP BY \")\n\t\tsql.WriteString(strings.Join(d.GroupBys, \", \"))\n\t}\n\n\tif len(d.HavingParts) > 0 {\n\t\tsql.WriteString(\" HAVING \")\n\t\tif err := appendToSQL(d.HavingParts, sql, \" AND \"); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"%w\", err)\n\t\t}\n\t}\n\n\tif len(d.OrderByParts) > 0 {\n\t\tsql.WriteString(\" ORDER BY \")\n\t\tif err := appendToSQL(d.OrderByParts, sql, \", \"); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"%w\", err)\n\t\t}\n\t}\n\n\tif len(d.Limit) > 0 {\n\t\tsql.WriteString(\" LIMIT \")\n\t\tsql.WriteString(d.Limit)\n\t}\n\n\tif len(d.Offset) > 0 {\n\t\tsql.WriteString(\" OFFSET \")\n\t\tsql.WriteString(d.Offset)\n\t}\n\n\tif len(d.Suffixes) > 0 {\n\t\tsql.WriteString(\" \")\n\n\t\tif err := appendToSQL(d.Suffixes, sql, \" \"); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"%w\", err)\n\t\t}\n\t}\n\n\treturn sql.String(), nil\n}", "title": "" }, { "docid": "e560ca94b45aadbff15c99ddd2117b9e", "score": "0.545113", "text": "func (g *Grammars) compileSelect() string {\n\tvar sql strings.Builder\n\tsql.Grow(1024)\n\tfor _, component := range g.Builder.SelectComponents {\n\t\tif _, ok := g.Builder.Components[component]; ok {\n\t\t\tg.compileComponent(component, &sql)\n\t\t}\n\t}\n\n\treturn sql.String()\n}", "title": "" }, { "docid": "bff54a1eae0abedbe305f1cdad317200", "score": "0.53766006", "text": "func createQuery(q interface{}) (string, error) {\n\t// Support only for struct types\n\tif reflect.ValueOf(q).Kind() == reflect.Struct {\n\t\tt := reflect.TypeOf(q).Name()\n\t\tquery := fmt.Sprintf(\"insert into %s values (\", t)\n\t\tv := reflect.ValueOf(q)\n\t\tfor i := 0; i < v.NumField(); i++ {\n\t\t\tswitch v.Field(i).Kind() {\n\t\t\tcase reflect.Int:\n\t\t\t\tif i == 0 {\n\t\t\t\t\tquery = fmt.Sprintf(\"%s %d\", query, v.Field(i).Int())\n\t\t\t\t} else {\n\t\t\t\t\tquery = fmt.Sprintf(\"%s, %d\", query, v.Field(i).Int())\n\t\t\t\t}\n\t\t\tcase reflect.String:\n\t\t\t\tif i == 0 {\n\t\t\t\t\tquery = fmt.Sprintf(\"%s\\\"%s\\\"\", query, v.Field(i).String())\n\t\t\t\t} else {\n\t\t\t\t\tquery = fmt.Sprintf(\"%s, \\\"%s\\\"\", query, v.Field(i).String())\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn \"\", errors.New(\"unsupported data type for the field\")\n\t\t\t}\n\t\t}\n\n\t\tquery = fmt.Sprintf(\"%s)\", query)\n\t\treturn query, nil\n\t}\n\treturn \"\", errors.New(\"unsupported type\")\n}", "title": "" }, { "docid": "224b8394cb24a32a03d07a15b101f8cf", "score": "0.53602", "text": "func (q *Query) FormatSelectStmt() (queryStmt string, bindArray []interface{}) {\n\tqueryStmt = generateSelect(q.Select, q)\n\tqueryStmt += \"FROM \" + string(q.Table) + \"as tbl\"\n\tqueryStmt, bindArray = generateWhere(q, queryStmt)\n\n\tif q.Limit != 0 {\n\t\tqueryStmt += \"LIMIT $\" + strconv.Itoa(q.Limit)\n\t\tbindArray = append(bindArray, strconv.Itoa(q.Limit))\n\t}\n\treturn\n}", "title": "" }, { "docid": "899a0a79823f9aa25e5000d831c06fb5", "score": "0.5350065", "text": "func (db *Storage) Select(ctxt Context, val interface{}, query string, args ...interface{}) error {\n\tctxt = debugContext(ctxt)\n\tt, kind, err := db.findType(val, \"Select\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar buf bytes.Buffer\n\tfmt.Fprintf(&buf, \"select \")\n\tsep := \"\"\n\tvar indexes [][]int\n\tfor _, col := range t.fields {\n\t\tfmt.Fprintf(&buf, \"%s%q\", sep, col.name)\n\t\tsep = \", \"\n\t\tindexes = append(indexes, col.index)\n\t}\n\tfmt.Fprintf(&buf, \" from %q %s\", t.name, query)\n\n\trows, err := ctxt.Query(buf.String(), args...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rows.Close()\n\n\trval := reflect.ValueOf(val).Elem()\n\trval.Set(reflect.Zero(rval.Type()))\n\tswitch kind {\n\tcase ptrStruct:\n\t\tif !rows.Next() {\n\t\t\treturn ErrNotFound\n\t\t}\n\t\treturn scan1(rows, t, rval)\n\n\tcase ptrPtrStruct:\n\t\tif !rows.Next() {\n\t\t\trval.Set(reflect.Zero(rval.Type()))\n\t\t\treturn nil\n\t\t}\n\t\trval.Set(reflect.New(rval.Type().Elem()))\n\t\treturn scan1(rows, t, rval.Elem())\n\n\tcase ptrSliceStruct:\n\t\tfor rows.Next() {\n\t\t\tn := rval.Len()\n\t\t\trval.Set(reflect.Append(rval, reflect.Zero(rval.Type().Elem())))\n\t\t\tif err := scan1(rows, t, rval.Index(n)); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\n\tcase ptrSlicePtrStruct:\n\t\tfor rows.Next() {\n\t\t\tn := rval.Len()\n\t\t\trval.Set(reflect.Append(rval, reflect.New(rval.Type().Elem().Elem())))\n\t\t\tif err := scan1(rows, t, rval.Index(n).Elem()); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\tpanic(\"dbstore: internal error: unexpected kind\")\n}", "title": "" }, { "docid": "55230bd8d0e00814da4bc5c358c9192d", "score": "0.5347649", "text": "func (s SelectQuery) String() string {\n\treturn s.Construct()\n}", "title": "" }, { "docid": "803447e2323d371ffa704464af6d7ab5", "score": "0.5337779", "text": "func (q SelectStmt) SQL() (string, []interface{}, error) {\n\tsql := dialects[q.dialect].query(q)\n\treturn sql, q.values, q.err\n}", "title": "" }, { "docid": "6878218660e5d87c5d0d2fcdc0c89f35", "score": "0.533394", "text": "func (that *PgClient) BuildInsertSql(table string, fields []string, returning string) string{\n n := len(fields)\n placeholders := make([]string, n)\n for i := 0; i < n; i++ {\n placeholders[i] = fmt.Sprintf(\"$%d\", i+1)\n }\n sql := fmt.Sprintf(\"INSERT INTO %s (%s) VALUES (%s)\", table, strings.Join(fields, \",\"), strings.Join(placeholders, \",\"))\n if returning != \"\" {\n sql += fmt.Sprintf(\" returning %s\", returning)\n }\n return sql\n}", "title": "" }, { "docid": "737dd2743fdb6a76749a2deb6570ebc4", "score": "0.5327487", "text": "func (queryBuilder *QueryBuilder) getSQLForSelect() string {\n\tsql := \"SELECT \"\n\n\tif selectStr := queryBuilder.sqlPartsSelect; selectStr != \"\" {\n\t\tsql += selectStr\n\t}\n\n\tsql += \" FROM \" + queryBuilder.getFromClauses()\n\n\tif whereStr := queryBuilder.sqlPartsWhere; whereStr != \"\" {\n\t\tsql += \" WHERE \" + whereStr\n\t}\n\n\tif groupByStr := queryBuilder.sqlPartsGroupBy; groupByStr != \"\" {\n\t\tsql += \" GROUP BY \" + groupByStr\n\t}\n\n\tif havingStr := queryBuilder.sqlPartsHaving; havingStr != \"\" {\n\t\tsql += \" HAVING \" + havingStr\n\t}\n\n\tif queryBuilder.flag == ISSORT {\n\t\tsql += \" ORDER BY \"\n\n\t\tfor _, v := range queryBuilder.sqlPartsOrderBy {\n\t\t\tsql += v.sort + \" \" + v.order + \",\"\n\t\t}\n\t\tsql = sql[:len(sql)-1]\n\t}\n\n\tif queryBuilder.isLimitQuery() {\n\t\tsql += \" LIMIT \" + strconv.Itoa(queryBuilder.firstResult) + \",\" + strconv.Itoa(queryBuilder.maxResults)\n\t}\n\n\treturn sql\n}", "title": "" }, { "docid": "3f600fb27d895f39e2743c8231fcaec7", "score": "0.52587867", "text": "func (db *DB) Select(s string, args ...interface{}) (string, error) {\n\tvar val string\n\terr := db.QueryRow(s, args...).Scan(&val)\n\treturn val, err\n}", "title": "" }, { "docid": "881a24e535df8b702f16d629ff777e78", "score": "0.5211162", "text": "func buildSelectColumnList(t *schema.Table) string {\n\tbuf := sqlparser.NewTrackedBuffer(nil)\n\tfor i, c := range t.MessageInfo.Fields {\n\t\t// Column names may have to be escaped.\n\t\tif i == 0 {\n\t\t\tbuf.Myprintf(\"%v\", sqlparser.NewColIdent(c.Name))\n\t\t} else {\n\t\t\tbuf.Myprintf(\", %v\", sqlparser.NewColIdent(c.Name))\n\t\t}\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "493966cc4c3b1304ac02a563bb83387b", "score": "0.5163088", "text": "func (mysql *Mysql) SelectAll(table *Table) string {\n\tvar buffer bytes.Buffer\n\n\tbuffer.WriteString(\"select \")\n\n\trows := table.rows\n\tlength := len(rows) - 1\n\tfor index, row := range rows {\n\t\tbuffer.WriteString(row.name)\n\t\tif index < length {\n\t\t\tbuffer.WriteString(\", \")\n\t\t}\n\t}\n\n\tbuffer.WriteString(\" from \")\n\tbuffer.WriteString(table.name)\n\n\treturn buffer.String()\n}", "title": "" }, { "docid": "e162e8f62de30a0cfbc420e0010b23c6", "score": "0.5156079", "text": "func (me *DBext) Select(id uint64, secured bool, rowPattern interface{}, name string, cacheName string, offset uint, count uint, params ...interface{}) (result []interface{}, code int, err error) {\n\tt0 := misc.NowUnixNano()\n\tdefer func() {\n\t\tmisc.LogProcessingTime(me.db.logFacility.Name(), \"\", id, `db.select \"`+name+`(`+cacheName+`)\"`, \"\", t0)\n\t}()\n\n\tif cacheName == \"\" {\n\t\tcacheName = name\n\t}\n\n\t// Make a query\n\n\trs, err := me.OpenRecordsetExtended(name, secured, offset, count, params...)\n\tif err != nil {\n\t\treturn nil, http.StatusInternalServerError, err\n\t}\n\tdefer rs.Close()\n\n\t// Get result definition\n\n\tvar df *resultDef\n\n\tif rowPattern != nil {\n\t\t// Prepare a list of fields from the pattern\n\t\tdf = &resultDef{\n\t\t\trow: rowPattern,\n\t\t}\n\t\tdf.fields, err = fieldsFromPattern(rowPattern)\n\t} else {\n\t\texists := false\n\t\tresultDefCacheMutex.RLock()\n\t\tdf, exists = resultDefCache[cacheName]\n\t\tresultDefCacheMutex.RUnlock()\n\n\t\tif !exists {\n\t\t\t// Make row Pattern and fields\n\t\t\tdf, err = makeRowPattern(rs)\n\t\t\tdf.mutex = new(sync.Mutex)\n\n\t\t\t// Save to cache for future use\n\t\t\tresultDefCacheMutex.Lock()\n\t\t\tresultDefCache[cacheName] = df\n\t\t\tresultDefCacheMutex.Unlock()\n\t\t}\n\t}\n\n\tif err != nil {\n\t\treturn nil, http.StatusBadRequest, err\n\t}\n\n\t// Read data and prepare answer\n\n\tanswer := []interface{}{}\n\n\tif df.mutex != nil {\n\t\tdf.mutex.Lock()\n\t}\n\n\tfor rs.Next() {\n\t\terr = rs.Scan(df.fields...)\n\t\tif err != nil {\n\t\t\treturn nil, http.StatusInternalServerError, err\n\t\t}\n\n\t\trow := reflect.Indirect(reflect.ValueOf(df.row)).Interface()\n\t\tanswer = append(answer, row)\n\t}\n\n\tif df.mutex != nil {\n\t\tdf.mutex.Unlock()\n\t}\n\n\treturn answer, http.StatusOK, nil\n}", "title": "" }, { "docid": "dcad54e67f07c73c79ca4af40c9d5c96", "score": "0.5155548", "text": "func GenerateInsertQuery(tblName string, data interface{}) string {\n\tif reflect.ValueOf(data).Kind() == reflect.Struct {\n\t\tv := reflect.TypeOf(data)\n\t\tvalues := reflect.ValueOf(data)\n\n\t\tfieldsSection := \"\"\n\t\tvaluesSection := \"\"\n\n\t\tfor i := 0; i < v.NumField(); i++ {\n\t\t\tfield := v.Field(i)\n\t\t\tsqlToolsTag := field.Tag.Get(\"sqltools\")\n\t\t\tif sqlToolsTag == \"\" {\n\t\t\t\tsqlToolsTag = field.Name\n\t\t\t}\n\t\t\tfieldsSection += sqlToolsTag + \",\"\n\t\t\tfieldType := values.Field(i).Kind()\n\t\t\tif fieldType == reflect.Int {\n\t\t\t\tvaluesSection += fmt.Sprintf(`'%d',`, values.Field(i).Int())\n\t\t\t} else if fieldType == reflect.String {\n\t\t\t\tvaluesSection += fmt.Sprintf(`'%s',`, values.Field(i))\n\t\t\t}\n\t\t}\n\t\tfieldsSection = strings.TrimRight(fieldsSection, \",\")\n\t\tvaluesSection = strings.TrimRight(valuesSection, \",\")\n\n\t\treturn fmt.Sprintf(insertQuerySchema, tblName, fieldsSection, valuesSection)\n\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "39e096f535a8130a52eff2e25fcd87f3", "score": "0.51476014", "text": "func SelectDatabaseStatement() string {\n\treturn \"select 1 from pg_database where datname = $1\"\n}", "title": "" }, { "docid": "9dd104ee1fdf469e44387a98fbdbd805", "score": "0.51467943", "text": "func (s queryBuilder) basicSelect(schema string, table string, selectFields []string) queryBuilder {\n\n\treturn queryBuilder(fmt.Sprintf(sqlToSelectFieldsFromTableSchema, toListString(selectFields), schema, table))\n\n}", "title": "" }, { "docid": "254001ace567895164b5135b8bd86fb3", "score": "0.51466244", "text": "func sqlPrepare() {\n\tdb, err := connect()\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn\n\t}\n\tdefer db.Close()\n\n\tstmt, err := db.Prepare(\"SELECT name, grade, age FROM tb_student WHERE id= ?\")\n\t/*\n\t\tMethod *prepare()* digunakan untuk deklarasi query, yang mengembalikan objek bertipe sql.*Stmt, dari objek tersebut dipanggil method *queryRow()* beberapa kali dengan isi value *id* berbeda-beda untuk tiap pemanggilannya\n\t*/\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn\n\t}\n\t\n\tvar result1 = student{}\n\tstmt.QueryRow(\"B001\").Scan(&result1.name, &result1.grade, &result1.age)\n\tfmt.Printf(\"Name: %s\\nGrade: %d\\nAge: %d\\n\\n\", result1.name, result1.grade, result1.age)\n\n\tvar result2 = student{}\n\tstmt.QueryRow(\"B002\").Scan(&result2.name, &result2.grade, &result2.age)\n\tfmt.Printf(\"Name: %s\\nGrade: %d\\nAge: %d\\n\\n\", result2.name, result2.grade, result2.age)\n\tfmt.Println(\"===================================================\\n\")\n}", "title": "" }, { "docid": "a0d249e2bf8e1c344e67d895f144493e", "score": "0.5144105", "text": "func (expr *ExprSelect) Ident() string {\n\treturn fmt.Sprintf(\"select (%s %s, %s %s, %s %s)\",\n\t\texpr.Cond.Type(),\n\t\texpr.Cond.Ident(),\n\t\texpr.X.Type(),\n\t\texpr.X.Ident(),\n\t\texpr.Y.Type(),\n\t\texpr.Y.Ident())\n}", "title": "" }, { "docid": "163db3e9309dd3f7033e22696f78f630", "score": "0.5139361", "text": "func initQuery() {\n\tinsertSelectIdByName = h.ReturnTrimFile(dir + \"insert_select_id_by_name.sql\")\n\temployeesSelectByImport = h.ReturnTrimFile(dir + \"all_employees_from_imports.sql\")\n\temployeesIdAnetId = h.ReturnTrimFile(dir + \"employees_id_anet_id.sql\")\n}", "title": "" }, { "docid": "0dfc56b92b6bf61912f86c73115bbf32", "score": "0.5117446", "text": "func (node *Select) Format(buf *TrackedBuffer) {\n\tbuf.Myprintf(\"select %v%s%s%s%v from %v%v%v%v%v%v%s\",\n\t\tnode.Comments, node.Cache, node.Distinct, node.Hints, node.SelectExprs,\n\t\tnode.From, node.Where,\n\t\tnode.GroupBy, node.Having, node.OrderBy,\n\t\tnode.Limit, node.Lock)\n}", "title": "" }, { "docid": "31513ed9d86d3995e1fc280734d6fc28", "score": "0.5106684", "text": "func (q SelectStmt) Select(cols ...string) SelectStmt {\n\tq.columns = cols\n\treturn q\n}", "title": "" }, { "docid": "e790d2eb456e957f6990cac6de7059b9", "score": "0.510141", "text": "func PrepareSelectQuery(metaInput map[string]interface{}) string {\n\t// get the endpoint\n\tdatabaseType := metaInput[\"databaseType\"].(string)\n\n\tquery := \"\"\n\tif databaseType == \"cassandra\" {\n\t\tquery = cassandraSelectQueryBuild(metaInput)\n\t} else if databaseType == \"presto\" {\n\t\tquery = prestoSelectQueryBuild(metaInput)\n\t}\n\treturn query\n\n}", "title": "" }, { "docid": "b08d26b114cf2c554ae56c7a63b1b387", "score": "0.50979185", "text": "func (q *BaseQueryBuilder) BuildSelect(cols []string, distinct bool, option string) string {\n\tvar s bytes.Buffer\n\ts.WriteString(\"SELECT \")\n\tif distinct {\n\t\ts.WriteString(\"DISTINCT \")\n\t}\n\tif option != \"\" {\n\t\ts.WriteString(option)\n\t\ts.WriteString(\" \")\n\t}\n\tif len(cols) == 0 {\n\t\ts.WriteString(\"*\")\n\t\treturn s.String()\n\t}\n\n\tfor i, col := range cols {\n\t\tif i > 0 {\n\t\t\ts.WriteString(\", \")\n\t\t}\n\t\tmatches := selectRegex.FindStringSubmatch(col)\n\t\tif len(matches) == 0 {\n\t\t\ts.WriteString(q.db.QuoteColumnName(col))\n\t\t} else {\n\t\t\tcol := col[:len(col)-len(matches[0])]\n\t\t\talias := matches[1]\n\t\t\ts.WriteString(q.db.QuoteColumnName(col) + \" AS \" + q.db.QuoteSimpleColumnName(alias))\n\t\t}\n\t}\n\n\treturn s.String()\n}", "title": "" }, { "docid": "a7e06c63f969a317d2f4d55c92de71aa", "score": "0.5087629", "text": "func echoSelectList(tls *libc.TLS, pTab uintptr, pIdxInfo uintptr) uintptr { /* test8.c:763:13: */\n\tbp := tls.Alloc(24)\n\tdefer tls.Free(24)\n\n\tvar zRet uintptr = uintptr(0)\n\tif sqlite3.Xsqlite3_libversion_number(tls) < 3010000 {\n\t\tzRet = sqlite3.Xsqlite3_mprintf(tls, ts+27433 /* \", *\" */, 0)\n\t} else {\n\t\tvar i int32\n\t\tfor i = 0; i < (*echo_vtab)(unsafe.Pointer(pTab)).FnCol; i++ {\n\t\t\tif ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FcolUsed & (sqlite3_uint64(uint64(1)) << (func() int32 {\n\t\t\t\tif i >= 63 {\n\t\t\t\t\treturn 63\n\t\t\t\t}\n\t\t\t\treturn i\n\t\t\t}()))) != 0 {\n\t\t\t\tzRet = sqlite3.Xsqlite3_mprintf(tls, ts+27437 /* \"%z, %s\" */, libc.VaList(bp, zRet, *(*uintptr)(unsafe.Pointer((*echo_vtab)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*8))))\n\t\t\t} else {\n\t\t\t\tzRet = sqlite3.Xsqlite3_mprintf(tls, ts+27444 /* \"%z, NULL\" */, libc.VaList(bp+16, zRet))\n\t\t\t}\n\t\t\tif !(zRet != 0) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn zRet\n}", "title": "" }, { "docid": "a40764a27b1b27f8ed8c444f5d60758d", "score": "0.5084347", "text": "func TestCnxSQLServerSelect() (string, *[]Proyecto) {\n\tdb := data.GetClienteMMSS()\n\ttsql := fmt.Sprintf(\"SELECT idproyecto, nombreproyecto, duracionmeses, inicio FROM proyecto;\")\n\trows, err := db.Query(tsql)\n\tif err != nil {\n\t\tfmt.Println(\"Error reading rows: \" + err.Error())\n\t\treturn \"error select\", nil\n\t}\n\tdefer rows.Close()\n\n\tvar arrTest []Proyecto\n\tfor rows.Next() {\n\t\tvar eproy Proyecto\n\t\terr := rows.Scan(&eproy.Idproyecto, &eproy.Nombreproyecto, &eproy.Duracionmeses, &eproy.Inicio)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error reading rows: \" + err.Error())\n\t\t\treturn \"error select\", nil\n\t\t}\n\t\tarrTest = append(arrTest, eproy)\n\t}\n\n\treturn \"select sql server OK\", &arrTest\n\n}", "title": "" }, { "docid": "75247b93cc398b3c2f0110b2cc87c661", "score": "0.5079747", "text": "func selectQuery(query *protocol.KontrolQuery) (string, []interface{}, error) {\n\tpsql := sq.StatementBuilder.PlaceholderFormat(sq.Dollar)\n\n\tkites := psql.Select(\"*\").From(\"kite.kite\")\n\tfields := query.Fields()\n\tandQuery := sq.And{}\n\n\t// we stop for the first empty value\n\tfor _, key := range keyOrder {\n\t\tv := fields[key]\n\t\tif v == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\t// we are using \"kitename\" as the columname\n\t\tif key == \"name\" {\n\t\t\tkey = \"kitename\"\n\t\t}\n\n\t\tandQuery = append(andQuery, sq.Eq{key: v})\n\t}\n\n\tif len(andQuery) == 0 {\n\t\treturn \"\", nil, ErrQueryFieldsEmpty\n\t}\n\n\treturn kites.Where(andQuery).ToSql()\n}", "title": "" }, { "docid": "ddc98b00f9e4c68ef2145514ac368154", "score": "0.5077588", "text": "func (b SelectBuilder) SQL() (string, []interface{}, error) {\n\tsb := &strings.Builder{}\n\targs := argumentList{}\n\tif err := b.Build(sb, &args); err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\treturn sb.String(), args, nil\n}", "title": "" }, { "docid": "40b054921c94fc41e9e3035fb0705bdf", "score": "0.5058318", "text": "func selectStr(first, second, defval string) string {\n\tvar selected string\n\tif first != \"\" {\n\t\tselected = first\n\t} else if second != \"\" {\n\t\tselected = second\n\t} else {\n\t\tselected = defval\n\t}\n\treturn selected\n}", "title": "" }, { "docid": "e0d29f76a08d725a99c53f8e2b3a6789", "score": "0.50522137", "text": "func (s *BaseJPAListener) EnterSelect_statement(ctx *Select_statementContext) {}", "title": "" }, { "docid": "2f2b9c014a9fe86a04ab2c4865302559", "score": "0.5024475", "text": "func Select(fields ...string) *SelectStmt {\n\ts := &SelectStmt{}\n\ts.add(\"SELECT\").join(fields)\n\treturn s\n}", "title": "" }, { "docid": "67d0277443459e6f2133d6502905bbd1", "score": "0.50234866", "text": "func unionPreparePrintf(tls *libc.TLS, pRc uintptr, pzErr uintptr, db uintptr, zFmt uintptr, va uintptr) uintptr { /* unionvtab.c:363:21: */\n\tvar pRet uintptr = uintptr(0)\n\tvar zSql uintptr\n\tvar ap va_list\n\t_ = ap\n\tap = va\n\n\tzSql = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)\n\tif *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK {\n\t\tif zSql == uintptr(0) {\n\t\t\t*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM\n\t\t} else {\n\t\t\tpRet = unionPrepare(tls, pRc, db, zSql, pzErr)\n\t\t}\n\t}\n\tsqlite3.Xsqlite3_free(tls, zSql)\n\n\t_ = ap\n\treturn pRet\n}", "title": "" }, { "docid": "2aeb36c51304a0f4b2f4776b17ecf5fc", "score": "0.50202286", "text": "func SelectStatement(schema *Schema, where []string) (string, error) {\n\tmainTable, err := schema.GetTable(schema.Name)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// preparing statement \"from\" clause based on main schema table\n\tfrom := []string{fmt.Sprintf(\"%s %s\", mainTable.Name, mainTable.Hint)}\n\n\tleftJoins := []string{}\n\tcolumns := []string{}\n\tfor _, table := range schema.Tables {\n\t\tcolumns = append(columns, hintedColumns(table)...)\n\n\t\tfor _, constraint := range table.Constraints {\n\t\t\tif constraint.Type != PgConstraintFK {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trelated, err := schema.GetTable(constraint.RelatedTableName)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\n\t\t\t// in order to keep the correct sql statement sequence, when dealing with a table having\n\t\t\t// one-to-many relationships, moving the statement to the end of left-joins group, while\n\t\t\t// when not having one-to-many, it will be prepended\n\t\t\tleftJoinStmt := leftJoin(schema, table, constraint, related)\n\t\t\tif schema.HasOneToMany(table.Path) {\n\t\t\t\tleftJoins = append(leftJoins, leftJoinStmt)\n\t\t\t} else {\n\t\t\t\tleftJoins = StringSlicePrepend(leftJoins, leftJoinStmt)\n\t\t\t}\n\t\t}\n\t}\n\n\tstatement := fmt.Sprintf(\n\t\t\"select %s from %s\",\n\t\tstrings.Join(columns, \", \"),\n\t\tstrings.Join(from, \", \"),\n\t)\n\tif len(leftJoins) > 0 {\n\t\tstatement = fmt.Sprintf(\"%s %s\", statement, strings.Join(leftJoins, \" \"))\n\t}\n\tif len(where) > 0 {\n\t\tstatement = fmt.Sprintf(\"%s where %s\", statement, strings.Join(where, \" and \"))\n\t}\n\treturn statement, nil\n}", "title": "" }, { "docid": "aa288aa5e31c37bbcc7328608c5eed5f", "score": "0.5015666", "text": "func (b *selectStmt) Build(d Dialect, buf Buffer) error {\n\tif b.raw.Query != \"\" {\n\t\treturn b.raw.Build(d, buf)\n\t}\n\n\tif len(b.Column) == 0 {\n\t\treturn ErrColumnNotSpecified\n\t}\n\n\tif len(b.Comment) > 0 {\n\t\tfor _, comm := range b.Comment {\n\t\t\tbuf.WriteString(\"/* \")\n\t\t\terr := comm.Build(d, buf)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuf.WriteString(\" */\")\n\t\t}\n\t}\n\n\tbuf.WriteString(\"SELECT \")\n\n\tif b.IsDistinct {\n\t\tbuf.WriteString(\"DISTINCT \")\n\t}\n\n\tfor i, col := range b.Column {\n\t\tif i > 0 {\n\t\t\tbuf.WriteString(\", \")\n\t\t}\n\t\tswitch col := col.(type) {\n\t\tcase string:\n\t\t\tbuf.WriteString(col)\n\t\tdefault:\n\t\t\tbuf.WriteString(placeholder)\n\t\t\tbuf.WriteValue(col)\n\t\t}\n\t}\n\n\tif b.Table != nil {\n\t\tbuf.WriteString(\" FROM \")\n\t\tswitch table := b.Table.(type) {\n\t\tcase string:\n\t\t\tbuf.WriteString(table)\n\t\tdefault:\n\t\t\tbuf.WriteString(placeholder)\n\t\t\tbuf.WriteValue(table)\n\t\t}\n\t\tif len(b.JoinTable) > 0 {\n\t\t\tfor _, join := range b.JoinTable {\n\t\t\t\terr := join.Build(d, buf)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(b.PrewhereCond) > 0 {\n\t\tkeyword := d.Prewhere()\n\t\tif len(keyword) == 0 {\n\t\t\treturn ErrPrewhereNotSupported\n\t\t}\n\n\t\tbuf.WriteString(\" \")\n\t\tbuf.WriteString(keyword)\n\t\tbuf.WriteString(\" \")\n\t\terr := And(b.PrewhereCond...).Build(d, buf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(b.WhereCond) > 0 {\n\t\tbuf.WriteString(\" WHERE \")\n\t\terr := And(b.WhereCond...).Build(d, buf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(b.Group) > 0 {\n\t\tbuf.WriteString(\" GROUP BY \")\n\t\tfor i, group := range b.Group {\n\t\t\tif i > 0 {\n\t\t\t\tbuf.WriteString(\", \")\n\t\t\t}\n\t\t\terr := group.Build(d, buf)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(b.HavingCond) > 0 {\n\t\tbuf.WriteString(\" HAVING \")\n\t\terr := And(b.HavingCond...).Build(d, buf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(b.Order) > 0 {\n\t\tbuf.WriteString(\" ORDER BY \")\n\t\tfor i, order := range b.Order {\n\t\t\tif i > 0 {\n\t\t\t\tbuf.WriteString(\", \")\n\t\t\t}\n\t\t\terr := order.Build(d, buf)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif b.LimitCount >= 0 {\n\t\tbuf.WriteString(\" \")\n\t\tbuf.WriteString(d.Limit(b.OffsetCount, b.LimitCount))\n\t}\n\n\tif b.IsForUpdate {\n\t\tbuf.WriteString(\" FOR UPDATE\")\n\t}\n\n\tif b.IsSkipLocked {\n\t\tbuf.WriteString(\" SKIP LOCKED\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f0735917940338545e9abce8d0cf499e", "score": "0.50132555", "text": "func PrepareSelectQuery(metaInput map[string]interface{}) []string {\n\t// get the endpoint\n\tdatabaseType := metaInput[\"databaseType\"].(string)\n\n\tvar query []string\n\n\tif databaseType == \"cassandra\" {\n\n\t\tquery = []string{cassandra_helper.SelectQueryBuild(metaInput)}\n\t} else if databaseType == \"presto\" {\n\n\t\tquery = []string{presto_helper.FindIDQueryBuild(metaInput)}\n\t} else if databaseType == \"cassandra_stratio\" {\n\t\tquery = []string{cassandra_helper.StratioSelectQueryBuild(metaInput)}\n\t}\n\n\treturn query\n}", "title": "" }, { "docid": "6f7b314d885b4ea51a11b765afd513cc", "score": "0.5005826", "text": "func genQuery( columnName string) string {\n\treturn fmt.Sprintf(\"%s = ?\", columnName)\n}", "title": "" }, { "docid": "6f7b314d885b4ea51a11b765afd513cc", "score": "0.5005826", "text": "func genQuery( columnName string) string {\n\treturn fmt.Sprintf(\"%s = ?\", columnName)\n}", "title": "" }, { "docid": "000b2236c87d14e786e185b799ab5339", "score": "0.5003799", "text": "func (b Builder) SQL() string {\n\n\tvar bindCount int\n\n\tsb := &strings.Builder{}\n\n\twriteSQL(sb, &bindCount, \"select \", \", \", b.selects)\n\twriteSQL(sb, &bindCount, \" from \", \", \", b.froms)\n\twriteSQL(sb, &bindCount, \" where \", \" and \", b.wheres)\n\twriteSQL(sb, &bindCount, \" group by \", \", \", b.groups)\n\twriteSQL(sb, &bindCount, \" having \", \" and \", b.havings)\n\twriteSQL(sb, &bindCount, \" order by \", \", \", b.orders)\n\n\tif b.limit > 0 {\n\t\tsb.WriteString(\" limit \")\n\t\tsb.WriteString(strconv.Itoa(b.limit))\n\t}\n\n\tif b.offset > 0 {\n\t\tsb.WriteString(\" offset \")\n\t\tsb.WriteString(strconv.Itoa(b.offset))\n\t}\n\n\treturn sb.String()\n}", "title": "" }, { "docid": "454c19854f6572587c98fdc0cd1f44de", "score": "0.49929658", "text": "func GetInsertStatement(tbName dna.String, structValue interface{}, isPrintable dna.Bool) dna.String {\n\tvar realKind string\n\tvar columnNames, columnValues dna.StringArray\n\ttempintslice := []int{0}\n\tvar ielements int\n\tvar kind string = reflect.TypeOf(structValue).Kind().String()\n\tif kind == \"ptr\" {\n\t\trealKind = reflect.TypeOf(structValue).Elem().Kind().String()\n\n\t} else {\n\t\trealKind = reflect.TypeOf(structValue).Kind().String()\n\n\t}\n\n\tif realKind != \"struct\" {\n\t\tpanic(\"Param has to be struct\")\n\t}\n\n\tif kind == \"ptr\" {\n\t\tielements = reflect.TypeOf(structValue).Elem().NumField()\n\t} else {\n\t\tielements = reflect.TypeOf(structValue).NumField()\n\t}\n\n\tfor i := 0; i < ielements; i++ {\n\t\ttempintslice[0] = i\n\t\tif kind == \"ptr\" {\n\t\t\tf := reflect.TypeOf(structValue).Elem().FieldByIndex(tempintslice)\n\t\t\tv := reflect.ValueOf(structValue).Elem().FieldByIndex(tempintslice)\n\t\t\tclName, clValue := getColumn(f, v.Interface())\n\t\t\tcolumnNames.Push(clName)\n\t\t\tcolumnValues.Push(clValue)\n\t\t} else {\n\t\t\tf := reflect.TypeOf(structValue).FieldByIndex(tempintslice)\n\t\t\tv := reflect.ValueOf(structValue).FieldByIndex(tempintslice)\n\t\t\tclName, clValue := getColumn(f, v.Interface())\n\t\t\tcolumnNames.Push(clName)\n\t\t\tcolumnValues.Push(clValue)\n\t\t}\n\n\t}\n\tif isPrintable == true {\n\t\treturn \"INSERT INTO \" + tbName + \"\\n(\" + columnNames.Join(\",\") + \")\\n\" + \"VALUES (\\n\" + columnValues.Join(\",\\n\") + \"\\n);\"\n\t} else {\n\t\treturn \"INSERT INTO \" + tbName + \"(\" + columnNames.Join(\",\") + \")\" + \" VALUES (\" + columnValues.Join(\",\") + \");\"\n\t}\n}", "title": "" }, { "docid": "14823d08ed143267502d3906a9d8f62a", "score": "0.49914792", "text": "func SelectStringSlice(connection *utils.DBConn, query string) []string {\n\tresults := make([]QuerySingleString, 0)\n\terr := connection.Select(&results, query)\n\tutils.CheckError(err)\n\tretval := make([]string, 0)\n\tfor _, str := range results {\n\t\tif str.String != \"\" {\n\t\t\tretval = append(retval, str.String)\n\t\t}\n\t}\n\treturn retval\n}", "title": "" }, { "docid": "d9dc50fee9624a4c3e2791c9cbc3b4a4", "score": "0.49686205", "text": "func test_get_table_printf(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:565:26: */\n\tbp := tls.Alloc(350)\n\tdefer tls.Free(350)\n\n\t// var db uintptr at bp+72, 8\n\n\t// var str Tcl_DString at bp+80, 216\n\n\tvar rc int32\n\t*(*uintptr)(unsafe.Pointer(bp + 304 /* zErr */)) = uintptr(0)\n\t*(*int32)(unsafe.Pointer(bp + 312 /* nRow */)) = 0\n\t*(*int32)(unsafe.Pointer(bp + 316 /* nCol */)) = 0\n\t// var aResult uintptr at bp+296, 8\n\n\tvar i int32\n\t// var zBuf [30]int8 at bp+320, 30\n\n\tvar zSql uintptr\n\t*(*int32)(unsafe.Pointer(bp + 64 /* resCount */)) = -1\n\tif argc == 5 {\n\t\tif tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 4*8)), bp+64 /* &resCount */) != 0 {\n\t\t\treturn TCL_ERROR\n\t\t}\n\t}\n\tif (argc != 4) && (argc != 5) {\n\t\ttcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* \"wrong # args: sh...\" */, *(*uintptr)(unsafe.Pointer(argv)),\n\t\t\tts+15513 /* \" DB FORMAT STRIN...\" */, 0))\n\t\treturn TCL_ERROR\n\t}\n\tif getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+72 /* &db */) != 0 {\n\t\treturn TCL_ERROR\n\t}\n\ttcl.XTcl_DStringInit(tls, bp+80 /* &str */)\n\tzSql = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)), libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(argv + 3*8))))\n\tif argc == 5 {\n\t\trc = sqlite3.Xsqlite3_get_table(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* db */)), zSql, bp+296 /* &aResult */, uintptr(0), uintptr(0), bp+304 /* &zErr */)\n\t} else {\n\t\trc = sqlite3.Xsqlite3_get_table(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* db */)), zSql, bp+296 /* &aResult */, bp+312 /* &nRow */, bp+316 /* &nCol */, bp+304 /* &zErr */)\n\t\t*(*int32)(unsafe.Pointer(bp + 64 /* resCount */)) = ((*(*int32)(unsafe.Pointer(bp + 312 /* nRow */)) + 1) * *(*int32)(unsafe.Pointer(bp + 316 /* nCol */)))\n\t}\n\tsqlite3.Xsqlite3_free(tls, zSql)\n\tsqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+320 /* &zBuf[0] */, ts+1238 /* \"%d\" */, libc.VaList(bp+40, rc))\n\ttcl.XTcl_AppendElement(tls, interp, bp+320 /* &zBuf[0] */)\n\tif rc == SQLITE_OK {\n\t\tif argc == 4 {\n\t\t\tsqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+320 /* &zBuf[0] */, ts+1238 /* \"%d\" */, libc.VaList(bp+48, *(*int32)(unsafe.Pointer(bp + 312 /* nRow */))))\n\t\t\ttcl.XTcl_AppendElement(tls, interp, bp+320 /* &zBuf[0] */)\n\t\t\tsqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+320 /* &zBuf[0] */, ts+1238 /* \"%d\" */, libc.VaList(bp+56, *(*int32)(unsafe.Pointer(bp + 316 /* nCol */))))\n\t\t\ttcl.XTcl_AppendElement(tls, interp, bp+320 /* &zBuf[0] */)\n\t\t}\n\t\tfor i = 0; i < *(*int32)(unsafe.Pointer(bp + 64 /* resCount */)); i++ {\n\t\t\ttcl.XTcl_AppendElement(tls, interp, func() uintptr {\n\t\t\t\tif *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 296 /* aResult */)) + uintptr(i)*8)) != 0 {\n\t\t\t\t\treturn *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 296 /* aResult */)) + uintptr(i)*8))\n\t\t\t\t}\n\t\t\t\treturn ts + 5707 /* \"NULL\" */\n\t\t\t}())\n\t\t}\n\t} else {\n\t\ttcl.XTcl_AppendElement(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 304 /* zErr */)))\n\t}\n\tsqlite3.Xsqlite3_free_table(tls, *(*uintptr)(unsafe.Pointer(bp + 296 /* aResult */)))\n\tif *(*uintptr)(unsafe.Pointer(bp + 304 /* zErr */)) != 0 {\n\t\tsqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 304 /* zErr */)))\n\t}\n\tif sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 72 /* db */)), rc) != 0 {\n\t\treturn TCL_ERROR\n\t}\n\treturn TCL_OK\n}", "title": "" }, { "docid": "f02c09e178b774a391d77909dc74e130", "score": "0.49481842", "text": "func Select(clause string) *Clause {\n\treturn New(fmt.Sprintf(\"select %s\", clause))\n}", "title": "" }, { "docid": "9d247cdd4c3d4dd95375849a30571812", "score": "0.48911306", "text": "func (c *Connection) Prepare(name, sql string) (err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tc.logger.Error(fmt.Sprintf(\"Prepare `%s` as `%s` failed: %v\", name, sql, err))\n\t\t}\n\t}()\n\n\t// parse\n\tbuf := c.getBuf()\n\tw := newMessageWriter(buf)\n\tw.WriteCString(name)\n\tw.WriteCString(sql)\n\tw.Write(int16(0))\n\tif w.Err != nil {\n\t\treturn w.Err\n\t}\n\terr = c.txMsg('P', buf, false)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// describe\n\tbuf = c.getBuf()\n\tw = newMessageWriter(buf)\n\tw.WriteByte('S')\n\tw.WriteCString(name)\n\tif w.Err != nil {\n\t\treturn w.Err\n\t}\n\n\terr = c.txMsg('D', buf, false)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// sync\n\terr = c.txMsg('S', c.getBuf(), true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tps := preparedStatement{Name: name}\n\n\tfor {\n\t\tif t, r, rxErr := c.rxMsg(); rxErr == nil {\n\t\t\tswitch t {\n\t\t\tcase parseComplete:\n\t\t\tcase parameterDescription:\n\t\t\t\tps.ParameterOids = c.rxParameterDescription(r)\n\t\t\tcase rowDescription:\n\t\t\t\tps.FieldDescriptions = c.rxRowDescription(r)\n\t\t\t\tfor i := range ps.FieldDescriptions {\n\t\t\t\t\toid := ps.FieldDescriptions[i].DataType\n\t\t\t\t\tif ValueTranscoders[oid] != nil && ValueTranscoders[oid].DecodeBinary != nil {\n\t\t\t\t\t\tps.FieldDescriptions[i].FormatCode = 1\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase noData:\n\t\t\tcase readyForQuery:\n\t\t\t\tc.rxReadyForQuery(r)\n\t\t\t\tc.preparedStatements[name] = &ps\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tif e := c.processContextFreeMsg(t, r); e != nil && err == nil {\n\t\t\t\t\terr = e\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\treturn rxErr\n\t\t}\n\t}\n}", "title": "" }, { "docid": "acdf1351e32ac0bb2a703384028a1f71", "score": "0.48858574", "text": "func prepareSql(tls *libc.TLS, zFormat uintptr, va uintptr) uintptr { /* mptest.c:357:21: */\n\tbp := tls.Alloc(28)\n\tdefer tls.Free(28)\n\n\tvar ap va_list\n\t_ = ap\n\tvar zSql uintptr\n\tvar rc int32\n\t*(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)) = uintptr(0)\n\tap = va\n\tzSql = sqlite3.Xsqlite3_vmprintf(tls, zFormat, ap)\n\t_ = ap\n\trc = sqlite3.Xsqlite3_prepare_v2(tls, g.db, zSql, -1, bp+24 /* &pStmt */, uintptr(0))\n\tif rc != 0 {\n\t\tsqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)))\n\t\tfatalError(tls, ts+122 /* \"%s\\n%s\\n\" */, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, g.db), zSql))\n\t}\n\tsqlite3.Xsqlite3_free(tls, zSql)\n\treturn *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */))\n}", "title": "" }, { "docid": "d41991629d1acd3b75e6cd0b4587e1b8", "score": "0.487642", "text": "func (sq *SubQuery) String() string {\n\tif sq.Stmt != nil {\n\t\tstmtStr := strings.TrimSuffix(sq.Stmt.OriginText(), \";\")\n\t\treturn fmt.Sprintf(\"(%s)\", stmtStr)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "b58ada92ce2d42533919bfea944f5a6d", "score": "0.48733628", "text": "func (g *Grammars) CompileSelect() { g.Builder.PSql = g.compileSelect() }", "title": "" }, { "docid": "a144a78f0ab3d4efbbd81db0e01cc848", "score": "0.4868809", "text": "func batchString(batchSize int, tableName string, newFirstLine []string, lenRecord int) string {\n\tphSlice := make([]string, batchSize)\n\txs := make([]string, 4)\n\txs[0] = fmt.Sprintf(\"INSERT INTO %s (\", tableName)\n\tfields := strings.Join(newFirstLine, \",\")\n\txs[1] = strings.TrimSuffix(fields, \" ,\")\n\txs[2] = \")VALUES \"\n\tfor i := 0; i < batchSize; i++ {\n\t\tph := \"(\"\n\t\tph += strings.Repeat(\"?, \", lenRecord)\n\t\tph = strings.TrimSuffix(ph, \", \")\n\t\tph += \"),\"\n\t\tphSlice[i] = ph\n\t}\n\tphs := strings.Join(phSlice, \" \")\n\txs[3] = strings.TrimSuffix(phs, \",\")\n\tqstring := strings.Join(xs, \" \")\n\treturn qstring\n}", "title": "" }, { "docid": "0eccf0bd4c42ab13e20d5593f8fef39d", "score": "0.48624897", "text": "func (q *Stmt) String() string {\n\tif q.sql == nil {\n\t\tvar argNo int = 1\n\t\t// Build a query\n\t\tbuf := getBuffer()\n\t\tq.sql = buf\n\n\t\tpos := 0\n\t\tfor n, chunk := range q.chunks {\n\t\t\t// Separate clauses with spaces\n\t\t\tif n > 0 && chunk.pos > pos {\n\t\t\t\tbuf.Write(space)\n\t\t\t}\n\t\t\ts := q.buf.B[chunk.bufLow:chunk.bufHigh]\n\t\t\tif chunk.argLen > 0 && q.dialect == PostgreSQL {\n\t\t\t\targNo, _ = writePg(argNo, s, buf)\n\t\t\t} else {\n\t\t\t\tbuf.Write(s)\n\t\t\t}\n\t\t\tpos = chunk.pos\n\t\t}\n\t}\n\treturn bufToString(&q.sql.B)\n}", "title": "" }, { "docid": "3383d3cc3939526eba88a605c4cc3178", "score": "0.4836276", "text": "func Sel(sqlPath string) (data []map[string]interface{}) {\r\n\t//get query results\r\n\tquery, err := ioutil.ReadFile(sqlPath)\r\n\thandle(err)\r\n\r\n\trows, err := DB.Query(string(query))\r\n\thandle(err)\r\n\tdefer rows.Close()\r\n\r\n\t//column names\r\n\tcols, _ := rows.Columns()\r\n\r\n\t//array of typed addresses to write results to\r\n\taddresses := sqlConvertTypes(rows)\r\n\r\n\tfor rows.Next() {\r\n\r\n\t\t// Scan the result into the column pointers...\r\n\t\terr := rows.Scan(addresses...)\r\n\t\thandle(err)\r\n\r\n\t\t// Create our map, and retrieve the value for each column from the pointers slice,\r\n\t\t// storing it in the map with the name of the column as the key.\r\n\t\tm := make(map[string]interface{})\r\n\t\tfor i, colName := range cols {\r\n\t\t\tval := reflect.ValueOf(addresses[i]).Elem().Field(0).Interface()\r\n\t\t\tm[colName] = val\r\n\t\t}\r\n\r\n\t\t// Outputs: map[columnName:value columnName2:value2 columnName3:value3 ...]\r\n\t\tdata = append(data, m)\r\n\t}\r\n\r\n\treturn data\r\n\r\n}", "title": "" }, { "docid": "3fad0edda6925a30916ea297203cf975", "score": "0.48287076", "text": "func (stmt *commonStmt) String() string {\n\tstmt.initOnce()\n\treturn stmt.query\n}", "title": "" }, { "docid": "5ee261f13b085d794d25fd8ae3e93d8e", "score": "0.48272824", "text": "func (q *InsertQuery) String() string {\n\tvalues := q.Stmt.Rows.(vtparser.Values)\n\tfor idx, columnValue := range q.ColumnValues {\n\t\tif columnValue == nil {\n\t\t\tcontinue\n\t\t}\n\t\tvalues[0][idx] = columnValue()\n\t}\n\treturn vtparser.String(q.Stmt)\n}", "title": "" }, { "docid": "e22f10d95fe78a869f474c967d922015", "score": "0.48161232", "text": "func (b *Builder) generateSelectColumns(query string, table string, column Column, first bool) (string, bool) {\n\tif first {\n\t\tfirst = false\n\t} else {\n\t\tquery = fmt.Sprintf(`%s,`, query)\n\t}\n\n\tcol := column.ToString(table)\n\tquery = fmt.Sprintf(`%s %s`, query, col)\n\treturn query, first\n}", "title": "" }, { "docid": "3657487b46663e8ec84f95cf0dfa01bc", "score": "0.48127827", "text": "func (s *SQL) BuildQuery() (string, []interface{}, error) {\n\tbuf := &bytes.Buffer{}\n\tvar args []interface{}\n\tif s.clause.dbSelect != nil {\n\t\t_, _ = buf.WriteString(\"SELECT \")\n\t\tselectCond := s.clause.dbSelect.condition\n\t\tif s.clause.count != nil {\n\t\t\t_, _ = buf.WriteString(s.clause.count.condition)\n\t\t\tn := strings.Index(selectCond, \"FROM\")\n\t\t\tif n > 0 {\n\t\t\t\tselectCond = selectCond[n:]\n\t\t\t}\n\t\t}\n\t\t_, _ = buf.WriteString(selectCond)\n\t\tif s.clause.dbSelect.args != nil {\n\t\t\targs = append(args, s.clause.dbSelect.args)\n\t\t}\n\t}\n\tif s.clause.where != nil {\n\t\t_, _ = buf.WriteString(\" WHERE\" + s.clause.where.condition)\n\t\tif s.clause.dbSelect != nil && s.clause.dbSelect.args != nil {\n\t\t\targs = append(args, s.clause.where.args)\n\t\t}\n\t}\n\tif s.clause.offset != nil {\n\t\t_, _ = buf.WriteString(\"OFFSET \" + s.clause.offset.condition)\n\t\tif s.clause.dbSelect.args != nil {\n\t\t\targs = append(args, s.clause.offset.args)\n\t\t}\n\t}\n\tif s.clause.limit != nil {\n\t\t_, _ = buf.WriteString(\"LIMIT\" + s.clause.limit.condition)\n\t\tif s.clause.dbSelect.args != nil {\n\t\t\targs = append(args, s.clause.limit.args)\n\t\t}\n\t}\n\t_, _ = buf.WriteString(\";\")\n\tif s.verbose {\n\t\tfmt.Println(buf.String())\n\t}\n\treturn buf.String(), cleanArgs(args...), nil\n}", "title": "" }, { "docid": "8abc0161d77c09c8568488f57dac4d50", "score": "0.48087507", "text": "func (s *SelectStmt) SQL() string {\n\treturn s.sql(s.buildSQL)\n}", "title": "" }, { "docid": "96c26268a46367ed4f9ce6e2532f3c82", "score": "0.479535", "text": "func Select(columns ...string) SelectBuilder {\n\treturn StatementBuilder.Select(columns...)\n}", "title": "" }, { "docid": "8a5777dcf644052c715010f22359c62b", "score": "0.47915006", "text": "func (s *SqlStore) queryToStrings(stmt string) ([]string, error) {\n\tvar output []string\n\n\trows, err := s.DB.Query(stmt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor rows.Next() {\n\t\tvar i string\n\t\terr = rows.Scan(&i)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\toutput = append(output, i)\n\t}\n\n\treturn output, nil\n}", "title": "" }, { "docid": "123285fcc5fa99530186adb4f85cbd87", "score": "0.47912255", "text": "func (self *PgDB) info(q string, args ...interface{}) ([]string, error) {\n var info []string\n\n err := self.query(func(r *sql.Rows) error {\n var inf string\n\n if err := r.Scan(&inf); err != nil {\n return err\n }\n info = append(info, inf)\n\n return nil\n }, q, args...)\n\n return info, err\n}", "title": "" }, { "docid": "ea00c8a744a208c4993fb3de3783010a", "score": "0.47911507", "text": "func SelectAllStatement(e *Entity) string {\n\n\tchunks := []string{}\n\tchunks = append(chunks, \"SELECT\")\n\n\tcolumns := []string{}\n\tfor _, a := range e.Attributes {\n\t\tcolumns = append(columns, AttributeColumnName(a))\n\t}\n\n\tfor _, r := range e.Relations {\n\t\tif r.HasModifier(\"belongsTo\") || r.HasModifier(\"hasOne\") {\n\t\t\tcolumns = append(columns, RelationColumnName(r))\n\t\t}\n\t}\n\n\tchunks = append(chunks, strings.Join(columns, \",\"))\n\tchunks = append(chunks, \"FROM\")\n\tchunks = append(chunks, TableName(e))\n\treturn strings.Join(chunks, \" \")\n\n}", "title": "" }, { "docid": "680b0a5fa8b02b7a12c71e41037b292f", "score": "0.47901925", "text": "func (p part) sql() (sql string, args []interface{}, err error) {\n\tif p.key == \"upload\" {\n\t\tswitch p.operator {\n\t\tcase equals:\n\t\t\treturn \"SELECT UploadID, RecordID FROM Records WHERE UploadID = ?\", []interface{}{p.value}, nil\n\t\tcase lt:\n\t\t\treturn \"SELECT UploadID, RecordID FROM Records WHERE UploadID < ?\", []interface{}{p.value}, nil\n\t\tcase gt:\n\t\t\treturn \"SELECT UploadID, RecordID FROM Records WHERE UploadID > ?\", []interface{}{p.value}, nil\n\t\tcase ltgt:\n\t\t\treturn \"SELECT UploadID, RecordID FROM Records WHERE UploadID < ? AND UploadID > ?\", []interface{}{p.value, p.value2}, nil\n\t\t}\n\t}\n\tswitch p.operator {\n\tcase equals:\n\t\tif p.value == \"\" {\n\t\t\t// TODO(quentin): Implement support for searching for missing labels.\n\t\t\treturn \"\", nil, fmt.Errorf(\"missing value for key %q\", p.key)\n\t\t}\n\t\treturn \"SELECT UploadID, RecordID FROM RecordLabels WHERE Name = ? AND Value = ?\", []interface{}{p.key, p.value}, nil\n\tcase lt:\n\t\treturn \"SELECT UploadID, RecordID FROM RecordLabels WHERE Name = ? AND Value < ?\", []interface{}{p.key, p.value}, nil\n\tcase gt:\n\t\tif p.value == \"\" {\n\t\t\t// Simplify queries for any value.\n\t\t\treturn \"SELECT UploadID, RecordID FROM RecordLabels WHERE Name = ?\", []interface{}{p.key}, nil\n\t\t}\n\t\treturn \"SELECT UploadID, RecordID FROM RecordLabels WHERE Name = ? AND Value > ?\", []interface{}{p.key, p.value}, nil\n\tcase ltgt:\n\t\treturn \"SELECT UploadID, RecordID FROM RecordLabels WHERE Name = ? AND Value < ? AND Value > ?\", []interface{}{p.key, p.value, p.value2}, nil\n\tdefault:\n\t\tpanic(\"unknown operator \" + string(p.operator))\n\t}\n}", "title": "" }, { "docid": "9b2df98294bf6eb57e98f226a22e1d7e", "score": "0.47895756", "text": "func SQLPara(arrStr []string) string {\n\treturn strings.Trim(strings.Repeat(\"?,\", len(arrStr)), \",\")\n}", "title": "" }, { "docid": "ae8787ca5b3eb6a89252651e370239e7", "score": "0.47869858", "text": "func createSQLInMarks(count int) string {\n\ts := \"?\"\n\tfor i := 1; i < count; i++ {\n\t\ts += \",?\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "8357f70bd2a9527d40f9b6345ba36895", "score": "0.47790667", "text": "func (c *client) Select(ctx context.Context, dest interface{}, query string, args ...interface{}) error {\n\terr := c.db.Select(dest, query, args...)\n\tif err == sql.ErrNoRows {\n\t\treturn nil\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9d764c1c1668fc7ddb022d17aa8f2a05", "score": "0.47754902", "text": "func (adapter *PostgresAdapter) SelectRowQuery(tableName, fields, indexValue string) string {\n\treturn Cleanf(\"SELECT %s FROM %s.%s WHERE %s = '%s';\",\n\t\tfields, // select\n\t\tadapter.Schema, adapter.SecureName(tableName), // from\n\t\ttypes.SQLColumnLabelHeight, indexValue, // where\n\t)\n}", "title": "" }, { "docid": "076b9e594112eb6020cad5a0323944de", "score": "0.47497344", "text": "func (ec *ExpressionChain) Select(fields ...string) *ExpressionChain {\n\tec.mainOperation = &querySegmentAtom{\n\t\tsegment: sqlSelect,\n\t\texpression: ec.populateTablePrefixes(strings.Join(fields, \", \")),\n\t\targuments: nil,\n\t\tsqlBool: SQLNothing,\n\t}\n\treturn ec\n}", "title": "" }, { "docid": "2ff60b689500cb41404ec145d9986520", "score": "0.47461542", "text": "func (u *__HTTPRPCLog_Selector) _stoSql() (string, []interface{}) {\n\tsqlWherrs, whereArgs := whereClusesToSql(u.wheres, u.whereSep)\n\n\tsqlstr := \"SELECT \" + u.selectCol + \" FROM sun_log.http_rpc_log\"\n\n\tif len(strings.Trim(sqlWherrs, \" \")) > 0 { //2 for safty\n\t\tsqlstr += \" WHERE \" + sqlWherrs\n\t}\n\n\tif u.orderBy != \"\" {\n\t\tsqlstr += u.orderBy\n\t}\n\n\tif u.limit != 0 {\n\t\tsqlstr += \" LIMIT \" + strconv.Itoa(u.limit)\n\t}\n\n\tif u.offset != 0 {\n\t\tsqlstr += \" OFFSET \" + strconv.Itoa(u.offset)\n\t}\n\treturn sqlstr, whereArgs\n}", "title": "" }, { "docid": "df3ed2d935292d9b392a2bb2dfbcc4c7", "score": "0.47363174", "text": "func (self *Query) Select(column string) *Query {\n\tvar size = len(self.Requested) + 1\n\tvar tmp = make([]string, size, size)\n\tcopy(tmp, self.Requested)\n\tself.Requested = tmp\n\tself.Requested[size - 1] = column\n\treturn self\n}", "title": "" }, { "docid": "4fe439c7fcb5229964f2537959a7250f", "score": "0.47266805", "text": "func idxPrintfPrepareStmt(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg uintptr, zFmt uintptr, va uintptr) int32 { /* sqlite3expert.c:324:12: */\n\tvar ap va_list\n\t_ = ap\n\tvar rc int32\n\tvar zSql uintptr\n\tap = va\n\tzSql = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)\n\tif zSql == uintptr(0) {\n\t\trc = SQLITE_NOMEM\n\t} else {\n\t\trc = idxPrepareStmt(tls, db, ppStmt, pzErrmsg, zSql)\n\t\tsqlite3.Xsqlite3_free(tls, zSql)\n\t}\n\t_ = ap\n\treturn rc\n}", "title": "" }, { "docid": "b0e237b18c5817014d4cbbdf80286a86", "score": "0.47210002", "text": "func (link *DBaseLink) executeSelectSql(sqlText string, params []interface{}, unit interface{}) (err error) {\n\tdefer DdlPanicRecover(&err)\n\tvar timer lla.DurationTimer\n\ttimer.StartTimer()\n\n\tvar row *sql.Rows\n\trow, err = link.conn.doQuery(sqlText, params...)\n\tlink.SqlTime = timer.Microseconds()\n\tif err == nil {\n\t\tlink.Done, err = fetchSelectedRow(row, unit)\n\t}\n\tddlLog.Debug(\"SQL SelectOne return %s\", lla.GetErrorText(err))\n\treturn err\n}", "title": "" }, { "docid": "3f71c0b85035682cf8c3844c35249239", "score": "0.4717892", "text": "func (fc *FrontendConn) getSelectExecDB(sql string, tokens []string, tokensLen int) (*ExecuteDB, error) {\n\texecuteDB := new(ExecuteDB)\n\texecuteDB.sql = sql\n\texecuteDB.RwSplit = false\n\n\t//if len(rules) != 0 {\n\t// for i := 1; i < tokensLen; i++ {\n\t// if strings.ToLower(tokens[i]) == mysql.TK_STR_FROM {\n\t// if i+1 < tokensLen {\n\t// DBName, tableName := sqlparser.GetDBTable(tokens[i+1])\n\t// //if the token[i+1] like this:kingshard.test_shard_hash\n\t// if DBName != \"\" {\n\t// ruleDB = DBName\n\t// } else {\n\t// ruleDB = c.logicDb\n\t// }\n\t// if router.GetSchemaRule(ruleDB, tableName) != nil {\n\t// return nil, nil\n\t// } else {\n\t// //if the table is not shard table,send the sql\n\t// //to default db\n\t// break\n\t// }\n\t// }\n\t// }\n\t//\n\t// if strings.ToLower(tokens[i]) == mysql.TK_STR_LAST_INSERT_ID {\n\t// return nil, nil\n\t// }\n\t// }\n\t//}\n\n\t//if send to master\n\t//if 2 < tokensLen {\n\t// if strings.ToLower(tokens[1]) == mysql.TK_STR_MASTER_HINT {\n\t// executeDB.IsSlave = false\n\t// }\n\t//}\n\terr := fc.SetExecuteNodeForDefault(executeDB)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn executeDB, nil\n}", "title": "" }, { "docid": "65a300613fdb09bfd36f6d4766c8b463", "score": "0.4714638", "text": "func Select(columns ...interface{}) *Query {\n\n\treturn &Query{\n\t\tColumns: interfaceToString(columns),\n\t\tTypeQuery: \"select\",\n\t}\n}", "title": "" }, { "docid": "f340d67ff826bcbe704bd12e2b0fc755", "score": "0.4713415", "text": "func get_sqlite_pointer(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:82:26: */\n\tbp := tls.Alloc(212)\n\tdefer tls.Free(212)\n\n\tvar p uintptr\n\t// var cmdInfo Tcl_CmdInfo at bp+48, 64\n\n\t// var zBuf [100]int8 at bp+112, 100\n\n\tif objc != 2 {\n\t\ttcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+15302 /* \"SQLITE-CONNECTIO...\" */)\n\t\treturn TCL_ERROR\n\t}\n\tif !(tcl.XTcl_GetCommandInfo(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+48 /* &cmdInfo */) != 0) {\n\t\ttcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15320, /* \"command not foun...\" */\n\t\t\ttcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), uintptr(0)))\n\t\treturn TCL_ERROR\n\t}\n\tp = (*Tcl_CmdInfo)(unsafe.Pointer(bp + 48 /* &cmdInfo */)).FobjClientData\n\tsqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+112 /* &zBuf[0] */, ts+13802 /* \"%p\" */, libc.VaList(bp+24, (*struct{ Fdb uintptr })(unsafe.Pointer(p)).Fdb))\n\ttcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+112 /* &zBuf[0] */, 0))\n\treturn TCL_OK\n}", "title": "" }, { "docid": "470d2d8572196601c4ed41db77f89a22", "score": "0.47056088", "text": "func Select(column ...interface{}) SelectStmt {\n\treturn createSelectStmt(column)\n}", "title": "" }, { "docid": "95ba809918242b4fed8db95af691487f", "score": "0.46989727", "text": "func (b SelectBuilder) Build(sb io.StringWriter, aa Placeholders) error {\n\t_, _ = sb.WriteString(\"SELECT \")\n\n\tfor i, col := range b.cols {\n\t\tif i > 0 {\n\t\t\t_, _ = sb.WriteString(\", \")\n\t\t}\n\t\t_, _ = sb.WriteString(col)\n\t}\n\n\tif b.from != nil {\n\t\tif err := b.from.Build(sb, aa); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif b.where != nil {\n\t\tif err := b.where.Build(sb, aa); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8a639313069bad072e11fd258d59195a", "score": "0.46969894", "text": "func (self *TSession) Select(fields ...string) *TSession {\r\n\tself.Statement.Select(fields...)\r\n\treturn self\r\n}", "title": "" }, { "docid": "8e2ef46f69c8040ceb72f331ccffe9a1", "score": "0.46956787", "text": "func Select(fields ...string) *Query {\n\treturn &Query{\n\t\tqueryType: SelectQuery,\n\t\tquery: fmt.Sprintf(selectTemplate, strings.Join(fields, `, `)),\n\t\tselectFields: fields,\n\t}\n}", "title": "" }, { "docid": "57403267e56d2c767e24956a9eae13b4", "score": "0.4693591", "text": "func (adapter *PostgresAdapter) SelectLogQuery() string {\n\tquery := `\n\t\tSELECT DISTINCT %s,%s FROM %s.%s l WHERE %s = $1;`\n\n\treturn Cleanf(query,\n\t\ttypes.SQLColumnLabelTableName, types.SQLColumnLabelEventName, // select\n\t\tadapter.Schema, types.SQLLogTableName, // from\n\t\ttypes.SQLColumnLabelHeight) // where\n}", "title": "" }, { "docid": "39e514ce0edc901965781fd248f447ec", "score": "0.46909603", "text": "func unionSourceToStr(tls *libc.TLS, pRc uintptr, pTab uintptr, pSrc uintptr, pzErr uintptr) uintptr { /* unionvtab.c:555:13: */\n\tbp := tls.Alloc(4)\n\tdefer tls.Free(4)\n\n\tvar zRet uintptr = uintptr(0)\n\tif *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK {\n\t\tvar db uintptr = func() uintptr {\n\t\t\tif (*UnionTab)(unsafe.Pointer(pTab)).FbSwarm != 0 {\n\t\t\t\treturn (*UnionSrc)(unsafe.Pointer(pSrc)).Fdb\n\t\t\t}\n\t\t\treturn (*UnionTab)(unsafe.Pointer(pTab)).Fdb\n\t\t}()\n\t\t*(*int32)(unsafe.Pointer(bp /* rc */)) = unionIsIntkeyTable(tls, db, pSrc, pzErr)\n\t\tvar pStmt uintptr = unionPrepare(tls, bp /* &rc */, db,\n\n\t\t\tts+7954 /* \"SELECT group_con...\" */, pzErr)\n\t\tif *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {\n\t\t\tsqlite3.Xsqlite3_bind_text(tls, pStmt, 1, (*UnionSrc)(unsafe.Pointer(pSrc)).FzTab, -1, uintptr(0))\n\t\t\tsqlite3.Xsqlite3_bind_text(tls, pStmt, 2, (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb, -1, uintptr(0))\n\t\t\tif SQLITE_ROW == sqlite3.Xsqlite3_step(tls, pStmt) {\n\t\t\t\tvar z uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 0)\n\t\t\t\tzRet = unionStrdup(tls, bp /* &rc */, z)\n\t\t\t}\n\t\t\tunionFinalize(tls, bp /* &rc */, pStmt, pzErr)\n\t\t}\n\t\t*(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp /* rc */))\n\t}\n\n\treturn zRet\n}", "title": "" }, { "docid": "7cef727fd8abfc9e9c153ce2083b0627", "score": "0.4687451", "text": "func (*ConcreteDB) Select() manager.Mail", "title": "" }, { "docid": "6678317cea713d59044a1a829c6db073", "score": "0.4687031", "text": "func AppointmentStrCol(col, where string, args ...interface{}) (strColRecs []string, err error) {\n\tsql := \"SELECT \" + col + \" FROM appointments\"\n\tif len(where) > 0 {\n\t\tsql = sql + \" WHERE \" + where\n\t}\n\tstmt, err := DB.Preparex(DB.Rebind(sql))\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\terr = stmt.Select(&strColRecs, args...)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\treturn strColRecs, nil\n}", "title": "" }, { "docid": "b0e89298dddee10aad4cbf4dd5081ff6", "score": "0.4678511", "text": "func (mysql *Mysql) SelectWhere(table *Table, rows ...string) string {\n\tvar buffer bytes.Buffer\n\n\tbuffer.WriteString(mysql.SelectAll(table))\n\tbuffer.WriteString(\" where \")\n\n\tlength := len(rows) - 1\n\tfor index, row := range rows {\n\t\tbuffer.WriteString(row)\n\t\tbuffer.WriteString(\"=?\")\n\t\tif index < length {\n\t\t\tbuffer.WriteString(\" and \")\n\t\t}\n\t}\n\n\treturn buffer.String()\n}", "title": "" }, { "docid": "9c5e6036bdd383c8c2a4583db24305d2", "score": "0.46724632", "text": "func (m *MockedDatabase) Select(d interface{}, q string, a ...interface{}) error {\n\targs := m.Called(d, q, a)\n\treturn args.Error(0)\n}", "title": "" }, { "docid": "a9ad11b979eca75cc52c5c79e285bced", "score": "0.4672158", "text": "func (q *Query) Select(selstmt string) *Query {\n\tr, err := regexp.Compile(`^([a-zA-Z\\,]+)`)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t} else {\n\t\tw := r.FindAllStringSubmatch(selstmt, -1)\n\t\tif len(w) == 1 && len(w[0]) == 2 {\n\t\t\tq.Sel = &Select{strings.Split(w[0][1], \",\")}\n\t\t}\n\t}\n\treturn q\n}", "title": "" }, { "docid": "576f63385b0c07649b094940531f7626", "score": "0.4665762", "text": "func (stmt *SelectStmt) Select(db DB, dest interface{}, args ...interface{}) error {\n\tstmt.initOnce()\n\tif stmt.err != nil {\n\t\treturn stmt.err\n\t}\n\tdestValue := reflect.ValueOf(dest)\n\n\tif destValue.Kind() != reflect.Ptr {\n\t\treturn stmt.errorSliceType()\n\t}\n\tif destValue.IsNil() {\n\t\treturn errors.New(\"Select: nil pointer passed as dest\")\n\t}\n\n\tsliceValue := reflect.Indirect(destValue)\n\tsliceType := sliceValue.Type()\n\tif sliceType.Kind() != reflect.Slice {\n\t\treturn stmt.errorSliceType()\n\t}\n\n\trowType := sliceType.Elem()\n\tisPtr := rowType.Kind() == reflect.Ptr\n\tif isPtr {\n\t\trowType = rowType.Elem()\n\t}\n\tif rowType != stmt.rowType {\n\t\treturn stmt.errorSliceType()\n\t}\n\n\trows, err := db.Query(stmt.query, args...)\n\tif err != nil {\n\t\tstmt.logError(args, err)\n\t\treturn err\n\t}\n\tdefer rows.Close()\n\n\tvar rowCount = 0\n\tif stmt.Logger != nil {\n\t\tdefer func() {\n\t\t\tstmt.logSuccess(args, rowCount)\n\t\t}()\n\t}\n\n\tscanValues := make([]interface{}, len(stmt.columns))\n\n\tfor rows.Next() {\n\t\trowCount++\n\t\trowValuePtr := reflect.New(rowType)\n\t\trowValue := reflect.Indirect(rowValuePtr)\n\t\tfor i, col := range stmt.columns {\n\t\t\tcellValue := col.Index.ValueRW(rowValue)\n\t\t\tscanValues[i] = cellValue.Addr().Interface()\n\t\t}\n\t\terr = rows.Scan(scanValues...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif isPtr {\n\t\t\tsliceValue.Set(reflect.Append(sliceValue, rowValuePtr))\n\t\t} else {\n\t\t\tsliceValue.Set(reflect.Append(sliceValue, rowValue))\n\t\t}\n\t}\n\n\treturn rows.Err()\n}", "title": "" }, { "docid": "5a7f02e62d6fe648fed51fd919c57067", "score": "0.46618354", "text": "func getSQLInfo() (string, string, string, string, string, string) {\n\tfmt.Println(\"\\nPlease enter host\")\n\tfmt.Scanln(&host)\n\tfmt.Println(\"\\nPlease enter port\")\n\tfmt.Scanln(&port)\n\tfmt.Println(\"\\nPlease enter user\")\n\tfmt.Scanln(&user)\n\tfmt.Println(\"\\nPlease enter password\")\n\tfmt.Scanln(&password)\n\tfmt.Println(\"\\nPlease enter dbname\")\n\tfmt.Scanln(&dbname)\n\tfmt.Println(\"\\nSSL mode?(enable or disable)\")\n\tfmt.Scanln(&sslMode)\n\treturn host, user, password, dbname, port, sslMode\n}", "title": "" }, { "docid": "f726bc25c002ab4097a594cb15b19e56", "score": "0.46537703", "text": "func (db *SQLDB) Select(table string, query string) (*sql.Rows, error) {\n\tif table == \"\"{\n\t\tclog.Debugf(\"table name not provided for select query, using default %s\", db.Table)\n\t\ttable = db.Table\n\t}\n\tif query == \"\"{\n\t\tquery = fmt.Sprintf(\"select * from %s limit 10\", table)\n\t}\n\treturn db.Db.Query(query)\n}", "title": "" }, { "docid": "297241d090fc787521d3485826057c02", "score": "0.46485236", "text": "func (q *Query) Select(fields ...string) *Query {\n\tfor _, field := range fields {\n\t\tq.ser.PutVarCUInt(querySelectFilter).PutVString(field)\n\t}\n\treturn q\n}", "title": "" }, { "docid": "6ada04585ce915d0eedba26741a6d6b2", "score": "0.46471593", "text": "func (df DataFrame) Select(c ...string) DataFrame {\n\trdf := make(DataFrame, len(c))\n\tfor _, col := range c {\n\t\trdf[col] = df[col]\n\t}\n\treturn rdf\n}", "title": "" }, { "docid": "63eb952ddc1fefee883a244ee33e379c", "score": "0.4643497", "text": "func newRawStmt(conn conn, rs string, v ...interface{}) *rawStmt {\n\ts := &rawStmt{}\n\ts.conn = conn\n\ts.cmd = &syntax.RawClause{RawStr: rs, Values: v}\n\treturn s\n}", "title": "" }, { "docid": "95a1698af208ab4af729ce58f6940094", "score": "0.46420795", "text": "func (db *Storage) Read(ctxt Context, val interface{}, columns ...string) error {\n\tctxt = debugContext(ctxt)\n\tt, _, err := db.findType(val, \"Read\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar buf bytes.Buffer\n\tvar args, scanargs []interface{}\n\trval := reflect.ValueOf(val).Elem()\n\n\twant := make(map[string]bool)\n\tfor _, name := range columns {\n\t\twant[name] = true\n\t}\n\n\tfmt.Fprintf(&buf, \"select \")\n\tsep := \"\"\n\tvar fixes []func()\n\tfor _, col := range t.fields {\n\t\tif !want[col.name] && !want[\"ALL\"] {\n\t\t\tcontinue\n\t\t}\n\t\tdelete(want, col.name)\n\t\tif col.key {\n\t\t\tcontinue // already set\n\t\t}\n\t\tfmt.Fprintf(&buf, \"%s%q\", sep, col.name)\n\t\tsep = \", \"\n\t\tscanargs = append(scanargs, rval.FieldByIndex(col.index).Addr().Interface())\n\t\tif col.utf8 {\n\t\t\tfixes = append(fixes, func() {\n\t\t\t\tv := rval.FieldByIndex(col.index)\n\t\t\t\ts := v.String()\n\t\t\t\tif !utf8.ValidString(s) {\n\t\t\t\t\tv.SetString(string([]rune(s)))\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n\tif sep == \"\" {\n\t\t// nothing to select, but want to provide error if not there.\n\t\t// select count of rows.\n\t\tfmt.Fprintf(&buf, \"count(*)\")\n\t\tscanargs = append(scanargs, new(int))\n\t}\n\n\tdelete(want, \"ALL\")\n\tif len(want) != 0 {\n\t\t// some column wasn't found\n\t\tfor _, name := range columns {\n\t\t\tif want[name] {\n\t\t\t\treturn fmt.Errorf(\"unknown column %q\", name)\n\t\t\t}\n\t\t}\n\t}\n\n\tfmt.Fprintf(&buf, \" from %q where \", t.name)\n\tsep = \"\"\n\tfor _, col := range t.fields {\n\t\tif !col.key {\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Fprintf(&buf, \"%s%q = ?\", sep, col.name)\n\t\tsep = \" and \"\n\t\targs = append(args, rval.FieldByIndex(col.index).Interface())\n\t}\n\n\trows, err := ctxt.Query(buf.String(), args...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rows.Close()\n\n\tif !rows.Next() {\n\t\tif err := rows.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn ErrNotFound\n\t}\n\n\tif err := rows.Scan(scanargs...); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, fix := range fixes {\n\t\tfix()\n\t}\n\n\treturn nil\n}", "title": "" } ]
eed3ddc5dea53a91aa4d5b61e7f7024f
SetMetadata overrides the packaged application metadata. This data can be used in many places like notifications and about screens.
[ { "docid": "5dc8969d80e5f208c63ca52dd5638a8e", "score": "0.82996696", "text": "func SetMetadata(m fyne.AppMetadata) {\n\tmeta = m\n}", "title": "" } ]
[ { "docid": "32b78b4c6e78a48a913afec4d20d3e67", "score": "0.7303202", "text": "func (d *SingularityDeploy) SetMetadata(m map[string]string) Deploy {\n\td.Metadata = m\n\treturn d\n}", "title": "" }, { "docid": "bd4dcd0e2b362ac48d07c54b85a5fe45", "score": "0.71273243", "text": "func (o *LaunchSpecification) SetMetadata(v []*Metadata) *LaunchSpecification {\n\tif o.Metadata = v; o.Metadata == nil {\n\t\to.nullFields = append(o.nullFields, \"Metadata\")\n\t}\n\treturn o\n}", "title": "" }, { "docid": "c48abe73c42a0b1be594fccc6f982e58", "score": "0.7039065", "text": "func (o *UpdateProduct) SetMetadata(v map[string]string) {\n\to.Metadata = &v\n}", "title": "" }, { "docid": "03fa2d1c63b1e24d2acb25c5f4fa01e7", "score": "0.6975246", "text": "func (l *Logger) SetMetadata(metadata map[string]string) {\n\tif metadata != nil {\n\t\tl.metadata = metadata\n\t}\n}", "title": "" }, { "docid": "0ad36c795a92537c90f3930c97b80a58", "score": "0.68804497", "text": "func (r *Request) SetApplicationMetadata(k string, v []byte) {\n\tif r.Metadata == nil {\n\t\tr.Metadata = &driver.TokenRequestMetadata{}\n\t}\n\tif len(r.Metadata.Application) == 0 {\n\t\tr.Metadata.Application = map[string][]byte{}\n\t}\n\tr.Metadata.Application[k] = v\n}", "title": "" }, { "docid": "78afee08fbab8c776802c054b346795e", "score": "0.68438435", "text": "func (a *jsiiProxy_Artifact) SetMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\ta,\n\t\t\"setMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "e8867b8ac8ed0feef408da5dd48ac6ba", "score": "0.68346256", "text": "func (self *Flow) SetMetadata(metadata, metadataMask uint64) error {\n\taction := new(FlowAction)\n\taction.actionType = \"setMetadata\"\n\taction.metadata = metadata\n\taction.metadataMask = metadataMask\n\n\tself.lock.Lock()\n\tdefer self.lock.Unlock()\n\n\t// Add to the action db\n\tself.flowActions = append(self.flowActions, action)\n\n\t// If the flow entry was already installed, re-install it\n\tif self.isInstalled {\n\t\tself.install()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "79567c911de4985f2792b3f085107021", "score": "0.6769184", "text": "func SetMetadata(md map[string]interface{}) {\n\tdefaultLogger.metadata = md\n}", "title": "" }, { "docid": "61dfc78467901ae1f52e41150b0d9c5f", "score": "0.667698", "text": "func (rpm *MockRingpopMonitor) SetMetadata(key string, data string) error {\n\treturn nil\n}", "title": "" }, { "docid": "cdc94ff6717f9d1acc753d3fca7d58ed", "score": "0.6671281", "text": "func (r *AWSCodePipelineWebhook_WebhookAuthConfiguration) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "1680cbfaffac44c0431b842455f8525c", "score": "0.6613325", "text": "func (o *FilePath) SetMetadata(metadata []string) {\n\n\to.Metadata = metadata\n}", "title": "" }, { "docid": "4e277430ba47847357bdb963aeed49af", "score": "0.6606878", "text": "func (es *EventStore) SetMetadata(metadata string) *EventStore {\n\tes.Metadata = metadata\n\treturn es\n}", "title": "" }, { "docid": "05f99992d04b1d9fc1c1888d03032c73", "score": "0.656127", "text": "func (o *IamIdpAllOf) SetMetadata(v string) {\n\to.Metadata = &v\n}", "title": "" }, { "docid": "d9b4c0d17808b554f174854afd736886", "score": "0.65585876", "text": "func (o *TransferCreateRequest) SetMetadata(v map[string]string) {\n\to.Metadata = v\n}", "title": "" }, { "docid": "4f8ddf9bbef08a2dc2efd8a4182b6761", "score": "0.65542424", "text": "func (r *AWSServiceCatalogCloudFormationProvisionedProduct_ProvisioningPreferences) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "7845e5524bace4888878602c3d515251", "score": "0.6546936", "text": "func (s *UpdateContentInput) SetMetadata(v map[string]*string) *UpdateContentInput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "8545b30fad65dabffd9fd52ba3b2b717", "score": "0.6537778", "text": "func (s *HeadObjectOutput) SetMetadata(v map[string]*string) *HeadObjectOutput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "8545b30fad65dabffd9fd52ba3b2b717", "score": "0.6537778", "text": "func (s *HeadObjectOutput) SetMetadata(v map[string]*string) *HeadObjectOutput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "250844346cd91c28ecdc24710c94df0f", "score": "0.6505357", "text": "func (s *CreateContentInput) SetMetadata(v map[string]*string) *CreateContentInput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "398927fddc45e3665f5f597c111afb61", "score": "0.6490664", "text": "func (s *CreateMultipartUploadInput) SetMetadata(v map[string]*string) *CreateMultipartUploadInput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "9599edccbded1527295e23f09974386b", "score": "0.6489703", "text": "func (s *PutObjectInput) SetMetadata(v map[string]*string) *PutObjectInput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "9599edccbded1527295e23f09974386b", "score": "0.6489703", "text": "func (s *PutObjectInput) SetMetadata(v map[string]*string) *PutObjectInput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "fdcca226edc99010afabbbab2ef768ff", "score": "0.6477445", "text": "func (s *GetObjectOutput) SetMetadata(v map[string]*string) *GetObjectOutput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "fdcca226edc99010afabbbab2ef768ff", "score": "0.6477445", "text": "func (s *GetObjectOutput) SetMetadata(v map[string]*string) *GetObjectOutput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "25dbdd2247a7f31a689025397dc70e55", "score": "0.6449619", "text": "func (p *PluginV1) SetMetadata(meta Metadata) {\n\tp.Metadata = meta\n}", "title": "" }, { "docid": "57abd4849847fe8b657181bc863519c4", "score": "0.644593", "text": "func (r *AWSIoTEventsDetectorModel_Action) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "51d73647e63497d8d48b239d86bb2739", "score": "0.6430007", "text": "func (pc *PersonCreate) SetMetadata(m *Metadata) *PersonCreate {\n\treturn pc.SetMetadataID(m.ID)\n}", "title": "" }, { "docid": "62335b7e296d94ab661b5c7aa8aed65f", "score": "0.6429695", "text": "func (s *TrustedAdvisorResourceDetail) SetMetadata(v []*string) *TrustedAdvisorResourceDetail {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "f9eedf5f4c2d73c949298438b1a10eaa", "score": "0.6426387", "text": "func (c *TrustedClusterV2) SetMetadata(meta Metadata) {\n\tc.Metadata = meta\n}", "title": "" }, { "docid": "964b56e5a856f15985da6afd40883693", "score": "0.64258957", "text": "func (s *TrustedAdvisorCheckDescription) SetMetadata(v []*string) *TrustedAdvisorCheckDescription {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "88fc58a18549925f3671daeba34b6804", "score": "0.6396664", "text": "func (s *ContentData) SetMetadata(v map[string]*string) *ContentData {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "b3148a294320a466fa27d6403568d0d4", "score": "0.63897496", "text": "func (gu *GroupUpdate) SetMetadata(m map[string]interface{}) *GroupUpdate {\n\tgu.mutation.SetMetadata(m)\n\treturn gu\n}", "title": "" }, { "docid": "2071afb9bdf9fccfeb9555e1fab6ba27", "score": "0.6382079", "text": "func (dmu *DeathMannerUpdate) SetMetadata(m *Metadata) *DeathMannerUpdate {\n\treturn dmu.SetMetadataID(m.ID)\n}", "title": "" }, { "docid": "d257ebc14b5feae83446feccf656a785", "score": "0.6366173", "text": "func (s *CopyObjectInput) SetMetadata(v map[string]*string) *CopyObjectInput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "34159fb20bc64f9cd0cb730e15aff930", "score": "0.63439935", "text": "func (s *GetReservationPurchaseRecommendationOutput) SetMetadata(v *ReservationPurchaseRecommendationMetadata) *GetReservationPurchaseRecommendationOutput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "71d72577e4a395f4266b96606050b5f7", "score": "0.62930804", "text": "func (r *AWSS3Bucket_WebsiteConfiguration) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "cbdffd21ec7655aa45c588e7e07e283d", "score": "0.62851995", "text": "func (s *GetRightsizingRecommendationOutput) SetMetadata(v *RightsizingRecommendationMetadata) *GetRightsizingRecommendationOutput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "295a0ca97092966a0d983e8c55491d3d", "score": "0.6265424", "text": "func (s *GetOpsMetadataOutput) SetMetadata(v map[string]*MetadataValue) *GetOpsMetadataOutput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "00087700ab5ffefb32c377a3599a6f3f", "score": "0.62600666", "text": "func (r *AWSAmplifyApp_AutoBranchCreationConfig) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "4702d2d9488499b8450476ec7ec24cf6", "score": "0.62569904", "text": "func (s *CreateOpsMetadataInput) SetMetadata(v map[string]*MetadataValue) *CreateOpsMetadataInput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "cf3a063e146343c13f2b3af96c2607f9", "score": "0.6254504", "text": "func (s *ContentSummary) SetMetadata(v map[string]*string) *ContentSummary {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "2eee27d3c7e84333e772c17419cf2414", "score": "0.6252863", "text": "func (fp *File) SetMetadata(metadata metadata) {\n\tfp.Data.ClientMetadata = metadata\n}", "title": "" }, { "docid": "5798ab069da8a4e1d7be26bb4dff2dc6", "score": "0.6245036", "text": "func (opts *FileOpts) SetMetadata(obj interface{}) error {\n\tmetaStr, err := dashutil.MarshalJson(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(metaStr) > dashutil.MetadataJsonMax {\n\t\treturn dasherr.ValidateErr(fmt.Errorf(\"Metadata too large\"))\n\t}\n\topts.MetadataJson = metaStr\n\treturn nil\n}", "title": "" }, { "docid": "3a7e0bbbdcaec872c5645e1a64e2ff21", "score": "0.6200942", "text": "func (o *SparseFilePath) SetMetadata(metadata []string) {\n\n\to.Metadata = &metadata\n}", "title": "" }, { "docid": "15aee9aa4544251ffb3c6ffd7bde4d00", "score": "0.6184904", "text": "func (guo *GroupUpdateOne) SetMetadata(m map[string]interface{}) *GroupUpdateOne {\n\tguo.mutation.SetMetadata(m)\n\treturn guo\n}", "title": "" }, { "docid": "8998f5cdd5b65f3f38ab5d8781be8e98", "score": "0.6163803", "text": "func (dmuo *DeathMannerUpdateOne) SetMetadata(m *Metadata) *DeathMannerUpdateOne {\n\treturn dmuo.SetMetadataID(m.ID)\n}", "title": "" }, { "docid": "1b3970ec84766eb9e4a6b3c7070512a1", "score": "0.61633056", "text": "func (r *AWSAutoScalingPlansScalingPlan_ScalingInstruction) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "975594912a7cd8666480b67815723bbc", "score": "0.6158327", "text": "func (s *GetSavingsPlansPurchaseRecommendationOutput) SetMetadata(v *SavingsPlansPurchaseRecommendationMetadata) *GetSavingsPlansPurchaseRecommendationOutput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "81b450f856e54c37d2af321ce2a80f94", "score": "0.6122645", "text": "func (r *AWSMediaLiveChannel_OutputDestination) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "97a7f36c008fc22221cf4d36186a2d6e", "score": "0.6108467", "text": "func (o *DataPrivacyAndSecurity) SetMetadata(v ConfigurationMetadata) {\n\to.Metadata = &v\n}", "title": "" }, { "docid": "c404379fc29ee9fcf53f3bfae36a9a93", "score": "0.60777414", "text": "func (r *Refund) SetMetadata(key, value string) error {\n\tif r.Metadata == nil {\n\t\tr.Metadata = make(map[string]string)\n\t}\n\tif len(key) > 45 || len(key) < 2 {\n\t\treturn fmt.Errorf(\"The key has the wrong format (too long/short)\")\n\t}\n\tif len(value) > 500 || len(value) < 2 {\n\t\treturn fmt.Errorf(\"The value has the wrong format (too long/short)\")\n\t}\n\t_, exist := r.Metadata[key]\n\tif len(r.Metadata) == 20 && !exist {\n\t\treturn fmt.Errorf(\"Metadata is too long already\")\n\t}\n\tr.Metadata[key] = value\n\treturn nil\n}", "title": "" }, { "docid": "e1035446e02637307866a5afb4556e67", "score": "0.6067996", "text": "func (s *ListDocumentMetadataHistoryOutput) SetMetadata(v *DocumentMetadataResponseInfo) *ListDocumentMetadataHistoryOutput {\n\ts.Metadata = v\n\treturn s\n}", "title": "" }, { "docid": "b57751ec7fb2d487cc744a119a9d9cbf", "score": "0.60422146", "text": "func (r *AWSBackupBackupPlan_BackupPlanResourceType) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "87434c25b2baedcd3f22c536c348bde1", "score": "0.6023006", "text": "func (r *AWSServerlessFunction_SAMPolicyTemplate) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "260fc26c0d4671d8ac5dcc53d8cbedce", "score": "0.60059977", "text": "func (r *AWSAutoScalingScalingPolicy_TargetTrackingConfiguration) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "ecad7ea3822206375d33e084326818f1", "score": "0.5993361", "text": "func (s *Share) SetMetadata(options *FileRequestOptions) error {\n\theaders, err := s.fsc.setResourceHeaders(s.buildPath(), compMetadata, resourceShare, mergeMDIntoExtraHeaders(s.Metadata, nil), options)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.updateEtagAndLastModified(headers)\n\treturn nil\n}", "title": "" }, { "docid": "881f58b870e6deda1ee228b603459241", "score": "0.59932643", "text": "func (eu *EthnicityUpdate) SetMetadata(m *Metadata) *EthnicityUpdate {\n\treturn eu.SetMetadataID(m.ID)\n}", "title": "" }, { "docid": "2c8577baf0c2e238c723c804fc253452", "score": "0.59628594", "text": "func (o *ProcessGroup) SetMetadata(v ProcessGroupMetadata) {\n\to.Metadata = &v\n}", "title": "" }, { "docid": "fd4d5523fef41d995a8955cc68325105", "score": "0.59608334", "text": "func (o *RequestAttribute) SetMetadata(v ConfigurationMetadata) {\n\to.Metadata = &v\n}", "title": "" }, { "docid": "029192167dce36b9e51d2b0158d66100", "score": "0.5951883", "text": "func (s *ListDocumentMetadataHistoryInput) SetMetadata(v string) *ListDocumentMetadataHistoryInput {\n\ts.Metadata = &v\n\treturn s\n}", "title": "" }, { "docid": "c897809cfee834d21802dc8c39b77633", "score": "0.5914034", "text": "func (o *ModelsDeploymentTarget) SetMetadata(v ModelsDeploymentTargetMetadata) {\n\to.Metadata = &v\n}", "title": "" }, { "docid": "e653a390f45911b17a60c5d9d5a32a67", "score": "0.59115356", "text": "func (euo *EthnicityUpdateOne) SetMetadata(m *Metadata) *EthnicityUpdateOne {\n\treturn euo.SetMetadataID(m.ID)\n}", "title": "" }, { "docid": "8858230c99985661bc1d49718dc81e92", "score": "0.5905886", "text": "func (s *fs) SetMetadata(dgst digest.Digest, key string, data []byte) error {\n\ts.Lock()\n\tdefer s.Unlock()\n\tif _, err := s.get(dgst); err != nil {\n\t\treturn err\n\t}\n\n\tbaseDir := filepath.Join(s.metadataDir(dgst))\n\tif err := os.MkdirAll(baseDir, 0o700); err != nil {\n\t\treturn err\n\t}\n\treturn ioutils.AtomicWriteFile(filepath.Join(s.metadataDir(dgst), key), data, 0o600)\n}", "title": "" }, { "docid": "b384be601155ea7978464474946e4dc8", "score": "0.5893639", "text": "func WithMetadata(name, version, environment, region string, tags map[string]string) Option {\n\treturn func(c *configs) {\n\t\tc.name = name\n\t\tc.version = version\n\t\tc.environment = environment\n\t\tc.region = region\n\t\tc.tags = tags\n\t}\n}", "title": "" }, { "docid": "416389c090b80ffe8ed5431d897db1dd", "score": "0.5873064", "text": "func (o *CalculatedServiceMetric) SetMetadata(v ConfigurationMetadata) {\n\to.Metadata = &v\n}", "title": "" }, { "docid": "5099d34cf27d498904f32a864b6c6ad6", "score": "0.58670294", "text": "func (c *jsiiProxy_CfnDeviceDefinitionVersion) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "2c3f11e73d7115deb73f113e4fe1a390", "score": "0.585232", "text": "func (i *ClowdApp) SetObjectMeta(o metav1.Object, opts ...omfunc) {\n\to.SetName(i.Name)\n\to.SetNamespace(i.Namespace)\n\to.SetLabels(i.GetLabels())\n\to.SetOwnerReferences([]metav1.OwnerReference{i.MakeOwnerReference()})\n\n\tfor _, opt := range opts {\n\t\topt(o)\n\t}\n}", "title": "" }, { "docid": "7a7c9cb18e10583fade6ee5883d5f1cf", "score": "0.5836415", "text": "func (c *Client) SetUserMetadata(org, hash string, data io.Reader) error {\n\treturn c.userMetadata(http.MethodPut, org, hash, data)\n}", "title": "" }, { "docid": "34ffe2ed70a5ebabf925e8d22ad07897", "score": "0.5830727", "text": "func (r *Fleet_ServerProcess) SetCoreMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "e45e1a4ea99f682371ee2fddb80d23eb", "score": "0.5818771", "text": "func (c *jsiiProxy_CfnDeviceDefinition) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "119a56d0ed8bf85a021fc5b6939f2d09", "score": "0.5798004", "text": "func (r *UserPool) SetCoreMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "b2b2292be7a6eb44cfe975d588b3a84d", "score": "0.5785536", "text": "func (s *Store) PutMetadata(key string, data interface{}) error {\n\treturn s.putUserMetadata(key, data)\n}", "title": "" }, { "docid": "2f084a61e8f0367b1c3a74b037879728", "score": "0.57714534", "text": "func (r *AWSPinpointCampaign_Limits) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "27fccefad1ff9deab9b57443f2135d56", "score": "0.57083166", "text": "func Metadata(md map[string]string) Option {\n\treturn func(o *Options) {\n\t\to.Metadata = md\n\t}\n}", "title": "" }, { "docid": "5f5305b035eb8ed3aa91792cc838062f", "score": "0.5698861", "text": "func (_this *Window) SetOnLoadedMetaData(listener func(event *domcore.Event, currentTarget *Window)) js.Func {\n\tcb := eventFuncWindow_domcore_Event(listener)\n\t_this.Value_JS.Set(\"onloadedmetadata\", cb)\n\treturn cb\n}", "title": "" }, { "docid": "2713198c869da82841ca13e9d823658b", "score": "0.569806", "text": "func (Store *Store) SetWithMetadata(key []byte, value []byte, meta byte) error {\n\treturn Store.DB.Update(func(txn *badger.Txn) error {\n\t\te := badger.NewEntry(key, value).WithMeta(meta)\n\t\treturn txn.SetEntry(e)\n\t})\n}", "title": "" }, { "docid": "95a08a65dc80d9b9f9c6d47ec2d6ce5f", "score": "0.5693686", "text": "func (m *MetadataManager) InitializeMetadata(channel string, metadata chaincode.MetadataSet) {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\n\tm.MetadataSet[channel] = metadata\n}", "title": "" }, { "docid": "b40fc0ef26becb45e561fdb448fbc366", "score": "0.5680131", "text": "func (r *AWSCognitoUserPoolRiskConfigurationAttachment_AccountTakeoverRiskConfigurationType) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "38c6e99afc6c14515d543ff0025b8bf9", "score": "0.567821", "text": "func (u *UserV2) SetMetadata() teleservices.Metadata {\n\treturn u.Metadata\n}", "title": "" }, { "docid": "fd52236611daa13efbe2787a3ec75bd1", "score": "0.56603926", "text": "func (r *AWSKinesisFirehoseDeliveryStream_S3DestinationConfiguration) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "05c1baeb22ae4495287e0ef56071b6c6", "score": "0.5654723", "text": "func (c *jsiiProxy_CfnModuleDefaultVersion) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "5607ad9d926199d42a08ea5671709bb3", "score": "0.56289387", "text": "func (r *CodeRepository_GitConfig) SetCoreMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "f19b994778100f2a32bc73db6ec3ab85", "score": "0.5610936", "text": "func (m *PowerliftIncidentMetadata) SetApplication(value *string)() {\n err := m.GetBackingStore().Set(\"application\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "999c3598113cd8f7d7fdc8f9b811a7d2", "score": "0.5602192", "text": "func (c *jsiiProxy_CfnStackSet) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "a9d79b6cd400a80cca6451e7954d305a", "score": "0.5598196", "text": "func PackageMetadata(ctx *context.Context) {\n\tpackageName := normalizer.Replace(ctx.Params(\"id\"))\n\n\tpvs, err := packages_model.GetVersionsByPackageName(ctx, ctx.Package.Owner.ID, packages_model.TypePyPI, packageName)\n\tif err != nil {\n\t\tapiError(ctx, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tif len(pvs) == 0 {\n\t\tapiError(ctx, http.StatusNotFound, err)\n\t\treturn\n\t}\n\n\tpds, err := packages_model.GetPackageDescriptors(ctx, pvs)\n\tif err != nil {\n\t\tapiError(ctx, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\t// sort package descriptors by version to mimic PyPI format\n\tsort.Slice(pds, func(i, j int) bool {\n\t\treturn strings.Compare(pds[i].Version.Version, pds[j].Version.Version) < 0\n\t})\n\n\tctx.Data[\"RegistryURL\"] = setting.AppURL + \"api/packages/\" + ctx.Package.Owner.Name + \"/pypi\"\n\tctx.Data[\"PackageDescriptor\"] = pds[0]\n\tctx.Data[\"PackageDescriptors\"] = pds\n\tctx.HTML(http.StatusOK, \"api/packages/pypi/simple\")\n}", "title": "" }, { "docid": "afbce0c716236b707d26171366e602da", "score": "0.5589554", "text": "func (o *Device) SetDeviceMetadata(v string) {\n\to.DeviceMetadata = &v\n}", "title": "" }, { "docid": "0332be6753cf17adedb24ae0c734cfd2", "score": "0.5583497", "text": "func (c *Client) PutMetadata(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, datasetID, edition, version string, metadata EditableMetadata, versionEtag string) error {\n\turi := fmt.Sprintf(\"%s/datasets/%s/editions/%s/versions/%s/metadata\", c.hcCli.URL, datasetID, edition, version)\n\n\tpayload, err := json.Marshal(metadata)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error while attempting to marshall metadata\")\n\t}\n\n\tresp, err := c.doPutWithAuthHeaders(ctx, userAuthToken, serviceAuthToken, collectionID, uri, payload, versionEtag)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"http client returned error while attempting to make request\")\n\t}\n\tdefer closeResponseBody(ctx, resp)\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn NewDatasetAPIResponse(resp, uri)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f35beecd01fefd1d57412855abe0a8bb", "score": "0.5566076", "text": "func (s *registrationServiceImpl) SetFunctionMetadata(metadata FunctionMetadata) {\n\ts.functionMetadata = metadata\n}", "title": "" }, { "docid": "657eaec788cdbdaf374b5a59fce89246", "score": "0.55569977", "text": "func SetMetadata(ctx context.Context, project, zone, name, key, value string, isWindows bool) (*Instance, error) {\n\ti, err := CreateInstanceObject(ctx, project, zone, name, isWindows)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = i.Client.SetInstanceMetadata(i.Project, i.Zone,\n\t\ti.Name, &api.Metadata{Items: []*api.MetadataItems{BuildInstanceMetadataItem(\n\t\t\tkey, value)},\n\t\t\tFingerprint: i.Metadata.Fingerprint})\n\treturn i, err\n}", "title": "" }, { "docid": "c08917079ac47bb1d07d6ee6bce0a210", "score": "0.55554384", "text": "func (h *appHandler) setRevisionMetadata(appRev *v1beta1.ApplicationRevision) {\n\tappRev.Namespace = h.app.Namespace\n\tappRev.SetAnnotations(h.app.GetAnnotations())\n\tappRev.SetLabels(h.app.GetLabels())\n\tutil.AddLabels(appRev, map[string]string{oam.LabelAppRevisionHash: h.revisionHash})\n\tappRev.SetOwnerReferences([]metav1.OwnerReference{{\n\t\tAPIVersion: v1beta1.SchemeGroupVersion.String(),\n\t\tKind: v1beta1.ApplicationKind,\n\t\tName: h.app.Name,\n\t\tUID: h.app.UID,\n\t\tController: pointer.BoolPtr(false),\n\t}})\n}", "title": "" }, { "docid": "aabe3346f4c2ac2e38d58cf16f462602", "score": "0.5545727", "text": "func NewMetadata() *Metadata {\n\treturn &Metadata{\n\t\tLogger: ui.New(),\n\t}\n}", "title": "" }, { "docid": "0292c60fb30cc4b24031e37ef8d0d2cc", "score": "0.5540496", "text": "func (c *jsiiProxy_CfnModuleVersion) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "22a1cb2492491e16558cbb526fde576f", "score": "0.553032", "text": "func (m *Mandate) AddMetadata(key, value string) {\n\tm.Metadata[key] = value\n}", "title": "" }, { "docid": "12c7954be6c8b8c0841267761c8518a6", "score": "0.5526193", "text": "func (o *TeflonObject) SetMeta(key, value string) {\n\to.UserData[key] = value\n}", "title": "" }, { "docid": "e872817738d280fdc4e66c107e60529d", "score": "0.55255336", "text": "func (probeConfig *ProbeConfig) SetDiscoveryMetadata(discoveryMetadata *DiscoveryMetadata) {\n\t// validate the discovery intervals\n\tcheckRediscoveryIntervalValidity(discoveryMetadata.fullDiscovery,\n\t\tdiscoveryMetadata.incrementalDiscovery,\n\t\tdiscoveryMetadata.performanceDiscovery)\n\tprobeConfig.discoveryMetadata = discoveryMetadata\n}", "title": "" }, { "docid": "4fdf8fad4030e8185069d560a8480daa", "score": "0.5504151", "text": "func (e *Config) SetCloudInitMetadata(data []byte) error {\n\t*e = append(*e,\n\t\t&types.OptionValue{\n\t\t\tKey: \"guestinfo.metadata\",\n\t\t\tValue: base64.StdEncoding.EncodeToString(data),\n\t\t},\n\t\t&types.OptionValue{\n\t\t\tKey: \"guestinfo.metadata.encoding\",\n\t\t\tValue: \"base64\",\n\t\t},\n\t)\n\n\treturn nil\n}", "title": "" }, { "docid": "5ec6e1a8633c704a677e343d74069795", "score": "0.5497182", "text": "func AuthSetMetadataHandler(\n\thandler func(\n\t\tversion, request_id, domain, address, identity, mechanism string, credentials ...string) (metadata map[string]string)) {\n\tauth_meta_handler = handler\n}", "title": "" }, { "docid": "897440797fc2be9d830b7d691094e404", "score": "0.5494932", "text": "func (c *jsiiProxy_CfnScript) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "17ada2c314bce8834e57c2a878a50232", "score": "0.54870534", "text": "func SetImageMetadata(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) error {\n\tt.Logf(\"Attempting to apply image metadata to volume %s\", volume.ID)\n\n\timageMetadataOpts := volumeactions.ImageMetadataOpts{\n\t\tMetadata: map[string]string{\n\t\t\t\"image_name\": \"testimage\",\n\t\t},\n\t}\n\n\terr := volumeactions.SetImageMetadata(client, volume.ID, imageMetadataOpts).ExtractErr()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b2c76b6e28693091f11214def568d371", "score": "0.5451362", "text": "func (c *jsiiProxy_CfnStack) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" } ]
ee828c2a829c10193af9a8a2da3f6b2c
NewMockBlock creates a new mock instance.
[ { "docid": "e05ce44fbe07e9a4a1c5f93d1aa23907", "score": "0.74162036", "text": "func NewMockBlock(ctrl *gomock.Controller) *MockBlock {\n\tmock := &MockBlock{ctrl: ctrl}\n\tmock.recorder = &MockBlockMockRecorder{mock}\n\treturn mock\n}", "title": "" } ]
[ { "docid": "96ff3c1418fcc20e7d236c7fd2bf7266", "score": "0.7071784", "text": "func MockBlock() *bc.Block {\n\treturn &bc.Block{\n\t\tBlockHeader: &bc.BlockHeader{Height: 1},\n\t}\n}", "title": "" }, { "docid": "8a0171a4a4e3b1d14a02c4871f414c50", "score": "0.6814578", "text": "func NewBlock(prevBlock Block, txns []Txn, hash string, target int) Block{\n newBlock := Block{}\n newBlock.Index = prevBlock.Index + 1\n newBlock.Txns = txns\n newBlock.PrevHash = prevBlock.Hash\n newBlock.MerkleRoot = CalculateMerkleRoot(txns)\n newBlock.Timestamp = []byte(time.Now().String()) //time at production of block (use tbd)\n newBlock.Nonce = 0 //unless we decide to start from elsewhere\n newBlock.Target = target\n newBlock.Hash = CalculateHash(newBlock)\n return newBlock;\n}", "title": "" }, { "docid": "eeb327a3a153b7349e62a08a3afac4bf", "score": "0.67639536", "text": "func NewMockDatabaseBlock(ctrl *gomock.Controller) *MockDatabaseBlock {\n\tmock := &MockDatabaseBlock{ctrl: ctrl}\n\tmock.recorder = &MockDatabaseBlockMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "52747bed206cb86b607a0aa54ca18286", "score": "0.67368305", "text": "func NewMockdatabaseBlock(ctrl *gomock.Controller) *MockdatabaseBlock {\n\tmock := &MockdatabaseBlock{ctrl: ctrl}\n\tmock.recorder = &MockdatabaseBlockMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "1e22136dd8785a31d601d92a17cf7553", "score": "0.64228517", "text": "func newBlock(prevHash [32]byte) *protocol.Block {\n\tb := new(protocol.Block)\n\tb.PrevHash = prevHash\n\tb.StateCopy = make(map[[32]byte]*protocol.Account)\n\treturn b\n}", "title": "" }, { "docid": "5f83c0ce7598ac3b101875beb83ae740", "score": "0.6418286", "text": "func newBlock(prevHash [32]byte, commitmentProof [crypto.COMM_PROOF_LENGTH]byte, height uint32) *protocol.Block {\n\tblock := new(protocol.Block)\n\tblock.PrevHash = prevHash\n\tblock.CommitmentProof = commitmentProof\n\tblock.Height = height\n\tblock.StateCopy = make(map[[32]byte]*protocol.Account)\n\n\treturn block\n}", "title": "" }, { "docid": "a96945aed8126cfa654fe7b0f27493bd", "score": "0.6399687", "text": "func newBlock(len int) *block {\n\treturn &block{padding: len}\n}", "title": "" }, { "docid": "c6dddea3218453d800685c8ce041d7a3", "score": "0.63924044", "text": "func newBlockchain(opts ...emulator.Option) *emulator.Blockchain {\n\tb, err := emulator.NewBlockchain(\n\t\tappend(\n\t\t\t[]emulator.Option{\n\t\t\t\t// No storage limit\n\t\t\t\temulator.WithStorageLimitEnabled(false),\n\t\t\t},\n\t\t\topts...,\n\t\t)...,\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "title": "" }, { "docid": "53eb06083cb7d46cf4a696e483edfdcb", "score": "0.63846546", "text": "func (tos *TxOutStoreDummy) NewBlock(height int64, constAccessor constants.ConstantValues) {\n\ttos.blockOut = NewTxOut(height)\n}", "title": "" }, { "docid": "806163ff97b806f71100690e38ad82ed", "score": "0.63837785", "text": "func (bi *Blockchainidentifier) newBlock(newblockindex int, newproof int, lastblockhash string) (b block) {\n\tb.Index = newblockindex\n\tb.Timestamp = time.Now().UTC().Format(\"2006-01-02 15:04:05\")\n\tb.Transactions = bi.Currenttransactions\n\tb.Proof = newproof\n\tb.Previousblockhash = lastblockhash\n\n\tbi.Blocks = append(bi.Blocks, b)\n\tbi.Currenttransactions = []transaction{}\n\n\treturn\n}", "title": "" }, { "docid": "c8f25a2edf6bf5ed4f0e1d7759d74fdb", "score": "0.6374269", "text": "func NewBlock(raw []byte) *Block {\n block := &Block{}\n block.UnmarshalRlp(raw)\n\n return block\n}", "title": "" }, { "docid": "16811499f2cdce6fcd06a5331e5a772f", "score": "0.6359654", "text": "func NewBlock(data string, prevBlockHash []byte) *Block {\n\tblock := &Block{time.Now().Unix(), []byte(data), prevBlockHash, []byte{}, 0}\n\tpow := NewProofOfWork(block)\n\tcounter, hash := pow.Run()\n\n\tblock.Hash = hash[:]\n\tblock.Counter = counter\n\n\treturn block\n}", "title": "" }, { "docid": "6891980f9cc775ab6c64c2fbb27fdd11", "score": "0.63328654", "text": "func NewBlock (p float64, jc int) *Block {\n\t// new(T) is a builtin that returns a pointer to T\n\t// where T is a type\n\tb:=new(Block)\n\tb.AttachmentPoint = p\n\tb.JointCounts = jc\n\treturn b\n}", "title": "" }, { "docid": "ef09782125281751039813cd9bfaf152", "score": "0.63271284", "text": "func NewMock() *Mock {\n\treturn &Mock{\n\t\tnow: time.Unix(0, 0),\n\t\ttimers: make(map[int]chan<- struct{}),\n\t}\n}", "title": "" }, { "docid": "6b85e6fe692a4c507ff251c1327a836a", "score": "0.631781", "text": "func (m *MockBlockWithPtrs) NewEmpty() Block {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NewEmpty\")\n\tret0, _ := ret[0].(Block)\n\treturn ret0\n}", "title": "" }, { "docid": "d2e8aab8ffefde9466905aafcdaf13fd", "score": "0.6301595", "text": "func NewBlock(oldBlock Block, Data string) Block {\n\n\tvar block Block\n\n\tt := time.Now()\n\n\tblock.Index = oldBlock.Index + 1\n\tblock.Timestamp = t.Format(layout)\n\tblock.Data = Data\n\tblock.PrevHash = oldBlock.Hash\n\n\tpow := NewProofOfWork(&block)\n\tnonce, hash := pow.RunPOW()\n\n\tblock.Hash = hex.EncodeToString(hash[:])\n\tblock.Nonce = nonce\n\n\treturn block\n}", "title": "" }, { "docid": "cd1c2f4a3ba10c3553483260abe185f8", "score": "0.62966996", "text": "func NewMock(salt byte) *Mock {\n\treturn &Mock{salt: salt}\n}", "title": "" }, { "docid": "8dee203cc4c8fa862439e2aded004c0d", "score": "0.62901056", "text": "func New(index int, data, prevHash string) *Block {\n\ttimestamp := time.Now().Unix()\n\tnonce := 0\n\tblock := Block{\n\t\tindex,\n\t\ttimestamp,\n\t\t\"\",\n\t\tprevHash,\n\t\tdata,\n\t\tnonce,\n\t}\n\tblock.Hash = block.CalculateHash()\n\treturn &block\n}", "title": "" }, { "docid": "52a9e025037f0955c8344be9e9e33ee7", "score": "0.6279856", "text": "func New() *block {\n\treturn &block{\n\t\tBroadcastChan: make(chan Message, broadcastChanSize),\n\t\tbroadcastSeen: map[string]struct{}{},\n\t}\n}", "title": "" }, { "docid": "8c3242e0101654926295d2a0d0516d76", "score": "0.62750465", "text": "func NewBlockMemory() BlockStorage { return make(blockMemory) }", "title": "" }, { "docid": "b09ad6f37d823ba0dfa1463a5fa1d60f", "score": "0.62734985", "text": "func NewBlock(sz uint16) StdMemory {\n\tif sz == 0 {\n\t\tsz = 0xffff\n\t}\n\treturn make(StdMemory, sz)\n}", "title": "" }, { "docid": "e1abf128886bd4586f0a4ae67c70e247", "score": "0.6264299", "text": "func NewMockOnReadBlock(ctrl *gomock.Controller) *MockOnReadBlock {\n\tmock := &MockOnReadBlock{ctrl: ctrl}\n\tmock.recorder = &MockOnReadBlockMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "9c7de57b7dbe809e752a76fcbc393529", "score": "0.6246419", "text": "func NewBlock() *Block {\n\treturn &Block{\n\t\tHeader: NewHeader(),\n\t}\n}", "title": "" }, { "docid": "6e8c978674da658261d4ca7cdaf2769a", "score": "0.6240864", "text": "func NewMock() *Mock {\n\tmock := &Mock{\n\t\tm: &sync.Mutex{},\n\t\ttimes: 1,\n\t}\n\tmock.request = &MockRequest{\n\t\tmock: mock,\n\t\theaders: map[string][]string{},\n\t\tformData: map[string][]string{},\n\t\tquery: map[string][]string{},\n\t\tmatchers: defaultMatchers,\n\t}\n\tmock.response = &MockResponse{\n\t\tmock: mock,\n\t\theaders: map[string][]string{},\n\t}\n\treturn mock\n}", "title": "" }, { "docid": "43c58b712204ecf51988e6e705e2243b", "score": "0.62372494", "text": "func (m *MockBlockWithPtrs) NewEmptier() func() Block {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NewEmptier\")\n\tret0, _ := ret[0].(func() Block)\n\treturn ret0\n}", "title": "" }, { "docid": "cc2c139f92b532bd6464d3a2051247c1", "score": "0.62268347", "text": "func CreateBlockForTests() *Block {\n\t//variables:\n\tid := uuid.NewV4()\n\tprevID := uuid.NewV4()\n\tcr := time.Now().UTC()\n\tvalBlk := concrete_validated.CreateBlockForTests()\n\n\tblocks := [][]byte{\n\t\tid.Bytes(),\n\t\t[]byte(strconv.Itoa(int(cr.UnixNano()))),\n\t\tprevID.Bytes(),\n\t\tvalBlk.GetMetaData().GetHashTree().GetHash().Get(),\n\t}\n\n\tht, _ := concrete_hashtrees.CreateHashTreeBuilderFactory().Create().Create().WithBlocks(blocks).Now()\n\n\tmet := createMetaData(&id, ht.(*concrete_hashtrees.HashTree), &prevID, cr)\n\tchainedBlk := createBlock(met.(*MetaData), valBlk)\n\treturn chainedBlk.(*Block)\n}", "title": "" }, { "docid": "460d57dd12e79704f5d9f74a94aa9f43", "score": "0.6200731", "text": "func newBlock(insns []instruction) *block {\n\treturn &block{\n\t\tinsns: insns,\n\t\tjumps: make(map[pos]*block),\n\t\tid: insns[0].id,\n\t}\n}", "title": "" }, { "docid": "2e1697b78aa25509d5ceda59d92329a2", "score": "0.6164077", "text": "func newBlockManager(s *server) *blockManager {\n\tchainNotify := make(chan *btcchain.Notification, chanBufferSize)\n\tbm := blockManager{\n\t\tserver: s,\n\t\tblockChain: btcchain.New(s.db, s.btcnet, chainNotify),\n\t\trequestQueue: list.New(),\n\t\trequestMap: make(map[string]*inventoryItem),\n\t\tlastBlockLogTime: time.Now(),\n\t\tnewBlocks: make(chan bool, 1),\n\t\tblockQueue: make(chan *blockMsg, chanBufferSize),\n\t\tinvQueue: make(chan *invMsg, chanBufferSize),\n\t\tchainNotify: chainNotify,\n\t\tquit: make(chan bool),\n\t}\n\tbm.blockChain.DisableVerify(cfg.VerifyDisabled)\n\treturn &bm\n}", "title": "" }, { "docid": "9389a478843dde38decf4275ca19d9db", "score": "0.61344033", "text": "func CreateTestBlock(/* TODO use raw data */transactions []*Transaction) *Block {\n block := &Block{\n // Slice of transactions to include in this block\n transactions: transactions,\n number: 1,\n prevHash: \"1234\",\n coinbase: \"me\",\n difficulty: 10,\n nonce: 0,\n time: time.Now().Unix(),\n }\n\n return block\n}", "title": "" }, { "docid": "b788ae0a5e1628afe93d1025b5b0cdc6", "score": "0.61277324", "text": "func (m *MockBlock) NewEmpty() Block {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NewEmpty\")\n\tret0, _ := ret[0].(Block)\n\treturn ret0\n}", "title": "" }, { "docid": "c59de98f4f5b8cd7f2a4cd9f932e883f", "score": "0.61128205", "text": "func NewMockBlockCache(ctrl *gomock.Controller) *MockBlockCache {\n\tmock := &MockBlockCache{ctrl: ctrl}\n\tmock.recorder = &MockBlockCacheMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "265a3fc8eaef45f89345e814df3833c6", "score": "0.6109988", "text": "func NewBlock(n int, trans []Transaction, ph string, ts time.Time) (Block, error) {\n\tb := Block{n, trans, ph, ts}\n\n\tif !b.IsValid() {\n\t\treturn Block{}, ErrInvalidData\n\t}\n\n\treturn b, nil\n}", "title": "" }, { "docid": "e5b603af11bda05e1ab7ac1541385e4a", "score": "0.60879254", "text": "func NewBlock(data []byte, prevBlockHash []byte) *Block {\n\tblock := &Block{time.Now().Unix(), data, prevBlockHash, []byte{}, 0}\n\tpow := NewProofOfWork(block)\n\tnonce, hash := pow.Run() // Run proof of work before creating block\n\tblock.Hash = hash[:]\n\tblock.Nonce = nonce\n\treturn block\n}", "title": "" }, { "docid": "160cfa3ea7f871542660afd6907ced9b", "score": "0.6080972", "text": "func NewBlock(data string, prevBlockHash []byte) *Block {\n\tblock := &Block{time.Now().Unix(), []byte(data), prevBlockHash, []byte{}, 0}\n\tpow := NewProofOfWork(block)\n\tnonce, hash := pow.Run()\n\n\tblock.Hash = hash[:]\n\tblock.Nonce = nonce\n\n\treturn block\n}", "title": "" }, { "docid": "160cfa3ea7f871542660afd6907ced9b", "score": "0.6080972", "text": "func NewBlock(data string, prevBlockHash []byte) *Block {\n\tblock := &Block{time.Now().Unix(), []byte(data), prevBlockHash, []byte{}, 0}\n\tpow := NewProofOfWork(block)\n\tnonce, hash := pow.Run()\n\n\tblock.Hash = hash[:]\n\tblock.Nonce = nonce\n\n\treturn block\n}", "title": "" }, { "docid": "49b449c35152b06d51a2f8f57a2b62ef", "score": "0.60789907", "text": "func CreateBlockForTests(blk blocks.Block, mining string) Block {\n\tcreatedOn := time.Now().UTC()\n\tins, err := NewBuilder().Create().WithBlock(blk).WithMining(mining).CreatedOn(createdOn).Now()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn ins\n}", "title": "" }, { "docid": "0c75799c0fd76176ab7df1eb9327bedf", "score": "0.6078014", "text": "func NewTestBlock(number *big.Int, txs []*types.Transaction,\n\ttrx []*types.Receipt) *types.Block {\n\theader := &types.Header{\n\t\tNumber: number,\n\t}\n\n\treturn types.NewBlock(header, txs, nil, trx, nil)\n}", "title": "" }, { "docid": "6f66739b2d35087ea9b930f953345e80", "score": "0.6051983", "text": "func NewBlock(data string, PreviousBlockHash []byte) *Block {\n\tblock := &Block{time.Now().Unix(), PreviousBlockHash, []byte{}, []byte(data)}\n\tblock.SetHash()\n\treturn block\n}", "title": "" }, { "docid": "4726b629c7741236a9377a1451d76540", "score": "0.60491866", "text": "func NewBlock(data string, prevBlockHash []byte) *Block {\n\t// 0 è il valore del nonce\n\tblock := &Block{time.Now().Unix(), []byte(data), prevBlockHash, []byte{}, 0}\n\tpow := NewProofOfWork(block)\n\tnonce, hash := pow.Run()\n\n\tblock.Hash = hash[:]\n\tblock.Nonce = nonce\n\n\treturn block\n}", "title": "" }, { "docid": "35af13c102a44558998836e37eafd29b", "score": "0.6045045", "text": "func New(index int, prevHash string, txns Transactions) Block {\n\tb := Block{\n\t\tIndex: index,\n\t\tNonce: 0, // TODO: add proof of work later.\n\t\tTimestamp: time.Now().UnixNano(),\n\t\tTxns: txns,\n\t\tPrevHash: prevHash,\n\t}\n\n\t// Calculate the hash of the block with all the fields except the current hash included.\n\tb.Hash = b.GetHash()\n\n\treturn b\n}", "title": "" }, { "docid": "b2be1f2ce06ed05010760b983e90b1ed", "score": "0.60446656", "text": "func (m *MockBlock) NewEmptier() func() Block {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NewEmptier\")\n\tret0, _ := ret[0].(func() Block)\n\treturn ret0\n}", "title": "" }, { "docid": "0cec7fc0e5b18a10dea9a693d2005b56", "score": "0.6040007", "text": "func NewMockPeer(name, url string, blockHeight uint64) *MockPeer {\n\treturn &MockPeer{\n\t\tPeer: fabmocks.NewMockPeer(name, url),\n\t\tblockHeight: blockHeight,\n\t}\n}", "title": "" }, { "docid": "c375572105e51834d3a9ba577ee4e511", "score": "0.6033066", "text": "func NewBlock(name string, required bool, nested *Spec) *Spec {\n\treturn BlockSpec(&Block{\n\t\tName: name,\n\t\tRequired: required,\n\t\tNested: nested,\n\t})\n}", "title": "" }, { "docid": "6ceed960c96eebc139929287cd3d2c07", "score": "0.6020443", "text": "func NewBlock(\n\tlastBlockHash [32]byte, payload Transaction,\n\tdifficulty uint8, timestamp uint64) Block {\n\tvar slice = make([]byte, 32)\n\tvar hash [32]byte\n\tcopy(hash[:], slice)\n\tblk := Block{getBlockIDGenerator().generate(),\n\t\tlastBlockHash,\n\t\t0,\n\t\tpayload,\n\t\tdifficulty,\n\t\ttimestamp,\n\t\thash}\n\tblk.mine()\n\treturn blk\n}", "title": "" }, { "docid": "5d617e1ea8c6bd236c6c13827c945c9f", "score": "0.60196507", "text": "func NewBlock(data string, prevBlockHash string) *Block {\n\tblock := &Block{data, prevBlockHash, \"\"}\n\tblock.setHash()\n\n\treturn block\n}", "title": "" }, { "docid": "452061fbadb9b280331f70b17d76a61e", "score": "0.6016722", "text": "func NewMockBlockServer(ctrl *gomock.Controller) *MockBlockServer {\n\tmock := &MockBlockServer{ctrl: ctrl}\n\tmock.recorder = &MockBlockServerMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "0871a51cfa1a97d29c9ff6d8c6a72588", "score": "0.6011239", "text": "func NewMockBlockOps(ctrl *gomock.Controller) *MockBlockOps {\n\tmock := &MockBlockOps{ctrl: ctrl}\n\tmock.recorder = &MockBlockOpsMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "ef7496120daf54c4b86542f01ee2da8d", "score": "0.60074353", "text": "func NewBlock(prehash []byte,txs []Tx, dif,nonce uint64, cName string)*Block{\n\tvar blk Block\n blk.PreHash = prehash\n\t// blk.Data = []byte(data)\n\tblk.Txs = txs\n\tblk.MerkelRoot = blk.GetMarkerRoot()\n\tblk.Version = uint64(1)\n\tblk.Timestamp = uint64(time.Now().Unix())\n\tblk.Difficulty = uint64(dif)\n\tblk.Nonce = nonce\n\tblk.ChainName = cName\n\t// blk.Hash = blk.SetHash1()\n\tblk.Hash = blk.NewPoW().Try()\n\terr := blk.AddBlockToDb()\n\tif err != nil{\n\t\tfmt.Println(\"new block\", err)\n\t}\n\treturn &blk\n}", "title": "" }, { "docid": "5b9b622239697e82b37b07152aae6bd5", "score": "0.6004319", "text": "func newBlock(mutation string) (b block) {\n\tsha1 := sha1.New()\n\tio.WriteString(sha1, mutation)\n\tcopy(b.Hdr.Score[:], sha1.Sum(nil))\n\n\tb.Data = []byte(mutation)\n\tb.Hdr.Size = int32(len(b.Data))\n\n\treturn\n}", "title": "" }, { "docid": "995a31e794f4a9eef226868e0cc112da", "score": "0.6002835", "text": "func (hc *halfConn) newBlock() *block {\n\tb := hc.bfree\n\tif b == nil {\n\t\treturn new(block)\n\t}\n\thc.bfree = b.link\n\tb.link = nil\n\tb.resize(0)\n\treturn b\n}", "title": "" }, { "docid": "0c6d73f47535ab20e241f1c3d99fabb8", "score": "0.5999725", "text": "func NewMockDatabaseBlockPool(ctrl *gomock.Controller) *MockDatabaseBlockPool {\n\tmock := &MockDatabaseBlockPool{ctrl: ctrl}\n\tmock.recorder = &MockDatabaseBlockPoolMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "26b23c82da5e276d7fa81b881f3dcec8", "score": "0.5998812", "text": "func NewMockBlockWithPtrs(ctrl *gomock.Controller) *MockBlockWithPtrs {\n\tmock := &MockBlockWithPtrs{ctrl: ctrl}\n\tmock.recorder = &MockBlockWithPtrsMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "95f8a84eb40d14b9f953282ce8710eda", "score": "0.59876347", "text": "func NewBlock(hash string) *pfs.Block {\n\treturn &pfs.Block{\n\t\tHash: hash,\n\t}\n}", "title": "" }, { "docid": "db2e77ae7c64583faa7ee6b454d2679f", "score": "0.5977133", "text": "func CreateBlock(prevBlockID string) *types.Block {\n\t/*totalBlocks := len(blockChain)\n\tif totalBlocks > AvgBlocksAmount {\n\t\tstartBlockIdx := totalBlocks - AvgBlocksAmount\n\t\tstartBlock := blockChain[startBlockIdx]\n\t\tlastBlock := blockChain[totalBlocks-1]\n\n\t\tstartTime := time.Unix(startBlock.Data.Timestamp, 0)\n\t\tendTime := time.Unix(lastBlock.Data.Timestamp, 0)\n\n\t\tprocessDuration := endTime.Sub(startTime)\n\t\tfmt.Printf(\"10 blocks duration: %v\\n\", processDuration)\n\t\tfmt.Printf(\"Average for one block: %v\\n\", processDuration.Seconds()/float64(AvgBlocksAmount))\n\n\t\tprevMantissa, prevExponent := SeparateTarget(lastBlock.Data.Target)\n\t\tprevTarget := GetTarget(prevMantissa, prevExponent)\n\t\tfmt.Printf(\"prev block target: %x\\n\", prevTarget)\n\t\tdefaultTarget := GetTarget(DefaultMantissa, DefaultExponent)\n\n\t\tlastBlockDifficulty := defaultTarget.Div(defaultTarget, prevTarget)\n\t\tfmt.Printf(\"last difficulty: %x\\n\", lastBlockDifficulty.Int64())\n\n\t\tnewDifficulty := float64(lastBlockDifficulty.Int64()) * (AvgBlocksDuration / processDuration.Seconds())\n\t\tfmt.Printf(\"new difficulty: %f\\n\", newDifficulty)\n\n\t\tSetTarget(newDifficulty)\n\t}*/\n\n\tblockTimestamp := time.Now().Unix()\n\n\tnewDifficulty := GetCurrentNetworkDifficulty(blockTimestamp)\n\tif newDifficulty.Cmp(big.NewFloat(DefaultDifficulty)) != 0 {\n\t\tSetTarget(newDifficulty)\n\t}\n\n\ttarget := uint32(currentMantissa<<8 + currentExponent)\n\n\treturn &types.Block{\n\t\tData: types.BlockData{\n\t\t\tPrevBlockID: prevBlockID,\n\t\t\tTarget: target,\n\t\t\tTimestamp: blockTimestamp,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "127b7209fe68da08f39489d157308a8a", "score": "0.5973096", "text": "func CreateTestBlock( /* TODO use raw data */ transactions []*Transaction) *Block {\n\tblock := &Block{\n\t\t// Slice of transactions to include in this block\n\t\ttransactions: transactions,\n\t\tPrevHash: []byte(\"1234\"),\n\t\tCoinbase: ZeroHash160,\n\t\tDifficulty: big.NewInt(10),\n\t\tNonce: ethutil.BigInt0,\n\t\tTime: time.Now().Unix(),\n\t}\n\n\treturn block\n}", "title": "" }, { "docid": "0f326414d67b8f426fb900f3e772acba", "score": "0.5969877", "text": "func NewBlock(prevBlockHash []byte, data string) *Block {\n\tblock := &Block{Timestamp: time.Now().Unix(), PrevBlockHash: prevBlockHash, Data: []byte(data)}\n\tblock.CalculateHash()\n\treturn block\n}", "title": "" }, { "docid": "1d972c5b5acf8a1ad6fa78e3284b7bad", "score": "0.5966324", "text": "func newMockChainSource(numBlocks int) *mockChainSource {\n\tchain := &mockChainSource{\n\t\tntfnChan: make(chan blockntfns.BlockNtfn),\n\t\tfiltersQueried: make(chan chainhash.Hash),\n\n\t\tblockHeightIndex: make(map[chainhash.Hash]uint32),\n\t\tblockHashesByHeight: make(map[uint32]*chainhash.Hash),\n\t\tblockHeaders: make(map[chainhash.Hash]*wire.BlockHeader),\n\t\tblocks: make(map[chainhash.Hash]*btcutil.Block),\n\t\tfilterHeadersByHeight: make(map[uint32]*chainhash.Hash),\n\t\tfilters: make(map[chainhash.Hash]*gcs.Filter),\n\t}\n\n\tgenesisHash := chain.ChainParams().GenesisHash\n\tgenesisBlock := chain.ChainParams().GenesisBlock\n\n\tchain.blockHeightIndex[*genesisHash] = 0\n\tchain.blockHashesByHeight[0] = genesisHash\n\tchain.blockHeaders[*genesisHash] = &genesisBlock.Header\n\tchain.blocks[*genesisHash] = btcutil.NewBlock(genesisBlock)\n\n\tfilter, _ := gcs.FromBytes(0, builder.DefaultP, builder.DefaultM, nil)\n\tchain.filters[*genesisHash] = filter\n\n\tfilterHeader, _ := builder.MakeHeaderForFilter(filter, chainhash.Hash{})\n\tchain.filterHeadersByHeight[0] = &filterHeader\n\n\tchain.bestBlock = headerfs.BlockStamp{\n\t\tHeight: 0,\n\t\tHash: *genesisHash,\n\t\tTimestamp: genesisBlock.Header.Timestamp,\n\t}\n\n\tfor i := 0; i < numBlocks-1; i++ {\n\t\tchain.addNewBlock(false)\n\t}\n\n\treturn chain\n}", "title": "" }, { "docid": "309985f273b17711afab315a4347f092", "score": "0.5959145", "text": "func NewBlock(statements []sql.Node) *Block {\n\treturn &Block{statements: statements}\n}", "title": "" }, { "docid": "7144d749768a03de2cf02caac4943e5d", "score": "0.59562415", "text": "func (w *ByteBlockWriter) NewBlock(align int64, length int64) error {\n\tif w.err != nil {\n\t\treturn w.err\n\t}\n\tif w.numBytesLeft > 0 {\n\t\tw.err = ErrNewBlockBeforeFinish\n\t\treturn w.err\n\t}\n\t// Length\n\tw.fillStub(int64(length))\n\tif w.err = w.rawWrite(w.stub[:]); w.err != nil {\n\t\treturn w.err\n\t}\n\t// Offset\n\toffset := int64(alignOffset(align, w.numBytesWritten+8))\n\tw.fillStub(offset)\n\tif w.err = w.rawWrite(w.stub[:]); w.err != nil {\n\t\treturn w.err\n\t}\n\t// Padding\n\tif w.err = w.rawWrite(make([]byte, offset)); w.err != nil {\n\t\treturn w.err\n\t}\n\tw.numBytesLeft = length\n\treturn nil\n}", "title": "" }, { "docid": "1eb7b9227aec54651bdf61c7731b2d70", "score": "0.5944308", "text": "func NewBlock(index int, preHash string, timestamp time.Time, data string) *Block {\n\treturn &Block{Index: index, PreHash: preHash, Timestamp: timestamp.Unix(), Data: data}\n}", "title": "" }, { "docid": "c770351e6995c5e5fe6e1d36839aa10e", "score": "0.5941409", "text": "func NewBlock(name string) *Block {\n\tblock := &Block{}\n\tblock.SetName(name)\n\treturn block\n}", "title": "" }, { "docid": "c770351e6995c5e5fe6e1d36839aa10e", "score": "0.5941409", "text": "func NewBlock(name string) *Block {\n\tblock := &Block{}\n\tblock.SetName(name)\n\treturn block\n}", "title": "" }, { "docid": "ea02d00952be8ceb6d4a42bc26099570", "score": "0.5940314", "text": "func NewMockBlockRetriever(ctrl *gomock.Controller) *MockBlockRetriever {\n\tmock := &MockBlockRetriever{ctrl: ctrl}\n\tmock.recorder = &MockBlockRetrieverMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "77f43345b2156cc3425a0a83d3679ee7", "score": "0.59371066", "text": "func newMockTime() *mockTime {\n\tnow := time.Now()\n\treturn &mockTime{\n\t\tt0: now,\n\t\tt: now,\n\t\tafterFuncs: map[time.Time][]func(){},\n\t}\n}", "title": "" }, { "docid": "597fd65e72a73c1fd12dbf721e87a49b", "score": "0.5921941", "text": "func NewBlock(index idx.Block, time Timestamp, atropos hash.Event, prevHash hash.Event, events hash.Events) *Block {\n\treturn &Block{\n\t\tIndex: index,\n\t\tTime: time,\n\t\tEvents: events,\n\t\tPrevHash: prevHash,\n\t\tSkippedTxs: make([]uint, 0),\n\t\tAtropos: atropos,\n\t}\n}", "title": "" }, { "docid": "752a452bdb2e4e327153093218593727", "score": "0.5919508", "text": "func generateBlock(oldBlock Block, BPM int) (Block, error){\n\tvar newBlock Block\n\n\tt := time.Now()\n\n\tnewBlock.Index = oldBlock.Index + 1\n\tnewBlock.Timestamp = t.String()\n\tnewBlock.BPM = BPM\n\tnewBlock.PrevHash = oldBlock.Hash\n\tnewBlock.Hash = calcHash(newBlock)\n\n\treturn newBlock, nil\n}", "title": "" }, { "docid": "1b082792c4c299361e8d4c1f0705c200", "score": "0.5909603", "text": "func generateBlock(oldBlock Block, BPM int) Block {\n\n\tvar newBlock Block\n\n\tt := time.Now()\n\n\tnewBlock.Index = oldBlock.Index + 1\n\tnewBlock.Timestamp = t.String()\n\tnewBlock.BPM = BPM\n\tnewBlock.PrevHash = oldBlock.Hash\n\tnewBlock.Hash = calculateHash(newBlock)\n\n\treturn newBlock\n}", "title": "" }, { "docid": "36fd46287141e97cc614b415f1fca4c7", "score": "0.59087265", "text": "func generateBlock(oldBlock Block, BPM int) (Block, error) {\n\n\tvar newBlock Block\n\n\tt := time.Now()\n\n\tnewBlock.Index = oldBlock.Index + 1\n\tnewBlock.Timestamp = t.String()\n\tnewBlock.BPM = BPM\n\tnewBlock.PrevHash = oldBlock.Hash\n\tnewBlock.Hash = calculateHash(newBlock)\n\n\treturn newBlock, nil\n}", "title": "" }, { "docid": "d57da5345b89d941b99fc308dc09d93c", "score": "0.59068555", "text": "func NewBlock(index int, previousHash *string, timestamp *time.Time, data *string) *Block {\n\tblock := new(Block)\n\tblock.Index = index\n\tblock.PreviousHash = *previousHash\n\tblock.Timestamp = FormatFromTime(timestamp)\n\tblock.Data = *data\n\tblock.Hash = Hash(block)\n\treturn block\n}", "title": "" }, { "docid": "6f1f61d10fc7bf599cb398ab096375b1", "score": "0.5904065", "text": "func New(b backend.Backend) *Blockfinder {\n\tbf := &Blockfinder{\n\t\tbackend: b,\n\t}\n\tbf.blocks = make(map[uint32]time.Time)\n\tbf.blockResponses = b.BlockResponses()\n\treturn bf\n}", "title": "" }, { "docid": "d46cee92ef598a52a2327c6155452995", "score": "0.5892645", "text": "func (blk *Block) NewBlock(height int32, timeStamp int64, parentHash string, acceptValue p1.MerklePatriciaTrie,\n\tapplyValue p1.MerklePatriciaTrie) error {\n\tsize := int32(len([]byte(fmt.Sprint(acceptValue))) + len([]byte(fmt.Sprint(applyValue))))\n\tblk.Header = Header{hashString(string(height) + string(timeStamp) + parentHash + acceptValue.Root +\n\t\tapplyValue.Root + string(size)), timeStamp, height, parentHash, size}\n\tblk.AcceptValue = acceptValue\n\tblk.ApplyValue = applyValue\n\treturn nil\n}", "title": "" }, { "docid": "fd860f1a4c4764ef9b3df07f3f6611d0", "score": "0.5889622", "text": "func MakeBlock(p float64) Block {\n\t// make only works on channels, slices and array\n\tb := Block {p, 4}\n\treturn b\n}", "title": "" }, { "docid": "2e5cf5dc057011386fecf260df996d9a", "score": "0.58866453", "text": "func New(chainID string, headers map[int64]*types.SignedHeader, vals map[int64]*types.ValidatorSet) *Mock {\n\theight := int64(0)\n\tfor h := range headers {\n\t\tif h > height {\n\t\t\theight = h\n\t\t}\n\t}\n\treturn &Mock{\n\t\tchainID: chainID,\n\t\theaders: headers,\n\t\tvals: vals,\n\t\tevidenceToReport: make(map[string]types.Evidence),\n\t\tlatestHeight: height,\n\t}\n}", "title": "" }, { "docid": "038d5d9e15f66aeea5bdc506f77d908c", "score": "0.58850694", "text": "func generateBlock(oldBlock Block, BPM int, address string, transaction []Transaction) (Block, error) {\n\n\tvar newBlock Block\n\n\tt := time.Now()\n\tnewBlock.Index = oldBlock.Index + 1\n\tnewBlock.Timestamp = t.String()\n\tnewBlock.BPM = BPM\n\tnewBlock.PrevHash = oldBlock.Hash\n\tnewBlock.Hash = calculateBlockHash(newBlock)\n\tnewBlock.Validator = address\n\tnewBlock.Transactions = transaction\n\n\treturn newBlock, nil\n}", "title": "" }, { "docid": "2aa0c4c173792eaf118e93ef8fe40664", "score": "0.58849025", "text": "func NewBlock(transactions []*Transaction, prevBlockHash []byte) *Block {\n\tblock := &Block{time.Now().Unix(), transactions, prevBlockHash, []byte{}, 0}\n\tpow := NewProofOfWork(block)\n\tnonce, hash := pow.Run()\n\n\tblock.Hash = hash[:]\n\tblock.Nonce = nonce\n\n\treturn block\n}", "title": "" }, { "docid": "a15c794162de444591ac2d13a5d7038c", "score": "0.58768946", "text": "func NewBlock(transactions []*Transaction, prevBlockHash []byte) *Block {\n\tblock := &Block{\n\t\ttime.Now().Unix(), transactions, prevBlockHash, []byte{}, 0}\n\tpow := NewProofOfWork(block)\n\tnonce, hash := pow.Run()\n\n\tblock.Hash = hash[:]\n\tblock.Nonce = nonce\n\n\treturn block\n}", "title": "" }, { "docid": "fabbfee31a767429e1e2a4b25b258942", "score": "0.5862958", "text": "func newBlockNode(blockHeader *wire.BlockHeader, parent *blockNode) *blockNode {\n\tvar node blockNode\n\tinitBlockNode(&node, blockHeader, parent)\n\treturn &node\n}", "title": "" }, { "docid": "c9517ea5c0e3955a5ea41db7ec731d63", "score": "0.58387613", "text": "func NewBlock(data string, prevBlockHash []byte) *Block {\n\t// 创建区块,需要设置的有生成该区块的时间戳,数据段、前一区块的hash值\n\tblock := &Block{time.Now().Unix(), []byte(data), prevBlockHash, []byte{}}\n\t// 设置当前区块的hash\n\tblock.SetHash()\n\treturn block\n}", "title": "" }, { "docid": "0fc91f255e99f0071777f6f825680ecc", "score": "0.58373636", "text": "func NewBlockRef(blockNum uint32) (br BlockRef) {\n\tbinary.BigEndian.PutUint32(br[:], blockNum)\n\treturn\n}", "title": "" }, { "docid": "75e40b8713852271bd1c4ef47fec48b0", "score": "0.583722", "text": "func NewBlock(\n\tindex uint64,\n\ttimestamp time.Time,\n\tdata string,\n\tproofOfWork int,\n\tpreviousHash []byte) *Block {\n\n\tblock := new(Block)\n\tblock.index = index\n\tblock.timestamp = timestamp\n\tblock.data = data\n\tblock.proofOfWork = proofOfWork\n\n\th := sha256.New()\n\n\t// Index\n\tindexBytes := make([]byte, 8)\n\tbinary.LittleEndian.PutUint64(indexBytes, index)\n\th.Write(indexBytes)\n\n\t// Timestamp\n\ttimestampBytes := make([]byte, 8)\n\tbinary.LittleEndian.PutUint64(timestampBytes, uint64(timestamp.UnixNano()))\n\th.Write(timestampBytes)\n\n\t// Data\n\th.Write([]byte(data))\n\n\t// Previous hash\n\th.Write(previousHash)\n\n\tblock.hash = h.Sum(nil)\n\n\treturn block\n}", "title": "" }, { "docid": "e436e60d88b335d590bb073ad9815a09", "score": "0.58230776", "text": "func NewBlock(x, y, z, w, h, d int, blocking bool, name string) Collider {\n\tb := &Block{w: w, h: h, d: d}\n\tb.x, b.y, b.z = x, y, z\n\tb.name = name\n\tb.xyshape = resolv.Shape(resolv.NewRectangle(int32(x), int32(y), int32(w), int32(h)))\n\tb.xzshape = resolv.Shape(resolv.NewRectangle(int32(x), int32(z), int32(w), int32(d)))\n\tb.zyshape = resolv.Shape(resolv.NewRectangle(int32(z), int32(y), int32(d), int32(h)))\n\tb.ref = -1\n\tb.bodyType = &BodyType{blocking: blocking}\n\tb.reactionHub = events.NewReactionHub()\n\treturn b\n}", "title": "" }, { "docid": "ef388e6f7537c0e118f9ce513ba82a55", "score": "0.58170944", "text": "func (b *Blockchain) NewBlock(proof int64, prevHash *string, blockHash *string) {\n\tnB := Block{\n\t\tIndex: len(b.Chain) + 1,\n\t\tTimestamp: time.Now().Unix(),\n\t\tTransactions: b.CurrentTX,\n\t\tProof: proof,\n\t\tPrevHash: prevHash,\n\t\tBlockHash: blockHash,\n\t}\n\n\t// New block appended - delete all transactions\n\tb.CurrentTX = make([]Transaction, 0)\n\tb.Chain = append(b.Chain, nB)\n\tb.Length = len(b.Chain)\n}", "title": "" }, { "docid": "26895548912da85fe9d9688faf39f87e", "score": "0.58075416", "text": "func NewMockOnRetrieveBlock(ctrl *gomock.Controller) *MockOnRetrieveBlock {\n\tmock := &MockOnRetrieveBlock{ctrl: ctrl}\n\tmock.recorder = &MockOnRetrieveBlockMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "7569bd7d67dc5af5989ea8fe2d7bd0a1", "score": "0.57943106", "text": "func newBlockStore(id string, conf *Conf, indexConfig *IndexConfig,\n\tdbHandle *leveldbhelper.DBHandle, stats *stats) (*BlockStore, error) {\n\tfileMgr, err := newBlockfileMgr(id, conf, indexConfig, dbHandle)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// create ledgerStats and initialize blockchain_height stat\n\tledgerStats := stats.ledgerStats(id)\n\tinfo := fileMgr.getBlockchainInfo()\n\tledgerStats.updateBlockchainHeight(info.Height)\n\n\treturn &BlockStore{id, conf, fileMgr, ledgerStats}, nil\n}", "title": "" }, { "docid": "7798275caa1d2a479ed1881d3090106e", "score": "0.57939136", "text": "func NewBlockBase(p MdProse, c OpaqueCode) BlockBase { return BlockBase{p, c} }", "title": "" }, { "docid": "2169753142177fc52ac3a2c338da1aed", "score": "0.5791505", "text": "func NewBlock(stmt *Node) (*Node, error) {\n\tcurrScope = currScope.parent // end of the previous block\n\treturn &Node{\"\", stmt.Code}, nil\n}", "title": "" }, { "docid": "652a42dc2149838a024c2d2165831f97", "score": "0.57790554", "text": "func New() BlockChain {\n\treturn []block.Block{}\n}", "title": "" }, { "docid": "6b90e1ca0a914e0b256a3ef8163c759b", "score": "0.577495", "text": "func NewMockDatabaseBlockRetriever(ctrl *gomock.Controller) *MockDatabaseBlockRetriever {\n\tmock := &MockDatabaseBlockRetriever{ctrl: ctrl}\n\tmock.recorder = &MockDatabaseBlockRetrieverMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "b2a40b155b877ba00fe3f0ebcd36c15f", "score": "0.57739514", "text": "func newBlockManager(cfg *blockManagerCfg) (*blockManager, error) {\n\ttargetTimespan := int64(cfg.ChainParams.TargetTimespan / time.Second)\n\ttargetTimePerBlock := int64(cfg.ChainParams.TargetTimePerBlock / time.Second)\n\tadjustmentFactor := cfg.ChainParams.RetargetAdjustmentFactor\n\n\tbm := blockManager{\n\t\tcfg: cfg,\n\t\tpeerChan: make(chan interface{}, MaxPeers*3),\n\t\tblockNtfnChan: make(chan blockntfns.BlockNtfn),\n\t\tblkHeaderProgressLogger: newBlockProgressLogger(\n\t\t\t\"Processed\", \"block\", log,\n\t\t),\n\t\tfltrHeaderProgessLogger: newBlockProgressLogger(\n\t\t\t\"Verified\", \"filter header\", log,\n\t\t),\n\t\theaderList: headerlist.NewBoundedMemoryChain(\n\t\t\tnumMaxMemHeaders,\n\t\t),\n\t\treorgList: headerlist.NewBoundedMemoryChain(\n\t\t\tnumMaxMemHeaders,\n\t\t),\n\t\tquit: make(chan struct{}),\n\t\tblocksPerRetarget: int32(targetTimespan / targetTimePerBlock),\n\t\tminRetargetTimespan: targetTimespan / adjustmentFactor,\n\t\tmaxRetargetTimespan: targetTimespan * adjustmentFactor,\n\t}\n\n\t// Next we'll create the two signals that goroutines will use to wait\n\t// on a particular header chain height before starting their normal\n\t// duties.\n\tbm.newHeadersSignal = sync.NewCond(&bm.newHeadersMtx)\n\tbm.newFilterHeadersSignal = sync.NewCond(&bm.newFilterHeadersMtx)\n\n\t// We fetch the genesis header to use for verifying the first received\n\t// interval.\n\tgenesisHeader, err := cfg.RegFilterHeaders.FetchHeaderByHeight(0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbm.genesisHeader = *genesisHeader\n\n\t// Initialize the next checkpoint based on the current height.\n\theader, height, err := cfg.BlockHeaders.ChainTip()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbm.nextCheckpoint = bm.findNextHeaderCheckpoint(int32(height))\n\tbm.headerList.ResetHeaderState(headerlist.Node{\n\t\tHeader: *header,\n\t\tHeight: int32(height),\n\t})\n\tbm.headerTip = height\n\tbm.headerTipHash = header.BlockHash()\n\n\t// Finally, we'll set the filter header tip so any goroutines waiting\n\t// on the condition obtain the correct initial state.\n\t_, bm.filterHeaderTip, err = cfg.RegFilterHeaders.ChainTip()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// We must also ensure the filter header tip hash is set to the block\n\t// hash at the filter tip height.\n\tfh, err := cfg.BlockHeaders.FetchHeaderByHeight(bm.filterHeaderTip)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbm.filterHeaderTipHash = fh.BlockHash()\n\n\treturn &bm, nil\n}", "title": "" }, { "docid": "1d04522131af23c11a2229b41d39f0ff", "score": "0.5772388", "text": "func generateBlock(previousBlock Block, BPM int) (Block, error) {\n\n\tnewBlock := Block{\n\t\tIndex: previousBlock.Index + 1,\n\t\tTimestamp: time.Now().String(),\n\t\tBPM: BPM,\n\t\tPrevHash: previousBlock.Hash,\n\t}\n\tnewBlock.Hash = calculateHash(newBlock)\n\n\treturn newBlock, nil\n}", "title": "" }, { "docid": "e8a989fbe0d160f4c7cde7ae7a22c80f", "score": "0.5759889", "text": "func NewBlock(transactions []*Transaction, prevBlockHash []byte) *Block {\n\tblock := &Block{time.Now().Unix(), transactions, prevBlockHash, []byte{}}\n\tblock.SetHash()\n\treturn block\n}", "title": "" }, { "docid": "35e1726affe0857356a93380cabdb90a", "score": "0.5755603", "text": "func (m *MockRPCClient) Block(height *int64) (*core_types.ResultBlock, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Block\", height)\n\tret0, _ := ret[0].(*core_types.ResultBlock)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b16b7548531dcbbe4bcb793fd431b122", "score": "0.5751669", "text": "func (db *DB) newBlock() (int64, error) {\n\toff, err := db.index.extend(blockSize)\n\tdb.addBlocks(1)\n\treturn off, err\n}", "title": "" }, { "docid": "6cbbfac33e9e3b2af07f2f0f220225d2", "score": "0.57312965", "text": "func New(r io.Reader) (block *Block, err error) {\n\tblock = new(Block)\n\tif err = block.parseHeader(r); err != nil {\n\t\treturn block, err\n\t}\n\tblock.lr = io.LimitReader(r, block.Length)\n\treturn block, nil\n}", "title": "" }, { "docid": "c94ca0d876e9b17eda93fb31e1a94a3e", "score": "0.5726474", "text": "func NewMock(n int) clustering.Mock {\n\tpeers := NewNodes(n)\n\treturn clustering.NewMock(peers[0], peers[1:]...)\n}", "title": "" }, { "docid": "b7529915c86016fe083548d0db335de2", "score": "0.5721977", "text": "func NewBlock(transactions []*Transaction, prevBlockHash []byte) *Block {\n\tvar block Block\n\tblock.Timestamp = time.Now().Unix()\n\tblock.Transactions = transactions\n\tblock.PreviousHash = prevBlockHash\n\tpow := NewProofOfWork(&block)\n\tnonce, hash := pow.Run()\n\n\tblock.Nonce = nonce\n\tblock.Hash = hash\n\tblock.TXHash = block.HashTransactions()\n\tfor i := range block.Transactions {\n\t\tblock.Transactions[i].BlockHash = hash\n\t}\n\treturn &block\n}", "title": "" }, { "docid": "91dbc70400744aa2b96745b8bfcd1d3e", "score": "0.57154137", "text": "func NewMockblockServerLocal(ctrl *gomock.Controller) *MockblockServerLocal {\n\tmock := &MockblockServerLocal{ctrl: ctrl}\n\tmock.recorder = &MockblockServerLocalMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "cdeb4e387d1f9b6554e5f26eb395d19d", "score": "0.57114774", "text": "func New(t *testing.T) *MockClient {\n\treturn &MockClient{\n\t\tt: t,\n\t\tfiles: make(map[string][]byte),\n\t\tupdatedFiles: make(map[string][]byte),\n\t\tcreatedBranches: make(map[string]bool),\n\t\tbranchHeads: make(map[string]string),\n\t\tcreatedPullRequests: make(map[string][]*scm.PullRequestInput),\n\t}\n}", "title": "" }, { "docid": "398ae2e6247dd1df5184c58ba53c396b", "score": "0.57068354", "text": "func NewMockBlockCacheSimple(ctrl *gomock.Controller) *MockBlockCacheSimple {\n\tmock := &MockBlockCacheSimple{ctrl: ctrl}\n\tmock.recorder = &MockBlockCacheSimpleMockRecorder{mock}\n\treturn mock\n}", "title": "" } ]
d8db352d6b881f20ff94e74e21b1fb29
IsYANGGoStruct ensures that NetworkInstance_Protocol_Bgp_Global_UseMultiplePaths_Ibgp implements the yang.GoStruct interface. This allows functions that need to handle this struct to identify it as being generated by ygen.
[ { "docid": "b72f455ab4008f05e0d7178d70a61493", "score": "0.8675234", "text": "func (*NetworkInstance_Protocol_Bgp_Global_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" } ]
[ { "docid": "a28681dc191985ec0bc9f65128f9310f", "score": "0.8327008", "text": "func (*Bgp_Global_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "a28681dc191985ec0bc9f65128f9310f", "score": "0.8327008", "text": "func (*Bgp_Global_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "a28681dc191985ec0bc9f65128f9310f", "score": "0.8326857", "text": "func (*Bgp_Global_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "d1d21e500f98a34aa934b8d38b1d1e18", "score": "0.832429", "text": "func (*NetworkInstance_Protocol_Bgp_Global_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "d1d21e500f98a34aa934b8d38b1d1e18", "score": "0.832391", "text": "func (*NetworkInstance_Protocol_Bgp_Global_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "d1d21e500f98a34aa934b8d38b1d1e18", "score": "0.832391", "text": "func (*NetworkInstance_Protocol_Bgp_Global_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "7fd65f43638408e017c1ed25321992ca", "score": "0.8293841", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "7fd65f43638408e017c1ed25321992ca", "score": "0.82895607", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "7fd65f43638408e017c1ed25321992ca", "score": "0.82895607", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "359bada086c7df4fec0f51063ca143e5", "score": "0.81795835", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "359bada086c7df4fec0f51063ca143e5", "score": "0.81795835", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "359bada086c7df4fec0f51063ca143e5", "score": "0.81778526", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "70fde1d514a6b03c7016795a4e9043a2", "score": "0.81414366", "text": "func (*Bgp_PeerGroup_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "70fde1d514a6b03c7016795a4e9043a2", "score": "0.81414366", "text": "func (*Bgp_PeerGroup_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "70fde1d514a6b03c7016795a4e9043a2", "score": "0.81409645", "text": "func (*Bgp_PeerGroup_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "23b49e618b9bfe6f84545164db98aff4", "score": "0.8098785", "text": "func (*Bgp_Global_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "23b49e618b9bfe6f84545164db98aff4", "score": "0.8098785", "text": "func (*Bgp_Global_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "23b49e618b9bfe6f84545164db98aff4", "score": "0.8098785", "text": "func (*Bgp_Global_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "73192e0ba3b1334a393f703aae64f416", "score": "0.80635", "text": "func (*NetworkInstance_Protocol_Bgp_Global_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "73192e0ba3b1334a393f703aae64f416", "score": "0.8061707", "text": "func (*NetworkInstance_Protocol_Bgp_Global_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "73192e0ba3b1334a393f703aae64f416", "score": "0.8061707", "text": "func (*NetworkInstance_Protocol_Bgp_Global_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "450899d40e43415a9c50bc0683833728", "score": "0.8008664", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "450899d40e43415a9c50bc0683833728", "score": "0.8008664", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "450899d40e43415a9c50bc0683833728", "score": "0.80082864", "text": "func (*NetworkInstance_Protocol_Bgp_Global_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "b043268af2408281be0c819bc187719b", "score": "0.8004233", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "b043268af2408281be0c819bc187719b", "score": "0.8003401", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "b043268af2408281be0c819bc187719b", "score": "0.8003401", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "858b53867eeefea92407034c55c8771d", "score": "0.79629445", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "858b53867eeefea92407034c55c8771d", "score": "0.79629445", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "858b53867eeefea92407034c55c8771d", "score": "0.79626924", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "0c8196658b098aef83a69e447262ed0e", "score": "0.79602456", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "0c8196658b098aef83a69e447262ed0e", "score": "0.7958843", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "0c8196658b098aef83a69e447262ed0e", "score": "0.7958843", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "37258eca0a5b02a8b13b909f775b8a4c", "score": "0.7950217", "text": "func (*NetworkInstance_Protocol_Bgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "37258eca0a5b02a8b13b909f775b8a4c", "score": "0.7950217", "text": "func (*NetworkInstance_Protocol_Bgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "37258eca0a5b02a8b13b909f775b8a4c", "score": "0.7950217", "text": "func (*NetworkInstance_Protocol_Bgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "fcba1326d6bf951368e6b3b2d72a960b", "score": "0.79436535", "text": "func (*Bgp_Neighbor_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "fcba1326d6bf951368e6b3b2d72a960b", "score": "0.79436535", "text": "func (*Bgp_Neighbor_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "fcba1326d6bf951368e6b3b2d72a960b", "score": "0.7943236", "text": "func (*Bgp_Neighbor_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "93212d1df4c31f6e190246cba63b0228", "score": "0.7895738", "text": "func (*Bgp_Global_AfiSafi_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "93212d1df4c31f6e190246cba63b0228", "score": "0.7895738", "text": "func (*Bgp_Global_AfiSafi_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "93212d1df4c31f6e190246cba63b0228", "score": "0.7895406", "text": "func (*Bgp_Global_AfiSafi_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "8efaa8eef8cdb05f89afbea6d8cdc335", "score": "0.787853", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "8efaa8eef8cdb05f89afbea6d8cdc335", "score": "0.787853", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "7ee38612b161e9177bd426823430b206", "score": "0.7877611", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "7ee38612b161e9177bd426823430b206", "score": "0.78769827", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "8efaa8eef8cdb05f89afbea6d8cdc335", "score": "0.7876612", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "7ee38612b161e9177bd426823430b206", "score": "0.78756666", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "68c0e4299fadc09812647a6a78c5c717", "score": "0.78687066", "text": "func (*Bgp_PeerGroup_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "68c0e4299fadc09812647a6a78c5c717", "score": "0.7867976", "text": "func (*Bgp_PeerGroup_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "68c0e4299fadc09812647a6a78c5c717", "score": "0.7867976", "text": "func (*Bgp_PeerGroup_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "272112fc8bd0faa018093bae8b806ada", "score": "0.78646404", "text": "func (*Bgp_Neighbor_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "272112fc8bd0faa018093bae8b806ada", "score": "0.78646404", "text": "func (*Bgp_Neighbor_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "272112fc8bd0faa018093bae8b806ada", "score": "0.78639966", "text": "func (*Bgp_Neighbor_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "38eb667efab37d30a2cec495f99ce46c", "score": "0.7832606", "text": "func (*Bgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "38eb667efab37d30a2cec495f99ce46c", "score": "0.7832606", "text": "func (*Bgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "38eb667efab37d30a2cec495f99ce46c", "score": "0.7832606", "text": "func (*Bgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "025c5e89e929fb7ea74441dd0c875b06", "score": "0.78159535", "text": "func (*Bgp_Global_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "025c5e89e929fb7ea74441dd0c875b06", "score": "0.78159535", "text": "func (*Bgp_Global_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "025c5e89e929fb7ea74441dd0c875b06", "score": "0.78159535", "text": "func (*Bgp_Global_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "fd2aacef01de26a860ec5576bea5f434", "score": "0.78138685", "text": "func (*NetworkInstance_Protocol_Bgp_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "fd2aacef01de26a860ec5576bea5f434", "score": "0.78138685", "text": "func (*NetworkInstance_Protocol_Bgp_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "fd2aacef01de26a860ec5576bea5f434", "score": "0.7813585", "text": "func (*NetworkInstance_Protocol_Bgp_Global) IsYANGGoStruct() {}", "title": "" }, { "docid": "ea784761806c7ff77fb8fdfa547ebeaa", "score": "0.7812163", "text": "func (*Bgp_PeerGroup_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "ea784761806c7ff77fb8fdfa547ebeaa", "score": "0.7812163", "text": "func (*Bgp_PeerGroup_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "ea784761806c7ff77fb8fdfa547ebeaa", "score": "0.78121316", "text": "func (*Bgp_PeerGroup_EbgpMultihop) IsYANGGoStruct() {}", "title": "" }, { "docid": "a447342225d6bbdd66cb9aa57cdfd896", "score": "0.7797117", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "a447342225d6bbdd66cb9aa57cdfd896", "score": "0.7795924", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "a447342225d6bbdd66cb9aa57cdfd896", "score": "0.7795924", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "7f9d803bfc1b7be12f8ac8f5dca868e1", "score": "0.77941525", "text": "func (*Bgp_Global_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "7f9d803bfc1b7be12f8ac8f5dca868e1", "score": "0.77941525", "text": "func (*Bgp_Global_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "7f9d803bfc1b7be12f8ac8f5dca868e1", "score": "0.77941525", "text": "func (*Bgp_Global_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "3f0618e81f490bad29190c691a0f8bd4", "score": "0.7758871", "text": "func (*Bgp_PeerGroup_AfiSafi_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "3f0618e81f490bad29190c691a0f8bd4", "score": "0.7758871", "text": "func (*Bgp_PeerGroup_AfiSafi_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "bad0be764934fb0e33f6c0fef860112a", "score": "0.7756335", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "bad0be764934fb0e33f6c0fef860112a", "score": "0.7756335", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "3f0618e81f490bad29190c691a0f8bd4", "score": "0.7756265", "text": "func (*Bgp_PeerGroup_AfiSafi_UseMultiplePaths_Ibgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "bad0be764934fb0e33f6c0fef860112a", "score": "0.77546763", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "9fea9da6e0a63e38ed8ae1b43878cb27", "score": "0.7737917", "text": "func (*Bgp_Neighbor_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "9fea9da6e0a63e38ed8ae1b43878cb27", "score": "0.77368516", "text": "func (*Bgp_Neighbor_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "9fea9da6e0a63e38ed8ae1b43878cb27", "score": "0.77368516", "text": "func (*Bgp_Neighbor_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "51f6bf631f8e52f91a6b23514849567f", "score": "0.7686063", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "51f6bf631f8e52f91a6b23514849567f", "score": "0.7686063", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "51f6bf631f8e52f91a6b23514849567f", "score": "0.76833", "text": "func (*NetworkInstance_Protocol_Bgp_Neighbor_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "7f389df7e4dd21ab50632efff8639a0c", "score": "0.7670072", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "7ddbb5a645344ca763c1fbee76b19fec", "score": "0.76676124", "text": "func (*Bgp_PeerGroup_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "7ddbb5a645344ca763c1fbee76b19fec", "score": "0.76676124", "text": "func (*Bgp_PeerGroup_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "7ddbb5a645344ca763c1fbee76b19fec", "score": "0.76676124", "text": "func (*Bgp_PeerGroup_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "7f389df7e4dd21ab50632efff8639a0c", "score": "0.76673937", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "7f389df7e4dd21ab50632efff8639a0c", "score": "0.76673937", "text": "func (*NetworkInstance_Protocol_Bgp_PeerGroup_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "95b2d7d32d5ca5f2085f4cdabd23af0a", "score": "0.7663708", "text": "func (*NetworkInstance_Protocol_Igmp_Interface_Group) IsYANGGoStruct() {}", "title": "" }, { "docid": "95b2d7d32d5ca5f2085f4cdabd23af0a", "score": "0.7663708", "text": "func (*NetworkInstance_Protocol_Igmp_Interface_Group) IsYANGGoStruct() {}", "title": "" }, { "docid": "ada88e7a2785e152dea0087764da2dd8", "score": "0.7644238", "text": "func (*Bgp_Neighbor_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "ada88e7a2785e152dea0087764da2dd8", "score": "0.7644238", "text": "func (*Bgp_Neighbor_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "ada88e7a2785e152dea0087764da2dd8", "score": "0.7644238", "text": "func (*Bgp_Neighbor_UseMultiplePaths) IsYANGGoStruct() {}", "title": "" }, { "docid": "e7f7d571752eee60e41b7be907957f6e", "score": "0.76386666", "text": "func (*Bgp_PeerGroup_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "e7f7d571752eee60e41b7be907957f6e", "score": "0.7634982", "text": "func (*Bgp_PeerGroup_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" }, { "docid": "e7f7d571752eee60e41b7be907957f6e", "score": "0.7634982", "text": "func (*Bgp_PeerGroup_AfiSafi_UseMultiplePaths_Ebgp) IsYANGGoStruct() {}", "title": "" } ]
5742223cf3ed973cffd3277f5372509b
NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
[ { "docid": "484356333793eb1ea8e1cc7c3b26a84e", "score": "0.7445835", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(rel.RawQuery) > 0 {\n\t\trel.RawQuery += \"&apikey=\"\n\t\trel.RawQuery += c.ApiKey\n\t} else {\n\t\trel.RawQuery = \"apikey=\"\n\t\trel.RawQuery += c.ApiKey\n\t}\n\n\tu := c.BaseURL.ResolveReference(rel)\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\terr := json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Accept\", \"application/json\")\n\tif c.UserAgent != \"\" {\n\t\treq.Header.Add(\"User-Agent\", c.UserAgent)\n\t}\n\n\treturn req, nil\n}", "title": "" } ]
[ { "docid": "95dd61d0cde14fbde69c62d307ae5949", "score": "0.75665414", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := c.BaseURL.ResolveReference(rel)\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\terr := json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tif c.UserAgent != \"\" {\n\t\treq.Header.Add(\"User-Agent\", c.UserAgent)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "512189292ea5fce41f006940506a7c7f", "score": "0.754921", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\tif !strings.HasSuffix(c.baseURL.Path, \"/\") {\n\t\treturn nil, fmt.Errorf(\"baseURL must have a trailing slash, but %q does not\", c.baseURL)\n\t}\n\tu, err := c.baseURL.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tenc := json.NewEncoder(buf)\n\t\tenc.SetEscapeHTML(false)\n\t\terr := enc.Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "c448f443199d0074c85bf7752a870ec1", "score": "0.753056", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\n\t// ensure the url\n\tif !strings.HasSuffix(c.BaseURL.Path, \"/\") {\n\t\treturn nil, fmt.Errorf(\"BaseURL must have a trailing slash, but %q does not\", c.BaseURL)\n\t}\n\tu, err := c.BaseURL.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// if we need to send a body with the request\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tenc := json.NewEncoder(buf)\n\t\tenc.SetEscapeHTML(false)\n\t\terr := enc.Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// create the new request e.g. GET, URL (stringified), body\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// post adjust request string\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\tif c.UserAgent != \"\" {\n\t\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "7d70e7a0e6e86f27a204876113e2beba", "score": "0.7459975", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\tif !strings.HasSuffix(c.baseURL.Path, \"/\") {\n\t\treturn nil, fmt.Errorf(\"baseURL must have a trailing slash, but %q does not\", c.baseURL)\n\t}\n\tu, err := c.baseURL.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tenc := json.NewEncoder(buf)\n\t\tenc.SetEscapeHTML(false)\n\t\terr = enc.Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, _ := http.NewRequest(method, u.String(), buf)\n\tc.setToken(req)\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "d6cf5cdb9e10a8e697b22550b03739a9", "score": "0.74403036", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\tif !strings.HasSuffix(c.baseURL.Path, \"/\") {\n\t\treturn nil, fmt.Errorf(\"client baseURL does not have a trailing slash: %q\", c.baseURL)\n\t}\n\n\tu, err := c.baseURL.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tenc := json.NewEncoder(buf)\n\t\tenc.SetEscapeHTML(false)\n\t\terr := enc.Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"token\", c.apiToken)\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\treq.Header.Set(\"Accept\", \"application/json\")\n\tif c.UserAgent != \"\" {\n\t\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "9646583330e43146dadbfc6d4625de49", "score": "0.7398107", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := c.baseURL.ResolveReference(rel)\n\n\tbuf := new(bytes.Buffer)\n\tif body != nil {\n\t\terr := json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Authorization\", \"Bearer \"+c.authToken)\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "1c811c9afa20c678cc76685b95f80e11", "score": "0.73829025", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tencErr := json.NewEncoder(buf).Encode(body)\n\t\tif encErr != nil {\n\t\t\treturn nil, encErr\n\t\t}\n\t}\n\n\tu := c.BaseURL.ResolveReference(rel)\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-type\", defaultMediaType)\n\t}\n\treq.Header.Set(\"Accept\", defaultMediaType)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "82693fcec979142a1abcc91139f0e29f", "score": "0.73550284", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\tif !strings.HasSuffix(c.BaseURL.Path, \"/\") {\n\t\treturn nil, fmt.Errorf(\"BaseURL must have a trailing slash, but %q does not\", c.BaseURL)\n\t}\n\n\tu, err := c.BaseURL.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tenc := json.NewEncoder(buf)\n\t\tenc.SetEscapeHTML(false)\n\t\terr := enc.Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// We need to sign the request. https://developer.akamai.com/legacy/introduction/Client_Auth.html\n\tsigner := NewSigner(c.Credentials)\n\tsigner.Sign(req, buf)\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\n\tif c.UserAgent != \"\" {\n\t\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "bfa86829d7d1a565d7cc6ea24612a01b", "score": "0.73459977", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\tif !strings.HasSuffix(c.BaseURL.Path, \"/\") {\n\t\treturn nil, fmt.Errorf(\"BaseURL must have a trailing slash, but %q does not\", c.BaseURL)\n\t}\n\tu, err := c.BaseURL.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tenc := json.NewEncoder(buf)\n\t\tenc.SetEscapeHTML(false)\n\t\terr := enc.Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//TODO: Check Auth\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %v\", c.Token))\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\tif c.UserAgent != \"\" {\n\t\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "4d329d81f9aee5e301eb25f4e756d5e0", "score": "0.73050135", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\tu, err := c.BaseURL.Parse(fmt.Sprintf(\"v1/%s\", urlStr))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = &bytes.Buffer{}\n\t\tenc := json.NewEncoder(buf)\n\t\tenc.SetEscapeHTML(false)\n\t\terr := enc.Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Authorization\", fmt.Sprintf(\"Bearer %s\", c.token))\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\n\tif c.UserAgent != \"\" {\n\t\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "dfc4b24ebb3ffcade6d36bfd7d3699a4", "score": "0.7305001", "text": "func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error) {\r\n\trel, err := url.Parse(urlStr)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tu := c.BaseURL.ResolveReference(rel)\r\n\r\n\tbuf := new(bytes.Buffer)\r\n\tif body != nil {\r\n\t\terr = json.NewEncoder(buf).Encode(body)\r\n\t\tif err != nil {\r\n\t\t\treturn nil, err\r\n\t\t}\r\n\t}\r\n\r\n\treq, err := http.NewRequest(method, u.String(), buf)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treq.Header.Add(\"Content-Type\", mediaType)\r\n\treq.Header.Add(\"Accept\", mediaType)\r\n\treq.Header.Add(\"User-Agent\", c.UserAgent)\r\n\treturn req, nil\r\n}", "title": "" }, { "docid": "0eeb00ee4828398810fd744b5a9a96d5", "score": "0.7279125", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := c.BaseURL.ResolveReference(rel)\n\n\t// If the body is not empty, assume it's a form data\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = bytes.NewBufferString(body.(string))\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Always request JSON\n\treq.Header.Set(\"Accept\", \"application/json\")\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\t}\n\n\tif c.UserAgent != \"\" {\n\t\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "b0bd67f40142244cb2e0121d034fc404", "score": "0.7264573", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := c.BaseURL.ResolveReference(rel)\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\terr := json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Accept\", \"application/json\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\t// Authentication v1\n\treq.Header.Add(xAIOKeyHeader, c.APIKey)\n\n\tif c.userAgent != \"\" {\n\t\treq.Header.Add(\"User-Agent\", c.userAgent)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "98ea277ae4e079118f1d74f8dda791f2", "score": "0.72621965", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\tif !strings.HasSuffix(c.BaseURL.Path, \"/\") {\n\t\treturn nil, fmt.Errorf(\"BaseURL must have a trailing slash, but %q does not\", c.BaseURL)\n\t}\n\tu, err := c.BaseURL.Parse(urlStr)\n\n\t// Add api key to params\n\tv := u.Query()\n\tv.Set(\"api_key\", c.apiKey)\n\tu.RawQuery = v.Encode()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tenc := json.NewEncoder(buf)\n\t\tenc.SetEscapeHTML(false)\n\t\terr := enc.Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Authorization\", \"Bearer \"+c.accessToken)\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\tif c.UserAgent != \"\" {\n\t\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "cb7e9a86a74c88dec111853204e58e04", "score": "0.72513527", "text": "func (client *Client) NewRequest(method string, urlStr string, body interface{}) (*http.Request, error) {\n\trelative, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqURL := client.BaseURL.ResolveReference(relative)\n\n\tvar data url.Values\n\tif body != nil {\n\t\tdata, _ = query.Values(body)\n\t}\n\n\tfmt.Println(\"Request Url \", reqURL, data.Encode())\n\treq, err := http.NewRequest(method, reqURL.String(),\n\t\tbytes.NewBufferString(data.Encode()))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif client.UserAgent != \"\" {\n\t\treq.Header.Add(\"User-Agent\", client.UserAgent)\n\t}\n\treq.Header.Add(\"Content-Type\", contentType)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "5054e54e5bded3d1cf6b0c04ace70864", "score": "0.724187", "text": "func (rc *RestClient) NewRequest(ctx context.Context, method string, urlStr string, body interface{}) (*http.Request, error) {\n\t// Resolve the urlStr against the base url\n\tref, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqURL := rc.baseURL.ResolveReference(ref).String()\n\n\t// Marshal the body as json if a body is present\n\tbuf := new(bytes.Buffer)\n\tif body != nil {\n\t\tdata, err := json.Marshal(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbuf = bytes.NewBuffer(data)\n\t}\n\n\treq, err := http.NewRequest(method, reqURL, buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\n\treq.Header.Set(\"Authorization\", rc.token)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"User-Agent\", rc.userAgent)\n\treturn req, nil\n}", "title": "" }, { "docid": "d6b120529faefeefdeb4bd24e6bf42ab", "score": "0.71970236", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\tu, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tenc := json.NewEncoder(buf)\n\t\tenc.SetEscapeHTML(false)\n\t\terr := enc.Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\treq.Proto = \"HTTP/2\"\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\n\t// req.Header.Set(\"Accept\", mediaTypeV3)\n\tif c.UserAgent != \"\" {\n\t\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\t}\n\treturn req, nil\n\n}", "title": "" }, { "docid": "1852cd808523cd69e8ea5e7983c29c36", "score": "0.71940213", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := c.baseURL.ResolveReference(rel)\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\terr = json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\t// Set authentication information\n\tif c.Authentication.authType == authTypeSession {\n\t\t// Set session cookie if there is one\n\t\tif c.session != nil {\n\t\t\tfor _, cookie := range c.session.Cookies {\n\t\t\t\treq.AddCookie(cookie)\n\t\t\t}\n\t\t}\n\t} else if c.Authentication.authType == authTypeBasic {\n\t\t// Set basic auth information\n\t\tif c.Authentication.username != \"\" {\n\t\t\treq.SetBasicAuth(c.Authentication.username, c.Authentication.password)\n\t\t}\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "1e179326e609c29f70d1850ca1b72bef", "score": "0.718935", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\tu, err := c.BaseURL.Parse(c.BaseURL.Path + urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tif body != nil {\n\t\terr = json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", mediaType)\n\treq.Header.Add(\"Accept\", mediaType)\n\tif c.Token != \"\" {\n\t\treq.Header.Add(\"Authorization\", fmt.Sprintf(\"Bearer %s\", c.Token))\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "f97a3552652735de5b80fa6dcfedf661", "score": "0.7158453", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\t// Resolve the relative URL path\n\trelPath, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tendpointURL := c.BaseURL.ResolveReference(relPath)\n\n\t// Create buffer and fill it with body data encoded in JSON\n\tvar b io.ReadWriter\n\tif body != nil {\n\t\tb = new(bytes.Buffer)\n\t\terr = json.NewEncoder(b).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Create new http request and set the headers\n\treq, err := http.NewRequest(method, endpointURL.String(), b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\n\t// Set the auth token to the one specified in the client\n\tif c.clientToken != \"\" {\n\t\treq.Header.Set(authTokenHeader, c.clientToken)\n\t} else {\n\t\treturn nil, errors.New(\"Please provide your API Token with the RAINFOREST_API_TOKEN environment variable or --token global flag\")\n\t}\n\n\t// Set UserAgent header with appended library version, will look like:\n\t// \"rainforest-cli/2.1.0 [rainforest golang lib/2.0.0]\"\n\tuserAgent := []string{\"rainforest\", \"golang\", \"lib/\" + libVersion}\n\n\tif c.SendTelemetry {\n\t\tfound, ci_name := detectci.WhichCI()\n\t\tif found {\n\t\t\tuserAgent = append(userAgent, \"ci/\"+ci_name)\n\t\t}\n\n\t\tvar remote string\n\t\tgit, err := gitTrigger.NewGitTrigger()\n\t\tif err == nil {\n\t\t\tremote, err = git.GetRemote()\n\t\t\tif err == nil {\n\t\t\t\tu, err := giturls.Parse(remote)\n\t\t\t\tif err == nil {\n\t\t\t\t\t// Strip the user details, if any\n\t\t\t\t\tu.User = nil\n\t\t\t\t\tuserAgent = append(userAgent, \"repo/\"+u.String())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tcomposedUserAgent := c.UserAgent + \" [\" + strings.Join(userAgent[:], \" \") + \"]\"\n\treq.Header.Set(\"User-Agent\", composedUserAgent)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "20008ba4f38105c1c3d47e7e7db3aa1b", "score": "0.7094935", "text": "func (c *Client) NewRequest(ctx context.Context, method, urlStr string, params map[string]string, body interface{}) (*http.Request, error) {\n\tif !strings.HasPrefix(urlStr, \"/\") {\n\t\treturn nil, fmt.Errorf(\"httpx new request error: url must have a preceding slash, but %q does not\", urlStr)\n\t}\n\tu, err := c.BaseURL.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"httpx new request error: %w\", err)\n\t}\n\tif params != nil {\n\t\tq := u.Query()\n\t\tfor k, v := range params {\n\t\t\tq.Set(k, v)\n\t\t}\n\t\tu.RawQuery = q.Encode()\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tif err := json.NewEncoder(buf).Encode(body); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"httpx new request error: %w\", err)\n\t\t}\n\t}\n\treq, err := http.NewRequestWithContext(ctx, method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"httpx new request error: %w\", err)\n\t}\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\treturn req, nil\n}", "title": "" }, { "docid": "0ef17f801edcb138abdef6571c2cd137", "score": "0.70873404", "text": "func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error) {\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := c.BaseURL.ResolveReference(rel)\n\n\tbuf := new(bytes.Buffer)\n\tif body != nil {\n\t\terr = json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.SetBasicAuth(c.Config.Username, c.Config.Password)\n\n\treq.Header.Add(\"Content-Type\", mediaType)\n\treq.Header.Add(\"Accept\", mediaType)\n\treq.Header.Add(\"User-Agent\", c.UserAgent)\n\treq.Header.Add(\"OC-API-Version\", c.Config.APIVersion)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "eecdf8e2206ea40b16961d58df74a5f4", "score": "0.6968888", "text": "func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error) {\n\tu, err := c.BaseURL.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar req *http.Request\n\tswitch method {\n\tcase http.MethodGet, http.MethodHead, http.MethodOptions:\n\t\treq, err = http.NewRequest(method, u.String(), nil)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\tdefault:\n\t\tbuf := new(bytes.Buffer)\n\t\tif body != nil {\n\t\t\terr = json.NewEncoder(buf).Encode(body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\treq, err = http.NewRequest(method, u.String(), buf)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treq.Header.Set(\"Content-Type\", mediaType)\n\t}\n\n\tfor k, v := range c.headers {\n\t\treq.Header.Add(k, v)\n\t}\n\n\treq.Header.Set(\"Accept\", mediaType)\n\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "e5e5a4d954447f886d9676b6546a823f", "score": "0.6938685", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}, opts ...URLOption) (*http.Request, error) {\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tv := rel.Query()\n\tfor _, opt := range opts {\n\t\tif opt != nil { // Avoid panic in case the user passes a nil option.\n\t\t\topt(&v)\n\t\t}\n\t}\n\trel.RawQuery = v.Encode()\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tif err = jsonapi.Encode(buf, body); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tu := c.BaseURL.ResolveReference(rel)\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-type\", defaultMediaType)\n\t}\n\treq.Header.Set(\"Accept\", defaultMediaType)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "8207ea4ba830cd7a2cca72534ebdc7af", "score": "0.6908295", "text": "func (c *Client) NewRequest(method, urlStr string, body io.Reader) (*http.Request, error) {\n\tif !strings.HasSuffix(c.BaseURL.Path, \"/\") {\n\t\treturn nil, fmt.Errorf(\"BaseURL must have a trailing slash, but %q does not\", c.BaseURL)\n\t}\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := c.BaseURL.ResolveReference(rel)\n\n\treq, err := http.NewRequest(method, u.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif c.UserAgent != \"\" {\n\t\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "dc7a14fe207852e19b99b3bfbd21ee45", "score": "0.6897141", "text": "func (c *Client) NewRequest(method, urlStr string, data interface{}) (*http.Request, error) {\n\trelativeURL, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tabsoluteURL := c.BaseURL.ResolveReference(relativeURL)\n\n\tvar body io.ReadWriter\n\tif data != nil {\n\t\tbody = new(bytes.Buffer)\n\n\t\terr := json.NewEncoder(body).Encode(data)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, absoluteURL.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// set api_key for auth\n\tq := req.URL.Query()\n\tq.Set(\"api_key\", c.apiKey)\n\treq.URL.RawQuery = q.Encode()\n\n\treq.Header.Set(\"Accept\", mediaType)\n\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\n\tif data != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "af046c9a21c421e16eb6c7e61abc752a", "score": "0.6871958", "text": "func (c *Client) newRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\tu, err := c.BaseURL.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tenc := json.NewEncoder(buf)\n\t\tenc.SetEscapeHTML(false)\n\t\tif err := enc.Encode(body); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\n\treq.Header.Set(\"Authorization\", c.token)\n\treq.Header.Set(\"User-Agent\", \"bitrise-add-new-project/0.14\")\n\n\treturn req, nil\n}", "title": "" }, { "docid": "8c11f50787443c5afcd1b7da23363489", "score": "0.68383634", "text": "func (c *Client) NewRequest(method string, urlStr string) (*http.Request, error) {\n\t// Resolve absolute URL\n\tu, err := c.BaseURL.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create the request\n\treq, err := http.NewRequest(method, u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Set request headers\n\treq.Header.Set(\"Accept\", \"application/json\")\n\tif c.UserAgent != \"\" {\n\t\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "e44ca3bb7ac1ce17e0261bf7ce44b65d", "score": "0.6800556", "text": "func (c *Client) newRequest(method string, urlStr string, body interface{}) (*http.Request, error) {\n\tu, err := c.BaseURL.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tif body != nil {\n\t\terr = json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", mediaType)\n\treq.Header.Add(\"Accept\", mediaType)\n\tif c.Token != \"\" {\n\t\treq.Header.Add(\"X-Auth-Header\", c.Token)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "66e710a948739f04fc3ca07b27c65a85", "score": "0.6794941", "text": "func (c *HubspotClient) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\tif strings.HasSuffix(c.BaseURL.Path, \"/\") {\n\t\treturn nil, fmt.Errorf(\"BaseURL must NOT have a trailing slash, but %q does not\", c.BaseURL)\n\t}\n\n\tif !strings.HasPrefix(urlStr, \"/\") {\n\t\treturn nil, fmt.Errorf(\"urlStr must have begin with a slash, but %q does not\", urlStr)\n\t}\n\n\tu, err := c.BaseURL.Parse(c.BaseURL.Path + urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tif e := json.NewEncoder(buf).Encode(body); e != nil {\n\t\t\treturn nil, e\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// body, err = ioutil.ReadAll(req.Body)\n\t// if err != nil {\n\t// \tlog.Fatalf(\"ERROR: %s\", err)\n\t// }\n\n\t// fmt.Printf(\"%s\", body)\n\n\tif body != nil {\n\t\treq.Header.Set(\"Accept\", \"application/json\")\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\n\tif c.UserAgent != \"\" {\n\t\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\t}\n\n\tif e := c.authenticator.Authenticate(req); e != nil {\n\t\treturn nil, e\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "e2d53993e30c3d308650367a87d8e35d", "score": "0.6760266", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}, query interface{}) (*http.Request, error) {\n\tu, err := c.buildURL(urlStr, query)\n\n\tvar b *bytes.Buffer\n\tif body != nil {\n\t\tb, err = buildBody(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// net/http checks type to parse the body; a nil bytes.Buffer causes a segfault\n\tvar req *http.Request\n\tif b == nil {\n\t\treq, err = http.NewRequest(method, u.String(), nil)\n\t} else {\n\t\treq, err = http.NewRequest(method, u.String(), b)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"accept\", \"application/json\")\n\treq.Header.Add(\"content-type\", \"application/json\")\n\n\terr = c.authFunc(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif debug {\n\t\trequestDump, err := httputil.DumpRequest(req, true)\n\t\tif err == nil {\n\t\t\tfmt.Println(string(requestDump))\n\t\t}\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "e86604335d01358ec982838a85d8e071", "score": "0.6745725", "text": "func (c *Client) NewRequest(method, urlStr string, body io.Reader) (*http.Request, error) {\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := c.BaseURL.ResolveReference(rel)\n\n\treq, err := http.NewRequest(method, u.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Authorization\", c.token)\n\n\tif c.UserAgent != \"\" {\n\t\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "618f9e5a15f984c861c89fb0291f73d6", "score": "0.6691331", "text": "func (c *Client) NewRequest(method, urlString string, data interface{}) (*http.Request, error) {\n\ttempUrl, err := url.Parse(urlString)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewUrl := c.BaseURL.ResolveReference(tempUrl)\n\n\tvar payload io.ReadWriter\n\tif data != nil {\n\t\tpayload = new(bytes.Buffer)\n\n\t\terr := json.NewEncoder(payload).Encode(data)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t}\n\treq, err := http.NewRequest(method, newUrl.String(), payload)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tq := req.URL.Query()\n\tq.Set(\"api_key\", c.apiKey)\n\treq.Header.Set(\"Accept\", mediaType)\n\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\n\tif data != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "4025715b4c07750c10e0050efb5f8efa", "score": "0.6666702", "text": "func (c *EVEAPIClient) newRequest(method, urlStr string, body interface{}, mediaType string) (*http.Request, error) {\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tif body != nil {\n\t\terr = json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, rel.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", mediaType)\n\treq.Header.Add(\"Accept\", BASE_API_VERSION)\n\treq.Header.Add(\"User-Agent\", c.userAgent)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "afe0ee23b551b68c412c428c2837fe6d", "score": "0.6664933", "text": "func (c *Client) NewRequest(method, endpoint string, params interface{}, body interface{}) (*http.Request, error) {\n\n\tu, err := c.APIURL.Parse(c.Base + \"/\" + endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tenc := json.NewEncoder(buf)\n\t\tenc.SetEscapeHTML(false)\n\t\terr := enc.Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar bearer = \"Bearer \" + c.APIKey\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Authorization\", bearer)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "405595be0fca515b749ad26da37e4152", "score": "0.6647715", "text": "func (c *Client) NewRequest(method, urlPath string, body interface{}) (*http.Request, error) {\n\trel, err := url.Parse(urlPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuf := new(bytes.Buffer)\n\n\tif body != nil {\n\t\terr = json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, c.BackendURL.ResolveReference(rel).String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"User-Agent\", c.UserAgent)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "4489db65ce1c0a071471c31d69e1ac77", "score": "0.66354287", "text": "func (b *ClientBase) NewRequest(method, path string, body interface{}) (*http.Request, error) {\n\trel := &url.URL{Path: path}\n\tu := b.BaseURL.ResolveReference(rel)\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\terr := json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\treq.Header.Set(\"Accept\", \"application/json\")\n\tif b.UserAgent != \"\" {\n\t\treq.Header.Set(\"User-Agent\", b.UserAgent)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "d84aca0eee1b826c81daefc476ad2345", "score": "0.6568731", "text": "func (c *Client) NewPostRequest(urlStr string, body interface{}) (*http.Request, error) {\n\treturn c.NewRequest(\"POST\", urlStr, body)\n}", "title": "" }, { "docid": "43f3917aa5b9c414b66dcb23e5093498", "score": "0.65480393", "text": "func (c *Client) NewRequest(method, urlStr string, params url.Values) (*http.Request, error) {\n\tif params == nil {\n\t\tparams = url.Values{}\n\t}\n\tc.setDefaultParams(&params)\n\tu, err := c.resolveURL(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar body io.Reader\n\tmethod = strings.ToUpper(method)\n\tif method == \"GET\" {\n\t\tu.RawQuery = params.Encode()\n\t} else {\n\t\tbody = strings.NewReader(params.Encode())\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif method != \"GET\" {\n\t\treq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\t}\n\n\tif c.UserAgent != \"\" {\n\t\treq.Header.Add(\"User-Agent\", c.UserAgent)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "c121cea70e647a8a6d1f6669ad304673", "score": "0.6496245", "text": "func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error) {\n\trequestURL, err := c.baseURL.Parse(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tif err := json.NewEncoder(buf).Encode(body); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, requestURL.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", applicationJson)\n\t}\n\treq.Header.Set(\"Accept\", applicationJson)\n\treturn req, nil\n}", "title": "" }, { "docid": "d79e0a0d90987de9bf873361a51ad4ab", "score": "0.6477276", "text": "func (c *APIClient) NewRequest(method, endpoint, jsonRequest string) (*http.Request, error) {\n\turi := c.baseURL + endpoint\n\tu, err := url.Parse(uri)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"error parsing url %s\", uri)\n\t}\n\tbuff := []byte(jsonRequest)\n\treq, err := http.NewRequest(method, u.String(), bytes.NewBuffer(buff))\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Error creating a new request\")\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Accept\", \"application/vnd.api+json\")\n\n\treturn req, nil\n}", "title": "" }, { "docid": "5665bfefd16aed415eacb88cef9168d2", "score": "0.646817", "text": "func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error) {\n\tu, err := c.baseURL.Parse(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tenc := json.NewEncoder(buf)\n\t\tenc.SetEscapeHTML(false)\n\t\terr := enc.Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Accept\", \"application/json\")\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\n\tif c.userAgent != \"\" {\n\t\treq.Header.Set(\"User-Agent\", c.userAgent)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "8739618e04402f936d476d91be282554", "score": "0.640845", "text": "func (c *Client) NewRequest(body interface{}, method string, endpoint string) (*http.Request, error) {\n\tu, err := url.Parse(c.URL + endpoint)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error parsing base URL: %s\", err)\n\t}\n\n\trBody, err := encodeBody(body)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error encoding request body: %s\", err)\n\t}\n\n\t// Build the request\n\treq, err := http.NewRequest(method, u.String(), rBody)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error creating request: %s\", err)\n\t}\n\n\t// Add the authorization header\n\treq.Header.Add(\"Authorization\", fmt.Sprintf(\"Bearer %s\", c.Token))\n\treq.Header.Add(\"Accept\", \"application/json\")\n\n\t// If it's a not a get, add a content-type\n\tif method != \"GET\" {\n\t\treq.Header.Add(\"Content-Type\", \"application/json\")\n\t}\n\n\treturn req, nil\n\n}", "title": "" }, { "docid": "9acd0bd00dcf83276e7e7ff26ee4d0b8", "score": "0.63622123", "text": "func (c *Client) NewRequest(method string, path string, body interface{}) (*http.Request, error) {\n\trel := &url.URL{Path: path}\n\tu := c.BaseURL.ResolveReference(rel)\n\n\tbuf := new(bytes.Buffer)\n\tif body != nil {\n\t\terr := json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Accept\", mediaType)\n\treq.Header.Add(\"Content-Type\", mediaType)\n\treq.Header.Add(\"User-Agent\", c.UserAgent)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "8fdab57fd725d9a6e2a243ce170816de", "score": "0.6354701", "text": "func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error) {\n\trel, err := url.Parse(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\turi := c.Endpoint.ResolveReference(rel)\n\n\t// Encode body as json\n\tbuf := new(bytes.Buffer)\n\tif body != nil {\n\t\terr := json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, uri.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Authorization\", \"bearer \"+c.APIToken)\n\treq.Header.Add(\"User-Agent\", c.UserAgent)\n\treq.Header.Add(\"Content-Type\", c.ContentType)\n\treturn req, nil\n}", "title": "" }, { "docid": "436fc72fb3709ba63794bcb92acd2e49", "score": "0.6325887", "text": "func (c *Client) NewRequest(method, urlStr string,\n\tdata url.Values) (*http.Request, error) {\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := c.BaseURL.ResolveReference(rel)\n\n\tif c.session != nil {\n\t\tvalues := u.Query()\n\t\tvalues.Set(\"sid\", c.session.Sid)\n\t\tu.RawQuery = values.Encode()\n\t}\n\n\tvar buf io.Reader\n\tif data != nil {\n\t\tbuf = strings.NewReader(data.Encode())\n\t}\n\treq, err := http.NewRequest(method, u.String(), buf)\n\treq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "5383dd6e477aa667816be692255425be", "score": "0.63210547", "text": "func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error) {\n\t// relative path to append to the endpoint url, no leading slash please\n\trel, err := url.Parse(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := c.BaseURL.ResolveReference(rel)\n\n\t// json encode the request body, if any\n\tbuf := new(bytes.Buffer)\n\tif body != nil {\n\t\terr := json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Close = true\n\n\treq.Header.Add(\"X-Auth-Token\", c.APIKey)\n\treq.Header.Add(\"X-Consumer-Token\", c.ConsumerToken)\n\n\treq.Header.Add(\"Content-Type\", mediaType)\n\treq.Header.Add(\"Accept\", mediaType)\n\treq.Header.Add(\"User-Agent\", userAgent)\n\treturn req, nil\n}", "title": "" }, { "docid": "a2ac3093c6a8a63cf1f22861923b12f9", "score": "0.62983274", "text": "func (client *Client) newRequest(method, path string, body io.Reader) (*http.Request, error) {\n url := client.RootURI\n url.Path = fmt.Sprintf(\"%v%v\", url.Path, path)\n\n request, err := http.NewRequest(method, url.String(), body)\n if err != nil {\n return nil, err\n }\n\n request.Header.Add(\"Accept\", kApplicationJson)\n request.Header.Add(\"Content-Type\", kApplicationJson)\n request.Header.Add(\"User-Agent\", kUserAgent)\n\n return request, nil\n}", "title": "" }, { "docid": "e2c4992a8d7bb58f9ea52c65b4ee5cda", "score": "0.62419426", "text": "func (c *DefaultHTTPClient) NewRequest(method, url string, body io.Reader) (*http.Request, error) {\n return http.NewRequest(method, url, body)\n}", "title": "" }, { "docid": "606ecd234388a93036681bd09cdf83eb", "score": "0.62257755", "text": "func (c *Client) NewRequest(ctx context.Context, method, urlStr string) (*http.Request, error) {\n\tu, err := c.BaseURL.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq, err := http.NewRequest(method, u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Add(\"Private-Token\", c.Token)\n\treq.WithContext(ctx)\n\treturn req, nil\n}", "title": "" }, { "docid": "c8ed08fad08e92cb263fc0ac888d2b45", "score": "0.62161434", "text": "func (c *Client) NewRequest(method string, requestUrl string, body io.Reader) (*http.Request, error) {\n\trelativeUrl, err := url.Parse(requestUrl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tu := c.BaseURL.ResolveReference(relativeUrl)\n\n\t// NewRequest uses a new value object of body\n\treq, err := http.NewRequest(method, u.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// parse and encode Querystring Values\n\tvalues := req.URL.Query()\n\treq.URL.RawQuery = values.Encode()\n\tdebug(\"Encoded url %+v\", u)\n\n\tmyBody := &Body{body}\n\n\tif body != nil {\n\t\t// Detect Content-type\n\t\treq.Header.Set(\"Content-Type\", myBody.ContentType())\n\t}\n\n\t// Calculate the body hash\n\treq.Header.Set(\"X-Ops-Content-Hash\", myBody.Hash())\n\n\t// don't have to check this works, signRequest only emits error when signing hash is not valid, and we baked that in\n\tc.Auth.SignRequest(req)\n\treturn req, nil\n}", "title": "" }, { "docid": "8bb90b7b5ebd6f1be6f9388d3456de1c", "score": "0.62065935", "text": "func NewRequest(urlString string, data interface{}, context SendContext) (*http.Request, error) {\n\treturn Structured.NewRequest(urlString, data, context)\n}", "title": "" }, { "docid": "32f2bdcf356fb4c3ff84951e6bbfdd75", "score": "0.61936563", "text": "func NewRequest(method, url string, body interface{}) *Request {\n\tjsonBody, err := json.Marshal(body)\n\tgomega.Expect(err).To(gomega.BeNil(), \"Error marshaling body parameter to json\")\n\treturn &Request{\n\t\tmethod: method,\n\t\turl: url,\n\t\tbody: body,\n\t\tHTTPRequest: httptest.NewRequest(method, url, ioutil.NopCloser(bytes.NewReader(jsonBody))),\n\t}\n}", "title": "" }, { "docid": "9f5f4239cea90edb43b9777ef70a2ce6", "score": "0.61844647", "text": "func (client *Client) newRequest(relativeURI string, method string, body interface{}) (*http.Request, error) {\n\tpath, err := normalizeURI(relativeURI)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trequestURI := client.baseAddress.ResolveReference(path)\n\n\tvar (\n\t\trequest *http.Request\n\t\tbodyReader io.Reader\n\t)\n\n\tbodyReader, err = newReaderFromJSON(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trequest, err = http.NewRequest(method, requestURI.String(), bodyReader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trequest.Header.Set(\"Accept\", \"application/json\")\n\n\tif bodyReader != nil {\n\t\trequest.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\n\treturn request, nil\n}", "title": "" }, { "docid": "01c5c2e412f33670bce2b8abe69bc925", "score": "0.61286676", "text": "func newPostBookRequest(jsonStr []byte) *http.Request {\n\trequest, _ := http.NewRequest(http.MethodPost, \"/books\", bytes.NewBuffer(jsonStr))\n\n\treturn request\n}", "title": "" }, { "docid": "e54c1469276f9b560c36328a02f5437b", "score": "0.6120356", "text": "func (c *Cli) NewRequest(method, path string, obj interface{}, enc ...func(interface{}) (io.Reader, error)) (*Request, error) {\n\tserialize := func(o interface{}) (io.Reader, error) {\n\t\tif o == nil {\n\t\t\treturn nil, nil\n\t\t}\n\t\tb, err := json.Marshal(o)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn bytes.NewReader(b), nil\n\t}\n\tif len(enc) != 0 {\n\t\tserialize = enc[0]\n\t}\n\n\tbody, err := serialize(obj)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to encoding object\")\n\t}\n\n\tr, err := http.NewRequest(method, c.APIClient.BaseURL()+path, body)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to new http request\")\n\t}\n\treturn &Request{req: r, cli: c.APIClient.HTTPCli}, nil\n}", "title": "" }, { "docid": "f46ad8e8c831c33aa40f61a5239d855d", "score": "0.6119299", "text": "func (c *Client) newRequest(method string, endpoint string, body []byte) (*http.Request, error) {\n\n\tvar urlStr string\n\tif c.ApiVersion > 0 {\n\t\turlStr = c.ServerUrl + \"/api/v\" + strconv.Itoa(c.ApiVersion) + endpoint\n\t} else {\n\t\turlStr = c.ServerUrl + endpoint\n\t}\n\turl, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error during parsing request URL: %s\", err)\n\t}\n\n\tvar bodyReader io.Reader\n\tif body != nil {\n\t\tbodyReader = bytes.NewReader(body)\n\t}\n\n\treq, err := http.NewRequest(method, url.String(), bodyReader)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error during creation of request: %s\", err)\n\t}\n\n\treq.Header.Add(\"X-API-Key\", c.ApiKey)\n\treq.Header.Add(\"Accept\", \"application/json\")\n\n\tif method != \"GET\" {\n\t\treq.Header.Add(\"Content-Type\", \"application/json\")\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "ad942b63b0209a914ebb057e210c9541", "score": "0.6108571", "text": "func (c *Client) newRequest(method, path, query string, body io.Reader) (*http.Request, error) {\n\n\t// add Base URL and API key to path\n\trel := &url.URL{Path: path}\n\tu := c.BaseURL.ResolveReference(rel)\n\n\tq, _ := url.ParseQuery(query)\n\tq.Add(\"apiKey\", c.apiKey)\n\tu.RawQuery = q.Encode()\n\n\treq, err := http.NewRequest(method, u.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "109adebf4b5451fef6c6d7aa47dde169", "score": "0.61007607", "text": "func (c *Client) NewRequest(method string, requestURL string, params *Params) (*http.Request, error) {\n\treq, err := http.NewRequest(method, requestURL, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Accept\", acceptVersion)\n\treq.Header.Set(\"Accept-Encoding\", \"gzip\")\n\treq.Header.Add(\"Content-Type\", \"application/json; charset=utf-8\")\n\treq.Header.Add(\"User-Agent\", userAgent)\n\treq.SetBasicAuth(c.apiKey, \"\")\n\n\tif params != nil {\n\t\t// TODO: generate an idempotency key if missing?\n\t\tif params.IdempotencyKey != \"\" {\n\t\t\treq.Header.Add(\"Idempotency-Key\", params.IdempotencyKey)\n\t\t}\n\t\tfor key, v := range params.Header {\n\t\t\tfor _, value := range v {\n\t\t\t\treq.Header.Set(key, value)\n\t\t\t}\n\t\t}\n\n\t\tif params.Data != nil && method != http.MethodGet {\n\t\t\tdata, err := json.Marshal(params.Data)\n\t\t\tif err != nil {\n\t\t\t\tc.Log.Errorf(\"Failed to marshal data to JSON payload: %v\", err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treq.Body = ioutil.NopCloser(bytes.NewBuffer(data))\n\t\t\tif c.Log.IsLevel(LevelDebug) {\n\t\t\t\tfmt.Println(\"Request Body: \", req.Body)\n\t\t\t}\n\t\t}\n\n\t\tif params.Context != nil {\n\t\t\treq = req.WithContext(params.Context)\n\t\t}\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "6cf92b31bb05de9cfff78a03efa1b9d5", "score": "0.60958457", "text": "func newRequest(method, path string, body io.Reader) *http.Request {\n\treq, _ := http.NewRequest(method, APIUrl+path, body)\n\treturn req\n}", "title": "" }, { "docid": "c2059b947d8675a30b6f799d08844798", "score": "0.60932326", "text": "func (s *Client) NewRequest(method, path string, body interface{}) (*http.Request, error) {\n\tvar (\n\t\tctype string\n\t\trbody io.Reader\n\t)\n\n\tswitch t := body.(type) {\n\tcase nil:\n\tcase string:\n\t\trbody = bytes.NewBufferString(t)\n\tcase io.Reader:\n\t\trbody = t\n\tdefault:\n\t\tv := reflect.ValueOf(body)\n\t\tif !v.IsValid() {\n\t\t\tbreak\n\t\t}\n\t\tif v.Type().Kind() == reflect.Ptr {\n\t\t\tv = reflect.Indirect(v)\n\t\t\tif !v.IsValid() {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tj, err := json.Marshal(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\trbody = bytes.NewReader(j)\n\t\tctype = \"application/json\"\n\t}\n\n\treq, err := http.NewRequest(method, apiURL+path, rbody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Accept\", \"application/vnd.heroku+json; version=3.sni_ssl_cert\")\n\treq.Header.Set(\"User-Agent\", userAgent)\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", s.Token))\n\tif ctype != \"\" {\n\t\treq.Header.Set(\"Content-Type\", ctype)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "83b69c8ecc6ba2770d678f0f3f581849", "score": "0.60797423", "text": "func NewRequest(method string, path string, params interface{}) (*http.Request, error) {\n\tbaseURL, err := url.Parse(model.BaseURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu, _ := baseURL.Parse(path)\n\n\treq, err := http.NewRequest(method, u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Accept\", \"application/json\")\n\n\tq := req.URL.Query()\n\n\tq.Add(\"api_key\", model.APIKey)\n\tq.Add(\"format\", \"json\")\n\n\tp := ConvertToMap(params)\n\n\tfor key, value := range p {\n\t\tq.Add(key, value)\n\t}\n\n\treq.URL.RawQuery = q.Encode()\n\n\treturn req, nil\n}", "title": "" }, { "docid": "b59d6bafc5a41f0bb0fa1b4cab2339b7", "score": "0.6078753", "text": "func (c *Client) NewRequest(method string, uri string, body io.Reader) (*http.Request, error) {\n\tu, err := url.Parse(uri)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfu := c.BaseURL.ResolveReference(u).String()\n\treq, err := http.NewRequest(method, fu, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "0dba5f6e6712310bb1708acf76e5a592", "score": "0.6055648", "text": "func createRequest(apiurl string, requestBody interface{}, apimethod string) *http.Request {\n\n// encode the request body\n encodedJson, err := json.Marshal(&requestBody)\n\n if err != nil {\n fmt.Println(err)\n return nil\n }\n\n // create a new http request\n newRequest, e := http.NewRequest(apimethod, apiurl, bytes.NewBuffer(encodedJson))\n\n if e != nil {\n fmt.Println(e)\n return nil\n }\n\n return newRequest\n}", "title": "" }, { "docid": "8c74cfdb879f3e28305378201fa24237", "score": "0.6053818", "text": "func (t binary) NewRequest(urlString string, data interface{}, context SendContext) (*http.Request, error) {\n\turl, err := url.Parse(urlString)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\th, err := context.AsHeaders()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tb, err := marshalEventData(h.Get(\"Content-Type\"), data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &http.Request{\n\t\tMethod: http.MethodPost,\n\t\tURL: url,\n\t\tHeader: h,\n\t\tBody: ioutil.NopCloser(bytes.NewReader(b)),\n\t}, nil\n}", "title": "" }, { "docid": "2db3f3f13fed74121933093c175f1d96", "score": "0.6051036", "text": "func (c *Client) NewRequest(method string, path string, body io.Reader) (*http.Request, error) {\n\tu, err := url.Parse(c.BaseURL + path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.newRequest(method, u, body)\n}", "title": "" }, { "docid": "12a0b6c5c8f42ba5c921e8fb21fe468f", "score": "0.60461736", "text": "func (c *Client) NewRequest(method string, path string, body io.Reader) (*http.Request, error) {\n\turi, err := c.getUrl(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq, err := http.NewRequest(method, uri, body)\n\n\tif err == nil {\n\t\treq.Header.Add(\"Authorization\", fmt.Sprintf(\"Bearer %s\", c.Token))\n\t}\n\n\treturn req, err\n}", "title": "" }, { "docid": "26782c552d6c7f3a6c5cfffdfc851740", "score": "0.60418874", "text": "func (c *Client) newRequest(method, relativePath string, requestData interface{}) (*http.Request, error) {\n\tif !strings.HasSuffix(c.BaseURL.Path, \"/\") {\n\t\treturn nil, fmt.Errorf(\"BaseURL must have a trailing slash, but %q does not\", c.BaseURL)\n\t}\n\turl, err := c.BaseURL.Parse(relativePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif requestData != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tenc := json.NewEncoder(buf)\n\t\terr := enc.Encode(requestData)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\trequest, err := http.NewRequest(method, url.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif requestData != nil {\n\t\trequest.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\tif c.UserAgent != \"\" {\n\t\trequest.Header.Set(\"User-Agent\", c.UserAgent)\n\t}\n\treturn request, nil\n}", "title": "" }, { "docid": "d14cb5373d9f641fb88fa2f261d2dc85", "score": "0.59980905", "text": "func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error) {\n\treturn c.newRequest(method, c.baseAPIURL, path, body)\n}", "title": "" }, { "docid": "33160449e4bbd92e5ad10ee872bc2e6e", "score": "0.5982191", "text": "func NewRequest(method, URL string, body interface{}) (*retryablehttp.Request, error) {\n\treturn retryablehttp.NewRequest(method, URL, body)\n}", "title": "" }, { "docid": "d4678f683b6113395abd999a81d5e54e", "score": "0.5975505", "text": "func (c *Client) NewRawRequest(method, urlStr string, body io.Reader) (*http.Request, error) {\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := c.baseURL.ResolveReference(rel)\n\n\treq, err := http.NewRequest(method, u.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\t// Set authentication information\n\tif c.Authentication.authType == authTypeSession {\n\t\t// Set session cookie if there is one\n\t\tif c.session != nil {\n\t\t\tfor _, cookie := range c.session.Cookies {\n\t\t\t\treq.AddCookie(cookie)\n\t\t\t}\n\t\t}\n\t} else if c.Authentication.authType == authTypeBasic {\n\t\t// Set basic auth information\n\t\tif c.Authentication.username != \"\" {\n\t\t\treq.SetBasicAuth(c.Authentication.username, c.Authentication.password)\n\t\t}\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "e137672e9ed6588e530843d1172d1636", "score": "0.597218", "text": "func (c *Client) newRequest(ctx context.Context, method, path, contentType string, body io.Reader) (*http.Request, error) {\n\tif !strings.HasPrefix(path, \"/\") {\n\t\tpath = \"/\" + path\n\t}\n\tpath = prodAPIURL + path\n\n\treq, err := http.NewRequestWithContext(ctx, method, path, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif contentType != \"\" {\n\t\treq.Header.Add(\"Content-Type\", contentType)\n\t}\n\n\treq.Header.Add(\"Authorization\", \"Bearer \"+c.bearerToken)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "63a535aa5d1d12ddc124dd2f3bd6a13f", "score": "0.59524953", "text": "func (c *Client) NewRequest(method, path string, params *Params) (*http.Request, error) {\n\trel, err := url.Parse(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tendpoint := c.BaseURL.ResolveReference(rel)\n\n\tif params == nil {\n\t\tparams = &Params{\n\t\t\t\"circle-token\": c.token,\n\t\t}\n\t} else {\n\t\t(*params)[\"circle-token\"] = c.token\n\t}\n\n\tvalues := endpoint.Query()\n\tfor key, value := range *params {\n\t\tvalues.Set(key, value)\n\t}\n\n\tendpoint.RawQuery = values.Encode()\n\n\treq, err := http.NewRequest(method, endpoint.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Accept\", \"application/json\")\n\treq.Header.Add(\"User-Agent\", c.UserAgent)\n\treturn req, nil\n}", "title": "" }, { "docid": "d37818f529f9b075727e0ef38eb48ff0", "score": "0.59365827", "text": "func NewRequest(method, url string, headersIn map[string]string, obj interface{}) *request {\n\tr := &request{\n\t\tmethod: method,\n\t\turl: url,\n\t\tparams: make(map[string][]string),\n\t\theaders: headersIn,\n\t\tobj: obj,\n\t}\n\treturn r\n}", "title": "" }, { "docid": "1502ce60360fa58ea37a57ae668dae6f", "score": "0.59326166", "text": "func (c *Client) newRequest(method string, path string, body *gabs.Container) (*http.Request, error) {\n\n\trel, err := url.Parse(path)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Infof(\"\\nHTTP Body: %s \", body.String())\n\n\tu := c.BaseURL.ResolveReference(rel)\n\tbodyBytes := []byte(body.String())\n\n\tbuf := bytes.NewBuffer(bodyBytes)\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif buf != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "f81a81b6c5da95eef752e961a3d9aad9", "score": "0.59325993", "text": "func NewRequest(method, url string, body io.Reader) (*Request, error) {\n\treturn http.NewRequest(method, url, body)\n}", "title": "" }, { "docid": "eca9cbc50753263fde47c5df52ec9d92", "score": "0.59211314", "text": "func (w *Wit) CreateRequest(method, params string) (*http.Client, *http.Request, error) {\n\terr := w.SanityCheck()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(method, w.URL+params, nil)\n\treq.Header.Add(\"Authorization\", \"Bearer \"+w.Token)\n\treq.Header.Add(\"Accept\", \"application/vnd.wit.\"+w.Version+\"+json\")\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn client, req, nil\n}", "title": "" }, { "docid": "db11554ce96ce425885dcd3c3ab97050", "score": "0.5915912", "text": "func (a *API) NewRequest(endpoint string) (*http.Request, error) {\n\tend, err := url.Parse(endpoint)\n\tif err != nil {\n\t\treturn &http.Request{}, err\n\t}\n\turlStr := a.BaseURL.ResolveReference(end)\n\n\treq, err := http.NewRequest(\"GET\", urlStr.String(), nil)\n\tif err != nil {\n\t\t// Handle error\n\t\treturn req, err\n\t}\n\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Add(\"trn-api-key\", a.APIKey)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "006590c84d4f1b1fa5f70244e8d20e64", "score": "0.59037274", "text": "func NewRequest(method string, url string, body string) Request {\n\treq, err := http.NewRequest(method, url, strings.NewReader(body))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn Request{httpRequest: req}\n}", "title": "" }, { "docid": "dbf70f1a9d43aa6041226a5c0b1f3a72", "score": "0.5897667", "text": "func (couch CouchDB) newRequest(method string, path string, body io.Reader) (*http.Request, error) {\n url := couch.url() + path\n return http.NewRequest(method, url, body)\n}", "title": "" }, { "docid": "2aadd9d6748cde19562983b1b36f1ee8", "score": "0.58738816", "text": "func (c *Client) NewGetRequest(urlStr string) (*http.Request, error) {\n\treturn c.NewRequest(\"GET\", urlStr, nil)\n}", "title": "" }, { "docid": "3c035911b68cd8a9caffab8e3f1b272b", "score": "0.5871084", "text": "func (c *RestClient) newRequest(method string, refURL string, params url.Values, body []byte) (*http.Request, error) {\n\trel, err := url.Parse(refURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif params != nil {\n\t\trel.RawQuery = params.Encode()\n\t}\n\tvar req *http.Request\n\tu := c.BaseURL.ResolveReference(rel)\n\n\treq, err = http.NewRequest(method, u.String(), bytes.NewReader(body))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif addUserAgentHeader {\n\t\treq.Header.Add(\"User-Agent\", UserAgent)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "5215ee46df69d399a2389ce0ce1d47e3", "score": "0.5855559", "text": "func (c *Client) NewRequest(method, path string, body io.Reader) (*http.Request, error) {\n\treturn c.NewRequestWithContext(context.Background(), method, path, body)\n}", "title": "" }, { "docid": "dcc365c138daf526320ce49606176b7e", "score": "0.5846451", "text": "func (client *Client) NewRequest(method, url string, params url.Values) (req *xhttp.Request, err error) {\n\tif method == xhttp.MethodGet {\n\t\treq, err = xhttp.NewRequest(xhttp.MethodGet, fmt.Sprintf(\"%s?%s\", url, params.Encode()), nil)\n\t} else {\n\t\treq, err = xhttp.NewRequest(xhttp.MethodPost, url, strings.NewReader(params.Encode()))\n\t}\n\tif err != nil {\n\t\terr = pkgerr.Wrapf(err, \"method:%s,uri:%s\", method, url)\n\t\treturn\n\t}\n\tif method == xhttp.MethodPost {\n\t\treq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\t}\n\treq.Header.Set(\"User-Agent\", _userAgent+\" \"+env.AppName)\n\treturn\n}", "title": "" }, { "docid": "eba8da5cfba8f0c903cc9020d07fae42", "score": "0.5845493", "text": "func (c *Client) newRequest(method, path string, body interface{}) (*http.Request, error) {\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tif err := json.NewEncoder(buf).Encode(body); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, c.host+path, buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"User-Agent\", c.userAgent)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "a50c9de5c74a648a2793db06d15865fb", "score": "0.58387214", "text": "func NewRequest(apiToken, method, url string, formData *url.Values) *Request {\n return &Request{\n ApiToken: apiToken,\n FormData: formData,\n Method: method,\n Url: url,\n }\n}", "title": "" }, { "docid": "85a23e4e77194185ec013937583142a0", "score": "0.5805327", "text": "func (r *Client) newRequest(method string, url string, body io.Reader) (*http.Request, error) {\n\tif !strings.HasPrefix(url, \"http\") {\n\t\turl = r.APIPath + url\n\t}\n\n\ttoken, err := r.getToken(method, url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(method, url, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", token))\n\n\treturn req, nil\n}", "title": "" }, { "docid": "f320df71ef099dce385ffd845ff031f6", "score": "0.58026147", "text": "func (c *client) NewRequest(\n\tctx context.Context,\n\tendpoint config.Endpoint,\n\tmethod string,\n\trequrl string,\n\tdata ReqEncoder,\n) (*http.Request, error) {\n\tb, ok := c.backends[endpoint]\n\tif !ok {\n\t\treturn nil, errNoClient\n\t}\n\treturn b.NewRequest(ctx, endpoint, method, requrl, data)\n}", "title": "" }, { "docid": "3e40f9c3c2debcc3fb05becc3b7b3d82", "score": "0.5802367", "text": "func (c *Client) NewRequest(task string, payload interface{}) (*http.Request, error) {\n\n\t// var buf io.Reader\n\tvar b url.Values\n\tvar err error\n\tvar url string\n\n\tif payload != nil {\n\t\tb, err = form.EncodeToValues(payload)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// buf = bytes.NewBuffer()\n\t}\n\n\turl, err = c.GetAPIPath(task)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn http.NewRequest(\"POST\", url, strings.NewReader(b.Encode()))\n}", "title": "" }, { "docid": "23617b0b559451764ee93b08ca926a99", "score": "0.57722247", "text": "func (c *Client) NewRequest(method, path string, opt interface{}) (*http.Request, error) {\n\tu := *c.baseURL\n\tunescaped, err := url.PathUnescape(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tu.RawPath = u.Path + path\n\tu.Path = u.Path + unescaped\n\treq := &http.Request{\n\t\tMethod: method,\n\t\tURL: &u,\n\t\tProto: \"HTTP/1.1\",\n\t\tProtoMajor: 1,\n\t\tProtoMinor: 1,\n\t\tHeader: make(http.Header),\n\t\tHost: u.Host,\n\t}\n\n\tswitch method {\n\tcase \"POST\", \"PUT\":\n\t\tq, err := query.Values(opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tq.Set(\"login_token\", c.token)\n\t\tq.Set(\"format\", \"json\")\n\t\tbodyStr := q.Encode()\n\t\tbodyReader := strings.NewReader(bodyStr)\n\n\t\tu.RawQuery = \"\"\n\t\treq.Body = ioutil.NopCloser(bodyReader)\n\t\treq.ContentLength = int64(bodyReader.Len())\n\t\treq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "c0604febd7f49553dad5fa2d58586599", "score": "0.5750656", "text": "func (s *Simulator) CreateRequest(method, target string, body io.Reader) *http.Request {\n\treturn httptest.NewRequest(method, target, body)\n}", "title": "" }, { "docid": "0d993da8aed41ee9d6abe41b8b3a6656", "score": "0.5749363", "text": "func NewRequest(urlStr string) (*Request, error) {\n\t// create http request\n\treq, err := http.NewRequest(\"GET\", urlStr, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Request{\n\t\tHTTPRequest: req,\n\t}, nil\n}", "title": "" }, { "docid": "b02740d2a03fd5956bcc260545708a72", "score": "0.5748458", "text": "func (c *Cli) NewPostRequest(path string, obj interface{}, enc ...func(interface{}) (io.Reader, error)) (*Request, error) {\n\treturn c.NewRequest(http.MethodPost, path, obj, enc...)\n}", "title": "" }, { "docid": "e8fd09cfd6cfe4ada616e37c1d4c0380", "score": "0.57269436", "text": "func NewRequest(method, url string, body io.Reader) (*Request, error) {\n\trequest, err := http.NewRequest(method, url, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Request{request}, nil\n}", "title": "" }, { "docid": "e5bda2d9e967dc00294f5accf74c149f", "score": "0.57004476", "text": "func newReq(body string) *http.Request {\n\treturn httptest.NewRequest(http.MethodPost, \"/\", strings.NewReader(body))\n}", "title": "" }, { "docid": "eb9d83b4c833bccf12d4c488433e392c", "score": "0.56987303", "text": "func (c *Client) NewMultiPartRequest(ctx context.Context, method, urlStr string, body io.Reader, contentType string) (*http.Request, error) {\n\tif body == nil {\n\t\treturn nil, errors.New(\"httpx new multi part request error: expected not nil body\")\n\t}\n\tif !strings.HasPrefix(urlStr, \"/\") {\n\t\treturn nil, fmt.Errorf(\"httpx new multi part request error: url must have a preceding slash, but %q does not\", urlStr)\n\t}\n\tu, err := c.BaseURL.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"httpx new multi part request error: %w\", err)\n\t}\n\n\treq, err := http.NewRequestWithContext(ctx, method, u.String(), body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"httpx new multi part request error: %w\", err)\n\t}\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\treturn req, nil\n}", "title": "" }, { "docid": "cd62ef58349084274a7b93aad648c844", "score": "0.5678137", "text": "func (c *Client) NewAPIRequest(method string, uri string, body interface{}) (req *http.Request, err error) {\n\tif !strings.HasSuffix(c.BaseURL.Path, \"/\") {\n\t\treturn nil, ErrInvalidBaseURL\n\t}\n\n\tu, err := c.BaseURL.Parse(uri)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\tenc := json.NewEncoder(buf)\n\t\tenc.SetEscapeHTML(false)\n\t\terr := enc.Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err = http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(AuthHeader, strings.Join([]string{TokenType, c.token}, \" \"))\n\treq.Header.Set(\"Content-Type\", ContentExchangeType)\n\treq.Header.Set(\"Accept\", ContentExchangeType)\n\n\treturn\n}", "title": "" }, { "docid": "6ee45f2c92c04badec34c85e6d75fadc", "score": "0.5671527", "text": "func newRequest(t testing.TB, method, path string, body io.Reader) *http.Request {\n\treq, err := http.NewRequest(method, path, body)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn req\n}", "title": "" }, { "docid": "bc7ac57672ae323492abb8eeebd3bed0", "score": "0.5660654", "text": "func (c *Client) NewRequest(method, path string, opt interface{}, options []RequestOptionFunc) (*retryablehttp.Request, error) {\n\tu := *c.baseURL\n\tunescaped, err := url.PathUnescape(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Set the encoded path data\n\tu.RawPath = c.baseURL.Path + path\n\tu.Path = c.baseURL.Path + unescaped\n\n\t// Create a request specific headers map.\n\treqHeaders := make(http.Header)\n\treqHeaders.Set(\"Accept\", \"application/json\")\n\n\tif c.UserAgent != \"\" {\n\t\treqHeaders.Set(\"User-Agent\", c.UserAgent)\n\t}\n\n\tvar body interface{}\n\tswitch {\n\tcase method == http.MethodPatch || method == http.MethodPost || method == http.MethodPut:\n\t\treqHeaders.Set(\"Content-Type\", \"application/json\")\n\n\t\tif opt != nil {\n\t\t\tbody, err = json.Marshal(opt)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\tcase opt != nil:\n\t\tq, err := query.Values(opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tu.RawQuery = q.Encode()\n\t}\n\n\treq, err := retryablehttp.NewRequest(method, u.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, fn := range append(c.defaultRequestOptions, options...) {\n\t\tif fn == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif err := fn(req); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Set the request specific headers.\n\tfor k, v := range reqHeaders {\n\t\treq.Header[k] = v\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "7afe5d4088d62fe8faa08e19f8385c0c", "score": "0.56349266", "text": "func NewRequest(client *http.Client, method string, baseURL *url.URL, token string, basicAuth *BasicAuth, headers map[string]string) *Request {\n\treturn &Request{\n\t\tclient: client,\n\t\tmethod: method,\n\t\ttoken: token,\n\t\tbasicAuth: basicAuth,\n\t\theaders: headers,\n\t\tbaseURL: baseURL,\n\t\tapiPrefix: defaultAPIPrefix,\n\t\tapiVersion: defaultAPIVersion,\n\t}\n}", "title": "" } ]
316cf700e232edced5ed6537f00cd1a6
Verifies that two block headers provide proof of a consensus fault: both headers mined by the same actor headers are different first header is of the same or lower epoch as the second at least one of the headers appears in the current chain at or after epoch `earliest` the headers provide evidence of a fault (see the spec for the different fault types). The parameters are all serialized block headers. The third "extra" parameter is consulted only for the "parent grinding fault", in which case it must be the sibling of h1 (same parent tipset) and one of the blocks in the parent of h2 (i.e. h2's grandparent). Returns nil and an error if the headers don't prove a fault.
[ { "docid": "047698f574edbe50b31faa8d448602c3", "score": "0.4220337", "text": "func (s *Syscalls) VerifyConsensusFault(ctx context.Context, h1, h2, extra []byte, curEpoch abi.ChainEpoch, msg vm.VmMessage, gasIpld cbornode.IpldStore, view vm.SyscallsStateView, getter vmcontext.LookbackStateGetter) (*vmr.ConsensusFault, error) {\n\treturn s.faultChecker.VerifyConsensusFault(ctx, h1, h2, extra, curEpoch, msg, gasIpld, view, getter)\n}", "title": "" } ]
[ { "docid": "12b87454e63b58e9356d29d13da7694a", "score": "0.59951067", "text": "func (s *ConsensusFaultChecker) VerifyConsensusFault(ctx context.Context, h1, h2, extra []byte, curEpoch abi.ChainEpoch, msg vm.VmMessage, gasIpld cbornode.IpldStore, view vm.SyscallsStateView, getter vmcontext.LookbackStateGetter) (*runtime7.ConsensusFault, error) {\n\tif bytes.Equal(h1, h2) {\n\t\treturn nil, fmt.Errorf(\"no consensus fault: blocks identical\")\n\t}\n\n\tvar b1, b2, b3 types.BlockHeader\n\tinnerErr := b1.UnmarshalCBOR(bytes.NewReader(h1))\n\tif innerErr != nil {\n\t\treturn nil, errors.Wrapf(innerErr, \"failed to decode h1\")\n\t}\n\tnetworkVersion := s.fork.GetNetworkVersion(ctx, curEpoch)\n\n\t// A _valid_ block must use an ID address, but that's not what we're checking here. We're\n\t// just making sure that adding additional address protocols won't lead to consensus issues.\n\tif !abi.AddressValidForNetworkVersion(b1.Miner, networkVersion) {\n\t\treturn nil, fmt.Errorf(\"address protocol unsupported in current network version: %d\", b1.Miner.Protocol())\n\t}\n\n\tinnerErr = b2.UnmarshalCBOR(bytes.NewReader(h2))\n\tif innerErr != nil {\n\t\treturn nil, errors.Wrapf(innerErr, \"failed to decode h2\")\n\t}\n\tif !abi.AddressValidForNetworkVersion(b2.Miner, networkVersion) {\n\t\treturn nil, fmt.Errorf(\"address protocol unsupported in current network version: %d\", b2.Miner.Protocol())\n\t}\n\n\t// workaround chain halt\n\tforkUpgrade := s.fork.GetForkUpgrade()\n\tif config.IsNearUpgrade(b1.Height, forkUpgrade.UpgradeOrangeHeight) {\n\t\treturn nil, fmt.Errorf(\"consensus reporting disabled around Upgrade Orange\")\n\t}\n\tif config.IsNearUpgrade(b2.Height, forkUpgrade.UpgradeOrangeHeight) {\n\t\treturn nil, fmt.Errorf(\"consensus reporting disabled around Upgrade Orange\")\n\t}\n\n\t// BlockHeader syntax is not validated. This implements the strictest check possible, and is also the simplest check\n\t// possible.\n\t// This means that blocks that could never have been included in the chain (e.g. with an empty parent state)\n\t// are still fault-able.\n\n\tif b1.Miner != b2.Miner {\n\t\treturn nil, fmt.Errorf(\"no consensus fault: miners differ\")\n\t}\n\tif b1.Height > b2.Height {\n\t\treturn nil, fmt.Errorf(\"no consensus fault: first block is higher than second\")\n\t}\n\n\t// Check the basic fault conditions first, defer the (expensive) signature and chain history check until last.\n\tvar fault *runtime7.ConsensusFault\n\n\t// Double-fork mining fault: two blocks at the same epoch.\n\t// It is not necessary to present a common ancestor of the blocks.\n\tif b1.Height == b2.Height {\n\t\tfault = &runtime7.ConsensusFault{\n\t\t\tTarget: b1.Miner,\n\t\t\tEpoch: b2.Height,\n\t\t\tType: runtime7.ConsensusFaultDoubleForkMining,\n\t\t}\n\t}\n\t// Time-offset mining fault: two blocks with the same parent but different epochs.\n\t// The curEpoch check is redundant at time of writing, but included for robustness to future changes to this method.\n\t// The blocks have a common ancestor by definition (the parent).\n\tb1PKey := types.NewTipSetKey(b1.Parents...)\n\tb2PKey := types.NewTipSetKey(b2.Parents...)\n\tif b1PKey.Equals(b2PKey) && b1.Height != b2.Height {\n\t\tfault = &runtime7.ConsensusFault{\n\t\t\tTarget: b1.Miner,\n\t\t\tEpoch: b2.Height,\n\t\t\tType: runtime7.ConsensusFaultTimeOffsetMining,\n\t\t}\n\t}\n\t// Parent-grinding fault: one block’s parent is a tipset that provably should have included some block but does not.\n\t// The provable case is that two blocks are mined and the later one does not include the\n\t// earlier one as a parent even though it could have.\n\t// B3 must prove that the higher block (B2) could have been included in B1's tipset.\n\tif len(extra) > 0 {\n\t\tinnerErr = b3.UnmarshalCBOR(bytes.NewReader(extra))\n\t\tif innerErr != nil {\n\t\t\treturn nil, errors.Wrapf(innerErr, \"failed to decode extra\")\n\t\t}\n\t\tif !abi.AddressValidForNetworkVersion(b3.Miner, networkVersion) {\n\t\t\treturn nil, fmt.Errorf(\"address protocol unsupported in current network version: %d\", b3.Miner.Protocol())\n\t\t}\n\t\tb3PKey := types.NewTipSetKey(b3.Parents...)\n\t\tif b1.Height == b3.Height && b3PKey.Equals(b1PKey) && !b2PKey.Has(b1.Cid()) && b2PKey.Has(b3.Cid()) {\n\t\t\tfault = &runtime7.ConsensusFault{\n\t\t\t\tTarget: b1.Miner,\n\t\t\t\tEpoch: b2.Height,\n\t\t\t\tType: runtime7.ConsensusFaultParentGrinding,\n\t\t\t}\n\t\t}\n\t}\n\n\tif fault == nil {\n\t\treturn nil, fmt.Errorf(\"no consensus fault: blocks are ok\")\n\t}\n\n\t// Expensive validation: signatures.\n\tb1Version := s.fork.GetNetworkVersion(ctx, b1.Height)\n\terr := verifyBlockSignature(ctx, b1, b1Version, curEpoch, msg.To, gasIpld, view, getter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tb2Version := s.fork.GetNetworkVersion(ctx, b2.Height)\n\terr = verifyBlockSignature(ctx, b2, b2Version, curEpoch, msg.To, gasIpld, view, getter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn fault, nil\n}", "title": "" }, { "docid": "5a3912d5b485d4b9591fb8271f80caeb", "score": "0.5827211", "text": "func (beacon *Beacon) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*model.Header, seals []bool) (chan<- struct{}, <-chan error) {\n\tif !beacon.IsPoSHeader(headers[len(headers)-1]) {\n\t\treturn beacon.ethone.VerifyHeaders(chain, headers, seals)\n\t}\n\tvar (\n\t\tpreHeaders []*model.Header\n\t\tpostHeaders []*model.Header\n\t\tpreSeals []bool\n\t)\n\tfor index, header := range headers {\n\t\tif beacon.IsPoSHeader(header) {\n\t\t\tpreHeaders = headers[:index]\n\t\t\tpostHeaders = headers[index:]\n\t\t\tpreSeals = seals[:index]\n\t\t\tbreak\n\t\t}\n\t}\n\t// All the headers have passed the transition point, use new rules.\n\tif len(preHeaders) == 0 {\n\t\treturn beacon.verifyHeaders(chain, headers, nil)\n\t}\n\t// The transition point exists in the middle, separate the headers\n\t// into two batches and apply different verification rules for them.\n\tvar (\n\t\tabort = make(chan struct{})\n\t\tresults = make(chan error, len(headers))\n\t)\n\tgo func() {\n\t\tvar (\n\t\t\toldLen, newLen, out = 0, len(preHeaders), 0\n\t\t\terrorList = make([]error, len(headers))\n\t\t\tdone = make([]bool, len(headers))\n\t\t\toldDone, oldResult = beacon.ethone.VerifyHeaders(chain, preHeaders, preSeals)\n\t\t\tnewDone, newResult = beacon.verifyHeaders(chain, postHeaders, preHeaders[len(preHeaders)-1])\n\t\t)\n\t\tfor {\n\t\t\tfor ; done[out]; out++ {\n\t\t\t\tresults <- errorList[out]\n\t\t\t\tif out == len(headers)-1 {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tselect {\n\t\t\tcase err := <-oldResult:\n\t\t\t\terrorList[oldLen], done[oldLen] = err, true\n\t\t\t\toldLen++\n\t\t\tcase err := <-newResult:\n\t\t\t\terrorList[newLen], done[newLen] = err, true\n\t\t\t\tnewLen++\n\t\t\tcase <-abort:\n\t\t\t\tclose(oldDone)\n\t\t\t\tclose(newDone)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\treturn abort, results\n}", "title": "" }, { "docid": "7eb0e51cdebf1c0f47970448cb350ad5", "score": "0.56024796", "text": "func checkHeaderEqual(headerA, headerB wire.BlockHeader) error {\n\tif headerA.Version != headerB.Version {\n\t\treturn fmt.Errorf(\"block header Version mismatch: %v != %v\", headerA.Version, headerB.Version)\n\t}\n\n\tif !headerA.PrevBlock.IsEqual(&headerB.PrevBlock) {\n\t\treturn fmt.Errorf(\"block header PrevBlock mismatch: %v != %v\", headerA.PrevBlock, headerB.PrevBlock)\n\t}\n\n\tif !headerA.MerkleRoot.IsEqual(&headerB.MerkleRoot) {\n\t\treturn fmt.Errorf(\"block header MerkleRoot mismatch: %v != %v\", headerA.MerkleRoot, headerB.MerkleRoot)\n\t}\n\n\tif !headerA.Timestamp.Equal(headerB.Timestamp) {\n\t\treturn fmt.Errorf(\"block header Timestamp mismatch: %v != %v\", headerA.Timestamp, headerB.Timestamp)\n\t}\n\n\tif headerA.Bits != headerB.Bits {\n\t\treturn fmt.Errorf(\"block header Bits mismatch: %v != %v\", headerA.Bits, headerB.Bits)\n\t}\n\n\tif headerA.Nonce != headerB.Nonce {\n\t\treturn fmt.Errorf(\"block header Nonce mismatch: %v != %v\", headerA.Bits, headerB.Bits)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f20e49f9c36fd5165860d9b574701bae", "score": "0.5560266", "text": "func TestEqualForkHeaders(t *testing.T) {\n\tlength := 10\n\n\t// Make first chain starting from genesis\n\t_, processor, err := newCanonical(length)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to make new canonical chain: %v\", err)\n\t}\n\t// Define the difficulty comparator\n\tequal := func(td1, td2 *big.Int) {\n\t\tif td2.Cmp(td1) != 0 {\n\t\t\tt.Errorf(\"total difficulty mismatch: have %v, want %v\", td2, td1)\n\t\t}\n\t}\n\t// Sum of numbers must be equal to `length` for this to be an equal fork\n\ttestFork(t, processor, 0, 10, equal)\n\ttestFork(t, processor, 1, 9, equal)\n\ttestFork(t, processor, 2, 8, equal)\n\ttestFork(t, processor, 5, 5, equal)\n\ttestFork(t, processor, 6, 4, equal)\n\ttestFork(t, processor, 9, 1, equal)\n}", "title": "" }, { "docid": "86bd29d2e2fe005c918bedd28518d5fb", "score": "0.5537924", "text": "func TestLongerForkHeaders(t *testing.T) {\n\tlength := 10\n\n\t// Make first chain starting from genesis\n\t_, processor, err := newCanonical(length)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to make new canonical chain: %v\", err)\n\t}\n\t// Define the difficulty comparator\n\tbetter := func(td1, td2 *big.Int) {\n\t\tif td2.Cmp(td1) <= 0 {\n\t\t\tt.Errorf(\"total difficulty mismatch: have %v, expected more than %v\", td2, td1)\n\t\t}\n\t}\n\t// Sum of numbers must be greater than `length` for this to be a longer fork\n\ttestFork(t, processor, 0, 11, better)\n\ttestFork(t, processor, 0, 15, better)\n\ttestFork(t, processor, 1, 10, better)\n\ttestFork(t, processor, 1, 12, better)\n\ttestFork(t, processor, 5, 6, better)\n\ttestFork(t, processor, 5, 8, better)\n}", "title": "" }, { "docid": "8cb8cdb40bd3fe982453573684930c19", "score": "0.5498209", "text": "func (beacon *Beacon) verifyHeader(chain consensus.ChainHeaderReader, header, parent *model.Header) error {\n\t// Ensure that the header's extra-data section is of a reasonable size\n\tif len(header.Extra) > 32 {\n\t\treturn fmt.Errorf(\"extra-data longer than 32 bytes (%d)\", len(header.Extra))\n\t}\n\t// Verify the seal parts. Ensure the nonce and uncle hash are the expected value.\n\tif header.Nonce != beaconNonce {\n\t\treturn errInvalidNonce\n\t}\n\tif header.UncleHash != model.EmptyUncleHash {\n\t\treturn errInvalidUncleHash\n\t}\n\t// Verify the block's difficulty to ensure it's the default constant\n\tif beaconDifficulty.Cmp(header.Difficulty) != 0 {\n\t\treturn fmt.Errorf(\"invalid difficulty: have %v, want %v\", header.Difficulty, beaconDifficulty)\n\t}\n\t// Verify that the gas limit is <= 2^63-1\n\tif header.GasLimit > config.MaxGasLimit {\n\t\treturn fmt.Errorf(\"invalid gasLimit: have %v, max %v\", header.GasLimit, config.MaxGasLimit)\n\t}\n\t// Verify that the gasUsed is <= gasLimit\n\tif header.GasUsed > header.GasLimit {\n\t\treturn fmt.Errorf(\"invalid gasUsed: have %d, gasLimit %d\", header.GasUsed, header.GasLimit)\n\t}\n\t// Verify that the block number is parent's +1\n\tif diff := new(big.Int).Sub(header.Number, parent.Number); diff.Cmp(common.Big1) != 0 {\n\t\treturn consensus.ErrInvalidNumber\n\t}\n\t// Verify the header's EIP-1559 attributes.\n\treturn misc.VerifyEip1559Header(chain.Config(), parent, header)\n}", "title": "" }, { "docid": "79e8d28af16aff318b9947a1cd34cdd6", "score": "0.5389117", "text": "func TestExtendCanonicalHeaders(t *testing.T) {\n\tlength := 5\n\n\t// Make first chain starting from genesis\n\t_, processor, err := newCanonical(length)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to make new canonical chain: %v\", err)\n\t}\n\t// Define the difficulty comparator\n\tbetter := func(td1, td2 *big.Int) {\n\t\tif td2.Cmp(td1) <= 0 {\n\t\t\tt.Errorf(\"total difficulty mismatch: have %v, expected more than %v\", td2, td1)\n\t\t}\n\t}\n\t// Start fork from current height\n\ttestFork(t, processor, length, 1, better)\n\ttestFork(t, processor, length, 2, better)\n\ttestFork(t, processor, length, 5, better)\n\ttestFork(t, processor, length, 10, better)\n}", "title": "" }, { "docid": "86ee8f70f1496ba8cf244c439fe663c0", "score": "0.5341219", "text": "func ValidateDAOHeaderExtraData(config *configure.ChainConfig, header *types.Header) error {\n\t// Short circuit validation if the node doesn't care about the DAO fork\n\tif config.DAOForkBlock == nil {\n\t\treturn nil\n\t}\n\t// Make sure the block is within the fork's modified extra-data range\n\tlimit := new(big.Int).Add(config.DAOForkBlock, configure.DAOForkExtraRange)\n\tif header.Number.Cmp(config.DAOForkBlock) < 0 || header.Number.Cmp(limit) >= 0 {\n\t\treturn nil\n\t}\n\t// Depending whether we support or oppose the fork, validate the extra-data contents\n\tif config.DAOForkSupport {\n\t\tif bytes.Compare(header.Extra, configure.DAOForkBlockExtra) != 0 {\n\t\t\treturn ValidationError(\"DAO pro-fork bad block extra-data: 0x%x\", header.Extra)\n\t\t}\n\t} else {\n\t\tif bytes.Compare(header.Extra, configure.DAOForkBlockExtra) == 0 {\n\t\t\treturn ValidationError(\"DAO no-fork bad block extra-data: 0x%x\", header.Extra)\n\t\t}\n\t}\n\t// All ok, header has the same extra-data we expect\n\treturn nil\n}", "title": "" }, { "docid": "e6be6ec3979ce126c1370178a99d2766", "score": "0.53412044", "text": "func checkBlockHeaderSanity(header *wire.BlockHeader, timeSource MedianTimeSource, flags BehaviorFlags, chainParams *chaincfg.Params) error {\n\t// Ensure the proof of work bits in the block header is in min/max\n\t// range and the block hash is less than the target value described by\n\t// the bits.\n\terr := checkProofOfWork(header, chainParams.PowLimit, flags)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// A block timestamp must not have a greater precision than one second.\n\t// This check is necessary because Go time.Time values support\n\t// nanosecond precision whereas the consensus rules only apply to\n\t// seconds and it's much nicer to deal with standard Go time values\n\t// instead of converting to seconds everywhere.\n\tif !header.Timestamp.Equal(time.Unix(header.Timestamp.Unix(), 0)) {\n\t\tstr := fmt.Sprintf(\"block timestamp of %v has a higher \"+\n\t\t\t\"precision than one second\", header.Timestamp)\n\t\treturn ruleError(ErrInvalidTime, str)\n\t}\n\n\t// Ensure the block time is not too far in the future.\n\tmaxTimestamp := timeSource.AdjustedTime().Add(time.Second *\n\t\tMaxTimeOffsetSeconds)\n\tif header.Timestamp.After(maxTimestamp) {\n\t\tstr := fmt.Sprintf(\"block timestamp of %v is too far in the \"+\n\t\t\t\"future\", header.Timestamp)\n\t\treturn ruleError(ErrTimeTooNew, str)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1123a9f5c6e712617ecc3210701b7088", "score": "0.5336697", "text": "func TestBlockHeader(t *testing.T) {\n\tnonce := uint64(0xba4d87a69924a93d)\n\n\tparents := []externalapi.BlockLevelParents{[]*externalapi.DomainHash{mainnetGenesisHash, simnetGenesisHash}}\n\n\tmerkleHash := mainnetGenesisMerkleRoot\n\tacceptedIDMerkleRoot := exampleAcceptedIDMerkleRoot\n\tbits := uint32(0x1d00ffff)\n\tdaaScore := uint64(123)\n\tblueScore := uint64(456)\n\tblueWork := big.NewInt(789)\n\tpruningPoint := simnetGenesisHash\n\tbh := NewBlockHeader(1, parents, merkleHash, acceptedIDMerkleRoot, exampleUTXOCommitment, bits, nonce,\n\t\tdaaScore, blueScore, blueWork, pruningPoint)\n\n\t// Ensure we get the same data back out.\n\tif !reflect.DeepEqual(bh.Parents, parents) {\n\t\tt.Errorf(\"NewBlockHeader: wrong parents - got %v, want %v\",\n\t\t\tspew.Sprint(bh.Parents), spew.Sprint(parents))\n\t}\n\tif bh.HashMerkleRoot != merkleHash {\n\t\tt.Errorf(\"NewBlockHeader: wrong merkle root - got %v, want %v\",\n\t\t\tspew.Sprint(bh.HashMerkleRoot), spew.Sprint(merkleHash))\n\t}\n\tif bh.Bits != bits {\n\t\tt.Errorf(\"NewBlockHeader: wrong bits - got %v, want %v\",\n\t\t\tbh.Bits, bits)\n\t}\n\tif bh.Nonce != nonce {\n\t\tt.Errorf(\"NewBlockHeader: wrong nonce - got %v, want %v\",\n\t\t\tbh.Nonce, nonce)\n\t}\n\tif bh.DAAScore != daaScore {\n\t\tt.Errorf(\"NewBlockHeader: wrong daaScore - got %v, want %v\",\n\t\t\tbh.DAAScore, daaScore)\n\t}\n\tif bh.BlueScore != blueScore {\n\t\tt.Errorf(\"NewBlockHeader: wrong blueScore - got %v, want %v\",\n\t\t\tbh.BlueScore, blueScore)\n\t}\n\tif bh.BlueWork != blueWork {\n\t\tt.Errorf(\"NewBlockHeader: wrong blueWork - got %v, want %v\",\n\t\t\tbh.BlueWork, blueWork)\n\t}\n\tif !bh.PruningPoint.Equal(pruningPoint) {\n\t\tt.Errorf(\"NewBlockHeader: wrong pruningPoint - got %v, want %v\",\n\t\t\tbh.PruningPoint, pruningPoint)\n\t}\n}", "title": "" }, { "docid": "49fc949ec4067f1c2f5f8b846462983d", "score": "0.5198121", "text": "func patchHeader(h *etcdserverpb.ResponseHeader, update etcdserverpb.ResponseHeader, allowSameRevision bool) error {\n\tif h.ClusterId != 0 && h.ClusterId != update.ClusterId {\n\t\treturn fmt.Errorf(\"etcd ClusterID mismatch (expected %d, got %d)\", h.ClusterId, update.ClusterId)\n\t} else if allowSameRevision && update.Revision < h.Revision {\n\t\treturn fmt.Errorf(\"etcd Revision mismatch (expected >= %d, got %d)\", h.Revision, update.Revision)\n\t} else if !allowSameRevision && update.Revision <= h.Revision {\n\t\treturn fmt.Errorf(\"etcd Revision mismatch (expected > %d, got %d)\", h.Revision, update.Revision)\n\t}\n\n\tif h.ClusterId != 0 && (h.MemberId != update.MemberId || h.RaftTerm != update.RaftTerm) {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"memberId\": h.MemberId,\n\t\t\t\"raftTerm\": h.RaftTerm,\n\t\t\t\"update.MemberId\": update.MemberId,\n\t\t\t\"update.RaftTerm\": update.RaftTerm,\n\t\t}).Info(\"etcd MemberId/RaftTerm changed\")\n\t}\n\n\t*h = update\n\treturn nil\n}", "title": "" }, { "docid": "ea767604ca5d3f140c9a52b9d2f843f6", "score": "0.5188713", "text": "func ExtractHeader(block []byte, checkHeight uint64) (*Header, blockdigest.Digest, []byte, error) {\n\tif len(block) < totalBlockSize {\n\t\treturn nil, blockdigest.Digest{}, nil, fault.ErrInvalidBlockHeaderSize\n\t}\n\tpackedHeader := PackedHeader{}\n\tcopy(packedHeader[:], block[:totalBlockSize])\n\n\theader, err := packedHeader.Unpack()\n\tif nil != err {\n\t\treturn nil, blockdigest.Digest{}, nil, err\n\t}\n\n\tif checkHeight > 0 && header.Number != checkHeight {\n\t\treturn nil, blockdigest.Digest{}, nil, fault.ErrHeightOutOfSequence\n\t}\n\n\tvar digest blockdigest.Digest\n\tif storage.Pool.BlockHeaderHash != nil {\n\t\tthisBlockNumberKey := make([]byte, 8)\n\t\tbinary.BigEndian.PutUint64(thisBlockNumberKey, header.Number)\n\t\tdigestBytes := storage.Pool.BlockHeaderHash.Get(thisBlockNumberKey)\n\t\tif err := blockdigest.DigestFromBytes(&digest, digestBytes); err != nil {\n\t\t\tdigest = blockdigest.NewDigest(packedHeader[:])\n\t\t}\n\t} else {\n\t\tdigest = blockdigest.NewDigest(packedHeader[:])\n\t}\n\n\tblockDifficulty := header.Difficulty.BigInt()\n\tcurrentDifficulty := difficulty.Current.BigInt()\n\n\tn := big.NewInt(10) // range ± N%\n\tl := big.NewInt(0)\n\th := big.NewInt(0)\n\th.Quo(currentDifficulty, n)\n\tl.Sub(currentDifficulty, h) // current - N%\n\th.Add(currentDifficulty, h) // current + N%\n\n\tif blockDifficulty.Cmp(l) < 0 || blockDifficulty.Cmp(h) > 0 || digest.Cmp(blockDifficulty) > 0 {\n\t\treturn nil, blockdigest.Digest{}, nil, fault.ErrInvalidBlockHeaderDifficulty\n\t}\n\n\treturn header, digest, block[totalBlockSize:], nil\n\n}", "title": "" }, { "docid": "3ee51c35d0bbb21ecbb2d2eb703d27b1", "score": "0.50684345", "text": "func (b *BlockChain) checkBlockHeaderPositional(header *wire.BlockHeader, prevNode *blockNode, flags BehaviorFlags) error {\n\t// The genesis block is valid by definition.\n\tif prevNode == nil {\n\t\treturn nil\n\t}\n\n\tfastAdd := flags&BFFastAdd == BFFastAdd\n\tif !fastAdd {\n\t\t// Ensure the difficulty specified in the block header matches\n\t\t// the calculated difficulty based on the previous block and\n\t\t// difficulty retarget rules.\n\t\texpDiff, err := b.calcNextRequiredDifficulty(prevNode,\n\t\t\theader.Timestamp)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tblockDifficulty := header.Bits\n\t\tif blockDifficulty != expDiff {\n\t\t\tstr := fmt.Sprintf(\"block difficulty of %d is not the\"+\n\t\t\t\t\" expected value of %d\", blockDifficulty,\n\t\t\t\texpDiff)\n\t\t\treturn ruleError(ErrUnexpectedDifficulty, str)\n\t\t}\n\n\t\t// Ensure the timestamp for the block header is after the\n\t\t// median time of the last several blocks (medianTimeBlocks).\n\t\tmedianTime := prevNode.CalcPastMedianTime()\n\t\tif !header.Timestamp.After(medianTime) {\n\t\t\tstr := \"block timestamp of %v is not after expected %v\"\n\t\t\tstr = fmt.Sprintf(str, header.Timestamp, medianTime)\n\t\t\treturn ruleError(ErrTimeTooOld, str)\n\t\t}\n\t}\n\n\t// The height of this block is one more than the referenced previous\n\t// block.\n\tblockHeight := prevNode.height + 1\n\n\t// Ensure chain matches up to predetermined checkpoints.\n\tblockHash := header.BlockHash()\n\tif !b.verifyCheckpoint(blockHeight, &blockHash) {\n\t\tstr := fmt.Sprintf(\"block at height %d does not match \"+\n\t\t\t\"checkpoint hash\", blockHeight)\n\t\treturn ruleError(ErrBadCheckpoint, str)\n\t}\n\n\t// Find the previous checkpoint and prevent blocks which fork the main\n\t// chain before it. This prevents storage of new, otherwise valid,\n\t// blocks which build off of old blocks that are likely at a much easier\n\t// difficulty and therefore could be used to waste cache and disk space.\n\tcheckpointNode, err := b.findPreviousCheckpoint()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif checkpointNode != nil && blockHeight < checkpointNode.height {\n\t\tstr := fmt.Sprintf(\"block at height %d forks the main chain \"+\n\t\t\t\"before the previous checkpoint at height %d\",\n\t\t\tblockHeight, checkpointNode.height)\n\t\treturn ruleError(ErrForkTooOld, str)\n\t}\n\n\tif !fastAdd {\n\t\t// Reject version 5 blocks for networks other than the main\n\t\t// network once a majority of the network has upgraded.\n\t\tif b.chainParams.Net != wire.MainNet && header.Version < 6 &&\n\t\t\tb.isMajorityVersion(6, prevNode, b.chainParams.BlockRejectNumRequired) {\n\n\t\t\tstr := \"new blocks with version %d are no longer valid\"\n\t\t\tstr = fmt.Sprintf(str, header.Version)\n\t\t\treturn ruleError(ErrBlockVersionTooOld, str)\n\t\t}\n\n\t\t// Reject version 4 blocks once a majority of the network has\n\t\t// upgraded.\n\t\tif header.Version < 5 && b.isMajorityVersion(5, prevNode,\n\t\t\tb.chainParams.BlockRejectNumRequired) {\n\n\t\t\tstr := \"new blocks with version %d are no longer valid\"\n\t\t\tstr = fmt.Sprintf(str, header.Version)\n\t\t\treturn ruleError(ErrBlockVersionTooOld, str)\n\t\t}\n\n\t\t// Reject version 3 blocks once a majority of the network has\n\t\t// upgraded.\n\t\tif header.Version < 4 && b.isMajorityVersion(4, prevNode,\n\t\t\tb.chainParams.BlockRejectNumRequired) {\n\n\t\t\tstr := \"new blocks with version %d are no longer valid\"\n\t\t\tstr = fmt.Sprintf(str, header.Version)\n\t\t\treturn ruleError(ErrBlockVersionTooOld, str)\n\t\t}\n\n\t\t// Reject version 2 blocks once a majority of the network has\n\t\t// upgraded.\n\t\tif header.Version < 3 && b.isMajorityVersion(3, prevNode,\n\t\t\tb.chainParams.BlockRejectNumRequired) {\n\n\t\t\tstr := \"new blocks with version %d are no longer valid\"\n\t\t\tstr = fmt.Sprintf(str, header.Version)\n\t\t\treturn ruleError(ErrBlockVersionTooOld, str)\n\t\t}\n\n\t\t// Reject version 1 blocks once a majority of the network has\n\t\t// upgraded.\n\t\tif header.Version < 2 && b.isMajorityVersion(2, prevNode,\n\t\t\tb.chainParams.BlockRejectNumRequired) {\n\n\t\t\tstr := \"new blocks with version %d are no longer valid\"\n\t\t\tstr = fmt.Sprintf(str, header.Version)\n\t\t\treturn ruleError(ErrBlockVersionTooOld, str)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bb7498f3f447bfd8812a50660ce8ada9", "score": "0.5056149", "text": "func (beacon *Beacon) verifyHeaders(chain consensus.ChainHeaderReader, headers []*model.Header, ancestor *model.Header) (chan<- struct{}, <-chan error) {\n\tvar (\n\t\tabort = make(chan struct{})\n\t\tresults = make(chan error, len(headers))\n\t)\n\tgo func() {\n\t\tfor i, header := range headers {\n\t\t\tvar parent *model.Header\n\t\t\tif i == 0 {\n\t\t\t\tif ancestor != nil {\n\t\t\t\t\tparent = ancestor\n\t\t\t\t} else {\n\t\t\t\t\tparent = chain.GetHeader(headers[0].ParentHash, headers[0].Number.Uint64()-1)\n\t\t\t\t}\n\t\t\t} else if headers[i-1].Hash() == headers[i].ParentHash {\n\t\t\t\tparent = headers[i-1]\n\t\t\t}\n\t\t\tif parent == nil {\n\t\t\t\tselect {\n\t\t\t\tcase <-abort:\n\t\t\t\t\treturn\n\t\t\t\tcase results <- consensus.ErrUnknownAncestor:\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terr := beacon.verifyHeader(chain, header, parent)\n\t\t\tselect {\n\t\t\tcase <-abort:\n\t\t\t\treturn\n\t\t\tcase results <- err:\n\t\t\t}\n\t\t}\n\t}()\n\treturn abort, results\n}", "title": "" }, { "docid": "f265e2f183d606ad31aac0e9eafd2aa9", "score": "0.50445366", "text": "func check_header() {\n\turl := \"http://localhost:8732/chains/main/blocks/head/header\"\n\tdata_dir := \"/home/tezos/.tezos-node\"\n\tlast_block := data_dir + \"/last_block\"\n\tresync := data_dir + \"/resync\"\n\tbody := getBody(url)\n\n\t// Parse the JSON\n\tvar header Header\n\terr := json.Unmarshal(body, &header)\n\tcheckError(err)\n\n\t// Get last block\n\tdata, err := ioutil.ReadFile(last_block)\n\tif err == nil {\n\t\tif string(data) == strconv.Itoa(header.Level) {\n\t\t\t// Don't overwrite file in case it has been acknowledged\n\t\t\t_, err := os.Stat(resync)\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\terr = ioutil.WriteFile(resync, []byte(\"\"), 0644)\n\t\t\t\tcheckError(err)\n\t\t\t}\n\t\t\tlog.Fatal(\"Block level has not changed!\")\n\t\t} else {\n\t\t\tos.Remove(resync)\n\t\t}\n\t}\n\n\t// Write last block state\n\terr = ioutil.WriteFile(last_block, []byte(strconv.Itoa(header.Level)), 0644)\n\tcheckError(err)\n\tfmt.Println(\"Current block level is now\", header.Level)\n}", "title": "" }, { "docid": "44bf6cb724052405911846ae265c87d6", "score": "0.5041394", "text": "func TestShorterForkHeaders(t *testing.T) {\n\tlength := 10\n\n\t// Make first chain starting from genesis\n\t_, processor, err := newCanonical(length)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to make new canonical chain: %v\", err)\n\t}\n\t// Define the difficulty comparator\n\tworse := func(td1, td2 *big.Int) {\n\t\tif td2.Cmp(td1) >= 0 {\n\t\t\tt.Errorf(\"total difficulty mismatch: have %v, expected less than %v\", td2, td1)\n\t\t}\n\t}\n\t// Sum of numbers must be less than `length` for this to be a shorter fork\n\ttestFork(t, processor, 0, 3, worse)\n\ttestFork(t, processor, 0, 7, worse)\n\ttestFork(t, processor, 1, 1, worse)\n\ttestFork(t, processor, 1, 7, worse)\n\ttestFork(t, processor, 5, 3, worse)\n\ttestFork(t, processor, 5, 4, worse)\n}", "title": "" }, { "docid": "b132ad1a5c9a94593bc0f750fe249d75", "score": "0.5012422", "text": "func checkParentSubHeaderEqual(parentsA, parentsB wire.ParentSubHeader) error {\n\tif parentsA.Version != parentsB.Version {\n\t\treturn fmt.Errorf(\"block parent sub-header Version mismatch: %v != %v\", parentsA.Version, parentsB.Version)\n\t}\n\n\tif parentsA.Size != parentsB.Size {\n\t\treturn fmt.Errorf(\"block parent sub-header Size (claimed number of parents) mismatch: %v != %v\", parentsA.Size, parentsB.Size)\n\t}\n\n\tif len(parentsA.Parents) != len(parentsB.Parents) {\n\t\treturn fmt.Errorf(\"block parent sub-header actual number of parents mismatch: %v != %v\", len(parentsA.Parents), len(parentsB.Parents))\n\t}\n\n\t// Index parents, to assist with finding missing parents and in comparing them\n\tparentIndexA := make(map[string]int)\n\tparentIndexB := make(map[string]int)\n\n\tfor i, hash := range parentsA.ParentHashes() {\n\t\tparentIndexA[hash.String()] = i\n\t}\n\n\tfor i, hash := range parentsB.ParentHashes() {\n\t\tparentIndexB[hash.String()] = i\n\t}\n\n\t// Examine parents\n\tfor hash, indexA := range parentIndexA {\n\t\t// Check for missing parent\n\t\tindexB, ok := parentIndexB[hash]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"block parent sub-header B missing A parent: %v\", hash)\n\t\t}\n\n\t\t// Confirm parents are identical\n\t\terr := assertParentIdentical(parentsA.Parents[indexA], parentsB.Parents[indexB])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tfor hash, _ := range parentIndexB {\n\t\t// We've already checked if parents are identical, so we just need to see if parentsB\n\t\t// has parents that parentsA does not.\n\t\t//\n\t\t// (I think we would only hit this case if the Size field of the parent sub-header didn't match\n\t\t// the length of the Parents array)\n\t\t_, ok := parentIndexA[hash]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"block parent sub-header A missing B parent: %v\", hash)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "de3b3b892591658def366546bf25de40", "score": "0.4890684", "text": "func checkCorrupt(file *os.File) (*header, error) {\n\tlength, err := fileLength(file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif length == 0 {\n\t\treturn nil, err\n\t}\n\t_, err = file.Seek(0, io.SeekStart)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader := &header{}\n\tcurrentOffset := int64(0)\n\tversion, err := ReadInt(file, currentOffset)\n\tcurrentOffset += 4\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif version != MagicVersionNumber {\n\t\treturn nil, CorruptVersionError\n\t}\n\theader.version = version\n\t// TODO(chermehdi): Use the flags\n\tflags, err := ReadInt(file, currentOffset)\n\tcurrentOffset += 4\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader.flags = flags\n\n\telementCount, err := ReadLong(file, currentOffset)\n\tcurrentOffset += 8\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader.elementCount = elementCount\n\n\theadOffset, err := ReadLong(file, currentOffset)\n\tcurrentOffset += 8\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttailOffset, err := ReadLong(file, currentOffset)\n\tcurrentOffset += 8\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader.head = &elementPtr{\n\t\toffset: headOffset,\n\t\tlength: 0,\n\t}\n\theader.tail = &elementPtr{\n\t\toffset: tailOffset,\n\t\tlength: 0,\n\t}\n\theadLength, err := ReadLong(file, headOffset)\n\tif err == nil {\n\t\theader.head.length = headLength\n\t}\n\ttailLength, err := ReadLong(file, tailOffset)\n\tif err == nil {\n\t\theader.tail.length = tailLength\n\t}\n\treturn header, nil\n}", "title": "" }, { "docid": "06cbcc1d4429b39880969f74eefc6be6", "score": "0.48426273", "text": "func TestBlockHeader(t *testing.T) {\n\tvar testRound = 100\n\n\tfor i := 0; i < testRound; i++ {\n\t\theader := mockHeader()\n\t\tbuf, err := proto.Marshal(header)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t\tt.FailNow()\n\t\t}\n\n\t\tnewHeader := new(BlockHeader)\n\t\terr = proto.Unmarshal(buf, newHeader)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t\tt.FailNow()\n\t\t}\n\n\t\t// compare header and newHeader\n\t\tif !proto.Equal(header, newHeader) {\n\t\t\tt.Error(\"header and newHeader is not equal\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "dfeb98bab342831f9ee6c5c75271c996", "score": "0.48053774", "text": "func TestInvalidHeaderRollback66Snap(t *testing.T) { testInvalidHeaderRollback(t, ent.ETH66, SnapSync) }", "title": "" }, { "docid": "4a15468a3a4f8c27af019cfb4c2e5bf7", "score": "0.47960225", "text": "func TestEqualHeader(t *testing.T) {\n\tInstallGPT()\n\tr := bytes.NewReader(disk)\n\tp, err := New(r)\n\tif err != nil {\n\t\tt.Fatalf(\"TestEqualHeader: Reading in gpt: got %v, want nil\", err)\n\t}\n\n\tif err := EqualHeader(p.Primary.Header, p.Backup.Header); err != nil {\n\t\tt.Fatalf(\"TestEqualHeader: got %v, want nil\", err)\n\t}\n\t// Yes, we assume a certain order, but it sure simplifies the test :-)\n\tp.Primary.Signature++\n\tp.Primary.Revision++\n\tp.Primary.HeaderSize++\n\tp.Primary.CurrentLBA++\n\tp.Primary.FirstLBA++\n\tp.Primary.LastLBA++\n\tp.Primary.DiskGUID.B[0]++\n\tp.Primary.NPart--\n\tp.Primary.PartSize--\n\tp.Primary.PartCRC++\n\tif err = EqualHeader(p.Primary.Header, p.Backup.Header); err == nil {\n\t\tt.Fatalf(\"TestEqualHeader: got %v, want nil\", err)\n\t}\n\tt.Logf(\"TestEqualHeader: EqualHeader returns %v\", err)\n\n\tif err.Error() != equalHeaderError {\n\t\tt.Fatalf(\"TestEqualHeader: got %v, want %v\", err.Error(), equalHeaderError)\n\t}\n}", "title": "" }, { "docid": "265915b814f8c421b31f4c7360f95931", "score": "0.4795874", "text": "func TestReorgBadHeaderHashes(t *testing.T) {\n\tbc := newTestLightChain()\n\n\t// Create a chain, import and ban afterwards\n\theaders := makeHeaderChainWithDiff(bc.genesisBlock, []int{1, 2, 3, 4}, 10)\n\n\tif _, err := bc.InsertHeaderChain(headers, 1); err != nil {\n\t\tt.Fatalf(\"failed to import headers: %v\", err)\n\t}\n\tif bc.CurrentHeader().Hash() != headers[3].Hash() {\n\t\tt.Errorf(\"last header hash mismatch: have: %x, want %x\", bc.CurrentHeader().Hash(), headers[3].Hash())\n\t}\n\tcore.BadHashes[headers[3].Hash()] = true\n\tdefer func() { delete(core.BadHashes, headers[3].Hash()) }()\n\n\t// Create a new LightChain and check that it rolled back the state.\n\tncm, err := NewLightChain(&dummyOdr{db: bc.chainDb}, params.TestChainConfig, ethash.NewFaker(), nil)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to create new chain manager: %v\", err)\n\t}\n\tif ncm.CurrentHeader().Hash() != headers[2].Hash() {\n\t\tt.Errorf(\"last header hash mismatch: have: %x, want %x\", ncm.CurrentHeader().Hash(), headers[2].Hash())\n\t}\n}", "title": "" }, { "docid": "e136301a6a7dc2cf16e751758ea3c0f5", "score": "0.4794163", "text": "func SanityCheckBlocks(blocks map[common.Namespace]*block.Block) error {\n\tfor _, blk := range blocks {\n\t\thdr := blk.Header\n\n\t\tif hdr.Timestamp > uint64(time.Now().Unix()+61*60) {\n\t\t\treturn fmt.Errorf(\"roothash: sanity check failed: block header timestamp is more than 1h1m in the future\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f802fecd79bdbdb2b720f287fbee34c4", "score": "0.47658157", "text": "func (b *BlockHeader) Validate() error {\n\tlogrus.Info(\"block header validate\")\n\n\n\t// refuse blocks more than 12 blocks intervals in future (as in bitcoin)\n\t// 拒绝超过12个区块间隔的区块(将验证时时间戳与区块时间戳作差,若差值超过12个区块的时间则拒绝检查。每个区块的出块时间被设定为60s)\n\tif b.Timestamp.Sub(time.Now().UTC()) > time.Second*12*BlockTimeSec {\n\t\treturn fmt.Errorf(\"invalid block time (%s)\", b.Timestamp)\n\t}\n\n\t// TODO: Check difficulty.\n\n\t// Check POW\n\tisPrimaryPow := b.POW.EdgeBits != SecondPowEdgeBits\n\n\t// Either the size shift must be a valid primary POW (greater than the\n\t// minimum size shift) or equal to the secondary POW size shift.\n\tif b.POW.EdgeBits < DefaultMinEdgeBits && isPrimaryPow {\n\t\treturn fmt.Errorf(\"cuckoo size too small: %d\", b.POW.EdgeBits)\n\t}\n\n\tif err := b.POW.Validate(b, b.POW.EdgeBits); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "168c07cbd32c73ab754210915be7150c", "score": "0.47609103", "text": "func (d *Downloader) fetchBeaconHeaders(from uint64) error {\n\thead, tail, err := d.skeleton.Bounds()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// A part of headers are not in the skeleton space, try to resolve\n\t// them from the local chain. Note the range should be very short\n\t// and it should only happen when there are less than 64 post-merge\n\t// blocks in the network.\n\tvar localHeaders []*model.Header\n\tif from < tail.Number.Uint64() {\n\t\tcount := tail.Number.Uint64() - from\n\t\tif count > uint64(fsMinFullBlocks) {\n\t\t\treturn fmt.Errorf(\"invalid origin (%d) of beacon sync (%d)\", from, tail.Number)\n\t\t}\n\t\tlocalHeaders = d.readHeaderRange(tail, int(count))\n\t\tlog.Warning(\"Retrieved beacon headers from local\", \"from\", from, \"count\", count)\n\t}\n\tfor {\n\t\t// Retrieve a batch of headers and feed it to the header processor\n\t\tvar (\n\t\t\theaders = make([]*model.Header, 0, maxHeadersProcess)\n\t\t\thashes = make([]common.Hash, 0, maxHeadersProcess)\n\t\t)\n\t\tfor i := 0; i < maxHeadersProcess && from <= head.Number.Uint64(); i++ {\n\t\t\theader := d.skeleton.Header(from)\n\n\t\t\t// The header is not found in skeleton space, try to find it in local chain.\n\t\t\tif header == nil && from < tail.Number.Uint64() {\n\t\t\t\tdist := tail.Number.Uint64() - from\n\t\t\t\tif len(localHeaders) >= int(dist) {\n\t\t\t\t\theader = localHeaders[dist-1]\n\t\t\t\t}\n\t\t\t}\n\t\t\t// The header is still missing, the beacon sync is corrupted and bail out\n\t\t\t// the error here.\n\t\t\tif header == nil {\n\t\t\t\treturn fmt.Errorf(\"missing beacon header %d\", from)\n\t\t\t}\n\t\t\theaders = append(headers, header)\n\t\t\thashes = append(hashes, headers[i].Hash())\n\t\t\tfrom++\n\t\t}\n\t\tif len(headers) > 0 {\n\t\t\tlog.Debug(\"Scheduling new beacon headers\", \"count\", len(headers), \"from\", from-uint64(len(headers)))\n\t\t\tselect {\n\t\t\tcase d.headerProcCh <- &headerTask{\n\t\t\t\theaders: headers,\n\t\t\t\thashes: hashes,\n\t\t\t}:\n\t\t\tcase <-d.cancelCh:\n\t\t\t\treturn errCanceled\n\t\t\t}\n\t\t}\n\t\t// If we still have headers to import, loop and keep pushing them\n\t\tif from <= head.Number.Uint64() {\n\t\t\tcontinue\n\t\t}\n\t\t// If the pivot block is committed, signal header sync termination\n\t\tif atomic.LoadInt32(&d.committed) == 1 {\n\t\t\tselect {\n\t\t\tcase d.headerProcCh <- nil:\n\t\t\t\treturn nil\n\t\t\tcase <-d.cancelCh:\n\t\t\t\treturn errCanceled\n\t\t\t}\n\t\t}\n\t\t// State sync still going, wait a bit for new headers and retry\n\t\tlog.Debug(\"Pivot not yet committed, waiting...\")\n\t\tselect {\n\t\tcase <-time.After(fsHeaderContCheck):\n\t\tcase <-d.cancelCh:\n\t\t\treturn errCanceled\n\t\t}\n\t\thead, _, err = d.skeleton.Bounds()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "84e6aafdb428def552cc3cc2dc5153b3", "score": "0.47567078", "text": "func TestMinerHeader(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\tt.Parallel()\n\tst, err := createServerTester(t.Name())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer st.server.panicClose()\n\tstartingHeight := st.cs.Height()\n\n\t// Get a header that can be used for mining.\n\tresp, err := HttpGET(\"http://\" + st.server.listener.Addr().String() + \"/miner/header\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer resp.Body.Close()\n\ttargetAndHeader, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Twiddle the header bits until a block has been found.\n\t//\n\t// Note: this test treats the target as hardcoded, if the testing target is\n\t// changed, this test will also need to be changed.\n\tif types.RootTarget[0] != 128 {\n\t\tt.Fatal(\"test will fail because the testing constants have been unexpectedly changed\")\n\t}\n\tvar header [80]byte\n\tcopy(header[:], targetAndHeader[32:])\n\theaderHash := crypto.HashObject(header)\n\tfor headerHash[0] >= types.RootTarget[0] {\n\t\theader[35]++\n\t\theaderHash = crypto.HashObject(header)\n\t}\n\n\t// Submit the solved header through the api and check that the height of\n\t// the blockchain increases.\n\tresp, err = HttpPOST(\"http://\"+st.server.listener.Addr().String()+\"/miner/header\", string(header[:]))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer resp.Body.Close()\n\ttime.Sleep(500 * time.Millisecond)\n\tif st.cs.Height() != startingHeight+1 {\n\t\tt.Errorf(\"block height did not increase after trying to mine a block through the api, started at %v and ended at %v\", startingHeight, st.cs.Height())\n\t}\n}", "title": "" }, { "docid": "f6eaad1f811a04e9db2c47ba9b472c3c", "score": "0.47536227", "text": "func (b *BlockChain) checkBlockHeaderContext(header *wire.BlockHeader, prevNode *blockNode, flags BehaviorFlags) error {\n\t// The genesis block is valid by definition.\n\tif prevNode == nil {\n\t\treturn nil\n\t}\n\n\tfastAdd := flags&BFFastAdd == BFFastAdd\n\tif !fastAdd {\n\t\t// removed stake check\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6c133c72b3de05e78a64b250bd22c607", "score": "0.46986747", "text": "func TestBrokenHeaderChain(t *testing.T) {\n\t// Make chain starting from genesis\n\tdb, LightChain, err := newCanonical(10)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to make new canonical chain: %v\", err)\n\t}\n\t// Create a forked chain, and try to insert with a missing link\n\tchain := makeHeaderChain(LightChain.CurrentHeader(), 5, db, forkSeed)[1:]\n\tif err := testHeaderChainImport(chain, LightChain); err == nil {\n\t\tt.Errorf(\"broken header chain not reported\")\n\t}\n}", "title": "" }, { "docid": "a8a82577444efc690600bec2a60c26c7", "score": "0.46242005", "text": "func (beacon *Beacon) VerifyHeader(chain consensus.ChainHeaderReader, header *model.Header, seal bool) error {\n\treached, _ := IsTTDReached(chain, header.ParentHash, header.Number.Uint64()-1)\n\tif !reached {\n\t\treturn beacon.ethone.VerifyHeader(chain, header, seal)\n\t}\n\t// Short circuit if the parent is not known\n\tparent := chain.GetHeader(header.ParentHash, header.Number.Uint64()-1)\n\tif parent == nil {\n\t\treturn consensus.ErrUnknownAncestor\n\t}\n\t// Sanity checks passed, do a proper verification\n\treturn beacon.verifyHeader(chain, header, parent)\n}", "title": "" }, { "docid": "373cd2f8ccbf8634d435b3108c3c8762", "score": "0.4609695", "text": "func verifyHeader(hActual *http.Header, hMustBe *descriptor.Headers) error {\n\n\tfor k, v := range *hMustBe {\n\n\t\tvar msg string\n\n\t\tfound := hActual.Get(k)\n\n\t\tif len(strings.TrimSpace(found)) == 0 {\n\t\t\tmsg = fmt.Sprintf(\"The key %s is missing in the request header.\", k)\n\t\t\treturn errors.New(msg)\n\t\t}\n\n\t\tif found != v {\n\t\t\tmsg = fmt.Sprintf(\"The value %s of key %s is not equal to desired value %s.\", k, found, v)\n\t\t\treturn errors.New(msg)\n\t\t}\n\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "89b00c254aa5853bbe1fb63d0916f7cd", "score": "0.45992064", "text": "func TestHeadersCompare(t *testing.T) {\n\tha := Headers{\"ka\", \"va\", \"kb\", \"vb\", \"kc\", \"vc\"}\n\thb := Headers{\"ka\", \"va\", \"kb\", \"vb\", \"kc\", \"vc\"}\n\thc := Headers{\"ka\", \"va\"}\n\thd := Headers{\"k1\", \"v1\", \"k2\", \"v2\", \"k3\", \"v3\"}\n\tb := ha.Compare(hb)\n\tif !b {\n\t\tt.Fatalf(\"CMP01 Expected true, got false\")\n\t}\n\tb = ha.Compare(hc)\n\tif b {\n\t\tt.Fatalf(\"CMP02 Expected false, got true\")\n\t}\n\tb = ha.Compare(hd)\n\tif b {\n\t\tt.Fatalf(\"CMP03 Expected false, got true\")\n\t}\n\tb = hd.Compare(ha)\n\tif b {\n\t\tt.Fatalf(\"CMP04 Expected false, got true\")\n\t}\n}", "title": "" }, { "docid": "79d6965b4e625872eb647c2d378b7e9e", "score": "0.45187634", "text": "func TestBadHeaderHashes(t *testing.T) {\n\tbc := newTestLightChain()\n\n\t// Create a chain, ban a hash and try to import\n\tvar err error\n\theaders := makeHeaderChainWithDiff(bc.genesisBlock, []int{1, 2, 4}, 10)\n\tcore.BadHashes[headers[2].Hash()] = true\n\tif _, err = bc.InsertHeaderChain(headers, 1); err != core.ErrBlacklistedHash {\n\t\tt.Errorf(\"error mismatch: have: %v, want %v\", err, core.ErrBlacklistedHash)\n\t}\n}", "title": "" }, { "docid": "ecf516aa6586ec186a95762e7d610c8a", "score": "0.4513135", "text": "func testHeaderChainImport(chain []*types.Header, lightchain *LightChain) error {\n\tfor _, header := range chain {\n\t\t// Try and validate the header\n\t\tif err := lightchain.engine.VerifyHeader(lightchain.hc, header, true); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Manually insert the header into the database, but don't reorganize (allows subsequent testing)\n\t\tlightchain.chainmu.Lock()\n\t\trawdb.WriteTd(lightchain.chainDb, header.Hash(), header.Number.Uint64(), new(big.Int).Add(header.Difficulty, lightchain.GetTdByHash(header.ParentHash)))\n\t\trawdb.WriteHeader(lightchain.chainDb, header)\n\t\tlightchain.chainmu.Unlock()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fecacdd4b4d23439af78fcddf1c43a93", "score": "0.4502502", "text": "func (cs *ConsensusSet) forkHeadersBlockchain(tx *bolt.Tx, newHeader *modules.ProcessedBlockHeader) (revertedHeaders, appliedHeaders []*modules.ProcessedBlockHeader, err error) {\n\t// log.Printf(\"\\n\\nforkHeadersBlockchain height:%d, %s\", newHeader.Height, newHeader.BlockHeader.ID())\n\tcommonParent := backtrackHeadersToCurrentPath(tx, newHeader)[0]\n\t// log.Printf(\"commonParent:%d, %s\", commonParent.Height, commonParent.BlockHeader.ID())\n\trevertedHeaders = cs.revertToHeader(tx, commonParent)\n\tappliedHeaders, err = cs.applyUntilHeader(tx, newHeader)\n\tif err != nil {\n\t\treturn revertedHeaders, appliedHeaders, err\n\t}\n\n\t// log.Printf(\"forkHeadersBlockchain height end:%d, %s\\n\\n\", newHeader.Height, newHeader.BlockHeader.ID())\n\treturn revertedHeaders, appliedHeaders, nil\n}", "title": "" }, { "docid": "ffdfcf1cfc1c27a434425ff0e26c3979", "score": "0.45020002", "text": "func TestBlockHeaderSerialize(t *testing.T) {\n\tnonce := uint32(123123) // 0x1e0f3\n\n\t// baseBlockHdr is used in the various tests as a baseline BlockHeader.\n\tbits := uint32(0x1d00ffff)\n\tbaseBlockHdr := &BlockHeader{\n\t\tVersion: 1,\n\t\tPrevBlock: mainNetGenesisHash,\n\t\tMerkleRoot: mainNetGenesisMerkleRoot,\n\t\tTimestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST\n\t\tBits: bits,\n\t\tNonce: nonce,\n\t\tHashStateRoot: mainNetGenesisHashStateRoot,\n\t\tHashUTXORoot: mainNetGenesisHashUTXORoot,\n\t\tBlockSig: make([]byte, 0),\n\t}\n\n\t// baseBlockHdrEncoded is the wire encoded bytes of baseBlockHdr.\n\t// baseBlockHdrEncoded is the wire encoded bytes of baseBlockHdr.\n\tbaseBlockHdrEncoded := []byte{\n\t\t0x01, 0x00, 0x00, 0x00, // Version 1\n\t\t0x6c, 0x98, 0xed, 0x82, 0x55, 0x5e, 0xf9, 0xe3,\n\t\t0xd6, 0x34, 0x83, 0xd9, 0x21, 0xfa, 0x6c, 0x09,\n\t\t0xc3, 0xf8, 0xe6, 0x8c, 0xae, 0xf8, 0x80, 0x35,\n\t\t0x85, 0xf2, 0x3c, 0xf8, 0xae, 0x75, 0x00, 0x00, // PrevBlock\n\t\t0x6d, 0xb9, 0x05, 0x14, 0x23, 0x82, 0x32, 0x4d,\n\t\t0xb4, 0x17, 0x76, 0x18, 0x91, 0xf2, 0xd2, 0xf3,\n\t\t0x55, 0xea, 0x92, 0xf2, 0x7a, 0xb0, 0xfc, 0x35,\n\t\t0xe5, 0x9e, 0x90, 0xb5, 0x0e, 0x05, 0x34, 0xed, // MerkleRoot\n\t\t0x29, 0xab, 0x5f, 0x49, // Timestamp\n\t\t0xff, 0xff, 0x00, 0x1d, // Bits\n\t\t0xf3, 0xe0, 0x01, 0x00, // Nonce\n\t\t0xe9, 0x65, 0xff, 0xd0, 0x02, 0xcd, 0x6a, 0xd0,\n\t\t0xe2, 0xdc, 0x40, 0x2b, 0x80, 0x44, 0xde, 0x83,\n\t\t0x3e, 0x06, 0xb2, 0x31, 0x27, 0xea, 0x8c, 0x3d,\n\t\t0x80, 0xae, 0xc9, 0x14, 0x10, 0x77, 0x14, 0x95, // staste root\n\t\t0x56, 0xe8, 0x1f, 0x17, 0x1b, 0xcc, 0x55, 0xa6,\n\t\t0xff, 0x83, 0x45, 0xe6, 0x92, 0xc0, 0xf8, 0x6e,\n\t\t0x5b, 0x48, 0xe0, 0x1b, 0x99, 0x6c, 0xad, 0xc0,\n\t\t0x01, 0x62, 0x2f, 0xb5, 0xe3, 0x63, 0xb4, 0x21, // utxo root\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, 0x00, 0x00, 0x00, 0x00,\n\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // prevout stake\n\t\t0x00, 0x00, 0x00, 0x00, // prevout N\n\t\t0x00, // BlockSig\n\t}\n\n\ttests := []struct {\n\t\tin *BlockHeader // Data to encode\n\t\tout *BlockHeader // Expected decoded data\n\t\tbuf []byte // Serialized data\n\t}{\n\t\t{\n\t\t\tbaseBlockHdr,\n\t\t\tbaseBlockHdr,\n\t\t\tbaseBlockHdrEncoded,\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 block header.\n\t\tvar buf bytes.Buffer\n\t\terr := test.in.Serialize(&buf)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Serialize #%d error %v\", i, err)\n\t\t\tcontinue\n\t\t}\n\t\tif !bytes.Equal(buf.Bytes(), test.buf) {\n\t\t\tt.Errorf(\"Serialize #%d\\n got: %s want: %s\", i,\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 block header.\n\t\tvar bh BlockHeader\n\t\trbuf := bytes.NewReader(test.buf)\n\t\terr = bh.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(&bh, test.out) {\n\t\t\tt.Errorf(\"Deserialize #%d\\n got: %s want: %s\", i,\n\t\t\t\tspew.Sdump(&bh), spew.Sdump(test.out))\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "43d8b2adbdb0f467f466fad32f104c35", "score": "0.4485141", "text": "func TestGossiper_Contention_Single_Block_Consensus(t *testing.T) {\n\tname1 := \"test1.txt\"\n\tname2 := \"test2.txt\"\n\n\tcontent1 := []byte{0xAA}\n\tcontent2 := []byte{0xBB}\n\n\tvar metaHash1 []byte\n\tvar metaHash2 []byte\n\n\t// Compute the metahash\n\th := sha256.New()\n\th.Write(content1)\n\tchunk := h.Sum(nil)\n\n\th = sha256.New()\n\th.Write(chunk)\n\tmetaHash1 = h.Sum(nil)\n\n\th = sha256.New()\n\th.Write(content2)\n\tchunk = h.Sum(nil)\n\n\th = sha256.New()\n\th.Write(chunk)\n\tmetaHash2 = h.Sum(nil)\n\n\tnA := createAndStartNode(t, \"NA\", WithNodeIndex(0), WithNumParticipants(5), WithAntiEntropy(1))\n\tnB := createAndStartNode(t, \"NB\", WithNodeIndex(1), WithNumParticipants(5), WithAntiEntropy(1))\n\tnC := createAndStartNode(t, \"NC\", WithNodeIndex(2), WithNumParticipants(5), WithAntiEntropy(1))\n\tnD := createAndStartNode(t, \"ND\", WithNodeIndex(3), WithNumParticipants(5), WithAntiEntropy(1))\n\tnE := createAndStartNode(t, \"NE\", WithNodeIndex(4), WithNumParticipants(5), WithAntiEntropy(1))\n\n\tdefer stopNodes(&nA, &nB, &nC, &nD, &nE)\n\n\tnodes := map[string]nodeInfo{\n\t\t\"A\": nA, \"B\": nB, \"C\": nC, \"D\": nD, \"E\": nE,\n\t}\n\n\tlb := newLinkBuilder(nodes)\n\tlb.connectAll()\n\n\tnA.addFile(t, name1, content1)\n\tnB.addFile(t, name2, content2)\n\n\tgo nA.gossiper.IndexShares(name1)\n\tgo nB.gossiper.IndexShares(name2)\n\n\ttime.Sleep(time.Second * 2)\n\n\taLast, aChain := nA.gossiper.GetBlocks()\n\tbLast, bChain := nB.gossiper.GetBlocks()\n\tcLast, cChain := nC.gossiper.GetBlocks()\n\tdLast, dChain := nD.gossiper.GetBlocks()\n\teLast, eChain := nE.gossiper.GetBlocks()\n\n\tgetFirst := func(last string, chain map[string]types.Block) (types.Block, bool) {\n\t\tif last == \"\" {\n\t\t\treturn types.Block{}, false\n\t\t}\n\n\t\tfor {\n\t\t\tblock := chain[last]\n\t\t\tif block.BlockNumber == 0 {\n\t\t\t\treturn block, true\n\t\t\t}\n\n\t\t\tlast = hex.EncodeToString(block.PreviousHash)\n\t\t}\n\t}\n\n\tmergeChain := func(block types.Block, chainCount map[string]int, chainMerged map[string]types.Block) {\n\t\tkey := hex.EncodeToString(block.Hash())\n\n\t\t_, ok := chainCount[key]\n\t\tif !ok {\n\t\t\tchainCount[key] = 0\n\t\t}\n\n\t\tchainCount[key]++\n\t\tchainMerged[key] = block\n\t}\n\n\tcountBlocks := map[string]int{}\n\tmergedBlocks := map[string]types.Block{}\n\n\taFirst, ok := getFirst(aLast, aChain)\n\tif ok {\n\t\tmergeChain(aFirst, countBlocks, mergedBlocks)\n\t}\n\n\tbFirst, ok := getFirst(bLast, bChain)\n\tif ok {\n\t\tmergeChain(bFirst, countBlocks, mergedBlocks)\n\t}\n\n\tcFirst, ok := getFirst(cLast, cChain)\n\tif ok {\n\t\tmergeChain(cFirst, countBlocks, mergedBlocks)\n\t}\n\n\tdFirst, ok := getFirst(dLast, dChain)\n\tif ok {\n\t\tmergeChain(dFirst, countBlocks, mergedBlocks)\n\t}\n\n\teFirst, ok := getFirst(eLast, eChain)\n\tif ok {\n\t\tmergeChain(eFirst, countBlocks, mergedBlocks)\n\t}\n\n\t// There should be at least one block with a count of 3\n\n\tthreeFound := false\n\tkeyFound := \"\"\n\tfor k, v := range countBlocks {\n\t\tif v >= 3 {\n\t\t\tthreeFound = true\n\t\t\tkeyFound = k\n\t\t}\n\t}\n\n\trequire.True(t, threeFound)\n\n\t// We check that the block with at least three occurrences is the expected\n\t// one.\n\n\tblock1 := types.Block{\n\t\tBlockNumber: 0,\n\t\tFilename: name1,\n\t\tMetahash: metaHash1,\n\t\tPreviousHash: make([]byte, 32),\n\t}\n\n\tblock2 := types.Block{\n\t\tBlockNumber: 0,\n\t\tFilename: name2,\n\t\tMetahash: metaHash2,\n\t\tPreviousHash: make([]byte, 32),\n\t}\n\n\tallPotentialBlocks := []types.Block{\n\t\tblock1,\n\t\tblock2,\n\t}\n\n\trequire.True(t, threeFound)\n\trequire.Contains(t, allPotentialBlocks, mergedBlocks[keyFound])\n}", "title": "" }, { "docid": "826dbafed1eb84cb1d9ea97b9cb57006", "score": "0.4452869", "text": "func (rl *RootChainListener) ProcessHeader(newHeader *types.Header) {\n\trl.Logger.Debug(\"New block detected\", \"blockNumber\", newHeader.Number)\n\n\t// fetch context\n\trootchainContext, err := rl.getRootChainContext()\n\tif err != nil {\n\t\treturn\n\t}\n\trequiredConfirmations := rootchainContext.ChainmanagerParams.MainchainTxConfirmations\n\tlatestNumber := newHeader.Number\n\n\t// confirmation\n\tconfirmationBlocks := big.NewInt(0).SetUint64(requiredConfirmations)\n\n\tif latestNumber.Cmp(confirmationBlocks) <= 0 {\n\t\trl.Logger.Error(\"Block number less than Confirmations required\", \"blockNumber\", latestNumber.Uint64, \"confirmationsRequired\", confirmationBlocks.Uint64)\n\t\treturn\n\t}\n\tlatestNumber = latestNumber.Sub(latestNumber, confirmationBlocks)\n\n\t// default fromBlock\n\tfromBlock := latestNumber\n\n\t// get last block from storage\n\thasLastBlock, _ := rl.storageClient.Has([]byte(lastRootBlockKey), nil)\n\tif hasLastBlock {\n\t\tlastBlockBytes, err := rl.storageClient.Get([]byte(lastRootBlockKey), nil)\n\t\tif err != nil {\n\t\t\trl.Logger.Info(\"Error while fetching last block bytes from storage\", \"error\", err)\n\t\t\treturn\n\t\t}\n\t\trl.Logger.Debug(\"Got last block from bridge storage\", \"lastBlock\", string(lastBlockBytes))\n\t\tif result, err := strconv.ParseUint(string(lastBlockBytes), 10, 64); err == nil {\n\t\t\tif result >= newHeader.Number.Uint64() {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfromBlock = big.NewInt(0).SetUint64(result + 1)\n\t\t}\n\t}\n\n\t// to block\n\ttoBlock := latestNumber\n\n\tif toBlock.Cmp(fromBlock) == -1 {\n\t\tfromBlock = toBlock\n\t}\n\n\t// set last block to storage\n\tif err := rl.storageClient.Put([]byte(lastRootBlockKey), []byte(toBlock.String()), nil); err != nil {\n\t\trl.Logger.Error(\"rl.storageClient.Put\", \"Error\", err)\n\t}\n\n\t// query events\n\trl.queryAndBroadcastEvents(rootchainContext, fromBlock, toBlock)\n}", "title": "" }, { "docid": "cd8625ca90a1cddc496f05c97bbe391c", "score": "0.44458002", "text": "func PreparePayloadAttributes(ctx context.Context, cfg *rollup.Config, dl L1ReceiptsFetcher, l2Parent eth.L2BlockRef, epoch eth.BlockID) (attrs *eth.PayloadAttributes, crit bool, err error) {\n\tvar l1Info eth.L1Info\n\tvar depositTxs []hexutil.Bytes\n\tvar seqNumber uint64\n\n\t// If the L1 origin changed this block, then we are in the first block of the epoch. In this\n\t// case we need to fetch all transaction receipts from the L1 origin block so we can scan for\n\t// user deposits.\n\tif l2Parent.L1Origin.Number != epoch.Number {\n\t\tinfo, _, receipts, err := dl.Fetch(ctx, epoch.Hash)\n\t\tif err != nil {\n\t\t\treturn nil, false, fmt.Errorf(\"failed to fetch L1 block info and receipts: %w\", err)\n\t\t}\n\t\tif l2Parent.L1Origin.Hash != info.ParentHash() {\n\t\t\treturn nil, true, fmt.Errorf(\"cannot create new block with L1 origin %s (parent %s) on top of L1 origin %s\", epoch, info.ParentHash(), l2Parent.L1Origin)\n\t\t}\n\t\tdeposits, err := DeriveDeposits(receipts, cfg.DepositContractAddress)\n\t\tif err != nil {\n\t\t\treturn nil, true, fmt.Errorf(\"failed to derive some deposits: %w\", err)\n\t\t}\n\t\tl1Info = info\n\t\tdepositTxs = deposits\n\t\tseqNumber = 0\n\t} else {\n\t\tif l2Parent.L1Origin.Hash != epoch.Hash {\n\t\t\treturn nil, true, fmt.Errorf(\"cannot create new block with L1 origin %s in conflict with L1 origin %s\", epoch, l2Parent.L1Origin)\n\t\t}\n\t\tinfo, err := dl.InfoByHash(ctx, epoch.Hash)\n\t\tif err != nil {\n\t\t\treturn nil, false, fmt.Errorf(\"failed to fetch L1 block info: %w\", err)\n\t\t}\n\t\tl1Info = info\n\t\tdepositTxs = nil\n\t\tseqNumber = l2Parent.SequenceNumber + 1\n\t}\n\n\tl1InfoTx, err := L1InfoDepositBytes(seqNumber, l1Info)\n\tif err != nil {\n\t\treturn nil, true, fmt.Errorf(\"failed to create l1InfoTx: %w\", err)\n\t}\n\n\ttxs := make([]hexutil.Bytes, 0, 1+len(depositTxs))\n\ttxs = append(txs, l1InfoTx)\n\ttxs = append(txs, depositTxs...)\n\n\treturn &eth.PayloadAttributes{\n\t\tTimestamp: hexutil.Uint64(l2Parent.Time + cfg.BlockTime),\n\t\tPrevRandao: eth.Bytes32(l1Info.MixDigest()),\n\t\tSuggestedFeeRecipient: cfg.FeeRecipientAddress,\n\t\tTransactions: txs,\n\t\tNoTxPool: true,\n\t}, false, nil\n}", "title": "" }, { "docid": "592a6fd68571992d82615000727f7e26", "score": "0.4438611", "text": "func (b *BlockChain) maybeAcceptBlockHeader(header *wire.BlockHeader, checkHeaderSanity bool) (*blockNode, error) {\n\t// Avoid validating the header again if its validation status is already\n\t// known. Invalid headers are never added to the block index, so if there\n\t// is an entry for the block hash, the header itself is known to be valid.\n\t// However, it might have since been marked invalid either due to the\n\t// associated block, or an ancestor, later failing validation.\n\thash := header.BlockHash()\n\tif node := b.index.LookupNode(&hash); node != nil {\n\t\tif err := b.checkKnownInvalidBlock(node); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn node, nil\n\t}\n\n\t// Perform context-free sanity checks on the block header.\n\tif checkHeaderSanity {\n\t\terr := checkBlockHeaderSanity(header, b.timeSource, BFNone, b.chainParams)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Orphan headers are not allowed and this function should never be called\n\t// with the genesis block.\n\tprevHash := &header.PrevBlock\n\tprevNode := b.index.LookupNode(prevHash)\n\tif prevNode == nil {\n\t\tstr := fmt.Sprintf(\"previous block %s is not known\", prevHash)\n\t\treturn nil, ruleError(ErrMissingParent, str)\n\t}\n\n\t// There is no need to validate the header if an ancestor is already known\n\t// to be invalid.\n\tprevNodeStatus := b.index.NodeStatus(prevNode)\n\tif prevNodeStatus.KnownInvalid() {\n\t\tstr := fmt.Sprintf(\"previous block %s is known to be invalid\", prevHash)\n\t\treturn nil, ruleError(ErrInvalidAncestorBlock, str)\n\t}\n\n\t// The block header must pass all of the validation rules which depend on\n\t// its position within the block chain.\n\terr := b.checkBlockHeaderPositional(header, prevNode, BFNone)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create a new block node for the block and add it to the block index.\n\t//\n\t// Note that the additional information for the actual votes, tickets, and\n\t// revocations in the block can't be populated until the full block data is\n\t// known since that information is not available in the header.\n\tnewNode := newBlockNode(header, prevNode)\n\tnewNode.status = statusNone\n\tb.index.AddNode(newNode)\n\n\t// Attempt to discover and set the old fork rejection checkpoint node if\n\t// needed now that a new header is available.\n\tb.maybeSetForkRejectionCheckpoint()\n\n\t// Potentially update the assumed valid node to this block header.\n\tb.maybeUpdateAssumeValid(newNode)\n\n\treturn newNode, nil\n}", "title": "" }, { "docid": "5a3eecf3d8bcf3ab9a5c2e6a80f7a21e", "score": "0.44248298", "text": "func TestValidateHeaders(t *testing.T) {\n\tvar (\n\t\ttooLargeName = strings.Repeat(\"x\", 256)\n\t\ttooLargeValue = strings.Repeat(\"y\", 16385)\n\t)\n\ttests := []struct {\n\t\tname string\n\t\troute *routev1.Route\n\t\texpectedErrorMessage string\n\t}{\n\t\t{\n\t\t\tname: \"should give an error on attempt to delete the HSTS header.\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"wildcardpolicy\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.wildcard.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tWildcardPolicy: routev1.WildcardPolicySubdomain,\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tResponse: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"Strict-Transport-Security\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Delete,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: \"spec.httpHeaders.actions.response[0].name: Forbidden: the following headers may not be modified using this API: strict-transport-security, proxy, cookie, set-cookie\",\n\t\t},\n\t\t{\n\t\t\tname: \"should give an error on attempt to delete the Proxy header.\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"wildcardpolicy\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.wildcard.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tWildcardPolicy: routev1.WildcardPolicySubdomain,\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tResponse: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"Proxy\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Delete,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: \"spec.httpHeaders.actions.response[0].name: Forbidden: the following headers may not be modified using this API: strict-transport-security, proxy, cookie, set-cookie\",\n\t\t},\n\t\t{\n\t\t\tname: \"should give an error on attempt to delete the Cookie header.\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"wildcardpolicy\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.wildcard.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tWildcardPolicy: routev1.WildcardPolicySubdomain,\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tRequest: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"Cookie\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Delete,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: \"spec.httpHeaders.actions.request[0].name: Forbidden: the following headers may not be modified using this API: strict-transport-security, proxy, cookie, set-cookie\",\n\t\t},\n\t\t{\n\t\t\tname: \"should give an error on attempt to delete the Set-Cookie header.\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"wildcardpolicy\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.wildcard.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tWildcardPolicy: routev1.WildcardPolicySubdomain,\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tResponse: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"Set-Cookie\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Delete,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: \"spec.httpHeaders.actions.response[0].name: Forbidden: the following headers may not be modified using this API: strict-transport-security, proxy, cookie, set-cookie\",\n\t\t},\n\t\t{\n\t\t\tname: \"should give an error when brackets are not closed properly.\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"wildcardpolicy\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.wildcard.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tWildcardPolicy: routev1.WildcardPolicySubdomain,\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tResponse: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"expires\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"%{+Q}[ssl_c_der,base64\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: `spec.httpHeaders.actions.response[0].action.set.value: Invalid value: \"%{+Q}[ssl_c_der,base64\": Either header value provided is not in correct format or the converter specified is not allowed. The dynamic header value may use HAProxy's %[] syntax and otherwise must be a valid HTTP header value as defined in https://datatracker.ietf.org/doc/html/rfc7230#section-3.2 Sample fetchers allowed are res.hdr, ssl_c_der. Converters allowed are lower, base64.`,\n\t\t},\n\t\t{\n\t\t\tname: \"should give an error if the converter in dynamic header value is not permitted.\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"wildcardpolicy\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.wildcard.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tWildcardPolicy: routev1.WildcardPolicySubdomain,\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tResponse: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"map\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"%[res.hdr(host),bogus]\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: `spec.httpHeaders.actions.response[0].action.set.value: Invalid value: \"%[res.hdr(host),bogus]\": Either header value provided is not in correct format or the converter specified is not allowed. The dynamic header value may use HAProxy's %[] syntax and otherwise must be a valid HTTP header value as defined in https://datatracker.ietf.org/doc/html/rfc7230#section-3.2 Sample fetchers allowed are res.hdr, ssl_c_der. Converters allowed are lower, base64.`,\n\t\t},\n\t\t{\n\t\t\tname: \"should give an error when same header name provided more than once\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"wildcardpolicy\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.wildcard.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tWildcardPolicy: routev1.WildcardPolicySubdomain,\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tResponse: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"X-Frame-Options\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"DENY\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"X-Server\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Delete,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"X-Frame-Options\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"SAMEORIGIN\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: `spec.httpHeaders.actions.response[2].name: Duplicate value: \"X-Frame-Options\"`,\n\t\t},\n\t\t{\n\t\t\tname: \"valid request headers\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"wildcardpolicy\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.wildcard.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tWildcardPolicy: routev1.WildcardPolicySubdomain,\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tRequest: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"Accept\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"text/plain,text/html\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"Accept-Encoding\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Delete,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"Conditional\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"%[req.hdr(Host)] if foo\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"Condition\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: `%[req.hdr(Host)]\\ if\\ foo`,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: \"\",\n\t\t},\n\t\t{\n\t\t\tname: \"valid request and response headers\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"valid-request-and-response-headers\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.example.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tRequest: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"x-foo\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"%{+Q}[ssl_c_der,base64]\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"x-bar\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Delete,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"x-baz\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"%[req.hdr(Host),lower]\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tResponse: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"x-foo\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"%{+Q}[ssl_c_der,base64]\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"x-fooby\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Delete,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"x-barby\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"%[res.hdr(server),lower]\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: \"\",\n\t\t},\n\t\t{\n\t\t\tname: \"invalid request and response headers\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"invalid-request-and-response-headers\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.example.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tRequest: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"x-foo\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"%+Q[ssl_c_der,base64]\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"x-bar\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Delete,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"x-baz\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"%[req.hdr(Host),lower\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tResponse: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"x-foo\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"%{+Q}[ssl_c_der,base64]\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"x-fooby\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Delete,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"x-barby\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"%[res.hdr(server),tolower]\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: `[spec.httpHeaders.actions.response[2].action.set.value: Invalid value: \"%[res.hdr(server),tolower]\": Either header value provided is not in correct format or the converter specified is not allowed. The dynamic header value may use HAProxy's %[] syntax and otherwise must be a valid HTTP header value as defined in https://datatracker.ietf.org/doc/html/rfc7230#section-3.2 Sample fetchers allowed are res.hdr, ssl_c_der. Converters allowed are lower, base64., spec.httpHeaders.actions.request[0].action.set.value: Invalid value: \"%+Q[ssl_c_der,base64]\": Either header value provided is not in correct format or the converter specified is not allowed. The dynamic header value may use HAProxy's %[] syntax and otherwise must be a valid HTTP header value as defined in https://datatracker.ietf.org/doc/html/rfc7230#section-3.2 Sample fetchers allowed are req.hdr, ssl_c_der. Converters allowed are lower, base64., spec.httpHeaders.actions.request[2].action.set.value: Invalid value: \"%[req.hdr(Host),lower\": Either header value provided is not in correct format or the converter specified is not allowed. The dynamic header value may use HAProxy's %[] syntax and otherwise must be a valid HTTP header value as defined in https://datatracker.ietf.org/doc/html/rfc7230#section-3.2 Sample fetchers allowed are req.hdr, ssl_c_der. Converters allowed are lower, base64.]`,\n\t\t},\n\t\t{\n\t\t\tname: \"should give an error if the header value exceeds 16384 chars\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"wildcardpolicy\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.wildcard.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tWildcardPolicy: routev1.WildcardPolicySubdomain,\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tResponse: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"X-SSL-Client-Cert\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: tooLargeValue,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: fmt.Sprintf(\"spec.httpHeaders.actions.response[0].action.set.value: Invalid value: %q: value exceeds the maximum length, which is 16384\", tooLargeValue),\n\t\t},\n\t\t{\n\t\t\tname: \"should give an error if the header value is 0 chars\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"wildcardpolicy\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.wildcard.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tWildcardPolicy: routev1.WildcardPolicySubdomain,\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tResponse: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"X-SSL-Client-Cert\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: \"spec.httpHeaders.actions.response[0].action.set.value: Required value\",\n\t\t},\n\t\t{\n\t\t\tname: \"should give an error if the header name exceeds 1024 chars\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"wildcardpolicy\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.wildcard.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tWildcardPolicy: routev1.WildcardPolicySubdomain,\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tResponse: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: tooLargeName,\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"foo\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: fmt.Sprintf(\"spec.httpHeaders.actions.response[0].name: Invalid value: %q: name exceeds the maximum length, which is 255\", tooLargeName),\n\t\t},\n\t\t{\n\t\t\tname: \"should give an error if the header name is 0 chars\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"wildcardpolicy\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.wildcard.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tWildcardPolicy: routev1.WildcardPolicySubdomain,\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tResponse: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"foo\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: \"spec.httpHeaders.actions.response[0].name: Required value\",\n\t\t},\n\t\t{\n\t\t\tname: \"should give an error if the response header's value has sample fetcher req.hdr\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"wildcardpolicy\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.wildcard.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tWildcardPolicy: routev1.WildcardPolicySubdomain,\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tResponse: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"X-SSL-Client-Cert\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"%[req.hdr(host),lower]\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: `spec.httpHeaders.actions.response[0].action.set.value: Invalid value: \"%[req.hdr(host),lower]\": Either header value provided is not in correct format or the converter specified is not allowed. The dynamic header value may use HAProxy's %[] syntax and otherwise must be a valid HTTP header value as defined in https://datatracker.ietf.org/doc/html/rfc7230#section-3.2 Sample fetchers allowed are res.hdr, ssl_c_der. Converters allowed are lower, base64.`,\n\t\t},\n\t\t{\n\t\t\tname: \"should give an error if the request header's value has converter base_64\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"wildcardpolicy\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.wildcard.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tWildcardPolicy: routev1.WildcardPolicySubdomain,\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tRequest: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"X-SSL-Client-Cert\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"%[ssl_c_der,base_64]\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: `spec.httpHeaders.actions.request[0].action.set.value: Invalid value: \"%[ssl_c_der,base_64]\": Either header value provided is not in correct format or the converter specified is not allowed. The dynamic header value may use HAProxy's %[] syntax and otherwise must be a valid HTTP header value as defined in https://datatracker.ietf.org/doc/html/rfc7230#section-3.2 Sample fetchers allowed are req.hdr, ssl_c_der. Converters allowed are lower, base64.`,\n\t\t},\n\t\t{\n\t\t\tname: \"should not allow repetition of a header name\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"wildcardpolicy\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.wildcard.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tWildcardPolicy: routev1.WildcardPolicySubdomain,\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tRequest: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"Accept\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"text/plain,text/html\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"Accept\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Delete,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: `spec.httpHeaders.actions.request[1].name: Duplicate value: \"Accept\"`,\n\t\t},\n\t\t{\n\t\t\tname: \"set is required when type is Set\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"missing-set-field\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.example.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tRequest: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"Accept\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Set,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: `spec.httpHeaders.actions.request[0].action.set: Required value: set is required when type is Set, and forbidden otherwise`,\n\t\t},\n\t\t{\n\t\t\tname: \"set is forbidden when type is not Set\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"missing-set-field\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.example.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tRequest: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"Accept\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Delete,\n\t\t\t\t\t\t\t\t\t\tSet: &routev1.RouteSetHTTPHeader{\n\t\t\t\t\t\t\t\t\t\t\tValue: \"text/plain,text/html\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: `spec.httpHeaders.actions.request[0].action.set: Required value: set is required when type is Set, and forbidden otherwise`,\n\t\t},\n\t\t{\n\t\t\tname: \"empty header name\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"empty-name\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.example.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tRequest: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Delete,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: \"spec.httpHeaders.actions.request[0].name: Required value\",\n\t\t},\n\t\t{\n\t\t\tname: \"invalid header name\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"invalid-name\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.example.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tRequest: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"foo bar\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: routev1.Delete,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: `spec.httpHeaders.actions.request[0].name: Invalid value: \"foo bar\": name must be a valid HTTP header name as defined in RFC 2616 section 4.2`,\n\t\t},\n\t\t{\n\t\t\tname: \"empty action\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"empty-action\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.example.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tRequest: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"x-foo\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: \"\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: `spec.httpHeaders.actions.request[0].action.type: Invalid value: \"\": type must be \"Set\" or \"Delete\"`,\n\t\t},\n\t\t{\n\t\t\tname: \"invalid action\",\n\t\t\troute: &routev1.Route{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: \"invalid-action\",\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t},\n\t\t\t\tSpec: routev1.RouteSpec{\n\t\t\t\t\tHost: \"subdomain.example.test\",\n\t\t\t\t\tTo: createRouteSpecTo(\"serviceName\", \"Service\"),\n\t\t\t\t\tHTTPHeaders: &routev1.RouteHTTPHeaders{\n\t\t\t\t\t\tActions: routev1.RouteHTTPHeaderActions{\n\t\t\t\t\t\t\tRequest: []routev1.RouteHTTPHeader{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"x-foo\",\n\t\t\t\t\t\t\t\t\tAction: routev1.RouteHTTPHeaderActionUnion{\n\t\t\t\t\t\t\t\t\t\tType: \"Replace\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedErrorMessage: `spec.httpHeaders.actions.request[0].action.type: Invalid value: \"Replace\": type must be \"Set\" or \"Delete\"`,\n\t\t},\n\t}\n\tfor _, tc := range tests {\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\tvar allErrs field.ErrorList\n\t\t\tallErrs = append(allErrs, validateHeaders(field.NewPath(\"spec\", \"httpHeaders\", \"actions\", \"response\"), tc.route.Spec.HTTPHeaders.Actions.Response, permittedResponseHeaderValueRE, permittedResponseHeaderValueErrorMessage)...)\n\t\t\tallErrs = append(allErrs, validateHeaders(field.NewPath(\"spec\", \"httpHeaders\", \"actions\", \"request\"), tc.route.Spec.HTTPHeaders.Actions.Request, permittedRequestHeaderValueRE, permittedRequestHeaderValueErrorMessage)...)\n\t\t\tvar actualErrorMessage string\n\t\t\tif err := allErrs.ToAggregate(); err != nil {\n\t\t\t\tactualErrorMessage = err.Error()\n\t\t\t}\n\t\t\tswitch {\n\t\t\tcase tc.expectedErrorMessage == \"\" && actualErrorMessage != \"\":\n\t\t\t\tt.Fatalf(\"unexpected error: %v\", actualErrorMessage)\n\t\t\tcase tc.expectedErrorMessage != \"\" && actualErrorMessage == \"\":\n\t\t\t\tt.Fatalf(\"got nil, expected %v\", tc.expectedErrorMessage)\n\t\t\tcase tc.expectedErrorMessage != actualErrorMessage:\n\t\t\t\tt.Fatalf(\"unexpected error: %v, expected: %v\", actualErrorMessage, tc.expectedErrorMessage)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "dd1932cd7f53b9b7b7cb0fbfaf0dcbee", "score": "0.4418866", "text": "func VerifyForkHashes(config *params.ChainConfig, header *types.Header, uncle bool) error {\n\t// We don't care about uncles\n\tif uncle {\n\t\treturn nil\n\t}\n\t// If the homestead reprice hash is set, validate it\n\tif config.EIP150Block != nil && config.EIP150Block.Cmp(header.Number) == 0 {\n\t\tif config.EIP150Hash != (common.Hash{}) && config.EIP150Hash != header.Hash() {\n\t\t\treturn fmt.Errorf(\"homestead gas reprice fork: have 0x%x, want 0x%x\", header.Hash(), config.EIP150Hash)\n\t\t}\n\t}\n\t// All ok, return\n\treturn nil\n}", "title": "" }, { "docid": "8156cceae7a543fb5c93fa99b7bbb1f5", "score": "0.44184685", "text": "func (cs *ConsensusSet) applyUntilHeader(tx *bolt.Tx, ph *modules.ProcessedBlockHeader) (headers []*modules.ProcessedBlockHeader, err error) {\n\t// Backtrack to the common parent of 'bn' and current path and then apply the new blocks.\n\t// log.Printf(\"applyUntilHeader height:%d, %s\", ph.Height, ph.BlockHeader.ID())\n\tnewPath := backtrackHeadersToCurrentPath(tx, ph)\n\tfor _, header := range newPath[1:] {\n\t\tid := header.BlockHeader.ID()\n\t\t// log.Printf(\"createDSCOBucket&applyMaturedSiacoinOutputsForHeader %d\", len(header.SiacoinOutputDiffs))\n\t\tif len(header.SiacoinOutputDiffs) == 0 {\n\t\t\tcreateDSCOBucket(tx, header.Height+types.MaturityDelay)\n\t\t\tapplyMaturedSiacoinOutputsForHeader(tx, header)\n\t\t\tupdateCurrentPath(tx, id, modules.DiffApply)\n\t\t\theaderMap := tx.Bucket(BlockHeaderMap)\n\t\t\theaderMap.Put(id[:], encoding.Marshal(*header))\n\t\t\t// log.Printf(\"after createDSCOBucket&applyMaturedSiacoinOutputsForHeader %d\", len(header.SiacoinOutputDiffs))\n\t\t} else {\n\t\t\tcommitHeaderDiffSet(tx, header, modules.DiffApply)\n\t\t}\n\n\t\tblock, err := getBlockMap(tx, id)\n\t\tif err == nil {\n\t\t\tcommitSingleBlockDiffSet(tx, block, modules.DiffApply)\n\t\t} else {\n\t\t\tif err != errNilItem {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\t\theaders = append(headers, header)\n\n\t\t// Sanity check - after applying a block, check that the consensus set\n\t\t// has maintained consistency.\n\t\t// NOTE: no every block payout info, no totally supply, no parent block, so won't check consistency in spv\n\t\tif build.Release == \"testing\" {\n\t\t\tcs.checkHeaderConsistency(tx)\n\t\t} else {\n\t\t\tcs.maybeCheckHeaderConsistency(tx)\n\t\t}\n\t}\n\treturn headers, nil\n}", "title": "" }, { "docid": "cf94a596ae1507cbc9f31024336001e9", "score": "0.43980595", "text": "func (d *Downloader) findBeaconAncestor() (uint64, error) {\n\t// Figure out the current local head position\n\tvar chainHead *model.Header\n\n\tswitch d.getMode() {\n\tcase FullSync:\n\t\tchainHead = d.blockchain.CurrentBlock().Header()\n\tcase SnapSync:\n\t\tchainHead = d.blockchain.CurrentFastBlock().Header()\n\tdefault:\n\t\tchainHead = d.lightchain.CurrentHeader()\n\t}\n\tnumber := chainHead.Number.Uint64()\n\n\t// Retrieve the skeleton bounds and ensure they are linked to the local chain\n\tbeaconHead, beaconTail, err := d.skeleton.Bounds()\n\tif err != nil {\n\t\t// This is a programming error. The chain backfiller was called with an\n\t\t// invalid beacon sync state. Ideally we would panic here, but erroring\n\t\t// gives us at least a remote chance to recover. It's still a big fault!\n\t\tlog.Error(\"Failed to retrieve beacon bounds\", \"err\", err)\n\t\treturn 0, err\n\t}\n\tvar linked bool\n\tswitch d.getMode() {\n\tcase FullSync:\n\t\tlinked = d.blockchain.HasBlock(beaconTail.ParentHash, beaconTail.Number.Uint64()-1)\n\tcase SnapSync:\n\t\tlinked = d.blockchain.HasFastBlock(beaconTail.ParentHash, beaconTail.Number.Uint64()-1)\n\tdefault:\n\t\tlinked = d.blockchain.HasHeader(beaconTail.ParentHash, beaconTail.Number.Uint64()-1)\n\t}\n\tif !linked {\n\t\t// This is a programming error. The chain backfiller was called with a\n\t\t// tail that's not linked to the local chain. Whilst this should never\n\t\t// happen, there might be some weirdnesses if beacon sync backfilling\n\t\t// races with the user (or beacon client) calling setHead. Whilst panic\n\t\t// would be the ideal thing to do, it is safer long term to attempt a\n\t\t// recovery and fix any noticed issue after the fact.\n\t\tlog.Error(\"Beacon sync linkup unavailable\", \"number\", beaconTail.Number.Uint64()-1, \"hash\", beaconTail.ParentHash)\n\t\treturn 0, fmt.Errorf(\"beacon linkup unavailable locally: %d [%x]\", beaconTail.Number.Uint64()-1, beaconTail.ParentHash)\n\t}\n\t// Binary search to find the ancestor\n\tstart, end := beaconTail.Number.Uint64()-1, number\n\tif number := beaconHead.Number.Uint64(); end > number {\n\t\t// This shouldn't really happen in a healty network, but if the consensus\n\t\t// clients feeds us a shorter chain as the canonical, we should not attempt\n\t\t// to access non-existent skeleton items.\n\t\tlog.Warning(\"Beacon head lower than local chain\", \"beacon\", number, \"local\", end)\n\t\tend = number\n\t}\n\tfor start+1 < end {\n\t\t// Split our chain interval in two, and request the hash to cross check\n\t\tcheck := (start + end) / 2\n\n\t\th := d.skeleton.Header(check)\n\t\tn := h.Number.Uint64()\n\n\t\tvar known bool\n\t\tswitch d.getMode() {\n\t\tcase FullSync:\n\t\t\tknown = d.blockchain.HasBlock(h.Hash(), n)\n\t\tcase SnapSync:\n\t\t\tknown = d.blockchain.HasFastBlock(h.Hash(), n)\n\t\tdefault:\n\t\t\tknown = d.lightchain.HasHeader(h.Hash(), n)\n\t\t}\n\t\tif !known {\n\t\t\tend = check\n\t\t\tcontinue\n\t\t}\n\t\tstart = check\n\t}\n\treturn start, nil\n}", "title": "" }, { "docid": "db4c3caba7f8ddd704baf91ccb630852", "score": "0.43770325", "text": "func (b *Block) Check() error {\r\n\tif b.IsGenesis() {\r\n\t\treturn nil\r\n\t}\r\n\tlogger := b.GetLogger()\r\n\tif b.PrevHeader == nil || b.PrevHeader.BlockID != b.Header.BlockID-1 {\r\n\t\tif err := b.readPreviousBlockFromBlockchainTable(); err != nil {\r\n\t\t\tlogger.WithFields(log.Fields{\"type\": consts.InvalidObject}).Error(\"block id is larger then previous more than on 1\")\r\n\t\t\treturn err\r\n\t\t}\r\n\t}\r\n\tif b.Header.Time > time.Now().Unix() {\r\n\t\tlogger.WithFields(log.Fields{\"type\": consts.ParameterExceeded}).Error(\"block time is larger than now\")\r\n\t\treturn ErrIncorrectBlockTime\r\n\t}\r\n\r\n\t// is this block too early? Allowable error = error_time\r\n\tif b.PrevHeader != nil {\r\n\t\t// skip time validation for first block\r\n\t\texists, err := protocols.NewBlockTimeCounter().BlockForTimeExists(time.Unix(b.Header.Time, 0), int(b.Header.NodePosition))\r\n\t\tif err != nil {\r\n\t\t\tlogger.WithFields(log.Fields{\"type\": consts.BlockError, \"error\": err}).Error(\"calculating block time\")\r\n\t\t\treturn err\r\n\t\t}\r\n\r\n\t\tif exists {\r\n\t\t\tlogger.WithFields(log.Fields{\"type\": consts.BlockError, \"error\": err}).Warn(\"incorrect block time\")\r\n\t\t\treturn utils.WithBan(fmt.Errorf(\"%s %d\", ErrIncorrectBlockTime, b.PrevHeader.Time))\r\n\t\t}\r\n\t}\r\n\r\n\t// check each transaction\r\n\ttxCounter := make(map[int64]int)\r\n\ttxHashes := make(map[string]struct{})\r\n\tfor _, t := range b.Transactions {\r\n\t\thexHash := string(converter.BinToHex(t.TxHash))\r\n\t\t// check for duplicate transactions\r\n\t\tif _, ok := txHashes[hexHash]; ok {\r\n\t\t\tlogger.WithFields(log.Fields{\"tx_hash\": hexHash, \"type\": consts.DuplicateObject}).Error(\"duplicate transaction\")\r\n\t\t\treturn utils.ErrInfo(fmt.Errorf(\"duplicate transaction %s\", hexHash))\r\n\t\t}\r\n\t\ttxHashes[hexHash] = struct{}{}\r\n\r\n\t\t// check for max transaction per user in one block\r\n\t\t//txCounter[t.TxKeyID]++\r\n\t\tif txCounter[t.TxKeyID] > syspar.GetMaxBlockUserTx() {\r\n\t\t\treturn utils.WithBan(utils.ErrInfo(fmt.Errorf(\"max_block_user_transactions\")))\r\n\t\t}\r\n\r\n\t\tif err := t.CheckTime(b.Header.Time); err != nil {\r\n\t\t\treturn errors.Wrap(err, \"check transaction\")\r\n\t\t}\r\n\t}\r\n\r\n\t// hash compare could be failed in the case of fork\r\n\t_, err := b.CheckHash()\r\n\tif err != nil {\r\n\t\ttransaction.CleanCache()\r\n\t\treturn err\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "4223614b81c9f045de050ae7bfb41fe2", "score": "0.43653646", "text": "func checkClientHisEqual(t *testing.T, ck1 *Clerk, ck2 *Clerk){\n update1 := ck1.GetUpdateFrom(-1)\n update2 := ck2.GetUpdateFrom(-1)\n if update1.Has_operation && update2.Has_operation{\n v1 := update1.New_operations\n v2 := update2.New_operations\n //First,check if the length of two lists are equal\n v :=v1\n if len(v1)>=len(v2){\n v=v2\n }\n for i := 0; i < len(v); i++{\n s1 :=v1[i].ClientStroke \n s2 :=v2[i].ClientStroke \n if !strokeEqual(s1, s2) { \n\t\t\t t.Fatalf(\"Two clients have different history, for %v instance, one had %v, one had %v\", i, s1, s2)\n\t\t } \n } \n }\n}", "title": "" }, { "docid": "bc2d40b952344c8f8c008faec6eb216c", "score": "0.4351235", "text": "func compareLedgerBlock(ledgerLst *[]ledger.Ledger, ledgerObj *ledger.Ledger, lstSoket []string, objSoket string, lstPublicKey []ecdsa.PublicKey, objPublicKey ecdsa.PublicKey) {\n\tfmt.Println(\"in : compareLedgerBlock\")\n\n\tlstLedger, _ := json.Marshal((*ledgerLst)[0].BlockchainObj)\n\tobjLedjer, _ := json.Marshal(ledgerObj.BlockchainObj)\n\n\tif bytes.Compare(lstLedger, objLedjer) != 0 {\n\t\tif len((*ledgerLst)[0].BlockchainObj) == len(ledgerObj.BlockchainObj) {\n\t\t\tbody := \"Dear admin ,the lists of blocks are not identical in servers with soket ip \" + strings.Join(lstSoket, \" , \") + \" deffirence in \" + objSoket\n\t\t\tfor i := 0; i < len(ledgerObj.AdminObj); i++ {\n\t\t\t\tfmt.Println(body)\n\t\t\t\tsendEmail(body, ledgerObj.AdminObj[i].AdminEmail)\n\t\t\t}\n\t\t} else if len((*ledgerLst)[0].BlockchainObj) > len(ledgerObj.BlockchainObj) {\n\t\t\tdiff := len((*ledgerLst)[0].BlockchainObj) - len(ledgerObj.BlockchainObj)\n\n\t\t\tfor i := diff; i > 0; i-- {\n\t\t\t\ttcp.SendObject((*ledgerLst)[0].BlockchainObj[len((*ledgerLst)[0].BlockchainObj)-i], objPublicKey, \"AddBlock\", \"block\", objSoket)\n\t\t\t\tledgerObj.BlockchainObj = append(ledgerObj.BlockchainObj, (*ledgerLst)[0].BlockchainObj[len((*ledgerLst)[0].BlockchainObj)-i])\n\n\t\t\t\tif len((*ledgerLst)[0].BlockchainObj[len((*ledgerLst)[0].BlockchainObj)-i].BlockTransactions) > 0 {\n\t\t\t\t\tfmt.Println(\"first senario\")\n\t\t\t\t\tfor m := 0; m < len((*ledgerLst)[0].BlockchainObj[len((*ledgerLst)[0].BlockchainObj)-i].BlockTransactions); m++ {\n\t\t\t\t\t\ttcp.SendObject((*ledgerLst)[0].BlockchainObj[len((*ledgerLst)[0].BlockchainObj)-i].BlockTransactions[m], objPublicKey, \"AddTransaction\", \"transaction\", objSoket)\n\t\t\t\t\t\tledgerObj.TransactionLstObj = append(ledgerObj.TransactionLstObj, (*ledgerLst)[0].BlockchainObj[len((*ledgerLst)[0].BlockchainObj)-i].BlockTransactions[m])\n\t\t\t\t\t\tfmt.Println(\"first senario0000001112121212121121121\")\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Println(\" block is wrong\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t} else {\n\t\t\tfmt.Println(\"second senario\")\n\t\t\tdiff := len(ledgerObj.BlockchainObj) - len((*ledgerLst)[0].BlockchainObj)\n\n\t\t\tfor i := diff; i > 0; i-- {\n\t\t\t\tfor j := 0; j < len(*ledgerLst); j++ {\n\t\t\t\t\ttcp.SendObject(ledgerObj.BlockchainObj[len(ledgerObj.BlockchainObj)-i], lstPublicKey[j], \"AddBlock\", \"block\", lstSoket[j])\n\t\t\t\t\t(*ledgerLst)[j].BlockchainObj = append((*ledgerLst)[j].BlockchainObj, ledgerObj.BlockchainObj[len(ledgerObj.BlockchainObj)-i])\n\t\t\t\t\tif len(ledgerObj.BlockchainObj[len(ledgerObj.BlockchainObj)-i].BlockTransactions) > 0 {\n\t\t\t\t\t\tfor m := 0; m < len(ledgerObj.BlockchainObj[len(ledgerObj.BlockchainObj)-i].BlockTransactions); m++ {\n\t\t\t\t\t\t\ttcp.SendObject(ledgerObj.BlockchainObj[len(ledgerObj.BlockchainObj)-i].BlockTransactions[m], lstPublicKey[j], \"AddTransaction\", \"transaction\", lstSoket[j])\n\t\t\t\t\t\t\t(*ledgerLst)[j].TransactionLstObj = append((*ledgerLst)[j].TransactionLstObj, ledgerObj.BlockchainObj[len(ledgerObj.BlockchainObj)-i].BlockTransactions[m])\n\t\t\t\t\t\t\t//if err != nil {\n\t\t\t\t\t\t\t//\tfmt.Println(\"append block transaction fail\")\n\t\t\t\t\t\t\t//}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Println(\" block is wrong\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "11efa34d123e7d274e61cbd86e9767bc", "score": "0.43366173", "text": "func TestBlockHeader(t *testing.T) {\n\tnonce64, err := RandomUint64()\n\tif err != nil {\n\t\tt.Errorf(\"RandomUint64: Error generating nonce: %v\", err)\n\t}\n\tnonce := uint32(nonce64)\n\n\thash := mainNetGenesisHash\n\tmerkleHash := mainNetGenesisMerkleRoot\n\tbits := uint32(0x1d00ffff)\n\tbh := NewBlockHeader(1, &hash, &merkleHash, bits, nonce)\n\n\t// Ensure we get the same data back out.\n\tif !bh.PrevBlock.IsEqual(&hash) {\n\t\tt.Errorf(\"NewBlockHeader: wrong prev hash - got %v, want %v\",\n\t\t\tspew.Sprint(bh.PrevBlock), spew.Sprint(hash))\n\t}\n\tif !bh.MerkleRoot.IsEqual(&merkleHash) {\n\t\tt.Errorf(\"NewBlockHeader: wrong merkle root - got %v, want %v\",\n\t\t\tspew.Sprint(bh.MerkleRoot), spew.Sprint(merkleHash))\n\t}\n\tif bh.Bits != bits {\n\t\tt.Errorf(\"NewBlockHeader: wrong bits - got %v, want %v\",\n\t\t\tbh.Bits, bits)\n\t}\n\tif bh.Nonce != nonce {\n\t\tt.Errorf(\"NewBlockHeader: wrong nonce - got %v, want %v\",\n\t\t\tbh.Nonce, nonce)\n\t}\n}", "title": "" }, { "docid": "3a44a6d3813ae0d5d1e0c8241ee7bb31", "score": "0.43207872", "text": "func TestBlockHeaderWire(t *testing.T) {\n\tnonce := uint32(123123) // 0x1e0f3\n\tpver := uint32(70001)\n\n\t// baseBlockHdr is used in the various tests as a baseline BlockHeader.\n\tbits := uint32(0x1d00ffff)\n\tbaseBlockHdr := &BlockHeader{\n\t\tVersion: 1,\n\t\tPrevBlock: mainNetGenesisHash,\n\t\tMerkleRoot: mainNetGenesisMerkleRoot,\n\t\tTimestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST\n\t\tBits: bits,\n\t\tNonce: nonce,\n\t\tHashStateRoot: mainNetGenesisHashStateRoot,\n\t\tHashUTXORoot: mainNetGenesisHashUTXORoot,\n\t\tBlockSig: make([]byte, 0),\n\t}\n\n\t// baseBlockHdrEncoded is the wire encoded bytes of baseBlockHdr.\n\tbaseBlockHdrEncoded := []byte{\n\t\t0x01, 0x00, 0x00, 0x00, // Version 1\n\t\t0x6c, 0x98, 0xed, 0x82, 0x55, 0x5e, 0xf9, 0xe3,\n\t\t0xd6, 0x34, 0x83, 0xd9, 0x21, 0xfa, 0x6c, 0x09,\n\t\t0xc3, 0xf8, 0xe6, 0x8c, 0xae, 0xf8, 0x80, 0x35,\n\t\t0x85, 0xf2, 0x3c, 0xf8, 0xae, 0x75, 0x00, 0x00, // PrevBlock\n\t\t0x6d, 0xb9, 0x05, 0x14, 0x23, 0x82, 0x32, 0x4d,\n\t\t0xb4, 0x17, 0x76, 0x18, 0x91, 0xf2, 0xd2, 0xf3,\n\t\t0x55, 0xea, 0x92, 0xf2, 0x7a, 0xb0, 0xfc, 0x35,\n\t\t0xe5, 0x9e, 0x90, 0xb5, 0x0e, 0x05, 0x34, 0xed, // MerkleRoot\n\t\t0x29, 0xab, 0x5f, 0x49, // Timestamp\n\t\t0xff, 0xff, 0x00, 0x1d, // Bits\n\t\t0xf3, 0xe0, 0x01, 0x00, // Nonce\n\t\t0xe9, 0x65, 0xff, 0xd0, 0x02, 0xcd, 0x6a, 0xd0,\n\t\t0xe2, 0xdc, 0x40, 0x2b, 0x80, 0x44, 0xde, 0x83,\n\t\t0x3e, 0x06, 0xb2, 0x31, 0x27, 0xea, 0x8c, 0x3d,\n\t\t0x80, 0xae, 0xc9, 0x14, 0x10, 0x77, 0x14, 0x95, // staste root\n\t\t0x56, 0xe8, 0x1f, 0x17, 0x1b, 0xcc, 0x55, 0xa6,\n\t\t0xff, 0x83, 0x45, 0xe6, 0x92, 0xc0, 0xf8, 0x6e,\n\t\t0x5b, 0x48, 0xe0, 0x1b, 0x99, 0x6c, 0xad, 0xc0,\n\t\t0x01, 0x62, 0x2f, 0xb5, 0xe3, 0x63, 0xb4, 0x21, // utxo root\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, 0x00, 0x00, 0x00, 0x00,\n\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // prevout stake\n\t\t0x00, 0x00, 0x00, 0x00, // prevout N\n\t\t0x00, // BlockSig\n\t}\n\n\ttests := []struct {\n\t\tin *BlockHeader // Data to encode\n\t\tout *BlockHeader // Expected decoded data\n\t\tbuf []byte // Wire encoding\n\t\tpver uint32 // Protocol version for wire encoding\n\t\tenc MessageEncoding // Message encoding variant to use\n\t}{\n\t\t// Latest protocol version.\n\t\t{\n\t\t\tbaseBlockHdr,\n\t\t\tbaseBlockHdr,\n\t\t\tbaseBlockHdrEncoded,\n\t\t\tProtocolVersion,\n\t\t\tBaseEncoding,\n\t\t},\n\n\t\t// Protocol version BIP0035Version.\n\t\t{\n\t\t\tbaseBlockHdr,\n\t\t\tbaseBlockHdr,\n\t\t\tbaseBlockHdrEncoded,\n\t\t\tBIP0035Version,\n\t\t\tBaseEncoding,\n\t\t},\n\n\t\t// Protocol version BIP0031Version.\n\t\t{\n\t\t\tbaseBlockHdr,\n\t\t\tbaseBlockHdr,\n\t\t\tbaseBlockHdrEncoded,\n\t\t\tBIP0031Version,\n\t\t\tBaseEncoding,\n\t\t},\n\n\t\t// Protocol version NetAddressTimeVersion.\n\t\t{\n\t\t\tbaseBlockHdr,\n\t\t\tbaseBlockHdr,\n\t\t\tbaseBlockHdrEncoded,\n\t\t\tNetAddressTimeVersion,\n\t\t\tBaseEncoding,\n\t\t},\n\n\t\t// Protocol version MultipleAddressVersion.\n\t\t{\n\t\t\tbaseBlockHdr,\n\t\t\tbaseBlockHdr,\n\t\t\tbaseBlockHdrEncoded,\n\t\t\tMultipleAddressVersion,\n\t\t\tBaseEncoding,\n\t\t},\n\t}\n\n\tt.Logf(\"Running %d tests\", len(tests))\n\tfor i, test := range tests {\n\t\t// Encode to wire format.\n\t\tvar buf bytes.Buffer\n\t\terr := writeBlockHeader(&buf, test.pver, test.in)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"writeBlockHeader #%d error %v\", i, err)\n\t\t\tcontinue\n\t\t}\n\t\tif !bytes.Equal(buf.Bytes(), test.buf) {\n\t\t\tt.Errorf(\"writeBlockHeader #%d\\n got: %s want: %s\", i,\n\t\t\t\tspew.Sdump(buf.Bytes()), spew.Sdump(test.buf))\n\t\t\tcontinue\n\t\t}\n\n\t\tbuf.Reset()\n\t\terr = test.in.BtcEncode(&buf, pver, 0)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"BtcEncode #%d error %v\", i, err)\n\t\t\tcontinue\n\t\t}\n\t\tif !bytes.Equal(buf.Bytes(), test.buf) {\n\t\t\tt.Errorf(\"BtcEncode #%d\\n got: %s want: %s\", i,\n\t\t\t\tspew.Sdump(buf.Bytes()), spew.Sdump(test.buf))\n\t\t\tcontinue\n\t\t}\n\n\t\t// Decode the block header from wire format.\n\t\tvar bh BlockHeader\n\t\trbuf := bytes.NewReader(test.buf)\n\t\terr = readBlockHeader(rbuf, test.pver, &bh)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"readBlockHeader #%d error %v\", i, err)\n\t\t\tcontinue\n\t\t}\n\t\tif !reflect.DeepEqual(&bh, test.out) {\n\t\t\tt.Errorf(\"readBlockHeader #%d\\n got: %s want: %s\", i,\n\t\t\t\tspew.Sdump(&bh), spew.Sdump(test.out))\n\t\t\tcontinue\n\t\t}\n\n\t\trbuf = bytes.NewReader(test.buf)\n\t\terr = bh.BtcDecode(rbuf, pver, test.enc)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"BtcDecode #%d error %v\", i, err)\n\t\t\tcontinue\n\t\t}\n\t\tif !reflect.DeepEqual(&bh, test.out) {\n\t\t\tt.Errorf(\"BtcDecode #%d\\n got: %s want: %s\", i,\n\t\t\t\tspew.Sdump(&bh), spew.Sdump(test.out))\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cfd3b964ab19be70abd30768b9a9da78", "score": "0.43207836", "text": "func RequireSignedTestBlockFromTipSet(t *testing.T, baseTipSet types.TipSet, stateRootCid cid.Cid, receiptRootCid cid.Cid, height abi.ChainEpoch, minerAddr address.Address, minerWorker address.Address, signer types.Signer) *types.BlockHeader {\n\tticket := consensus.MakeFakeTicketForTest()\n\temptyBLSSig := crypto.Signature{\n\t\tType: crypto.SigTypeBLS,\n\t\tData: (*bls.Aggregate([]bls.Signature{}))[:],\n\t}\n\n\tb := &types.BlockHeader{\n\t\tMiner: minerAddr,\n\t\tTicket: ticket,\n\t\tParents: baseTipSet.Key(),\n\t\tParentWeight: fbig.NewInt(int64(height * 10000)),\n\t\tHeight: height,\n\t\tParentStateRoot: stateRootCid,\n\t\tParentMessageReceipts: receiptRootCid,\n\t\tBLSAggregate: &emptyBLSSig,\n\t}\n\tsig, err := signer.SignBytes(context.TODO(), b.SignatureData(), minerWorker)\n\trequire.NoError(t, err)\n\tb.BlockSig = sig\n\n\treturn b\n}", "title": "" }, { "docid": "0c3fb8df8fd6e7ca0240b50a916024e6", "score": "0.43091846", "text": "func MultipleWrongFirst(URL string, postData string, contentType string, HTTPv string, path string, method string) []bool {\n\tfmt.Println(\"Checking for priority in CL headers...\")\n\tr := TCPeditor{}\n\tr.Server = URL\n\tr.Host = URL\n\tr.Method = method\n\tr.Path = path\n\tr.HttpVersion = HTTPv\n\tr.Body = postData\n\tr.Headers = []string{\"Content-Type: \" + contentType, \"Content-Length: 1\", \"Content-Length: \" + strconv.Itoa(len(postData))}\n\n\tsc, res := r.MakeRequest()\n\tdefer fmt.Println(\"Done...\")\n\tif sc == \"200\" {\n\t\tif strings.Contains(res, \"input2=Testing, input3=Fuzzer\") {\n\t\t\treturn []bool{true, true}\n\t\t}\n\t}\n\treturn []bool{false, HitsServer(sc, res)}\n}", "title": "" }, { "docid": "58133a97281a23d5f0e5a8f10a8260f5", "score": "0.43079978", "text": "func TestUnMarshal(t *testing.T) {\n\tassert := assert.New(t)\n\theader1 := header.Header{}\n\theader1.PubKeyBLS, _ = crypto.RandEntropy(129)\n\theader1.Round = uint64(5)\n\theader1.Step = uint8(2)\n\theader1.BlockHash, _ = crypto.RandEntropy(32)\n\n\tbuf := new(bytes.Buffer)\n\tassert.NoError(header.Marshal(buf, header1))\n\n\theader2 := header.Header{}\n\tassert.NoError(header.Unmarshal(buf, &header2))\n\n\tassert.True(header1.Equal(header2))\n}", "title": "" }, { "docid": "1a65e60327c1f4114aeea638dbf3a374", "score": "0.4306039", "text": "func (node *Node) BroadcastCrossLinkHeader(newBlock *types.Block) {\n\tutils.Logger().Info().Msgf(\"Broadcasting new header to beacon chain groupID %s\", node.NodeConfig.GetBeaconGroupID())\n\tlastThreeHeaders := []*types.Header{}\n\n\tblock := node.Blockchain().GetBlockByNumber(newBlock.NumberU64() - 2)\n\tif block != nil {\n\t\tlastThreeHeaders = append(lastThreeHeaders, block.Header())\n\t}\n\tblock = node.Blockchain().GetBlockByNumber(newBlock.NumberU64() - 1)\n\tif block != nil {\n\t\tlastThreeHeaders = append(lastThreeHeaders, block.Header())\n\t}\n\tlastThreeHeaders = append(lastThreeHeaders, newBlock.Header())\n\n\tnode.host.SendMessageToGroups([]p2p.GroupID{node.NodeConfig.GetBeaconGroupID()}, host.ConstructP2pMessage(byte(0), proto_node.ConstructCrossLinkHeadersMessage(lastThreeHeaders)))\n}", "title": "" }, { "docid": "a7052c168bd41268c1c0f2acb12b8869", "score": "0.43029192", "text": "func (chain *BlockChain) LocateForkPointAndFetchHeaders(hashes []*crypto.HashType) ([]*crypto.HashType, error) {\n\ttailHeight := chain.tail.Header.Height\n\tfor index := range hashes {\n\t\tblock, err := LoadBlockByHash(*hashes[index], chain.db)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\t// Important: make sure the block is on main chain !!!\n\t\tb, _ := chain.LoadBlockByHeight(block.Header.Height)\n\t\tif !b.BlockHash().IsEqual(block.BlockHash()) {\n\t\t\tcontinue\n\t\t}\n\n\t\tresult := []*crypto.HashType{}\n\t\tcurrentHeight := block.Header.Height + 1\n\t\tif tailHeight-block.Header.Height+1 < MaxBlocksPerSync {\n\t\t\tfor currentHeight <= tailHeight {\n\t\t\t\tblock, err := chain.LoadBlockByHeight(currentHeight)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tresult = append(result, block.BlockHash())\n\t\t\t\tcurrentHeight++\n\t\t\t}\n\t\t\treturn result, nil\n\t\t}\n\n\t\tvar idx uint32\n\t\tfor idx < MaxBlocksPerSync {\n\t\t\tblock, err := chain.LoadBlockByHeight(currentHeight + idx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresult = append(result, block.BlockHash())\n\t\t\tidx++\n\t\t}\n\t\treturn result, nil\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "10d804f99644ad72a126b9e363444cbc", "score": "0.42866495", "text": "func TestRFC6979Compat(t *testing.T) {\n\t// Test vectors matching Trezor and CoreBitcoin implementations.\n\t// - https://github.com/trezor/trezor-crypto/blob/9fea8f8ab377dc514e40c6fd1f7c89a74c1d8dc6/tests.c#L432-L453\n\t// - https://github.com/oleganza/CoreBitcoin/blob/e93dd71207861b5bf044415db5fa72405e7d8fbc/CoreBitcoin/BTCKey%2BTests.m#L23-L49\n\ttests := []struct {\n\t\tkey string\n\t\tmsg string\n\t\tnonce string\n\t\tsignature string\n\t}{{\n\t\t\"cca9fbcc1b41e5a95d369eaa6ddcff73b61a4efaa279cfc6567e8daa39cbaf50\",\n\t\t\"sample\",\n\t\t\"2df40ca70e639d89528a6b670d9d48d9165fdc0febc0974056bdce192b8e16a3\",\n\t\t\"3045022100af340daf02cc15c8d5d08d7735dfe6b98a474ed373bdb5fbecf7571be52b384202205009fb27f37034a9b24b707b7c6b79ca23ddef9e25f7282e8a797efe53a8f124\",\n\t}, {\n\t\t// This signature hits the case when S is higher than halforder.\n\t\t// If S is not canonicalized (lowered by halforder), this test will fail.\n\t\t\"0000000000000000000000000000000000000000000000000000000000000001\",\n\t\t\"Satoshi Nakamoto\",\n\t\t\"8f8a276c19f4149656b280621e358cce24f5f52542772691ee69063b74f15d15\",\n\t\t\"3045022100934b1ea10a4b3c1757e2b0c017d0b6143ce3c9a7e6a4a49860d7a6ab210ee3d802202442ce9d2b916064108014783e923ec36b49743e2ffa1c4496f01a512aafd9e5\",\n\t}, {\n\t\t\"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140\",\n\t\t\"Satoshi Nakamoto\",\n\t\t\"33a19b60e25fb6f4435af53a3d42d493644827367e6453928554f43e49aa6f90\",\n\t\t\"3045022100fd567d121db66e382991534ada77a6bd3106f0a1098c231e47993447cd6af2d002206b39cd0eb1bc8603e159ef5c20a5c8ad685a45b06ce9bebed3f153d10d93bed5\",\n\t}, {\n\t\t\"f8b8af8ce3c7cca5e300d33939540c10d45ce001b8f252bfbc57ba0342904181\",\n\t\t\"Alan Turing\",\n\t\t\"525a82b70e67874398067543fd84c83d30c175fdc45fdeee082fe13b1d7cfdf1\",\n\t\t\"304402207063ae83e7f62bbb171798131b4a0564b956930092b33b07b395615d9ec7e15c022058dfcc1e00a35e1572f366ffe34ba0fc47db1e7189759b9fb233c5b05ab388ea\",\n\t}, {\n\t\t\"0000000000000000000000000000000000000000000000000000000000000001\",\n\t\t\"All those moments will be lost in time, like tears in rain. Time to die...\",\n\t\t\"38aa22d72376b4dbc472e06c3ba403ee0a394da63fc58d88686c611aba98d6b3\",\n\t\t\"30450221008600dbd41e348fe5c9465ab92d23e3db8b98b873beecd930736488696438cb6b0220547fe64427496db33bf66019dacbf0039c04199abb0122918601db38a72cfc21\",\n\t}, {\n\t\t\"e91671c46231f833a6406ccbea0e3e392c76c167bac1cb013f6f1013980455c2\",\n\t\t\"There is a computer disease that anybody who works with computers knows about. It's a very serious disease and it interferes completely with the work. The trouble with computers is that you 'play' with them!\",\n\t\t\"1f4b84c23a86a221d233f2521be018d9318639d5b8bbd6374a8a59232d16ad3d\",\n\t\t\"3045022100b552edd27580141f3b2a5463048cb7cd3e047b97c9f98076c32dbdf85a68718b0220279fa72dd19bfae05577e06c7c0c1900c371fcd5893f7e1d56a37d30174671f6\",\n\t}}\n\n\tfor i, test := range tests {\n\t\tprivKey := hexToBytes(test.key)\n\t\thash := sha256.Sum256([]byte(test.msg))\n\n\t\t// Ensure deterministically generated nonce is the expected value.\n\t\tgotNonce := NonceRFC6979(privKey, hash[:], nil, nil, 0)\n\t\twantNonce := hexToBytes(test.nonce)\n\t\tgotNonceBytes := gotNonce.Bytes()\n\t\tif !bytes.Equal(gotNonceBytes[:], wantNonce) {\n\t\t\tt.Errorf(\"NonceRFC6979 #%d (%s): Nonce is incorrect: \"+\n\t\t\t\t\"%x (expected %x)\", i, test.msg, gotNonce,\n\t\t\t\twantNonce)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Ensure deterministically generated signature is the expected value.\n\t\tgotSig := PrivKeyFromBytes(privKey).Sign(hash[:])\n\t\tgotSigBytes := gotSig.Serialize()\n\t\twantSigBytes := hexToBytes(test.signature)\n\t\tif !bytes.Equal(gotSigBytes, wantSigBytes) {\n\t\t\tt.Errorf(\"Sign #%d (%s): mismatched signature: %x (expected %x)\", i,\n\t\t\t\ttest.msg, gotSigBytes, wantSigBytes)\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6a168a8d950689294b90a169608b5d05", "score": "0.4282174", "text": "func (w *Wallet) ValidateHeaderChainDifficulties(ctx context.Context, chain []*BlockNode, idx int) ([]*BlockNode, error) {\n\tvar invalid []*BlockNode\n\terr := walletdb.View(ctx, w.db, func(dbtx walletdb.ReadTx) error {\n\t\tvar err error\n\t\tinvalid, err = w.validateHeaderChainDifficulties(dbtx, chain, idx)\n\t\treturn err\n\t})\n\treturn invalid, err\n}", "title": "" }, { "docid": "09c02e4515552f609edd607896c74ff0", "score": "0.42597342", "text": "func TestBinGossiper_Contention_Single_Block_Consensus(t *testing.T) {\n\tname1 := \"test1.txt\"\n\tname2 := \"test2.txt\"\n\n\tcontent1 := []byte{0xAA}\n\tcontent2 := []byte{0xBB}\n\n\tvar metaHash1 []byte\n\tvar metaHash2 []byte\n\n\t// Compute the metahash\n\th := sha256.New()\n\th.Write(content1)\n\tchunk := h.Sum(nil)\n\n\th = sha256.New()\n\th.Write(chunk)\n\tmetaHash1 = h.Sum(nil)\n\n\th = sha256.New()\n\th.Write(content2)\n\tchunk = h.Sum(nil)\n\n\th = sha256.New()\n\th.Write(chunk)\n\tmetaHash2 = h.Sum(nil)\n\n\tnA := createAndStartNode(t, \"NA\", WithNodeIndex(0), WithNumParticipants(5), WithAntiEntropy(1))\n\tnB := createAndStartBinNode(t, \"NB\", WithNodeIndex(1), WithNumParticipants(5), WithAntiEntropy(1))\n\tnC := createAndStartBinNode(t, \"NC\", WithNodeIndex(2), WithNumParticipants(5), WithAntiEntropy(1))\n\tnD := createAndStartBinNode(t, \"ND\", WithNodeIndex(3), WithNumParticipants(5), WithAntiEntropy(1))\n\tnE := createAndStartBinNode(t, \"NE\", WithNodeIndex(4), WithNumParticipants(5), WithAntiEntropy(1))\n\n\tdefer stopNodes(&nA, &nB, &nC, &nD, &nE)\n\n\tnodes := map[string]nodeInfo{\n\t\t\"A\": nA, \"B\": nB, \"C\": nC, \"D\": nD, \"E\": nE,\n\t}\n\n\tlb := newLinkBuilder(nodes)\n\tlb.connectAll()\n\n\tnA.addFile(t, name1, content1)\n\tnB.addFile(t, name2, content2)\n\n\tgo nA.gossiper.IndexShares(name1)\n\tgo nB.gossiper.IndexShares(name2)\n\n\ttime.Sleep(time.Second * 2)\n\n\taLast, aChain := nA.gossiper.GetBlocks()\n\tbLast, bChain := nB.gossiper.GetBlocks()\n\tcLast, cChain := nC.gossiper.GetBlocks()\n\tdLast, dChain := nD.gossiper.GetBlocks()\n\teLast, eChain := nE.gossiper.GetBlocks()\n\n\tgetFirst := func(last string, chain map[string]types.Block) (types.Block, bool) {\n\t\tif last == \"\" {\n\t\t\treturn types.Block{}, false\n\t\t}\n\n\t\tfor {\n\t\t\tblock := chain[last]\n\t\t\tif block.BlockNumber == 0 {\n\t\t\t\treturn block, true\n\t\t\t}\n\n\t\t\tlast = hex.EncodeToString(block.PreviousHash)\n\t\t}\n\t}\n\n\tmergeChain := func(block types.Block, chainCount map[string]int, chainMerged map[string]types.Block) {\n\t\tkey := hex.EncodeToString(block.Hash())\n\n\t\t_, ok := chainCount[key]\n\t\tif !ok {\n\t\t\tchainCount[key] = 0\n\t\t}\n\n\t\tchainCount[key]++\n\t\tchainMerged[key] = block\n\t}\n\n\tcountBlocks := map[string]int{}\n\tmergedBlocks := map[string]types.Block{}\n\n\taFirst, ok := getFirst(aLast, aChain)\n\tif ok {\n\t\tmergeChain(aFirst, countBlocks, mergedBlocks)\n\t}\n\n\tbFirst, ok := getFirst(bLast, bChain)\n\tif ok {\n\t\tmergeChain(bFirst, countBlocks, mergedBlocks)\n\t}\n\n\tcFirst, ok := getFirst(cLast, cChain)\n\tif ok {\n\t\tmergeChain(cFirst, countBlocks, mergedBlocks)\n\t}\n\n\tdFirst, ok := getFirst(dLast, dChain)\n\tif ok {\n\t\tmergeChain(dFirst, countBlocks, mergedBlocks)\n\t}\n\n\teFirst, ok := getFirst(eLast, eChain)\n\tif ok {\n\t\tmergeChain(eFirst, countBlocks, mergedBlocks)\n\t}\n\n\t// There should be at least one block with a count of 3\n\n\tthreeFound := false\n\tkeyFound := \"\"\n\tfor k, v := range countBlocks {\n\t\tif v >= 3 {\n\t\t\tthreeFound = true\n\t\t\tkeyFound = k\n\t\t}\n\t}\n\n\trequire.True(t, threeFound)\n\n\t// We check that the block with at least three occurrences is the expected\n\t// one.\n\n\tblock1 := types.Block{\n\t\tBlockNumber: 0,\n\t\tFilename: name1,\n\t\tMetahash: metaHash1,\n\t\tPreviousHash: make([]byte, 32),\n\t}\n\n\tblock2 := types.Block{\n\t\tBlockNumber: 0,\n\t\tFilename: name2,\n\t\tMetahash: metaHash2,\n\t\tPreviousHash: make([]byte, 32),\n\t}\n\n\tallPotentialBlocks := []types.Block{\n\t\tblock1,\n\t\tblock2,\n\t}\n\n\trequire.True(t, threeFound)\n\trequire.Contains(t, allPotentialBlocks, mergedBlocks[keyFound])\n}", "title": "" }, { "docid": "cc21fdf11e08091e3e2a7befc5d60fc8", "score": "0.4256273", "text": "func TestRefCounterLoadInvalidHeader(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\tt.Parallel()\n\n\t// prepare\n\tcid := types.FileContractID(crypto.HashBytes([]byte(\"contractId\")))\n\td := build.TempDir(t.Name())\n\terr := os.MkdirAll(d, modules.DefaultDirPerm)\n\tif err != nil {\n\t\tt.Fatal(\"Failed to create test directory:\", err)\n\t}\n\tpath := filepath.Join(d, cid.String()+refCounterExtension)\n\n\t// Create a file that contains a corrupted header. This basically means\n\t// that the file is too short to have the entire header in there.\n\tf, err := os.Create(path)\n\tif err != nil {\n\t\tt.Fatal(\"Failed to create test file:\", err)\n\t}\n\n\t// The version number is 8 bytes. We'll only write 4.\n\tif _, err = f.Write(fastrand.Bytes(4)); err != nil {\n\t\terr = errors.Compose(err, f.Close())\n\t\tt.Fatal(\"Failed to write to test file:\", err)\n\t}\n\tif err := f.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Make sure we fail to load from that file and that we fail with the right\n\t// error\n\t_, err = loadRefCounter(path, testWAL)\n\tif !errors.Contains(err, io.EOF) {\n\t\tt.Fatal(fmt.Sprintf(\"Should not be able to read file with bad header, expected `%s` error, got:\", io.EOF.Error()), err)\n\t}\n}", "title": "" }, { "docid": "5a02dc139d04b60b3929150a95cacb7e", "score": "0.42228338", "text": "func testFork(t *testing.T, LightChain *LightChain, i, n int, comparator func(td1, td2 *big.Int)) {\n\t// Copy old chain up to #i into a new db\n\tdb, LightChain2, err := newCanonical(i)\n\tif err != nil {\n\t\tt.Fatal(\"could not make new canonical in testFork\", err)\n\t}\n\t// Assert the chains have the same header/block at #i\n\tvar hash1, hash2 common.Hash\n\thash1 = LightChain.GetHeaderByNumber(uint64(i)).Hash()\n\thash2 = LightChain2.GetHeaderByNumber(uint64(i)).Hash()\n\tif hash1 != hash2 {\n\t\tt.Errorf(\"chain content mismatch at %d: have hash %v, want hash %v\", i, hash2, hash1)\n\t}\n\t// Extend the newly created chain\n\theaderChainB := makeHeaderChain(LightChain2.CurrentHeader(), n, db, forkSeed)\n\tif _, err := LightChain2.InsertHeaderChain(headerChainB, 1); err != nil {\n\t\tt.Fatalf(\"failed to insert forking chain: %v\", err)\n\t}\n\t// Sanity check that the forked chain can be imported into the original\n\tvar tdPre, tdPost *big.Int\n\n\ttdPre = LightChain.GetTdByHash(LightChain.CurrentHeader().Hash())\n\tif err := testHeaderChainImport(headerChainB, LightChain); err != nil {\n\t\tt.Fatalf(\"failed to import forked header chain: %v\", err)\n\t}\n\ttdPost = LightChain.GetTdByHash(headerChainB[len(headerChainB)-1].Hash())\n\t// Compare the total difficulties of the chains\n\tcomparator(tdPre, tdPost)\n}", "title": "" }, { "docid": "8c0958349f500e548a792546ac880b63", "score": "0.42184836", "text": "func (chain *FakeChain) AddHeaders(...*block.Header) error {\n\tpanic(\"TODO\")\n}", "title": "" }, { "docid": "d0cbeb14dae39c71ee423c68d830a8d7", "score": "0.42090046", "text": "func TestHeadEvents(t *testing.T) {\n\ttf.UnitTest(t)\n\n\tctx := context.Background()\n\tbuilder := chain.NewBuilder(t, address.Undef)\n\tgenTS := builder.Genesis()\n\tchainStore := newChainStore(builder.Repo(), genTS)\n\t// Construct test chain data\n\tlink1 := builder.AppendOn(ctx, genTS, 2)\n\tlink2 := builder.AppendOn(ctx, link1, 3)\n\tlink3 := builder.AppendOn(ctx, link2, 1)\n\tlink4 := builder.BuildOn(ctx, link3, 2, func(bb *chain.BlockBuilder, i int) { bb.IncHeight(2) })\n\tchA := chainStore.Store.SubHeadChanges(ctx)\n\tchB := chainStore.Store.SubHeadChanges(ctx)\n\t// HCurrent\n\t<-chA\n\t<-chB\n\n\tdefer ctx.Done()\n\n\theadSets := []*types.TipSet{genTS, link1, link2, link3, link4, link3, link2, link1, genTS}\n\theads := []*types.TipSet{genTS, link1, link2, link3, link4, link4, link3, link2, link1}\n\ttypes := []types.HeadChangeType{\n\t\ttypes.HCApply, types.HCApply, types.HCApply, types.HCApply, types.HCApply, types.HCRevert,\n\t\ttypes.HCRevert, types.HCRevert, types.HCRevert,\n\t}\n\twaitAndCheck := func(index int) {\n\t\theadA := <-chA\n\t\theadB := <-chB\n\t\tassert.Equal(t, headA[0].Type, types[index])\n\t\ttest.Equal(t, headA, headB)\n\t\ttest.Equal(t, headA[0].Val, heads[index])\n\t}\n\n\t// Heads arrive in the expected order\n\tfor i := 0; i < 9; i++ {\n\t\tassertSetHead(t, chainStore, headSets[i])\n\t\twaitAndCheck(i)\n\t}\n\t// No extra notifications\n\tassertEmptyCh(t, chA)\n\tassertEmptyCh(t, chB)\n}", "title": "" }, { "docid": "ea1b817a13de6ce6080944a6296bbb52", "score": "0.42065415", "text": "func checkTendermintMisbehaviour(\n\tctx context.Context,\n\tclientID string,\n\tproposedHeader *tmclient.Header,\n\tcachedHeader IBCHeader,\n\tcounterparty ChainProvider,\n) (ibcexported.ClientMessage, error) {\n\tvar (\n\t\ttrustedHeader *tmclient.Header\n\t\terr error\n\t)\n\n\tif cachedHeader == nil {\n\t\theader, err := counterparty.QueryIBCHeader(ctx, proposedHeader.Header.Height)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttmHeader, ok := header.(TendermintIBCHeader)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"failed to check for misbehaviour, expected %T, got %T\", (*TendermintIBCHeader)(nil), header)\n\t\t}\n\n\t\ttrustedHeader, err = tmHeader.TMHeader()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\ttrustedHeader, err = cachedHeader.(TendermintIBCHeader).TMHeader()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif isMatchingTendermintConsensusState(proposedHeader.ConsensusState(), trustedHeader.ConsensusState()) {\n\t\treturn nil, nil\n\t}\n\n\t// When we queried the light block in QueryIBCHeader we did not have the TrustedHeight or TrustedValidators,\n\t// it is the relayer's responsibility to inject these trusted fields i.e. we need a height < the proposed headers height.\n\t// The TrustedHeight is the height of a stored ConsensusState on the client that will be used to verify the new untrusted header.\n\t// The Trusted ConsensusState must be within the unbonding period of current time in order to correctly verify,\n\t// and the TrustedValidators must hash to TrustedConsensusState.NextValidatorsHash since that is the last trusted\n\t// validator set at the TrustedHeight.\n\ttrustedHeader.TrustedValidators = proposedHeader.TrustedValidators\n\ttrustedHeader.TrustedHeight = proposedHeader.TrustedHeight\n\n\treturn tmclient.NewMisbehaviour(clientID, proposedHeader, trustedHeader), nil\n}", "title": "" }, { "docid": "f4aeb9108260ee48d68c428433503185", "score": "0.42050716", "text": "func TestHeadersEmtKV(t *testing.T) {\n\twh := Headers{\"a\", \"b\", \"c\", \"d\"} // work headers\n\tek := Headers{\"a\", \"b\", \"\", \"d\"} // empty key\n\tev := Headers{\"a\", \"\", \"c\", \"d\"} // empty value\n\t//\n\te := checkHeaders(wh, SPL_10)\n\tif e != nil {\n\t\tt.Fatalf(\"CHD01 Expected [nil], got [%v]\\n\", e)\n\t}\n\te = checkHeaders(wh, SPL_11)\n\tif e != nil {\n\t\tt.Fatalf(\"CHD02 Expected [nil], got [%v]\\n\", e)\n\t}\n\t//\n\te = checkHeaders(ek, SPL_10)\n\tif e != EHDRMTK {\n\t\tt.Fatalf(\"CHD03 Expected [%v], got [%v]\\n\", EHDRMTK, e)\n\t}\n\te = checkHeaders(ek, SPL_11)\n\tif e != EHDRMTK {\n\t\tt.Fatalf(\"CHD04 Expected [%v], got [%v]\\n\", EHDRMTK, e)\n\t}\n\t//\n\te = checkHeaders(ev, SPL_10)\n\tif e != EHDRMTV {\n\t\tt.Fatalf(\"CHD05 Expected [%v], got [%v]\\n\", EHDRMTV, e)\n\t}\n\te = checkHeaders(ev, SPL_11)\n\tif e != nil {\n\t\tt.Fatalf(\"CHD06 Expected [nil], got [%v]\\n\", e)\n\t}\n}", "title": "" }, { "docid": "92fea03ac5f6e3944bf35099f9b8b23c", "score": "0.42030182", "text": "func CompareRequestsSummary(a RequestsSummary, b RequestsSummary) (c RequestsCompare, err error) {\n\tif len(a.LatencyHistogram) != len(b.LatencyHistogram) {\n\t\treturn RequestsCompare{}, fmt.Errorf(\"len(a.LatencyHistogram) %d != len(b.LatencyHistogram) %d\", len(a.LatencyHistogram), len(b.LatencyHistogram))\n\t}\n\n\tc = RequestsCompare{\n\t\tA: a,\n\t\tB: b,\n\t}\n\n\t// e.g. \"A\" 100, \"B\" 50 == -50%\n\t// e.g. \"A\" 50, \"B\" 100 == 100%\n\tdeltaP50 := float64(b.LantencyP50) - float64(a.LantencyP50)\n\tdeltaP50 /= float64(a.LantencyP50)\n\tdeltaP50 *= 100.0\n\tdeltaP50 = convertInvalid(deltaP50)\n\n\tdeltaP90 := float64(b.LantencyP90) - float64(a.LantencyP90)\n\tdeltaP90 /= float64(a.LantencyP90)\n\tdeltaP90 *= 100.0\n\tdeltaP90 = convertInvalid(deltaP90)\n\n\tdeltaP99 := float64(b.LantencyP99) - float64(a.LantencyP99)\n\tdeltaP99 /= float64(a.LantencyP99)\n\tdeltaP99 *= 100.0\n\tdeltaP99 = convertInvalid(deltaP99)\n\n\tdeltaP999 := float64(b.LantencyP999) - float64(a.LantencyP999)\n\tdeltaP999 /= float64(a.LantencyP999)\n\tdeltaP999 *= 100.0\n\tdeltaP999 = convertInvalid(deltaP999)\n\n\tdeltaP9999 := float64(b.LantencyP9999) - float64(a.LantencyP9999)\n\tdeltaP9999 /= float64(a.LantencyP9999)\n\tdeltaP9999 *= 100.0\n\tdeltaP9999 = convertInvalid(deltaP9999)\n\n\tc.LantencyP50DeltaPercent = deltaP50\n\tc.LantencyP90DeltaPercent = deltaP90\n\tc.LantencyP99DeltaPercent = deltaP99\n\tc.LantencyP999DeltaPercent = deltaP999\n\tc.LantencyP9999DeltaPercent = deltaP9999\n\n\treturn c, nil\n}", "title": "" }, { "docid": "8df49405a135aa3179dcfa22ac87f307", "score": "0.41987354", "text": "func (ps pricedSyscalls) VerifyConsensusFault(h1 []byte, h2 []byte, extra []byte) (*vmr.ConsensusFault, error) {\n\tps.chargeGas(ps.pl.OnVerifyConsensusFault())\n\tdefer ps.chargeGas(gasOnActorExec)\n\n\treturn ps.under.VerifyConsensusFault(h1, h2, extra)\n}", "title": "" }, { "docid": "099ed591c13be5558f72b8df13673739", "score": "0.41965425", "text": "func TestMissingHeaderAttack66Full(t *testing.T) { testMissingHeaderAttack(t, ent.ETH66, FullSync) }", "title": "" }, { "docid": "f1dc6bc4c140c76ffa13833d70901fcb", "score": "0.41877002", "text": "func verifyNoncesFromHeaders(checker validation.PoW, headers []*types.Header) (chan<- struct{}, <-chan nonceCheckResult) {\n\titems := make([]validation.Block, len(headers))\n\tfor i, header := range headers {\n\t\titems[i] = types.NewBlockWithHeader(header)\n\t}\n\treturn verifyNonces(checker, items)\n}", "title": "" }, { "docid": "17bc71055d9cc527435d340e5cc7ddd0", "score": "0.41828233", "text": "func ReadHeader(path string, lockMode LockMode) (*HeaderInfo, error) {\n\treleaseLock, err := acquireSharedLock(path, lockMode)\n\tif err != nil {\n\t\treturn nil, xerrors.Errorf(\"cannot acquire shared lock: %w\", err)\n\t}\n\tdefer releaseLock()\n\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\n\t// Try to decode and check the primary header\n\tprimaryHdr, primaryJSONData, primaryErr := decodeAndCheckHeader(f, 0, true)\n\tvar primaryMetadata Metadata\n\tif primaryErr == nil {\n\t\tif err := json.NewDecoder(primaryJSONData).Decode(&primaryMetadata); err != nil {\n\t\t\tprimaryErr = xerrors.Errorf(\"cannot decode JSON metadata area: %w\", err)\n\t\t}\n\t}\n\n\tvar secondaryHdr *binaryHdr\n\tvar secondaryJSONData *bytes.Buffer\n\tvar secondaryErr error\n\tif primaryErr != nil {\n\t\t// No valid primary header. Try to decode and check a secondary header from one of the\n\t\t// well known offsets (see Table 1: Possible LUKS2 secondary header offsets and JSON area\n\t\t// size in the LUKS2 On-Disk Format specification).\n\t\tfor _, off := range []int64{0x4000, 0x8000, 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000} {\n\t\t\tsecondaryHdr, secondaryJSONData, secondaryErr = decodeAndCheckHeader(f, off, false)\n\t\t\tif secondaryErr == nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// Try to decode and check the secondary header immediately after the primary header.\n\t\tsecondaryHdr, secondaryJSONData, secondaryErr = decodeAndCheckHeader(f, int64(primaryHdr.HdrSize), false)\n\t}\n\tvar secondaryMetadata Metadata\n\tif secondaryErr == nil {\n\t\tif err := json.NewDecoder(secondaryJSONData).Decode(&secondaryMetadata); err != nil {\n\t\t\tsecondaryErr = xerrors.Errorf(\"cannot decode JSON metadata area: %w\", err)\n\t\t}\n\t}\n\n\tvar hdr *binaryHdr\n\tvar metadata *Metadata\n\tswitch {\n\tcase primaryErr == nil && secondaryErr == nil:\n\t\t// Both headers are valid\n\t\thdr = primaryHdr\n\t\tmetadata = &primaryMetadata\n\t\tswitch {\n\t\tcase secondaryHdr.SeqId < primaryHdr.SeqId:\n\t\t\t// The secondary header is obsolete. Cryptsetup will recover this automatically.\n\t\t\tfmt.Fprintf(stderr, \"luks2.ReadHeader: secondary header for %s is obsolete\\n\", path)\n\t\tcase secondaryHdr.SeqId > primaryHdr.SeqId:\n\t\t\t// The primary header is obsolete, so use the secondary header. This shouldn't\n\t\t\t// normally happen as the primary header is updated first. Cryptsetup will recover\n\t\t\t// this automatically.\n\t\t\thdr = secondaryHdr\n\t\t\tmetadata = &secondaryMetadata\n\t\t\tfmt.Fprintf(stderr, \"luks2.ReadHeader: primary header for %s is obsolete\\n\", path)\n\t\t}\n\tcase primaryErr == nil:\n\t\t// We only have a valid primary header so use that. Cryptsetup will recover this automatically.\n\t\thdr = primaryHdr\n\t\tmetadata = &primaryMetadata\n\t\tfmt.Fprintf(stderr, \"luks2.ReadHeader: secondary header for %s is invalid: %v\\n\", path, secondaryErr)\n\tcase secondaryErr == nil:\n\t\t// We only have a valid secondary header so use that. Cryptsetup will recover this automatically.\n\t\thdr = secondaryHdr\n\t\tmetadata = &secondaryMetadata\n\t\tfmt.Fprintf(stderr, \"luks2.ReadHeader: primary header for %s is invalid: %v\\n\", path, primaryErr)\n\tdefault:\n\t\t// No valid headers :(\n\t\treturn nil, xerrors.Errorf(\"no valid header found, error from decoding primary header: %w\", primaryErr)\n\t}\n\n\treturn &HeaderInfo{\n\t\tHeaderSize: hdr.HdrSize,\n\t\tLabel: hdr.Label.String(),\n\t\tMetadata: *metadata}, nil\n}", "title": "" }, { "docid": "76bb85cbd9568dd101bb167fb193d654", "score": "0.4180818", "text": "func (v *blockValidator) ValidateHeaderInIsolation(stagingArea *model.StagingArea, blockHash *externalapi.DomainHash) error {\n\tonEnd := logger.LogAndMeasureExecutionTime(log, \"ValidateHeaderInIsolation\")\n\tdefer onEnd()\n\n\theader, err := v.blockHeaderStore.BlockHeader(v.databaseContext, stagingArea, blockHash)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !blockHash.Equal(v.genesisHash) {\n\t\terr = v.checkBlockVersion(header)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = v.checkBlockTimestampInIsolation(header)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = v.checkParentsLimit(header)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0a22d4798a8afc112cd1c4b6b48c9a40", "score": "0.417569", "text": "func (v *BlockValidator) ValidateBody(block *types.SnailBlock) error {\n\t// Check whether the block's known, and if not, that it's linkable\n\tif v.bc.HasBlockAndState(block.Hash(), block.NumberU64()) {\n\t\treturn ErrKnownBlock\n\t}\n\tif !v.bc.HasBlockAndState(block.ParentHash(), block.NumberU64()-1) {\n\t\tif !v.bc.HasBlock(block.ParentHash(), block.NumberU64()-1) {\n\t\t\treturn consensus.ErrUnknownAncestor\n\t\t}\n\t\treturn consensus.ErrPrunedAncestor\n\t}\n\t// Header validity is known at this point, check the uncles and transactions\n\t//header := block.Header()\n\tif err := v.engine.VerifySnailUncles(v.bc, block); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, fruit := range block.Fruits() {\n\t\tif err := v.ValidateFruit(fruit); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// TODO need add uncles or transaction at snail block 20180804\n\t/*\n\t\tif hash := types.CalcUncleHash(block.Uncles()); hash != header.UncleHash {\n\t\t\treturn fmt.Errorf(\"uncle root hash mismatch: have %x, want %x\", hash, header.UncleHash)\n\t\t}\n\t\tif hash := types.DeriveSha(block.Transactions()); hash != header.TxHash {\n\t\t\treturn fmt.Errorf(\"transaction root hash mismatch: have %x, want %x\", hash, header.TxHash)\n\t\t}*/\n\treturn nil\n}", "title": "" }, { "docid": "83595f3bdb788c4a6c67c26bb959f95f", "score": "0.4168173", "text": "func checkHeaders(h Headers, p string) error {\n\tif h == nil {\n\t\treturn EHDRNIL\n\t}\n\t// Length check\n\tif e := h.Validate(); e != nil {\n\t\treturn e\n\t}\n\t// Empty key / value check\n\tfor i := 0; i < len(h); i += 2 {\n\t\tif h[i] == \"\" {\n\t\t\treturn EHDRMTK\n\t\t}\n\t\tif p == SPL_10 && h[i+1] == \"\" {\n\t\t\treturn EHDRMTV\n\t\t}\n\t}\n\t// UTF8 check\n\tif p != SPL_10 {\n\t\t_, e := h.ValidateUTF8()\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1fd8446500853765e1e7aca9a2331cd7", "score": "0.41546386", "text": "func FuzzBlockHeader(data []byte) int {\n\n\tblockheader := types.BlockHeader{}\n\tf := gfuzz.NewFromGoFuzz(data).NilChance(0)\n\tf.Fuzz(&blockheader)\n\tencodedHeader, err := blockheader.Serialize()\n\tif err != nil {\n\t\treturn 0\n\t}\n\theader, err := types.DecodeBlock(encodedHeader)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Error in decoding BlockHeader: %v\", err))\n\t}\n\n\t// Checks if the decoded BlockHeader is different to the initial BlockHeader.\n\tif !cmp.Equal(blockheader, header) {\n\t\tpanic(fmt.Sprintf(\"Decoded BlockHeader and serialized BlockHeader are not equal: %v\", err))\n\t}\n\treturn 1\n}", "title": "" }, { "docid": "d9abef62c4ab59a6d841fd3176bc5b19", "score": "0.41492954", "text": "func newResourceDelta(\n\ta *resource,\n\tb *resource,\n) *ackcompare.Delta {\n\tdelta := ackcompare.NewDelta()\n\tif (a == nil && b != nil) ||\n\t\t(a != nil && b == nil) {\n\t\tdelta.Add(\"\", a, b)\n\t\treturn delta\n\t}\n\tcustomPreCompare(a, b)\n\n\tif ackcompare.HasNilDifference(a.ko.Spec.ACL, b.ko.Spec.ACL) {\n\t\tdelta.Add(\"Spec.ACL\", a.ko.Spec.ACL, b.ko.Spec.ACL)\n\t} else if a.ko.Spec.ACL != nil && b.ko.Spec.ACL != nil {\n\t\tif *a.ko.Spec.ACL != *b.ko.Spec.ACL {\n\t\t\tdelta.Add(\"Spec.ACL\", a.ko.Spec.ACL, b.ko.Spec.ACL)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.Accelerate, b.ko.Spec.Accelerate) {\n\t\tdelta.Add(\"Spec.Accelerate\", a.ko.Spec.Accelerate, b.ko.Spec.Accelerate)\n\t} else if a.ko.Spec.Accelerate != nil && b.ko.Spec.Accelerate != nil {\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.Accelerate.Status, b.ko.Spec.Accelerate.Status) {\n\t\t\tdelta.Add(\"Spec.Accelerate.Status\", a.ko.Spec.Accelerate.Status, b.ko.Spec.Accelerate.Status)\n\t\t} else if a.ko.Spec.Accelerate.Status != nil && b.ko.Spec.Accelerate.Status != nil {\n\t\t\tif *a.ko.Spec.Accelerate.Status != *b.ko.Spec.Accelerate.Status {\n\t\t\t\tdelta.Add(\"Spec.Accelerate.Status\", a.ko.Spec.Accelerate.Status, b.ko.Spec.Accelerate.Status)\n\t\t\t}\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.CORS, b.ko.Spec.CORS) {\n\t\tdelta.Add(\"Spec.CORS\", a.ko.Spec.CORS, b.ko.Spec.CORS)\n\t} else if a.ko.Spec.CORS != nil && b.ko.Spec.CORS != nil {\n\t\tif !reflect.DeepEqual(a.ko.Spec.CORS.CORSRules, b.ko.Spec.CORS.CORSRules) {\n\t\t\tdelta.Add(\"Spec.CORS.CORSRules\", a.ko.Spec.CORS.CORSRules, b.ko.Spec.CORS.CORSRules)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.CreateBucketConfiguration, b.ko.Spec.CreateBucketConfiguration) {\n\t\tdelta.Add(\"Spec.CreateBucketConfiguration\", a.ko.Spec.CreateBucketConfiguration, b.ko.Spec.CreateBucketConfiguration)\n\t} else if a.ko.Spec.CreateBucketConfiguration != nil && b.ko.Spec.CreateBucketConfiguration != nil {\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.CreateBucketConfiguration.LocationConstraint, b.ko.Spec.CreateBucketConfiguration.LocationConstraint) {\n\t\t\tdelta.Add(\"Spec.CreateBucketConfiguration.LocationConstraint\", a.ko.Spec.CreateBucketConfiguration.LocationConstraint, b.ko.Spec.CreateBucketConfiguration.LocationConstraint)\n\t\t} else if a.ko.Spec.CreateBucketConfiguration.LocationConstraint != nil && b.ko.Spec.CreateBucketConfiguration.LocationConstraint != nil {\n\t\t\tif *a.ko.Spec.CreateBucketConfiguration.LocationConstraint != *b.ko.Spec.CreateBucketConfiguration.LocationConstraint {\n\t\t\t\tdelta.Add(\"Spec.CreateBucketConfiguration.LocationConstraint\", a.ko.Spec.CreateBucketConfiguration.LocationConstraint, b.ko.Spec.CreateBucketConfiguration.LocationConstraint)\n\t\t\t}\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.Encryption, b.ko.Spec.Encryption) {\n\t\tdelta.Add(\"Spec.Encryption\", a.ko.Spec.Encryption, b.ko.Spec.Encryption)\n\t} else if a.ko.Spec.Encryption != nil && b.ko.Spec.Encryption != nil {\n\t\tif !reflect.DeepEqual(a.ko.Spec.Encryption.Rules, b.ko.Spec.Encryption.Rules) {\n\t\t\tdelta.Add(\"Spec.Encryption.Rules\", a.ko.Spec.Encryption.Rules, b.ko.Spec.Encryption.Rules)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.GrantFullControl, b.ko.Spec.GrantFullControl) {\n\t\tdelta.Add(\"Spec.GrantFullControl\", a.ko.Spec.GrantFullControl, b.ko.Spec.GrantFullControl)\n\t} else if a.ko.Spec.GrantFullControl != nil && b.ko.Spec.GrantFullControl != nil {\n\t\tif *a.ko.Spec.GrantFullControl != *b.ko.Spec.GrantFullControl {\n\t\t\tdelta.Add(\"Spec.GrantFullControl\", a.ko.Spec.GrantFullControl, b.ko.Spec.GrantFullControl)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.GrantRead, b.ko.Spec.GrantRead) {\n\t\tdelta.Add(\"Spec.GrantRead\", a.ko.Spec.GrantRead, b.ko.Spec.GrantRead)\n\t} else if a.ko.Spec.GrantRead != nil && b.ko.Spec.GrantRead != nil {\n\t\tif *a.ko.Spec.GrantRead != *b.ko.Spec.GrantRead {\n\t\t\tdelta.Add(\"Spec.GrantRead\", a.ko.Spec.GrantRead, b.ko.Spec.GrantRead)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.GrantReadACP, b.ko.Spec.GrantReadACP) {\n\t\tdelta.Add(\"Spec.GrantReadACP\", a.ko.Spec.GrantReadACP, b.ko.Spec.GrantReadACP)\n\t} else if a.ko.Spec.GrantReadACP != nil && b.ko.Spec.GrantReadACP != nil {\n\t\tif *a.ko.Spec.GrantReadACP != *b.ko.Spec.GrantReadACP {\n\t\t\tdelta.Add(\"Spec.GrantReadACP\", a.ko.Spec.GrantReadACP, b.ko.Spec.GrantReadACP)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.GrantWrite, b.ko.Spec.GrantWrite) {\n\t\tdelta.Add(\"Spec.GrantWrite\", a.ko.Spec.GrantWrite, b.ko.Spec.GrantWrite)\n\t} else if a.ko.Spec.GrantWrite != nil && b.ko.Spec.GrantWrite != nil {\n\t\tif *a.ko.Spec.GrantWrite != *b.ko.Spec.GrantWrite {\n\t\t\tdelta.Add(\"Spec.GrantWrite\", a.ko.Spec.GrantWrite, b.ko.Spec.GrantWrite)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.GrantWriteACP, b.ko.Spec.GrantWriteACP) {\n\t\tdelta.Add(\"Spec.GrantWriteACP\", a.ko.Spec.GrantWriteACP, b.ko.Spec.GrantWriteACP)\n\t} else if a.ko.Spec.GrantWriteACP != nil && b.ko.Spec.GrantWriteACP != nil {\n\t\tif *a.ko.Spec.GrantWriteACP != *b.ko.Spec.GrantWriteACP {\n\t\t\tdelta.Add(\"Spec.GrantWriteACP\", a.ko.Spec.GrantWriteACP, b.ko.Spec.GrantWriteACP)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.Lifecycle, b.ko.Spec.Lifecycle) {\n\t\tdelta.Add(\"Spec.Lifecycle\", a.ko.Spec.Lifecycle, b.ko.Spec.Lifecycle)\n\t} else if a.ko.Spec.Lifecycle != nil && b.ko.Spec.Lifecycle != nil {\n\t\tif !reflect.DeepEqual(a.ko.Spec.Lifecycle.Rules, b.ko.Spec.Lifecycle.Rules) {\n\t\t\tdelta.Add(\"Spec.Lifecycle.Rules\", a.ko.Spec.Lifecycle.Rules, b.ko.Spec.Lifecycle.Rules)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.Logging, b.ko.Spec.Logging) {\n\t\tdelta.Add(\"Spec.Logging\", a.ko.Spec.Logging, b.ko.Spec.Logging)\n\t} else if a.ko.Spec.Logging != nil && b.ko.Spec.Logging != nil {\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.Logging.LoggingEnabled, b.ko.Spec.Logging.LoggingEnabled) {\n\t\t\tdelta.Add(\"Spec.Logging.LoggingEnabled\", a.ko.Spec.Logging.LoggingEnabled, b.ko.Spec.Logging.LoggingEnabled)\n\t\t} else if a.ko.Spec.Logging.LoggingEnabled != nil && b.ko.Spec.Logging.LoggingEnabled != nil {\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.Logging.LoggingEnabled.TargetBucket, b.ko.Spec.Logging.LoggingEnabled.TargetBucket) {\n\t\t\t\tdelta.Add(\"Spec.Logging.LoggingEnabled.TargetBucket\", a.ko.Spec.Logging.LoggingEnabled.TargetBucket, b.ko.Spec.Logging.LoggingEnabled.TargetBucket)\n\t\t\t} else if a.ko.Spec.Logging.LoggingEnabled.TargetBucket != nil && b.ko.Spec.Logging.LoggingEnabled.TargetBucket != nil {\n\t\t\t\tif *a.ko.Spec.Logging.LoggingEnabled.TargetBucket != *b.ko.Spec.Logging.LoggingEnabled.TargetBucket {\n\t\t\t\t\tdelta.Add(\"Spec.Logging.LoggingEnabled.TargetBucket\", a.ko.Spec.Logging.LoggingEnabled.TargetBucket, b.ko.Spec.Logging.LoggingEnabled.TargetBucket)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !reflect.DeepEqual(a.ko.Spec.Logging.LoggingEnabled.TargetGrants, b.ko.Spec.Logging.LoggingEnabled.TargetGrants) {\n\t\t\t\tdelta.Add(\"Spec.Logging.LoggingEnabled.TargetGrants\", a.ko.Spec.Logging.LoggingEnabled.TargetGrants, b.ko.Spec.Logging.LoggingEnabled.TargetGrants)\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.Logging.LoggingEnabled.TargetPrefix, b.ko.Spec.Logging.LoggingEnabled.TargetPrefix) {\n\t\t\t\tdelta.Add(\"Spec.Logging.LoggingEnabled.TargetPrefix\", a.ko.Spec.Logging.LoggingEnabled.TargetPrefix, b.ko.Spec.Logging.LoggingEnabled.TargetPrefix)\n\t\t\t} else if a.ko.Spec.Logging.LoggingEnabled.TargetPrefix != nil && b.ko.Spec.Logging.LoggingEnabled.TargetPrefix != nil {\n\t\t\t\tif *a.ko.Spec.Logging.LoggingEnabled.TargetPrefix != *b.ko.Spec.Logging.LoggingEnabled.TargetPrefix {\n\t\t\t\t\tdelta.Add(\"Spec.Logging.LoggingEnabled.TargetPrefix\", a.ko.Spec.Logging.LoggingEnabled.TargetPrefix, b.ko.Spec.Logging.LoggingEnabled.TargetPrefix)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.Name, b.ko.Spec.Name) {\n\t\tdelta.Add(\"Spec.Name\", a.ko.Spec.Name, b.ko.Spec.Name)\n\t} else if a.ko.Spec.Name != nil && b.ko.Spec.Name != nil {\n\t\tif *a.ko.Spec.Name != *b.ko.Spec.Name {\n\t\t\tdelta.Add(\"Spec.Name\", a.ko.Spec.Name, b.ko.Spec.Name)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.Notification, b.ko.Spec.Notification) {\n\t\tdelta.Add(\"Spec.Notification\", a.ko.Spec.Notification, b.ko.Spec.Notification)\n\t} else if a.ko.Spec.Notification != nil && b.ko.Spec.Notification != nil {\n\t\tif !reflect.DeepEqual(a.ko.Spec.Notification.LambdaFunctionConfigurations, b.ko.Spec.Notification.LambdaFunctionConfigurations) {\n\t\t\tdelta.Add(\"Spec.Notification.LambdaFunctionConfigurations\", a.ko.Spec.Notification.LambdaFunctionConfigurations, b.ko.Spec.Notification.LambdaFunctionConfigurations)\n\t\t}\n\t\tif !reflect.DeepEqual(a.ko.Spec.Notification.QueueConfigurations, b.ko.Spec.Notification.QueueConfigurations) {\n\t\t\tdelta.Add(\"Spec.Notification.QueueConfigurations\", a.ko.Spec.Notification.QueueConfigurations, b.ko.Spec.Notification.QueueConfigurations)\n\t\t}\n\t\tif !reflect.DeepEqual(a.ko.Spec.Notification.TopicConfigurations, b.ko.Spec.Notification.TopicConfigurations) {\n\t\t\tdelta.Add(\"Spec.Notification.TopicConfigurations\", a.ko.Spec.Notification.TopicConfigurations, b.ko.Spec.Notification.TopicConfigurations)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.ObjectLockEnabledForBucket, b.ko.Spec.ObjectLockEnabledForBucket) {\n\t\tdelta.Add(\"Spec.ObjectLockEnabledForBucket\", a.ko.Spec.ObjectLockEnabledForBucket, b.ko.Spec.ObjectLockEnabledForBucket)\n\t} else if a.ko.Spec.ObjectLockEnabledForBucket != nil && b.ko.Spec.ObjectLockEnabledForBucket != nil {\n\t\tif *a.ko.Spec.ObjectLockEnabledForBucket != *b.ko.Spec.ObjectLockEnabledForBucket {\n\t\t\tdelta.Add(\"Spec.ObjectLockEnabledForBucket\", a.ko.Spec.ObjectLockEnabledForBucket, b.ko.Spec.ObjectLockEnabledForBucket)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.OwnershipControls, b.ko.Spec.OwnershipControls) {\n\t\tdelta.Add(\"Spec.OwnershipControls\", a.ko.Spec.OwnershipControls, b.ko.Spec.OwnershipControls)\n\t} else if a.ko.Spec.OwnershipControls != nil && b.ko.Spec.OwnershipControls != nil {\n\t\tif !reflect.DeepEqual(a.ko.Spec.OwnershipControls.Rules, b.ko.Spec.OwnershipControls.Rules) {\n\t\t\tdelta.Add(\"Spec.OwnershipControls.Rules\", a.ko.Spec.OwnershipControls.Rules, b.ko.Spec.OwnershipControls.Rules)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.Policy, b.ko.Spec.Policy) {\n\t\tdelta.Add(\"Spec.Policy\", a.ko.Spec.Policy, b.ko.Spec.Policy)\n\t} else if a.ko.Spec.Policy != nil && b.ko.Spec.Policy != nil {\n\t\tif *a.ko.Spec.Policy != *b.ko.Spec.Policy {\n\t\t\tdelta.Add(\"Spec.Policy\", a.ko.Spec.Policy, b.ko.Spec.Policy)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.Replication, b.ko.Spec.Replication) {\n\t\tdelta.Add(\"Spec.Replication\", a.ko.Spec.Replication, b.ko.Spec.Replication)\n\t} else if a.ko.Spec.Replication != nil && b.ko.Spec.Replication != nil {\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.Replication.Role, b.ko.Spec.Replication.Role) {\n\t\t\tdelta.Add(\"Spec.Replication.Role\", a.ko.Spec.Replication.Role, b.ko.Spec.Replication.Role)\n\t\t} else if a.ko.Spec.Replication.Role != nil && b.ko.Spec.Replication.Role != nil {\n\t\t\tif *a.ko.Spec.Replication.Role != *b.ko.Spec.Replication.Role {\n\t\t\t\tdelta.Add(\"Spec.Replication.Role\", a.ko.Spec.Replication.Role, b.ko.Spec.Replication.Role)\n\t\t\t}\n\t\t}\n\t\tif !reflect.DeepEqual(a.ko.Spec.Replication.Rules, b.ko.Spec.Replication.Rules) {\n\t\t\tdelta.Add(\"Spec.Replication.Rules\", a.ko.Spec.Replication.Rules, b.ko.Spec.Replication.Rules)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.RequestPayment, b.ko.Spec.RequestPayment) {\n\t\tdelta.Add(\"Spec.RequestPayment\", a.ko.Spec.RequestPayment, b.ko.Spec.RequestPayment)\n\t} else if a.ko.Spec.RequestPayment != nil && b.ko.Spec.RequestPayment != nil {\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.RequestPayment.Payer, b.ko.Spec.RequestPayment.Payer) {\n\t\t\tdelta.Add(\"Spec.RequestPayment.Payer\", a.ko.Spec.RequestPayment.Payer, b.ko.Spec.RequestPayment.Payer)\n\t\t} else if a.ko.Spec.RequestPayment.Payer != nil && b.ko.Spec.RequestPayment.Payer != nil {\n\t\t\tif *a.ko.Spec.RequestPayment.Payer != *b.ko.Spec.RequestPayment.Payer {\n\t\t\t\tdelta.Add(\"Spec.RequestPayment.Payer\", a.ko.Spec.RequestPayment.Payer, b.ko.Spec.RequestPayment.Payer)\n\t\t\t}\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.Tagging, b.ko.Spec.Tagging) {\n\t\tdelta.Add(\"Spec.Tagging\", a.ko.Spec.Tagging, b.ko.Spec.Tagging)\n\t} else if a.ko.Spec.Tagging != nil && b.ko.Spec.Tagging != nil {\n\t\tif !reflect.DeepEqual(a.ko.Spec.Tagging.TagSet, b.ko.Spec.Tagging.TagSet) {\n\t\t\tdelta.Add(\"Spec.Tagging.TagSet\", a.ko.Spec.Tagging.TagSet, b.ko.Spec.Tagging.TagSet)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.Versioning, b.ko.Spec.Versioning) {\n\t\tdelta.Add(\"Spec.Versioning\", a.ko.Spec.Versioning, b.ko.Spec.Versioning)\n\t} else if a.ko.Spec.Versioning != nil && b.ko.Spec.Versioning != nil {\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.Versioning.Status, b.ko.Spec.Versioning.Status) {\n\t\t\tdelta.Add(\"Spec.Versioning.Status\", a.ko.Spec.Versioning.Status, b.ko.Spec.Versioning.Status)\n\t\t} else if a.ko.Spec.Versioning.Status != nil && b.ko.Spec.Versioning.Status != nil {\n\t\t\tif *a.ko.Spec.Versioning.Status != *b.ko.Spec.Versioning.Status {\n\t\t\t\tdelta.Add(\"Spec.Versioning.Status\", a.ko.Spec.Versioning.Status, b.ko.Spec.Versioning.Status)\n\t\t\t}\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.Website, b.ko.Spec.Website) {\n\t\tdelta.Add(\"Spec.Website\", a.ko.Spec.Website, b.ko.Spec.Website)\n\t} else if a.ko.Spec.Website != nil && b.ko.Spec.Website != nil {\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.Website.ErrorDocument, b.ko.Spec.Website.ErrorDocument) {\n\t\t\tdelta.Add(\"Spec.Website.ErrorDocument\", a.ko.Spec.Website.ErrorDocument, b.ko.Spec.Website.ErrorDocument)\n\t\t} else if a.ko.Spec.Website.ErrorDocument != nil && b.ko.Spec.Website.ErrorDocument != nil {\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.Website.ErrorDocument.Key, b.ko.Spec.Website.ErrorDocument.Key) {\n\t\t\t\tdelta.Add(\"Spec.Website.ErrorDocument.Key\", a.ko.Spec.Website.ErrorDocument.Key, b.ko.Spec.Website.ErrorDocument.Key)\n\t\t\t} else if a.ko.Spec.Website.ErrorDocument.Key != nil && b.ko.Spec.Website.ErrorDocument.Key != nil {\n\t\t\t\tif *a.ko.Spec.Website.ErrorDocument.Key != *b.ko.Spec.Website.ErrorDocument.Key {\n\t\t\t\t\tdelta.Add(\"Spec.Website.ErrorDocument.Key\", a.ko.Spec.Website.ErrorDocument.Key, b.ko.Spec.Website.ErrorDocument.Key)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.Website.IndexDocument, b.ko.Spec.Website.IndexDocument) {\n\t\t\tdelta.Add(\"Spec.Website.IndexDocument\", a.ko.Spec.Website.IndexDocument, b.ko.Spec.Website.IndexDocument)\n\t\t} else if a.ko.Spec.Website.IndexDocument != nil && b.ko.Spec.Website.IndexDocument != nil {\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.Website.IndexDocument.Suffix, b.ko.Spec.Website.IndexDocument.Suffix) {\n\t\t\t\tdelta.Add(\"Spec.Website.IndexDocument.Suffix\", a.ko.Spec.Website.IndexDocument.Suffix, b.ko.Spec.Website.IndexDocument.Suffix)\n\t\t\t} else if a.ko.Spec.Website.IndexDocument.Suffix != nil && b.ko.Spec.Website.IndexDocument.Suffix != nil {\n\t\t\t\tif *a.ko.Spec.Website.IndexDocument.Suffix != *b.ko.Spec.Website.IndexDocument.Suffix {\n\t\t\t\t\tdelta.Add(\"Spec.Website.IndexDocument.Suffix\", a.ko.Spec.Website.IndexDocument.Suffix, b.ko.Spec.Website.IndexDocument.Suffix)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.Website.RedirectAllRequestsTo, b.ko.Spec.Website.RedirectAllRequestsTo) {\n\t\t\tdelta.Add(\"Spec.Website.RedirectAllRequestsTo\", a.ko.Spec.Website.RedirectAllRequestsTo, b.ko.Spec.Website.RedirectAllRequestsTo)\n\t\t} else if a.ko.Spec.Website.RedirectAllRequestsTo != nil && b.ko.Spec.Website.RedirectAllRequestsTo != nil {\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.Website.RedirectAllRequestsTo.HostName, b.ko.Spec.Website.RedirectAllRequestsTo.HostName) {\n\t\t\t\tdelta.Add(\"Spec.Website.RedirectAllRequestsTo.HostName\", a.ko.Spec.Website.RedirectAllRequestsTo.HostName, b.ko.Spec.Website.RedirectAllRequestsTo.HostName)\n\t\t\t} else if a.ko.Spec.Website.RedirectAllRequestsTo.HostName != nil && b.ko.Spec.Website.RedirectAllRequestsTo.HostName != nil {\n\t\t\t\tif *a.ko.Spec.Website.RedirectAllRequestsTo.HostName != *b.ko.Spec.Website.RedirectAllRequestsTo.HostName {\n\t\t\t\t\tdelta.Add(\"Spec.Website.RedirectAllRequestsTo.HostName\", a.ko.Spec.Website.RedirectAllRequestsTo.HostName, b.ko.Spec.Website.RedirectAllRequestsTo.HostName)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.Website.RedirectAllRequestsTo.Protocol, b.ko.Spec.Website.RedirectAllRequestsTo.Protocol) {\n\t\t\t\tdelta.Add(\"Spec.Website.RedirectAllRequestsTo.Protocol\", a.ko.Spec.Website.RedirectAllRequestsTo.Protocol, b.ko.Spec.Website.RedirectAllRequestsTo.Protocol)\n\t\t\t} else if a.ko.Spec.Website.RedirectAllRequestsTo.Protocol != nil && b.ko.Spec.Website.RedirectAllRequestsTo.Protocol != nil {\n\t\t\t\tif *a.ko.Spec.Website.RedirectAllRequestsTo.Protocol != *b.ko.Spec.Website.RedirectAllRequestsTo.Protocol {\n\t\t\t\t\tdelta.Add(\"Spec.Website.RedirectAllRequestsTo.Protocol\", a.ko.Spec.Website.RedirectAllRequestsTo.Protocol, b.ko.Spec.Website.RedirectAllRequestsTo.Protocol)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif !reflect.DeepEqual(a.ko.Spec.Website.RoutingRules, b.ko.Spec.Website.RoutingRules) {\n\t\t\tdelta.Add(\"Spec.Website.RoutingRules\", a.ko.Spec.Website.RoutingRules, b.ko.Spec.Website.RoutingRules)\n\t\t}\n\t}\n\n\treturn delta\n}", "title": "" }, { "docid": "89ae490642350e989d76eac8ca4dd896", "score": "0.41487405", "text": "func (cs *ConsensusSet) revertToHeader(tx *bolt.Tx, ph *modules.ProcessedBlockHeader) (revertedHeaders []*modules.ProcessedBlockHeader) {\n\t// Sanity check - make sure that pb is in the current path.\n\tcurrentPathID, err := getPath(tx, ph.Height)\n\tif build.DEBUG && (err != nil || currentPathID != ph.BlockHeader.ID()) {\n\t\tpanic(errExternalRevert)\n\t}\n\t// log.Printf(\"reverting header: %d %d %s %s\", blockHeight(tx), ph.Height, currentBlockID(tx), ph.BlockHeader.ID())\n\n\tfor currentBlockID(tx) != ph.BlockHeader.ID() {\n\t\theader := currentProcessedHeader(tx)\n\t\tcommitHeaderDiffSet(tx, header, modules.DiffRevert)\n\t\t// if block exist, need to revert diffs too\n\t\tblock, err := getBlockMap(tx, header.BlockHeader.ID())\n\t\tif err == nil {\n\t\t\tcommitSingleBlockDiffSet(tx, block, modules.DiffRevert)\n\t\t} else {\n\t\t\tif err != errNilItem {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\n\t\trevertedHeaders = append(revertedHeaders, header)\n\t\t// Sanity check - after removing a block, check that the consensus set\n\t\t// has maintained consistency.\n\t\tif build.Release == \"testing\" {\n\t\t\tcs.checkHeaderConsistency(tx)\n\t\t} else {\n\t\t\tcs.maybeCheckHeaderConsistency(tx)\n\t\t}\n\t}\n\treturn revertedHeaders\n}", "title": "" }, { "docid": "7bda681dbbd53c7c8f0a8c3f4037be6c", "score": "0.41452372", "text": "func TestNewLeader(t *testing.T) {\n\trafts := makeRafts(t, 5, 7100) // array of []raftNode\n\tldr := getLeader(t, rafts)\n\n\tfirst := \"deep\"\n\tsecond := \"patel\"\n\n\tldr.Append([]byte(\"deep\"))\n\n\tvar wg sync.WaitGroup\n\twg.Add(len(rafts))\n\tfor _, node := range rafts {\n\t\tgo func(node RaftNode) {\n\t\t\tdefer wg.Done()\n\t\t\tci := <-node.CommitChannel()\n\t\t\tif ci.err != \"\" {\n\t\t\t\tt.Fatal(ci.err)\n\t\t\t}\n\t\t\tif string(ci.data) != first {\n\t\t\t\tt.Fatal(\"Got different data\")\n\t\t\t}\n\t\t\terr, data := node.Get(1)\n\t\t\tif err != nil || string(data) != first {\n\t\t\t\tt.Fatal(\"Expected message on log also\")\n\t\t\t}\n\t\t\t//logger.Println(\"Done ID:\", node.Id())\n\t\t}(node)\n\t}\n\twg.Wait()\n\tldr.Shutdown()\n\tldr.Delete()\n\n\tearlierLeader := ldr.Id()\n\tvar wg2 sync.WaitGroup\n\twg2.Add(len(rafts) - 1)\n\tldr = getLeader(t, rafts)\n\tldr.Append([]byte(second))\n\tfor _, node := range rafts {\n\t\tif node.Id() == earlierLeader {\n\t\t\tcontinue\n\t\t}\n\t\tgo func(node RaftNode) {\n\t\t\tdefer wg2.Done()\n\t\t\tci := <-node.CommitChannel()\n\t\t\tif ci.err != \"\" {\n\t\t\t\tt.Fatal(ci.err)\n\t\t\t}\n\t\t\tif string(ci.data) != second {\n\t\t\t\tt.Fatal(\"Got different data\")\n\t\t\t}\n\t\t\terr3, _ := node.Get(3)\n\t\t\terr2, data2 := node.Get(2)\n\t\t\terr1, data1 := node.Get(1)\n\t\t\t//fmt.Println(\"here\", node.Id(), string(data1), err1, string(data2), err2, string(data3), err3)\n\t\t\tif err1 != nil || string(data1) != first || err2 != nil || string(data2) != second || err3 == nil {\n\t\t\t\tt.Fatal(\"Persistent log has unexpected values\")\n\t\t\t}\n\t\t}(node)\n\t}\n\twg2.Wait()\n\n\tfor _, node := range rafts {\n\t\tif node.Id() != earlierLeader {\n\t\t\tnode.Shutdown()\n\t\t\tnode.Delete()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "58954958161d6f6f4de7c32b7bf037b3", "score": "0.41425627", "text": "func (s *FakeStateSync) AddHeaders(...*block.Header) error {\n\tpanic(\"TODO\")\n}", "title": "" }, { "docid": "1c04bbbd708249f2354a086b8872722f", "score": "0.4139173", "text": "func mustReadIndexBlockHeaders(dst []indexBlockHeader, r *readerWithStats) []indexBlockHeader {\n\tdata, err := io.ReadAll(r)\n\tif err != nil {\n\t\tlogger.Panicf(\"FATAL: cannot read indexBlockHeader entries from %s: %s\", r.Path(), err)\n\t}\n\n\tbb := longTermBufPool.Get()\n\tbb.B, err = encoding.DecompressZSTD(bb.B[:0], data)\n\tif err != nil {\n\t\tlogger.Panicf(\"FATAL: cannot decompress indexBlockHeader entries from %s: %s\", r.Path(), err)\n\t}\n\tdst, err = unmarshalIndexBlockHeaders(dst, bb.B)\n\tif len(bb.B) < 1024*1024 {\n\t\tlongTermBufPool.Put(bb)\n\t}\n\tif err != nil {\n\t\tlogger.Panicf(\"FATAL: cannot parse indexBlockHeader entries from %s: %s\", r.Path(), err)\n\t}\n\treturn dst\n}", "title": "" }, { "docid": "1381e5b634086a3284f1e91a9a8b7810", "score": "0.41388622", "text": "func InvalidCLHeader(URL string, postData string, contentType string, HTTPv string, path string, method string) []bool {\n\tfmt.Println(\"Checking for CL header as Content_Length...\")\n\tr := TCPeditor{}\n\tr.Server = URL\n\tr.Host = URL\n\tr.Method = method\n\tr.Path = path\n\tr.HttpVersion = HTTPv\n\tr.Body = postData\n\tr.Headers = []string{\"Content-Type: \" + contentType, \"Content_Length: \" + strconv.Itoa(len(postData))}\n\tsc, res := r.MakeRequest()\n\n\tdefer fmt.Println(\"Done...\")\n\tif sc == \"200\" {\n\t\tif strings.Contains(res, \"input2=Testing, input3=Fuzzer\") {\n\t\t\treturn []bool{true, true}\n\t\t}\n\t}\n\treturn []bool{false, HitsServer(sc, res)}\n}", "title": "" }, { "docid": "811fb7611e4b36a6fb7a7899dc312c9b", "score": "0.41386244", "text": "func assertOwnChain(t *testing.T, tester *downloadTester, length int) {\n\t// Mark this method as a helper to report errors at callsite, not in here\n\tt.Helper()\n\n\theaders, blocks, receipts := length, length, length\n\tif tester.downloader.getMode() == LightSync {\n\t\tblocks, receipts = 1, 1\n\t}\n\tif hs := int(tester.chain.CurrentHeader().Number.Uint64()) + 1; hs != headers {\n\t\tt.Fatalf(\"synchronised headers mismatch: have %v, want %v\", hs, headers)\n\t}\n\tif bs := int(tester.chain.CurrentBlock().NumberU64()) + 1; bs != blocks {\n\t\tt.Fatalf(\"synchronised blocks mismatch: have %v, want %v\", bs, blocks)\n\t}\n\tif rs := int(tester.chain.CurrentFastBlock().NumberU64()) + 1; rs != receipts {\n\t\tt.Fatalf(\"synchronised receipts mismatch: have %v, want %v\", rs, receipts)\n\t}\n}", "title": "" }, { "docid": "7e4317563a800094a5b821a1dcf42f9b", "score": "0.41380242", "text": "func handleGetBlockHeader(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {\n\tc := cmd.(*btcjson.GetBlockHeaderCmd)\n\n\t// Fetch the header from chain.\n\thash, err := chainhash.NewHashFromStr(c.Hash)\n\tif err != nil {\n\t\treturn nil, rpcDecodeHexError(c.Hash)\n\t}\n\tblockHeader, err := s.cfg.Chain.HeaderByHash(hash)\n\tif err != nil {\n\t\treturn nil, &btcjson.RPCError{\n\t\t\tCode: btcjson.ErrRPCBlockNotFound,\n\t\t\tMessage: \"Block not found\",\n\t\t}\n\t}\n\n\t// When the verbose flag isn't set, simply return the serialized block\n\t// header as a hex-encoded string.\n\tif c.Verbose != nil && !*c.Verbose {\n\t\tvar headerBuf bytes.Buffer\n\t\terr := blockHeader.Serialize(&headerBuf)\n\t\tif err != nil {\n\t\t\tcontext := \"Failed to serialize block header\"\n\t\t\treturn nil, internalRPCError(err.Error(), context)\n\t\t}\n\t\treturn hex.EncodeToString(headerBuf.Bytes()), nil\n\t}\n\n\t// The verbose flag is set, so generate the JSON object and return it.\n\n\t// Get the block height from chain.\n\tblockHeight, err := s.cfg.Chain.BlockHeightByHash(hash)\n\tif err != nil {\n\t\tcontext := \"Failed to obtain block height\"\n\t\treturn nil, internalRPCError(err.Error(), context)\n\t}\n\tbest := s.cfg.Chain.BestSnapshot()\n\n\t// Get next block hash unless there are none.\n\tvar nextHashString string\n\tif blockHeight < best.Height {\n\t\tnextHash, err := s.cfg.Chain.BlockHashByHeight(blockHeight + 1)\n\t\tif err != nil {\n\t\t\tcontext := \"No next block\"\n\t\t\treturn nil, internalRPCError(err.Error(), context)\n\t\t}\n\t\tnextHashString = nextHash.String()\n\t}\n\n\tparams := s.cfg.ChainParams\n\tblockHeaderReply := btcjson.GetBlockHeaderVerboseResult{\n\t\tHash: c.Hash,\n\t\tConfirmations: int64(1 + best.Height - blockHeight),\n\t\tHeight: blockHeight,\n\t\tVersion: blockHeader.Version,\n\t\tVersionHex: fmt.Sprintf(\"%08x\", blockHeader.Version),\n\t\tMerkleRoot: blockHeader.MerkleRoot.String(),\n\t\tNextHash: nextHashString,\n\t\tPreviousHash: blockHeader.PrevBlock.String(),\n\t\tNonce: uint64(blockHeader.Nonce),\n\t\tTime: blockHeader.Timestamp.Unix(),\n\t\tBits: strconv.FormatInt(int64(blockHeader.Bits), 16),\n\t\tDifficulty: getDifficultyRatio(blockHeader.Bits, params),\n\t}\n\treturn blockHeaderReply, nil\n}", "title": "" }, { "docid": "d505f8fc9ec88b19af51d300b0d4d7a9", "score": "0.41336083", "text": "func (h *Header) Unmarshal(buf []byte) (n int, err error) { //nolint:gocognit\n\tif len(buf) < headerLength {\n\t\treturn 0, fmt.Errorf(\"%w: %d < %d\", errHeaderSizeInsufficient, len(buf), headerLength)\n\t}\n\n\t/*\n\t * 0 1 2 3\n\t * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\n\t * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n\t * |V=2|P|X| CC |M| PT | sequence number |\n\t * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n\t * | timestamp |\n\t * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n\t * | synchronization source (SSRC) identifier |\n\t * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+\n\t * | contributing source (CSRC) identifiers |\n\t * | .... |\n\t * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n\t */\n\n\th.Version = buf[0] >> versionShift & versionMask\n\th.Padding = (buf[0] >> paddingShift & paddingMask) > 0\n\th.Extension = (buf[0] >> extensionShift & extensionMask) > 0\n\tnCSRC := int(buf[0] & ccMask)\n\tif cap(h.CSRC) < nCSRC || h.CSRC == nil {\n\t\th.CSRC = make([]uint32, nCSRC)\n\t} else {\n\t\th.CSRC = h.CSRC[:nCSRC]\n\t}\n\n\tn = csrcOffset + (nCSRC * csrcLength)\n\tif len(buf) < n {\n\t\treturn n, fmt.Errorf(\"size %d < %d: %w\", len(buf), n,\n\t\t\terrHeaderSizeInsufficient)\n\t}\n\n\th.Marker = (buf[1] >> markerShift & markerMask) > 0\n\th.PayloadType = buf[1] & ptMask\n\n\th.SequenceNumber = binary.BigEndian.Uint16(buf[seqNumOffset : seqNumOffset+seqNumLength])\n\th.Timestamp = binary.BigEndian.Uint32(buf[timestampOffset : timestampOffset+timestampLength])\n\th.SSRC = binary.BigEndian.Uint32(buf[ssrcOffset : ssrcOffset+ssrcLength])\n\n\tfor i := range h.CSRC {\n\t\toffset := csrcOffset + (i * csrcLength)\n\t\th.CSRC[i] = binary.BigEndian.Uint32(buf[offset:])\n\t}\n\n\tif h.Extensions != nil {\n\t\th.Extensions = h.Extensions[:0]\n\t}\n\n\tif h.Extension {\n\t\tif expected := n + 4; len(buf) < expected {\n\t\t\treturn n, fmt.Errorf(\"size %d < %d: %w\",\n\t\t\t\tlen(buf), expected,\n\t\t\t\terrHeaderSizeInsufficientForExtension,\n\t\t\t)\n\t\t}\n\n\t\th.ExtensionProfile = binary.BigEndian.Uint16(buf[n:])\n\t\tn += 2\n\t\textensionLength := int(binary.BigEndian.Uint16(buf[n:])) * 4\n\t\tn += 2\n\n\t\tif expected := n + extensionLength; len(buf) < expected {\n\t\t\treturn n, fmt.Errorf(\"size %d < %d: %w\",\n\t\t\t\tlen(buf), expected,\n\t\t\t\terrHeaderSizeInsufficientForExtension,\n\t\t\t)\n\t\t}\n\n\t\tswitch h.ExtensionProfile {\n\t\t// RFC 8285 RTP One Byte Header Extension\n\t\tcase extensionProfileOneByte:\n\t\t\tend := n + extensionLength\n\t\t\tfor n < end {\n\t\t\t\tif buf[n] == 0x00 { // padding\n\t\t\t\t\tn++\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\textid := buf[n] >> 4\n\t\t\t\tlen := int(buf[n]&^0xF0 + 1)\n\t\t\t\tn++\n\n\t\t\t\tif extid == extensionIDReserved {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\textension := Extension{id: extid, payload: buf[n : n+len]}\n\t\t\t\th.Extensions = append(h.Extensions, extension)\n\t\t\t\tn += len\n\t\t\t}\n\n\t\t// RFC 8285 RTP Two Byte Header Extension\n\t\tcase extensionProfileTwoByte:\n\t\t\tend := n + extensionLength\n\t\t\tfor n < end {\n\t\t\t\tif buf[n] == 0x00 { // padding\n\t\t\t\t\tn++\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\textid := buf[n]\n\t\t\t\tn++\n\n\t\t\t\tlen := int(buf[n])\n\t\t\t\tn++\n\n\t\t\t\textension := Extension{id: extid, payload: buf[n : n+len]}\n\t\t\t\th.Extensions = append(h.Extensions, extension)\n\t\t\t\tn += len\n\t\t\t}\n\n\t\tdefault: // RFC3550 Extension\n\t\t\tif len(buf) < n+extensionLength {\n\t\t\t\treturn n, fmt.Errorf(\"%w: %d < %d\",\n\t\t\t\t\terrHeaderSizeInsufficientForExtension, len(buf), n+extensionLength)\n\t\t\t}\n\n\t\t\textension := Extension{id: 0, payload: buf[n : n+extensionLength]}\n\t\t\th.Extensions = append(h.Extensions, extension)\n\t\t\tn += len(h.Extensions[0].payload)\n\t\t}\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "16644d6c4886c75c9e462b01b4e0a634", "score": "0.413058", "text": "func TestSearch_UntriagedDigestsAtHead_Success(t *testing.T) {\n\tunittest.LargeTest(t)\n\tctx := context.Background()\n\tdb := sqltest.NewCockroachDBForTestsWithProductionSchema(ctx, t)\n\texistingData := schema.Tables{}\n\taddDiffData(t, &existingData, data.AlphaUntriagedDigest, data.AlphaPositiveDigest, makeSmallDiffMetric())\n\taddDiffData(t, &existingData, data.AlphaUntriagedDigest, data.AlphaNegativeDigest, makeBigDiffMetric())\n\taddDiffData(t, &existingData, data.BetaUntriagedDigest, data.BetaPositiveDigest, makeBigDiffMetric())\n\trequire.NoError(t, sqltest.BulkInsertDataTables(ctx, db, existingData))\n\twaitForSystemTime()\n\t// BetaUntriagedDigest has no negative images to compare against.\n\n\ts := New(makeThreeDevicesExpectationStore(), nil, makeThreeDevicesIndexer(), nil, nil, everythingPublic, nothingFlaky, db)\n\n\tq := &query.Search{\n\t\tChangelistID: \"\",\n\t\tIncludeUntriagedDigests: true,\n\t\tOnlyIncludeDigestsProducedAtHead: true,\n\n\t\tMetric: query.CombinedMetric,\n\t\tRGBAMinFilter: 0,\n\t\tRGBAMaxFilter: 255,\n\t\tSort: query.SortAscending,\n\t}\n\n\tresp, err := s.Search(ctx, q)\n\trequire.NoError(t, err)\n\trequire.NotNil(t, resp)\n\n\tassert.Equal(t, &frontend.SearchResponse{\n\t\tCommits: frontend.FromTilingCommits(data.MakeTestCommits()),\n\t\tOffset: 0,\n\t\tSize: 2,\n\t\tResults: []*frontend.SearchResult{\n\t\t\t// AlphaTest comes first because we are sorting by ascending\n\t\t\t// \"combined\" metric, and AlphaTest's closest match is the\n\t\t\t// small diff metric, whereas BetaTest's only match is the\n\t\t\t// big diff metric.\n\t\t\t{\n\t\t\t\tTest: data.AlphaTest,\n\t\t\t\tDigest: data.AlphaUntriagedDigest,\n\t\t\t\tStatus: \"untriaged\",\n\t\t\t\tParamSet: map[string][]string{\n\t\t\t\t\t\"device\": {data.BullheadDevice},\n\t\t\t\t\ttypes.PrimaryKeyField: {string(data.AlphaTest)},\n\t\t\t\t\ttypes.CorpusField: {\"gm\"},\n\t\t\t\t\t\"ext\": {data.PNGExtension},\n\t\t\t\t},\n\t\t\t\tTraceGroup: frontend.TraceGroup{\n\t\t\t\t\tTotalDigests: 2,\n\t\t\t\t\tTraces: []frontend.Trace{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tDigestIndices: []int{1, 1, 0},\n\t\t\t\t\t\t\tID: data.BullheadAlphaTraceID,\n\t\t\t\t\t\t\tParams: map[string]string{\n\t\t\t\t\t\t\t\t\"device\": data.BullheadDevice,\n\t\t\t\t\t\t\t\ttypes.PrimaryKeyField: string(data.AlphaTest),\n\t\t\t\t\t\t\t\ttypes.CorpusField: \"gm\",\n\t\t\t\t\t\t\t\t\"ext\": data.PNGExtension,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tDigests: []frontend.DigestStatus{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tDigest: data.AlphaUntriagedDigest,\n\t\t\t\t\t\t\tStatus: \"untriaged\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tDigest: data.AlphaNegativeDigest,\n\t\t\t\t\t\t\tStatus: \"negative\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tClosestRef: frontend.PositiveRef,\n\t\t\t\tRefDiffs: map[frontend.RefClosest]*frontend.SRDiffDigest{\n\t\t\t\t\tfrontend.PositiveRef: {\n\t\t\t\t\t\t// Small diff\n\t\t\t\t\t\tNumDiffPixels: 8,\n\t\t\t\t\t\tPixelDiffPercent: 0.02,\n\t\t\t\t\t\tMaxRGBADiffs: [4]int{0, 48, 12, 0},\n\t\t\t\t\t\tDimDiffer: false,\n\t\t\t\t\t\tCombinedMetric: 0.0005,\n\t\t\t\t\t\tQueryMetric: 0.0005,\n\t\t\t\t\t\tDigest: data.AlphaPositiveDigest,\n\t\t\t\t\t\tStatus: \"positive\",\n\t\t\t\t\t\tParamSet: map[string][]string{\n\t\t\t\t\t\t\t\"device\": {data.AnglerDevice, data.CrosshatchDevice},\n\t\t\t\t\t\t\ttypes.PrimaryKeyField: {string(data.AlphaTest)},\n\t\t\t\t\t\t\ttypes.CorpusField: {\"gm\"},\n\t\t\t\t\t\t\t\"ext\": {data.PNGExtension},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tfrontend.NegativeRef: {\n\t\t\t\t\t\t// Big Diff\n\t\t\t\t\t\tNumDiffPixels: 88812,\n\t\t\t\t\t\tPixelDiffPercent: 98.68,\n\t\t\t\t\t\tMaxRGBADiffs: [4]int{102, 51, 13, 0},\n\t\t\t\t\t\tDimDiffer: true,\n\t\t\t\t\t\tCombinedMetric: 4.7,\n\t\t\t\t\t\tQueryMetric: 4.7,\n\t\t\t\t\t\tDigest: data.AlphaNegativeDigest,\n\t\t\t\t\t\tStatus: \"negative\",\n\t\t\t\t\t\tParamSet: map[string][]string{\n\t\t\t\t\t\t\t\"device\": {data.AnglerDevice, data.BullheadDevice, data.CrosshatchDevice},\n\t\t\t\t\t\t\ttypes.PrimaryKeyField: {string(data.AlphaTest)},\n\t\t\t\t\t\t\ttypes.CorpusField: {\"gm\"},\n\t\t\t\t\t\t\t\"ext\": {data.PNGExtension},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tTest: data.BetaTest,\n\t\t\t\tDigest: data.BetaUntriagedDigest,\n\t\t\t\tStatus: \"untriaged\",\n\t\t\t\tParamSet: map[string][]string{\n\t\t\t\t\t\"device\": {data.CrosshatchDevice},\n\t\t\t\t\ttypes.PrimaryKeyField: {string(data.BetaTest)},\n\t\t\t\t\ttypes.CorpusField: {\"gm\"},\n\t\t\t\t\t\"ext\": {data.PNGExtension},\n\t\t\t\t},\n\t\t\t\tTraceGroup: frontend.TraceGroup{\n\t\t\t\t\tTotalDigests: 1,\n\t\t\t\t\tTraces: []frontend.Trace{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tDigestIndices: []int{0, MissingDigestIndex, MissingDigestIndex},\n\t\t\t\t\t\t\tID: data.CrosshatchBetaTraceID,\n\t\t\t\t\t\t\tParams: map[string]string{\n\t\t\t\t\t\t\t\t\"device\": data.CrosshatchDevice,\n\t\t\t\t\t\t\t\ttypes.PrimaryKeyField: string(data.BetaTest),\n\t\t\t\t\t\t\t\ttypes.CorpusField: \"gm\",\n\t\t\t\t\t\t\t\t\"ext\": data.PNGExtension,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tDigests: []frontend.DigestStatus{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tDigest: data.BetaUntriagedDigest,\n\t\t\t\t\t\t\tStatus: \"untriaged\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tClosestRef: frontend.PositiveRef,\n\t\t\t\tRefDiffs: map[frontend.RefClosest]*frontend.SRDiffDigest{\n\t\t\t\t\tfrontend.PositiveRef: {\n\t\t\t\t\t\t// Big Diff\n\t\t\t\t\t\tNumDiffPixels: 88812,\n\t\t\t\t\t\tPixelDiffPercent: 98.68,\n\t\t\t\t\t\tMaxRGBADiffs: [4]int{102, 51, 13, 0},\n\t\t\t\t\t\tDimDiffer: true,\n\t\t\t\t\t\tCombinedMetric: 4.7,\n\t\t\t\t\t\tQueryMetric: 4.7,\n\t\t\t\t\t\tDigest: data.BetaPositiveDigest,\n\t\t\t\t\t\tStatus: \"positive\",\n\t\t\t\t\t\tParamSet: paramtools.ParamSet{\n\t\t\t\t\t\t\t\"device\": {data.AnglerDevice, data.BullheadDevice},\n\t\t\t\t\t\t\ttypes.PrimaryKeyField: {string(data.BetaTest)},\n\t\t\t\t\t\t\ttypes.CorpusField: {\"gm\"},\n\t\t\t\t\t\t\t\"ext\": {data.PNGExtension},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tfrontend.NegativeRef: nil,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tBulkTriageData: frontend.TriageRequestData{\n\t\t\tdata.AlphaTest: {\n\t\t\t\tdata.AlphaUntriagedDigest: expectations.Positive,\n\t\t\t},\n\t\t\tdata.BetaTest: {\n\t\t\t\tdata.BetaUntriagedDigest: expectations.Positive,\n\t\t\t},\n\t\t},\n\t}, resp)\n}", "title": "" }, { "docid": "3d22d7aaab6e938d83806d168ed4ea96", "score": "0.41298592", "text": "func (l *DBLoader) PerformSanityCheck(startAt, firstBlocksAmount, lastBlocksAmount uint64) error {\n\tvar height uint64\n\tvar prevBlock *block.Block\n\n\tif startAt > 0 {\n\t\treturn errors.New(\"performing sanity checks from arbitrary points is not supported yet\")\n\t}\n\n\tif startAt == 0 {\n\t\tprevBlock = l.genesis\n\t}\n\n\tprevHeader := prevBlock.Header\n\t// Verify first N blocks\n\terr := l.db.View(func(t database.Transaction) error {\n\t\t// This will most likely verify genesis, unless the startAt parameter\n\t\t// is set to some other height. In case of genesis, failure here would mostly occur if mainnet node\n\t\t// loads testnet blockchain\n\t\thash, err := t.FetchBlockHashByHeight(startAt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif !bytes.Equal(prevHeader.Hash, hash) {\n\t\t\treturn fmt.Errorf(\"invalid genesis block\")\n\t\t}\n\n\t\tfor height = 1; height <= firstBlocksAmount; height++ {\n\t\t\thash, err := t.FetchBlockHashByHeight(height)\n\n\t\t\tif err == database.ErrBlockNotFound {\n\t\t\t\t// seems we reach the tip\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\theader, err := t.FetchBlockHeader(hash)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif !bytes.Equal(header.PrevBlockHash, prevHeader.Hash) {\n\t\t\t\treturn fmt.Errorf(\"invalid block hash at height %d\", height)\n\t\t\t}\n\n\t\t\tprevHeader = header\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: Verify lastBlockAmount blocks\n\treturn nil\n}", "title": "" }, { "docid": "9baefa0c0ce1abfc1edea50fd8cadb3f", "score": "0.41231704", "text": "func (r *FileDiffReader) readOneFileHeader(prefix []byte) (filename string, timestamp *time.Time, err error) {\n\tvar line []byte\n\n\tif r.fileHeaderLine == nil {\n\t\tvar err error\n\t\tline, err = r.reader.readLine()\n\t\tif err == io.EOF {\n\t\t\treturn \"\", nil, &ParseError{r.line, r.offset, ErrNoFileHeader}\n\t\t} else if err != nil {\n\t\t\treturn \"\", nil, err\n\t\t}\n\t} else {\n\t\tline = r.fileHeaderLine\n\t\tr.fileHeaderLine = nil\n\t}\n\n\tif !bytes.HasPrefix(line, prefix) {\n\t\treturn \"\", nil, &ParseError{r.line, r.offset, ErrBadFileHeader}\n\t}\n\n\tr.offset += int64(len(line))\n\tr.line++\n\tline = line[len(prefix):]\n\n\ttrimmedLine := strings.TrimSpace(string(line)) // filenames that contain spaces may be terminated by a tab\n\tparts := strings.SplitN(trimmedLine, \"\\t\", 2)\n\tfilename = parts[0]\n\tif len(parts) == 2 {\n\t\tvar ts time.Time\n\t\t// Timestamp is optional, but this header has it.\n\t\tts, err = time.Parse(diffTimeParseLayout, parts[1])\n\t\tif err != nil {\n\t\t\tvar err1 error\n\t\t\tts, err1 = time.Parse(diffTimeParseWithoutTZLayout, parts[1])\n\t\t\tif err1 != nil {\n\t\t\t\treturn \"\", nil, err\n\t\t\t}\n\t\t\terr = nil\n\t\t}\n\t\ttimestamp = &ts\n\t}\n\n\treturn filename, timestamp, err\n}", "title": "" }, { "docid": "554d4cd9875bd76f1497da9587cd8d16", "score": "0.41224903", "text": "func ParseHeartbeat(data []byte) (*Heartbeat, error) {\n\t// check minimum size\n\tif len(data) < HeartbeatPacketMinSize {\n\t\treturn nil, fmt.Errorf(\"%w: packet doesn't reach minimum heartbeat packet size of %d\", ErrMalformedPacket, HeartbeatPacketMinSize)\n\t}\n\n\tif len(data) > HeartbeatPacketMaxSize {\n\t\treturn nil, fmt.Errorf(\"%w: packet exceeds maximum heartbeat packet size of %d\", ErrMalformedPacket, HeartbeatPacketMaxSize)\n\t}\n\tnetworkIDBytesLength := int(data[HeartbeatPacketNetworkIDBytesCountSize-1])\n\tif networkIDBytesLength == 0 {\n\t\treturn nil, ErrInvalidHeartbeatNetworkVersion\n\t}\n\tif networkIDBytesLength > HeartbeatPacketMaxNetworkIDBytesSize {\n\t\treturn nil, ErrInvalidHeartbeatNetworkVersion\n\t}\n\t// sanity check: packet len - min packet - networkIDLength % id size = 0,\n\t// since we're only dealing with IDs from that offset\n\tif (len(data)-HeartbeatPacketMinSize-networkIDBytesLength)%HeartbeatPacketPeerIDSize != 0 {\n\t\treturn nil, fmt.Errorf(\"%w: heartbeat packet is malformed since the data length after the min. packet size offset isn't conforming with peer ID sizes\", ErrMalformedPacket)\n\t}\n\toffset := HeartbeatPacketNetworkIDBytesCountSize\n\t// copy network id\n\tnetworkID := make([]byte, networkIDBytesLength)\n\tcopy(networkID, data[offset:offset+networkIDBytesLength])\n\n\t// networkID always starts with a \"v\", lets check it\n\tnetworkIDString := string(networkID)\n\tif !strings.HasPrefix(networkIDString, \"v\") {\n\t\treturn nil, ErrInvalidHeartbeatNetworkVersion\n\t}\n\n\toffset += networkIDBytesLength\n\n\t// copy own ID\n\townID := make([]byte, HeartbeatPacketPeerIDSize)\n\tcopy(ownID, data[offset:offset+HeartbeatPacketPeerIDSize])\n\n\toffset += HeartbeatPacketPeerIDSize\n\n\t// read outbound IDs count\n\toutboundIDCount := int(data[offset])\n\toffset += HeartbeatPacketOutboundIDCountSize\n\tif outboundIDCount > HeartbeatMaxOutboundPeersCount {\n\t\treturn nil, fmt.Errorf(\"%w: heartbeat packet exceeds maximum outbound IDs of %d\", ErrMalformedPacket, HeartbeatMaxOutboundPeersCount)\n\t}\n\n\t// check whether we'd have the amount of data needed for the advertised outbound id count\n\tif (len(data)-HeartbeatPacketMinSize-networkIDBytesLength)/HeartbeatPacketPeerIDSize < outboundIDCount {\n\t\treturn nil, fmt.Errorf(\"%w: heartbeat packet is malformed since remaining data length wouldn't fit advertsized outbound IDs count\", ErrMalformedPacket)\n\t}\n\n\t// outbound IDs can be zero\n\toutboundIDs := make([][]byte, outboundIDCount)\n\n\tif outboundIDCount != 0 {\n\t\tfor i := range outboundIDs {\n\t\t\toutboundIDs[i] = make([]byte, HeartbeatPacketPeerIDSize)\n\t\t\tcopy(outboundIDs[i], data[offset+i*HeartbeatPacketPeerIDSize:offset+(i+1)*HeartbeatPacketPeerIDSize])\n\t\t}\n\t}\n\n\t// (packet size - (min packet size + read outbound IDs)) / ID size = inbound IDs count\n\tinboundIDCount := (len(data) - (offset + outboundIDCount*HeartbeatPacketPeerIDSize)) / HeartbeatPacketPeerIDSize\n\tif inboundIDCount > HeartbeatMaxInboundPeersCount {\n\t\treturn nil, fmt.Errorf(\"%w: heartbeat packet exceeds maximum inbound IDs of %d\", ErrMalformedPacket, HeartbeatMaxInboundPeersCount)\n\t}\n\n\t// inbound IDs can be zero\n\tinboundIDs := make([][]byte, inboundIDCount)\n\toffset += outboundIDCount * HeartbeatPacketPeerIDSize\n\tfor i := range inboundIDs {\n\t\tinboundIDs[i] = make([]byte, HeartbeatPacketPeerIDSize)\n\t\tcopy(inboundIDs[i], data[offset+i*HeartbeatPacketPeerIDSize:offset+(i+1)*HeartbeatPacketPeerIDSize])\n\t}\n\n\treturn &Heartbeat{NetworkID: networkID, OwnID: ownID, OutboundIDs: outboundIDs, InboundIDs: inboundIDs}, nil\n}", "title": "" }, { "docid": "059fa76f5cb64babcee63b1ea4c9332b", "score": "0.41177332", "text": "func (node *Node) VerifyBlockCrossLinks(block *types.Block) error {\n\tif len(block.Header().CrossLinks) == 0 {\n\t\treturn nil\n\t}\n\tcrossLinks := &types.CrossLinks{}\n\terr := rlp.DecodeBytes(block.Header().CrossLinks, crossLinks)\n\tif err != nil {\n\t\treturn ctxerror.New(\"[CrossLinkVerification] failed to decode cross links\",\n\t\t\t\"blockHash\", block.Hash(),\n\t\t\t\"crossLinks\", len(block.Header().CrossLinks),\n\t\t).WithCause(err)\n\t}\n\n\tif !crossLinks.IsSorted() {\n\t\treturn ctxerror.New(\"[CrossLinkVerification] cross links are not sorted\",\n\t\t\t\"blockHash\", block.Hash(),\n\t\t\t\"crossLinks\", len(block.Header().CrossLinks),\n\t\t)\n\t}\n\n\tfirstCrossLinkBlock := core.ShardingSchedule.FirstCrossLinkBlock()\n\n\tfor i, crossLink := range *crossLinks {\n\t\tlastLink := &types.CrossLink{}\n\t\tif i == 0 {\n\t\t\tif crossLink.BlockNum().Uint64() > firstCrossLinkBlock {\n\t\t\t\tlastLink, err = node.Blockchain().ReadShardLastCrossLink(crossLink.ShardID())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn ctxerror.New(\"[CrossLinkVerification] no last cross link found 1\",\n\t\t\t\t\t\t\"blockHash\", block.Hash(),\n\t\t\t\t\t\t\"crossLink\", lastLink,\n\t\t\t\t\t).WithCause(err)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif (*crossLinks)[i-1].Header().ShardID != crossLink.Header().ShardID {\n\t\t\t\tif crossLink.BlockNum().Uint64() > firstCrossLinkBlock {\n\t\t\t\t\tlastLink, err = node.Blockchain().ReadShardLastCrossLink(crossLink.ShardID())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn ctxerror.New(\"[CrossLinkVerification] no last cross link found 2\",\n\t\t\t\t\t\t\t\"blockHash\", block.Hash(),\n\t\t\t\t\t\t\t\"crossLink\", lastLink,\n\t\t\t\t\t\t).WithCause(err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlastLink = &(*crossLinks)[i-1]\n\t\t\t}\n\t\t}\n\n\t\tif crossLink.BlockNum().Uint64() > firstCrossLinkBlock { // TODO: verify genesis block\n\t\t\terr = node.VerifyCrosslinkHeader(lastLink.Header(), crossLink.Header())\n\t\t\tif err != nil {\n\t\t\t\treturn ctxerror.New(\"cannot ValidateNewBlock\",\n\t\t\t\t\t\"blockHash\", block.Hash(),\n\t\t\t\t\t\"numTx\", len(block.Transactions()),\n\t\t\t\t).WithCause(err)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "83c46cf8574ab1e7b317fa439fa2d5ac", "score": "0.41145128", "text": "func TestCoreSynchronization(t *testing.T) {\n\ttests := []struct {\n\t\t// Entries in leader's log.\n\t\tleaderLog []Entry\n\t\t// Entries in follower's log.\n\t\tfollowerLog []Entry\n\t}{\n\n\t\t// NOTE entry (1, 1) will be the reconfiguration entry and it will be appended\n\t\t// automatically.\n\n\t\t// follower and leader have the same log history.\n\t\t//\n\t\t//\n\t\t// L: (1, 1), (1, 2)\n\t\t// F: (1, 1), (1, 2)\n\t\t//\n\t\t{\n\t\t\t[]Entry{Entry{Term: 1, Index: 2}},\n\t\t\t[]Entry{Entry{Term: 1, Index: 2}},\n\t\t},\n\n\t\t// follower's log history is a prefix of leader's.\n\t\t//\n\t\t// L: (1, 1), (1, 2), (1, 3)\n\t\t// F: (1, 1), (1, 2)\n\t\t//\n\t\t{\n\t\t\t[]Entry{Entry{Term: 1, Index: 2}, Entry{Term: 1, Index: 3}},\n\t\t\t[]Entry{Entry{Term: 1, Index: 2}},\n\t\t},\n\n\t\t// leader's log history is a prefix of follower's.\n\t\t//\n\t\t// L: (1, 1),\n\t\t// F: (1, 1), (1, 2)\n\t\t//\n\t\t{\n\t\t\t[]Entry{},\n\t\t\t[]Entry{Entry{Term: 1, Index: 2}},\n\t\t},\n\n\t\t// The logs between leader and follower diverged at some point.\n\t\t//\n\t\t// L: (1, 1), (1, 2), (1, 3)\n\t\t// F: (1, 1), (2, 2)\n\t\t//\n\t\t{\n\t\t\t[]Entry{Entry{Term: 1, Index: 2}, Entry{Term: 1, Index: 3}},\n\t\t\t[]Entry{Entry{Term: 2, Index: 2}},\n\t\t},\n\t}\n\n\tfor _, test := range tests {\n\t\tt.Log(\"running test:\", test)\n\t\t// Create leader core.\n\t\tcfg := Config{\n\t\t\tID: \"1\",\n\t\t\tHeartbeatTimeout: 3,\n\t\t\tMaxNumEntsPerAppEnts: 1000,\n\t\t}\n\t\tleader := newCore(cfg, newStorage())\n\t\tleader.proposeInitialMembership(Membership{Members: []string{\"1\", \"2\"}, Epoch: 54321})\n\t\tleader.storage.log.Append(test.leaderLog...)\n\n\t\t// Create follower core.\n\t\tcfg = Config{ID: \"2\"}\n\t\tfollower := newCore(cfg, newStorage())\n\t\tfollower.proposeInitialMembership(Membership{Members: []string{\"1\", \"2\"}, Epoch: 54321})\n\t\tfollower.storage.log.Append(test.followerLog...)\n\n\t\t// Force it become a leader.\n\t\tleader.changeState(leader.leader, leader.ID)\n\t\tfpeer := leader.state.(*coreLeader).peers[\"2\"]\n\n\t\t// last index of leader.\n\t\tli := leader.storage.lastIndex()\n\t\t// Check whether we initialize 'matchIndex' and 'nextIndex' in a\n\t\t// correct way.\n\t\tif fpeer.matchIndex != 0 || fpeer.nextIndex != li+1 {\n\t\t\tt.Fatalf(\"incorrect initial state of peer\")\n\t\t}\n\n\t\t// Let follower and leader talk with each other until the follower is fully\n\t\t// synced.\n\t\tfor {\n\t\t\t// Leader should send a request.\n\t\t\tmsgs := leader.TakeAllMsgs()\n\t\t\tif len(msgs) != 1 {\n\t\t\t\tt.Fatalf(\"expected leader to send a request.\")\n\t\t\t}\n\t\t\t// Give it to follower.\n\t\t\tfollower.HandleMsg(msgs[0])\n\t\t\tmsgs = follower.TakeAllMsgs()\n\t\t\tif len(msgs) != 1 {\n\t\t\t\tt.Fatalf(\"expected follower to respond request sent from leader\")\n\t\t\t}\n\t\t\t// Give response to leader.\n\t\t\tleader.HandleMsg(msgs[0])\n\t\t\tfpeer := leader.state.(*coreLeader).peers[\"2\"]\n\n\t\t\tif fpeer.matchIndex == li {\n\t\t\t\t// Now the follower is fully synced.\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif !isLegalSyncedState(leader.storage.log, follower.storage.log) {\n\t\t\tt.Fatal(\"The logs of leader and follower are not in a legal synced state.\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0e9532d53c5d430383ac360f6ffa941e", "score": "0.41142502", "text": "func (h *Hashgraph) UpdateAncestorFirstDescendant(event Event) error {\n\tfakeCreatorID, ok := h.Participants[event.Creator()]\n\tif !ok {\n\t\treturn fmt.Errorf(\"Could not find creator fake id (%s)\", event.Creator())\n\t}\n\tindex := event.Index()\n\thash := event.Hex()\n\n\tfor i := 0; i < len(event.lastAncestors); i++ {\n\t\tah := event.lastAncestors[i].hash\n\t\tfor ah != \"\" {\n\t\t\ta, err := h.Store.GetEvent(ah)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif a.firstDescendants[fakeCreatorID].index == math.MaxInt64 {\n\t\t\t\ta.firstDescendants[fakeCreatorID] = EventCoordinates{index: index, hash: hash}\n\t\t\t\tif err := h.Store.SetEvent(a); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tah = a.SelfParent()\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ff6624ac209ee2b9af70f2eddf820b87", "score": "0.41142404", "text": "func TestMiscBadHeaders(t *testing.T) {\n\t//\n\tn, _ := openConn(t)\n\tneh := Headers{\"a\", \"b\", \"c\"} // not even number header count\n\tconn, e := Connect(n, neh)\n\tif e == nil {\n\t\tt.Fatalf(\"Expected [%v], got [nil]\\n\", EHDRLEN)\n\t}\n\tif e != EHDRLEN {\n\t\tt.Fatalf(\"Expected [%v], got [%v]\\n\", EHDRLEN, e)\n\t}\n\t//\n\tbvh := Headers{HK_HOST, \"localhost\", HK_ACCEPT_VERSION, \"3.14159\"}\n\tconn, e = Connect(n, bvh)\n\tif e == nil {\n\t\tt.Fatalf(\"Expected [%v], got [nil]\\n\", EBADVERCLI)\n\t}\n\tif e != EBADVERCLI {\n\t\tt.Fatalf(\"Expected [%v], got [%v]\\n\", EBADVERCLI, e)\n\t}\n\t//\n\tch := check11(TEST_HEADERS)\n\tconn, e = Connect(n, ch) // Should be a good connect\n\t//\n\t_, e = conn.Subscribe(neh)\n\tif e == nil {\n\t\tt.Fatalf(\"Expected [%v], got [nil]\\n\", EHDRLEN)\n\t}\n\tif e != EHDRLEN {\n\t\tt.Fatalf(\"Expected [%v], got [%v]\\n\", EHDRLEN, e)\n\t}\n\t//\n\te = conn.Unsubscribe(neh)\n\tif e == nil {\n\t\tt.Fatalf(\"Expected [%v], got [nil]\\n\", EHDRLEN)\n\t}\n\tif e != EHDRLEN {\n\t\tt.Fatalf(\"Expected [%v], got [%v]\\n\", EHDRLEN, e)\n\t}\n\t//\n\tif conn != nil && conn.Connected() {\n\t\t_ = conn.Disconnect(empty_headers)\n\t}\n\t_ = closeConn(t, n)\n}", "title": "" }, { "docid": "5a784fdcfb9ecabcca180a87603271f8", "score": "0.41061333", "text": "func (r *record) SameHeader(o Record) bool {\r\n\th := o.Header()\r\n\tif len(r.header) != len(h) {\r\n\t\treturn false\r\n\t} else if len(h) == 0 || &h[0] == &r.header[0] {\r\n\t\t// two slices with the same address and length have the same contents\r\n\t\treturn true\r\n\t} else {\r\n\t\tfor i, k := range r.header {\r\n\t\t\tif h[i] != k {\r\n\t\t\t\treturn false\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true\r\n\t}\r\n}", "title": "" }, { "docid": "c2fe2a0c7f38021eb6a2479691e72ba7", "score": "0.41018814", "text": "func newResourceDelta(\n\ta *resource,\n\tb *resource,\n) *ackcompare.Delta {\n\tdelta := ackcompare.NewDelta()\n\tif (a == nil && b != nil) ||\n\t\t(a != nil && b == nil) {\n\t\tdelta.Add(\"\", a, b)\n\t\treturn delta\n\t}\n\n\tif ackcompare.HasNilDifference(a.ko.Spec.AtRestEncryptionEnabled, b.ko.Spec.AtRestEncryptionEnabled) {\n\t\tdelta.Add(\"Spec.AtRestEncryptionEnabled\", a.ko.Spec.AtRestEncryptionEnabled, b.ko.Spec.AtRestEncryptionEnabled)\n\t} else if a.ko.Spec.AtRestEncryptionEnabled != nil && b.ko.Spec.AtRestEncryptionEnabled != nil {\n\t\tif *a.ko.Spec.AtRestEncryptionEnabled != *b.ko.Spec.AtRestEncryptionEnabled {\n\t\t\tdelta.Add(\"Spec.AtRestEncryptionEnabled\", a.ko.Spec.AtRestEncryptionEnabled, b.ko.Spec.AtRestEncryptionEnabled)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.AuthToken, b.ko.Spec.AuthToken) {\n\t\tdelta.Add(\"Spec.AuthToken\", a.ko.Spec.AuthToken, b.ko.Spec.AuthToken)\n\t} else if a.ko.Spec.AuthToken != nil && b.ko.Spec.AuthToken != nil {\n\t\tif *a.ko.Spec.AuthToken != *b.ko.Spec.AuthToken {\n\t\t\tdelta.Add(\"Spec.AuthToken\", a.ko.Spec.AuthToken, b.ko.Spec.AuthToken)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.AutomaticFailoverEnabled, b.ko.Spec.AutomaticFailoverEnabled) {\n\t\tdelta.Add(\"Spec.AutomaticFailoverEnabled\", a.ko.Spec.AutomaticFailoverEnabled, b.ko.Spec.AutomaticFailoverEnabled)\n\t} else if a.ko.Spec.AutomaticFailoverEnabled != nil && b.ko.Spec.AutomaticFailoverEnabled != nil {\n\t\tif *a.ko.Spec.AutomaticFailoverEnabled != *b.ko.Spec.AutomaticFailoverEnabled {\n\t\t\tdelta.Add(\"Spec.AutomaticFailoverEnabled\", a.ko.Spec.AutomaticFailoverEnabled, b.ko.Spec.AutomaticFailoverEnabled)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.CacheNodeType, b.ko.Spec.CacheNodeType) {\n\t\tdelta.Add(\"Spec.CacheNodeType\", a.ko.Spec.CacheNodeType, b.ko.Spec.CacheNodeType)\n\t} else if a.ko.Spec.CacheNodeType != nil && b.ko.Spec.CacheNodeType != nil {\n\t\tif *a.ko.Spec.CacheNodeType != *b.ko.Spec.CacheNodeType {\n\t\t\tdelta.Add(\"Spec.CacheNodeType\", a.ko.Spec.CacheNodeType, b.ko.Spec.CacheNodeType)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.CacheParameterGroupName, b.ko.Spec.CacheParameterGroupName) {\n\t\tdelta.Add(\"Spec.CacheParameterGroupName\", a.ko.Spec.CacheParameterGroupName, b.ko.Spec.CacheParameterGroupName)\n\t} else if a.ko.Spec.CacheParameterGroupName != nil && b.ko.Spec.CacheParameterGroupName != nil {\n\t\tif *a.ko.Spec.CacheParameterGroupName != *b.ko.Spec.CacheParameterGroupName {\n\t\t\tdelta.Add(\"Spec.CacheParameterGroupName\", a.ko.Spec.CacheParameterGroupName, b.ko.Spec.CacheParameterGroupName)\n\t\t}\n\t}\n\tif !ackcompare.SliceStringPEqual(a.ko.Spec.CacheSecurityGroupNames, b.ko.Spec.CacheSecurityGroupNames) {\n\t\tdelta.Add(\"Spec.CacheSecurityGroupNames\", a.ko.Spec.CacheSecurityGroupNames, b.ko.Spec.CacheSecurityGroupNames)\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.CacheSubnetGroupName, b.ko.Spec.CacheSubnetGroupName) {\n\t\tdelta.Add(\"Spec.CacheSubnetGroupName\", a.ko.Spec.CacheSubnetGroupName, b.ko.Spec.CacheSubnetGroupName)\n\t} else if a.ko.Spec.CacheSubnetGroupName != nil && b.ko.Spec.CacheSubnetGroupName != nil {\n\t\tif *a.ko.Spec.CacheSubnetGroupName != *b.ko.Spec.CacheSubnetGroupName {\n\t\t\tdelta.Add(\"Spec.CacheSubnetGroupName\", a.ko.Spec.CacheSubnetGroupName, b.ko.Spec.CacheSubnetGroupName)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.Engine, b.ko.Spec.Engine) {\n\t\tdelta.Add(\"Spec.Engine\", a.ko.Spec.Engine, b.ko.Spec.Engine)\n\t} else if a.ko.Spec.Engine != nil && b.ko.Spec.Engine != nil {\n\t\tif *a.ko.Spec.Engine != *b.ko.Spec.Engine {\n\t\t\tdelta.Add(\"Spec.Engine\", a.ko.Spec.Engine, b.ko.Spec.Engine)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.EngineVersion, b.ko.Spec.EngineVersion) {\n\t\tdelta.Add(\"Spec.EngineVersion\", a.ko.Spec.EngineVersion, b.ko.Spec.EngineVersion)\n\t} else if a.ko.Spec.EngineVersion != nil && b.ko.Spec.EngineVersion != nil {\n\t\tif *a.ko.Spec.EngineVersion != *b.ko.Spec.EngineVersion {\n\t\t\tdelta.Add(\"Spec.EngineVersion\", a.ko.Spec.EngineVersion, b.ko.Spec.EngineVersion)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.KMSKeyID, b.ko.Spec.KMSKeyID) {\n\t\tdelta.Add(\"Spec.KMSKeyID\", a.ko.Spec.KMSKeyID, b.ko.Spec.KMSKeyID)\n\t} else if a.ko.Spec.KMSKeyID != nil && b.ko.Spec.KMSKeyID != nil {\n\t\tif *a.ko.Spec.KMSKeyID != *b.ko.Spec.KMSKeyID {\n\t\t\tdelta.Add(\"Spec.KMSKeyID\", a.ko.Spec.KMSKeyID, b.ko.Spec.KMSKeyID)\n\t\t}\n\t}\n\tif !reflect.DeepEqual(a.ko.Spec.LogDeliveryConfigurations, b.ko.Spec.LogDeliveryConfigurations) {\n\t\tdelta.Add(\"Spec.LogDeliveryConfigurations\", a.ko.Spec.LogDeliveryConfigurations, b.ko.Spec.LogDeliveryConfigurations)\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.MultiAZEnabled, b.ko.Spec.MultiAZEnabled) {\n\t\tdelta.Add(\"Spec.MultiAZEnabled\", a.ko.Spec.MultiAZEnabled, b.ko.Spec.MultiAZEnabled)\n\t} else if a.ko.Spec.MultiAZEnabled != nil && b.ko.Spec.MultiAZEnabled != nil {\n\t\tif *a.ko.Spec.MultiAZEnabled != *b.ko.Spec.MultiAZEnabled {\n\t\t\tdelta.Add(\"Spec.MultiAZEnabled\", a.ko.Spec.MultiAZEnabled, b.ko.Spec.MultiAZEnabled)\n\t\t}\n\t}\n\tif !reflect.DeepEqual(a.ko.Spec.NodeGroupConfiguration, b.ko.Spec.NodeGroupConfiguration) {\n\t\tdelta.Add(\"Spec.NodeGroupConfiguration\", a.ko.Spec.NodeGroupConfiguration, b.ko.Spec.NodeGroupConfiguration)\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.NotificationTopicARN, b.ko.Spec.NotificationTopicARN) {\n\t\tdelta.Add(\"Spec.NotificationTopicARN\", a.ko.Spec.NotificationTopicARN, b.ko.Spec.NotificationTopicARN)\n\t} else if a.ko.Spec.NotificationTopicARN != nil && b.ko.Spec.NotificationTopicARN != nil {\n\t\tif *a.ko.Spec.NotificationTopicARN != *b.ko.Spec.NotificationTopicARN {\n\t\t\tdelta.Add(\"Spec.NotificationTopicARN\", a.ko.Spec.NotificationTopicARN, b.ko.Spec.NotificationTopicARN)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.NumNodeGroups, b.ko.Spec.NumNodeGroups) {\n\t\tdelta.Add(\"Spec.NumNodeGroups\", a.ko.Spec.NumNodeGroups, b.ko.Spec.NumNodeGroups)\n\t} else if a.ko.Spec.NumNodeGroups != nil && b.ko.Spec.NumNodeGroups != nil {\n\t\tif *a.ko.Spec.NumNodeGroups != *b.ko.Spec.NumNodeGroups {\n\t\t\tdelta.Add(\"Spec.NumNodeGroups\", a.ko.Spec.NumNodeGroups, b.ko.Spec.NumNodeGroups)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.Port, b.ko.Spec.Port) {\n\t\tdelta.Add(\"Spec.Port\", a.ko.Spec.Port, b.ko.Spec.Port)\n\t} else if a.ko.Spec.Port != nil && b.ko.Spec.Port != nil {\n\t\tif *a.ko.Spec.Port != *b.ko.Spec.Port {\n\t\t\tdelta.Add(\"Spec.Port\", a.ko.Spec.Port, b.ko.Spec.Port)\n\t\t}\n\t}\n\tif !ackcompare.SliceStringPEqual(a.ko.Spec.PreferredCacheClusterAZs, b.ko.Spec.PreferredCacheClusterAZs) {\n\t\tdelta.Add(\"Spec.PreferredCacheClusterAZs\", a.ko.Spec.PreferredCacheClusterAZs, b.ko.Spec.PreferredCacheClusterAZs)\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.PreferredMaintenanceWindow, b.ko.Spec.PreferredMaintenanceWindow) {\n\t\tdelta.Add(\"Spec.PreferredMaintenanceWindow\", a.ko.Spec.PreferredMaintenanceWindow, b.ko.Spec.PreferredMaintenanceWindow)\n\t} else if a.ko.Spec.PreferredMaintenanceWindow != nil && b.ko.Spec.PreferredMaintenanceWindow != nil {\n\t\tif *a.ko.Spec.PreferredMaintenanceWindow != *b.ko.Spec.PreferredMaintenanceWindow {\n\t\t\tdelta.Add(\"Spec.PreferredMaintenanceWindow\", a.ko.Spec.PreferredMaintenanceWindow, b.ko.Spec.PreferredMaintenanceWindow)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.PrimaryClusterID, b.ko.Spec.PrimaryClusterID) {\n\t\tdelta.Add(\"Spec.PrimaryClusterID\", a.ko.Spec.PrimaryClusterID, b.ko.Spec.PrimaryClusterID)\n\t} else if a.ko.Spec.PrimaryClusterID != nil && b.ko.Spec.PrimaryClusterID != nil {\n\t\tif *a.ko.Spec.PrimaryClusterID != *b.ko.Spec.PrimaryClusterID {\n\t\t\tdelta.Add(\"Spec.PrimaryClusterID\", a.ko.Spec.PrimaryClusterID, b.ko.Spec.PrimaryClusterID)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.ReplicasPerNodeGroup, b.ko.Spec.ReplicasPerNodeGroup) {\n\t\tdelta.Add(\"Spec.ReplicasPerNodeGroup\", a.ko.Spec.ReplicasPerNodeGroup, b.ko.Spec.ReplicasPerNodeGroup)\n\t} else if a.ko.Spec.ReplicasPerNodeGroup != nil && b.ko.Spec.ReplicasPerNodeGroup != nil {\n\t\tif *a.ko.Spec.ReplicasPerNodeGroup != *b.ko.Spec.ReplicasPerNodeGroup {\n\t\t\tdelta.Add(\"Spec.ReplicasPerNodeGroup\", a.ko.Spec.ReplicasPerNodeGroup, b.ko.Spec.ReplicasPerNodeGroup)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.ReplicationGroupDescription, b.ko.Spec.ReplicationGroupDescription) {\n\t\tdelta.Add(\"Spec.ReplicationGroupDescription\", a.ko.Spec.ReplicationGroupDescription, b.ko.Spec.ReplicationGroupDescription)\n\t} else if a.ko.Spec.ReplicationGroupDescription != nil && b.ko.Spec.ReplicationGroupDescription != nil {\n\t\tif *a.ko.Spec.ReplicationGroupDescription != *b.ko.Spec.ReplicationGroupDescription {\n\t\t\tdelta.Add(\"Spec.ReplicationGroupDescription\", a.ko.Spec.ReplicationGroupDescription, b.ko.Spec.ReplicationGroupDescription)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.ReplicationGroupID, b.ko.Spec.ReplicationGroupID) {\n\t\tdelta.Add(\"Spec.ReplicationGroupID\", a.ko.Spec.ReplicationGroupID, b.ko.Spec.ReplicationGroupID)\n\t} else if a.ko.Spec.ReplicationGroupID != nil && b.ko.Spec.ReplicationGroupID != nil {\n\t\tif *a.ko.Spec.ReplicationGroupID != *b.ko.Spec.ReplicationGroupID {\n\t\t\tdelta.Add(\"Spec.ReplicationGroupID\", a.ko.Spec.ReplicationGroupID, b.ko.Spec.ReplicationGroupID)\n\t\t}\n\t}\n\tif !ackcompare.SliceStringPEqual(a.ko.Spec.SecurityGroupIDs, b.ko.Spec.SecurityGroupIDs) {\n\t\tdelta.Add(\"Spec.SecurityGroupIDs\", a.ko.Spec.SecurityGroupIDs, b.ko.Spec.SecurityGroupIDs)\n\t}\n\tif !ackcompare.SliceStringPEqual(a.ko.Spec.SnapshotARNs, b.ko.Spec.SnapshotARNs) {\n\t\tdelta.Add(\"Spec.SnapshotARNs\", a.ko.Spec.SnapshotARNs, b.ko.Spec.SnapshotARNs)\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.SnapshotName, b.ko.Spec.SnapshotName) {\n\t\tdelta.Add(\"Spec.SnapshotName\", a.ko.Spec.SnapshotName, b.ko.Spec.SnapshotName)\n\t} else if a.ko.Spec.SnapshotName != nil && b.ko.Spec.SnapshotName != nil {\n\t\tif *a.ko.Spec.SnapshotName != *b.ko.Spec.SnapshotName {\n\t\t\tdelta.Add(\"Spec.SnapshotName\", a.ko.Spec.SnapshotName, b.ko.Spec.SnapshotName)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.SnapshotRetentionLimit, b.ko.Spec.SnapshotRetentionLimit) {\n\t\tdelta.Add(\"Spec.SnapshotRetentionLimit\", a.ko.Spec.SnapshotRetentionLimit, b.ko.Spec.SnapshotRetentionLimit)\n\t} else if a.ko.Spec.SnapshotRetentionLimit != nil && b.ko.Spec.SnapshotRetentionLimit != nil {\n\t\tif *a.ko.Spec.SnapshotRetentionLimit != *b.ko.Spec.SnapshotRetentionLimit {\n\t\t\tdelta.Add(\"Spec.SnapshotRetentionLimit\", a.ko.Spec.SnapshotRetentionLimit, b.ko.Spec.SnapshotRetentionLimit)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.SnapshotWindow, b.ko.Spec.SnapshotWindow) {\n\t\tdelta.Add(\"Spec.SnapshotWindow\", a.ko.Spec.SnapshotWindow, b.ko.Spec.SnapshotWindow)\n\t} else if a.ko.Spec.SnapshotWindow != nil && b.ko.Spec.SnapshotWindow != nil {\n\t\tif *a.ko.Spec.SnapshotWindow != *b.ko.Spec.SnapshotWindow {\n\t\t\tdelta.Add(\"Spec.SnapshotWindow\", a.ko.Spec.SnapshotWindow, b.ko.Spec.SnapshotWindow)\n\t\t}\n\t}\n\tif !reflect.DeepEqual(a.ko.Spec.Tags, b.ko.Spec.Tags) {\n\t\tdelta.Add(\"Spec.Tags\", a.ko.Spec.Tags, b.ko.Spec.Tags)\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.TransitEncryptionEnabled, b.ko.Spec.TransitEncryptionEnabled) {\n\t\tdelta.Add(\"Spec.TransitEncryptionEnabled\", a.ko.Spec.TransitEncryptionEnabled, b.ko.Spec.TransitEncryptionEnabled)\n\t} else if a.ko.Spec.TransitEncryptionEnabled != nil && b.ko.Spec.TransitEncryptionEnabled != nil {\n\t\tif *a.ko.Spec.TransitEncryptionEnabled != *b.ko.Spec.TransitEncryptionEnabled {\n\t\t\tdelta.Add(\"Spec.TransitEncryptionEnabled\", a.ko.Spec.TransitEncryptionEnabled, b.ko.Spec.TransitEncryptionEnabled)\n\t\t}\n\t}\n\tif !ackcompare.SliceStringPEqual(a.ko.Spec.UserGroupIDs, b.ko.Spec.UserGroupIDs) {\n\t\tdelta.Add(\"Spec.UserGroupIDs\", a.ko.Spec.UserGroupIDs, b.ko.Spec.UserGroupIDs)\n\t}\n\n\tfilterDelta(delta, a, b)\n\treturn delta\n}", "title": "" }, { "docid": "c7162bc27945feec1fc9c99a961a2263", "score": "0.40894794", "text": "func verifyBlockSignature(ctx context.Context, blk types.BlockHeader, nv network.Version, curEpoch abi.ChainEpoch, receiver address.Address, gasIpld cbornode.IpldStore, view FaultStateView, getter vmcontext.LookbackStateGetter) error {\n\tif nv >= network.Version7 && blk.Height < curEpoch-policy.ChainFinality {\n\t\treturn fmt.Errorf(\"cannot get worker key (currEpoch %d, height %d)\", curEpoch, blk.Height)\n\t}\n\n\tlbstate, err := getter(ctx, blk.Height)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"fialed to look back state at height %d\", blk.Height)\n\t}\n\n\tact, err := lbstate.LoadActor(ctx, receiver)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to get miner actor\")\n\t}\n\n\tmas, err := miner.Load(adt.WrapStore(ctx, gasIpld), act)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to load state for miner %s\", receiver)\n\t}\n\n\tinfo, err := mas.Info()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get miner info for miner %s\", receiver)\n\t}\n\n\tif blk.BlockSig == nil {\n\t\treturn errors.Errorf(\"no consensus fault: block %s has nil signature\", blk.Cid())\n\t}\n\n\tsd, err := blk.SignatureData()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = state.NewSignatureValidator(view).ValidateSignature(ctx, sd, info.Worker, *blk.BlockSig)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"no consensus fault: block %s signature invalid\", blk.Cid())\n\t}\n\treturn err\n}", "title": "" }, { "docid": "cebe9120adf812b1ed5da776b20cceef", "score": "0.40813875", "text": "func HanleVersion(request []byte, chain *blockchain.BlockChain) {\n\tvar buff bytes.Buffer\n\tvar payload Version\n\n\tbuff.Write(request[commandLength:])\n\tdec := gob.NewDecoder(&buff)\n\terr := dec.Decode(&payload)\n\tErrorHandler(err)\n\n\tbestHeight := chain.GetBestHeight()\n\totherHeight := payload.BestHeight\n\n\tif bestHeight < otherHeight {\n\t\tSendGetBlock(payload.AddrFrom)\n\t} else {\n\t\tSendVersion(payload.AddrFrom, chain)\n\t}\n\n\tif !NodeIsKnown(payload.AddrFrom) {\n\t\tKnownNodes = append(KnownNodes, payload.AddrFrom)\n\t}\n}", "title": "" }, { "docid": "cb3a52e7e07db0b5b35553320fb593df", "score": "0.40741092", "text": "func TestHostBlockHeightWithinTolerance(t *testing.T) {\n\tt.Parallel()\n\n\tl := priceTableHostBlockHeightLeeWay\n\tinputs := []struct {\n\t\tRenterSynced bool\n\t\tRenterBlockHeight types.BlockHeight\n\t\tHostBlockHeight types.BlockHeight\n\t\tExpectedOutcome bool\n\t}{\n\t\t{true, l - 1, 0, true}, // renter synced and hbh lower (verify underflow)\n\t\t{true, l, 0, true}, // renter synced and hbh lower\n\t\t{true, l + 1, 0, false}, // renter synced and hbh too low\n\t\t{false, l, 0, false}, // renter not synced and hbh lower\n\t\t{true, 1, 1 + l, true}, // renter synced and hbh higher\n\t\t{true, l + 1, 1, true}, // renter synced and hbh lower\n\t\t{true, 0, l + 1, false}, // renter synced and hbh too high\n\t\t{true, l + 2, 1, false}, // renter synced and hbh too low\n\t\t{false, 5, 4, false}, // renter not synced and hbh too low\n\t\t{false, 5, 5, true}, // renter not synced and hbh equal\n\t\t{false, 5, 6, true}, // renter not synced and hbh higher\n\t}\n\n\tfor _, input := range inputs {\n\t\tif hostBlockHeightWithinTolerance(input.RenterSynced, input.RenterBlockHeight, input.HostBlockHeight) != input.ExpectedOutcome {\n\t\t\tt.Fatal(\"unexpected outcome\", input)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1187ae9471ca376c86a149f6a7c7ad45", "score": "0.40732154", "text": "func TestHeadersAddDelete(t *testing.T) {\n\tha := Headers{\"ka\", \"va\", \"kb\", \"vb\", \"kc\", \"vc\"}\n\thb := Headers{\"kaa\", \"va\", \"kbb\", \"vb\", \"kcc\", \"vc\"}\n\thn := ha.AddHeaders(hb)\n\tif len(ha)+len(hb) != len(hn) {\n\t\tt.Fatalf(\"Unexpected length AddHeaders, got: [%v], expected: [%v]\\n\", len(hn), len(ha)+len(hb))\n\t}\n\tol := len(hn)\n\thn = hn.Delete(\"ka\")\n\tif len(hn) != ol-2 {\n\t\tt.Fatalf(\"Unexpected length Delete 1, got: [%v], expected: [%v]\\n\", len(hn), ol-2)\n\t}\n\thn = hn.Delete(\"kcc\")\n\tif len(hn) != ol-4 {\n\t\tt.Fatalf(\"Unexpected length Delete 2, got: [%v], expected: [%v]\\n\", len(hn), ol-4)\n\t}\n}", "title": "" }, { "docid": "531c5a1cb07ce58da4b34c1b318a0380", "score": "0.40675396", "text": "func headsEqual(h1, h2 xinerama.Heads) bool {\n\tif len(h1) != len(h2) {\n\t\treturn false\n\t}\n\tfor i, h := range h1 {\n\t\tx1, y1, w1, h1 := h.Pieces()\n\t\tx2, y2, w2, h2 := h2[i].Pieces()\n\t\tif x1 != x2 || y1 != y2 || w1 != w2 || h1 != h2 {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "05c9cfa751bb6426a59aa6653f13edb0", "score": "0.4057457", "text": "func TestComputeTraceGroups(t *testing.T) {\n\n\tvar tt1, tt2, tt3 traceTuple\n\ttt1.hostname = \"hostA\"\n\ttt2.hostname = \"hostB\"\n\ttt3.hostname = \"hostC\"\n\ttt1.firstUniques = make([]common.Chunk, 0)\n\ttt2.firstUniques = make([]common.Chunk, 0)\n\ttt3.firstUniques = make([]common.Chunk, 0)\n\n\ttuples := []*traceTuple{&tt1, &tt2}\n\n\t// with theshold 1 nothing should be merged (only if both have chunks and are equal)\n\tif res := computeNewTraceGroups(tuples, 1, 42); len(res) != 2 {\n\t\tt.Fatalf(\"wrong number of groups. expected: %v, got: %v\", 2, len(res))\n\t} else if len(res[0]) != 1 {\n\t\tt.Fatalf(\"wrong size of first group. expected: %v, got: %v\", 1, len(res[0]))\n\t} else if len(res[1]) != 1 {\n\t\tt.Fatalf(\"wrong size of second group. expected: %v, got: %v\", 1, len(res[1]))\n\t}\n\n\t// with threshold 0 everything should be merged together\n\tif res := computeNewTraceGroups(tuples, 0, 42); len(res) != 1 {\n\t\tt.Fatalf(\"wrong number of groups. expected: %v, got: %v\", 1, len(res))\n\t} else if len(res[0]) != 2 {\n\t\tt.Fatalf(\"wrong size of first group. expected: %v, got: %v\", 2, len(res[0]))\n\t}\n\n\t// test with chunks\n\tbuffer := new(bytes.Buffer)\n\tif err := binary.Write(buffer, binary.LittleEndian, int64(42)); err != nil {\n\t\tt.Fatalf(\"writing binary representaion failed: %v\", err)\n\t}\n\tc := common.Chunk{Digest: make([]byte, 12)}\n\tcopy(c.Digest, buffer.Bytes())\n\ttt1.firstUniques = append(tt1.firstUniques, c)\n\n\tbuffer.Reset()\n\tif err := binary.Write(buffer, binary.LittleEndian, int64(17)); err != nil {\n\t\tt.Fatalf(\"writing binary representaion failed: %v\", err)\n\t}\n\tc = common.Chunk{Digest: make([]byte, 12)}\n\tcopy(c.Digest, buffer.Bytes())\n\ttt2.firstUniques = append(tt2.firstUniques, c)\n\n\t// both should be merged since they fit into 1 page\n\tif res := computeNewTraceGroups(tuples, 0.5, 42); len(res) != 1 {\n\t\tt.Fatalf(\"wrong number of groups. expected: %v, got: %v\", 1, len(res))\n\t} else if len(res[0]) != 2 {\n\t\tt.Fatalf(\"wrong size of first group. expected: %v, got: %v\", 2, len(res[0]))\n\t}\n\n\t// no merge because the average utilazation is 0.5\n\tif res := computeNewTraceGroups(tuples, 1, 1); len(res) != 2 {\n\t\tt.Fatalf(\"wrong number of groups. expected: %v, got: %v\", 2, len(res))\n\t} else if len(res[0]) != 1 {\n\t\tt.Fatalf(\"wrong size of first group. expected: %v, got: %v\", 1, len(res[0]))\n\t} else if len(res[1]) != 1 {\n\t\tt.Fatalf(\"wrong size of second group. expected: %v, got: %v\", 2, len(res[1]))\n\t}\n\n\t// both should be merged now\n\tif res := computeNewTraceGroups(tuples, 0.5, 1); len(res) != 1 {\n\t\tt.Fatalf(\"wrong number of groups. expected: %v, got: %v\", 1, len(res))\n\t} else if len(res[0]) != 2 {\n\t\tt.Fatalf(\"wrong size of first group. expected: %v, got: %v\", 2, len(res[0]))\n\t}\n\n\t// test with 3 traces\n\ttuples = []*traceTuple{&tt1, &tt2, &tt3}\n\tbuffer.Reset()\n\tif err := binary.Write(buffer, binary.LittleEndian, int64(42)); err != nil {\n\t\tt.Fatalf(\"writing binary representaion failed: %v\", err)\n\t}\n\tc = common.Chunk{Digest: make([]byte, 12)}\n\tcopy(c.Digest, buffer.Bytes())\n\ttt3.firstUniques = append(tt3.firstUniques, c)\n\n\t// all should be merged since they fit into 1 page\n\tif res := computeNewTraceGroups(tuples, 0.2, 42); len(res) != 1 {\n\t\tt.Fatalf(\"wrong number of groups. expected: %v, got: %v\", 1, len(res))\n\t} else if len(res[0]) != 3 {\n\t\tt.Fatalf(\"wrong size of first group. expected: %v, got: %v\", 3, len(res[0]))\n\t}\n\n\t// only 1 merge because the max util after the first is only 0.5\n\tif res := computeNewTraceGroups(tuples, 0.6, 42); len(res) != 2 {\n\t\tt.Fatalf(\"wrong number of groups. expected: %v, got: %v\", 2, len(res))\n\t} else if len(res[0]) != 2 {\n\t\tt.Fatalf(\"wrong size of first group. expected: %v, got: %v\", 2, len(res[0]))\n\t} else if len(res[1]) != 1 {\n\t\tt.Fatalf(\"wrong size of first group. expected: %v, got: %v\", 1, len(res[1]))\n\t}\n}", "title": "" }, { "docid": "9b8c24d92270277f7c5904c87d251fbc", "score": "0.40438485", "text": "func AssertBlockOrderAndHeight(t *testing.T, h *Harness, order, total, height uint64) {\n\t// order\n\tif c, err := h.Client.BlockCount(); err != nil {\n\t\tt.Errorf(\"test failed : %v\", err)\n\t} else {\n\t\texpect := order\n\t\tif c != expect {\n\t\t\tt.Errorf(\"test failed, expect %v , but got %v\", expect, c)\n\t\t}\n\t}\n\t// total block\n\tif tal, err := h.Client.BlockTotal(); err != nil {\n\t\tt.Errorf(\"test failed : %v\", err)\n\t} else {\n\t\texpect := total\n\t\tif tal != expect {\n\t\t\tt.Errorf(\"test failed, expect %v , but got %v\", expect, tal)\n\t\t}\n\t}\n\t// main height\n\tif h, err := h.Client.MainHeight(); err != nil {\n\t\tt.Errorf(\"test failed : %v\", err)\n\t} else {\n\t\texpect := height\n\t\tif h != expect {\n\t\t\tt.Errorf(\"test failed, expect %v , but got %v\", expect, h)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "24469491ce93853521a9a87d6113b3e2", "score": "0.40396804", "text": "func TestCancelRequestMidBody_h1(t *testing.T) { testCancelRequestMidBody(t, h1Mode) }", "title": "" }, { "docid": "a3ab276555888f053101ca7b95b92a30", "score": "0.4039585", "text": "func IsInSameChain(b1, b2 *protocol.Block) bool {\n\n\tSameChainMutex.Lock()\n\tdefer SameChainMutex.Unlock()\n\tvar higherBlock, lowerBlock *protocol.Block\n\n\tif b1.Height == b2.Height {\n\t\treturn false\n\t}\n\n\tif b1.Height > b2.Height {\n\t\thigherBlock = b1\n\t\tlowerBlock = b2\n\t} else {\n\t\thigherBlock = b2\n\t\tlowerBlock = b1\n\t}\n\n\tfor higherBlock.Height > 0 {\n\t\tnewHigherBlock := storage.ReadClosedBlock(higherBlock.PrevHash)\n\t\t//Check blocks without transactions\n\t\tif newHigherBlock == nil {\n\t\t\tnewHigherBlock = storage.ReadClosedBlockWithoutTx(higherBlock.PrevHashWithoutTx)\n\t\t}\n\t\tif newHigherBlock == nil {\n\t\t\tp2p.BlockReq(higherBlock.PrevHash, higherBlock.PrevHashWithoutTx)\n\n\t\t\t//Blocking wait\n\t\t\tselect {\n\t\t\tcase encodedBlock := <-p2p.BlockReqChan:\n\t\t\t\tnewHigherBlock = newHigherBlock.Decode(encodedBlock)\n\t\t\t\tstorage.WriteToReceivedStash(newHigherBlock)\n\t\t\t\t//Limit waiting time to BLOCKFETCH_TIMEOUT seconds before aborting.\n\t\t\tcase <-time.After(BLOCKFETCH_TIMEOUT * time.Second):\n\t\t\t\tif p2p.BlockAlreadyReceived(storage.ReadReceivedBlockStash(), higherBlock.PrevHash) {\n\t\t\t\t\tfor _, block := range storage.ReadReceivedBlockStash() {\n\t\t\t\t\t\tif block.Hash == higherBlock.PrevHash {\n\t\t\t\t\t\t\tnewHigherBlock = block\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlogger.Printf(\"Block %x received Before\", higherBlock.PrevHash)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tlogger.Printf(\"Higher Block %x, %x is nil --> Break\", higherBlock.PrevHash, higherBlock.PrevHashWithoutTx)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif higherBlock != nil {\n\t\t\thigherBlock = newHigherBlock\n\t\t\tif higherBlock.Hash == lowerBlock.Hash {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7c2eb6af0dcdffae1c03c040d910cbf5", "score": "0.4034485", "text": "func checkBlockSanity(block *ndrutil.Block, timeSource MedianTimeSource, flags BehaviorFlags, chainParams *chaincfg.Params) error {\n\tmsgBlock := block.MsgBlock()\n\theader := &msgBlock.Header\n\terr := checkBlockHeaderSanity(header, timeSource, flags, chainParams)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// A block must have at least one regular transaction.\n\tnumTx := len(msgBlock.Transactions)\n\tif numTx == 0 {\n\t\treturn ruleError(ErrNoTransactions, \"block does not contain \"+\n\t\t\t\"any transactions\")\n\t}\n\n\t// A block must not exceed the maximum allowed block payload when\n\t// serialized.\n\t//\n\t// This is a quick and context-free sanity check of the maximum block\n\t// size according to the wire protocol. Even though the wire protocol\n\t// already prevents blocks bigger than this limit, there are other\n\t// methods of receiving a block that might not have been checked\n\t// already. A separate block size is enforced later that takes into\n\t// account the network-specific block size and the results of block\n\t// size votes. Typically that block size is more restrictive than this\n\t// one.\n\tserializedSize := msgBlock.SerializeSize()\n\tif serializedSize > wire.MaxBlockPayload {\n\t\tstr := fmt.Sprintf(\"serialized block is too big - got %d, \"+\n\t\t\t\"max %d\", serializedSize, wire.MaxBlockPayload)\n\t\treturn ruleError(ErrBlockTooBig, str)\n\t}\n\n\t// The first transaction in a block's regular tree must be a coinbase.\n\ttransactions := block.Transactions()\n\tif !IsCoinBaseTx(transactions[0].MsgTx()) {\n\t\treturn ruleError(ErrFirstTxNotCoinbase, \"first transaction in \"+\n\t\t\t\"block is not a coinbase\")\n\t}\n\n\t// A block must not have more than one coinbase.\n\tfor i, tx := range transactions[1:] {\n\t\tif IsCoinBaseTx(tx.MsgTx()) {\n\t\t\tstr := fmt.Sprintf(\"block contains second coinbase at \"+\n\t\t\t\t\"index %d\", i+1)\n\t\t\treturn ruleError(ErrMultipleCoinbases, str)\n\t\t}\n\t}\n\n\t// Do some preliminary checks on each regular transaction to ensure they\n\t// are sane before continuing.\n\tfor _, tx := range transactions {\n\t\t// A block must not have stake transactions in the regular\n\t\t// transaction tree.\n\t\tmsgTx := tx.MsgTx()\n\n\t\terr := CheckTransactionSanity(msgTx, chainParams)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Build merkle tree and ensure the calculated merkle root matches the\n\t// entry in the block header. This also has the effect of caching all\n\t// of the transaction hashes in the block to speed up future hash\n\t// checks. Bitcoind builds the tree here and checks the merkle root\n\t// after the following checks, but there is no reason not to check the\n\t// merkle root matches here.\n\tmerkles := BuildMerkleTreeStore(block.Transactions())\n\tcalculatedMerkleRoot := merkles[len(merkles)-1]\n\tif !header.MerkleRoot.IsEqual(calculatedMerkleRoot) {\n\t\tstr := fmt.Sprintf(\"block merkle root is invalid - block \"+\n\t\t\t\"header indicates %v, but calculated value is %v\",\n\t\t\theader.MerkleRoot, calculatedMerkleRoot)\n\t\treturn ruleError(ErrBadMerkleRoot, str)\n\t}\n\n\t// Check for duplicate transactions. This check will be fairly quick\n\t// since the transaction hashes are already cached due to building the\n\t// merkle trees above.\n\texistingTxHashes := make(map[chainhash.Hash]struct{})\n\tallTransactions := transactions\n\n\tfor _, tx := range allTransactions {\n\t\thash := tx.Hash()\n\t\tif _, exists := existingTxHashes[*hash]; exists {\n\t\t\tstr := fmt.Sprintf(\"block contains duplicate \"+\n\t\t\t\t\"transaction %v\", hash)\n\t\t\treturn ruleError(ErrDuplicateTx, str)\n\t\t}\n\t\texistingTxHashes[*hash] = struct{}{}\n\t}\n\n\t// The number of signature operations must be less than the maximum\n\t// allowed per block.\n\ttotalSigOps := 0\n\tfor _, tx := range allTransactions {\n\t\t// We could potentially overflow the accumulator so check for\n\t\t// overflow.\n\t\tlastSigOps := totalSigOps\n\n\t\tmsgTx := tx.MsgTx()\n\t\tisCoinBase := IsCoinBaseTx(msgTx)\n\t\ttotalSigOps += CountSigOps(tx, isCoinBase)\n\t\tif totalSigOps < lastSigOps || totalSigOps > MaxSigOpsPerBlock {\n\t\t\tstr := fmt.Sprintf(\"block contains too many signature \"+\n\t\t\t\t\"operations - got %v, max %v\", totalSigOps,\n\t\t\t\tMaxSigOpsPerBlock)\n\t\t\treturn ruleError(ErrTooManySigOps, str)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" } ]
900ab338da6024c527ba70a21e2ce4c4
Tag returns current tag of a config
[ { "docid": "a6632d95681dc76559c9b54cbce9522c", "score": "0.7357911", "text": "func (config ProvisionerConfig) Tag() string {\n\treturn config.tag\n}", "title": "" } ]
[ { "docid": "f1af1beaac6290de290a7ef52add10bc", "score": "0.64995736", "text": "func Tag() string {\n\treturn defaultManager.Tag()\n}", "title": "" }, { "docid": "4d64b62142700271c505f57302571e4b", "score": "0.6461414", "text": "func (ir ImageRepository) Tag() string {\n\t// No check here, should call Valid() before calling name\n\tsegments := strings.SplitN(string(ir), \":\", 2)\n\tif len(segments) < 2 {\n\t\treturn \"\"\n\t}\n\n\treturn segments[1]\n}", "title": "" }, { "docid": "e8dbb2d18745bb98741404198f741b95", "score": "0.64063436", "text": "func GetTag() string {\n\trole := \"master\"\n\tif IsSlave == 1 {\n\t\trole = \"slave\"\n\t}\n\treturn fmt.Sprintf(\"role=%s,port=%d\", role, g.Config().Collector.MySQL.Port)\n}", "title": "" }, { "docid": "fca154d78288ada7c3062d1f524d1844", "score": "0.6191363", "text": "func (n *RoutingPolicy_PolicyDefinition_Statement_Actions_SetTag_InlinePath) Tag() *RoutingPolicy_PolicyDefinition_Statement_Actions_SetTag_Inline_TagPath {\n\treturn &RoutingPolicy_PolicyDefinition_Statement_Actions_SetTag_Inline_TagPath{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"tag\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e32616330cdd54a91f0435314c631641", "score": "0.61298984", "text": "func (lc *LConfig) ImageTag() (string, error) {\n\tswitch {\n\tcase lc.ImageName == \"\":\n\t\treturn \"\", errors.New(\"image name is required\")\n\tcase lc.Version == \"\":\n\t\treturn \"\", errors.New(\"version is required\")\n\t}\n\n\treturn lc.ImageName + \":\" + lc.Version, nil\n}", "title": "" }, { "docid": "2144c3afc1cf9215a7717e13caa33e14", "score": "0.61208177", "text": "func (i imageRef) Tag() string {\n\treturn i.tag\n}", "title": "" }, { "docid": "0117ed3246d0c06ccec2fbada5346884", "score": "0.6118422", "text": "func (ct *SCollisionTracker) Tag() string {\n\treturn ct.tag\n}", "title": "" }, { "docid": "9b1a1286fa5875622f48e5bbf48871ea", "score": "0.60546994", "text": "func (t ConnectionType) Tag() ([]byte, error) {\n\tswitch t {\n\tcase ConnectionTypeAbridged:\n\t\treturn ConnectionTagAbridged, nil\n\tcase ConnectionTypeIntermediate:\n\t\treturn ConnectionTagIntermediate, nil\n\tcase ConnectionTypeSecure:\n\t\treturn ConnectionTagSecure, nil\n\tdefault:\n\t\treturn nil, errors.Errorf(\"Unknown connection type %d\", t)\n\t}\n}", "title": "" }, { "docid": "76eb80500187afe3289bd93a2a8abc62", "score": "0.6040213", "text": "func (m *dockerRegistryEvent) Tag() string {\n\treturn m.tagField\n}", "title": "" }, { "docid": "73d239ad67194d6e9397da82ec1dde0b", "score": "0.60339683", "text": "func (s *Source) Tag() string {\n\treturn fmt.Sprintf(\"%s:%s\", s.Kind, s.Identifier)\n}", "title": "" }, { "docid": "414213f4215201316d39df8c621ae5d7", "score": "0.6018511", "text": "func Tag(key, value string) string {\n\treturn key + \":\" + value\n}", "title": "" }, { "docid": "7ce2d5afb54c97a69dc812791a5bb855", "score": "0.5998928", "text": "func (sc *SlackClient) Tag() string {\n\tswitch sc.self {\n\tcase nil:\n\t\treturn fmt.Sprintf(\"[%-12p]\", sc)\n\tdefault:\n\t\treturn fmt.Sprintf(\"[%-12s]\", sc.self.SlackID)\n\t}\n}", "title": "" }, { "docid": "14ebc0ae24fc94ef67b6c749d932b6ca", "score": "0.59853214", "text": "func (ei *endpointInfo) Tag(key string) (value string, exist bool) {\n\tvalue, exist = ei.tags[key]\n\treturn\n}", "title": "" }, { "docid": "c048e94391097130883690980c267598", "score": "0.59460837", "text": "func (this *Logger) AppTag() string {\n\treturn this.apptag\n}", "title": "" }, { "docid": "c264a69a1382de24e952f80ba498e697", "score": "0.5907308", "text": "func getConfigName(field reflect.StructField) string {\n\tname := field.Tag.Get(\"confignamev1\")\n\tif name == \"\" {\n\t\tname = field.Name\n\t}\n\treturn name\n}", "title": "" }, { "docid": "3bee642f043fc160578afcaaaf58595a", "score": "0.5887828", "text": "func (p *ComponentBase) GetTag() string {\n\treturn p.Tag\n}", "title": "" }, { "docid": "417116358d80a977dc42a1f92bb801cf", "score": "0.5880586", "text": "func (t tag) Tag() tag {\n\treturn t\n}", "title": "" }, { "docid": "126f589808d9f20ceacc13c21d9282ba", "score": "0.5844238", "text": "func GitTag() string {\n\treturn gitTag\n}", "title": "" }, { "docid": "f8a84af1ea4b532b4c745bbe4de69576", "score": "0.5813017", "text": "func (i *Image) Tag(key string) string {\n\tfor _, tag := range i.Image.Tags {\n\t\tif *tag.Key == key {\n\t\t\treturn *tag.Value\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "d273232c4fdf422245bbafa218be6d3f", "score": "0.57916653", "text": "func (n *RoutingPolicy_PolicyDefinition_Statement_Actions_SetTag_InlinePathAny) Tag() *RoutingPolicy_PolicyDefinition_Statement_Actions_SetTag_Inline_TagPathAny {\n\treturn &RoutingPolicy_PolicyDefinition_Statement_Actions_SetTag_Inline_TagPathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"tag\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e786d2b3396b13954b782abf39a5d861", "score": "0.5781643", "text": "func Tag(r *http.Request) (category string, value string) {\n\treturn ContextMap(r)[\"Category\"], ContextMap(r)[\"Value\"]\n}", "title": "" }, { "docid": "a648c3406247f90996a120bdce22cf23", "score": "0.57736284", "text": "func (request WidgetSessionRequest) GetTag() string {\n\treturn request.tag\n}", "title": "" }, { "docid": "0c8074b91e5c2172b77dc8669564a267", "score": "0.5770401", "text": "func (e *BitbucketServerPushEvent) GetTag() string {\n\tfor _, changes := range e.Changes {\n\t\tref := changes.Ref\n\t\tif strings.ToLower(ref.Type) == \"tag\" {\n\t\t\treturn ref.DisplayID\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "04bf549c907a492d9ef23afea00f9253", "score": "0.5734154", "text": "func (c *NoopSecretCache) GetTag() string {\n\treturn c.Tag\n}", "title": "" }, { "docid": "063031a3a4fe4d4e6d38c4403413d764", "score": "0.5726621", "text": "func tag() string {\n\ts, _ := sh.Output(\"git\", \"describe\", \"--tags\")\n\treturn s\n}", "title": "" }, { "docid": "2497899f8cfa1ba5a5612cdb0da4c0ab", "score": "0.5698826", "text": "func (ll *ListOfLinks) GetTag(i int) string {\n\treturn ll.TagBindings[i]\n}", "title": "" }, { "docid": "57072a6d69fe8be6cdc96fde89915ee7", "score": "0.56699544", "text": "func (scene *Scene) GetTag() string {\n\treturn scene.tag\n}", "title": "" }, { "docid": "edc73aa1c30546b80a04ca103e57d1df", "score": "0.5642302", "text": "func (t Tag) TagStr() string {\n\treturn t.tag\n}", "title": "" }, { "docid": "52f7dcdeaf7856f46f60b65bdfae868a", "score": "0.5626531", "text": "func (l *LocalWorkspace) GetTag(ctx context.Context, stackName string, key string) (string, error) {\n\tstdout, stderr, errCode, err := l.runPulumiCmdSync(ctx, \"stack\", \"tag\", \"get\", key, \"--stack\", stackName)\n\tif err != nil {\n\t\treturn stdout, newAutoError(fmt.Errorf(\"unable to read tag: %w\", err), stdout, stderr, errCode)\n\t}\n\treturn strings.TrimSpace(stdout), nil\n}", "title": "" }, { "docid": "3142dc45885797475281b146bcc7d1d3", "score": "0.56184065", "text": "func (a *Asset) GetTag() string {\n\treturn a.name\n}", "title": "" }, { "docid": "f874f4d0a70b7c8f6ed6f261848b4f46", "score": "0.5615652", "text": "func (m *LanguageProficiency) GetTag()(*string) {\n val, err := m.GetBackingStore().Get(\"tag\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "eeda26a48b181ee69a9c8487dcea95ef", "score": "0.56051606", "text": "func (s *Struct) Tag(i int) string {\n\tif i < len(s.tags) {\n\t\treturn s.tags[i]\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e69746522d0c65e80bb3d8f3229bdb8a", "score": "0.55393416", "text": "func Tag(k, v string) string {\n\treturn stats.Tag(k, v)\n}", "title": "" }, { "docid": "3e98740c6467a8acd753accddd8a3a01", "score": "0.55388516", "text": "func (o InstanceConfigOutput) Etag() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *InstanceConfig) pulumi.StringOutput { return v.Etag }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "18081ef912b78301327af89a325079a1", "score": "0.5527165", "text": "func (els *elements) tag() string {\n\tif len(els.elements) == 0 {\n\t\treturn \"\"\n\t}\n\treturn els.elements[0].tag()\n}", "title": "" }, { "docid": "b7c1fc1c11e2434567991bace86698f9", "score": "0.549974", "text": "func configGetValFromTag(key string, value reflect.Value) (interface{}, error) {\n\t// Iterate over all available fields\n\tfor i := 0; i < value.NumField(); i++ {\n\t\t// Get the field\n\t\tfield := value.Field(i)\n\n\t\t// iterate over all subfields, and look for the corresponding variable for the tag\n\t\tfor j := 0; j < field.NumField(); j++ {\n\t\t\t// Get the tag\n\t\t\tentryTag := value.Type().Field(i).Type.Field(j).Tag.Get(\"envconfig\")\n\n\t\t\t// If the unset environment variable is found in file config, return its value\n\t\t\tif entryTag == key {\n\t\t\t\treturn field.Field(j).Interface(), nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"could not find key '%s' in struct '%s'\", key, value.Type())\n}", "title": "" }, { "docid": "51361fb702ec1008498c3baf8b3c9a27", "score": "0.5492086", "text": "func (response WidgetSessionResponse) GetTag() string {\n\treturn response.tag\n}", "title": "" }, { "docid": "f601cdca3d6ee5ef709c1df6411e9131", "score": "0.5489602", "text": "func Tag(i int) language.Tag {\n\treturn languages[i]\n}", "title": "" }, { "docid": "06285f2f6e187e9ac4a9c9610d07a38b", "score": "0.54736465", "text": "func (b *Builder) Tag(name string) error {\n\treturn b.exec.Image().Tag(name)\n}", "title": "" }, { "docid": "b81d71b6a551a373e680ed7615171d04", "score": "0.54579383", "text": "func (c *Config) GlobalTags() string {\n\tvar tags []string\n\n\tfor k, v := range c.Tags {\n\t\ttags = append(tags, fmt.Sprintf(\"%s=%s\", k, v))\n\t}\n\tsort.Strings(tags)\n\n\treturn strings.Join(tags, \" \")\n}", "title": "" }, { "docid": "76678df11d65f20c8b868c9edb1f2bd1", "score": "0.5454396", "text": "func (c *Config) String() string { return c.Name }", "title": "" }, { "docid": "85532fb420d0c4bcef9002edc14c9b77", "score": "0.541573", "text": "func (v SemVer) GitTag() string {\n\treturn fmt.Sprintf(\"v%d.%d.%d\", v.Major, v.Minor, v.Patch)\n}", "title": "" }, { "docid": "2dac86bcde44b303ac2064a70be3d4bd", "score": "0.5404412", "text": "func (ei *endpointInfo) DefaultTag(key, def string) string {\n\tif value, exist := ei.tags[key]; exist && value != \"\" {\n\t\treturn value\n\t}\n\treturn def\n}", "title": "" }, { "docid": "18b19299aa98901dbbfe129468714d1d", "score": "0.5395898", "text": "func ImageTag() string {\n\tif buildinfo.Version == \"\" {\n\t\treturn \"latest\"\n\t}\n\treturn buildinfo.Version\n}", "title": "" }, { "docid": "0c7ffa6a765ebfaf04e8289231a34363", "score": "0.53890103", "text": "func (oc *OvertheboxConfig) ConfigName() string { return \"me\" }", "title": "" }, { "docid": "fbb9ce155be27277a23c638b4aeeaa7c", "score": "0.53638524", "text": "func GetYamlTag(value interface{}) string {\n\tbuf, err := yaml.Marshal(value)\n\tif err != nil {\n\t\tlog.Entry(context.TODO()).Warnf(\"error marshaling %-v\", value)\n\t\treturn \"\"\n\t}\n\trawStr := string(buf)\n\ti := strings.Index(rawStr, \":\")\n\tif i == -1 {\n\t\treturn \"\"\n\t}\n\treturn rawStr[:i]\n}", "title": "" }, { "docid": "7a135e6f467a59eee6ba1dcc0c31dfbf", "score": "0.53636336", "text": "func (this *CodeWriter) Get_tagName() string {\n return this.tagName\n}", "title": "" }, { "docid": "4dccb64605ed111d2811b2f60a2cd8a6", "score": "0.53266615", "text": "func (vim *VirtletImageMapping) ConfigName() string { return vim.Name }", "title": "" }, { "docid": "b0d4e1c7cec2ba5872e74243ebd3ffeb", "score": "0.5322758", "text": "func getTagInfo(tags reflect.StructTag, defaultKey string) (section, key string, isLastKey bool) {\n\ttag := tags.Get(iniTagID)\n\tif tag == \"\" {\n\t\tkey = defaultKey\n\t\treturn\n\t}\n\tlst := strings.Split(tag, \",\")\n\tn := len(lst)\n\tif n > 0 {\n\t\tkey = lst[0]\n\t\tif key == \"\" {\n\t\t\tkey = defaultKey\n\t\t}\n\t}\n\tif n > 1 {\n\t\tsection = lst[1]\n\t}\n\tif n > 2 {\n\t\tisLastKey, _ = strconv.ParseBool(lst[2])\n\t}\n\treturn\n}", "title": "" }, { "docid": "1efb3e5a4939a2f2a1bfa0ab534c43b4", "score": "0.53190345", "text": "func (m *EcdictMutation) Tag() (r string, exists bool) {\n\tv := m.tag\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "d3a984783cdcd91ffc0ba31f9d035327", "score": "0.53165936", "text": "func (o *ImageAnalysisRequest) GetTag() string {\n\tif o == nil || o.Tag == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Tag\n}", "title": "" }, { "docid": "f3a7227728ae0bf8183deb31d176eda3", "score": "0.5306809", "text": "func (o *SystemNodeGetIterRequest) Tag() string {\n\tvar r string\n\tif o.TagPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.TagPtr\n\treturn r\n}", "title": "" }, { "docid": "0208d34926428b33062a313511d82d3f", "score": "0.5303436", "text": "func (c *Context) Config() string {\n\tf := c.cmd.Flags.Lookup(\"config\")\n\tif f != nil {\n\t\treturn f.Value.String()\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "6c47bc62a1eb0b5dea51a6a392bc6f6c", "score": "0.5286486", "text": "func (t Task) String() string {\n\treturn \"tag\"\n}", "title": "" }, { "docid": "f64d4abb1343be4f3bb9808e66ee758d", "score": "0.5283997", "text": "func (c *Config) Name() string {\n\treturn c.config.Name\n}", "title": "" }, { "docid": "3ce478d57c671e8913213b196440e8fa", "score": "0.5282618", "text": "func IsTag(key string) (string, bool) {\n\treturn \"\", false\n}", "title": "" }, { "docid": "5fe57aff72eca2742c1e508b4315106a", "score": "0.5266136", "text": "func (r Repository) Tag(identifier string) Tag {\n\tt := Tag{\n\t\ttag: identifier,\n\t\tRepository: r,\n\t}\n\tt.original = t.Name()\n\treturn t\n}", "title": "" }, { "docid": "78c27689a8e6ad012a7ce9ad3a0e16b7", "score": "0.5257862", "text": "func (o IdentityProviderConfigOutput) Tags() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *IdentityProviderConfig) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "3b44353911c47cf82c31d225d86d3029", "score": "0.5254155", "text": "func (o *NvmeSubsystemGetIterRequest) Tag() string {\n\tvar r string\n\tif o.TagPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.TagPtr\n\treturn r\n}", "title": "" }, { "docid": "a29d14ba9ba96e185fb4f240d97e135e", "score": "0.5250112", "text": "func (s ProcessorInformationStructure) AssetTag() string {\n\treturn get(s.Structure, 4)\n}", "title": "" }, { "docid": "98cd5a38b00d13141ab26d0c1de45aa6", "score": "0.5249489", "text": "func (c *Config) Name() string {\n\treturn name\n}", "title": "" }, { "docid": "7eaf3394b00a90e0eac424b9561486ca", "score": "0.5247768", "text": "func (o *TagEntry) GetTag() string {\n\tif o == nil || o.Tag == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Tag\n}", "title": "" }, { "docid": "443c9686409b153e9103e62b686a9e26", "score": "0.52434325", "text": "func (o TagProtectionOutput) Tag() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *TagProtection) pulumi.StringOutput { return v.Tag }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "21f863999d455ccc0288eaffc24e74fb", "score": "0.523138", "text": "func (x KVs) GetTag(k []byte) []byte {\n\tfor _, f := range x {\n\t\tif !f.IsTag {\n\t\t\tcontinue\n\t\t}\n\n\t\tif bytes.Equal(f.Key, k) {\n\t\t\treturn f.GetD()\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "33fe002859e57db3b623f8a45a594fba", "score": "0.52308893", "text": "func (t tags) TagValue(name string) string {\n\tfor _, x := range t {\n\t\tif x.Name == name {\n\t\t\treturn x.Value\n\t\t}\n\t}\n\treturn \"N/A\"\n}", "title": "" }, { "docid": "aa7fd74905d7e20d15a313550323adc4", "score": "0.52270955", "text": "func (r RequestID) Tag() string {\n\treturn fmt.Sprintf(\"graphsync-request-%d\", r)\n}", "title": "" }, { "docid": "84acaa86f407b500213566289b8ee4e1", "score": "0.52268624", "text": "func (a Aux) Tag() Tag { var t Tag; copy(t[:], a[:2]); return t }", "title": "" }, { "docid": "785e00e3070309764fc43a67945bf24f", "score": "0.522586", "text": "func (t *taskStackConfig) Tags() []*cloudformation.Tag {\n\ttags := map[string]string{\n\t\tdeploy.TaskTagKey: t.Name,\n\t}\n\n\tif t.Env != \"\" {\n\t\ttags[deploy.AppTagKey] = t.App\n\t\ttags[deploy.EnvTagKey] = t.Env\n\t}\n\n\treturn mergeAndFlattenTags(t.AdditionalTags, tags)\n}", "title": "" }, { "docid": "2a541748e8ae08e6a0e3e8b55395c993", "score": "0.52210146", "text": "func GetDockerTag() (string, error) {\n\t// The cwd call isn't needed. The commit hash function already uses the current working directory\n\t// and less work is done if the path isn't set\n\tgm := NewLocalGitManager()\n\thash, err := gm.CommitHash()\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"Failed to retrive git commit hash\")\n\t}\n\n\tname, err := gm.RepoName()\n\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"Failed to retrive repository name from git\")\n\t}\n\n\treturn fmt.Sprintf(\"%s/%s:%s.%s\", viper.GetString(\"repository\"), name, time.Now().Format(\"20060102\"), hash), nil\n}", "title": "" }, { "docid": "bcf698b0fc98c41bfb595fe6e33f91cb", "score": "0.52186406", "text": "func (s *MiSpan) Tag(k string) interface{} {\n\ts.RLock()\n\tdefer s.RUnlock()\n\treturn s.tags[k]\n}", "title": "" }, { "docid": "2a27c1109eda7765bf554bdfe2979db5", "score": "0.52115303", "text": "func (o *SnapmirrorPolicyGetIterRequest) Tag() string {\n\tvar r string\n\tif o.TagPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.TagPtr\n\treturn r\n}", "title": "" }, { "docid": "0e5b6c552028e72c748ecfe100326fe7", "score": "0.52064246", "text": "func GetConfig() *ConfigInfo { return configgg }", "title": "" }, { "docid": "fe1890fa8d1d463857b6b8564ef9e999", "score": "0.5205953", "text": "func (of *ObjField) Tag(tag string) (string, error) {\n\tif err := of.assertValid(); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn of.structField.Tag.Get(tag), nil\n}", "title": "" }, { "docid": "c7efe8a92d744099ed3d4187cee3547a", "score": "0.5204973", "text": "func (o CloudRunRewriteOutput) Tag() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v CloudRunRewrite) *string { return v.Tag }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3c5d26ed37e640195670861ea394d7e3", "score": "0.5203214", "text": "func (t *Tree) tag() (Node, error) {\n\ttagname := t.next()\n\n\tswitch tagname.typ {\n\tcase itemBlock:\n\t\treturn t.newBlockStmt()\n\tcase itemIf:\n\t\treturn t.newIfStmt()\n\t}\n\n\treturn nil, t.errorf(\"unknown tag %s\", tagname.val)\n}", "title": "" }, { "docid": "04400240785e80a8f54335af66589a7c", "score": "0.5203159", "text": "func (c *Config) Label() string {\n\treturn c.label\n}", "title": "" }, { "docid": "6fdabedc543ba4814a8794afa43631b6", "score": "0.5202371", "text": "func (o GoogleCloudRunV2TrafficTargetStatusResponseOutput) Tag() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GoogleCloudRunV2TrafficTargetStatusResponse) string { return v.Tag }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "bed61440b0efbe9669604ec2139a4030", "score": "0.5196978", "text": "func (n *RoutingPolicy_DefinedSets_TagSetPath) TagValue() *RoutingPolicy_DefinedSets_TagSet_TagValuePath {\n\treturn &RoutingPolicy_DefinedSets_TagSet_TagValuePath{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"tag-value\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "755c3fa3f5b00de8331e1ab444c5015b", "score": "0.5184784", "text": "func (d* DockerImageOpt) GetImage() string {\n return d.tag\n}", "title": "" }, { "docid": "931c2dbaa9f77fb8a5a343f3fccefc60", "score": "0.517937", "text": "func (d Docker) Tag() {\n\tsh.RunV(\"docker\", \"tag\", appImage(), remoteTag())\n}", "title": "" }, { "docid": "ed860298d3ad4da79bd3bf4543f11154", "score": "0.5178469", "text": "func (o GoogleCloudRunV2TrafficTargetOutput) Tag() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GoogleCloudRunV2TrafficTarget) *string { return v.Tag }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "caefcb9fc88cb0fc3a39c00847218fda", "score": "0.5173565", "text": "func (o *JobScheduleGetIterRequest) Tag() string {\n\tvar r string\n\tif o.TagPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.TagPtr\n\treturn r\n}", "title": "" }, { "docid": "4b8e246f9498a5dd405e8889d7a7fee0", "score": "0.5168336", "text": "func (m *dockerRegistryWebHook) TagNamePattern() string {\n\treturn m.tagNamePatternField\n}", "title": "" }, { "docid": "cf6befbd6cb6b65d0538c375aaea6af0", "score": "0.51508796", "text": "func (nr *NetworkSwitchVLAN) ConfigName() string { return \"\" }", "title": "" }, { "docid": "16469e733ef6467e2eb02fd76162d4fd", "score": "0.51460713", "text": "func (t *OpaqueDatatype) Tag() string {\n\tcname := C.H5Tget_tag(t.id)\n\tif cname != nil {\n\t\treturn C.GoString(cname)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "bf70aedfedf96fe0cc386e5f0d6db7c0", "score": "0.5144629", "text": "func (e *componentBase) GetTagName() string {\n\treturn e.tagName\n}", "title": "" }, { "docid": "bf8b33e33fbf8fdcf40dad4186867976", "score": "0.5144471", "text": "func (tags Tags) GetTag(tag string) bool {\n\tfor _, t := range tags {\n\t\tif t == tag {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4342ee747ad11ad21454e378d87cb4e9", "score": "0.51428276", "text": "func (c *Config) ConfigName() string {\n\treturn \"log\"\n}", "title": "" }, { "docid": "0ccf823d20a695cec9b3e2af8c192697", "score": "0.51371396", "text": "func (request NumberLookupRequest) GetTag() string {\n\treturn request.tag\n}", "title": "" }, { "docid": "fb1bc8178e907ef7e8af22a4088b9bf4", "score": "0.5136418", "text": "func CurrentConfig() *Config { return (*Config)(atomic.LoadPointer(&config)) }", "title": "" }, { "docid": "cb65c79e725763f87478997538405e04", "score": "0.51244843", "text": "func FindLatestDeployTag(stackName, region, profile string) (string, error) {\n\tvar err error\n\tvar sess *session.Session\n\tvar awsConfig *aws.Config\n\tvar taskId string\n\tvar tag string\n\n\tif region != \"\" {\n\t\tawsConfig = &aws.Config{Region: aws.String(region)}\n\t} else {\n\t\tawsConfig = &aws.Config{}\n\t}\n\n\tsess, err = session.NewSessionWithOptions(session.Options{\n\t\tConfig: *awsConfig,\n\t\tProfile: \"vmnetops\",\n\t\tSharedConfigState: session.SharedConfigEnable,\n\t})\n\n\tcf := cloudformation.New(sess)\n\tparams := &cloudformation.ListStackResourcesInput{\n\t\tStackName: aws.String(stackName),\n\t}\n\n\tresp, err := cf.ListStackResources(params)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tfor _, v := range resp.StackResourceSummaries {\n\t\tif aws.StringValue(v.LogicalResourceId) == \"taskdefinition\" {\n\t\t\ttaskId = aws.StringValue(v.PhysicalResourceId)\n\t\t\tbreak\n\t\t}\n\t}\n\n\tecsClient := ecs.New(sess)\n\n\tecsParams := &ecs.DescribeTaskDefinitionInput{\n\t\tTaskDefinition: aws.String(taskId),\n\t}\n\n\tecsResp, err := ecsClient.DescribeTaskDefinition(ecsParams)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcontainerName := strings.Join(strings.Split(stackName, \"-\")[0:2], \"-\")\n\tif len(ecsResp.TaskDefinition.ContainerDefinitions) == 1 {\n\t\ttag = strings.Split(aws.StringValue(ecsResp.TaskDefinition.ContainerDefinitions[0].Image), \":\")[1]\n\t} else {\n\t\tfor _, v := range ecsResp.TaskDefinition.ContainerDefinitions {\n\t\t\tif aws.StringValue(v.Name) == containerName {\n\t\t\t\t// v.Image is of the form <repo>/<image>:<tag>\n\t\t\t\t// repo and image cannot have a \":\" in them\n\t\t\t\t// so there are only two splits and we want the second\n\t\t\t\ttag = strings.Split(aws.StringValue(v.Image), \":\")[1]\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn tag, nil\n}", "title": "" }, { "docid": "cb4bcc7d3597e7fd8be1232324d0344a", "score": "0.5116905", "text": "func (o *NvmeNamespaceGetIterRequest) Tag() string {\n\tvar r string\n\tif o.TagPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.TagPtr\n\treturn r\n}", "title": "" }, { "docid": "cab3f4740400785ad2e7f5ae7e8c45fc", "score": "0.5111357", "text": "func (o *VserverShowAggrGetIterRequest) Tag() string {\n\tvar r string\n\tif o.TagPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.TagPtr\n\treturn r\n}", "title": "" }, { "docid": "033f1abf0381aaa293ee70e5729e2a94", "score": "0.5110967", "text": "func (n *RoutingPolicy_DefinedSets_TagSetPathAny) TagValue() *RoutingPolicy_DefinedSets_TagSet_TagValuePathAny {\n\treturn &RoutingPolicy_DefinedSets_TagSet_TagValuePathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"tag-value\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "13a88b7ced907c3b9b09f1179abd61c6", "score": "0.51092726", "text": "func (o IPConfigurationOutput) Etag() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IPConfiguration) *string { return v.Etag }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "533355eb31a2ec30d5ff956a607c5730", "score": "0.51078033", "text": "func (self *Field) GetTag(label string, fallback ...interface{}) (string, []string, bool) {\n\tif tag := self.Tag.Get(label); tag != `` {\n\t\tvar first, rest = stringutil.SplitPair(tag, `,`)\n\t\tvar attrs = strings.Split(rest, `,`)\n\n\t\treturn typeutil.OrString(first, self.Name), sliceutil.TrimSpace(attrs), true\n\t}\n\n\treturn ``, nil, false\n}", "title": "" }, { "docid": "cd0235ea5dbed6277ad1b130b54cef67", "score": "0.51046723", "text": "func getStructTag(f reflect.StructField, t string) string {\n\treturn string(f.Tag.Get(t))\n}", "title": "" }, { "docid": "90bd3584dc8fac655f85e0118c3a2295", "score": "0.5097402", "text": "func (i *Iterator) Tags() string { return i.tags }", "title": "" }, { "docid": "6773d5d2f76fdb9f95c36fd091672b00", "score": "0.509445", "text": "func (o FieldLevelEncryptionConfigOutput) Etag() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *FieldLevelEncryptionConfig) pulumi.StringOutput { return v.Etag }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5d913fb6d6ebaf51820453a9dbdc8656", "score": "0.5085073", "text": "func (tag Tag) String() string {\n\tif tag < 0 || tag > 4 { // Check out of bounds\n\t\treturn \"\" // Return invalid tag\n\t}\n\n\treturn []string{\"nop\", \"transfer\", \"contract\", \"stake\", \"batch\"}[tag] // Return tag\n}", "title": "" } ]
800f709d3deefee9a53e6b4562d52f78
Process encodes the Job into a byte slice that will be returned from Next() (in arbitrary order). Returns false if Next is certain to return an error. Caller must ensure j does not change until after the first call to Next(). May not be called after calling Next().
[ { "docid": "cbab4dc669956c1e3f96e79bc47c0b92", "score": "0.76817566", "text": "func (e *JobEncoder) Process(j *Job) bool {\n\tif e.err != nil {\n\t\treturn false\n\t}\n\tvar buf bytes.Buffer\n\tif err := gob.NewEncoder(&buf).Encode(j); err != nil {\n\t\te.err = err\n\t\te.jobs = nil\n\t\te.result = nil\n\t\treturn false\n\t}\n\te.jobs = append(e.jobs, j)\n\te.result = append(e.result, buf.Bytes())\n\treturn true\n}", "title": "" } ]
[ { "docid": "3054ed69477eaefdd4e8d8b3763d5c97", "score": "0.6934841", "text": "func (d *JobDecoder) Process(b []byte) bool {\n\td.init()\n\td.input <- b\n\treturn len(d.errors) == 0\n}", "title": "" }, { "docid": "cfd9fbc43958edfaa6bb524182a818a1", "score": "0.5881837", "text": "func (e *JobEncoder) Next() (*Job, []byte, error) {\n\tif e.err != nil {\n\t\treturn nil, nil, e.err\n\t}\n\tif len(e.jobs) == 0 {\n\t\treturn nil, nil, nil\n\t}\n\tj := e.jobs[0]\n\te.jobs = e.jobs[1:]\n\tserialized := e.result[0]\n\te.result = e.result[1:]\n\treturn j, serialized, nil\n}", "title": "" }, { "docid": "e8588700d2f9c6a204e92cd97639272b", "score": "0.5381919", "text": "func (pc *PyTorchController) processNextWorkItem() bool {\n\tobj, quit := pc.WorkQueue.Get()\n\tif quit {\n\t\treturn false\n\t}\n\tdefer pc.WorkQueue.Done(obj)\n\n\tvar key string\n\tvar ok bool\n\tif key, ok = obj.(string); !ok {\n\t\t// As the item in the workqueue is actually invalid, we call\n\t\t// Forget here else we'd go into a loop of attempting to\n\t\t// process a work item that is invalid.\n\t\tpc.WorkQueue.Forget(obj)\n\t\tutilruntime.HandleError(fmt.Errorf(\"expected string in workqueue but got %#v\", obj))\n\t\treturn true\n\t}\n\n\tlogger := pylogger.LoggerForKey(key)\n\n\tpytorchJob, err := pc.getPyTorchJobFromKey(key)\n\tif err != nil {\n\t\tif err == errNotExists {\n\t\t\tlogger.Infof(\"PyTorchJob has been deleted: %v\", key)\n\t\t\tnamespace, _, keyerr := cache.SplitMetaNamespaceKey(key)\n\t\t\tif keyerr == nil && len(namespace) != 0 {\n\t\t\t\tpytorchJobsDeletedCount.WithLabelValues(namespace).Inc()\n\t\t\t} else {\n\t\t\t\tlogger.Errorf(\"Invalid PyTorchJob key %s: Namespace is missing %v\", key, keyerr)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\n\t\t// Log the failure to conditions.\n\t\tlogger.Errorf(\"Failed to get PyTorchJob from key %s: %v\", key, err)\n\t\tif err == errFailedMarshal {\n\t\t\terrMsg := fmt.Sprintf(\"Failed to unmarshal the object to PyTorchJob object: %v\", err)\n\t\t\tpylogger.LoggerForJob(pytorchJob).Warn(errMsg)\n\t\t\tpc.Recorder.Event(pytorchJob, v1.EventTypeWarning, failedMarshalPyTorchJobReason, errMsg)\n\t\t}\n\n\t\treturn true\n\t}\n\n\t// Sync PyTorchJob to mapch the actual state to this desired state.\n\tforget, err := pc.syncHandler(key)\n\tif err == nil {\n\t\tif forget {\n\t\t\tpc.WorkQueue.Forget(key)\n\t\t}\n\t\treturn true\n\t}\n\n\tutilruntime.HandleError(fmt.Errorf(\"error syncing job: %v\", err))\n\tpc.WorkQueue.AddRateLimited(key)\n\n\treturn true\n}", "title": "" }, { "docid": "b7a9cc4aa7ed698db19cdd09071df8b4", "score": "0.5337146", "text": "func (j *Job) Process() (err error) {\n\t// Close and override the returned err only if not set already.\n\tcloseErr := func(c io.Closer) {\n\t\tif c != nil {\n\t\t\tif cerr := c.Close(); err == nil {\n\t\t\t\terr = cerr\n\t\t\t}\n\t\t}\n\t}\n\n\t// Process the input\n\tdefer closeErr(j.input)\n\tm, f, err := image.Decode(j.input)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"Decoded image with format %s and dimensions %d x %d\\n\",\n\t\tf, m.Bounds().Dx(), m.Bounds().Dy())\n\t// Some codecs don't seem to read full file flush to compute SHA.\n\tio.Copy(ioutil.Discard, j.input)\n\tsha := fmt.Sprintf(\"%x\", j.input.Sum(nil))\n\tlog.Printf(\"Computed original image SHA1 as %s\\n\", sha)\n\n\t// Size the image\n\tprocessed, err := size(m, j.size)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"Sized image to %d x %d\\n\", processed.Bounds().Dx(),\n\t\tprocessed.Bounds().Dy())\n\n\t// Encode and write the file to the store\n\t// TODO Later change to path with directories, to avoid file system\n\t// limits.\n\tpath := fmt.Sprintf(\"%s-%d-%s.%s\", j.size.Type, j.size.Value, sha,\n\t\tj.format)\n\tout, err := j.store.Put(path)\n\tdefer closeErr(out)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"Writing image to %s\", path)\n\tswitch j.format {\n\tcase JPG:\n\t\treturn jpeg.Encode(out, processed, &jpeg.Options{100})\n\tcase PNG:\n\t\treturn png.Encode(out, processed)\n\tcase WebP:\n\t\treturn webp.Encode(out, processed, &webp.Options{true, 100})\n\tdefault:\n\t\treturn ErrInvalidFormat\n\t}\n}", "title": "" }, { "docid": "ab6303cafdf2cbc67c60506cee7f3399", "score": "0.5180367", "text": "func (n *readWriteStream) process(j job.Job) {\n\n\t////////////////////////////////////////////\n\t// Acquire resource (limit concurrency)\n\terr := n.resource.Acquire(j.Context)\n\tif err != nil {\n\t\tj.ResponseChan <- response.NoAck(err)\n\t\treturn\n\t}\n\n\t////////////////////////////////////////////\n\t// PROCESS ( DECODE -> PROCESS -> ENCODE )\n\n\t/// DECODE\n\tdecoded, Response := n.processor.Decode(j.Payload.(payload.Bytes), j.Data)\n\tif !Response.Ack {\n\t\tj.ResponseChan <- Response\n\t\tn.resource.Release()\n\t\treturn\n\t}\n\n\t/// PROCESS\n\tdecodedPayload, Response := n.processor.Process(decoded, j.Data)\n\tif !Response.Ack {\n\t\tj.ResponseChan <- Response\n\t\tn.resource.Release()\n\t\treturn\n\t}\n\n\t// Node output writerCloner\n\tbuffer := bufferspool.Get()\n\tdefer bufferspool.Put(buffer)\n\twriterCloner := mirror.NewWriter(buffer)\n\n\t/// ENCODE\n\tResponse = n.processor.EncodeStream(decodedPayload, j.Data, writerCloner)\n\tn.resource.Release()\n\tif !Response.Ack {\n\t\tj.ResponseChan <- Response\n\t\treturn\n\t}\n\n\tctx, cancel := context.WithCancel(j.Context)\n\tdefer cancel()\n\n\t// Send to nexts\n\tresponseChan := n.sendNextsStream(ctx, writerCloner, j.Data)\n\n\t// Await Responses\n\tResponse = n.waitResponses(responseChan)\n\n\t// Send Response back.\n\tj.ResponseChan <- Response\n}", "title": "" }, { "docid": "2e1b7613169b22297cb4634d8dec8853", "score": "0.5015793", "text": "func (q *Queue) Process() {\n\tgo func() {\n\t\tfor {\n\t\t\tif q.limit != -1 && q.runningjobs > q.limit {\n\t\t\t\tlog.Printf(\"Limit has been reached on a number of jobs\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, jobitem := range q.jobs {\n\t\t\t\tif jobitem.job.IsDone() {\n\t\t\t\t\tidx := 0\n\t\t\t\t\tfor i, pname := range q.jobs {\n\t\t\t\t\t\tif pname.job.Title == jobitem.job.Title {\n\t\t\t\t\t\t\tidx = i\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif len(q.jobs) > 0 {\n\t\t\t\t\t\tq.jobs = append(q.jobs[:idx], q.jobs[idx+1:]...)\n\t\t\t\t\t}\n\t\t\t\t\tinfo := Info{\n\t\t\t\t\t\tTitle: jobitem.job.Title,\n\t\t\t\t\t\tJobID: jobitem.jobID,\n\t\t\t\t\t\tStatus: Waiting,\n\t\t\t\t\t}\n\n\t\t\t\t\tinfo.storeInfo(q.dbstore)\n\t\t\t\t\tresultitem, err := jobitem.job.waitUntilResult()\n\t\t\t\t\tresult := Result{\n\t\t\t\t\t\tID : Idgen(),\n\t\t\t\t\t\tTitle: jobitem.job.Title,\n\t\t\t\t\t\tDate: time.Now(),\n\t\t\t\t\t\tResult: resultitem,\n\t\t\t\t\t\tStatus: FINISHED,\n\t\t\t\t\t\tJobID: jobitem.jobID,\n\t\t\t\t\t}\n\t\t\t\t\t//Serialize result, in the case if task contain result value\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\tres, err := json.Marshal(resultitem)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Fatal(fmt.Sprintf(\"Can't get checksum from resut of %s\", jobitem.job.Title))\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresult.Result = resultitem\n\t\t\t\t\t\tresult.DataChecksum = getChecksum(res)\n\t\t\t\t\t}\n\n\t\t\t\t\tresult.storeResult(q.dbstore)\n\t\t\t\t\tresult.storeResultById(q.dbstore)\n\t\t\t\t\tinfo = Info{\n\t\t\t\t\t\tTitle: jobitem.job.Title,\n\t\t\t\t\t\tJobID: jobitem.jobID,\n\t\t\t\t\t\tStatus: Completed,\n\t\t\t\t\t}\n\n\t\t\t\t\tinfo.storeInfo(q.dbstore)\n\t\t\t\t\tatomic.AddInt32(&q.runningjobs, -1)\n\t\t\t\t}\n\t\t\t}\n\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "4184cbf2ae7e7e034c1860fee270ffd1", "score": "0.5011204", "text": "func (c *MPIJobController) processNextWorkItem() bool {\n\tobj, shutdown := c.queue.Get()\n\n\tif shutdown {\n\t\treturn false\n\t}\n\n\t// We wrap this block in a func so we can defer c.queue.Done.\n\terr := func(obj interface{}) error {\n\t\t// We call Done here so the work queue knows we have finished\n\t\t// processing this item. We also must remember to call Forget if we\n\t\t// do not want this work item being re-queued. For example, we do\n\t\t// not call Forget if a transient error occurs, instead the item is\n\t\t// put back on the work queue and attempted again after a back-off\n\t\t// period.\n\t\tdefer c.queue.Done(obj)\n\t\tvar key string\n\t\tvar ok bool\n\t\t// We expect strings to come off the work queue. These are of the\n\t\t// form namespace/name. We do this as the delayed nature of the\n\t\t// work queue means the items in the informer cache may actually be\n\t\t// more up to date that when the item was initially put onto the\n\t\t// work queue.\n\t\tif key, ok = obj.(string); !ok {\n\t\t\t// As the item in the work queue is actually invalid, we call\n\t\t\t// Forget here else we'd go into a loop of attempting to\n\t\t\t// process a work item that is invalid.\n\t\t\tc.queue.Forget(obj)\n\t\t\truntime.HandleError(fmt.Errorf(\"expected string in workqueue but got %#v\", obj))\n\t\t\treturn nil\n\t\t}\n\t\t// Run the syncHandler, passing it the namespace/name string of the\n\t\t// MPIJob resource to be synced.\n\t\tif err := c.syncHandler(key); err != nil {\n\t\t\tc.queue.AddRateLimited(key)\n\t\t\treturn fmt.Errorf(\"error syncing '%s': %s\", key, err.Error())\n\t\t}\n\t\t// Finally, if no error occurs we Forget this item so it does not\n\t\t// get queued again until another change happens.\n\t\tc.queue.Forget(obj)\n\t\tklog.Infof(\"Successfully synced '%s'\", key)\n\t\treturn nil\n\t}(obj)\n\n\tif err != nil {\n\t\truntime.HandleError(err)\n\t\treturn true\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "9f479341d9bafa19af54e13761ac5e48", "score": "0.50100017", "text": "func (q *queueProcessor) Process(job interface{}) {\n\tstart := time.Now()\n\tq.logger.Infof(\"processing job type %T\", job)\n\tvar err error\n\tswitch e := job.(type) {\n\tcase *gh.PushEvent:\n\t\terr = q.github.Analyse(github.PushConfig(e))\n\t\tif err != nil {\n\t\t\terr = errors.Wrapf(err, \"cannot analyse push event for sha %v on repo %v\", *e.After, *e.Repo.HTMLURL)\n\t\t}\n\tcase *gh.PullRequestEvent:\n\t\terr = q.github.Analyse(github.PullRequestConfig(e))\n\t\tif err != nil {\n\t\t\terr = errors.Wrapf(err, \"cannot analyse pr %v\", *e.PullRequest.HTMLURL)\n\t\t}\n\tdefault:\n\t\terr = fmt.Errorf(\"unknown queue job type %T\", e)\n\t}\n\tq.logger.Infof(\"finished processing in %v\", time.Since(start))\n\tif err != nil {\n\t\tq.logger.With(\"error\", err).Error(\"processing error\")\n\t}\n}", "title": "" }, { "docid": "c6108fee90118ad874bb06194fc61f98", "score": "0.49930725", "text": "func worker(data interface{}) bool {\n\t// cast the interface{} back to our custom JobData\n\tif job, ok := data.(JobData); ok {\n\t\tfmt.Printf(\"processing %v\\npicture: %v\\n\\n\", job.Name, job.PictureFilePath)\n\t\t// process the job here\n\t\ttime.Sleep(1 * time.Second)\n\t\tfmt.Printf(\"\\n'%v' was processed\\n\", job.Name)\n\n\t\t// let the pool know that this job was successfully processed\n\t\treturn true\n\t}\n\n\t// the job was not successfully processed\n\treturn false\n}", "title": "" }, { "docid": "cff913a02653f8794da506c623337c2e", "score": "0.4956046", "text": "func (wp *fixedWorkerPool) Execute(job Job) bool {\n\tif wp.IsStopped() {\n\t\tfmt.Println(\"go worker stopped.\")\n\t\treturn false\n\t}\n\n\thashCode := uint32(0)\n\tkey := job.Key()\n\tif len(key) > 0 {\n\t\th := fnv.New32a()\n\t\th.Write([]byte(key))\n\t\thashCode = h.Sum32()\n\t}\n\n\twp.lock.Lock()\n\tdefer wp.lock.Unlock()\n\n\tidx := 0\n\tif hashCode != 0 {\n\t\tidx = int(hashCode % uint32(len(wp.ready)))\n\t} else {\n\t\tidx = rand.Intn(len(wp.ready))\n\t}\n\t\n\tch := wp.ready[idx]\n\tif ch == nil {\n\t\treturn false\n\t}\n\n\tch.ch <- job\n\treturn true\n}", "title": "" }, { "docid": "ea2700615b19ad4df05650f7bd73b0a9", "score": "0.49530244", "text": "func chunkHandler(w http.ResponseWriter, req *http.Request) {\n\tjob, err := decodeJob(req) \n if err != nil {\n http.Error(w, err.Error(), 400)\n return\n\t}\n\tmuJobs.Lock()\n\tlastProgress, ok:= currentJobs[job.Worker_id]\n\tmuJobs.Unlock()\n\tif !ok {\n\t\tprintl(\"Job not found...check that submitter died or job has finished\")\n\t\treturn\n\t}\n\n\tmuFinishedJob.Lock()\n\t_, finished := finishedJobs[job.File_id]\n\tif finished {\n\t\tprintl(\"Job %v already processed\", job.File_id)\n\t\tmuFinishedJob.Unlock()\n\t\tgo func(worker_id int) {\n\t\t\tnextWorker <- worker_id\n\t\t} (job.Worker_id)\n\t\treturn\n\t}\n\tvar empty struct{}\n\tfinishedJobs[job.File_id] = empty\n\tmuFinishedJob.Unlock()\n\n\tfinalTotal += job.Result\n\tlastProgress.progress = job.Progress\n\tprintl(\"Worker %v finished job %v with progress %v out of %v\", job.Worker_id, job.File_id, lastProgress.progress, lastProgress.total)\n\n\t// TODO: Not sure if need check reply received matches work given \n\tif lastProgress.file.Filename == job.File_id {\n\t\tprintl(\"Removing active job\")\n\t\tmuJobs.Lock()\n\t\tdelete(currentJobs, job.Worker_id)\n\t\tmuJobs.Unlock()\n\t\tos.Remove(job.File_id) \n\t\tfinishedFiles++\n\t}\n\n\t// TODO: Think of smarter way to check that job is complete. Maybe use a map?\n\tif finishedFiles == totalFiles {\n\t\tfinishedFiles = 0\n\t\t// Check: Is it necessary to check for lingering jobs. Why would there be any?\n\t\tmuJobs.Lock()\n\t\tif len(currentJobs) > 0 {\n\t\t\tfor k := range currentJobs {\n\t\t\t\tdelete(currentJobs, k)\n\t\t\t}\n\t\t}\n\t\tmuJobs.Unlock()\n\t\tfinishedJobs = make(map[string]struct{})\n\t\tchangeStatus(false, -1)\n\t\tfinishedAll <- 0\n\t\treturn\n\t}\n\n\tgo func(worker_id int) {\n\t\tnextWorker <- worker_id\n\t} (job.Worker_id)\n}", "title": "" }, { "docid": "4941ce926641f1fc515eaf7dfff1b8d3", "score": "0.49438068", "text": "func (g *generic) getAndProcessNextJob() bool {\n\t// Get next job.\n\tnextJob, exit := g.queue.Get()\n\tif exit {\n\t\treturn true\n\t}\n\tdefer g.queue.Done(nextJob)\n\tevt := nextJob.(*common.K8sEvent)\n\n\t// Our root span will start here.\n\tspan := g.tracer.StartSpan(\"processJob\")\n\tdefer span.Finish()\n\tctx := opentracing.ContextWithSpan(context.Background(), span)\n\tg.setRootSpanInfo(evt.Key, span)\n\n\t// Process the job. If errors then enqueue again.\n\tif err := g.processJob(ctx, evt); err == nil {\n\t\tg.queue.Forget(evt)\n\t\tg.setForgetSpanInfo(evt.Key, span, err)\n\t} else if g.queue.NumRequeues(evt) < g.cfg.ProcessingJobRetries {\n\t\t// Job processing failed, requeue.\n\t\tg.logger.Warningf(\"error processing %s job (requeued): %v\", evt.Key, err)\n\t\tg.queue.AddRateLimited(evt)\n\t\tg.metrics.IncResourceEventQueued(g.cfg.Name, metrics.RequeueEvent)\n\t\tg.setReenqueueSpanInfo(evt.Key, span, err)\n\t} else {\n\t\tg.logger.Errorf(\"Error processing %s: %v\", evt.Key, err)\n\t\tg.queue.Forget(evt)\n\t\tg.setForgetSpanInfo(evt.Key, span, err)\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "809ea8cfe2e3217806d4c9bc61fa9e2d", "score": "0.49286845", "text": "func (p processWithWriter) Process(ctx context.Context, job *proto.JobRequest) error {\n\tctx, span := trace.StartSpan(ctx, \"processWithWriter\")\n\tdefer span.End()\n\n\tif _, err := fmt.Fprintf(p.Writer, \"job %d has been processed\\n\", job.Id); err != nil {\n\t\treturn errors.Wrap(err, \"unable to write\")\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "072a5570579df2693fa406348ee4fbe9", "score": "0.4927024", "text": "func (d *JobDecoder) decode(wg *sync.WaitGroup) {\n\tfor b := range d.input {\n\t\tvar j Job\n\t\tif err := gob.NewDecoder(bytes.NewReader(b)).Decode(&j); err != nil {\n\t\t\td.errors <- err\n\t\t\tbreak\n\t\t}\n\t\td.output <- &j\n\t\tif len(d.errors) > 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\twg.Done()\n}", "title": "" }, { "docid": "d3dabe8871f535303f5006a3ca0f948a", "score": "0.48756108", "text": "func (H *HASH384) Process(byt byte) { /* process the next message byte */\r\n\tcnt := (H.length[0] / 64) % 16\r\n\r\n\tH.w[cnt] <<= 8\r\n\tH.w[cnt] |= uint64(byt & 0xFF)\r\n\tH.length[0] += 8\r\n\tif H.length[0] == 0 {\r\n\t\tH.length[1]++\r\n\t\tH.length[0] = 0\r\n\t}\r\n\tif (H.length[0] % 1024) == 0 {\r\n\t\tH.transform()\r\n\t}\r\n}", "title": "" }, { "docid": "d6cb74d73313ae42222ee468b564593f", "score": "0.48364958", "text": "func (p *pruner) getNextJob() (job *Job, blocked bool) {\n\tif p.queue == nil {\n\t\treturn\n\t}\n\n\tpop := func(item *nodeItem) (*imagegraph.ImageNode, *nodeItem) {\n\t\tnode, next := item.pop()\n\t\tif item == p.queue {\n\t\t\tp.queue = next\n\t\t}\n\t\treturn node, next\n\t}\n\n\tfor item := p.queue; item != nil; {\n\t\t// something could have changed\n\t\tif !imageIsPrunable(p.g, item.node, p.algorithm) {\n\t\t\t_, item = pop(item)\n\t\t\tcontinue\n\t\t}\n\n\t\tif components, blocked := getImageComponents(p.g, p.processedImages, item.node); !blocked {\n\t\t\tjob = &Job{\n\t\t\t\tImage: item.node,\n\t\t\t\tComponents: components,\n\t\t\t}\n\t\t\t_, item = pop(item)\n\t\t\tbreak\n\t\t}\n\t\titem = item.next\n\t}\n\n\tblocked = job == nil && p.queue != nil\n\n\treturn\n}", "title": "" }, { "docid": "23acb5c61e993403b27b21f679e884c7", "score": "0.4834767", "text": "func (i *Iterator) Next() bool {\n\tif i.err != nil {\n\t\treturn false\n\t}\n\n\tlast := len(i.stash) - 1\n\tif last < 0 {\n\t\treturn false\n\t}\n\n\titem := i.stash[last]\n\ti.stash = i.stash[:last]\n\ti.cur = append(i.cur[:0], item.data...)\n\n\tsrc := i.sources[item.srcID]\n\tif src.Next() {\n\t\ti.insert(item.srcID, src.Bytes())\n\t}\n\tif err := src.Err(); err != nil {\n\t\ti.err = err\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "a033b87800ee4399113ef9b6479a9768", "score": "0.482985", "text": "func (j *job) Marshal() *format.Job { return j.Status(true, true) }", "title": "" }, { "docid": "267017a7a8be405002e2968b3aa22793", "score": "0.47836694", "text": "func Consume(j Job, payload []byte) {\n // Job is implemented in your own package and\n // will just be executed here.\n j.ProcessWork( payload )\n}", "title": "" }, { "docid": "a3620ed2cc8d5fd912364a66c3176255", "score": "0.47794545", "text": "func (job Job) Done(result bool) {\n\tif job.ScanImage != nil {\n\t\tjob.arbiter.DoneScan(result, job.ScanImage.digest)\n\t} else if job.PodImage != nil {\n\t\tjob.arbiter.DonePod(job.PodImage.imageName)\n\t}\n\n\ttime.Sleep(100 * time.Millisecond) // allow API server some time to breathe\n\treturn\n}", "title": "" }, { "docid": "5ad15c09f4d35a1497675ae9e264ab69", "score": "0.47788578", "text": "func (s *BatchSplitter) Next() bool {\n\tif len(s.buf) == 0 {\n\t\ts.out = nil\n\t\treturn false\n\t}\n\tif len(s.buf) <= s.chunkSize {\n\t\ts.out = s.buf\n\t\ts.buf = nil\n\t\treturn true\n\t}\n\n\t// Look backwards from the maximum size for a newline.\n\tfor i := s.chunkSize; i >= 0; i-- {\n\t\tif s.buf[i] == '\\n' {\n\t\t\ti++\n\t\t\ts.out = s.buf[:i]\n\t\t\ts.buf = s.buf[i:]\n\t\t\treturn true\n\t\t}\n\t}\n\n\t// No newline found, which means that a line was bigger than\n\t// chunkSize. This is bad (but highly unlikely in practice). Split\n\t// up the line at chunkSize.\n\ts.out = s.buf[:s.chunkSize]\n\ts.buf = s.buf[s.chunkSize:]\n\treturn true\n}", "title": "" }, { "docid": "7395c01868f434026fe76146dbec5291", "score": "0.4769768", "text": "func (q *WorkQueue) runStep() bool {\n\tif q.head != nil {\n\t\t// If we have work to send, non-blocking read\n\t\tselect {\n\t\tcase u, ok := <-q.src:\n\t\t\tif !ok {\n\t\t\t\tfor q.head != nil {\n\t\t\t\t\tq.dst <- q.pop()\n\t\t\t\t}\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif q.filter(u) {\n\t\t\t\tq.push(u)\n\t\t\t} else {\n\t\t\t\tq.reject(u)\n\t\t\t}\n\t\tcase q.dst <- q.peek():\n\t\t\tq.pop()\n\t\t}\n\t} else {\n\t\t// Blocking read and non-blocking send\n\t\tu, ok := <-q.src\n\t\tif !ok {\n\t\t\treturn false\n\t\t}\n\t\tif !q.filter(u) {\n\t\t\tq.reject(u)\n\t\t\treturn true\n\t\t}\n\t\tselect {\n\t\tcase q.dst <- u:\n\t\tdefault:\n\t\t\tq.push(u)\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "b121b8a2f8f300fe5adbb597df285ba4", "score": "0.47638148", "text": "func (c *CaddyController) processNextItem() bool {\n\t// Wait until there is a new item in the working queue\n\taction, quit := c.syncQueue.Get()\n\tif quit {\n\t\treturn false\n\t}\n\n\t// Tell the queue that we are done with processing this key. This unblocks the key for other workers\n\t// This allows safe parallel processing because two ingresses with the same key are never processed in\n\t// parallel.\n\tdefer c.syncQueue.Done(action)\n\n\t// Invoke the method containing the business logic\n\terr := action.(Action).handle(c)\n\tif err != nil {\n\t\tc.handleErr(err, action)\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "2babf850440c93c0f96591e75d7929bf", "score": "0.4758386", "text": "func (octo *Octopus) processNext() {\n\t// if queue is not empty, remove job from the queue\n\tif octo.jobQueue.IsNotEmpty() {\n\t\tjob, err := octo.jobQueue.RemoveJob()\n\t\tlog.Println(\"removing job:\", job.name, \"from queue and assigning to a worker.\")\n\n\t\tif err != nil {\n\t\t\tlog.Println(\"error occurred while removing the job.\")\n\t\t\treturn\n\t\t}\n\n\t\t// assign the job to the worker\n\t\tocto.workerPool.assignJob(job)\n\t\tlog.Println(\"assigned job:\", job.name, \"to a worker.\")\n\t}\n}", "title": "" }, { "docid": "6dd4f695280fa7f6f8b09ef8224c554b", "score": "0.47392854", "text": "func (sb *SplitBytes) Next() bool {\n\tif sb.lastChunk {\n\t\t// we do not check the length here, this ensures that we return the\n\t\t// last chunk in the sequence (even if it's empty)\n\t\treturn false\n\t}\n\n\tnext := bytes.IndexByte(sb.buf, sb.delim)\n\tif next == -1 {\n\t\t// no newline, consume the entire buffer\n\t\tsb.currentChunk = sb.buf\n\t\tsb.buf = nil\n\t\tsb.lastChunk = true\n\t} else {\n\t\tsb.currentChunk = sb.buf[:next]\n\t\tsb.buf = sb.buf[next+1:]\n\t}\n\treturn true\n}", "title": "" }, { "docid": "56a0c536e8e94d7d25dea51304316bdc", "score": "0.47082654", "text": "func (q *Queue) Process(ctx context.Context, data interface{}) (interface{}, error) {\n\tif q.ctx.Err() != nil {\n\t\treturn nil, fmt.Errorf(\"queue has been shutdown\")\n\t}\n\n\tresultChan := make(chan jobResult)\n\n\tq.queue <- job{\n\t\tdata: data,\n\t\tresult: resultChan,\n\t\tcontext: ctx,\n\t}\n\n\tresult := <-resultChan\n\tclose(resultChan)\n\n\tif result.err != nil {\n\t\treturn nil, result.err\n\t}\n\n\treturn result.result, nil\n}", "title": "" }, { "docid": "984cf70891074b57d686931ddd6a805b", "score": "0.46868303", "text": "func (job Job) IsProc() bool {\n\treturn job.Status == \"processing\"\n}", "title": "" }, { "docid": "d6cb5ad28ba59a846fa89f8e4b8da29b", "score": "0.46836388", "text": "func (i *Iterator) Next() bool {\n\t// If there is one byte left, it's the terminating 0 byte of the document, which should be ignored, so iteration\n\t// is complete.\n\tif len(i.src) <= 1 {\n\t\treturn false\n\t}\n\n\tvar ok bool\n\ti.elem, i.src, ok = bsoncore.ReadElement(i.src)\n\tif !ok {\n\t\ti.err = errors.New(\"ReadElement failed\")\n\t\treturn false\n\t}\n\tif i.err = i.elem.Validate(); i.err != nil {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "35f44b1a7a18ad6b80cad89299513ffd", "score": "0.46465632", "text": "func (c *KubectlDeliveryController) processNextWorkItem() bool {\n\tobj, shutdown := c.queue.Get()\n\n\tif shutdown {\n\t\treturn false\n\t}\n\n\t// We wrap this block in a func so we can defer c.queue.Done.\n\terr := func(obj interface{}) error {\n\t\t// We call Done here so the work queue knows we have finished\n\t\t// processing this item. We also must remember to call Forget if we\n\t\t// do not want this work item being re-queued. For example, we do\n\t\t// not call Forget if a transient error occurs, instead the item is\n\t\t// put back on the work queue and attempted again after a back-off\n\t\t// period.\n\t\tdefer c.queue.Done(obj)\n\t\tvar key string\n\t\tvar ok bool\n\t\t// We expect strings to come off the work queue. These are of the\n\t\t// form namespace/name. We do this as the delayed nature of the\n\t\t// work queue means the items in the informer cache may actually be\n\t\t// more up to date that when the item was initially put onto the\n\t\t// work queue.\n\t\tif key, ok = obj.(string); !ok {\n\t\t\t// As the item in the work queue is actually invalid, we call\n\t\t\t// Forget here else we'd go into a loop of attempting to\n\t\t\t// process a work item that is invalid.\n\t\t\tc.queue.Forget(obj)\n\t\t\truntime.HandleError(fmt.Errorf(\"expected string in workqueue but got %#v\", obj))\n\t\t\treturn nil\n\t\t}\n\t\t// Run the syncHandler, passing it the namespace/name string of the\n\t\t// MPIJob resource to be synced.\n\t\tif err := c.syncHandler(key); err != nil {\n\t\t\tc.queue.AddRateLimited(key)\n\t\t\treturn fmt.Errorf(\"error syncing '%s': %s\", key, err.Error())\n\t\t}\n\t\t// Finally, if no error occurs we Forget this item so it does not\n\t\t// get queued again until another change happens.\n\t\tc.queue.Forget(obj)\n\t\tklog.Infof(\"Successfully synced '%s'\", key)\n\t\treturn nil\n\t}(obj)\n\n\tif err != nil {\n\t\truntime.HandleError(err)\n\t\treturn true\n\t}\n\treturn true\n}", "title": "" }, { "docid": "c7f271ee5de546f9d84abc78d10044b4", "score": "0.46287277", "text": "func (c *Controller) processNextItem() bool {\n\tkey, quit := c.queue.Get()\n\tif quit {\n\t\treturn false\n\t}\n\tdefer c.queue.Done(key)\n\n\tworkItem := key.(item)\n\n\tprowJob, err := c.prowJobClient.GetProwJob(workItem.prowJobId)\n\tif err != nil {\n\t\tc.handleErr(err, workItem)\n\t\treturn true\n\t}\n\tspec := downwardapi.NewJobSpec(prowJob.Spec, prowJob.Status.BuildID, prowJob.Name)\n\n\tresult := c.client.Pods(workItem.namespace).GetLogs(workItem.podName, &api.PodLogOptions{Container: workItem.containerName}).Do()\n\tif err := result.Error(); err != nil {\n\t\tc.handleErr(err, workItem)\n\t\treturn true\n\t}\n\n\t// error is checked above\n\tlog, _ := result.Raw()\n\tvar target string\n\tif workItem.podName == workItem.prowJobId {\n\t\ttarget = path.Join(ContainerLogDir, fmt.Sprintf(\"%s.txt\", workItem.containerName))\n\t} else {\n\t\ttarget = path.Join(ContainerLogDir, workItem.podName, fmt.Sprintf(\"%s.txt\", workItem.containerName))\n\t}\n\tdata := gcs.DataUpload(bytes.NewReader(log))\n\tif err := c.gcsConfig.Run(&spec, map[string]gcs.UploadFunc{target: data}); err != nil {\n\t\tc.handleErr(err, workItem)\n\t\treturn true\n\t}\n\tc.queue.Forget(key)\n\treturn true\n}", "title": "" }, { "docid": "8ad54eba68c7c518586d2e5b01fab0f9", "score": "0.46240947", "text": "func (c *Controller) processNextWorkItem() bool {\n\tkey, quit := c.WorkQueue.Get()\n\tif quit {\n\t\treturn false\n\t}\n\n\tdefer c.WorkQueue.Done(key)\n\n\t_, err := c.syncHandler(key.(string))\n\tif err == nil {\n\t\t// Calling forget resets the rate limiter for this item.\n\t\t// Since the sync was processed successfully we want to reset the ratelimiter\n\t\t// so that future events can be processed immediately.\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"job\": key,\n\t\t}).Infof(\"WorkQueue forgetting key %v\", key)\n\t\tc.WorkQueue.Forget(key)\n\t\treturn true\n\t}\n\n\t// There was an error processing the key so to retry we requeue it.\n\t// The WorkQueue uses a rate limiter to control when the key gets retried.\n\tutilruntime.HandleError(fmt.Errorf(\"Error syncing job: %v\", err))\n\tc.WorkQueue.AddRateLimited(key)\n\n\treturn true\n}", "title": "" }, { "docid": "e7d4798a89817736ecd52e1832f4c8b1", "score": "0.46188876", "text": "func (w *ClamWorker) Process(submission *ClamSubmission) {\n\tw.Connect()\n\tdefer w.connection.Close()\n\tfile, err := os.Open(submission.Path)\n\tresult := bufio.NewReader(w.connection)\n\tbuffer := make([]byte, 2048)\n\tvar data string\n\n\tdefer file.Close()\n\tif err != nil {\n\t\tsubmission.Result <- ClamERR\n\t\treturn\n\t}\n\n\tw.logger.Debug(\"Submitting: %s\\n\", submission.Path)\n\n\tif _, err := w.connection.Write([]byte(\"nINSTREAM\\n\")); err != nil {\n\t\tw.logger.Debug(\"INSTREAM write error\")\n\t\tsubmission.Result <- ClamERR\n\t\treturn\n\t}\n\n\tfor {\n\t\treadSize, err := file.Read(buffer)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tw.logger.Error(\"Error while reading file '%s': %s\", submission.Path, err.Error())\n\t\t\tsubmission.Result <- ClamERR\n\t\t\treturn\n\t\t}\n\n\t\tif readSize > 0 {\n\t\t\tif err = binary.Write(w.connection, binary.BigEndian, uint32(readSize)); err != nil {\n\t\t\t\tw.logger.Info(\"size write error %s, %d, %s\", submission.Path, readSize, err.Error())\n\t\t\t\tsubmission.Result <- ClamERR\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif _, err = w.connection.Write(buffer[0:readSize]); err != nil {\n\t\t\t\tw.logger.Info(\"data write error %s, %d, %s\", submission.Path, readSize, err.Error())\n\t\t\t\tsubmission.Result <- ClamERR\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tbinary.Write(w.connection, binary.BigEndian, uint32(0))\n\n\tdata, err = result.ReadString('\\n')\n\tif err != nil {\n\t\tw.logger.Debug(\"read error\")\n\t\tsubmission.Result <- ClamERR\n\t\treturn\n\t}\n\n\tif strings.Contains(data, \"FOUND\") {\n\t\tsubmission.Result <- ClamFOUND\n\t\treturn\n\t}\n\tif strings.Contains(data, \"ERROR\") {\n\t\tsubmission.Result <- ClamERR\n\t\treturn\n\t}\n\tsubmission.Result <- ClamOK\n\treturn\n}", "title": "" }, { "docid": "7ac6f600e9d2e14670e3583f53b50504", "score": "0.4581961", "text": "func (it *JSONIterator) Next() bool {\n\tit.ptr++\n\treturn it.ptr < len(it.jsonOffsets)\n}", "title": "" }, { "docid": "9ad96b94f58650afa0c998fa17802b63", "score": "0.45715564", "text": "func (c *AuthorizationRoleBindingController) processNextWorkItem() bool {\n\tobj, shutdown := c.workqueue.Get()\n\n\tif shutdown {\n\t\treturn false\n\t}\n\n\terr := func(obj interface{}) error {\n\t\tdefer c.workqueue.Done(obj)\n\t\tvar key string\n\t\tvar ok bool\n\t\tif key, ok = obj.(string); !ok {\n\t\t\tc.workqueue.Forget(obj)\n\t\t\tlog.Errorf(\"expected string in workqueue but got %#v\", obj)\n\t\t\treturn nil\n\t\t}\n\n\t\terr := c.authorizationRoleBindingSyncHandler(key)\n\t\treturn c.handleErr(err, key)\n\t}(obj)\n\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn true\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "f972f3a9e4d7d13cba4d53cb5244aa9f", "score": "0.45649207", "text": "func (c *TemplateInstanceFinalizerController) processNextWorkItem() bool {\n\tkey, quit := c.queue.Get()\n\tif quit {\n\t\treturn false\n\t}\n\tdefer c.queue.Done(key)\n\n\terr := c.sync(key.(string))\n\tif err == nil { // for example, success, or the TemplateInstance has gone away\n\t\tc.queue.Forget(key)\n\t\treturn true\n\t}\n\n\tutilruntime.HandleError(fmt.Errorf(\"TemplateInstanceFinalizer %v failed with: %v\", key, err))\n\tc.queue.AddRateLimited(key) // avoid hot looping\n\n\treturn true\n}", "title": "" }, { "docid": "64684e38fd631bd1684883d35f3e1a52", "score": "0.45426986", "text": "func (cc *CertificateController) processNextWorkItem() bool {\n\tcKey, quit := cc.queue.Get()\n\tif quit {\n\t\treturn false\n\t}\n\tdefer cc.queue.Done(cKey)\n\n\terr := cc.syncHandler(cKey.(string))\n\tif err == nil {\n\t\tcc.queue.Forget(cKey)\n\t\treturn true\n\t}\n\n\tcc.queue.AddRateLimited(cKey)\n\tutilruntime.HandleError(fmt.Errorf(\"Sync %v failed with : %v\", cKey, err))\n\treturn true\n}", "title": "" }, { "docid": "152f127a4e6e130ad55a4d1581dce83d", "score": "0.45373747", "text": "func (bt *Worker) isDone(pieces [][]byte) bool {\n\tfor _, piece := range pieces {\n\t\tif len(piece) == 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "1a798f5c2f9082f303d83ee9bd2b301a", "score": "0.4535187", "text": "func (p *partialResultSetDecoder) done() bool {\n\t// There is no explicit end of stream marker, but ending part way through a\n\t// row is obviously bad, or ending with the last column still awaiting\n\t// completion.\n\treturn len(p.row.vals) == 0 && !p.chunked\n}", "title": "" }, { "docid": "435dac949212066aff36303e954b0996", "score": "0.4534413", "text": "func (rsc *RunCatalog) moveJobInQueue(submitStamp string, index int) (bool, [][2]string) {\n\n\tif submitStamp == \"\" {\n\t\treturn false, [][2]string{} // empty job submission stamp: return empty result\n\t}\n\n\trsc.rscLock.Lock()\n\tdefer rsc.rscLock.Unlock()\n\n\t// find current job position in the queue, excluding jobs selected to run\n\tisFound := false\n\tn := 0\n\tfor n = range rsc.queueKeys {\n\t\tisFound = rsc.queueKeys[n] == submitStamp\n\t\tif isFound {\n\t\t\tbreak\n\t\t}\n\t}\n\tif isFound {\n\t\tisSel := false\n\t\tfor j := 0; !isSel && j < len(rsc.selectedKeys); j++ {\n\t\t\tisSel = rsc.selectedKeys[j] == submitStamp\n\t\t}\n\t\tisFound = !isSel\n\t}\n\tif !isFound {\n\t\treturn false, [][2]string{} // job not found in the queue\n\t}\n\n\t// position must be between zero at the last position in the queue\n\tnPos := index\n\tfPos := jobPositionDefault\n\n\tisFirst := nPos <= 0\n\tif isFirst {\n\t\tnPos = 0\n\t\trsc.jobFirstPosition--\n\t\tfPos = rsc.jobFirstPosition\n\t}\n\n\tisLast := !isFirst && nPos >= len(rsc.queueKeys)-1\n\tif isLast {\n\t\tnPos = len(rsc.queueKeys) - 1\n\t\tfPos = rsc.jobLastPosition + 1\n\t\trsc.jobLastPosition = fPos + 1\n\t}\n\tif nPos == n {\n\t\treturn true, [][2]string{} // job is already at this position\n\t}\n\n\t// list of files to rename\n\tmoveLst := [][2]string{}\n\n\tfJ, isFrom := rsc.queueJobs[submitStamp]\n\ttoJ, isTo := rsc.queueJobs[rsc.queueKeys[nPos]]\n\n\tif !isFirst && !isLast {\n\n\t\tif isFrom && isTo {\n\t\t\tmoveLst = append(moveLst, [2]string{\n\t\t\t\tfJ.filePath,\n\t\t\t\tjobQueuePath(fJ.SubmitStamp, fJ.ModelName, fJ.ModelDigest, fJ.IsMpi, toJ.position, fJ.Res.Cpu, fJ.Res.Mem),\n\t\t\t})\n\t\t}\n\t} else { // move source file to the top (before the first position) or to the bottom (after last postion)\n\n\t\tmoveLst = append(moveLst, [2]string{\n\t\t\tfJ.filePath,\n\t\t\tjobQueuePath(fJ.SubmitStamp, fJ.ModelName, fJ.ModelDigest, fJ.IsMpi, fPos, fJ.Res.Cpu, fJ.Res.Mem),\n\t\t})\n\t}\n\n\t// move down to the queue: shift items up\n\tif nPos > n {\n\n\t\tfor k := n; k < nPos && k < len(rsc.queueKeys)-1; k++ {\n\n\t\t\t// skip files selected to run\n\t\t\tfromKey := rsc.queueKeys[k+1]\n\n\t\t\tisSel := false\n\t\t\tfor j := 0; !isSel && j < len(rsc.selectedKeys); j++ {\n\t\t\t\tisSel = rsc.selectedKeys[j] == fromKey\n\t\t\t}\n\t\t\tif isSel {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif !isFirst && !isLast {\n\n\t\t\t\tfJ, isFrom = rsc.queueJobs[fromKey]\n\t\t\t\ttoJ, isTo = rsc.queueJobs[rsc.queueKeys[k]]\n\t\t\t\tif isFrom && isTo {\n\t\t\t\t\tmoveLst = append(moveLst, [2]string{\n\t\t\t\t\t\tfJ.filePath,\n\t\t\t\t\t\tjobQueuePath(fJ.SubmitStamp, fJ.ModelName, fJ.ModelDigest, fJ.IsMpi, toJ.position, fJ.Res.Cpu, fJ.Res.Mem),\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trsc.queueKeys[k] = fromKey\n\t\t}\n\n\t} else { // move up in the queue: shift items down\n\n\t\tfor k := n - 1; k >= nPos && k >= 0; k-- {\n\n\t\t\t// skip files selected to run\n\t\t\tfromKey := rsc.queueKeys[k]\n\n\t\t\tisSel := false\n\t\t\tfor j := 0; !isSel && j < len(rsc.selectedKeys); j++ {\n\t\t\t\tisSel = rsc.selectedKeys[j] == fromKey\n\t\t\t}\n\t\t\tif isSel {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif !isFirst && !isLast {\n\n\t\t\t\tfJ, isFrom = rsc.queueJobs[fromKey]\n\t\t\t\ttoJ, isTo = rsc.queueJobs[rsc.queueKeys[k+1]]\n\t\t\t\tif isFrom && isTo {\n\t\t\t\t\tmoveLst = append(moveLst, [2]string{\n\t\t\t\t\t\tfJ.filePath,\n\t\t\t\t\t\tjobQueuePath(fJ.SubmitStamp, fJ.ModelName, fJ.ModelDigest, fJ.IsMpi, toJ.position, fJ.Res.Cpu, fJ.Res.Mem),\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trsc.queueKeys[k+1] = fromKey\n\t\t}\n\t}\n\trsc.queueKeys[nPos] = submitStamp\n\n\treturn true, moveLst\n}", "title": "" }, { "docid": "eb31b6e4b72f0305a7bac1586c8eb446", "score": "0.45269737", "text": "func (j Job) Publish() (bool, error) {\n\n\tvar err error\n\tif !flag {\n\t\tconn, err = amqp.Dial(\"amqp://guest:guest@rbm-local.sigis.com.ve:5672/\")\n\t\tfailOnError(err, \"Failed to connect to RabbitMQ\")\n\t\tch, err = conn.Channel()\n\t\tfailOnError(err, \"Failed to declare a queue\")\n\t\tflag = true\n\t}\n\n\tq, err = ch.QueueDeclare(\n\t\t\"hello\", // name\n\t\tfalse, // durable\n\t\tfalse, // delete when unused\n\t\tfalse, // exclusive\n\t\ttrue, // no-wait\n\t\tnil, // arguments\n\t)\n\t//failOnError(err, \"Failed to declare a queue\")\n\n\terr = ch.Publish(\n\t\t\"\", // exchange\n\t\tq.Name, // routing key\n\t\tfalse, // mandatory\n\t\tfalse, // immediate\n\t\tamqp.Publishing{\n\t\t\tContentType: \"text/plain\",\n\t\t\tBody: []byte(j.payload),\n\t\t})\n\t//failOnError(err, \"Failed to publish a message\")\n\n\treturn true, nil\n}", "title": "" }, { "docid": "c4560a2d91deecd6df30f8971f96b371", "score": "0.452311", "text": "func IsFinished(job *batchv1.Job) bool {\n\treturn IsSuccessful(job) || IsFailed(job)\n}", "title": "" }, { "docid": "2c6715fe3022db05e6445610f38873c8", "score": "0.45174035", "text": "func (br *bufioEntryReader) Next() bool {\n\tlength, err := binary.ReadUvarint(br.r)\n\tif err == io.EOF {\n\t\treturn false\n\t} else if err != nil {\n\t\tbr.err = err\n\t\treturn true\n\t}\n\tbr.count += int64(stream.UvariantSize(length))\n\t// expand the cap or not\n\tif uint64(cap(br.content)) < length {\n\t\tbr.content = make([]byte, length)\n\t}\n\t// shrink the length\n\tbr.content = br.content[:length]\n\t// read content\n\tn, err := io.ReadFull(br.r, br.content)\n\tif err == io.EOF {\n\t\treturn false\n\t}\n\tbr.err = err\n\tbr.count += int64(n)\n\treturn true\n}", "title": "" }, { "docid": "95667b4ec1bda5fcec20830f4a61e036", "score": "0.45102584", "text": "func (n *output) process(j job.Job) {\n\terr := n.resource.Acquire(j.Context)\n\tif err != nil {\n\t\tj.ResponseChan <- response.NoAck(err)\n\t\treturn\n\t}\n\n\tresponseChan := make(chan response.Response)\n\n\tn.output.JobChan <- job.Job{\n\t\tPayload: j.Payload,\n\t\tData: j.Data,\n\t\tResponseChan: responseChan,\n\t\tContext: j.Context,\n\t}\n\n\tj.ResponseChan <- <-responseChan\n\n\tn.resource.Release()\n}", "title": "" }, { "docid": "6b41b730d722d873c193f46a8db1a21f", "score": "0.4500664", "text": "func (r *BitReader) ChunkFinished() bool {\n\treturn r.chunkTargets.top() <= r.ActualPosition()\n}", "title": "" }, { "docid": "29c7ea88e4998f9e55299e2b6037f14e", "score": "0.4499674", "text": "func (c *Controller) processNextWorkItem() bool {\n\tobj, shutdown := c.workQueue.Get()\n\n\tif shutdown {\n\t\treturn false\n\t}\n\n\t// We wrap this block in a func so we can defer c.workQueue.Done.\n\terr := func(obj interface{}) error {\n\t\t// We call Done here so the workQueue knows we have finished\n\t\t// processing this item. We also must remember to call Forget if we\n\t\t// do not want this work item being re-queued. For example, we do\n\t\t// not call Forget if a transient error occurs, instead the item is\n\t\t// put back on the workQueue and attempted again after a back-off\n\t\t// period.\n\t\tdefer c.workQueue.Done(obj)\n\t\tvar key string\n\t\tvar ok bool\n\t\t// We expect strings to come off the workQueue. These are of the\n\t\t// form namespace/name. We do this as the delayed nature of the\n\t\t// workQueue means the items in the informer cache may actually be\n\t\t// more up to date that when the item was initially put onto the\n\t\t// workQueue.\n\t\tif key, ok = obj.(string); !ok {\n\t\t\t// As the item in the workQueue is actually invalid, we call\n\t\t\t// Forget here else we'd go into a loop of attempting to\n\t\t\t// process a work item that is invalid.\n\t\t\tc.workQueue.Forget(obj)\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"expected string in workQueue but got %#v\", obj))\n\t\t\treturn nil\n\t\t}\n\t\t// Start the syncHandler, passing it the namespace/name string of the\n\t\t// HelmRequest resource to be synced.\n\t\tif err := c.syncHandler(key); err != nil {\n\t\t\t// Put the item back on the workQueue to handle any transient errors.\n\t\t\tc.workQueue.AddRateLimited(key)\n\t\t\treturn fmt.Errorf(\"error syncing '%s': %s, requeuing\", key, err.Error())\n\t\t}\n\t\t// Finally, if no error occurs we Forget this item so it does not\n\t\t// get queued again until another change happens.\n\t\tc.workQueue.Forget(obj)\n\t\tklog.Infof(\"Successfully synced '%s'\", key)\n\t\treturn nil\n\t}(obj)\n\n\tif err != nil {\n\t\tutilruntime.HandleError(err)\n\t\treturn true\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "16ae725f93e5ffc66241d571dbf01be1", "score": "0.4491065", "text": "func (r *Reflector) processNextWorkItem() bool {\n\t// Get he element to be processed.\n\tkey, shutdown := r.workqueue.Get()\n\n\tif shutdown {\n\t\treturn false\n\t}\n\n\t// We call Done here so the workqueue knows we have finished\n\t// processing this item. We also must remember to call Forget if we\n\t// do not want this work item being re-queued. For example, we do\n\t// not call Forget if a transient error occurs, instead the item is\n\t// put back on the workqueue and attempted again after a back-off\n\t// period.\n\tdefer r.workqueue.Done(key)\n\n\t// Run the handler, passing it the item to be processed as parameter.\n\tif err := r.handle(context.Background(), key.(item)); err != nil {\n\t\t// Put the item back on the workqueue to handle any transient errors.\n\t\tr.workqueue.AddRateLimited(key)\n\t\treturn true\n\t}\n\n\t// Finally, if no error occurs we Forget this item so it does not\n\t// get queued again until another change happens.\n\tr.workqueue.Forget(key)\n\treturn true\n}", "title": "" }, { "docid": "aab6dafaa127dee20602d30d3ecded4a", "score": "0.44910625", "text": "func (i *Iter) Next() bool {\n\tif i.err != nil || !i.iter.Next() {\n\t\treturn false\n\t}\n\tid, r := i.iter.Item()\n\tvar bookmark Channel\n\ti.err = xml.NewTokenDecoder(r).Decode(&bookmark)\n\tif i.err != nil {\n\t\treturn false\n\t}\n\tj, err := jid.Parse(id)\n\tif err != nil {\n\t\treturn false\n\t}\n\ti.current = bookmark\n\ti.current.JID = j\n\treturn true\n}", "title": "" }, { "docid": "5e6f55ddb62e955c998ea10208399e4d", "score": "0.4488286", "text": "func (b *Queue) Peek(row *Row) bool {\n\n\tcount := atomic.LoadInt64(&b.count)\n\n\tif count > 0 {\n\t\t*row = b.buf[b.head]\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c36b0e7d3ca7ec40e386e72e8f751e60", "score": "0.448608", "text": "func (r *RPC) JustJob(job *Job, out *([]byte)) error {\n\tr.Lock()\n\tdefer r.Unlock()\n\tif nil == r.jobs {\n\t\tr.jobs = make(map[string]Job)\n\t}\n\tr.jobs[job.Name] = *job\n\tif nil == r.back {\n\t\tr.back = make(map[string]chan []byte)\n\t}\n\t_, ok := r.back[job.Name]\n\tif !ok {\n\t\tr.back[job.Name] = make(chan []byte)\n\t}\n\n\tfmt.Printf(\"jobs <- [%s]\\n\", job.Name)\n\tstateJobs(r.jobs)\n\treturn nil\n}", "title": "" }, { "docid": "288cd2e127a47833989fa9e780366ac2", "score": "0.44838533", "text": "func (pdc *projectDownloadChunk) finished() (bool, error) {\n\t// Convenience variables.\n\tec := pdc.workerSet.staticErasureCoder\n\n\t// Count the number of completed pieces and hopeful pieces in our list of\n\t// potential downloads.\n\tcompletedPieces := 0\n\thopefulPieces := 0\n\tfor _, piece := range pdc.availablePieces {\n\t\t// Only count one piece as hopeful per set.\n\t\thopeful := false\n\t\tfor _, pieceDownload := range piece {\n\t\t\t// If this piece is completed, count it both as hopeful and\n\t\t\t// completed, no need to look at other pieces.\n\t\t\tif pieceDownload.successful() {\n\t\t\t\thopeful = true\n\t\t\t\tcompletedPieces++\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// If this piece has not yet failed, it is hopeful. Keep looking\n\t\t\t// through the pieces in case there is a piece that was downloaded\n\t\t\t// successfully.\n\t\t\tif pieceDownload.downloadErr == nil {\n\t\t\t\thopeful = true\n\t\t\t}\n\t\t}\n\t\tif hopeful {\n\t\t\thopefulPieces++\n\t\t}\n\t}\n\tif completedPieces >= ec.MinPieces() {\n\t\treturn true, nil\n\t}\n\n\t// Count the number of workers that haven't resolved yet, and thus\n\t// (optimistically) might contribute towards downloading a unique piece.\n\thopefulPieces += pdc.unresolvedWorkersRemaining\n\n\t// Ensure that there are enough pieces that could potentially become\n\t// completed to finish the download.\n\tif hopefulPieces < ec.MinPieces() {\n\t\treturn false, errNotEnoughPieces\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "a6751cb910648bb4651e64ffe43fcb7a", "score": "0.44774583", "text": "func (j *Job) Done() chan error {\n\treturn j.done\n}", "title": "" }, { "docid": "a768d9df0df234c6a5e32773b636380e", "score": "0.44718298", "text": "func Example() {\n\tvar msg = make(chan string)\n\tvar processing = make(chan struct{})\n\tvar wait = make(chan struct{})\n\n\tjh := jh.New()\n\tjh.Process(func(job.Job) {\n\t\t// Signal that we started processing\n\t\tprocessing <- struct{}{}\n\t\t// Don't rush on processing\n\t\t<-wait\n\t})\n\n\tth := transformation.New(jh, 1)\n\tth.Confirm(func(j job.Job) {\n\t\tmsg <- fmt.Sprintln(\"Confirmed\", j)\n\t})\n\tth.Error(func(j job.Job) {\n\t\tmsg <- fmt.Sprintln(\"Failed to execute\", j)\n\t})\n\n\tth.Submit(\"Job 1\")\n\t<-processing\n\tth.Submit(\"Job 2\")\n\tth.Submit(\"Job 3\")\n\n\tfmt.Print(<-msg)\n\tfmt.Print(<-msg)\n\tfmt.Print(<-msg)\n\n\tclose(wait)\n\n\t// Unordered output:\n\t// Confirmed Job 1\n\t// Confirmed Job 2\n\t// Failed to execute Job 3\n}", "title": "" }, { "docid": "a4613d98a6f25083057b753087dabc0a", "score": "0.4461977", "text": "func (producer *getProducer) processChunk(curChunk *ds3Models.Objects, bucketName string, jobId string) (int, error) {\n producer.Debugf(\"begin chunk processing %s\", curChunk.ChunkId)\n\n processedCount := 0\n // transfer blobs that are ready, and queue those that are waiting for channel\n for _, curObj := range curChunk.Objects {\n producer.Debugf(\"queuing object in waiting to be processed %s offset=%d length=%d\", *curObj.Name, curObj.Offset, curObj.Length)\n blob := helperModels.NewBlobDescription(*curObj.Name, curObj.Offset, curObj.Length)\n\n blobQueued, err := producer.queueBlobForTransfer(&blob, bucketName, jobId)\n if err != nil {\n return 0, err\n }\n if blobQueued {\n processedCount++\n }\n }\n return processedCount, nil\n}", "title": "" }, { "docid": "3beba273dd1b9d7262d6bc35da519b30", "score": "0.44522062", "text": "func Submit(job Job) chan bool {\n\twg := make(chan bool, 1)\n\texej := execJob{Ejob: job, Done: wg}\n\tjobQueue <- exej\n\n\treturn wg\n}", "title": "" }, { "docid": "2e0e9bd8244091b482159e23b6c3a337", "score": "0.4434556", "text": "func (c *MyResourceControllerImpl) processNextWorkItem() bool {\n\tkey, quit := c.queue.Get()\n\tif quit {\n\t\treturn false\n\t}\n\tdefer c.queue.Done(key)\n\n\terr := c.sync(key.(string))\n\tif err == nil {\n\t\tc.queue.Forget(key)\n\t\treturn true\n\t}\n\n\truntime.HandleError(fmt.Errorf(\"%v failed with: %v\", key, err))\n\tc.queue.AddRateLimited(key)\n\n\treturn true\n}", "title": "" }, { "docid": "85c33ac2ae5cb497268858a68767de81", "score": "0.44290844", "text": "func (o *V0037JobSubmission) HasJob() bool {\n\tif o != nil && o.Job != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d74d173dbd993297bbd841420379aa5b", "score": "0.44269085", "text": "func (g *generic) processJob(ctx context.Context, evt *common.K8sEvent) error {\n\t// Get the object\n\tobj, exists, err := g.informer.GetIndexer().GetByKey(evt.Key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// handle the object.\n\tif !exists { // Deleted resource from the cache.\n\t\treturn g.handleDelete(ctx, evt)\n\t}\n\n\tevt.Object = obj.(runtime.Object)\n\treturn g.handleAdd(ctx, evt)\n}", "title": "" }, { "docid": "6fb4921dec607c32262cccbbab3054f4", "score": "0.44191962", "text": "func (r *reaper) sequenceJobsCompleted(sequenceStartJob proto.Job) []proto.Job {\n\ttoVisit := map[string]proto.Job{} // job id -> job to visit\n\tvisited := map[string]proto.Job{} // job id -> job visited\n\n\t// Process sequenceStartJob\n\tfor _, pJob := range r.chain.NextJobs(sequenceStartJob.Id) {\n\t\ttoVisit[pJob.Id] = pJob\n\t}\n\tvisited[sequenceStartJob.Id] = sequenceStartJob\n\nPROCESS_TO_VISIT_LIST:\n\tfor len(toVisit) > 0 {\n\n\tPROCESS_CURRENT_JOB:\n\t\tfor currentJobId, currentJob := range toVisit {\n\n\t\tPROCESS_NEXT_JOBS:\n\t\t\tfor _, nextJob := range r.chain.NextJobs(currentJobId) {\n\t\t\t\t// Don't add failed or pending jobs to toVisit list\n\t\t\t\t// For example, if job C of A -> B -> C -> D fails, then do not add C\n\t\t\t\t// or D to toVisit list. Because we have single sequence retries,\n\t\t\t\t// stopping at the failed job ensures we do not add jobs not in the\n\t\t\t\t// sequence to the toVisit list.\n\t\t\t\tif nextJob.State != proto.STATE_COMPLETE {\n\t\t\t\t\tcontinue PROCESS_NEXT_JOBS\n\t\t\t\t}\n\n\t\t\t\t// Make sure we don't visit a job multiple times. We can see a job\n\t\t\t\t// multiple times if it is a \"fan in\" node.\n\t\t\t\tif _, seen := visited[nextJob.Id]; !seen {\n\t\t\t\t\ttoVisit[nextJob.Id] = nextJob\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Since we have processed all of the next jobs for this current job, we\n\t\t\t// are done visiting the current job and can delete it from the toVisit\n\t\t\t// list and add it to the visited list.\n\t\t\tdelete(toVisit, currentJobId)\n\t\t\tvisited[currentJobId] = currentJob\n\n\t\t\tcontinue PROCESS_CURRENT_JOB\n\t\t}\n\n\t\tcontinue PROCESS_TO_VISIT_LIST\n\t}\n\n\tcompletedJobs := make([]proto.Job, 0, len(visited))\n\tfor _, j := range visited {\n\t\tcompletedJobs = append(completedJobs, j)\n\t}\n\n\treturn completedJobs\n}", "title": "" }, { "docid": "519274362f1c9d4c842ad07628c78c81", "score": "0.44122538", "text": "func (c *Controller) processNextQueueItem() bool {\n\t// Get() will block until there is an item to be processed.\n\t// Get() returns done==true if this routine should exit, determined via the\n\t// channel that the queue is attached to.\n\tkey, shutdown := c.queue.Get()\n\n\tif shutdown {\n\t\treturn false\n\t}\n\t// the queue returns an interface but key is a string.\n\tkeyString := fmt.Sprintf(\"%v\", key)\n\tlog.Debugf(\"processing key %s from the queue\", keyString)\n\n\t// There may be a better way to turn this key into something addressable in\n\t// the Kube API, but this does work and is pretty strait-forward.\n\tvar namespace, podName string\n\tif strings.Contains(keyString, \"/\") {\n\t\tkeySplit := strings.Split(keyString, \"/\")\n\t\tnamespace = keySplit[0]\n\t\tpodName = keySplit[1]\n\t} else {\n\t\tpodName = keyString\n\t}\n\n\terr := c.annotatePod(namespace, podName)\n\tif err == nil {\n\t\tc.queue.Forget(key) // for the queue rate limiter\n\t\tc.queue.Done(key)\n\t\treturn true\n\t} else {\n\t\t// THere was an error\n\t\tif c.queue.NumRequeues(key) < maxQueueRetries {\n\t\t\tlog.Errorf(\"requeueing after error patching %s : %v\", key, err)\n\t\t\tc.queue.AddRateLimited(key)\n\t\t} else {\n\t\t\tlog.Errorf(\"error patching %s after max %d number of retries: %v\", key, maxQueueRetries, err)\n\t\t\tc.queue.Forget(key) // for the queue rate limiter\n\t\t\tc.queue.Done(key)\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "61904ceb85ccd3d45eae1d30af740653", "score": "0.44040015", "text": "func (w *bufferWorker) Enqueue(param interface{}) bool {\n return w.queue.Enqueue(param)\n}", "title": "" }, { "docid": "3436c5460552266e0727fbf35daf24b9", "score": "0.43890658", "text": "func IsJobFinished(job *batchv1.Job) bool {\n\tBackoffLimit := job.Spec.BackoffLimit\n\treturn job.Status.CompletionTime != nil || (job.Status.Active == 0 && BackoffLimit != nil && job.Status.Failed >= *BackoffLimit)\n}", "title": "" }, { "docid": "ced1b9ced0a5c0598c562f8b72f2faf8", "score": "0.43885493", "text": "func (op *DeleteCustomJobOperation) Done() bool {\n\treturn op.lro.Done()\n}", "title": "" }, { "docid": "de387ce01d31be317f1bf66ac0349993", "score": "0.43884173", "text": "func JobDone(id int) bool {\n\tjobStatusMut.RLock()\n\tdefer jobStatusMut.RUnlock()\n\n\t//check for invalid id\n\tif id < 0 || id >= len(jobs) {\n\t\treturn false\n\t}\n\n\treturn jobs[id].done\n}", "title": "" }, { "docid": "5ca6cae70b1e0693b030f4fe52360fb4", "score": "0.4382376", "text": "func (c *CloneController) ProcessNextPvcItem() bool {\n\tkey, shutdown := c.queue.Get()\n\tif shutdown {\n\t\treturn false\n\t}\n\tdefer c.queue.Done(key)\n\n\terr := c.syncPvc(key.(string))\n\tif err != nil { // processPvcItem errors may not have been logged so log here\n\t\tglog.Errorf(\"error processing pvc %q: %v\", key, err)\n\t\treturn true\n\t}\n\treturn c.forgetKey(key, fmt.Sprintf(\"ProcessNextPvcItem: processing pvc %q completed\", key))\n}", "title": "" }, { "docid": "ac00d3618ed40240ed6a5bb18e96e450", "score": "0.4379531", "text": "func (c *CreateRepoJob) IsSequential() bool {\n\treturn true\n}", "title": "" }, { "docid": "1d44c2ee4dd20c50df11b6c0c8f38a10", "score": "0.43681768", "text": "func (iseq *IntSeq) Done() bool {\n\treturn iseq.seq == nil\n}", "title": "" }, { "docid": "84d0e1cf88d396340e099e70c8b8fcd3", "score": "0.43637568", "text": "func PopNextPendingJob(types []JobType) (*Job, error) {\n\tvar op = dbi.DB.Operation()\n\top.Dbg = dbi.Debug\n\n\top.BeginTransaction()\n\tdefer op.EndTransaction()\n\n\t// Wrangle the IN pain...\n\tvar j = &Job{}\n\tvar args []any\n\tvar placeholders []string\n\targs = append(args, string(JobStatusPending), time.Now())\n\tfor _, t := range types {\n\t\targs = append(args, string(t))\n\t\tplaceholders = append(placeholders, \"?\")\n\t}\n\n\tvar clause = fmt.Sprintf(\"status = ? AND run_at <= ? AND job_type IN (%s)\", strings.Join(placeholders, \",\"))\n\tif !op.Select(\"jobs\", &Job{}).Where(clause, args...).Order(\"created_at\").First(j) {\n\t\treturn nil, op.Err()\n\t}\n\n\tvar err = j.decodeXDat()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error decoding job %d: %w\", j.ID, err)\n\t}\n\tj.Status = string(JobStatusInProcess)\n\tj.StartedAt = time.Now()\n\t_ = j.SaveOp(op)\n\n\t// Make sure the pipeline's start date has been set, or else set it now\n\tvar p *Pipeline\n\tp, err = findPipeline(j.PipelineID)\n\tif err != nil {\n\t\treturn j, err\n\t}\n\tif p.StartedAt.IsZero() {\n\t\tp.StartedAt = time.Now()\n\t\t_ = p.saveOp(op)\n\t}\n\n\treturn j, op.Err()\n}", "title": "" }, { "docid": "622e9f7baf9c482fb3c226d39a71bb73", "score": "0.43533656", "text": "func (m *StatusProber) processWorkItem() bool {\n\tobj, shutdown := m.workQueue.Get()\n\tif shutdown {\n\t\treturn false\n\t}\n\n\tdefer m.workQueue.Done(obj)\n\n\t// Crash if the item is not of the expected type\n\titem, ok := obj.(*workItem)\n\tif !ok {\n\t\tm.logger.Fatalf(\"Unexpected work item type: want: %s, got: %s\\n\", \"*workItem\", reflect.TypeOf(obj).Name())\n\t}\n\tm.logger.Infof(\"Processing probe for %s (depth: %d)\", item.probeHost, m.workQueue.Len())\n\n\tok, err := prober.Do(\n\t\titem.context,\n\t\tm.transportFactory(),\n\t\tfmt.Sprintf(\"http://%s/\", item.podIP),\n\t\tprober.WithHost(item.probeHost),\n\t\tprober.ExpectsStatusCodes([]int{http.StatusOK, http.StatusMovedPermanently}),\n\t)\n\n\t// In case of cancellation, drop the work item\n\tselect {\n\tcase <-item.context.Done():\n\t\tm.workQueue.Forget(obj)\n\t\treturn true\n\tdefault:\n\t}\n\n\tif err != nil || !ok {\n\t\t// In case of error, enqueue for retry\n\t\tm.workQueue.AddRateLimited(obj)\n\t\tm.logger.Errorf(\"Probing of %s failed: ready: %t, error: %v (depth: %d)\", item.podIP, ok, err, m.workQueue.Len())\n\t} else {\n\t\t// In case of success, update the state\n\t\tif atomic.AddInt32(&item.pendingCount, -1) == 0 {\n\t\t\tm.readyCallback(item.virtualService)\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "ed44836ced9de141628ac13f9569d08d", "score": "0.4352164", "text": "func (p *Step) Job() (*Job, bool) {\n\tif p.job != nil {\n\t\treturn p.job, true\n\t}\n\treturn nil, false\n}", "title": "" }, { "docid": "b14b597ad3e2105977f62cd6a8c66f40", "score": "0.43521333", "text": "func (outputMessageType) EndOfJob() outputMessageType { return outputMessageType(3) }", "title": "" }, { "docid": "c7bdc74d448c4d6e3a9d13dc0631216a", "score": "0.43486163", "text": "func (op *DeleteBatchPredictionJobOperation) Done() bool {\n\treturn op.lro.Done()\n}", "title": "" }, { "docid": "b7254486cf323cd2d96566300534348d", "score": "0.43460327", "text": "func (c *Controller) processNextWorkItem(ctx context.Context) bool {\n\tpvcKey, quit := c.queue.Get()\n\tif quit {\n\t\treturn false\n\t}\n\tdefer c.queue.Done(pvcKey)\n\n\tpvcNamespace, pvcName, err := cache.SplitMetaNamespaceKey(pvcKey.(string))\n\tif err != nil {\n\t\tutilruntime.HandleError(fmt.Errorf(\"error parsing PVC key %q: %v\", pvcKey, err))\n\t\treturn true\n\t}\n\n\terr = c.processPVC(ctx, pvcNamespace, pvcName)\n\tif err == nil {\n\t\tc.queue.Forget(pvcKey)\n\t\treturn true\n\t}\n\n\tutilruntime.HandleError(fmt.Errorf(\"PVC %v failed with : %v\", pvcKey, err))\n\tc.queue.AddRateLimited(pvcKey)\n\n\treturn true\n}", "title": "" }, { "docid": "6391f3e401f802d343ad757542561e4f", "score": "0.4345527", "text": "func (p *Printer) Jobs() ([]JobInfo, error) {\n\tvar bytesNeeded, jobsReturned uint32\n\tbuf := make([]byte, 1)\n\tfor {\n\t\terr := EnumJobs(p.h, 0, 255, 1, &buf[0], uint32(len(buf)), &bytesNeeded, &jobsReturned)\n\t\tif err == nil {\n\t\t\tbreak\n\t\t}\n\t\tif err != syscall.ERROR_INSUFFICIENT_BUFFER {\n\t\t\treturn nil, err\n\t\t}\n\t\tif bytesNeeded <= uint32(len(buf)) {\n\t\t\treturn nil, err\n\t\t}\n\t\tbuf = make([]byte, bytesNeeded)\n\t}\n\tif jobsReturned <= 0 {\n\t\treturn nil, nil\n\t}\n\tpjs := make([]JobInfo, 0, jobsReturned)\n\tji := (*[2048]JOB_INFO_1)(unsafe.Pointer(&buf[0]))[:jobsReturned]\n\tfor _, j := range ji {\n\t\tpji := JobInfo{\n\t\t\tJobID: j.JobID,\n\t\t\tStatusCode: j.StatusCode,\n\t\t\tPriority: j.Priority,\n\t\t\tPosition: j.Position,\n\t\t\tTotalPages: j.TotalPages,\n\t\t\tPagesPrinted: j.PagesPrinted,\n\t\t}\n\t\tif j.MachineName != nil {\n\t\t\tpji.UserMachineName = syscall.UTF16ToString((*[2048]uint16)(unsafe.Pointer(j.MachineName))[:])\n\t\t}\n\t\tif j.UserName != nil {\n\t\t\tpji.UserName = syscall.UTF16ToString((*[2048]uint16)(unsafe.Pointer(j.UserName))[:])\n\t\t}\n\t\tif j.Document != nil {\n\t\t\tpji.DocumentName = syscall.UTF16ToString((*[2048]uint16)(unsafe.Pointer(j.Document))[:])\n\t\t}\n\t\tif j.DataType != nil {\n\t\t\tpji.DataType = syscall.UTF16ToString((*[2048]uint16)(unsafe.Pointer(j.DataType))[:])\n\t\t}\n\t\tif j.Status != nil {\n\t\t\tpji.Status = syscall.UTF16ToString((*[2048]uint16)(unsafe.Pointer(j.Status))[:])\n\t\t}\n\t\tif strings.TrimSpace(pji.Status) == \"\" {\n\t\t\tif pji.StatusCode == 0 {\n\t\t\t\tpji.Status += \"Queue Paused, \"\n\t\t\t}\n\t\t\tif pji.StatusCode&JOB_STATUS_PRINTING != 0 {\n\t\t\t\tpji.Status += \"Printing, \"\n\t\t\t}\n\t\t\tif pji.StatusCode&JOB_STATUS_PAUSED != 0 {\n\t\t\t\tpji.Status += \"Paused, \"\n\t\t\t}\n\t\t\tif pji.StatusCode&JOB_STATUS_ERROR != 0 {\n\t\t\t\tpji.Status += \"Error, \"\n\t\t\t}\n\t\t\tif pji.StatusCode&JOB_STATUS_DELETING != 0 {\n\t\t\t\tpji.Status += \"Deleting, \"\n\t\t\t}\n\t\t\tif pji.StatusCode&JOB_STATUS_SPOOLING != 0 {\n\t\t\t\tpji.Status += \"Spooling, \"\n\t\t\t}\n\t\t\tif pji.StatusCode&JOB_STATUS_OFFLINE != 0 {\n\t\t\t\tpji.Status += \"Printer Offline, \"\n\t\t\t}\n\t\t\tif pji.StatusCode&JOB_STATUS_PAPEROUT != 0 {\n\t\t\t\tpji.Status += \"Out of Paper, \"\n\t\t\t}\n\t\t\tif pji.StatusCode&JOB_STATUS_PRINTED != 0 {\n\t\t\t\tpji.Status += \"Printed, \"\n\t\t\t}\n\t\t\tif pji.StatusCode&JOB_STATUS_DELETED != 0 {\n\t\t\t\tpji.Status += \"Deleted, \"\n\t\t\t}\n\t\t\tif pji.StatusCode&JOB_STATUS_BLOCKED_DEVQ != 0 {\n\t\t\t\tpji.Status += \"Driver Error, \"\n\t\t\t}\n\t\t\tif pji.StatusCode&JOB_STATUS_USER_INTERVENTION != 0 {\n\t\t\t\tpji.Status += \"User Action Required, \"\n\t\t\t}\n\t\t\tif pji.StatusCode&JOB_STATUS_RESTART != 0 {\n\t\t\t\tpji.Status += \"Restarted, \"\n\t\t\t}\n\t\t\tif pji.StatusCode&JOB_STATUS_COMPLETE != 0 {\n\t\t\t\tpji.Status += \"Sent to Printer, \"\n\t\t\t}\n\t\t\tif pji.StatusCode&JOB_STATUS_RETAINED != 0 {\n\t\t\t\tpji.Status += \"Retained, \"\n\t\t\t}\n\t\t\tif pji.StatusCode&JOB_STATUS_RENDERING_LOCALLY != 0 {\n\t\t\t\tpji.Status += \"Rendering on Client, \"\n\t\t\t}\n\t\t\tpji.Status = strings.TrimRight(pji.Status, \", \")\n\t\t}\n\t\tpji.Submitted = time.Date(\n\t\t\tint(j.Submitted.Year),\n\t\t\ttime.Month(int(j.Submitted.Month)),\n\t\t\tint(j.Submitted.Day),\n\t\t\tint(j.Submitted.Hour),\n\t\t\tint(j.Submitted.Minute),\n\t\t\tint(j.Submitted.Second),\n\t\t\tint(1000*j.Submitted.Milliseconds),\n\t\t\ttime.Local,\n\t\t).UTC()\n\t\tpjs = append(pjs, pji)\n\t}\n\treturn pjs, nil\n}", "title": "" }, { "docid": "0b7d691afd3b8bdd430e73c29372e009", "score": "0.43441322", "text": "func (pc *PodController) processNextWorkItem() bool {\n\t// Pull the next work item from queue. It should be a key we use to lookup something in a cache\n\tkeyObj, quit := pc.queue.Get()\n\tif quit {\n\t\treturn false\n\t}\n\t// You always have to indicate to the queue that you've completed a piece of work\n\tdefer pc.queue.Done(keyObj)\n\n\tkey := keyObj.(string)\n\n\t// Do your work on the key. This method will contains your \"do stuff\" logic\n\terr := pc.syncHandler(key)\n\tif err == nil {\n\t\t// if you had no error, tell the queue to stop tracking history for your key. This will\n\t\t// reset things like failure counts for per-item rate limiting\n\t\tpc.queue.Forget(key)\n\t\treturn true\n\t}\n\n\t// There was a failure so be sure to report it. This method allows for pluggable error handling\n\t// which can be used for things like cluster-monitoring\n\tutilruntime.HandleError(fmt.Errorf(\"%v failed with : %v\", key, err))\n\n\t// Since we failed, we should requeue the item to work on later. This method will add a backoff\n\t// to avoid hotlooping on particular items (they're probably still not going to work right away)\n\t// and overall controller protection (everything I've done is broken, this controller needs to\n\t// calm down or it can starve other useful work) cases.\n\tpc.queue.AddRateLimited(key)\n\n\treturn true\n}", "title": "" }, { "docid": "e8406a7eade53837735e22be82b1df83", "score": "0.43428665", "text": "func (pdc *projectDownloadChunk) handleJobReadResponse(jrr *jobReadResponse) {\n\t// Prevent a production panic.\n\tif jrr == nil {\n\t\tpdc.workerSet.staticRenter.log.Critical(\"received nil job read response in handleJobReadResponse\")\n\t\treturn\n\t}\n\n\t// Grab the metadata from the response\n\tmetadata := jrr.staticMetadata\n\tworker := metadata.staticWorker\n\tpieceIndex := metadata.staticPieceRootIndex\n\tlaunchedWorker := pdc.launchedWorkers[metadata.staticLaunchedWorkerIndex]\n\n\t// Update the launched worker information, we keep track of these metrics\n\t// debugging purposes.\n\tlaunchedWorker.completeTime = time.Now()\n\tlaunchedWorker.jobDuration = jrr.staticJobTime\n\tlaunchedWorker.totalDuration = time.Since(launchedWorker.launchTime)\n\n\t// Check whether the job failed.\n\tif jrr.staticErr != nil {\n\t\t// The download failed, update the pdc available pieces to reflect the\n\t\t// failure.\n\t\tpieceFound := false\n\t\tfor i := 0; i < len(pdc.availablePieces[pieceIndex]); i++ {\n\t\t\tif pdc.availablePieces[pieceIndex][i].worker.staticHostPubKeyStr == worker.staticHostPubKeyStr {\n\t\t\t\tif pieceFound {\n\t\t\t\t\tbuild.Critical(\"The list of available pieces contains duplicates.\") // sanity check\n\t\t\t\t}\n\t\t\t\tpieceFound = true\n\t\t\t\tpdc.availablePieces[pieceIndex][i].completed = true\n\t\t\t\tpdc.availablePieces[pieceIndex][i].downloadErr = jrr.staticErr\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\t// Decrypt the piece that has come back.\n\tkey := pdc.workerSet.staticMasterKey.Derive(pdc.workerSet.staticChunkIndex, uint64(pieceIndex))\n\t_, err := key.DecryptBytesInPlace(jrr.staticData, pdc.pieceOffset/crypto.SegmentSize)\n\tif err != nil {\n\t\tpdc.workerSet.staticRenter.log.Println(\"decryption of a piece failed\")\n\t\treturn\n\t}\n\n\t// The download succeeded, add the piece to the appropriate index.\n\tpdc.dataPieces[pieceIndex] = jrr.staticData\n\tjrr.staticData = nil // Just in case there's a reference to the job response elsewhere.\n\n\tpieceFound := false\n\tfor i := 0; i < len(pdc.availablePieces[pieceIndex]); i++ {\n\t\tif pdc.availablePieces[pieceIndex][i].worker.staticHostPubKeyStr == worker.staticHostPubKeyStr {\n\t\t\tif pieceFound {\n\t\t\t\tbuild.Critical(\"The list of available pieces contains duplicates.\") // sanity check\n\t\t\t}\n\t\t\tpieceFound = true\n\t\t\tpdc.availablePieces[pieceIndex][i].completed = true\n\t\t}\n\t}\n}", "title": "" }, { "docid": "83d97c8ff033cbdf0e7397c93aed9d6d", "score": "0.43387902", "text": "func isJobComplete(job *appsv1alpha1.BroadcastJob, desiredNodes map[string]*corev1.Pod) bool {\n\tif job.Spec.CompletionPolicy.Type == appsv1alpha1.Never {\n\t\t// the job will not terminate, if the the completion policy is never\n\t\treturn false\n\t}\n\t// if no desiredNodes, job pending\n\tif len(desiredNodes) == 0 {\n\t\tklog.Info(\"Num desiredNodes is 0\")\n\t\treturn false\n\t}\n\tfor _, pod := range desiredNodes {\n\t\tif pod == nil || kubecontroller.IsPodActive(pod) {\n\t\t\t// the job is incomplete if there exits any pod not yet created OR still active\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "892be55ec42fe7db8c2d33c1ee21bc06", "score": "0.43373957", "text": "func (c *Controller) processNextChartRepo() bool {\n\tobj, shutdown := c.chartRepoWorkQueue.Get()\n\n\tif shutdown {\n\t\treturn false\n\t}\n\n\t// We wrap this block in a func so we can defer c.chartRepoWorkQueue.Done.\n\terr := func(obj interface{}) error {\n\t\t// We call Done here so the chartRepoWorkQueue knows we have finished\n\t\t// processing this item. We also must remember to call Forget if we\n\t\t// do not want this work item being re-queued. For example, we do\n\t\t// not call Forget if a transient error occurs, instead the item is\n\t\t// put back on the chartRepoWorkQueue and attempted again after a back-off\n\t\t// period.\n\t\tdefer c.chartRepoWorkQueue.Done(obj)\n\t\tvar key string\n\t\tvar ok bool\n\t\t// We expect strings to come off the chartRepoWorkQueue. These are of the\n\t\t// form namespace/name. We do this as the delayed nature of the\n\t\t// chartRepoWorkQueue means the items in the informer cache may actually be\n\t\t// more up to date that when the item was initially put onto the\n\t\t// chartRepoWorkQueue.\n\t\tif key, ok = obj.(string); !ok {\n\t\t\t// As the item in the chartRepoWorkQueue is actually invalid, we call\n\t\t\t// Forget here else we'd go into a loop of attempting to\n\t\t\t// process a work item that is invalid.\n\t\t\tc.chartRepoWorkQueue.Forget(obj)\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"expected string in chartRepoWorkQueue but got %#v\", obj))\n\t\t\treturn nil\n\t\t}\n\t\t// Start the syncHandler, passing it the namespace/name string of the\n\t\t// HelmRequest resource to be synced.\n\t\tif err := c.syncChartRepoHandler(key); err != nil {\n\t\t\t// Put the item back on the chartRepoWorkQueue to handle any transient errors.\n\t\t\tc.chartRepoWorkQueue.AddRateLimited(key)\n\t\t\treturn fmt.Errorf(\"error syncing chartrepo '%s': %s, requeuing\", key, err.Error())\n\t\t}\n\t\t// Finally, if no error occurs we Forget this item so it does not\n\t\t// get queued again until another change happens.\n\t\tc.chartRepoWorkQueue.Forget(obj)\n\t\tklog.Infof(\"Successfully synced '%s'\", key)\n\t\treturn nil\n\t}(obj)\n\n\tif err != nil {\n\t\tutilruntime.HandleError(err)\n\t\treturn true\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "45415a32fd4359aa778c45f1b0a5e4ee", "score": "0.43352574", "text": "func (w *Writer) Write(in chan Any) (done chan bool) {\n\tvar wg sync.WaitGroup\n\n\tjobs := make(chan Job, w.cfg.MaxJobs)\n\tdone = make(chan bool)\n\n\tpw := NewParallelWriter(w.w)\n\n\tgo func(jobs chan Job, in chan Any, pw *ParallelWriter, done chan bool) {\n\t\t// spawn a number of workers\n\t\tfor i := 1; i <= w.cfg.MaxWorkers; i++ {\n\t\t\tgo w.work(jobs, &wg, pw)\n\t\t}\n\n\t\t// queue jobs\n\t\tw.delegateJobs(jobs, in)\n\t\twg.Wait()\n\n\t\tclose(jobs)\n\t\tdone <- true\n\t}(jobs, in, pw, done)\n\n\treturn done\n}", "title": "" }, { "docid": "05f3b57891e5abac7869c7cfb24fac01", "score": "0.43312985", "text": "func (c *Controller) processNextWorkClaim() bool {\n\tobj, shutdown := c.resourceQuotaClaimWorkQueue.Get()\n\n\tif shutdown {\n\t\treturn false\n\t}\n\n\t// We wrap this block in a func so we can defer c.resourceQuotaClaimWorkQueue.Done.\n\terr := func(obj interface{}) error {\n\t\t// We call Done here so the resourceQuotaClaimWorkQueue knows we have finished\n\t\t// processing this item. We also must remember to call Forget if we\n\t\t// do not want this work item being re-queued. For example, we do\n\t\t// not call Forget if a transient error occurs, instead the item is\n\t\t// put back on the resourceQuotaClaimWorkQueue and attempted again after a back-off\n\t\t// period.\n\t\tdefer c.resourceQuotaClaimWorkQueue.Done(obj)\n\t\tvar key string\n\t\tvar ok bool\n\t\t// We expect strings to come off the resourceQuotaClaimWorkQueue. These are of the\n\t\t// form namespace/name. We do this as the delayed nature of the\n\t\t// resourceQuotaClaimWorkQueue means the items in the informer cache may actually be\n\t\t// more up to date that when the item was initially put onto the\n\t\t// resourceQuotaClaimWorkQueue.\n\t\tif key, ok = obj.(string); !ok {\n\t\t\t// As the item in the resourceQuotaClaimWorkQueue is actually invalid, we call\n\t\t\t// Forget here else we'd go into a loop of attempting to\n\t\t\t// process a work item that is invalid.\n\t\t\tc.resourceQuotaClaimWorkQueue.Forget(obj)\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"expected string in resourceQuotaClaimWorkQueue but got %#v\", obj))\n\t\t\treturn nil\n\t\t}\n\t\t// Run the syncHandlerClaim, passing it the namespace/name string of the\n\t\t// ResourceQuotaClaims resource to be synced.\n\t\tif err := c.syncHandlerClaim(key); err != nil {\n\t\t\t// Put the item back on the resourceQuotaClaimWorkQueue to handle any transient errors.\n\t\t\tc.resourceQuotaClaimWorkQueue.AddRateLimited(key)\n\t\t\treturn fmt.Errorf(\"error syncing '%s': %s, requeuing\", key, err.Error())\n\t\t}\n\t\t// Finally, if no error occurs we Forget this item so it does not\n\t\t// get queued again until another change happens.\n\t\tc.resourceQuotaClaimWorkQueue.Forget(obj)\n\t\tklog.Infof(\"Successfully synced claim '%s'\", key)\n\t\treturn nil\n\t}(obj)\n\n\tif err != nil {\n\t\tutilruntime.HandleError(err)\n\t\treturn true\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "b2bbaf96c6c72b0ac58f63551bea94ca", "score": "0.43303522", "text": "func (i *Iterator) Next() bool {\n\tif i.start > i.max || i.isClosed == true || i.err != nil {\n\t\treturn false\n\t}\n\tresults, err := i.fn(i.batch, i.start)\n\tif err != nil {\n\t\ti.err = err\n\t\treturn false\n\t}\n\t// No more results\n\tif len(results.Results) == 0 {\n\t\treturn false\n\t}\n\ti.value = results\n\t// Return all results, therefore no longer need to iterate\n\tif i.batch == 0 {\n\t\treturn false\n\t}\n\ti.start += i.batch\n\treturn true\n}", "title": "" }, { "docid": "48f303b0759c7a98acc844464227f60f", "score": "0.4325928", "text": "func (r *TransactionQueryResult) Next() bool {\n\tif r.idx >= len(r.results) {\n\t\treturn false\n\t}\n\n\tr.rowBytes = r.results[r.idx]\n\tr.idx++\n\n\treturn true\n}", "title": "" }, { "docid": "cd65945c8bbf49f60d2e9a02523c5adf", "score": "0.43253735", "text": "func (o *V0037JobSubmission) GetJobOk() (*V0037JobProperties, bool) {\n\tif o == nil || o.Job == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Job, true\n}", "title": "" }, { "docid": "321c84b1686fe321ef8cdf93f84dc958", "score": "0.4322283", "text": "func (b *JobCompletedWorker) Process(message *workers.Msg) {\n\tarr, err := message.Args().Array()\n\tcheckErr(b.Logger, err)\n\tjobID := arr[0]\n\tid, err := uuid.FromString(jobID.(string))\n\tcheckErr(b.Logger, err)\n\tl := b.Logger.With(\n\t\tzap.String(\"jobID\", id.String()),\n\t)\n\tlog.I(l, \"starting job_completed_worker\")\n\n\tjob := &model.Job{\n\t\tID: id,\n\t}\n\terr = b.MarathonDB.DB.Model(job).Column(\"job.*\", \"App\").Where(\"job.id = ?\", job.ID).Select()\n\tcheckErr(l, err)\n\n\tif b.SendgridClient != nil {\n\t\terr = email.SendJobCompletedEmail(b.SendgridClient, job, job.App.Name)\n\t\tcheckErr(l, err)\n\t}\n\n\tlog.I(l, \"finished job_completed_worker\")\n}", "title": "" }, { "docid": "5699a92fb6753617c7d085ed97778c0d", "score": "0.43211", "text": "func (p *ipv4Provider) ProcessAsyncJob(job interface{}) (ctrl.Result, error) {\n\twarmPoolJob, isValid := job.(*worker.WarmPoolJob)\n\tif !isValid {\n\t\treturn ctrl.Result{}, fmt.Errorf(\"invalid job type\")\n\t}\n\n\tswitch warmPoolJob.Operations {\n\tcase worker.OperationCreate:\n\t\tp.CreatePrivateIPv4AndUpdatePool(warmPoolJob)\n\tcase worker.OperationDeleted:\n\t\tp.DeletePrivateIPv4AndUpdatePool(warmPoolJob)\n\tcase worker.OperationProcessDeleteQueue:\n\t\treturn p.ProcessDeleteQueue(warmPoolJob)\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "ce2d9570cbd9e9c7844bdb4a3db95680", "score": "0.4314304", "text": "func CompleteJob(j *Job) error {\n\t// We need the job's pipeline - if we can't get this, the rest of the\n\t// function doesn't really matter\n\tvar p, err = findPipeline(j.PipelineID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Start a transaction as we might be manipulating a lot of entities here\n\tvar op = dbi.DB.Operation()\n\top.Dbg = dbi.Debug\n\top.BeginTransaction()\n\tdefer op.EndTransaction()\n\n\tj.Status = string(JobStatusSuccessful)\n\tj.CompletedAt = time.Now()\n\t_ = j.SaveOp(op)\n\n\t// If there are any unfinished jobs at the same sequence number, we don't\n\t// need to do anything more\n\tvar n = countJobsOp(op, \"pipeline_id = ? AND sequence <= ? AND status not in (?, ?)\", j.PipelineID, j.Sequence, JobStatusFailedDone, JobStatusSuccessful)\n\tif n > 0 {\n\t\treturn op.Err()\n\t}\n\n\t// If there are no jobs left, the pipeline is done and we can close it\n\tn = countJobsOp(op, \"pipeline_id = ? AND status not in (?, ?)\", j.PipelineID, JobStatusFailedDone, JobStatusSuccessful)\n\tif n == 0 {\n\t\tp.CompletedAt = time.Now()\n\t\treturn p.saveOp(op)\n\t}\n\n\t// There are jobs left, but they're on hold, so let's fix that\n\top.Exec(\"UPDATE jobs SET status = ? WHERE pipeline_id = ? AND sequence = ?\", JobStatusPending, j.PipelineID, j.Sequence+1)\n\treturn op.Err()\n}", "title": "" }, { "docid": "32606d4a0f37517a4ebfd3fd9f1d8b05", "score": "0.43127555", "text": "func (c *Client) waitForJob(e watch.Event, name string) (bool, error) {\n\to, ok := e.Object.(*batchinternal.Job)\n\tif !ok {\n\t\treturn true, fmt.Errorf(\"Expected %s to be a *batch.Job, got %T\", name, e.Object)\n\t}\n\n\tfor _, c := range o.Status.Conditions {\n\t\tif c.Type == batchinternal.JobComplete && c.Status == core.ConditionTrue {\n\t\t\treturn true, nil\n\t\t} else if c.Type == batchinternal.JobFailed && c.Status == core.ConditionTrue {\n\t\t\treturn true, fmt.Errorf(\"Job failed: %s\", c.Reason)\n\t\t}\n\t}\n\n\tc.Log(\"%s: Jobs active: %d, jobs failed: %d, jobs succeeded: %d\", name, o.Status.Active, o.Status.Failed, o.Status.Succeeded)\n\treturn false, nil\n}", "title": "" }, { "docid": "c21259d079e950153c33810821235a21", "score": "0.43116796", "text": "func (j Job) Process() {\n\tcount, err := textsearch.CountString(searchString, j.source)\n\tif err != nil {\n\t\tj.result <- resultwriter.Result{\n\t\t\tSource: j.source,\n\t\t\tWordCount: 0,\n\t\t\tError: err,\n\t\t\tEndOfData: false,\n\t\t}\n\t\treturn\n\t}\n\tj.result <- resultwriter.Result{\n\t\tSource: j.source,\n\t\tWordCount: count,\n\t\tError: nil,\n\t\tEndOfData: false,\n\t}\n}", "title": "" }, { "docid": "cce36abbee57547faedce19b2f5cf53a", "score": "0.4305941", "text": "func Json(in []byte) bool {\n\tparsed, err := json.Scan(in)\n\tif len(in) < ReadLimit {\n\t\treturn err == nil\n\t}\n\n\treturn parsed == len(in)\n}", "title": "" }, { "docid": "85cf079bfebe3f50653e9467d0b0d8d3", "score": "0.43039522", "text": "func (o *HyperflexClusterBackupPolicyInventoryAllOf) GetJobIdOk() (*string, bool) {\n\tif o == nil || o.JobId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.JobId, true\n}", "title": "" }, { "docid": "62a6106993754cc4da6c9c46a4bb9628", "score": "0.43037373", "text": "func (iter *MemIterator) Next() bool {\n\tif len(iter.data) <= iter.cursor {\n\t\treturn false\n\t}\n\titer.job, iter.err = iter.m.Get(iter.data[iter.cursor])\n\tif iter.err != nil {\n\t\treturn false\n\t}\n\titer.cursor++\n\treturn true\n}", "title": "" }, { "docid": "86ad26f7aa4e955b43639c2ee355ec55", "score": "0.4299108", "text": "func (it *Iterator) Valid(data []byte) bool {\n\tit.ResetBytes(data)\n\terr := it.Skip()\n\tif err != nil {\n\t\treturn false\n\t}\n\t_, err = it.nextToken()\n\treturn err == io.EOF\n}", "title": "" }, { "docid": "26dffd843c703e4a9130890d9c956cb5", "score": "0.429857", "text": "func (br *bufioReader) Next() bool {\n\tlength, err := binary.ReadUvarint(br.r)\n\tif err == io.EOF {\n\t\treturn false\n\t} else if err != nil {\n\t\tbr.err = err\n\t\treturn true\n\t}\n\tbr.count += GetVariantLength(length)\n\t// expand the cap or not\n\tif uint64(cap(br.content)) < length {\n\t\tbr.content = make([]byte, length)\n\t}\n\t// shrink the length\n\tbr.content = br.content[:length]\n\t// read content\n\tn, err := io.ReadFull(br.r, br.content)\n\tif err == io.EOF {\n\t\treturn false\n\t}\n\tbr.err = err\n\tbr.count += int64(n)\n\treturn true\n}", "title": "" }, { "docid": "ecbbabd83dee96621b71239eaaa8cefe", "score": "0.42923734", "text": "func Process(queue <-chan []byte, rules rules.Rules, rewrites rewrites.Rewrites, workerPoolSize int,\n\tshouldValidate bool, shouldLog bool, lg *zap.Logger, metrics *metrics.Prom) chan struct{} {\n\tdone := make(chan struct{})\n\n\tif workerPoolSize < 1 {\n\t\tworkerPoolSize = runtime.GOMAXPROCS(0) / 2\n\t\tif workerPoolSize == 0 {\n\t\t\tworkerPoolSize = 1\n\t\t}\n\t}\n\n\tvar wg sync.WaitGroup\n\tfor w := 1; w <= int(workerPoolSize); w++ {\n\t\twg.Add(1)\n\t\tgo worker(&wg, queue, rules, rewrites, shouldValidate, shouldLog, lg, metrics)\n\t}\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(done)\n\t}()\n\n\treturn done\n}", "title": "" }, { "docid": "3a0f00f24758991eafc52526b49147b3", "score": "0.4289179", "text": "func (q *Queue) Process(callback func(interface{})) {\n\telement, ok := q.Next()\n\n\tfor ok {\n\t\tcallback(element)\n\t\telement, ok = q.Next()\n\t}\n}", "title": "" }, { "docid": "95cae5c5b1012d8a93403acef06f5603", "score": "0.42888215", "text": "func (p *Pool) Add(job func() error) bool {\n\tp.RLock()\n\thasErr := p.err != nil\n\tp.RUnlock()\n\tif hasErr {\n\t\treturn false\n\t}\n\tp.wg.Add(1)\n\tp.jobs <- job\n\treturn true\n}", "title": "" }, { "docid": "9b211aa1f9eea1def790c0c00f06a510", "score": "0.4282505", "text": "func (c *ChunkLister) Next() bool {\n\treturn false\n}", "title": "" }, { "docid": "e69f0e146e6943491eb61fdb78c88688", "score": "0.42781872", "text": "func (c *Controller) processNextWorkItem() bool {\n\tobj, shutdown := c.queue.Get()\n\n\tif shutdown {\n\t\treturn false\n\t}\n\n\t// We wrap this block in a func so we can defer c.workqueue.Done.\n\terr := func(obj interface{}) error {\n\t\t// We call Done here so the workqueue knows we have finished\n\t\t// processing this item. We also must remember to call Forget if we\n\t\t// do not want this work item being re-queued. For example, we do\n\t\t// not call Forget if a transient error occurs, instead the item is\n\t\t// put back on the workqueue and attempted again after a back-off\n\t\t// period.\n\t\tdefer c.queue.Done(obj)\n\t\tvar key string\n\t\tvar ok bool\n\t\t// We expect strings to come off the workqueue. These are of the\n\t\t// form namespace/name. We do this as the delayed nature of the\n\t\t// workqueue means the items in the informer cache may actually be\n\t\t// more up to date that when the item was initially put onto the\n\t\t// workqueue.\n\t\tif key, ok = obj.(string); !ok {\n\t\t\t// As the item in the workqueue is actually invalid, we call\n\t\t\t// Forget here else we'd go into a loop of attempting to\n\t\t\t// process a work item that is invalid.\n\t\t\tc.queue.Forget(obj)\n\t\t\truntime.HandleError(fmt.Errorf(\"expected string in workqueue but got %#v\", obj))\n\t\t\treturn nil\n\t\t}\n\t\t// Run the syncHandler, passing it the namespace/name string of the\n\t\t// Foo resource to be synced.\n\t\tif err := c.syncHandler(key); err != nil {\n\t\t\treturn fmt.Errorf(\"error syncing '%s': %s\", key, err.Error())\n\t\t}\n\t\t// Finally, if no error occurs we Forget this item so it does not\n\t\t// get queued again until another change happens.\n\t\tc.queue.Forget(obj)\n\t\tglog.Infof(\"Successfully synced '%s'\", key)\n\t\treturn nil\n\t}(obj)\n\n\tif err != nil {\n\t\truntime.HandleError(err)\n\t\treturn true\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "9c7de5ad3bd08f96f5a272ab5eaa5209", "score": "0.42755327", "text": "func ProcessJob(ctx context.Context) error {\n\tmovies, err := model.FetchAllMovies()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmovieLatentMap := make(map[model.MovieID][]float64)\n\tfor _, movie := range movies {\n\t\tif len(movie.Feature) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tmovieLatentMap[movie.ID] = movie.Feature\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\tcase job := <-JobQueue:\n\t\t\ttrainer := lowrank.NewTrainer(movieLatentMap)\n\t\t\ttrainer.AssignJob(job)\n\n\t\t\tgo func(t *lowrank.Trainer) {\n\t\t\t\tinitLoss, err := t.Loss()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Error(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\terr = t.Train()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Error(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tlogrus.Infof(\"completed training for user %s\", job.UserEmail)\n\t\t\t\tfor _, el := range t.Preference() {\n\t\t\t\t\tif math.IsNaN(el) || math.IsInf(el, 0) {\n\t\t\t\t\t\tlogrus.Errorf(\"user %s updated preference has NaN / Inf value\", job.UserEmail)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfinalLoss, err := t.Loss()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Error(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tjob.Response <- lowrank.TrainerResponse{\n\t\t\t\t\tInitLoss: initLoss,\n\t\t\t\t\tFinalLoss: finalLoss,\n\t\t\t\t\tPreference: t.Preference(),\n\t\t\t\t}\n\t\t\t}(trainer)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9402ea5d874ec2abdd4f602a499288d4", "score": "0.4274804", "text": "func (wp *WorkPool) Dispatch(job func()) (res bool) {\n\tfor worker := range wp.pool {\n\t\tworker <- jobMsg{\n\t\t\tjob: job,\n\t\t}\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d58f82d69b067539f12adbd81f0b93c9", "score": "0.42684987", "text": "func (d *JobDecoder) Result() ([]*Job, error) {\n\t// Allow JobDecoder to be used without initialization.\n\tif d.result == nil {\n\t\treturn []*Job{}, nil\n\t}\n\tclose(d.input)\n\tselect {\n\tcase err := <-d.errors:\n\t\treturn nil, err\n\tcase result := <-d.result:\n\t\treturn result, nil\n\t}\n}", "title": "" } ]
37cf7187678fd72aeb76ff826a375fb3
Get returns a namespace for with a given name
[ { "docid": "efe6e6c1dbd93065f85000a06078692c", "score": "0.6613356", "text": "func Get(ctx context.Context, clientset *kubernetes.Clientset, name string) (*corev1.Namespace, error) {\n\topts := metav1.GetOptions{}\n\tnamespace, err := clientset.CoreV1().Namespaces().Get(ctx, name, opts)\n\tif err != nil {\n\t\tlog.Printf(\"failed trying to get namespace (%s):%s\\n\", name, err.Error())\n\t\treturn nil, err\n\t}\n\n\treturn namespace, nil\n}", "title": "" } ]
[ { "docid": "065e1b3d6f95046b8edd2f540b046e92", "score": "0.7202221", "text": "func (c *namespaces) Get(name string) (*api.Namespace, error) {\n\tresult := &api.Namespace{}\n\terr := c.r.Get().Resource(\"namespaces\").Name(name).Do().Into(result)\n\treturn result, err\n}", "title": "" }, { "docid": "d3e2d53c823c076ce8b08464b18e912b", "score": "0.6753773", "text": "func (h *Headscale) GetNamespace(name string) (*Namespace, error) {\n\tn := Namespace{}\n\tif result := h.db.First(&n, \"name = ?\", name); errors.Is(result.Error, gorm.ErrRecordNotFound) {\n\t\treturn nil, errorNamespaceNotFound\n\t}\n\treturn &n, nil\n}", "title": "" }, { "docid": "8bbd8742733b10bd3c09774fa94749e1", "score": "0.6673755", "text": "func (k K8s) GetNamespace(name string) *Namespace {\n\tnamespace, ok := k.Namespaces[name]\n\tif ok {\n\t\treturn namespace\n\t}\n\tnewNamespace := &Namespace{\n\t\tName: name,\n\t\tRelevant: k.isRelevantNamespace(name),\n\t\tEndpoints: make(map[string]*Endpoints),\n\t\tServices: make(map[string]*Service),\n\t\tIngresses: make(map[string]*Ingress),\n\t\tSecret: make(map[string]*Secret),\n\t\tStatus: ADDED,\n\t}\n\tk.Namespaces[name] = newNamespace\n\treturn newNamespace\n}", "title": "" }, { "docid": "07033f342672e3a09bf07a6db3d63595", "score": "0.6563219", "text": "func (s *NamespacesService) Get(name string) (*v1.Namespace, *unversioned.Status, error) {\n\tclient, err := getDefaultClient()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tresp := &v1.Namespace{}\n\tstatus, err := client.makeRequest(\"GET\", \"namespaces/\"+name, nil, resp)\n\tif status != nil || err != nil {\n\t\treturn nil, status, err\n\t}\n\treturn resp, nil, nil\n}", "title": "" }, { "docid": "e2056f457a00f63d03c7e892cbfb8203", "score": "0.6506421", "text": "func (m PrefixMap) Namespace(prefix string) string { return m[prefix] }", "title": "" }, { "docid": "5878aee8c2f8a5f9d96938f74abe48ce", "score": "0.64065295", "text": "func Get(ns string, c *kubernetes.Clientset) (*apiv1.Namespace, error) {\n\tn, err := c.CoreV1().Namespaces().Get(ns, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn n, nil\n}", "title": "" }, { "docid": "ce58f0c6d69f0e26c436fbab224399a9", "score": "0.6384119", "text": "func (a *NamespaceKeeper) Get(name string, blockNum ...uint64) *state.Namespace {\n\n\t// Get version is provided\n\tvar version uint64\n\tif len(blockNum) > 0 && blockNum[0] > 0 {\n\t\tversion = blockNum[0]\n\t}\n\n\t// Query the namespace by key. If version is provided, we do a versioned\n\t// query, otherwise we query the latest.\n\tkey := MakeNamespaceKey(name)\n\tvar bs []byte\n\tif version != 0 {\n\t\t_, bs = a.state.GetVersioned(key, int64(version))\n\t} else {\n\t\t_, bs = a.state.Get(key)\n\t}\n\n\t// If we don't find the namespace, we return an empty namespace.\n\tif bs == nil {\n\t\treturn state.BareNamespace()\n\t}\n\n\t// Otherwise, we decode the bytes to types.Namespace\n\tns, err := state.NewNamespaceFromBytes(bs)\n\tif err != nil {\n\t\tpanic(errors.Wrap(err, \"failed to decode namespace byte slice\"))\n\t}\n\n\treturn ns\n}", "title": "" }, { "docid": "dcee0e7fa11699d2cbb85722c6d70cc7", "score": "0.6321218", "text": "func (s *sdHandler) getNamespace(ctx context.Context, name string) (*sdpb.Namespace, error) {\n\tnsPath := s.getResourcePath(name)\n\n\t// Try to get it, first\n\tns, err := s.client.GetNamespace(ctx, &sdpb.GetNamespaceRequest{\n\t\tName: nsPath,\n\t})\n\n\tif err == nil {\n\t\treturn ns, nil\n\t}\n\n\t// If it doesn't exist we're returning nil.\n\t// This will make the code that uses this functions free from having\n\t// to worry about importing and checking errors, thus cluttering the\n\t// code too much\n\tif status.Code(err) == codes.NotFound {\n\t\treturn nil, nil\n\t}\n\n\t// Every other error\n\treturn nil, err\n}", "title": "" }, { "docid": "1b6b725b0df4304f53e135577b881e09", "score": "0.6294596", "text": "func (reg *registry) Get(namespace string, create bool) (Namespace, bool) {\n\t// Lock the mutex around the registry\n\treg.Lock()\n\tdefer reg.Unlock()\n\n\t// Get and return the namespace\n\tns, ok := reg.namespaces[namespace]\n\tif !ok {\n\t\tif !create {\n\t\t\treturn nil, false\n\t\t}\n\n\t\t// Create the namespace\n\t\tns = newNamespace(namespace)\n\t\treg.namespaces[namespace] = ns\n\t}\n\n\treturn ns, true\n}", "title": "" }, { "docid": "73b965097512d73811fb728571191f34", "score": "0.6293627", "text": "func (rng *RandomNameGenerator) GetNamespace(namespace string) string {\n\tif val, ok := rng.namespaces[namespace]; ok {\n\t\treturn val\n\t}\n\tname := rng.randNames.GetLongName()\n\trng.namespaces[namespace] = name\n\treturn name\n}", "title": "" }, { "docid": "9137b4862abe54226eaa9c1bc352de57", "score": "0.6285583", "text": "func (c apps) getNamespace(name string) (ns *api.Namespace, err error) {\n\tns, err = c.k.k8sClient.Namespaces().Get(name)\n\tif err != nil {\n\t\tif k8s_errors.IsNotFound(err) {\n\t\t\treturn nil, NewNotFoundErrorf(`namespace \"%s\" not found`, name)\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn\n}", "title": "" }, { "docid": "e9994d5f06dbc7f17d3dff8c3ea33963", "score": "0.62651473", "text": "func (s *Store) GetNamespace(ctx context.Context, name string) (*corev2.Namespace, error) {\n\tvar namespace corev2.Namespace\n\terr := Get(ctx, s.client, getNamespacePath(name), &namespace)\n\tif err != nil {\n\t\tif _, ok := err.(*store.ErrNotFound); ok {\n\t\t\terr = nil\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn &namespace, nil\n}", "title": "" }, { "docid": "8d7c6a6b817c2d5ae1faae6e844e7b81", "score": "0.61992115", "text": "func (k *kubeManager) getNamespace(ctx context.Context, ns string) (*v1.Namespace, error) {\n\tselectedNameSpace, err := k.clientSet.CoreV1().Namespaces().Get(ctx, ns, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to get namespace %s: %w\", ns, err)\n\t}\n\treturn selectedNameSpace, nil\n}", "title": "" }, { "docid": "1a6594d39b9c2e674f9af02dfa34cb87", "score": "0.6190343", "text": "func (r *HierarchyConfigReconciler) getNamespace(ctx context.Context, nm string) (*corev1.Namespace, error) {\n\tns := &corev1.Namespace{}\n\tnnm := types.NamespacedName{Name: nm}\n\tif err := r.Get(ctx, nnm, ns); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ns, nil\n}", "title": "" }, { "docid": "8f3bda197c3d8d7ac87e955036a17a44", "score": "0.6187509", "text": "func (s *memStore) Get(typ namespace.Type, name string) (*namespace.Namespace, error) {\n\tif ns, ok := s.data[typ][name]; ok {\n\t\tnewNs, err := ns.Dup()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn newNs, nil\n\t}\n\treturn nil, store.ErrNotExists\n}", "title": "" }, { "docid": "2bbfcc643868d0b0296c418b6de54081", "score": "0.61263186", "text": "func Get(ctx context.Context, kubeClient *kubernetes.Cluster, lookupNamespace string) (*Namespace, error) {\n\tnamespaces, err := List(ctx, kubeClient)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, namespace := range namespaces {\n\t\tif namespace.Name == lookupNamespace {\n\t\t\treturn &namespace, nil\n\t\t}\n\t}\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "2a6033b38ce8ce9ebd21d7866c90dffd", "score": "0.6063712", "text": "func (client *RestClient) FetchNamespace(namespaceName string) (*corev3.Namespace, error) {\n\tpath := NamespacesPath(namespaceName)\n\tres, err := client.R().Get(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif res.StatusCode() >= 400 {\n\t\treturn nil, UnmarshalError(res)\n\t}\n\n\tvar wrapper types.Wrapper\n\terr = json.Unmarshal(res.Body(), &wrapper)\n\treturn wrapper.Value.(*corev3.Namespace), err\n}", "title": "" }, { "docid": "21aaff746901fcae500d97958c334c3b", "score": "0.6059514", "text": "func GetNamespace(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *NamespaceState, opts ...pulumi.ResourceOption) (*Namespace, error) {\n\tvar resource Namespace\n\terr := ctx.ReadResource(\"alicloud:cms/namespace:Namespace\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "2aeac6fc64ac92fc13bc76476c6b1397", "score": "0.60267043", "text": "func GetNamespace(ctx *context.T) namespace.T {\n\treturn initState.currentRuntime().GetNamespace(ctx)\n}", "title": "" }, { "docid": "8e7ebf0303e338cb39b2213f76786276", "score": "0.602054", "text": "func GetNameSpace(namespaceName string) (*PmemNameSpace, error) {\n\tnamespace := &PmemNameSpace{}\n\tnamespaceList := []*PmemNameSpace{}\n\tgetRegionCmd := fmt.Sprintf(\"%s ndctl list -n %s\", NsenterCmd, namespaceName)\n\tregionOut, err := utils.Run(getRegionCmd)\n\tif err != nil {\n\t\treturn namespace, err\n\t}\n\terr = json.Unmarshal(([]byte)(regionOut), &namespaceList)\n\tif err != nil {\n\t\treturn namespace, err\n\t}\n\tif len(namespaceList) == 1 {\n\t\treturn namespaceList[0], nil\n\t}\n\treturn namespace, fmt.Errorf(\"namespace found error\")\n}", "title": "" }, { "docid": "bad8c637fe4e3b0f6acc0a5bdb2a91bb", "score": "0.60179335", "text": "func GetNamespace(nsPath string, nsType NSType) (Namespace, error) {\n\tns, err := nspkg.GetNS(nsPath)\n\tif err != nil {\n\t\t// Failed to GetNS. It's possible this is expected (pod is stopped).\n\t\treturn &namespace{nsType: nsType, nsPath: nsPath, closed: true}, err\n\t}\n\n\treturn &namespace{ns: ns, nsType: nsType, nsPath: nsPath}, nil\n}", "title": "" }, { "docid": "9c887d480cc50b4f8be0e396ebd42605", "score": "0.6012102", "text": "func GetNamespace(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *NamespaceState, opts ...pulumi.ResourceOption) (*Namespace, error) {\n\tvar resource Namespace\n\terr := ctx.ReadResource(\"aws:redshiftserverless/namespace:Namespace\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "772daa0f11e9ac31a4043e48d214741b", "score": "0.5993024", "text": "func (s *REST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {\n\topts := metav1.GetOptions{}\n\tif options != nil {\n\t\topts = *options\n\t}\n\tnamespace, err := s.client.Get(name, opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn projectutil.ConvertNamespace(namespace), nil\n}", "title": "" }, { "docid": "3749a33630cd6260716ba40cc7d3668c", "score": "0.59223217", "text": "func (p *ZDBPool) Namespace(name string) (info NSInfo, err error) {\n\tpath := filepath.Join(p.path, name, \"zdb-namespace\")\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn info, err\n\t}\n\n\tdefer f.Close()\n\theader, err := ReadHeader(f)\n\tif err != nil {\n\t\treturn info, errors.Wrapf(err, \"failed to read namespace header at %s\", path)\n\t}\n\n\tinfo = NSInfo{\n\t\tName: name,\n\t\tSize: header.MaxSize,\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "421e35d7a679132edbbb95848234cc9e", "score": "0.5919029", "text": "func GetNamespace(namespace, defaultNamespace string) string {\n\tif namespace == \"\" {\n\t\treturn defaultNamespace\n\t}\n\treturn namespace\n}", "title": "" }, { "docid": "b557ef0ae1ee169b9b94ea846b14076b", "score": "0.5908617", "text": "func GetNamespace() string {\n\treturn namespace\n}", "title": "" }, { "docid": "9fccb8bee8c8e7924fd72e2751cd227a", "score": "0.58868694", "text": "func (l *Local) Namespace(envName string) (string, error) {\n\tenv, err := env2.GetEnvByName(envName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn env.Namespace, nil\n}", "title": "" }, { "docid": "4a1bbd6479ea38992c03579872580c24", "score": "0.5882549", "text": "func GetFromName(name string) (*NetworkNs, error) {\n\treturn GetFromPath(fmt.Sprintf(\"/var/run/netns/%s\", name))\n}", "title": "" }, { "docid": "6128224ece002e047f41ab0182de062e", "score": "0.5869352", "text": "func (p *Pod) GetNamespace() string { return p.namespace }", "title": "" }, { "docid": "09d24578e8c030c9545e611227ce4bf8", "score": "0.5857951", "text": "func (c *Config) GetNamespace() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvars := mux.Vars(r)\n\n\t\tns, err := c.Client.CoreV1().Namespaces().Get(vars[\"namespace\"], metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusOK)\n\t\tjson.NewEncoder(w).Encode(ns)\n\t}\n}", "title": "" }, { "docid": "ecb0ec7935253bc6097aa241ae09fea3", "score": "0.58568186", "text": "func GetNamespace(path string) string {\n\tnamespace := \"\"\n\tparts := strings.Split(path, \".\")\n\tif strings.HasPrefix(parts[0], \"$\") {\n\t\tnamespace = strings.TrimPrefix(parts[0], \"$\")\n\t}\n\tif namespace == \"\" {\n\t\tnamespace = Current\n\t}\n\treturn namespace\n}", "title": "" }, { "docid": "121f099a26b72b8e0e6f489572c538a1", "score": "0.5844068", "text": "func (c *UsersService) GetNamespace(name string) (*teleservices.Namespace, error) {\n\treturn c.backend.GetNamespace(name)\n}", "title": "" }, { "docid": "b852ca710a70a8e60c2a074bc966edf6", "score": "0.5787057", "text": "func (s *Storage) GetNamespace(ctx context.Context, ID int64) (*Namespace, error) {\n\tvar namespace Namespace\n\terr := s.db.QueryRowContext(ctx, \"SELECT id, name, created_by, last_modified_by, created_at, last_modified_at FROM namespaces WHERE id=$1;\", ID).Scan(&namespace.ID, &namespace.Name, &namespace.audit.createdBy, &namespace.audit.lastModifiedBy, &namespace.audit.createdAt, &namespace.audit.lastModifiedAt)\n\tif err != nil {\n\t\treturn nil, s.database.ProcessError(err)\n\t}\n\n\treturn &namespace, nil\n}", "title": "" }, { "docid": "ea3f3fb61406fba880ac39f006155fea", "score": "0.5748227", "text": "func GetNamespacedName(r *reconcile.Request, pattern, namespace string) types.NamespacedName {\n\tif namespace == \"\" {\n\t\tnamespace = r.Namespace\n\t}\n\treturn types.NamespacedName{\n\t\tName: fmt.Sprintf(pattern, r.Name),\n\t\tNamespace: namespace,\n\t}\n}", "title": "" }, { "docid": "80d7a549f5e6016f324525aa1e5cde02", "score": "0.57421917", "text": "func (r *Request) Namespace(name string) map[string]interface{} {\n\treturn r.commands[name]\n}", "title": "" }, { "docid": "c8541b106ee8b950319cf52ff7a1c4c6", "score": "0.5741743", "text": "func (c *clientSet) GetNamespace(name string) (result *v1.Namespace, err error) {\n\tresult = &v1.Namespace{}\n\terr = c.coreClient.Get().\n\t\tResource(\"namespaces\").\n\t\tName(name).\n\t\tVersionedParams(&meta_v1.GetOptions{}, scheme.ParameterCodec).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "540bb67e020b46e33ab71714571e51a3", "score": "0.5731251", "text": "func (c *Client) Namespace(nsp string) Namespace { return c.creatensp(nsp) }", "title": "" }, { "docid": "2cd3bfd200655940809561af9be5be90", "score": "0.5727532", "text": "func (s *API) GetNamespace(req *GetNamespaceRequest, opts ...scw.RequestOption) (*Namespace, error) {\n\tvar err error\n\n\tif req.Region == \"\" {\n\t\tdefaultRegion, _ := s.client.GetDefaultRegion()\n\t\treq.Region = defaultRegion\n\t}\n\n\tif fmt.Sprint(req.Region) == \"\" {\n\t\treturn nil, errors.New(\"field Region cannot be empty in request\")\n\t}\n\n\tif fmt.Sprint(req.NamespaceID) == \"\" {\n\t\treturn nil, errors.New(\"field NamespaceID cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"GET\",\n\t\tPath: \"/registry/v1/regions/\" + fmt.Sprint(req.Region) + \"/namespaces/\" + fmt.Sprint(req.NamespaceID) + \"\",\n\t\tHeaders: http.Header{},\n\t}\n\n\tvar resp Namespace\n\n\terr = s.client.Do(scwReq, &resp, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "fa4734d3295d694de1cd294e9c60ebed", "score": "0.57149875", "text": "func (c *client) GetNamespace(name string) (*corev1.Namespace, error) {\n\treturn c.coreClient.Namespaces().Get(name, metav1.GetOptions{})\n}", "title": "" }, { "docid": "ae2ae64452871353b424238e396f8681", "score": "0.57027495", "text": "func (s directorBindNamespaceLister) Get(name string) (*bind.DirectorBind, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(bind.Resource(\"directorbind\"), name)\n\t}\n\treturn obj.(*bind.DirectorBind), nil\n}", "title": "" }, { "docid": "ba167f2684d6ec9bb71fd9d0061e6d89", "score": "0.5656153", "text": "func (s typ0crdNamespaceLister) Get(name string) (*v1.Typ0crd, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"typ0crd\"), name)\n\t}\n\treturn obj.(*v1.Typ0crd), nil\n}", "title": "" }, { "docid": "8b6b733cfb93964aec6199171068c83b", "score": "0.5617935", "text": "func GetNamespace(clientset *kubernetes.Clientset, username, requestedNS string) (string, error) {\n\n\tlog.Debugf(\"GetNamespace username [%s] ns [%s]\", username, requestedNS)\n\n\tif requestedNS == \"\" {\n\t\treturn requestedNS, errors.New(\"empty namespace is not valid from pgo clients\")\n\t}\n\n\tif !UserIsPermittedInNamespace(username, requestedNS) {\n\t\terrMsg := fmt.Sprintf(\"user [%s] is not allowed access to namespace [%s]\", username, requestedNS)\n\t\treturn requestedNS, errors.New(errMsg)\n\t}\n\n\tif util.WatchingNamespace(clientset, requestedNS) {\n\t\treturn requestedNS, nil\n\t}\n\n\tlog.Debugf(\"GetNamespace did not find the requested namespace %s\", requestedNS)\n\treturn requestedNS, errors.New(\"requested Namespace was not found to be in the list of Namespaces being watched.\")\n}", "title": "" }, { "docid": "cd6d996f88071c1f872bf0325ad59ccb", "score": "0.5598151", "text": "func (i *ClowdApp) GetNamespacedName(pattern string) types.NamespacedName {\n\treturn types.NamespacedName{\n\t\tNamespace: i.Namespace,\n\t\tName: fmt.Sprintf(pattern, i.Name),\n\t}\n}", "title": "" }, { "docid": "a7062410f0741c220d969ff5320da75d", "score": "0.5589354", "text": "func (s danmNetNamespaceLister) Get(name string) (*v1.DanmNet, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"danmnet\"), name)\n\t}\n\treturn obj.(*v1.DanmNet), nil\n}", "title": "" }, { "docid": "46dba63a0c9704e95cf05b38b5602323", "score": "0.55787456", "text": "func (c *NamespaceController) Get(ctx *app.GetNamespaceContext) error {\n\t// NamespaceController_Get: start_implement\n\tif _, ok := c.ds.Project(ctx.Projectid); !ok {\n\t\treturn ctx.NotFound()\n\t}\n\tns, ok := c.ds.Namespace(ctx.Namespaceid)\n\tif !ok {\n\t\treturn ctx.NotFound()\n\t}\n\tres := MarshalNamespaceObject(ns)\n\treturn ctx.OK(res)\n\t// NamespaceController_Get: end_implement\n}", "title": "" }, { "docid": "b9b9193835d6f3fdd86ccd6d1d78a999", "score": "0.5564025", "text": "func (o LookupTopicResultOutput) NamespaceName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LookupTopicResult) *string { return v.NamespaceName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "fad9e8cdd0e192625cbdf39fd91f9f13", "score": "0.55539626", "text": "func (m *MockNamespaceStore) GetByName(v0 context.Context, v1 string) (*Namespace, error) {\n\tr0, r1 := m.GetByNameFunc.nextHook()(v0, v1)\n\tm.GetByNameFunc.appendCall(NamespaceStoreGetByNameFuncCall{v0, v1, r0, r1})\n\treturn r0, r1\n}", "title": "" }, { "docid": "51c96c888a511791cca19bf37c413b65", "score": "0.55501807", "text": "func (ns *NS) GetName() string {\n\treturn ns.Name\n}", "title": "" }, { "docid": "58d654d301127429bf41f2be386c5732", "score": "0.5544382", "text": "func GetNamespace() string {\n\treturn getNamespace(\"/var/run/secrets/kubernetes.io/serviceaccount/namespace\")\n}", "title": "" }, { "docid": "a691fb1a7cc1617e8804c0fa82f90db5", "score": "0.55311424", "text": "func (p *Provider) GetSpaceByName(spaceName string) (*Space, error) {\n\t// Response struct\n\tresponse := struct {\n\t\tSpace []*struct {\n\t\t\tID int `json:\"id\"`\n\t\t\tName string `json:\"name\"`\n\t\t\tKubeContext *struct {\n\t\t\t\tNamespace string `json:\"namespace\"`\n\t\t\t\tServiceAccountToken string `json:\"service_account_token\"`\n\n\t\t\t\tCluster *struct {\n\t\t\t\t\tCaCert string `json:\"ca_cert\"`\n\t\t\t\t\tServer string `json:\"server\"`\n\t\t\t\t} `json:\"clusterByclusterId\"`\n\n\t\t\t\tDomains []*struct {\n\t\t\t\t\tURL string `json:\"url\"`\n\t\t\t\t} `json:\"kubeContextDomainsBykubeContextId\"`\n\t\t\t} `json:\"kubeContextBykubeContextId\"`\n\t\t\tCreatedAt string `json:\"created_at\"`\n\t\t} `json:\"space\"`\n\t}{}\n\n\t// Do the request\n\terr := p.GrapqhlRequest(`\n\t query($name:String!) {\n\t\t\tspace(where:{name:{_eq:$name}},limit:1){\n\t\t\t\tid\n\t\t\t\tname\n\t\t\t\t\n\t\t\t\tkubeContextBykubeContextId {\n\t\t\t\t\tnamespace\n\t\t\t\t\tservice_account_token\n\t\t\t\t\t\n\t\t\t\t\tclusterByclusterId {\n\t\t\t\t\t\tca_cert\n\t\t\t\t\t\tserver\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tkubeContextDomainsBykubeContextId(limit:1) {\n\t\t\t\t\t\turl\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tcreated_at\n\t\t\t}\n\t }\n\t`, map[string]interface{}{\n\t\t\"name\": spaceName,\n\t}, &response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Check result\n\tif response.Space == nil {\n\t\treturn nil, fmt.Errorf(\"Space %s not found\", spaceName)\n\t}\n\tif len(response.Space) == 0 {\n\t\treturn nil, fmt.Errorf(\"Space %s not found\", spaceName)\n\t}\n\n\tspaceConfig := response.Space[0]\n\tif spaceConfig.KubeContext == nil {\n\t\treturn nil, fmt.Errorf(\"KubeContext is nil for space %s\", spaceConfig.Name)\n\t}\n\tif spaceConfig.KubeContext.Cluster == nil {\n\t\treturn nil, fmt.Errorf(\"Cluster is nil for space %s\", spaceConfig.Name)\n\t}\n\n\tretSpace := &Space{\n\t\tSpaceID: spaceConfig.ID,\n\t\tName: spaceConfig.Name,\n\t\tNamespace: spaceConfig.KubeContext.Namespace,\n\t\tServiceAccountToken: spaceConfig.KubeContext.ServiceAccountToken,\n\t\tServer: spaceConfig.KubeContext.Cluster.Server,\n\t\tCaCert: spaceConfig.KubeContext.Cluster.CaCert,\n\t\tProviderName: p.Name,\n\t\tCreated: spaceConfig.CreatedAt,\n\t}\n\tif spaceConfig.KubeContext.Domains != nil && len(spaceConfig.KubeContext.Domains) > 0 {\n\t\tretSpace.Domain = &spaceConfig.KubeContext.Domains[0].URL\n\t}\n\n\treturn retSpace, nil\n}", "title": "" }, { "docid": "292511e13c6a8614f1db36a85af7e414", "score": "0.55227524", "text": "func NameSpaceForConfig(configFile string) *Namespaced {\n\tif !fileutils.FileExists(configFile) {\n\t\treturn nil\n\t}\n\n\tprj, err := FromPath(configFile)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tnames := Namespaced{\n\t\tOwner: prj.Owner(),\n\t\tProject: prj.Name(),\n\t}\n\n\tcommitID, err := localcommit.Get(prj.Dir())\n\tif err != nil && !localcommit.IsFileDoesNotExistError(err) {\n\t\tmultilog.Error(\"Unable to get local commit: %v\", errs.JoinMessage(err))\n\t}\n\tif commitID != \"\" {\n\t\tnames.CommitID = &commitID\n\t}\n\n\treturn &names\n}", "title": "" }, { "docid": "0f5f3c43216dd4a6e3248ec7543d9ed0", "score": "0.55206245", "text": "func findPublicNamespace(name string, sdClient serviceDiscoveryClient) (*string, error) {\n\tvar namespace *string\n\terr := listNamespaces(true, sdClient, func(n *servicediscovery.NamespaceSummary) bool {\n\t\tif aws.StringValue(n.Name) == name {\n\t\t\tnamespace = n.Id\n\t\t\treturn false // we found it, stop the list call\n\t\t}\n\t\treturn true\n\t})\n\n\treturn namespace, err\n}", "title": "" }, { "docid": "62c5379141780c6be29c5c39cc8bd6a2", "score": "0.5519405", "text": "func (re *JSRE) Get(ns string) (v otto.Value, err error) {\n\tre.Do(func(vm *otto.Otto) { v, err = vm.Get(ns) })\n\treturn v, err\n}", "title": "" }, { "docid": "01cf65341df4ecefa1893b190cda520e", "score": "0.55146646", "text": "func GetNamespace(t testing.TestingT, options *KubectlOptions, namespaceName string) *corev1.Namespace {\n\tnamespace, err := GetNamespaceE(t, options, namespaceName)\n\trequire.NoError(t, err)\n\trequire.NotNil(t, namespace)\n\treturn namespace\n}", "title": "" }, { "docid": "6e6a65545d310d820bf677c9e6e51803", "score": "0.5513756", "text": "func (s proxySQLNamespaceLister) Get(name string) (*v1alpha2.ProxySQL, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha2.Resource(\"proxysql\"), name)\n\t}\n\treturn obj.(*v1alpha2.ProxySQL), nil\n}", "title": "" }, { "docid": "9a2da7470b52b1229a31f763e649d9c2", "score": "0.5506785", "text": "func resloveNameSpacedName(req ctrl.Request, s string) types.NamespacedName {\n\treturn types.NamespacedName{\n\t\tNamespace: req.Namespace,\n\t\tName: s,\n\t}\n}", "title": "" }, { "docid": "76db671f24aa57a7072cf032135fbace", "score": "0.54799", "text": "func (nm *tenantNamespaceManager) GetNamespace(ctx context.Context, cluster discoveryv1alpha1.ClusterIdentity) (*v1.Namespace, error) {\n\treq, err := labels.NewRequirement(discovery.ClusterIDLabel, selection.Equals, []string{cluster.ClusterID})\n\tutilruntime.Must(err)\n\n\tnamespaces, err := nm.listNamespaces(ctx, labels.NewSelector().Add(*req))\n\tif err != nil {\n\t\tklog.Error(err)\n\t\treturn nil, err\n\t}\n\n\tif nItems := len(namespaces); nItems == 0 {\n\t\terr = kerrors.NewNotFound(v1.Resource(\"Namespace\"), GetNameForNamespace(cluster))\n\t\t// do not log it always, since it is also used in the preliminary stage of the create method\n\t\tklog.V(4).Info(err)\n\t\treturn nil, err\n\t} else if nItems > 1 {\n\t\terr = fmt.Errorf(\"multiple tenant namespaces found for clusterid %v\", cluster.ClusterName)\n\t\tklog.Error(err)\n\t\treturn nil, err\n\t}\n\treturn namespaces[0].DeepCopy(), nil\n}", "title": "" }, { "docid": "f0ce129391a19cbeaafd200800158d1f", "score": "0.54697424", "text": "func (k *K8sProvider) Namespace() string {\n\treturn k.namespace\n}", "title": "" }, { "docid": "6f69bc1d842d02b7f115186f57aaee58", "score": "0.54635656", "text": "func (r *NamespaceCreate) GetName() string {\n\treturn r.Name\n}", "title": "" }, { "docid": "13e789646ce867286933133163dcf6e7", "score": "0.54631114", "text": "func (ps Packages) GetByName(n string) Package {\n\tvar r Package\n\tfor _, p := range ps {\n\t\tif p.Name == n {\n\t\t\tr = p\n\t\t}\n\t}\n\treturn r\n}", "title": "" }, { "docid": "3a7ea1b338df3cadd4aa419dd45e0197", "score": "0.54615885", "text": "func (s memcachedNamespaceLister) Get(name string) (*v1alpha2.Memcached, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha2.Resource(\"memcached\"), name)\n\t}\n\treturn obj.(*v1alpha2.Memcached), nil\n}", "title": "" }, { "docid": "913b0e7035d0f0aede73928199593aef", "score": "0.54496235", "text": "func (a *ServerWithRoles) GetNamespace(name string) (*types.Namespace, error) {\n\tif err := a.action(apidefaults.Namespace, types.KindNamespace, types.VerbRead); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\treturn a.authServer.GetNamespace(name)\n}", "title": "" }, { "docid": "ab48e506423bdf7b4a718a345e055a5a", "score": "0.54439807", "text": "func (t Node) GetNamespace() string {\n\treturn \"\"\n}", "title": "" }, { "docid": "dabaef2fbbca6b7e3785f130403a1598", "score": "0.53948003", "text": "func (s awsWafregionalGeoMatchSetNamespaceLister) Get(name string) (*v1.AwsWafregionalGeoMatchSet, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"awswafregionalgeomatchset\"), name)\n\t}\n\treturn obj.(*v1.AwsWafregionalGeoMatchSet), nil\n}", "title": "" }, { "docid": "a1ebd3dc50c268b381e5e663ecaa4910", "score": "0.53936946", "text": "func (s frameworkNamespaceLister) Get(name string) (*v2.Framework, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v2.Resource(\"framework\"), name)\n\t}\n\treturn obj.(*v2.Framework), nil\n}", "title": "" }, { "docid": "f4ccc8e87dd59d8cbd28ee6e82951b2b", "score": "0.5383344", "text": "func (s missionNamespaceLister) Get(name string) (*v1alpha1.Mission, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"mission\"), name)\n\t}\n\treturn obj.(*v1alpha1.Mission), nil\n}", "title": "" }, { "docid": "7548f338d836826c2683645fe2c41115", "score": "0.5380338", "text": "func (s serviceNamespaceLister) Get(name string) (*v1.Service, error) {\r\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\tif !exists {\r\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"service\"), name)\r\n\t}\r\n\treturn obj.(*v1.Service), nil\r\n}", "title": "" }, { "docid": "8366c190ed8d0198ac3016fe38d9c7bb", "score": "0.53777605", "text": "func (s sqlVirtualNetworkRuleNamespaceLister) Get(name string) (*v1alpha1.SqlVirtualNetworkRule, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"sqlvirtualnetworkrule\"), name)\n\t}\n\treturn obj.(*v1alpha1.SqlVirtualNetworkRule), nil\n}", "title": "" }, { "docid": "b780c7ef40fc7c1e667db0be4596824c", "score": "0.5376208", "text": "func (s awsWafIpsetNamespaceLister) Get(name string) (*v1.AwsWafIpset, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"awswafipset\"), name)\n\t}\n\treturn obj.(*v1.AwsWafIpset), nil\n}", "title": "" }, { "docid": "32a9389bc3f99f2b278881e7591310e8", "score": "0.536916", "text": "func (o *K8s) GetNamespace() (string, error) {\n\tif ns := os.Getenv(\"POD_NAMESPACE\"); ns != \"\" {\n\t\treturn ns, nil\n\t}\n\tif data, err := ioutil.ReadFile(\"/var/run/secrets/kubernetes.io/serviceaccount/namespace\"); err == nil {\n\t\tif ns := strings.TrimSpace(string(data)); len(ns) > 0 {\n\t\t\treturn ns, nil\n\t\t}\n\t\treturn \"\", err\n\t}\n\treturn \"\", nil\n}", "title": "" }, { "docid": "5339b076fe3dc8d82fb3f3cead7311d9", "score": "0.53605425", "text": "func NewNS(name string) *NS {\n\tns := new(NS)\n\tns.Name = name\n\treturn ns\n}", "title": "" }, { "docid": "ac323238397f3b32c7adef9ad37756fe", "score": "0.5357466", "text": "func (f *Feature) GetNamespace() string {\n\treturn fmt.Sprintf(\"%s/%s\", f.Namespace, FeatureScope)\n}", "title": "" }, { "docid": "d3a633096d1fcbc8335a76359cc52b5a", "score": "0.5338151", "text": "func GetNamespaceDetails(ns v1.Namespace) namespace.Namespace {\n\treturn namespace.Namespace{\n\t\tName: ns.Name,\n\t\tApplication: ns.Annotations[\"cloud-platform.justice.gov.uk/application\"],\n\t\tBusinessUnit: ns.Annotations[\"cloud-platform.justice.gov.uk/business-unit\"],\n\t\tDeploymentType: ns.Labels[\"cloud-platform.justice.gov.uk/environment-name\"],\n\t\tGithubURL: ns.Annotations[\"cloud-platform.justice.gov.uk/source-code\"],\n\t\tTeamName: ns.Annotations[\"cloud-platform.justice.gov.uk/team-name\"],\n\t\tTeamSlackChannel: ns.Annotations[\"cloud-platform.justice.gov.uk/slack-channel\"],\n\t\tDomainNames: []string{},\n\t}\n}", "title": "" }, { "docid": "9502b018829c9ee42d35cd0025b32e2d", "score": "0.53349704", "text": "func (c Config) NamespaceName() string {\n\treturn c.NamespacedName().NamespaceName()\n}", "title": "" }, { "docid": "cfe4b4d84fb51e7a0a7af543768fc22d", "score": "0.5332561", "text": "func (o *SparseDiscoveryMode) GetNamespace() (out string) {\n\n\tif o.Namespace == nil {\n\t\treturn\n\t}\n\n\treturn *o.Namespace\n}", "title": "" }, { "docid": "1784e8408826e8f72cc1a4505aac69d4", "score": "0.5328029", "text": "func (s frameworkNamespaceLister) Get(name string) (*v1.Framework, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"framework\"), name)\n\t}\n\treturn obj.(*v1.Framework), nil\n}", "title": "" }, { "docid": "d19abc732fa60ec308afba9dd5148aac", "score": "0.53266674", "text": "func newNamespace(name string) Namespace {\n\treturn &namespace{\n\t\tnamespace: name,\n\t\tcontents: map[string][]*PluginMeta{},\n\t}\n}", "title": "" }, { "docid": "cb08b72236ec7562b549ff43a3c0292b", "score": "0.5325378", "text": "func (suite *BaseSuite) GetNewNamespace(opts ...servicebus.NamespaceOption) *servicebus.Namespace {\n\tns, err := servicebus.NewNamespace(append(opts, servicebus.NamespaceWithConnectionString(suite.ConnStr))...)\n\tif err != nil {\n\t\tsuite.T().Fatal(err)\n\t}\n\treturn ns\n}", "title": "" }, { "docid": "b7541b90438f1ce1e623e71cb55531e2", "score": "0.5324321", "text": "func (r *Resolver) Namespace() gqlschema.NamespaceResolver { return &namespaceResolver{r} }", "title": "" }, { "docid": "bcae19c8622407fe8e185e5b9cd957c4", "score": "0.53234655", "text": "func (p *Project) Namespace() *Namespaced {\n\tcommitID, err := localcommit.Get(p.Dir())\n\tif err != nil && !localcommit.IsFileDoesNotExistError(err) {\n\t\tmultilog.Error(\"Unable to get local commit: %v\", errs.JoinMessage(err))\n\t}\n\treturn &Namespaced{p.projectfile.Owner(), p.projectfile.Name(), &commitID, false}\n}", "title": "" }, { "docid": "9b24063249eeefdf1839989300d44ff1", "score": "0.53232193", "text": "func (s cosmosdbMongoCollectionNamespaceLister) Get(name string) (*v1alpha1.CosmosdbMongoCollection, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"cosmosdbmongocollection\"), name)\n\t}\n\treturn obj.(*v1alpha1.CosmosdbMongoCollection), nil\n}", "title": "" }, { "docid": "ffaf7582ad02ba94ff780c3130b2c95b", "score": "0.5322894", "text": "func (r *ProjectsLocationsWorkloadIdentityPoolsNamespacesOperationsService) Get(name string) *ProjectsLocationsWorkloadIdentityPoolsNamespacesOperationsGetCall {\n\tc := &ProjectsLocationsWorkloadIdentityPoolsNamespacesOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "title": "" }, { "docid": "5b27f1687fe07d478b43e3c9db4b5f59", "score": "0.530889", "text": "func nsFromToken(token string) string {\n\t// ns:<namespace>\n\tparts := strings.Split(token, \":\")\n\tif len(parts) == 2 && parts[0] == \"ns\" {\n\t\treturn parts[1]\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "4d15a95985df168ff54416ab476a8b97", "score": "0.5300208", "text": "func (r *eventImpl) Namespace(p graphql.ResolveParams) (string, error) {\n\tevent := p.Source.(*corev2.Event)\n\tif event.Entity != nil {\n\t\treturn event.Entity.Namespace, nil\n\t}\n\tif event.Check != nil {\n\t\treturn event.Check.Namespace, nil\n\t}\n\treturn \"\", nil\n}", "title": "" }, { "docid": "754e36a47817cbf6650f58eeda04700d", "score": "0.5287383", "text": "func (s schemaReplicationNamespaceLister) Get(name string) (*v1beta1.SchemaReplication, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1beta1.Resource(\"schemareplication\"), name)\n\t}\n\treturn obj.(*v1beta1.SchemaReplication), nil\n}", "title": "" }, { "docid": "775fd931d553c994bc2e84a967727e8f", "score": "0.5285276", "text": "func (s cStorRestoreNamespaceLister) Get(name string) (*v1alpha1.CStorRestore, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"cstorrestore\"), name)\n\t}\n\treturn obj.(*v1alpha1.CStorRestore), nil\n}", "title": "" }, { "docid": "44d8b5455f2c73feb3a9fe0a0266b62f", "score": "0.52845925", "text": "func (erf ErrRelationNotFound) NamespaceName() string {\n\treturn erf.namespaceName\n}", "title": "" }, { "docid": "05c26eac14fba5cc0241ddb5f699f699", "score": "0.52777654", "text": "func (s containerBuildNamespaceLister) Get(name string) (*v1.ContainerBuild, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"containerbuild\"), name)\n\t}\n\treturn obj.(*v1.ContainerBuild), nil\n}", "title": "" }, { "docid": "d4b7b0b09ba5bc35276bf5a399a5b632", "score": "0.52767646", "text": "func (c *WebsocketState) GetNamespace() string {\n\treturn c.namespace.get()\n}", "title": "" }, { "docid": "00d90e7b4917aed39c210f88305c7125", "score": "0.5276334", "text": "func (o SecretBackendCaOutput) Namespace() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SecretBackendCa) pulumi.StringPtrOutput { return v.Namespace }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b7feef34afd1b77fe6606231ec29709d", "score": "0.52638304", "text": "func (n *Namespace) GetName() string {\n\treturn n.Metadata.Name\n}", "title": "" }, { "docid": "5e27e2f3297bbccac34bcda4ebfc3c77", "score": "0.5262718", "text": "func (c Config) GetNamespace(defaults ...string) string {\n\treturn configutil.CoalesceString(c.Namespace, \"\", defaults...)\n}", "title": "" }, { "docid": "4aaa04dbc15a1b161da16c6b28c300b5", "score": "0.5253381", "text": "func getNamespaces(n *jNode) namespaces {\n\tnsList := namespaces{}\n\tfor k, v := range attributesAsMap(n) {\n\t\tif strings.HasPrefix(k, \"xmlns:\") {\n\t\t\tprefix := k[6:]\n\t\t\tnsList.register(prefix, v)\n\t\t}\n\t}\n\treturn nsList\n}", "title": "" }, { "docid": "0777bfb262cc04dff899304a3689bf93", "score": "0.52518004", "text": "func (s computeForwardingRuleNamespaceLister) Get(name string) (*v1alpha1.ComputeForwardingRule, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"computeforwardingrule\"), name)\n\t}\n\treturn obj.(*v1alpha1.ComputeForwardingRule), nil\n}", "title": "" }, { "docid": "ec984b1b1f318391489b7913cac1676d", "score": "0.5250122", "text": "func GetNamespaceConfig(url string) (string, error) {\n\tconfigInter, ok := namespaceConfig.Load(url)\n\t// not exist\n\tif !ok {\n\t\treturn refreshNamespaceConfig(url)\n\t}\n\tconfig := configInter.(configStruct)\n\t// expired\n\tif config.expire.Before(time.Now()) {\n\t\treturn refreshNamespaceConfig(url)\n\t}\n\treturn config.singleConfig.(string), nil\n}", "title": "" }, { "docid": "66557b05ec8500ed4545dce959c6f1ce", "score": "0.5249571", "text": "func NewNamespace(node *Node, name string) *Namespace {\n\tns := &Namespace{\n\t\tnode: node,\n\t\tname: name,\n\t\tstatsHistory: map[string]*rrd.Bucket{},\n\t\tlatencyHistory: rrd.NewSimpleBucket(5, 3600),\n\t}\n\n\tfor _, stat := range _recordedNamespaceStats {\n\t\tns.statsHistory[stat] = rrd.NewBucket(ns.node.cluster.UpdateInterval(), 3600, true)\n\t}\n\n\treturn ns\n}", "title": "" }, { "docid": "afb23c30f2a6ae818f222db9561bae56", "score": "0.52459264", "text": "func (c *clientImpl) lookupNamespace(ns string) string {\n\tif c.isNamespaceAll {\n\t\treturn metav1.NamespaceAll\n\t}\n\treturn ns\n}", "title": "" }, { "docid": "aaf463990a7d1a8325b6e269749fc9f8", "score": "0.52348137", "text": "func (s l4RuleNamespaceLister) Get(name string) (*v1alpha2.L4Rule, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha2.Resource(\"l4rule\"), name)\n\t}\n\treturn obj.(*v1alpha2.L4Rule), nil\n}", "title": "" }, { "docid": "04632bc3a1064689dc42cb270f33c55b", "score": "0.5225839", "text": "func (o AuthBackendOutput) Namespace() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AuthBackend) pulumi.StringPtrOutput { return v.Namespace }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9580af51e0f97157e1a20b10d6f15eb7", "score": "0.52229553", "text": "func (s computeGlobalForwardingRuleNamespaceLister) Get(name string) (*v1alpha1.ComputeGlobalForwardingRule, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"computeglobalforwardingrule\"), name)\n\t}\n\treturn obj.(*v1alpha1.ComputeGlobalForwardingRule), nil\n}", "title": "" } ]
3099dac9824bbf4d5246e452aa39a286
verifies that validation method is called on body param with $ref
[ { "docid": "5fa38629d978c1cbd75afc45783263ba", "score": "0.0", "text": "func TestGenParameter_Issue1237(t *testing.T) {\n\tdefer discardOutput()()\n\n\tfixtureConfig := map[string]map[string][]string{\n\t\t\"1\": { // fixture index\n\t\t\t\"serverParameter\": { // executed template\n\t\t\t\t// expected code lines\n\t\t\t\t`var body models.Sg`,\n\t\t\t\t`if err := route.Consumer.Consume(r.Body, &body); err != nil {`,\n\t\t\t\t`if err == io.EOF {`,\n\t\t\t\t`res = append(res, errors.Required(\"body\", \"body\", \"\"))`,\n\t\t\t\t`} else {`,\n\t\t\t\t`res = append(res, errors.NewParseError(\"body\", \"body\", \"\", err))`,\n\t\t\t\t`if err := body.Validate(route.Formats); err != nil {`,\n\t\t\t},\n\t\t},\n\t}\n\tfor _, fixtureContents := range fixtureConfig {\n\t\tfixtureSpec := strings.Join([]string{\"fixture-1237\", \".json\"}, \"\")\n\t\tgen, err := opBuilder(\"add sg\", filepath.Join(\"..\", \"fixtures\", \"bugs\", \"1237\", fixtureSpec))\n\t\trequire.NoError(t, err)\n\n\t\top, err := gen.MakeOperation()\n\t\trequire.NoError(t, err)\n\n\t\topts := opts()\n\t\tfor fixtureTemplate, expectedCode := range fixtureContents {\n\t\t\tbuf := bytes.NewBuffer(nil)\n\t\t\trequire.NoErrorf(t, opts.templates.MustGet(fixtureTemplate).Execute(buf, op),\n\t\t\t\t\"expected generation to go well on %s with template %s\", fixtureSpec, fixtureTemplate)\n\n\t\t\tff, err := opts.LanguageOpts.FormatContent(\"foo.go\", buf.Bytes())\n\t\t\trequire.NoErrorf(t, err, \"expected formatting to go well on %s with template %s: %s\", fixtureSpec, fixtureTemplate, buf.String())\n\n\t\t\tres := string(ff)\n\t\t\tfor line, codeLine := range expectedCode {\n\t\t\t\tif !assertInCode(t, strings.TrimSpace(codeLine), res) {\n\t\t\t\t\tt.Logf(\"Code expected did not match for fixture %s at line %d\", fixtureSpec, line)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "c764303d6d89cd255d0083a3a97a8a92", "score": "0.5869853", "text": "func okValidation(reflect.Value, *ErrorReporter) {}", "title": "" }, { "docid": "f52608f15924d07b39f87898399192fe", "score": "0.55604434", "text": "func (o *PatchReferenceEntityCodeUnauthorizedBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "ca74618bde3e258262449023f7df3382", "score": "0.54909325", "text": "func BodyCheckWrapper(fn func(Service)) func(Service) {\n\treturn func(s Service) {\n\t\terr := s.FillBody()\n\n\t\tif err != nil {\n\t\t\ts.Tell(err.Error(), 400)\n\t\t\treturn\n\t\t}\n\n\t\tfn(s)\n\t}\n}", "title": "" }, { "docid": "53a8bf07c3c5680b098a9d31dca398b9", "score": "0.54477715", "text": "func (o *GetOKBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "68b13bfe0191d77c4185dbb74d2ed776", "score": "0.5446208", "text": "func verifyTransactionReference(apiTransactionRef, funcTransactionRef interface{}) error {\n\tif apiTransactionRef != funcTransactionRef {\n\t\treturn fmt.Errorf(\n\t\t\t\"Transaction not verified because the transaction reference doesn't match: '%s' != '%s'\",\n\t\t\tapiTransactionRef, funcTransactionRef,\n\t\t)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "289d8eec8e7d9878719653e99b5d528b", "score": "0.5380987", "text": "func validateBody(class string, context string) error {\n\t// If the given class is empty, return an error\n\tif class == \"\" {\n\t\treturn fmt.Errorf(\"the given class is empty\")\n\t}\n\n\t// If the given context is empty, return an error\n\tif context == \"\" {\n\t\treturn fmt.Errorf(\"the given context is empty\")\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "0c87c50a9cea0fd8d4d09f6182b955cc", "score": "0.53732693", "text": "func verify(p Payload, options ...Option) error {\n\n\tif err := validate(p, options...); err != nil {\n\t\treturn fmt.Errorf(\"validation error: %v\", err)\n\t}\n\n\tif ok := p.VerifySignatures(); !ok {\n\t\treturn errors.New(\"failed signature verification\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "90e7d83a08064d5ccd82bb348793a203", "score": "0.5357951", "text": "func (h *Handler) verifyBody(body map[string]interface{}, str ...string) error {\n\tfor _, s := range str {\n\t\tfmt.Println(s)\n\t\tif _, ok := body[s]; !ok {\n\t\t\treturn errors.New(\"error: missing field: \" + s)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ff2dd17ededef4e53d4a7076314bbc29", "score": "0.53537005", "text": "func validate(c *Context, targetStruct interface{}) error {\n\t// only accept pointer\n\tif reflect.TypeOf(targetStruct).Kind() != reflect.Ptr {\n\t\treturn &ErrBinding{\n\t\t\tText: \"expected pointer to target struct, got non-pointer\",\n\t\t\tStatus: http.StatusInternalServerError,\n\t\t}\n\t}\n\n\terr := c.validator.Struct(targetStruct)\n\n\tif err != nil {\n\t\tvar errFields []string\n\t\tfor _, err := range err.(validator.ValidationErrors) {\n\t\t\terrFields = append(errFields, err.Translate(c.translator))\n\t\t}\n\n\t\treturn ErrBinding{\n\t\t\tStatus: http.StatusUnprocessableEntity,\n\t\t\tText: \"validation error\",\n\t\t\tFields: errFields,\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c29a4d1b0bd93b52f015457d4621ce06", "score": "0.53462106", "text": "func (o *UpdateResourceUsageBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "cf9b9c2a49ce278ce7febd193e0d0f60", "score": "0.5334606", "text": "func (fm FieldModelStateEx) Verify() bool { return true }", "title": "" }, { "docid": "eeeeb31c08b6afffbb47986214502665", "score": "0.5319381", "text": "func (ref *Ref) Validate(serializedID []byte) error {\n\tmembership, err := ref.get()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn membership.Validate(serializedID)\n}", "title": "" }, { "docid": "4e88f533836a25f3644abca121b505c2", "score": "0.53031033", "text": "func (ep *Endpoint) validate() error {\n\tif ep.Name == \"\" {\n\t\treturn errEndpointHasNoName\n\t}\n\n\thandlerType := reflect.TypeOf(ep.Handler)\n\tif handlerType.Kind() != reflect.Func ||\n\t\thandlerType.NumIn() != 3 ||\n\t\thandlerType.NumOut() != 1 ||\n\t\thandlerType.Out(0).Name() != \"error\" {\n\t\treturn errEndpointHandlerBadSignature\n\t}\n\n\tvar ctxInterface *context.Context\n\tif !handlerType.In(0).Implements(reflect.TypeOf(ctxInterface).Elem()) {\n\t\treturn errEndpointHandlerBadArg0\n\t}\n\n\tif handlerType.In(1).Kind() != reflect.Ptr || handlerType.In(1).Elem().Kind() != reflect.Struct {\n\t\treturn errEndpointHandlerBadArg1\n\t}\n\n\tif handlerType.In(2).Kind() != reflect.Ptr || handlerType.In(2).Elem().Kind() != reflect.Struct {\n\t\treturn errEndpointHandlerBadArg2\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1e778f4b3d9fb8883a3b8e2f4b07be51", "score": "0.5264638", "text": "func (r *createRequest) Validate() *validation.Output {\n\to := &validation.Output{Valid: true}\n\n\trefID, er := common.Decrypt(r.RefID)\n\tif er != nil {\n\t\to.Failure(\"ref_id\", \"Ref id is invalid\")\n\t}\n\t// Ambil ref_type yang dipilih\n\t// ambil document_status dari purchase_invoice yang dipilih\n\tif r.RefType == \"purchase_invoice\" {\n\t\tvar pinvoice model.PurchaseInvoice\n\n\t\tquery := orm.NewOrm().QueryTable(new(model.PurchaseInvoice)).RelatedSel()\n\t\terr := query.Filter(\"id\", refID).Filter(\"is_deleted\", 0).Limit(1).One(&pinvoice)\n\t\tif err != nil {\n\t\t\to.Failure(\"ref_id\", \"Ref id for purchase invoice is not found\")\n\t\t} else {\n\t\t\t// cek document status purchase invoice == finished?\n\t\t\tif pinvoice.DocumentStatus == \"finished\" {\n\t\t\t\to.Failure(\"ref_id\", \"Purchase invoice already paid\")\n\t\t\t} else {\n\t\t\t\t// jumlahkan semua amount dari finance_expense yang memiliki referensi dari purchase invoice yang diinput\n\t\t\t\tvar sumFE float64\n\t\t\t\torm.NewOrm().Raw(\"SELECT SUM(fe.amount) AS sumFE FROM finance_expense fe WHERE fe.ref_id = ? AND fe.ref_type = ?;\", pinvoice.ID, \"purchase_invoice\").QueryRow(&sumFE)\n\t\t\t\t// cek jumlah amount diatas > total amount di purchase invoice\n\t\t\t\tif (sumFE + r.Amount) > pinvoice.TotalAmount {\n\t\t\t\t\to.Failure(\"amount\", \"You pay too much from total charge in purchase order\")\n\t\t\t\t} else {\n\t\t\t\t\t// update document status pada purchase invoice yang dipilih menjadi active\n\t\t\t\t\tpinvoice.DocumentStatus = \"active\"\n\t\t\t\t\tpinvoice.Save(\"DocumentStatus\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tvar sreturn *model.SalesReturn\n\t\tsreturn, err := salesReturn.ShowSalesReturn(\"id\", refID)\n\t\tif err != nil && sreturn == nil || sreturn.IsDeleted == int8(1) || sreturn.DocumentStatus == \"cancelled\" {\n\t\t\to.Failure(\"ref_id\", \"Ref id for sales return is not found\")\n\t\t} else {\n\t\t\t// ambil document status sales return yang dipilih\n\t\t\t// check document status == finished\n\t\t\tif sreturn.DocumentStatus == \"finished\" {\n\t\t\t\to.Failure(\"ref_id\", \"Sales return already paid\")\n\t\t\t} else {\n\t\t\t\t// jumlahkan semua amount dari expense yang memiliki referensi dari sales return yang diinputkan\n\t\t\t\tvar sumSR float64\n\t\t\t\torm.NewOrm().Raw(\"SELECT SUM(fe.amount) AS amount FROM finance_expense fe WHERE fe.ref_id = ? AND fe.ref_type = ?;\", sreturn.ID, \"sales_return\").QueryRow(&sumSR)\n\t\t\t\t// check jumlah amount diatas > total amount sales return\n\t\t\t\tif (sumSR + r.Amount) > sreturn.TotalAmount {\n\t\t\t\t\to.Failure(\"amount\", \"You pay too much from total amount in sales return\")\n\t\t\t\t} else {\n\t\t\t\t\t// update document status pada sales return yang dipilih menjadi active\n\t\t\t\t\tsreturn.DocumentStatus = \"active\"\n\t\t\t\t\tsreturn.Save(\"DocumentStatus\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif r.PaymentMethod == \"debit_card\" || r.PaymentMethod == \"credit_card\" {\n\t\tif r.BankNumber == \"\" {\n\t\t\to.Failure(\"bank_number\", \"Bank number is required\")\n\t\t}\n\t\tif r.BankName == \"\" {\n\t\t\to.Failure(\"bank_name\", \"Bank name is required\")\n\t\t}\n\t\tif r.BankHolder == \"\" {\n\t\t\to.Failure(\"bank_holder\", \"Bank holder is required\")\n\t\t}\n\t\tif r.GiroNumber != \"\" {\n\t\t\to.Failure(\"giro_number\", \"Giro number can't be inputted if payment method is debit card\")\n\t\t}\n\t} else if r.PaymentMethod == \"giro\" {\n\t\tif r.GiroNumber == \"\" {\n\t\t\to.Failure(\"giro_number\", \"Giro number is required\")\n\t\t}\n\t\tif r.BankNumber != \"\" {\n\t\t\to.Failure(\"bank_number\", \"Bank number can't be inputted if payment method is giro\")\n\t\t}\n\t\tif r.BankName != \"\" {\n\t\t\to.Failure(\"bank_name\", \"Bank name can't be inputted if payment method is giro\")\n\t\t}\n\t\tif r.BankHolder != \"\" {\n\t\t\to.Failure(\"bank_holder\", \"Bank holder can't be inputted if payment method is giro\")\n\t\t}\n\t} else {\n\t\tif r.BankNumber != \"\" {\n\t\t\to.Failure(\"bank_number\", \"Bank number can't be inputted if payment method is cash\")\n\t\t}\n\t\tif r.BankName != \"\" {\n\t\t\to.Failure(\"bank_name\", \"Bank name can't be inputted if payment method is cash\")\n\t\t}\n\t\tif r.BankHolder != \"\" {\n\t\t\to.Failure(\"bank_holder\", \"Bank holder can't be inputted if payment method is cash\")\n\t\t}\n\t\tif r.GiroNumber != \"\" {\n\t\t\to.Failure(\"giro_number\", \"Giro number can't be inputted if payment method is cash\")\n\t\t}\n\t}\n\n\treturn o\n}", "title": "" }, { "docid": "9abc0fd5049feb9d404a6ebf5416b3e2", "score": "0.52505636", "text": "func (_m *VnfdValidator) ValidateVnfdPostBody(_a0 []byte) error {\n\tret := _m.Called(_a0)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func([]byte) error); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "d83c6d3411e70dfe3ad6b7b792b34394", "score": "0.5231435", "text": "func VisitRefOfValidation(in *Validation, f Visit) error {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tif cont, err := f(in); err != nil || !cont {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "48619576b2c7d382c25b359dec3c3801", "score": "0.5229849", "text": "func (o *ValidateResourceBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "ffb1e48136e1a7d7f6b950ae0db745cb", "score": "0.5220692", "text": "func ValidateReference(ref *pb.Reference, md *desc.MessageDescriptor, t Type) error {\n\treturn VerifyEndOfPath(ref.Path, md, func(fd *desc.FieldDescriptor) error {\n\t\tu, err := FieldDescriptorTypeToSupportedType(fd.GetType())\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid field %s: %w\", fd.GetFullyQualifiedName(), err)\n\t\t}\n\n\t\tif t != u {\n\t\t\treturn fmt.Errorf(\"unexpected type at field %s: expected %s but found %s\", fd.GetFullyQualifiedName(), t, u)\n\t\t}\n\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "ecb2b5b153c2f28a85f936bb22559aa8", "score": "0.51791704", "text": "func (_m *VnfdValidator) ValidateVnfdInstanceBody(_a0 []byte) error {\n\tret := _m.Called(_a0)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func([]byte) error); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "5ef0e01cd79e8004cae2997496b2b19f", "score": "0.5155054", "text": "func validateCommitWithRef(cm *pb.GitilesCommit) error {\n\tif cm.GetRef() == \"\" {\n\t\treturn errors.Reason(`ref is required`).Err()\n\t}\n\treturn validateCommit(cm)\n}", "title": "" }, { "docid": "ca15e6f33a9166af7067652d1a530c46", "score": "0.51512796", "text": "func validate(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"validate function is not implemented\"))\n}", "title": "" }, { "docid": "93b54360d826e8786b38543cd89c319b", "score": "0.5149931", "text": "func (o *ValidateVsphereResourceBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "b1da29811c7a4cedc328726464932da0", "score": "0.51455826", "text": "func verify(class *Class) {\n\t// nothing to do\n}", "title": "" }, { "docid": "4a7785ad139997941ae97219b2693ad6", "score": "0.5142217", "text": "func (o *ModifyUserBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "cd850a5a57bcc39971af972773a71ff0", "score": "0.5127185", "text": "func (jv JsonValidator) Validate(path string, method string, body []byte) error {\r\n\tif _, isPathExist := jv.schemaDict[path]; isPathExist {\r\n\t\tif _, isMethodExist := jv.schemaDict[path][method]; isMethodExist {\r\n\t\t\treturn jv.schemaDict[path][method].validateBytes(body)\r\n\t\t} else {\r\n\t\t\treturn errors.New(\"could not validate request: unknown path \\\"\" +\r\n\t\t\t\tpath +\r\n\t\t\t\t\"\\\"\")\r\n\t\t}\r\n\t} else {\r\n\t\treturn errors.New(\"could not validate to path \" +\r\n\t\t\tpath +\r\n\t\t\t\": no schema exist for method \\\"\" +\r\n\t\t\tmethod +\r\n\t\t\t\"\\\"\")\r\n\t}\r\n}", "title": "" }, { "docid": "0f90b10f120e1ece5d1c1a33c1f9603a", "score": "0.51262957", "text": "func validateDependency(dependency interface{}) error {\n\t/*\n\t\tTODO: Add validations\n\t*/\n\treturn nil\n}", "title": "" }, { "docid": "8d80165fa0539d1727c80789d3ea48cb", "score": "0.51141346", "text": "func (nopaction) Validate() error { return nil }", "title": "" }, { "docid": "874d1b46a841780010a71e3befc5f676", "score": "0.5096687", "text": "func (m *V1URLRef) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "c553519eb9fecf175d7a6928fd65d405", "score": "0.5084838", "text": "func (c Context) Validate(dest interface{}) {\n\tif e := formChecker.Struct(dest); e != nil {\n\t\tc.log.Errorf(\"error while validating the payload :\\n%s\", e.Error())\n\t\tpanic(NewUnprocessable(AnonymousError{e.Error()}))\n\t}\n}", "title": "" }, { "docid": "d3f1d6ed3ec6dcd6081f2029a5fe2033", "score": "0.5067944", "text": "func validateRefType(s string) bool {\n\treturn (s == connutils.RefTypeAction || s == connutils.RefTypeThing || s == connutils.RefTypeKey)\n}", "title": "" }, { "docid": "26e862298fb21ce085a4e2040cd46c2c", "score": "0.50642776", "text": "func validateHandler(httpMethod string, handlerFunctionType reflect.Type) {\n\tlog.Debug(\"[validateHandler] httpMethod => '%s' | isHttpMethodBodyable => '%t' | handlerFunctionType => %s\",\n\t\thttpMethod,\n\t\tisHttpMethodBodyable(httpMethod),\n\t\thandlerFunctionType)\n\n\tif handlerFunctionType.Kind() != reflect.Func {\n\t\tpanic(\"[validateHandler] Parameter 'handlerFunctionType' is not a `func`\")\n\t}\n\tlog.Debug(\"[validateHandler] NumIn => %d | NumOut => %d\", handlerFunctionType.NumIn(), handlerFunctionType.NumOut())\n\n\tnumIn := handlerFunctionType.NumIn()\n\tif !(numIn == 1 || numIn == 2) {\n\t\tpanic(fmt.Sprintf(\"[validateHandler] Parameter 'handlerFunctionType' must have 1 or 2 input parameters but had %d parameters\", numIn))\n\t} else if isHttpMethodBodyable(httpMethod) && numIn == 1 {\n\t\tpanic(fmt.Sprintf(\"[validateHandler] Parameter 'handlerFunctionType' for '%s' HTTP method must have 2 parameters\", httpMethod))\n\t} else if !isHttpMethodBodyable(httpMethod) && numIn == 2 {\n\t\tpanic(fmt.Sprintf(\"[validateHandler] Parameter 'handlerFunctionType' for '%s' HTTP method must have 1 parameters\", httpMethod))\n\t}\n\n\tfirstParameterType := handlerFunctionType.In(0)\n\thttpType := reflect.TypeOf((**Http)(nil)).Elem()\n\tif firstParameterType != httpType {\n\t\tpanic(fmt.Sprintf(\"[validateHandler] Parameter 'handlerFunctionType' parameter n°1 type must be 'rest.Http' but was '%s'\", firstParameterType))\n\t}\n\n\tif numIn == 2 {\n\t\tsecondParameterType := handlerFunctionType.In(1)\n\t\tif secondParameterType.Kind() != reflect.Ptr {\n\t\t\tpanic(fmt.Sprintf(\"[validateHandler] Parameter 'handlerFunctionType' parameter n°2 type must be a pointer like '*%s' but was '%s'\", secondParameterType, secondParameterType))\n\t\t}\n\t}\n\n\tnumOut := handlerFunctionType.NumOut()\n\tif numOut != 1 {\n\t\tpanic(fmt.Sprintf(\"[validateHandler] Parameter 'handlerFunctionType' must have 1 output parameter but had %d parameter(s)\", numOut))\n\t}\n\treturnType := handlerFunctionType.Out(0)\n\thttpResponseType := reflect.TypeOf((*HttpResponse)(nil)).Elem()\n\tif returnType != httpResponseType {\n\t\tpanic(fmt.Sprintf(\"[validateHandler] Parameter 'handlerFunctionType' return type must be 'rest.HttpResponse' but was '%s'\", returnType))\n\t}\n}", "title": "" }, { "docid": "add9124ebcd395bdcf633ae731ec5f8a", "score": "0.505872", "text": "func (o *RepoEditPullRequestCreatedBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateAssignees(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateBody(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateClosed(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateComments(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateCreated(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateDeadline(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateDiffURL(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateHTMLURL(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateHasMerged(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateIndex(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateLabels(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateMergeBase(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateMergeable(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateMerged(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateMergedCommitID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validatePatchURL(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateTitle(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateURL(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateUpdated(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateAssignee(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateBase(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateHead(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateMergedBy(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateMilestone(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateState(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateUser(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b5ff659c969d1e141c57a290084f80e3", "score": "0.5043327", "text": "func (o *ModifyUserNotFoundBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "4c70616956d1612ed7b0a81115c119e4", "score": "0.5036897", "text": "func (o *ModifyUserOKBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "e380fbf23ea6cde0f0396ac47ed7f139", "score": "0.50162345", "text": "func (endpoint *DnsResolversInboundEndpoint) validateResourceReferences() (admission.Warnings, error) {\n\trefs, err := reflecthelpers.FindResourceReferences(&endpoint.Spec)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn genruntime.ValidateResourceReferences(refs)\n}", "title": "" }, { "docid": "c86532aeb3c7c075f3ccd9191c1a309d", "score": "0.5008413", "text": "func (o *ToggleActiveNotFoundBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "ad4c1c778f3c13ce80a0195b7c445a8c", "score": "0.49999836", "text": "func validateReq(req interface{}) error {\n\tif err := VALIDATE.Struct(req); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "56702a3bbf4d00f6fb37e7b148b22410", "score": "0.4969762", "text": "func (p *GatewayAPIProcessor) validateBackendRef(backendRef gatewayapi_v1alpha2.BackendRef, routeKind, routeNamespace string) (*Service, error) {\n\tif !(backendRef.Group == nil || *backendRef.Group == \"\") {\n\t\treturn nil, fmt.Errorf(\"Spec.Rules.BackendRef.Group must be \\\"\\\"\")\n\t}\n\n\tif !(backendRef.Kind != nil && *backendRef.Kind == \"Service\") {\n\t\treturn nil, fmt.Errorf(\"Spec.Rules.BackendRef.Kind must be 'Service'\")\n\t}\n\n\tif backendRef.Name == \"\" {\n\t\treturn nil, fmt.Errorf(\"Spec.Rules.BackendRef.Name must be specified\")\n\t}\n\n\tif backendRef.Port == nil {\n\t\treturn nil, fmt.Errorf(\"Spec.Rules.BackendRef.Port must be specified\")\n\t}\n\n\t// If the backend is in a different namespace than the route, then we need to\n\t// check for a ReferencePolicy that allows the reference.\n\tif backendRef.Namespace != nil && string(*backendRef.Namespace) != routeNamespace {\n\t\tif !p.validCrossNamespaceRef(\n\t\t\tcrossNamespaceFrom{\n\t\t\t\tgroup: string(gatewayapi_v1alpha2.GroupName),\n\t\t\t\tkind: routeKind,\n\t\t\t\tnamespace: routeNamespace,\n\t\t\t},\n\t\t\tcrossNamespaceTo{\n\t\t\t\tgroup: \"\",\n\t\t\t\tkind: \"Service\",\n\t\t\t\tnamespace: string(*backendRef.Namespace),\n\t\t\t\tname: string(backendRef.Name),\n\t\t\t},\n\t\t) {\n\t\t\treturn nil, fmt.Errorf(\"Spec.Rules.BackendRef.Namespace must match the route's namespace or be covered by a ReferencePolicy\")\n\t\t}\n\t}\n\n\tvar meta types.NamespacedName\n\tif backendRef.Namespace != nil {\n\t\tmeta = types.NamespacedName{Name: string(backendRef.Name), Namespace: string(*backendRef.Namespace)}\n\t} else {\n\t\tmeta = types.NamespacedName{Name: string(backendRef.Name), Namespace: routeNamespace}\n\t}\n\n\t// TODO: Refactor EnsureService to take an int32 so conversion to intstr is not needed.\n\tservice, err := p.dag.EnsureService(meta, intstr.FromInt(int(*backendRef.Port)), p.source, p.EnableExternalNameService)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"service %q is invalid: %s\", meta.Name, err)\n\t}\n\n\treturn service, nil\n}", "title": "" }, { "docid": "39cc0036454c3ac20ee6f1e9fea0ca7d", "score": "0.4956372", "text": "func (rc *ReplyCreate) check() error {\n\tif _, ok := rc.mutation.UserID(); !ok {\n\t\treturn &ValidationError{Name: \"user_id\", err: errors.New(`ent: missing required field \"Reply.user_id\"`)}\n\t}\n\tif v, ok := rc.mutation.UserID(); ok {\n\t\tif err := reply.UserIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"user_id\", err: fmt.Errorf(`ent: validator failed for field \"Reply.user_id\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.CommentID(); ok {\n\t\tif err := reply.CommentIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"comment_id\", err: fmt.Errorf(`ent: validator failed for field \"Reply.comment_id\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.ParentID(); ok {\n\t\tif err := reply.ParentIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"parent_id\", err: fmt.Errorf(`ent: validator failed for field \"Reply.parent_id\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := rc.mutation.Content(); !ok {\n\t\treturn &ValidationError{Name: \"content\", err: errors.New(`ent: missing required field \"Reply.content\"`)}\n\t}\n\tif v, ok := rc.mutation.Content(); ok {\n\t\tif err := reply.ContentValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"content\", err: fmt.Errorf(`ent: validator failed for field \"Reply.content\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := rc.mutation.Status(); !ok {\n\t\treturn &ValidationError{Name: \"status\", err: errors.New(`ent: missing required field \"Reply.status\"`)}\n\t}\n\tif v, ok := rc.mutation.Status(); ok {\n\t\tif err := reply.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(`ent: validator failed for field \"Reply.status\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := rc.mutation.Floor(); !ok {\n\t\treturn &ValidationError{Name: \"floor\", err: errors.New(`ent: missing required field \"Reply.floor\"`)}\n\t}\n\tif v, ok := rc.mutation.Floor(); ok {\n\t\tif err := reply.FloorValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"floor\", err: fmt.Errorf(`ent: validator failed for field \"Reply.floor\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := rc.mutation.CreateAt(); !ok {\n\t\treturn &ValidationError{Name: \"create_at\", err: errors.New(`ent: missing required field \"Reply.create_at\"`)}\n\t}\n\tif v, ok := rc.mutation.CreateAt(); ok {\n\t\tif err := reply.CreateAtValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"create_at\", err: fmt.Errorf(`ent: validator failed for field \"Reply.create_at\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.ID(); ok {\n\t\tif err := reply.IDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"id\", err: fmt.Errorf(`ent: validator failed for field \"Reply.id\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7624b040760f3a3f21ab48b01b9d31b5", "score": "0.49555075", "text": "func (db *MockDB) ReferenceValidator(formatName string) Validate {\n\treturn func(ctx context.Context, value interface{}) string {\n\t\tstringValue := fmt.Sprintf(\"%v\", value)\n\t\t_, err := db.GetRecord(ctx, formatName, stringValue)\n\t\tif err != nil {\n\t\t\treturn err.Error()\n\t\t}\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "c9e51c9cbbc36ce061c381a439ee1df7", "score": "0.49419492", "text": "func (o *SyncHookBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateFinalizing(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateParent(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f9e52428a16066f66875924dc2dbcc09", "score": "0.49304485", "text": "func (o *PatchReferenceEntityCodeUnprocessableEntityBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "ae2f3c3ef7cbb3c09d8c67bdec7ca359", "score": "0.49253955", "text": "func (whsvr *WebhookServer) validateRequest(w http.ResponseWriter, r *http.Request) {\n\tglog.Infof(\"Entering validateRequest()\")\n\tvar body []byte\n\tif r.Body != nil {\n\t\tif data, err := ioutil.ReadAll(r.Body); err == nil {\n\t\t\tbody = data\n\t\t}\n\t}\n\tif len(body) == 0 {\n\t\tglog.Error(\"empty body\")\n\t\thttp.Error(w, \"empty body\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// verify the content type is accurate\n\tcontentType := r.Header.Get(\"Content-Type\")\n\tif contentType != \"application/json\" {\n\t\tglog.Errorf(\"Content-Type=%s, expect application/json\", contentType)\n\t\thttp.Error(w, \"invalid Content-Type, expect `application/json`\", http.StatusUnsupportedMediaType)\n\t\treturn\n\t}\n\n\tvar admissionResponse *v1beta1.AdmissionResponse\n\tar := v1beta1.AdmissionReview{}\n\tif _, _, err := deserializer.Decode(body, nil, &ar); err != nil {\n\t\tglog.Errorf(\"Can't decode body: %v\", err)\n\t\tadmissionResponse = &v1beta1.AdmissionResponse{\n\t\t\tResult: &metav1.Status{\n\t\t\t\tMessage: err.Error(),\n\t\t\t},\n\t\t}\n\t} else {\n\t\tadmissionResponse = whsvr.validate(&ar)\n\t}\n\n\tadmissionReview := v1beta1.AdmissionReview{}\n\tif admissionResponse != nil {\n\t\tadmissionReview.Response = admissionResponse\n\t\tif ar.Request != nil {\n\t\t\tadmissionReview.Response.UID = ar.Request.UID\n\t\t}\n\t}\n\n\tresp, err := json.Marshal(admissionReview)\n\n\tif err != nil {\n\t\tglog.Errorf(\"Can't encode response: %v\", err)\n\t\thttp.Error(w, fmt.Sprintf(\"could not encode response: %v\", err), http.StatusInternalServerError)\n\t}\n\tglog.Infof(\"Ready to write reponse ...\")\n\tif _, err := w.Write(resp); err != nil {\n\t\tglog.Errorf(\"Can't write response: %v\", err)\n\t\thttp.Error(w, fmt.Sprintf(\"could not write response: %v\", err), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "b2ff8ebbaa0a83544f4559bb359bd43e", "score": "0.49201074", "text": "func validateIdentityRef(identityRef *corev1.ObjectReference, fldPath *field.Path) *field.Error {\n\tif identityRef == nil {\n\t\treturn field.Required(fldPath, \"identityRef is required\")\n\t}\n\tif identityRef.Kind != \"AzureClusterIdentity\" {\n\t\treturn field.NotSupported(fldPath.Child(\"name\"), identityRef.Name, []string{\"AzureClusterIdentity\"})\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4d457a662ceee140e94b1888dba53d77", "score": "0.4900939", "text": "func (todo *Todo) Validate(v *revel.Validation) {\n v.Required(todo.Name).Message(\"A ToDo has to have a name!\")\n}", "title": "" }, { "docid": "e82eaef763e342e4c1c3e77b30f0f6ac", "score": "0.48899657", "text": "func (o *ToggleActiveBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "1ced495c72be8ee152ce02819b579ab5", "score": "0.48898324", "text": "func (o *PostLinkMethodNotAllowedBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// validation for a type composition with models.Error405Data\n\tif err := o.Error405Data.Validate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "537f5c0b77d436758c93962a932d182d", "score": "0.4887062", "text": "func (o *AddProxySQLServiceBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "9cc4c828ee8a5cdfd05f7ce5df31cc3f", "score": "0.48847002", "text": "func (none) Verify(_, _ []byte) error { return nil }", "title": "" }, { "docid": "38b415d5a1bc1371c5f60295fb24669c", "score": "0.48846743", "text": "func (o *DelUserNotFoundBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "b843d1aed2fce27790bc97faf080f9fc", "score": "0.48759663", "text": "func (c *Context) Validate(obj any) error {\n\treturn binding.Validate(obj)\n}", "title": "" }, { "docid": "25cf7c911b0b091eb0382121cefbb0ad", "score": "0.48656166", "text": "func (o *ModifyUserUnauthorizedBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "9375b733c340c713b0946526597467c1", "score": "0.48641", "text": "func (fd *FunctionDefinition) VerifyArguments(data json.RawMessage) (err error) {\n\t// fd.Parameters and data may be either JSON or Yaml structured, convert to JSON structured uniformly.\n\tif fd.Parameters, err = strutil.YamlOrJsonToJson(fd.Parameters); err != nil {\n\t\treturn errors.Wrap(err, \"failed to unmarshal Parameters to JSON\")\n\t}\n\tif data, err = strutil.YamlOrJsonToJson(data); err != nil {\n\t\treturn errors.Wrap(err, \"failed to unmarshal to JSON\")\n\t}\n\tif valid := json.Valid(data); !valid {\n\t\treturn errors.New(\"data is invalid JSON\")\n\t}\n\tls := gojsonschema.NewBytesLoader(fd.Parameters)\n\tld := gojsonschema.NewBytesLoader(data)\n\tresult, err := gojsonschema.Validate(ls, ld)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to Validate\")\n\t}\n\tif result.Valid() {\n\t\treturn nil\n\t}\n\tvar ss []string\n\tfor _, item := range result.Errors() {\n\t\tss = append(ss, item.String())\n\t}\n\treturn errors.New(strings.Join(ss, \"; \"))\n}", "title": "" }, { "docid": "be223fcd67a8e067210757817f81e5df", "score": "0.4854283", "text": "func (o *RepoCreatePullRequestCreatedBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateAssignees(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateBody(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateClosed(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateComments(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateCreated(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateDeadline(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateDiffURL(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateHTMLURL(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateHasMerged(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateIndex(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateLabels(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateMergeBase(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateMergeable(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateMerged(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateMergedCommitID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validatePatchURL(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateTitle(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateURL(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateUpdated(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateAssignee(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateBase(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateHead(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateMergedBy(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateMilestone(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateState(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateUser(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8096727a520dd8f6fdffef44e1617ef9", "score": "0.48535782", "text": "func (rq *RobotReq) Valid(v *validation.Validation) {\n\t// ToDo: add validation for access info.\n}", "title": "" }, { "docid": "a707b11bf6ae80464aafc08e640bbeb6", "score": "0.4847522", "text": "func (o *GetSyncingOKBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "0b4f175d52dfaf539bdb74ef587a00b3", "score": "0.48373055", "text": "func (o *GetSearchOKBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "488d5578d58fab14db427219a37496d0", "score": "0.48343626", "text": "func (b Blank) validAsSubject() {}", "title": "" }, { "docid": "0b4e6a01d25789031b0ffdecb1adbd77", "score": "0.4828097", "text": "func (m *TestPointReference) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "1e027cb599225814cf7bdc666f96d2dd", "score": "0.48254603", "text": "func (d *API) validate() error {\n\tvar consumes []string\n\tfor k := range d.consumers {\n\t\tconsumes = append(consumes, k)\n\t}\n\n\tvar produces []string\n\tfor k := range d.producers {\n\t\tproduces = append(produces, k)\n\t}\n\n\tvar authenticators []string\n\tfor k := range d.authenticators {\n\t\tauthenticators = append(authenticators, k)\n\t}\n\n\tvar operations []string\n\tfor m, v := range d.operations {\n\t\tfor p := range v {\n\t\t\toperations = append(operations, fmt.Sprintf(\"%s %s\", strings.ToUpper(m), p))\n\t\t}\n\t}\n\n\tvar definedAuths []string\n\tfor k := range d.spec.Spec().SecurityDefinitions {\n\t\tdefinedAuths = append(definedAuths, k)\n\t}\n\n\tif err := d.verify(\"consumes\", consumes, d.analyzer.RequiredConsumes()); err != nil {\n\t\treturn err\n\t}\n\tif err := d.verify(\"produces\", produces, d.analyzer.RequiredProduces()); err != nil {\n\t\treturn err\n\t}\n\tif err := d.verify(\"operation\", operations, d.analyzer.OperationMethodPaths()); err != nil {\n\t\treturn err\n\t}\n\n\trequiredAuths := d.analyzer.RequiredSecuritySchemes()\n\tif err := d.verify(\"auth scheme\", authenticators, requiredAuths); err != nil {\n\t\treturn err\n\t}\n\tif err := d.verify(\"security definitions\", definedAuths, requiredAuths); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d04e548b47d1984d4b3356b92423597e", "score": "0.48116806", "text": "func ValidateStoredUserRequestBody(body *StoredUserRequestBody) (err error) {\n\tif body.Email == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"email\", \"body\"))\n\t}\n\tif body.Firstname == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"firstname\", \"body\"))\n\t}\n\tif body.Lastname == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"lastname\", \"body\"))\n\t}\n\tif body.Role == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"role\", \"body\"))\n\t}\n\tif body.Email != nil {\n\t\terr = goa.MergeErrors(err, goa.ValidatePattern(\"body.email\", *body.Email, \".+@.+\\\\..{1,6}\"))\n\t}\n\tif body.Firstname != nil {\n\t\tif utf8.RuneCountInString(*body.Firstname) > 100 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(\"body.firstname\", *body.Firstname, utf8.RuneCountInString(*body.Firstname), 100, false))\n\t\t}\n\t}\n\tif body.Lastname != nil {\n\t\tif utf8.RuneCountInString(*body.Lastname) > 100 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(\"body.lastname\", *body.Lastname, utf8.RuneCountInString(*body.Lastname), 100, false))\n\t\t}\n\t}\n\tif body.Role != nil {\n\t\terr = goa.MergeErrors(err, goa.ValidatePattern(\"body.role\", *body.Role, \"[a-z]+[a-z0-9]*\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "1efaad9e747da2dd1d2978dd408b2c41", "score": "0.48084667", "text": "func verifyMethodCall(method dbusutil.CalledMethod, expectedMethod expectedMethodCall) error {\n\tif method.MethodName != expectedMethod.methodName {\n\t\treturn errors.Errorf(\"missing method call: %s\", expectedMethod.methodName)\n\t}\n\n\tif len(method.Arguments) != len(expectedMethod.verifierFuncs) {\n\t\treturn errors.Errorf(\"number of argumentVerifiers(%d)) not equal to number of arguments(%d)\", len(expectedMethod.verifierFuncs), len(method.Arguments))\n\t}\n\tfor i, argument := range method.Arguments {\n\t\tif expectedMethod.verifierFuncs[i] != nil {\n\t\t\tif err := expectedMethod.verifierFuncs[i](argument); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"failed to validate arguments for method %s\", method.MethodName)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9e05bd4034281f3f7f3b29b2aa17d4e6", "score": "0.47953868", "text": "func Validate(payload interface{}) *fiber.Error {\n\terr := validate.Struct(payload)\n\n\tif err != nil {\n\t\tvar errors []string\n\t\tfor _, err := range err.(validator.ValidationErrors) {\n\t\t\terrors = append(\n\t\t\t\terrors,\n\t\t\t\tfmt.Sprintf(\"`%v` with value `%v` doesn't satisfy the `%v` constraint\", strings.ToLower(err.Field()), err.Value(), err.Tag()),\n\t\t\t)\n\t\t}\n\n\t\treturn &fiber.Error{\n\t\t\tCode: fiber.StatusBadRequest,\n\t\t\tMessage: strings.Join(errors, \",\"),\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ae91d8e92ea521b195058728264d6e45", "score": "0.47908816", "text": "func (o *ValidateResourceOKBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "268f933e900804e9c19f6a6c5834e2dc", "score": "0.4780963", "text": "func ValidateStoredTaskRequestBody(body *StoredTaskRequestBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Title == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"title\", \"body\"))\n\t}\n\tif body.Description == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"description\", \"body\"))\n\t}\n\tif body.CreatedDate == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"created_date\", \"body\"))\n\t}\n\tif body.Status == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"status\", \"body\"))\n\t}\n\tif body.Owner == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"owner\", \"body\"))\n\t}\n\tif body.UpdatedDate == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"updated_date\", \"body\"))\n\t}\n\tif body.Title != nil {\n\t\tif utf8.RuneCountInString(*body.Title) > 200 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(\"body.title\", *body.Title, utf8.RuneCountInString(*body.Title), 200, false))\n\t\t}\n\t}\n\tif body.Description != nil {\n\t\tif utf8.RuneCountInString(*body.Description) > 5000 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(\"body.description\", *body.Description, utf8.RuneCountInString(*body.Description), 5000, false))\n\t\t}\n\t}\n\tif body.CreatedDate != nil {\n\t\terr = goa.MergeErrors(err, goa.ValidateFormat(\"body.created_date\", *body.CreatedDate, goa.FormatDateTime))\n\t}\n\tif body.UpdatedDate != nil {\n\t\terr = goa.MergeErrors(err, goa.ValidateFormat(\"body.updated_date\", *body.UpdatedDate, goa.FormatDateTime))\n\t}\n\tif body.DueDate != nil {\n\t\terr = goa.MergeErrors(err, goa.ValidateFormat(\"body.due_date\", *body.DueDate, goa.FormatDateTime))\n\t}\n\tif body.Status != nil {\n\t\tif !(*body.Status == \"Open\" || *body.Status == \"Closed\" || *body.Status == \"Pending\") {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidEnumValueError(\"body.status\", *body.Status, []interface{}{\"Open\", \"Closed\", \"Pending\"}))\n\t\t}\n\t}\n\tif body.Owner != nil {\n\t\tif err2 := ValidateStoredUserRequestBody(body.Owner); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tif body.Assignee != nil {\n\t\tif err2 := ValidateStoredUserRequestBody(body.Assignee); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "c1b1e9abd9bec02bc776e6df6ed1a034", "score": "0.47725603", "text": "func (o *GetIPAMSuggestIPOKBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "d9d993f463a2c97e730507891508f609", "score": "0.47685844", "text": "func (b Blueprint) finalValidate() error {\n\treturn nil\n}", "title": "" }, { "docid": "86bab2c5739ba3b8981ac1a42ee610be", "score": "0.47672972", "text": "func (o *SeveralChannelsPatchUnauthorizedBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "75e1bafd1e051fcdab05789791ec3032", "score": "0.47659022", "text": "func (o *GetFamiliesCodeUnauthorizedBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "a73874ed86694fd52573aa6914b2cb79", "score": "0.47639173", "text": "func validatePathParameter(field *surface_v1.Field, types []*surface_v1.Type) (*surface_v1.Field, error) {\n\n\tif field.Kind != surface_v1.FieldKind_SCALAR {\n\t\tif field.Kind == surface_v1.FieldKind_REFERENCE {\n\t\t\t// We got a reference. Let's try to flatten!\n\t\t\tfield, err := flattenPathParameter(field, types)\n\t\t\tif err == nil {\n\t\t\t\treturn field, nil\n\t\t\t}\n\t\t}\n\t\treturn nil, errors.New(\"The path parameter with the Name \" + field.Name + \" is invalid. \" +\n\t\t\t\"The path template may refer to one or more fields in the gRPC request message, as\" +\n\t\t\t\" long as each field is a non-repeated field with a primitive (non-message) type\")\n\t}\n\n\treturn field, nil\n}", "title": "" }, { "docid": "e0c50192b505d0d685fa5fc0ffce1f95", "score": "0.4761145", "text": "func (p *MockProtocol) Validate(_ context.Context, act action.Action) error {\n\treturn nil\n}", "title": "" }, { "docid": "dde2d913429ca32f31ef6a5c041a5e20", "score": "0.4742591", "text": "func (fm *FieldModelChar) Verify() bool { return true }", "title": "" }, { "docid": "f4cd1d86469581d88de42ecce210729e", "score": "0.47401428", "text": "func (g GHTTPWithGomega) VerifyBody(expectedBody []byte) http.HandlerFunc {\n\treturn CombineHandlers(\n\t\tfunc(w http.ResponseWriter, req *http.Request) {\n\t\t\tbody, err := gutil.ReadAll(req.Body)\n\t\t\treq.Body.Close()\n\t\t\tg.gomega.Expect(err).ShouldNot(HaveOccurred())\n\t\t\tg.gomega.Expect(body).Should(Equal(expectedBody), \"Body Mismatch\")\n\t\t},\n\t)\n}", "title": "" }, { "docid": "b1a8e68d4236991bea31ae22490435b5", "score": "0.47350356", "text": "func (o *CreateRelationTupleBadRequestBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "cbe161b8970996642d5eb8977cb67784", "score": "0.47308886", "text": "func (rule *ServersOutboundFirewallRule) validateResourceReferences() (admission.Warnings, error) {\n\trefs, err := reflecthelpers.FindResourceReferences(&rule.Spec)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn genruntime.ValidateResourceReferences(refs)\n}", "title": "" }, { "docid": "78158827ca3ddb3635930ca8b893c542", "score": "0.4729094", "text": "func (whsvr *WebhookServer) validate(ar *v1beta1.AdmissionReview) *v1beta1.AdmissionResponse {\n\treq := ar.Request\n\tvar (\n\t\tavailableLabels map[string]string\n\t\tobjectMeta *metav1.ObjectMeta\n\t\tresourceNamespace, resourceName string\n\t)\n\n\tklog.Infof(\"AdmissionReview for Kind=%v, Namespace=%v Name=%v (%v) UID=%v patchOperation=%v UserInfo=%v\",\n\t\treq.Kind, req.Namespace, req.Name, resourceName, req.UID, req.Operation, req.UserInfo)\n\n\tswitch req.Kind.Kind {\n\tcase \"Pod\":\n\t\tvar pod corev1.Pod\n\t\tif err := json.Unmarshal(req.Object.Raw, &pod); err != nil {\n\t\t\tklog.Errorf(\"Could not unmarshal raw object: %v\", err)\n\t\t\treturn &v1beta1.AdmissionResponse{\n\t\t\t\tResult: &metav1.Status{\n\t\t\t\t\tMessage: err.Error(),\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t\tresourceName, resourceNamespace, objectMeta = pod.Name, pod.Namespace, &pod.ObjectMeta\n\t\tavailableLabels = pod.Labels\n\n\t}\n\n\tif !validationRequired(ignoredNamespaces, objectMeta) {\n\t\tklog.Infof(\"Skipping validation for %s/%s due to policy check\", resourceNamespace, resourceName)\n\t\treturn &v1beta1.AdmissionResponse{\n\t\t\tAllowed: true,\n\t\t}\n\t}\n\n\tallowed := true\n\tvar result *metav1.Status\n\tklog.Info(\"available labels:\", availableLabels)\n\n\treturn &v1beta1.AdmissionResponse{\n\t\tAllowed: allowed,\n\t\tResult: result,\n\t}\n}", "title": "" }, { "docid": "9860d898f155b672f82cebc661ad3641", "score": "0.47285885", "text": "func (endpoint *DnsResolversInboundEndpoint) updateValidations() []func(old runtime.Object) (admission.Warnings, error) {\n\treturn []func(old runtime.Object) (admission.Warnings, error){\n\t\tfunc(old runtime.Object) (admission.Warnings, error) {\n\t\t\treturn endpoint.validateResourceReferences()\n\t\t},\n\t\tendpoint.validateWriteOnceProperties}\n}", "title": "" }, { "docid": "76d790710da0bbbd295e448c843a107b", "score": "0.4726665", "text": "func (o *PostWebhookNotifyBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateTriggeredAt(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bdec3c493aa0e76d8c2eee7ab803ffc3", "score": "0.47245657", "text": "func (o *CreateRelationTupleInternalServerErrorBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "8cdff436caadcb672712634e8366a7b9", "score": "0.47206232", "text": "func validateContainerRef(containerRef *storage.Container) error {\n\tif containerRef.Name == \"\" {\n\t\terMsg := \"Error while getting container reference for container \"\n\t\tlog.Println(erMsg)\n\t\ter := errors.New(erMsg)\n\t\treturn er\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6283c4a8f474474fddb2028a5f7113ea", "score": "0.47196293", "text": "func (o *UpdateBillingDateBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "7c986bf0bccc0fd8740e608a03815dfe", "score": "0.47156116", "text": "func (ref *Ref) Verify(serializedID []byte, msg []byte, sig []byte) error {\n\tmembership, err := ref.get()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn membership.Verify(serializedID, msg, sig)\n}", "title": "" }, { "docid": "aa2eae1d81695869a82a40835cacd005", "score": "0.4714592", "text": "func validateRequest(c *fiber.Ctx) (bool, error) {\n\n\t// Check for existence of 'signature' query param in request\n\tsignature := c.Query(cfg.SignatureQueryKey)\n\tif signature == \"\" {\n\t\treturn false, fmt.Errorf(\"%s is a required query param for a signed URL route\", cfg.SignatureQueryKey)\n\t}\n\n\t// Check for existence of 'expires' query param in request and determine if\n\t// url has passed expiration\n\texpires := c.Query(cfg.ExpiresQueryKey)\n\tif expires != \"\" {\n\t\ti, err := strconv.ParseInt(expires, 10, 64)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"%s value must be valid integer\", cfg.ExpiresQueryKey)\n\t\t}\n\t\twhen := time.Unix(i, 0)\n\t\tif when.Before(time.Now()) {\n\t\t\treturn false, errors.New(\"url signature has expired\")\n\t\t}\n\t}\n\n\tmethod := c.Method()\n\tbaseURL := c.BaseURL()\n\toriginalURL := c.OriginalURL()\n\tbody := c.Body()\n\n\t// Get hashed signture from context\n\thashedSignature, _ := getSignature(method, baseURL, originalURL, body)\n\n\t// Compare signature given with calculated value\n\tif hashedSignature != signature {\n\t\treturn false, errors.New(\"invalid signature\")\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "9ec128e2fd7771b1cc6f818bd3c6f2a4", "score": "0.4713985", "text": "func (o *DelUserBadRequestBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "26a2134129834cd386655a3e3d9770bf", "score": "0.47134757", "text": "func (fm *FieldModelOrderType) Verify() bool { return true }", "title": "" }, { "docid": "0c66f3bba059d5e1610ed94168a3ab69", "score": "0.4711656", "text": "func (b *Binding) Validate(value interface{}) error {\n\treturn b.vd.Validate(value)\n}", "title": "" }, { "docid": "fa2995dcfeb8a96801aebda5b8c2967c", "score": "0.4710756", "text": "func (v *validatorImpl) Verify() error {\n\tif v.err != nil {\n\t\treturn v.err\n\t}\n\tifv := reflect.ValueOf(v.config)\n\treturn verifyRec(ifv)\n}", "title": "" }, { "docid": "6498ddeeaa8ce017fc81a442063f8138", "score": "0.47065032", "text": "func (sch *Schema) verify(desc ast.TypeDescriptor) {\n\tswitch t := desc.(type) {\n\tcase *ast.BaseType:\n\t\tname := t.Name()\n\t\tif _, ok := sch.types[name]; !ok {\n\t\t\tlog.Panicf(\"Type '%s' not found in schema\", name)\n\t\t}\n\n\tcase *ast.ListType:\n\t\tsch.verify(t.OfType)\n\n\tcase *ast.InputObjectType:\n\t\tfor _, sub := range t.Fields {\n\t\t\tsch.verify(sub)\n\t\t}\n\tdefault:\n\t\tpanic(\"verify called on invalid type\")\n\t}\n\n}", "title": "" }, { "docid": "5c245a8769fb2f4766076c9cc02dc2ec", "score": "0.47052783", "text": "func (m UpdateLinkRequest) Validate() error {\n\treturn validation.ValidateStruct(&m) //validation.Field(&m.Name, validation.Required, validation.Length(0, 128)),\n\n}", "title": "" }, { "docid": "80bc3c443267b89498e591dec186d768", "score": "0.47036764", "text": "func ReferralCodeVerify(c *gin.Context) (*ReferralVerify, error) {\n\tvar r ReferralVerify\n\tif err := c.ShouldBindJSON(&r); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &r, nil\n}", "title": "" }, { "docid": "15492477d748a42c7a9c77375d0f6b4c", "score": "0.47034", "text": "func validateLeafRef(schema *yang.Entry, value interface{}) (errors []error) {\n\tdbgPrint(\"validateLeafRef %s\\n\", schema.Name)\n\trefSchema, err := findLeafRefSchema(schema, schema.Type.Path)\n\tif err == nil {\n\t\treturn validateLeaf(refSchema, value)\n\t}\n\treturn appendErr(errors, err)\n}", "title": "" }, { "docid": "5be3bb741aac65a549cb998e61697908", "score": "0.47004515", "text": "func (m *ProductReferenceRequestDTO) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "ff8f6065f1fa13516b9547ccff6dcaf5", "score": "0.46979117", "text": "func TestRelatedRemittanceLocationMethodValid(t *testing.T) {\n\trr := mockRelatedRemittance()\n\trr.RemittanceLocationMethod = \"BBRB\"\n\n\terr := rr.Validate()\n\n\trequire.EqualError(t, err, fieldError(\"RemittanceLocationMethod\", ErrRemittanceLocationMethod, rr.RemittanceLocationMethod).Error())\n}", "title": "" }, { "docid": "85375e6a194242c7ebdc3e95a868dd05", "score": "0.46963456", "text": "func validateObject(object interface{}) error {\n\t/*\n\t\tTODO: Validate if fields are exported to deliver a more specific error message\n\t\tTODO: Validate if more than one dependency can be injected into one field\n\t*/\n\treturn nil\n}", "title": "" }, { "docid": "6c61ac086dc45eab79459b2106debd2d", "score": "0.4692334", "text": "func (o *PostLinkOKBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// validation for a type composition with models.SuccessData\n\tif err := o.SuccessData.Validate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateData(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5fbb964cd95ec4dec889086c385dc756", "score": "0.46864995", "text": "func (fn mtoAgentValidatorFunc) Validate(appCtx appcontext.AppContext, newer models.MTOAgent, older *models.MTOAgent, ship *models.MTOShipment) error {\n\treturn fn(appCtx, newer, older, ship)\n}", "title": "" }, { "docid": "a4bbdd0c091ff50765f87666e4eeb0eb", "score": "0.46816328", "text": "func (o *EventViewMethodNotAllowedBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// validation for a type composition with models.Error405Data\n\tif err := o.Error405Data.Validate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9a377d418402f8c044f37b3af15cdc27", "score": "0.46807155", "text": "func (r *updateRequest) Validate() *validation.Output {\n\to := &validation.Output{Valid: true}\n\n\tif r.FinanceExpense.DocumentStatus == \"cleared\" {\n\t\to.Failure(\"document_status\", \"Finance expense document status already cleared\")\n\t}\n\n\t// Ambil ref_type yang dipilih\n\t// ambil document_status dari purchase_invoice yang dipilih\n\tif r.FinanceExpense.RefType == \"purchase_invoice\" {\n\t\tvar pinvoice model.PurchaseInvoice\n\n\t\tquery := orm.NewOrm().QueryTable(new(model.PurchaseInvoice)).RelatedSel()\n\t\terr := query.Filter(\"id\", r.FinanceExpense.RefID).Filter(\"is_deleted\", 0).Limit(1).One(&pinvoice)\n\t\tif err != nil {\n\t\t\to.Failure(\"ref_id\", \"Ref id for purchase invoice is not found\")\n\t\t} else {\n\t\t\t// cek document status purchase invoice == finished?\n\t\t\tif pinvoice.DocumentStatus == \"finished\" {\n\t\t\t\to.Failure(\"ref_id\", \"Purchase invoice already paid\")\n\t\t\t} else {\n\t\t\t\t// jumlahkan semua amount dari finance_expense yang memiliki referensi dari purchase invoice yang diinput\n\t\t\t\tvar sumFE float64\n\t\t\t\torm.NewOrm().Raw(\"SELECT SUM(fe.amount) AS sumFE FROM finance_expense fe WHERE fe.ID !=? fe.ref_id = ? AND fe.ref_type = ?;\", r.FinanceExpense.ID, pinvoice.ID, \"purchase_invoice\").QueryRow(&sumFE)\n\t\t\t\t// cek jumlah amount diatas > total amount di purchase invoice\n\t\t\t\tif (sumFE + r.Amount) > pinvoice.TotalAmount {\n\t\t\t\t\to.Failure(\"ref_id\", \"You pay too much from total charge in purchase order\")\n\t\t\t\t} else {\n\t\t\t\t\t// update document status pada purchase invoice yang dipilih menjadi active\n\t\t\t\t\tpinvoice.DocumentStatus = \"active\"\n\t\t\t\t\tpinvoice.Save(\"DocumentStatus\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tvar sreturn *model.SalesReturn\n\t\tsreturn, err := salesReturn.ShowSalesReturn(\"id\", r.FinanceExpense.RefID)\n\t\tif err != nil || sreturn.IsDeleted == int8(1) || sreturn.DocumentStatus == \"cancelled\" {\n\t\t\to.Failure(\"ref_id\", \"Ref id for sales return is not found\")\n\t\t} else {\n\t\t\t// ambil document status sales return yang dipilih\n\t\t\t// check document status == finished\n\t\t\tif sreturn.DocumentStatus == \"finished\" {\n\t\t\t\to.Failure(\"ref_id\", \"Sales return already paid\")\n\t\t\t} else {\n\t\t\t\t// jumlahkan semua amount dari expense yang memiliki referensi dari sales return yang diinputkan\n\t\t\t\tvar sumSR float64\n\t\t\t\torm.NewOrm().Raw(\"SELECT SUM(fe.amount) AS amount FROM finance_expense fe WHERE fe.ID != ? fe.ref_id = ? AND fe.ref_type = ?;\", r.FinanceExpense.ID, sreturn.ID, \"sales_return\").QueryRow(&sumSR)\n\t\t\t\t// check jumlah amount diatas > total amount sales return\n\t\t\t\tif (sumSR + r.Amount) > sreturn.TotalAmount {\n\t\t\t\t\to.Failure(\"ref_id\", \"You pay too much from total amount in sales return\")\n\t\t\t\t} else {\n\t\t\t\t\t// update document status pada sales return yang dipilih menjadi active\n\t\t\t\t\tsreturn.DocumentStatus = \"active\"\n\t\t\t\t\tsreturn.Save(\"DocumentStatus\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif r.PaymentMethod == \"debit_card\" || r.PaymentMethod == \"credit_card\" {\n\t\tif r.BankNumber == \"\" {\n\t\t\to.Failure(\"bank_number\", \"Bank number is required\")\n\t\t}\n\t\tif r.BankName == \"\" {\n\t\t\to.Failure(\"bank_name\", \"Bank name is required\")\n\t\t}\n\t\tif r.BankHolder == \"\" {\n\t\t\to.Failure(\"bank_holder\", \"Bank holder is required\")\n\t\t}\n\t\tif r.GiroNumber != \"\" {\n\t\t\to.Failure(\"giro_number\", \"Giro number can't be inputted if payment method is debit card\")\n\t\t}\n\t} else if r.PaymentMethod == \"giro\" {\n\t\tif r.GiroNumber == \"\" {\n\t\t\to.Failure(\"giro_number\", \"Giro number is required\")\n\t\t}\n\t\tif r.BankNumber != \"\" {\n\t\t\to.Failure(\"bank_number\", \"Bank number can't be inputted if payment method is giro\")\n\t\t}\n\t\tif r.BankName != \"\" {\n\t\t\to.Failure(\"bank_name\", \"Bank name can't be inputted if payment method is giro\")\n\t\t}\n\t\tif r.BankHolder != \"\" {\n\t\t\to.Failure(\"bank_holder\", \"Bank holder can't be inputted if payment method is giro\")\n\t\t}\n\t} else {\n\t\tif r.BankNumber != \"\" {\n\t\t\to.Failure(\"bank_number\", \"Bank number can't be inputted if payment method is cash\")\n\t\t}\n\t\tif r.BankName != \"\" {\n\t\t\to.Failure(\"bank_name\", \"Bank name can't be inputted if payment method is cash\")\n\t\t}\n\t\tif r.BankHolder != \"\" {\n\t\t\to.Failure(\"bank_holder\", \"Bank holder can't be inputted if payment method is cash\")\n\t\t}\n\t\tif r.GiroNumber != \"\" {\n\t\t\to.Failure(\"giro_number\", \"Giro number can't be inputted if payment method is cash\")\n\t\t}\n\t}\n\n\treturn o\n}", "title": "" }, { "docid": "9fc3ce999a984eb7bce2c6f0f0b9c2c7", "score": "0.46788615", "text": "func (o *ToggleActiveOKBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "93b25ee211d4201d14c87e63f431e180", "score": "0.4677983", "text": "func (o *PostWebhookNotifyOKBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateTriggeredAt(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9fd5ebc7bce3e45e4942d795bb35fc80", "score": "0.46748266", "text": "func verifyBodyContent(reader io.Reader, body interface{}) error {\n\n\tb, err := ioutil.ReadAll(reader)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(string(b))\n\n\treturn nil\n\n}", "title": "" } ]
98b39b73baff6fb1ce769ce29810aaaf
create an empty file
[ { "docid": "4e6a917466dc421657c2801b619e1268", "score": "0.0", "text": "func Touch(f string) error {\n _, e := os.Create(f)\n\n if e != nil {\n return e\n }\n\n return nil\n}", "title": "" } ]
[ { "docid": "6d58a58217d1095df93e5f338c9ff85f", "score": "0.8062293", "text": "func createEmptyFile(path string) error {\n\tf, err := os.Create(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err = f.Close(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c9c1393b79803026e6a61b0337ef01d2", "score": "0.698786", "text": "func (impl *defaultClientImplementation) CreateEmptyFile(cve string, _ *ClientOptions) (\n\tfile *os.File, err error,\n) {\n\tif err := impl.CheckID(cve); err != nil {\n\t\treturn nil, fmt.Errorf(\"checking new CVE ID: %w\", err)\n\t}\n\n\t// Add a relnote-compatible struct with only the CVE data\n\tnoteMap := struct {\n\t\tPR int\n\t\tDataFields map[string]*CVE\n\t}{\n\t\tPR: 0,\n\t\tDataFields: map[string]*CVE{\n\t\t\t\"cve\": {\n\t\t\t\tID: cve,\n\t\t\t},\n\t\t},\n\t}\n\n\t// Marshall the data struct into yaml\n\tyamlCode, err := yaml.Marshal(noteMap)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"marshalling CVE data map: %w\", err)\n\t}\n\n\tfile, err = os.CreateTemp(os.TempDir(), \"cve-data-*.yaml\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating new map file: %w\", err)\n\t}\n\tif _, err := file.WriteString(newMapHeader); err != nil {\n\t\treturn nil, fmt.Errorf(\"writing empty CVE header: %w\", err)\n\t}\n\tif _, err := file.Write(yamlCode); err != nil {\n\t\treturn nil, fmt.Errorf(\"writing yaml code to file: %w\", err)\n\t}\n\n\treturn file, nil\n}", "title": "" }, { "docid": "c92e7373f563d79c4fea21518b4c496e", "score": "0.66988045", "text": "func createFile(name string, contents string) {\n\tfileContent := []byte(contents)\n\tpermissions := os.FileMode(0666)\n\n\tif _, err := os.Stat(name); os.IsNotExist(err) {\n\t\terr := ioutil.WriteFile(name, fileContent, permissions)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e2a6722bedb0bdda341b15b41e70409b", "score": "0.66154826", "text": "func (rt *renterTester) createZeroByteFileOnDisk() (string, error) {\n\tpath := filepath.Join(rt.renter.staticFileSystem.Root(), persist.RandomSuffix())\n\terr := ioutil.WriteFile(path, []byte{}, 0600)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn path, nil\n}", "title": "" }, { "docid": "87ad9007f96efb3811d52a2f0746f4fb", "score": "0.63969374", "text": "func createFile() {\n\t// detect if file exists\n\tvar _, err = os.Stat(path)\n\n\t// create file if not exists\n\tif os.IsNotExist(err) {\n\t\tvar file, err = os.Create(path)\n\t\tif isError(err) {\n\t\t\treturn\n\t\t}\n\t\tdefer file.Close()\n\t}\n\n\tfmt.Println(\"==> done creating file\", path)\n}", "title": "" }, { "docid": "5c9673ec12696c67877708afc2ec295d", "score": "0.63790363", "text": "func main() {\n\t//os.Create will create a new file\n\t//If already exists, then truncates the file\n\tfile, err := os.Create(\"NewFile.txt\")\n\n\tif err != nil {\n\t\tfmt.Println(\"Error in creating file\")\n\t}\n\tdefer file.close()\n\n\t_,err = file.Write([]byte(\"New File Created :)\"))\n\tif err != nil {\n\t\tfmt.Println(\"Error in writing into the file :(\")\n\t}\n}", "title": "" }, { "docid": "ff3878b25dbfce733bdda0212219b6dc", "score": "0.6355124", "text": "func CreateFile(fn string) (err error) {\n\tfile, err := os.Create(fn)\n\tif err != nil {\n\t\treturn nil\n\t}\n\t_, err = file.WriteString(\"0\")\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4ddd0002e60821fc82ee18e82eee7dd5", "score": "0.6339076", "text": "func newFile(path string) (*bufio.Writer, error) {\n\tfile, err := os.Create(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\twriter := bufio.NewWriter(file)\n\treturn writer, err\n}", "title": "" }, { "docid": "6d1c23267f582d9c351e708fccd41dc7", "score": "0.63251245", "text": "func createFile() {\n\tfile, err := os.Create(\"hello.txt\")\n\tif err != nil {\n\t\tfmt.Println(\"A error has ocurr %v\", err)\n\t\treturn\n\t}\n\t// Close Secure\n\tdefer file.Close()\n\n\t_, err = file.Write([]byte(\"Hello Cristian to this new file\"))\n\tif err != nil {\n\t\tfmt.Println(\"Ocurrió un error al escribir el archivo: %v\", err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "91540dfaebe30ca5235e5182b641319b", "score": "0.6313522", "text": "func createFile(p string) *os.File {\n fmt.Println(\"Creating file...\")\n f, err := os.Create(p)\n if err != nil {\n panic(err)\n }\n return f\n}", "title": "" }, { "docid": "c488358397766c62c705b32555d92297", "score": "0.6283499", "text": "func createFile(name string) {\n\t//os.Mkdir(\"serverdata\", os.FileMode(os.ModePerm))\n\tf, err := os.Create(\"serverdata/\" + name)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tl, err := f.WriteString(\"Hello Kubernetes\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tf.Close()\n\t\treturn\n\t}\n\tfmt.Println(l, \"Message written successfully\")\n\terr = f.Close()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "c8ee7aba39c084a3abf4287a742ce570", "score": "0.6182468", "text": "func writeIfNotExists(path string, content []byte) error {\n\tdir := filepath.Dir(path)\n\tif err := os.MkdirAll(dir, 0755); err != nil {\n\t\treturn err\n\t}\n\tfile, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0600)\n\tif err != nil {\n\t\tif os.IsExist(err) {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\tdefer file.Close()\n\t_, err = file.Write(content)\n\treturn err\n}", "title": "" }, { "docid": "c53c58fdda1aa243e4a6147c87c2ff96", "score": "0.61654645", "text": "func openOrCreateFile(path string, truncate bool) (f *os.File) {\n\tvar err error\n\tif _, err = os.Stat(path); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tf, err = os.Create(path)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalln(err)\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\t} else {\n\t\t//\t\tf, err = os.OpenFile(path, os.O_APPEND|os.O_WRONLY|os.O_EXCL, 0664)\n\t\tf, err = os.OpenFile(path, os.O_APPEND|os.O_WRONLY, 0664)\n\t\tif err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\n\t\tif truncate {\n\t\t\terr = os.Truncate(path, 0)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalln(err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn f\n}", "title": "" }, { "docid": "65598f1f80c55e2e3845990327b20878", "score": "0.6165224", "text": "func createRandomFile(fileName string, size int64) error {\n\tb := make([]byte, size)\n\tif _, err := cryptorand.Read(b); err != nil {\n\t\treturn err\n\t}\n\tf, err := cos.CreateFile(fileName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\tn, err := f.Write(b)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif int64(n) != size {\n\t\treturn fmt.Errorf(\"could not write %d bytes, wrote %d bytes\", size, n)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "78ba17fd36d71419ba0c650db29677ae", "score": "0.6151966", "text": "func createFile(path string) *os.File {\n\tfile, err := os.Create(path)\n\tcheckForError(err)\n\tfile.Chmod(0644)\n\treturn file\n}", "title": "" }, { "docid": "e910ce41014695477dcfb83fcb30c396", "score": "0.6118818", "text": "func createFileIfNotExist(filepath string) {\n\tif _, err := os.Stat(filepath); os.IsNotExist(err) {\n\t\t_, err = os.Create(filepath)\n\t\tif err != nil {\n\t\t\tlog.Fatal(branchGrowError)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5ffef9df3182afa60a74784d84c9a724", "score": "0.6113763", "text": "func (fs *InMemoryFileSystem) Create(filename string) (io.WriteCloser, error) {\n\tbuffer := bytes.NewBufferString(\"\")\n\tfs.files[filename] = buffer\n\treturn NopWriteCloser(buffer), nil\n}", "title": "" }, { "docid": "e0225634e52b7b3652a7ec4905fe9b7a", "score": "0.6078373", "text": "func (f *FileRotator) createFile() error {\n\tlogFileName := filepath.Join(f.path, fmt.Sprintf(\"%s.%d\", f.baseFileName, f.logFileIdx))\n\tcFile, err := os.OpenFile(logFileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)\n\tif err != nil {\n\t\treturn err\n\t}\n\tf.currentFile = cFile\n\tfi, err := f.currentFile.Stat()\n\tif err != nil {\n\t\treturn err\n\t}\n\tf.currentWr = fi.Size()\n\tf.createOrResetBuffer()\n\treturn nil\n}", "title": "" }, { "docid": "89d8b16802ec903be9e25f56d4af2674", "score": "0.6077594", "text": "func CreateFile(file string) {\n\td := []byte(\"\")\n\terr := ioutil.WriteFile(file, d, 0666)\n\tcheck(err)\n}", "title": "" }, { "docid": "e6b0c4b0bc1db8be6f5bbc58f342cfc4", "score": "0.6072031", "text": "func Test_CreateNewFile_1(t *testing.T) {\n\tvar Outputfile = \"/tmp/outputfromtest.json\"\n\t// tidying up before running file create test don't care if it exsts or not so no need to error\n\tos.Remove(\"/tmp/outputfromtest.json\")\n\tCreateNewFile(Outputfile)\n\n\t// os.Remove(\"/tmp/outputfromtest.json\") // <-- This was to validate that test was appropriate uncomment to prove it yourself :-)\n\n\t// check that file has been created - if created pass\n\tif _, err := os.Stat(Outputfile); err == nil {\n\t\tfmt.Println(Outputfile, \"exist! <-- Pass\")\n\t\tt.Log(\"Passes because file created\")\n\t} else {\n\t\tt.Error(\"Not creating output file\")\n\n\t}\n\n}", "title": "" }, { "docid": "aca1bae23b7e1af1dbe3ed504d58bcc5", "score": "0.6067211", "text": "func createFile(path string, name string, content []byte) error {\n\t// create file in a given path\n\tf, err := os.Create(filepath.Join(path, name))\n\tif err == nil {\n\t\t// when file was created successfully, write a content to it\n\t\t_, err = f.Write(content)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "42e5452e2f9b52dd9b77f75790130f7e", "score": "0.60635334", "text": "func createFile(t *testing.T, size int64) (string, string) {\n\tb := make([]byte, size)\n\t_, err := rand.Read(b)\n\tif err != nil {\n\t\tt.Fatalf(\"Error reading rand: %v\", err)\n\t}\n\tfile, err := ioutil.TempFile(\"/tmp/\", \"gomega-\")\n\tif err != nil {\n\t\tt.Fatalf(\"Error creating temp file: %v\", err)\n\t}\n\t_, err = file.Write(b)\n\tif err != nil {\n\t\tt.Fatalf(\"Error writing temp file: %v\", err)\n\t}\n\th := md5.New()\n\t_, err = h.Write(b)\n\tif err != nil {\n\t\tt.Fatalf(\"Error on Write while writing temp file: %v\", err)\n\t}\n\treturn file.Name(), fmt.Sprintf(\"%x\", h.Sum(nil))\n}", "title": "" }, { "docid": "c0af4a02fafa09a605750e903de3d81b", "score": "0.60592175", "text": "func (fs *Fs) Create(name string) (afero.File, error) { return nil, syscall.EPERM }", "title": "" }, { "docid": "dcf327d5f03a461c692df0df5f71cb30", "score": "0.6032512", "text": "func newFile(name ...string) {\n\tpath := toPath(name...)\n\tdir, _ := filepath.Split(path)\n\tos.MkdirAll(dir, 0777)\n\tos.Create(path)\n}", "title": "" }, { "docid": "4f62d757ce38ae257610a753e3797df0", "score": "0.6001598", "text": "func main() {\n\t_, err := os.Create(\"/tmp/file\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"Can we get here?\")\n}", "title": "" }, { "docid": "b3ad8b67c857e519be6dea2e21359339", "score": "0.5988478", "text": "func createFile(filename string) {\n\tstart := time.Now()\n\n\tlog.Printf(\"Creating file: %s\\n\", filename)\n\n\t// Create file\n\tpath := filepath.Join(upDir, filename)\n\tf, err := os.Create(path)\n\tcheck(err)\n\tdefer func() {\n\t\tif err := f.Close(); err != nil {\n\t\t\tcheck(err)\n\t\t}\n\t}()\n\n\t_, err = io.CopyN(f, fastrand.Reader, int64(actualFileSize))\n\tcheck(err)\n\terr = f.Sync()\n\tcheck(err)\n\n\t// Log duration\n\telapsed := time.Since(start)\n\tlog.Printf(\"Created file: %s in: %s\\n\", filename, elapsed)\n}", "title": "" }, { "docid": "48e4c439e6fde647ba64cdb60d03fca0", "score": "0.59866863", "text": "func CreateFile(w http.ResponseWriter, r *http.Request) {\n\tpath := r.URL.Query().Get(\"path\")\n\tcreated, _ := createEmptyFile(&path)\n\tif created {\n\t\tfmt.Fprintf(w, \"created file %s \\n\", path)\n\t} else {\n\t\tfmt.Fprintf(w, \"couldn't create file %s \\n\", path)\n\t}\n}", "title": "" }, { "docid": "b3b550242c2ca42dd8f77377ddc9091e", "score": "0.596869", "text": "func CreateDummyFileOnOperator(ctx context.Context, deployment *Deployment, podName string, filepath string, size string, filename string) error {\n\tcmd := fmt.Sprintf(\"cd %s && dd if=/dev/zero of=./%s bs=4k iflag=fullblock,count_bytes count=%s\", filepath, filename, size)\n\t_, err := ExecuteCommandOnOperatorPod(ctx, deployment, podName, cmd)\n\tif err != nil {\n\t\tlogf.Log.Error(err, \"Failed to create file on the pod\", \"Pod Name\", podName)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4e14c5368103db1378154a1df81d58f1", "score": "0.59397763", "text": "func main() {\n\tdefer fileInstance.Close()\n\tfileInstance, err = os.Create(\"tickets.csv\")\n if err!=nil{\n \tlog.Fatal(err)\n\t }\n\t log.Println(fileInstance)\n\tfileInfo,err=os.Stat(\"tickets.csv\")\n\tfmt.Println(fileInfo.Size())\n fileInstance.WriteString(\"ID\\n\")\n\tfor i:=0;i<100000;i++{\n\t\tfileInstance.WriteString(strconv.Itoa(rand.Intn(10000))+\"\\n\")\n\t}\n\n w:=bufio.NewWriter(fileInstance)\n\tfor i:=0;i<100000;i++{\n\t\tw.WriteString(strconv.Itoa(rand.Intn(10000))+\"\\n\")\n\t}\n\n}", "title": "" }, { "docid": "1e4d523ffb06a4edf9d34b7769b8a766", "score": "0.5933175", "text": "func createFile(dir string, format string) (string, bool) {\n\tswitch format {\n\tcase \"txt\":\n\t\treturn path.Join(dir, \"data.txt\"), true\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "93d073009060ce7c7c123eb4e2413211", "score": "0.592034", "text": "func createFile(fpath, fname string) (*os.File, error) {\n\terr := os.MkdirAll(fpath, os.ModePerm)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn os.Create(filepath.Join(fpath, fname))\n}", "title": "" }, { "docid": "41345a57c59c85fc1ecd0e8ab60b0a18", "score": "0.58978087", "text": "func (o *Opener) Create(name string) (*os.File, error) {\n\treturn o.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666)\n}", "title": "" }, { "docid": "edda2dc0eb379bfffdfc9562f8a3ebcc", "score": "0.58858556", "text": "func createLogFile(localPath, out string) error {\n\t_, err := os.Stat(strings.Replace(filepath.Dir(filepath.Join(localPath, out)), \"\\\\\", \"/\", -1))\n\tif err != nil && os.IsNotExist(err) {\n\t\terr = os.MkdirAll(strings.Replace(filepath.Dir(filepath.Join(localPath, out)), \"\\\\\", \"/\", -1), os.ModePerm)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else if err != nil {\n\t\treturn err\n\t}\n\tf, err := os.OpenFile(strings.Replace(filepath.Join(localPath, out), \"\\\\\", \"/\", -1), os.O_CREATE, 0600)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn f.Close()\n}", "title": "" }, { "docid": "bf974affda1d8fdeb1da654b4db33fe4", "score": "0.5877328", "text": "func (l * LoggingT)createFile() error {\n\tnow := time.Now()\n\t\n\tsb := &syncBuffer{\n\t\t\t\tlogger: l,\n\t\t\t\tsev : numSeverity, // use less\n\t\t\t}\n\t\n\tif err := sb.rotateFile(now, l.rotateDaily); err != nil {\n\t\treturn err\n\t}\n\t\n\tl.logFile = &singleLogProxy {\n\t\tfile : sb,\n\t\tsev : l.logFileLevel,\t\n\t};\n\treturn nil\n}", "title": "" }, { "docid": "da2e6046fb14eab547248f3274564acb", "score": "0.5874325", "text": "func createFile(t *perftest.RatingParams) error {\n\tif len(t.RawFields) == 0 {\n\t\treturn errors.New(\"Raw fields cannot be empty\")\n\t}\n\n\t// check to see if the location exist, location specified must exist\n\tif err := exists(t.DropLocation); err != nil {\n\t\treturn err\n\t}\n\n\tvar filename string\n\tfor i := uint32(0); i < t.NumOfFiles; i++ {\n\t\tfilename = t.DropLocation + \"/\" + t.FilenamePrefix + \"-\" + strconv.FormatUint(uint64(i), 10) + \".csv\"\n\n\t\tfo, err := os.Create(filename)\n\t\tdefer func() {\n\t\t\tif e := fo.Close(); e != nil {\n\t\t\t\tpanic(e)\n\t\t\t}\n\t\t}()\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor i := 0; i < t.NumRecordsPerFile; i++ {\n\t\t\t// No random, rate repeatly using the current timestamp for phase 1\n\t\t\t// 20060102150405 is const have to specify it this way, refer to\n\t\t\t// http://stackoverflow.com/questions/20234104/how-to-format-current-time-using-a-yyyymmddhhmmss-format\n\t\t\ttns := time.Now().Format(\"20060102150405.000\")\n\n\t\t\t// replace the timestamp\n\t\t\tt.RawFields[t.TimpstampFieldIndex] = tns\n\t\t\t// replace the uniqueness identifier\n\t\t\tvar err error\n\t\t\tt.RawFields[0], err = newUUID()\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tfo.WriteString(strings.Join(t.RawFields, \",\") + \"\\n\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e4b4fd20b33d857c62034eeefbc616d0", "score": "0.5847283", "text": "func (ds *diskStorage) create(key string, contents []byte) error {\n\tif key == \"\" {\n\t\treturn storage.ErrKeyIsEmpty\n\t}\n\n\tkeyPath := filepath.Join(ds.baseDir, key)\n\tdir, _ := filepath.Split(keyPath)\n\tif _, err := os.Stat(dir); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tif err = os.MkdirAll(dir, 0755); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\t// dir for key is already exist\n\t}\n\n\t// open file with synchronous I/O\n\tf, err := os.OpenFile(keyPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC|os.O_SYNC, 0600)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(contents)\n\tif err == nil && n < len(contents) {\n\t\terr = io.ErrShortWrite\n\t}\n\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "title": "" }, { "docid": "9acd89dcd752124718291ca921c2470c", "score": "0.58413595", "text": "func createAndCloseFile(path string) error {\n\terr := os.MkdirAll(filepath.Dir(path), 0700)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed creating path %s: %s\", path, err)\n\t}\n\tnewFile, err := os.OpenFile(path, os.O_CREATE|os.O_TRUNC|os.O_RDWR, 0600)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed creating file %s: %s\", path, err)\n\t}\n\n\treturn newFile.Close()\n}", "title": "" }, { "docid": "5cfe19e08f948bdcb982848b687aaad1", "score": "0.58349264", "text": "func (d *Downloader) createFinalFile() (err error) {\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdefer d.Close()\n\n\tfor i := 0; i < len(d.Chunks); i++ {\n\t\tfilename := d.Chunks[i].DestinationFile()\n\t\tfile, err := os.Open(filename)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = io.Copy(d, file)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfile.Close()\n\t\tos.Remove(filename)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "08e460f6e375052b846764cc5e047f7f", "score": "0.5806625", "text": "func createConfFile(p string, s string) {\n\tfile, err := os.Create(p)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Fprintf(file, s)\n}", "title": "" }, { "docid": "3385eecea9674171c2a521ba3c3a84a5", "score": "0.57892126", "text": "func NewFile(n string) {\n\texec.Command(\"touch \" + n)\n}", "title": "" }, { "docid": "a680445825389890a0af86e3709bdd9c", "score": "0.57802", "text": "func MustCreate(name string) *os.File {\n\tfile, err := os.Create(name)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn file\n}", "title": "" }, { "docid": "fb12a0cd25d6b30827f34da88e0d92c2", "score": "0.57742846", "text": "func Create(name string) (File, error) {\n\treturn fs.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_TRUNC)\n}", "title": "" }, { "docid": "b6e26f35437a307ceef6b3b99059af6f", "score": "0.5766122", "text": "func Create(path string) (*Writer, error) {\n\tf, err := os.OpenFile(path, os.O_RDWR|os.O_TRUNC|os.O_CREATE, 0600)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewWriter(f, nil)\n}", "title": "" }, { "docid": "f6c7c098b3530c03f8d3f555ff9b656b", "score": "0.5761051", "text": "func createFileMD(t *testing.T, size int) *www.File {\n\tt.Helper()\n\n\tvar b bytes.Buffer\n\tr, err := util.Random(size)\n\tif err != nil {\n\t\tt.Fatalf(\"%v\", err)\n\t}\n\tb.WriteString(base64.StdEncoding.EncodeToString(r) + \"\\n\")\n\n\treturn &www.File{\n\t\tName: www.PolicyIndexFilename,\n\t\tMIME: http.DetectContentType(b.Bytes()),\n\t\tDigest: hex.EncodeToString(util.Digest(b.Bytes())),\n\t\tPayload: base64.StdEncoding.EncodeToString(b.Bytes()),\n\t}\n}", "title": "" }, { "docid": "df5fd60be7864bb45f770e7605f2d7bb", "score": "0.57118845", "text": "func crearRegistro(){\n archivo, err := os.Create(\"registro.csv\")\n if err != nil{\n log.Println(err)\n }\n archivo.Close()\n}", "title": "" }, { "docid": "635a762794cc1935f3fa6e791ad95fa8", "score": "0.57096356", "text": "func createInterpolatedFile(filename string, stamped bool, stateDT time.Time) *os.File {\n\tif stamped {\n\t\tt := time.Now()\n\t\tfilename = fmt.Sprintf(\"%s/prop-%s-%d-%02d-%02dT%02d.%02d.%02d.xyzv\", smdConfig().outputDir, filename, t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second())\n\t} else {\n\t\tfilename = fmt.Sprintf(\"%s/prop-%s.xyzv\", smdConfig().outputDir, filename)\n\t}\n\tf, err := os.Create(filename)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// Header\n\tf.WriteString(fmt.Sprintf(`# Creation date (UTC): %s\n# Records are <jd> <x> <y> <z> <vel x> <vel y> <vel z>\n# Time is a TDB Julian date\n# Position in km\n# Velocity in km/sec\n# Simulation time start (UTC): %s`, time.Now(), stateDT.UTC()))\n\treturn f\n}", "title": "" }, { "docid": "38daf9360dbd417fbb8662b0a48a20eb", "score": "0.5705833", "text": "func CreateFile(filename string, size int64) error {\n\n\tbuf := make([]byte, size)\n\n\t// Create the file store some data\n\tfp, err := os.Create(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write the buffer\n\t_, err = fp.Write(buf)\n\n\t// Cleanup\n\tfp.Close()\n\n\treturn err\n}", "title": "" }, { "docid": "8e0e6932f787056ddd8a4f1742e2b8e5", "score": "0.5704533", "text": "func Create(name string) (*os.File, error) {\n\tdefer updateOSMetrics(osMetricCreate, name)()\n\treturn os.Create(name)\n}", "title": "" }, { "docid": "d432ce341f785666ef328766c9ed818c", "score": "0.5701419", "text": "func createFileWriter(directory string) (*bufio.Writer, *os.File, error) {\n\tfilePath := filepath.Join(string(directory), \"content\")\n\tfile, err := os.Create(filePath)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to create file: %v\", err)\n\t}\n\n\treturn bufio.NewWriter(file), file, nil\n}", "title": "" }, { "docid": "22c36da0760c48498abd3cc3d02870eb", "score": "0.5699997", "text": "func CreateCompressedFile() string {\n\tvar buf bytes.Buffer\n\tzw := gzip.NewWriter(&buf)\n\tzw.Name = \"dummy.txt\"\n\tzw.Write([]byte(\"some content\"))\n\tzw.Close()\n\treturn buf.String()\n}", "title": "" }, { "docid": "a5df7bca868ad5f1c65d6df2cb35036e", "score": "0.5694823", "text": "func createAsCSVFile(filename string, conf ExportConfig, stateDT time.Time) *os.File {\n\tif conf.Timestamp {\n\t\tt := time.Now()\n\t\tfilename = fmt.Sprintf(\"%s/orbital-elements-%s-%d-%02d-%02dT%02d.%02d.%02d.csv\", smdConfig().outputDir, filename, t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second())\n\t} else {\n\t\tfilename = fmt.Sprintf(\"%s/orbital-elements-%s.csv\", smdConfig().outputDir, filename)\n\t}\n\tf, err := os.Create(filename)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// Header\n\tf.WriteString(fmt.Sprintf(`# Creation date (UTC): %s\n# Records are a, e, i, Ω, ω, ν. All angles are in degrees.\n# Simulation time start (UTC): %s\ntime,a,e,i,Omega,omega,nu,fuel,timeInHours,timeInDays,`, time.Now(), stateDT.UTC()))\n\tif conf.CSVAppendHdr != nil {\n\t\t// Append the headers for the appended columns.\n\t\tf.WriteString(conf.CSVAppendHdr())\n\t}\n\treturn f\n}", "title": "" }, { "docid": "7281b53491b5b3ffe8e2c27d1390998a", "score": "0.5691802", "text": "func CreateSizedFile(path string, size int64) error {\n\tfd, err := os.Create(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer Close(fd)\n\n\tif size <= 0 {\n\t\treturn nil\n\t}\n\n\t_, err = fd.Seek(size-1, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = fd.Write([]byte{0})\n\treturn err\n}", "title": "" }, { "docid": "4b93a99a0f5ef667b2115039c4c25410", "score": "0.56855303", "text": "func create(name string) {\n\tfd, err := os.Create(name)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t_, err = fmt.Fprint(fd, arHeader)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfd.Close()\n}", "title": "" }, { "docid": "4cac33c7a62dbc09f6e1b2707d028462", "score": "0.56789756", "text": "func (r *TestCommands) CreateFile(name, content string) {\n\tfilePath := filepath.Join(r.WorkingDir, name)\n\tfolderPath := filepath.Dir(filePath)\n\tasserts.NoError(os.MkdirAll(folderPath, os.ModePerm))\n\t//nolint:gosec // need permission 700 here in order for tests to work\n\tasserts.NoError(os.WriteFile(filePath, []byte(content), 0x700))\n}", "title": "" }, { "docid": "52217fabe8d8a81a9f4ef8504285b0d4", "score": "0.56591487", "text": "func TestFileTreeCreateEmpty(t *testing.T) {\n\twant, got := setupFileTreeTestDir(\"empty\", t)\n\tif !got.Equal(want) {\n\t\tt.Errorf(\"%v(): got %v, want %v\", t.Name(), got, want)\n\t}\n}", "title": "" }, { "docid": "cfa69a83e1701bc14d87f51ac98eb379", "score": "0.5641912", "text": "func testFileBuildNoBatch(t testing.TB) {\n\tfile := NewFile().SetHeader(mockFileHeader())\n\tif err := file.Create(); err != nil {\n\t\tif e, ok := err.(*FileError); ok {\n\t\t\tif e.FieldName != \"Batches\" {\n\t\t\t\tt.Errorf(\"%T: %s\", err, err)\n\t\t\t}\n\t\t} else {\n\t\t\tt.Errorf(\"%T: %s\", err, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "af33b99812ae67d53e4b96083bc2af86", "score": "0.562873", "text": "func newDummyFile(name string, size int64) *dummyFile {\n\treturn &dummyFile{\n\t\tname: name,\n\t\tsize: size,\n\t}\n}", "title": "" }, { "docid": "6345b0d3ff994a0aca8f3279f0e4617c", "score": "0.5622281", "text": "func (w *Warehouse) Create(filepath string) {\n\tos, err := os.Create(filepath)\n\tif err != nil {\n\t\tpanic(\"error: could not create a new file\")\n\t}\n\tw.file = os\n}", "title": "" }, { "docid": "d4377b4c2af7410234dc48ada7a4e115", "score": "0.56140804", "text": "func WriteNewTruncFile(filename string, buffer []byte) error {\n\tf, err := os.OpenFile(filename, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Manually close the file handler here, because it must be closed not deffered but\n\tif _, err := f.Write(buffer); err != nil {\n\t\tf.Close()\n\t\treturn err\n\t}\n\tf.Close()\n\treturn nil\n}", "title": "" }, { "docid": "97b2156be5892145263b77bc9155e76d", "score": "0.5596032", "text": "func NewEmpty(l language.Language, name string) (*ScriptFile, error) {\n\treturn new(l, name, []byte(\"\"))\n}", "title": "" }, { "docid": "0b37ae2261cc581f6190e105022c0518", "score": "0.55958754", "text": "func (fs *PseudoFS) Create(name string, minShards int) (*PseudoFile, error) {\n\treturn fs.OpenFile(name, os.O_CREATE|os.O_TRUNC|os.O_RDWR, 0o666, minShards)\n}", "title": "" }, { "docid": "1cd6f910ea20722f028501feb5a87095", "score": "0.5585809", "text": "func createTestFile(t *testing.T) (directory, file string, err error) {\n\tif directory, err = createTestDirectory(t); err != nil {\n\t\treturn\n\t}\n\t// Cleanup if the file creation fails\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tos.RemoveAll(directory)\n\t\t}\n\t}()\n\n\tfilePath := filepath.Join(directory, \"test.txt\")\n\tfileHandle, err := os.Create(filePath)\n\tif err != nil {\n\t\treturn directory, filePath, err\n\t}\n\tdefer fileHandle.Close()\n\n\t_, err = fileHandle.Write([]byte(\"Here is some test data!\\n\"))\n\treturn directory, filePath, err\n}", "title": "" }, { "docid": "459804e6c73e16afec79aa89c18cf5d9", "score": "0.5585354", "text": "func TestUsageNonemptyFile(t *testing.T) {\n\tdir := t.TempDir()\n\n\tvar file *os.File\n\tvar err error\n\tif file, err = os.CreateTemp(dir, \"file\"); err != nil {\n\t\tt.Fatalf(\"failed to create file: %s\", err)\n\t}\n\n\td := []byte{97, 98, 99, 100, 101}\n\t_, err = file.Write(d)\n\trequire.NoError(t, err)\n\n\tusage, _ := Usage(dir)\n\texpectSizeAndInodeCount(t, \"directory with one 5-byte file\", usage, &DiskUsage{\n\t\tSize: 5,\n\t\tInodeCount: 2,\n\t})\n}", "title": "" }, { "docid": "d2b2bd1a669395f9ee807373df32367f", "score": "0.5583775", "text": "func writeFile(contents string, filepath string) (error) {\n f, err := os.Create(filepath)\n fmt.Print(err, \"\\n\\n\")\n if err != nil {\n return err\n }\n\n fmt.Print(\"file:\", f)\n _, err = f.WriteString(contents)\n if err != nil {\n f.Close()\n return err\n }\n fmt.Printf(\"Wriring {%s} to %s\\n\", contents, filepath)\n err = f.Close()\n if err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "6362c8282238d7d2407f8982d652dd00", "score": "0.5571088", "text": "func mustCreateFile(name string) *os.File {\n\tf, err := os.Create(name)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn f\n}", "title": "" }, { "docid": "0244e3fafcca9bad0de69dc849889ec4", "score": "0.55618966", "text": "func mkFile(path string, info os.FileInfo, r io.Reader) (err error) {\n\tfh, err := os.OpenFile(path, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, info.Mode())\n\tdefer func() { err = utils.CheckedClose(fh, err) }()\n\tif err != nil {\n\t\terr = errors.WithStack(err)\n\t\treturn\n\t}\n\n\tif _, err = io.Copy(fh, r); err != nil {\n\t\terr = errors.WithStack(err)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "7f71411ca131caee51aba228fb27d7d0", "score": "0.5556477", "text": "func writeToTmp(file string) {\n\n\tdate := dateLastModified()\n\tcreateFile, err := os.Create(file)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\twriteToFile, _ := createFile.WriteString(date)\n\n\t_ = writeToFile\n\n\tdefer createFile.Close()\n\n}", "title": "" }, { "docid": "bf8143c185fd452677ed87e3c3f2cb2b", "score": "0.5553184", "text": "func createConfigFile(t *testing.T, name, contents string) string {\n\tos.MkdirAll(\"tmpout\", os.ModeDir)\n\tfullName := \"tmpout/\" + name\n\tos.Remove(fullName) // Remove old if it exist\n\terr := ioutil.WriteFile(fullName, []byte(contents), 0644)\n\tif err != nil {\n\t\tt.Fatalf(\"Unable to create configuration file. Reason: %s\", err)\n\t}\n\treturn fullName\n}", "title": "" }, { "docid": "4845412fe242ce12ca4cd6515372f78e", "score": "0.55518335", "text": "func (f *File) Write() error {\n return os.WriteFile(f.Path, []byte(f.Generate()), 0644)\n}", "title": "" }, { "docid": "8858e6a4319b6f9a9412a1b0a4e417fa", "score": "0.5551219", "text": "func createDefaultConfigFile(destinationPath string) error {\n\t// Create the destination directory if it does not exists\n\terr := os.MkdirAll(filepath.Dir(destinationPath), 0700)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdest, err := os.OpenFile(destinationPath,\n\t\tos.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer dest.Close()\n\n\t_, err = dest.WriteString(sampleConfig)\n\n\treturn err\n}", "title": "" }, { "docid": "5277e0bb1d3b7fd51fd471e5e40efcdd", "score": "0.5547015", "text": "func MakeFile(path string) {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\n\t\tf, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_RDWR, 0777)\n\t\tdefer f.Close()\n\n\t\tif err != nil {\n\t\t\tf, err = os.Create(path)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"error opening file: %v \\n\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ebd74dd625da1d8e28913aebfbfda933", "score": "0.5545574", "text": "func createTestFile(packageName string, testFilename string) {\n\tutils.LogWhenVerbose(\"[coverage] created test for package %s file @ %s\", packageName, testFilename)\n\n\tif _, err := os.Stat(testFilename); err == nil {\n\t\tutils.LogWhenVerbose(\"[coverage] file already exists @ %s cowardly refusing to overwrite\", testFilename)\n\t\treturn\n\t}\n\n\tfile, err := os.OpenFile(testFilename, os.O_RDWR|os.O_CREATE, 0600)\n\tif err != nil {\n\t\tutils.LogWhenVerbose(\"[coverage] error while creating test file %s\", err)\n\t\treturn\n\t}\n\n\t_, err = file.WriteString(`package ` + packageName + `\n\nimport \"testing\"\n\nfunc TestThisTestDoesntReallyTestAnything(t *testing.T) {}\n`)\n\tif err != nil {\n\t\tutils.LogWhenVerbose(\"[coverage] error while writing test file %s\", err)\n\t\treturn\n\t}\n\n\terr = file.Close()\n\tif err != nil {\n\t\tutils.LogWhenVerbose(\"[coverage] error while closing file '%s\", err)\n\t}\n}", "title": "" }, { "docid": "4d35105938bd2c6dee05cc32ba9673f1", "score": "0.55303574", "text": "func CreateAllIfNotExist(path string) (*os.File, error) {\n\treturn OpenFileAll(path, DefaultFlagCreateIfNotExist, DefaultPermissionDirectory, DefaultPermissionFile)\n}", "title": "" }, { "docid": "9aa5c8386cc48b76631f20cb282d63b3", "score": "0.55283606", "text": "func CreateFileFromString(content string, filename string) {\n\tf, err := os.Create(filename)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tl, err := f.WriteString(content)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tf.Close()\n\t\treturn\n\t}\n\tfmt.Println(fmt.Sprintf(\"%s - %v bytes written successfully\", filename, l))\n\terr = f.Close()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "531b67b1ed6c2222a112b016104f1ab5", "score": "0.5518938", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n f, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n if err != nil {\n return err\n }\n n, err := f.Write(data)\n if err == nil && n < len(data) {\n err = io.ErrShortWrite\n }\n if err1 := f.Close(); err == nil {\n err = err1\n }\n return err\n}", "title": "" }, { "docid": "531b67b1ed6c2222a112b016104f1ab5", "score": "0.5518938", "text": "func WriteFile(filename string, data []byte, perm os.FileMode) error {\n f, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)\n if err != nil {\n return err\n }\n n, err := f.Write(data)\n if err == nil && n < len(data) {\n err = io.ErrShortWrite\n }\n if err1 := f.Close(); err == nil {\n err = err1\n }\n return err\n}", "title": "" }, { "docid": "9d536ccea17bfcccc944e42af3fbc89a", "score": "0.5514411", "text": "func CreateFile(path string, valueType valueType, startTime int64, resolution int64, functions int64) (file *File, err os.Error) {\n\t// make directory\n\tdirpath, _ := filepath.Split(path)\n\tos.MkdirAll(dirpath, uint32(0755))\n\n\t// open file\n\t// todo: O_APPEND is a bad idea here?\n\tfd, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_EXCL|os.O_APPEND, 0666)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\theader := fileHeader{fileMagic, 1, valueType, resolution, startTime, functions}\n\t_, err = fd.Write(header.Bytes())\n\t// todo: is this the right response to this error?\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &File{fd, &header}, nil\n}", "title": "" }, { "docid": "4e31cb215de4e6ff3a1dbe0c11ebe58d", "score": "0.5511341", "text": "func createFile(metaPath string) (*metadata, error) {\n\taa, err := newArena(metaPath, cMetadataSize)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error in creating arena for metadata file :: %w\", err)\n\t}\n\n\tmd := &metadata{\n\t\taa: aa,\n\t\tco: make(map[string]int64),\n\t\tfile: metaPath,\n\t\tsize: cMetadataSize,\n\t}\n\tmd.putVersion()\n\n\treturn md, nil\n}", "title": "" }, { "docid": "3e8d0bc02f2c43f566f40dc50b4383bf", "score": "0.55078816", "text": "func (fPerm *FilePermissionConfig) Empty() {\n fPerm.isInitialized = false\n fPerm.fileMode = os.FileMode(0)\n}", "title": "" }, { "docid": "0be1c1155af089a9939afa839afb95bb", "score": "0.5502581", "text": "func (f *File) Create() error {\n\tlogging.Logger.Info(\"create \" + f.Path)\n\tfObj, err := os.Create(f.Path)\n\tif err != nil {\n\t\treturn &file.CreateFileError{\n\t\t\tErr: err,\n\t\t}\n\t}\n\tdefer fObj.Close()\n\n\t_, err = fObj.WriteString(viper.GetString(\"export\") + \"\\n\")\n\tif err != nil {\n\t\treturn &WriteExportError{\n\t\t\tErr: err,\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d1d2f73d7ec70405015e3777597c744b", "score": "0.5502572", "text": "func (server Server) createIdFile() {\n\tidFile := server.settings.IdFile()\n\tif fileio.FileExists(idFile) {\n\t\treturn\n\t}\n\n\terr := fileio.CreateFile(idFile, \"0\")\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Could not create ID file: %s\", err.Error()))\n\t}\n}", "title": "" }, { "docid": "03cf9371702650544e195d04360c591e", "score": "0.54951566", "text": "func WriteToFile(filename string, message string) {\n fmt.Println(\"Writing to file\")\n file, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0666)\n if err != nil {\n fmt.Println(\"File does not exists or cannot be created\")\n os.Exit(1)\n }\n defer file.Close()\n\n if _, err := file.WriteString(message);\n err != nil {\n fmt.Println(err)\n }\n}", "title": "" }, { "docid": "4cc1472f1a76abb68f28654f6a8767d2", "score": "0.549111", "text": "func makeFile(filePath, fileContents string) error {\n\t_, err := os.Stat(filePath)\n\tif err == nil {\n\t\tlog.Printf(\"File exists: %q\\n\", filePath)\n\t\treturn nil\n\t} else if os.IsNotExist(err) {\n\t\tlog.Printf(\"Writing to: %q\\n\", filePath)\n\t\treturn ioutil.WriteFile(filePath, []byte(fileContents), workingDirectoryPermission)\n\t} else {\n\t\treturn err\n\t}\n}", "title": "" }, { "docid": "21eb288795d2f6eab402f77efd902e00", "score": "0.5473721", "text": "func Create(name string) (*os.File, error) {\n\treturn openFileSequential(name, windows.O_RDWR|windows.O_CREAT|windows.O_TRUNC)\n}", "title": "" }, { "docid": "df38d07001fe71618ed473681d48bb36", "score": "0.54705787", "text": "func (d *directory) newFile(name string) (*os.File, error) {\n\treturn os.OpenFile(filepath.Join(d.n, name), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0700)\n}", "title": "" }, { "docid": "afe9a88496e35826475fd6f8f5e0bdc1", "score": "0.54607797", "text": "func openTempFile(prefix string, suffix string, mode os.FileMode) (string, *os.File, error) {\n\tfilename, err := RandomID(prefix)\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\tif suffix != \"\" {\n\t\tfilename += suffix\n\t}\n\tflags := os.O_WRONLY | os.O_CREATE | os.O_EXCL\n\tif mode == 0 {\n\t\tmode = 0600\n\t}\n\tfile, err := os.OpenFile(filename, flags, mode)\n\treturn filename, file, err\n}", "title": "" }, { "docid": "e236ef4b905d429375a05243f2dd3226", "score": "0.5460473", "text": "func (f *file) Create(name string, size int64) error {\n\tfilename := filepath.Join(f.path, name)\n\t_, err := f.filesystem.Create(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "520d8716031d81c2e4d1b98a95b5316b", "score": "0.54592425", "text": "func openOrCreate(fileLoc string) (target *os.File, err error) {\n\tif fileExists(fileLoc) {\n\t\ttarget, err = os.Open(fileLoc)\n\t} else {\n\t\ttarget, err = os.Create(fileLoc)\n\t}\n\treturn\n}", "title": "" }, { "docid": "3d63be2f750d00ad2d6a3a84ba000ebd", "score": "0.5456232", "text": "func newFileWriter(path string) (*fileWriter, error) {\n\t// prepare temp file for initial writing.\n\t//nolint:gosec // we really need to read this file.\n\tfile, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o644)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating temporary file at %s: %w\", path, err)\n\t}\n\n\treturn &fileWriter{\n\t\tfile: file,\n\t\tmd5Writer: md5.New(),\n\t}, nil\n}", "title": "" }, { "docid": "4a9cacf9528ba93a562db0fe6cfbb899", "score": "0.5455808", "text": "func makeFile(c string) (fn string) {\n\tif f, err := ioutil.TempFile(os.TempDir(), \"conf\"); err == nil {\n\t\tf.WriteString(c)\n\t\tf.Close()\n\t\treturn f.Name()\n\t} else {\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "f891905f1bea8a75f89e31537524c4af", "score": "0.54546684", "text": "func CreateRandomFile(sizeMiB int) (path string, err error) {\n\tvar f *os.File\n\tf, err = ioutil.TempFile(\"/tmp\", \"ciao-random-\")\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer func() {\n\t\terr1 := f.Close()\n\t\tif err1 != nil && err == nil {\n\t\t\terr = err1\n\t\t}\n\t}()\n\n\tb := make([]byte, sizeMiB*1024*1024)\n\t_, err = rand.Read(b)\n\tif err != nil {\n\t\treturn\n\t}\n\t_, err = f.Write(b)\n\tif err == nil {\n\t\tpath = f.Name()\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "a5644914eddb392a1cb1ad06773098d1", "score": "0.545209", "text": "func main() {\n\n // Subito dopo aver creato un file con la funzione\n // `createFile`, utilizziamo `defer` su `closeFile`.\n // Questa funzione sarà eseguita al termine della funzione\n // dentro la quale è stata chiamata (in questo caso\n // `main`), appena la funzione `writeFile` avrà terminato.\n f := createFile(\"/tmp/defer.txt\")\n defer closeFile(f)\n writeFile(f)\n}", "title": "" }, { "docid": "51ecbb9e02d1b659b4873f742072ef8c", "score": "0.5450137", "text": "func (d *directory) createFile(path string) (*os.File, error) {\n\td.mu.Lock()\n\tdefer d.mu.Unlock()\n\n\tif err := d.ensureParentDir(path); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn os.Create(path)\n}", "title": "" }, { "docid": "3cdc513b83ddaf429864ada671a5a83f", "score": "0.5441632", "text": "func OpenOrCreateFile(path string) (*os.File, error) {\n\treturn os.OpenFile(path, os.O_WRONLY|os.O_APPEND|os.O_CREATE, DEFAULT_PERM)\n}", "title": "" }, { "docid": "af6fbd583feb39adb39d4ac1162a47e4", "score": "0.5439745", "text": "func CreateTempFile(t *testing.T, file_prefix string, content []byte) string {\r\n\ttmp_file, err := ioutil.TempFile(\"\", \"pub_key\")\r\n\tif err != nil {\r\n\t\tt.Fail()\r\n\t}\r\n\tif _, err := tmp_file.Write(content); err != nil {\r\n\t\tt.Fail()\r\n\t}\r\n\tif err := tmp_file.Close(); err != nil {\r\n\t\tt.Fail()\r\n\t}\r\n\treturn tmp_file.Name()\r\n}", "title": "" }, { "docid": "55cec7c4c34e2b65952199979c0f5000", "score": "0.54337513", "text": "func CreateFileOf(filePath string) (*os.File, error) {\n\treturn os.OpenFile(filePath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0664)\n}", "title": "" }, { "docid": "6b3ee14d83bf1ad8bd635efe36adfd9d", "score": "0.54078346", "text": "func (td *tempDir) newFile(name string, data string) string {\n\tpath := filepath.Join(td.dir, name)\n\tf, err := os.Create(path)\n\tif err != nil {\n\t\ttd.t.Fatalf(\"newFile(%q, %q) error: %v\", name, data, err)\n\t}\n\t_, werr := f.Write([]byte(data))\n\tcerr := f.Close()\n\tif werr != nil {\n\t\ttd.t.Errorf(\"newFile(%q, %q) write error: %v\", name, data, err)\n\t}\n\tif cerr != nil {\n\t\ttd.t.Errorf(\"newFile(%q, %q) close error: %v\", name, data, err)\n\t}\n\tif werr != nil || cerr != nil {\n\t\ttd.t.FailNow()\n\t}\n\treturn path\n}", "title": "" }, { "docid": "032389415ed29f60f829d999183b2b48", "score": "0.5405854", "text": "func (c *Celeritas) CreateFileIfNotExists(path string) error {\n\tvar _, err = os.Stat(path)\n\tif os.IsNotExist(err) {\n\t\tvar file, err = os.Create(path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdefer func(file *os.File) {\n\t\t\t_ = file.Close()\n\t\t}(file)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "047ccef4b8aa6616bf285935815df8a7", "score": "0.53988385", "text": "func writeFile(n string, d []byte) error {\n\tf, e := os.Create(n)\n\tif e != nil {\n\t\treturn e\n\t}\n\tdefer f.Close()\n\tnr, e := f.Write(d)\n\tif e != nil {\n\t\treturn e\n\t}\n\tfmt.Println(\"WriteDataLen:\", len(d), \"Written:\", nr)\n\treturn nil\n}", "title": "" }, { "docid": "6b6e4eda9e9ed4a4a1c5700099051488", "score": "0.5398402", "text": "func CreateNewFile(filePath string) *os.File {\n\tf, err := os.Create(filePath)\n\tcomm.CheckPrecond(err)\n\tchunk := make([]byte, ChunkSize*FileSize)\n\tf.Write(chunk)\n\tf.Sync()\n\n\treturn f\n}", "title": "" }, { "docid": "87846aa44223db80b088657ef1788866", "score": "0.5397061", "text": "func TestUsageEmptyFile(t *testing.T) {\n\tdir := t.TempDir()\n\n\tvar file *os.File\n\tvar err error\n\tif file, err = os.CreateTemp(dir, \"file\"); err != nil {\n\t\tt.Fatalf(\"failed to create file: %s\", err)\n\t}\n\n\tusage, _ := Usage(file.Name())\n\texpectSizeAndInodeCount(t, \"one file\", usage, &DiskUsage{\n\t\tSize: 0,\n\t\tInodeCount: 1,\n\t})\n}", "title": "" } ]
0f34d18da9c952c8e8a320fdec4af4e2
ReqString formats a string for request
[ { "docid": "4284785b7b600f44c203501dcb2b883b", "score": "0.73739314", "text": "func ReqString(req *http.Request) string {\n\tctx := req.Context()\n\tcomp, _ := ClientComponentFrom(ctx)\n\tif info, ok := apirequest.RequestInfoFrom(ctx); ok {\n\t\treturn fmt.Sprintf(\"%v %s %s: %s\", comp, info.Verb, info.Resource, req.URL.String())\n\t}\n\n\treturn fmt.Sprintf(\"%s of %s\", comp, req.URL.String())\n}", "title": "" } ]
[ { "docid": "174bc63c52607b625ab3c387a4b3ec2b", "score": "0.6584091", "text": "func (r Request) String() string {\n\tb, _ := json.Marshal(r)\n\treturn \"--> \" + string(b)\n}", "title": "" }, { "docid": "2e81f77d419a09f85bd40b1ae744b67b", "score": "0.65675455", "text": "func (r Request) String() string {\n\tb, err := json.Marshal(r)\n\tif err != nil {\n\t\treturn fmt.Sprintf(\"%#v.MarshalJSON(): %v\", r, err)\n\t}\n\treturn \"--> \" + string(b)\n}", "title": "" }, { "docid": "8aefde15fdad0ad8b8c0d52859e9c450", "score": "0.64853966", "text": "func ReqInfoString(info *apirequest.RequestInfo) string {\n\tif info == nil {\n\t\treturn \"\"\n\t}\n\n\treturn fmt.Sprintf(\"%s %s for %s\", info.Verb, info.Resource, info.Path)\n}", "title": "" }, { "docid": "d20d570faf4199eaed944f2ce34999a3", "score": "0.6480174", "text": "func (b *HTTPReq) String() (string, error) {\n\tdata, err := b.Bytes()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(data), nil\n}", "title": "" }, { "docid": "55637068326b2434996c6d932c5cc559", "score": "0.6469589", "text": "func (c *Client) RequestStr(params map[string]string, action string,method string) (string, error) {\n data,err := c.RequestByte(params,action,method)\n return string(data),err\n}", "title": "" }, { "docid": "15bdfae40e7e7e70741d0d8d3fcab86f", "score": "0.6444972", "text": "func (r Request) String() string {\n\tvar s strings.Builder\n\tif err := r.Write(&s); err != nil {\n\t\treturn err.Error()\n\t}\n\treturn s.String()\n}", "title": "" }, { "docid": "fa72b73b4581c777fd566258f0bfc42b", "score": "0.63875985", "text": "func (c *Client) BuildRequestString(request string) error {\n\treturn c.buildRequestString(request, false)\n}", "title": "" }, { "docid": "383da7011217b59849d150002ceac711", "score": "0.6282836", "text": "func (v *Request) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [2]string\n\ti := 0\n\tif v.FirstName != nil {\n\t\tfields[i] = fmt.Sprintf(\"FirstName: %v\", *(v.FirstName))\n\t\ti++\n\t}\n\tif v.LastName != nil {\n\t\tfields[i] = fmt.Sprintf(\"LastName: %v\", *(v.LastName))\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"Request{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "d7165c403f3a4ac7244f5b8e7c9507f4", "score": "0.6199578", "text": "func (req *Request) String() (string, error) {\n\treturn String(req.Do())\n}", "title": "" }, { "docid": "2809408de8a4e3aff8189bf2770e0813", "score": "0.6170702", "text": "func (b *HTTPReq) DumpRequestString() string {\n\treturn string(b.DumpRequest())\n}", "title": "" }, { "docid": "0e03236b9f3a77557fb3cf705d872c89", "score": "0.61612433", "text": "func (sr SystemRequest) UpdateString() string {\n\ts := \"{\"\n\ts += fmt.Sprintf(\"\\\"name\\\": \\\"%s\\\",\", sr.Name)\n\ts += fmt.Sprintf(\"\\\"customerFqdn\\\": \\\"%s\\\",\", sr.CustomerFqdn)\n\ts += fmt.Sprintf(\"\\\"disk\\\": \\\"%d\\\",\", sr.Disk)\n\ts += fmt.Sprintf(\"\\\"systemimage\\\": %s,\", sr.Systemimage)\n\ts += fmt.Sprintf(\"\\\"organisation\\\": %s,\", sr.Organisation)\n\ts += fmt.Sprintf(\"\\\"systemproviderConfiguration\\\": %s,\", sr.SystemproviderConfiguration)\n\ts += fmt.Sprintf(\"\\\"zone\\\": %s\", sr.Zone)\n\ts += \"}\"\n\treturn s\n}", "title": "" }, { "docid": "cb151779dbadd7ddf57642af27ab93b8", "score": "0.61586016", "text": "func (c ServicesReq) String() string {\n\tls := new(common.LogString)\n\tls.AddS(\"Services\\n\")\n\tls.AddF(\"JID: %v\\n\", c.JID)\n\tls.AddF(\"Location - lat: %v lon: %v city: %v\\n\", c.LatitudeV, c.LongitudeV, c.City)\n\treturn ls.Box(80)\n}", "title": "" }, { "docid": "87e3e000efe8ac5240c90d9143cc640c", "score": "0.61265486", "text": "func (o *Createemailrequest) String() string {\n\tj, _ := json.Marshal(o)\n\tstr, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n\treturn str\n}", "title": "" }, { "docid": "dd6c0fda0937e55b9062070be33833cf", "score": "0.6034005", "text": "func (sigReq SignatureRequest) String() string {\n\ts := sigReq.ElectionID + \"\\n\\n\" + string(sigReq.RequestID) + \"\\n\\n\" + sigReq.PublicKey.String() + \"\\n\\n\" + string(sigReq.BallotHash)\n\tif sigReq.HasSignature() {\n\t\ts += \"\\n\\n\" + sigReq.Signature.String()\n\t}\n\treturn s\n}", "title": "" }, { "docid": "3113c6469ac5dbcaa4c49fccfeff6854", "score": "0.60006315", "text": "func (m RequestMatcher) String() string {\n\tvar seg []string\n\tif m.Path != \"\" {\n\t\tseg = append(seg, fmt.Sprintf(\"path ^= %q\", m.Path))\n\t}\n\tif m.Method != \"\" {\n\t\tseg = append(seg, fmt.Sprintf(\"method == %q\", m.Method))\n\t}\n\tif m.Payload != nil {\n\t\tseg = append(seg, fmt.Sprintf(\"payload == %v\", format.MustJSON(m.Payload)))\n\t}\n\n\treturn fmt.Sprintf(\"(%s)\", strings.Join(seg, \" && \"))\n}", "title": "" }, { "docid": "e0bfc2aada8a2e88cb6703bd51d6f30c", "score": "0.5986177", "text": "func (req *InboundUpdateRequest) String() string {\n\treturn fmt.Sprintf(\"Cache %v, File %v, Priority %v\", req.Index, req.File, req.Priority)\n}", "title": "" }, { "docid": "fa0336d4aaf37e3da74d497b3c2c6646", "score": "0.59826636", "text": "func (v *EchoReq) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [1]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Msg: %v\", v.Msg)\n\ti++\n\n\treturn fmt.Sprintf(\"EchoReq{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "8ed2e0b5a546ff07f72516f0815538c2", "score": "0.59776795", "text": "func requestToString(q dns.Question, recursion bool, net string) string {\n\ts := q.Name + \"_\" + dns.TypeToString[q.Qtype] + \"_\" + dns.ClassToString[q.Qclass]\n\tif recursion {\n\t\ts += \"_1\"\n\t} else {\n\t\ts += \"_0\"\n\t}\n\ts += \"_\" + net\n\treturn s\n}", "title": "" }, { "docid": "a3a56419c48c90ab1862f3450929cc26", "score": "0.59578264", "text": "func (s MatchingRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ddf49fc762b3f579fde1464438e91a0d", "score": "0.5955938", "text": "func (s InputSourceRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d8527886a394c7119ddb01ae5d29750a", "score": "0.5949534", "text": "func (a *AuditEventRequest) String() string {\n\tconst format = `{\"path\":\"%s\",\"identity\":\"%s\"}`\n\treturn fmt.Sprintf(format, a.Path, a.Identity)\n}", "title": "" }, { "docid": "61997a54a22918cd0ed021f9cc3b8521", "score": "0.5940076", "text": "func (c *SChString) RequestString() (dat string) {\n\t// eq <- struct{}{}\n\treturn <-c.dat\n}", "title": "" }, { "docid": "2e40e1ec27eff271dd267caaf57d4f57", "score": "0.59349954", "text": "func (s NackRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "34808273e6bf7ffcb1e346243661d1cd", "score": "0.5920886", "text": "func (r NCreateRequest) String() string {\n\tls := new(common.LogString)\n\tls.AddF(\"NCreateRequest\\n\")\n\tls.AddS(r.NRequestCommon.String())\n\tls.AddF(\"Request: %s\\n\", r.ServiceName)\n\tls.AddF(\"Device - ID: %s type: %s model: %s\\n\", r.DeviceID, r.DeviceType, r.DeviceModel)\n\tls.AddF(\"Request - %s\\n\", r.MID.MID())\n\tls.AddF(\"Location - lat: %v lon: %v\\n\", r.Latitude, r.Longitude)\n\tls.AddF(\" %s\\n\", r.Address)\n\tls.AddF(\" %s, %s %s\\n\", r.Area, r.State, r.Zip)\n\tls.AddF(\"Description: %q\\n\", r.Description)\n\tls.AddF(\"Author(anon: %t) %s %s Email: %s Tel: %s\\n\", r.IsAnonymous, r.FirstName, r.LastName, r.Email, r.Phone)\n\treturn ls.Box(80)\n}", "title": "" }, { "docid": "2401eaff957d0c6771ad5f37d61798f3", "score": "0.59041697", "text": "func (o *Lineintegrationrequest) String() string {\n \n \n \n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "405d623e44f0bb738ed75be3599dc6d6", "score": "0.5867359", "text": "func (sq *StreamRequest) String() string {\n\tstr := fmt.Sprintf(\"[Request]\")\n\tstr += fmt.Sprintf(\"\\tChannel: %v\", sq.Channel)\n\tstr += fmt.Sprintf(\"\\tSource: %v\", sq.Source)\n\tstr += fmt.Sprintf(\"\\tTrack: %v\", sq.Track)\n\tstr += fmt.Sprintf(\"\\tWho: %s\\n\", sq.Who)\n\tstr += fmt.Sprintf(\"\\tStartedAt: %s\", sq.Time)\n\tstr += fmt.Sprintf(\"\\tDesciption: %s\\n\", sq.Desc)\n\treturn str\n}", "title": "" }, { "docid": "32d00e7e5f07bc9ffa0488b1a8f36ad2", "score": "0.58151925", "text": "func String(data string) c.Middleware {\n\treturn c.RequestProcessor(func(req *http.Request) error {\n\t\treq.Method = getMethod(req)\n\t\treq.Body = ioutil.NopCloser(strings.NewReader(data))\n\t\treq.ContentLength = int64(bytes.NewBufferString(data).Len())\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "78937342f3b90075842f04e2bc9a9db8", "score": "0.5814652", "text": "func FormatRequest(r ...Bytes) (string, error) {\n\tif len(r) == 0 {\n\t\treturn \"\", fmt.Errorf(\"no ranges provided\")\n\t}\n\tb := bytes.NewBuffer([]byte(\"bytes=\"))\n\tfor i, br := range r {\n\t\tif i != 0 {\n\t\t\tb.WriteString(\",\")\n\t\t}\n\t\tre, err := br.fmtRequest()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tb.WriteString(re)\n\t}\n\treturn b.String(), nil\n}", "title": "" }, { "docid": "4942b83d220d88c04836386e90629e76", "score": "0.58127975", "text": "func formatRequest(r *http.Request) string {\n // Create return string\n var request []string\n // Add the request string\n url := fmt.Sprintf(\"%v %v %v\", r.Method, r.URL, r.Proto)\n request = append(request, url)\n // Add the host\n request = append(request, fmt.Sprintf(\"Host: %v\", r.Host))\n // Loop through headers\n for name, headers := range r.Header {\n name = strings.ToLower(name)\n for _, h := range headers {\n request = append(request, fmt.Sprintf(\"%v: %v\", name, h))\n }\n }\n // If this is a POST, add post data\n if r.Method == \"POST\" {\n r.ParseForm()\n request = append(request, \"\\n\")\n request = append(request, r.Form.Encode())\n }\n // Return the request as a string\n return strings.Join(request, \"\\n\")\n}", "title": "" }, { "docid": "e79c2d8fa942f3f2e33493755c9a3a13", "score": "0.5788492", "text": "func String(req *http.Request, k string, def string) string {\n\tv, ok := Get(req, k)\n\tif !ok {\n\t\treturn def\n\t}\n\tif i, ok := v.(string); ok {\n\t\treturn i\n\t}\n\treturn def\n}", "title": "" }, { "docid": "b644f46fbb67e9fa1427a206a69b4453", "score": "0.5756545", "text": "func (client *DictionaryClient) getStringValidCreateRequest(ctx context.Context, options *DictionaryClientGetStringValidOptions) (*policy.Request, error) {\n\turlPath := \"/dictionary/prim/string/foo1.foo2.foo3\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "c4a327070d15c45a87e88c606c972f68", "score": "0.57511723", "text": "func (o *Patchpredictorrequest) String() string {\n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "92ce83edbd09371cd5f8bdfa113dcdb1", "score": "0.5738806", "text": "func requestToString(req *http.Request) string {\n\tvar dump []byte\n\tvar err error\n\n\tif req == nil {\n\t\treturn \"Request: <nil>\\n\"\n\t}\n\tdump, err = httputil.DumpRequestOut(req, true)\n\tif err != nil {\n\t\treturn fmt.Sprintf(\"fatal error dumping http request, %v\\n\", err)\n\t}\n\treturn fmt.Sprintf(\"Request: \\n%s\", dump)\n}", "title": "" }, { "docid": "a215664dbb0f54bcb863533efcee8c08", "score": "0.57335675", "text": "func (s RuleBasedMatchingRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b9d11935d50c86be7b8503507421e790", "score": "0.5725656", "text": "func (r NServiceRequest) String() string {\n\tls := new(common.LogString)\n\tls.AddF(\"NServiceRequest\\n\")\n\tls.AddS(r.NRequestCommon.String())\n\tls.AddF(\"Location - area: %v\\n\", r.Area)\n\treturn ls.Box(80)\n}", "title": "" }, { "docid": "1dc0cf0b5fd31a283905ab0ddf0ff5cf", "score": "0.5717425", "text": "func (c SearchReq) String() string {\n\tls := new(common.LogString)\n\tls.AddS(\"Search\\n\")\n\tls.AddF(\"Bkend: %s\\n\", c.bkend)\n\tls.AddF(\"Device ID: %s\\n\", c.DeviceID)\n\tls.AddF(\"Location\\n\")\n\tif math.Abs(c.LatitudeV) > 1 {\n\t\tls.AddF(\" lat: %v lon: %v\\n\", c.LatitudeV, c.LongitudeV)\n\t}\n\tif len(c.City) > 1 {\n\t\tls.AddF(\" \\n\", c.Address)\n\t\tls.AddF(\" %s, %s %s\\n\", c.City, c.State, c.Zip)\n\t}\n\treturn ls.Box(80)\n}", "title": "" }, { "docid": "9afe5f52c7209c5f76446c4b57bc5a97", "score": "0.56980395", "text": "func (o *Batchconversationeventrequest) String() string {\n\tj, _ := json.Marshal(o)\n\tstr, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n\treturn str\n}", "title": "" }, { "docid": "de1b447f11b294037d2b343799bb9b54", "score": "0.5690378", "text": "func (o *Createwebchatrequest) String() string {\n \n \n o.SkillIds = []string{\"\"} \n \n \n o.Attributes = map[string]string{\"\": \"\"} \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "df7624ee77a198e0d582dc2f30530693", "score": "0.56802154", "text": "func formatRequest(r *http.Request) string {\n\t// Create return string\n\tvar request []string\n\t// Add the request string\n\turl := fmt.Sprintf(\"%v %v %v\", r.Method, r.URL, r.Proto)\n\trequest = append(request, url)\n\t// Add the host\n\trequest = append(request, fmt.Sprintf(\"Host: %v\", r.Host))\n\t// Loop through headers\n\tfor name, headers := range r.Header {\n\t\tname = strings.ToLower(name)\n\t\tfor _, h := range headers {\n\t\t\trequest = append(request, fmt.Sprintf(\"%v: %v\", name, h))\n\t\t}\n\t}\n\n\t// If this is a POST, add post data\n\tif r.Method == \"POST\" {\n\t\t r.ParseForm()\n\t\t request = append(request, \"\\n\")\n\t\t request = append(request, r.Form.Encode())\n\t}\n\t // Return the request as a string\n\t return strings.Join(request, \"\\n\")\n}", "title": "" }, { "docid": "3d061a1e08a5a9d202963bd3af62d43d", "score": "0.5676698", "text": "func (rt RequestType) String() string {\n\tswitch rt {\n\tcase RequestTypeGet:\n\t\treturn getString\n\tcase RequestTypeSet:\n\t\treturn setString\n\tcase RequestTypeAdd:\n\t\treturn addString\n\tcase RequestTypeReplace:\n\t\treturn replaceString\n\tcase RequestTypeDelete:\n\t\treturn deleteString\n\tcase RequestTypeIncr:\n\t\treturn incrString\n\tcase RequestTypeDecr:\n\t\treturn decrString\n\tcase RequestTypeQuit:\n\t\treturn quitString\n\tcase RequestTypeGetQ:\n\t\treturn getQString\n\tcase RequestTypeNoop:\n\t\treturn noopString\n\tcase RequestTypeVersion:\n\t\treturn versionString\n\tcase RequestTypeGetK:\n\t\treturn getKString\n\tcase RequestTypeGetKQ:\n\t\treturn getKQString\n\tcase RequestTypeAppend:\n\t\treturn appendString\n\tcase RequestTypePrepend:\n\t\treturn prependString\n\tcase RequestTypeSetQ:\n\t\treturn setQString\n\tcase RequestTypeAddQ:\n\t\treturn addQString\n\tcase RequestTypeReplaceQ:\n\t\treturn replaceQString\n\tcase RequestTypeIncrQ:\n\t\treturn incrQString\n\tcase RequestTypeDecrQ:\n\t\treturn decrQString\n\tcase RequestTypeQuitQ:\n\t\treturn quitQString\n\tcase RequestTypeAppendQ:\n\t\treturn appendQString\n\tcase RequestTypePrependQ:\n\t\treturn prependQString\n\tcase RequestTypeTouch:\n\t\treturn touchString\n\tcase RequestTypeGat:\n\t\treturn gatString\n\tcase RequestTypeGatQ:\n\t\treturn gatQString\n\t}\n\treturn unknownString\n}", "title": "" }, { "docid": "06e6318569c28b61904be0b0fa6e2383", "score": "0.5669945", "text": "func (o *Messagingsettingdefaultrequest) String() string {\n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "5ba0e339b46104e4c12081723df71933", "score": "0.5668111", "text": "func (s *RequestModifier) String(body string) {\n\tif s.Request.Method == \"GET\" || s.Request.Method == \"HEAD\" {\n\t\treturn\n\t}\n\ts.Request.Body = ioutil.NopCloser(bytes.NewReader([]byte(body)))\n}", "title": "" }, { "docid": "bc943927cc70ebbd25068cc7eff8fd96", "score": "0.56577843", "text": "func (o *Updatebusinessunitsettingsrequest) String() string {\n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "b7baeb807bc93716e9e8258acfd680b6", "score": "0.56528777", "text": "func formatRequest(r *http.Request) string {\n\t// Create return string\n\tvar request []string\n\t// Add the request string\n\turl := fmt.Sprintf(\"%v %v %v\", r.Method, r.URL, r.Proto)\n\trequest = append(request, url)\n\t// Add the host\n\trequest = append(request, fmt.Sprintf(\"Host: %v\", r.Host))\n\t// Loop through headers\n\tfor name, headers := range r.Header {\n\t\tname = strings.ToLower(name)\n\t\tfor _, h := range headers {\n\t\t\trequest = append(request, fmt.Sprintf(\"%v: %v\", name, h))\n\t\t}\n\t}\n\n\t// If this is a POST, add post data\n\tif r.Method == \"POST\" {\n\t\tr.ParseForm()\n\t\trequest = append(request, \"\\n\")\n\t\trequest = append(request, r.Form.Encode())\n\t}\n\t// Return the request as a string\n\treturn strings.Join(request, \"\\n\")\n}", "title": "" }, { "docid": "b7baeb807bc93716e9e8258acfd680b6", "score": "0.56528777", "text": "func formatRequest(r *http.Request) string {\n\t// Create return string\n\tvar request []string\n\t// Add the request string\n\turl := fmt.Sprintf(\"%v %v %v\", r.Method, r.URL, r.Proto)\n\trequest = append(request, url)\n\t// Add the host\n\trequest = append(request, fmt.Sprintf(\"Host: %v\", r.Host))\n\t// Loop through headers\n\tfor name, headers := range r.Header {\n\t\tname = strings.ToLower(name)\n\t\tfor _, h := range headers {\n\t\t\trequest = append(request, fmt.Sprintf(\"%v: %v\", name, h))\n\t\t}\n\t}\n\n\t// If this is a POST, add post data\n\tif r.Method == \"POST\" {\n\t\tr.ParseForm()\n\t\trequest = append(request, \"\\n\")\n\t\trequest = append(request, r.Form.Encode())\n\t}\n\t// Return the request as a string\n\treturn strings.Join(request, \"\\n\")\n}", "title": "" }, { "docid": "97131c73ec236487b812308fafc10ad0", "score": "0.5644806", "text": "func formatRequest(r *http.Request) string {\n\t// Create return string\n\tvar request []string\n\t// Add the request string\n\turl := fmt.Sprintf(\"%v %v %v\", r.Method, r.URL, r.Proto)\n\trequest = append(request, url)\n\t// Add the host\n\trequest = append(request, fmt.Sprintf(\"Host: %v\", r.Host))\n\t// Loop through headers\n\tfor name, headers := range r.Header {\n\t\tname = strings.ToLower(name)\n\t\tfor _, h := range headers {\n\t\t\trequest = append(request, fmt.Sprintf(\"%v: %v\", name, h))\n\t\t}\n\t}\n\t// If this is a POST, add post data\n\tif r.Method == \"POST\" || r.Method == \"PUT\" || r.Method == \"PATCH\" {\n\t\tr.ParseForm()\n\t\trequest = append(request, \"\\n\")\n\t\trequest = append(request, r.Form.Encode())\n\t}\n\t// Return the request as a string\n\treturn strings.Join(request, \"\\n\")\n}", "title": "" }, { "docid": "11154f4e0d4f5c45d1080deebd8c18d0", "score": "0.5637781", "text": "func FormatRequest(r *http.Request) string {\n\t// Create return string\n\tvar request []string\n\t// Add the request string\n\turl := fmt.Sprintf(\"%v %v %v\", r.Method, r.URL, r.Proto)\n\trequest = append(request, url)\n\t// Add the host\n\trequest = append(request, fmt.Sprintf(\"Host: %v\", r.Host))\n\t// Loop through headers\n\tfor name, headers := range r.Header {\n\t\tname = strings.ToLower(name)\n\t\tfor _, h := range headers {\n\t\t\trequest = append(request, fmt.Sprintf(\"%v: %v\", name, h))\n\t\t}\n\t}\n\n\t// If this is a POST, add post data\n\tif r.Method == \"POST\" {\n\t\tr.ParseForm()\n\t\trequest = append(request, \"\\n\")\n\t\trequest = append(request, r.Form.Encode())\n\t}\n\t// Return the request as a string\n\treturn strings.Join(request, \"\\n\")\n}", "title": "" }, { "docid": "11154f4e0d4f5c45d1080deebd8c18d0", "score": "0.5637781", "text": "func FormatRequest(r *http.Request) string {\n\t// Create return string\n\tvar request []string\n\t// Add the request string\n\turl := fmt.Sprintf(\"%v %v %v\", r.Method, r.URL, r.Proto)\n\trequest = append(request, url)\n\t// Add the host\n\trequest = append(request, fmt.Sprintf(\"Host: %v\", r.Host))\n\t// Loop through headers\n\tfor name, headers := range r.Header {\n\t\tname = strings.ToLower(name)\n\t\tfor _, h := range headers {\n\t\t\trequest = append(request, fmt.Sprintf(\"%v: %v\", name, h))\n\t\t}\n\t}\n\n\t// If this is a POST, add post data\n\tif r.Method == \"POST\" {\n\t\tr.ParseForm()\n\t\trequest = append(request, \"\\n\")\n\t\trequest = append(request, r.Form.Encode())\n\t}\n\t// Return the request as a string\n\treturn strings.Join(request, \"\\n\")\n}", "title": "" }, { "docid": "87ac0e0cc971684a74287f86657e6a5a", "score": "0.5604008", "text": "func (s AckRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3baddb4871f0469164ffee7dad652247", "score": "0.5589545", "text": "func (s PollRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c66bc020287c8239b27c7993eaf3f88e", "score": "0.55859596", "text": "func generateRequestJSONString(\n\tendpoint string,\n\tmethod string,\n\tjsonString string,\n\th func(http.ResponseWriter, *http.Request)) (rr *httptest.ResponseRecorder, r *http.Request) {\n\n\tbody := strings.NewReader(jsonString)\n\n\tr, _ = http.NewRequest(method, endpoint, body)\n\n\trr = httptest.NewRecorder()\n\thandler := http.HandlerFunc(h)\n\thandler.ServeHTTP(rr, r)\n\n\treturn rr, r\n}", "title": "" }, { "docid": "d980b6214fdcade0b88b62e7c1493874", "score": "0.55712414", "text": "func (r RequestID) String() string {\n\treturn uuid.Must(uuid.FromBytes([]byte(r.string))).String()\n}", "title": "" }, { "docid": "6784345936a58950e02745cb90664dc6", "score": "0.5558429", "text": "func getRequestMethod(reqStr string) string {\n\tsplitReq := strings.Split(reqStr, \" \")\n\tif len(splitReq) < 1 {\n\t\treturn \"\"\n\t}\n\n\treturn splitReq[0]\n}", "title": "" }, { "docid": "59ce2c900dfc77deea8c20c1748afc48", "score": "0.5557012", "text": "func formatRequest(r *http.Request) string {\n\t// Create return string\n\tvar request []string\n\t// Add the request string\n\turl := fmt.Sprintf(\"%v %v %v\", r.Method, r.URL, r.Proto)\n\trequest = append(request, url)\n\t// Add the host\n\trequest = append(request, fmt.Sprintf(\"Host: %v\", r.Host))\n\n\tvar headerNames []string\n\tfor name := range r.Header {\n\t\theaderNames = append(headerNames, name)\n\t}\n\tsort.Strings(headerNames)\n\n\t// Loop through headers\n\tfor _, name := range headerNames {\n\t\tfor _, h := range r.Header[name] {\n\t\t\trequest = append(request, fmt.Sprintf(\"%v: %v\", name, h))\n\t\t}\n\t}\n\n\t// If this is a POST, add post data\n\tif r.Method == \"POST\" && r.Header.Get(\"Content-Type\") == \"application/x-www-form-urlencoded\" {\n\t\t_ = r.ParseForm()\n\t\trequest = append(request, r.Form.Encode())\n\t} else {\n\t\tbodyBytes, _ := io.ReadAll(r.Body)\n\t\trequest = append(request, string(bodyBytes))\n\t}\n\t// Return the request as a string\n\treturn strings.Join(request, \"\\n\")\n}", "title": "" }, { "docid": "70aff836242992f0f51a7854ad1aad46", "score": "0.5522567", "text": "func (v *ReapplyEventsRequest) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [3]string\n\ti := 0\n\tif v.DomainName != nil {\n\t\tfields[i] = fmt.Sprintf(\"DomainName: %v\", *(v.DomainName))\n\t\ti++\n\t}\n\tif v.WorkflowExecution != nil {\n\t\tfields[i] = fmt.Sprintf(\"WorkflowExecution: %v\", v.WorkflowExecution)\n\t\ti++\n\t}\n\tif v.Events != nil {\n\t\tfields[i] = fmt.Sprintf(\"Events: %v\", v.Events)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"ReapplyEventsRequest{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "bd99c0d0054ae5cb7f67b71002f8c35f", "score": "0.5520807", "text": "func formatRequest(r *http.Request) string {\n\t// Create return string\n\tvar request []string\n\t// Add the request string\n\turl := fmt.Sprintf(\"%v %v %v\", r.Method, r.URL, r.Proto)\n\trequest = append(request, url)\n\t// Add the host\n\trequest = append(request, fmt.Sprintf(\"Host: %v\", r.Host))\n\t// Loop through headers\n\tfor name, headers := range r.Header {\n\t name = strings.ToLower(name)\n\t for _, h := range headers {\n\t\trequest = append(request, fmt.Sprintf(\"%v: %v\\n\", name, h))\n\t }\n\t}\n\t\n\tr.ParseForm()\n\n\tr.ParseMultipartForm(1234567)\n\n\tfmt.Println(\"Form data\")\n\n\tfor k, v := range r.Form {\n fmt.Println(\"key:\", k)\n fmt.Println(\"val:\", strings.Join(v, \"\"))\n\t}\n\t\n\tfmt.Println(\"PostForm data\")\n\n\tfor k, v := range r.PostForm {\n fmt.Println(\"key:\", k)\n fmt.Println(\"val:\", strings.Join(v, \"\"))\n\t}\n\t\n\t// fmt.Println(\"MultipartForm data\")\n\n\t// for k, v := range r.MultipartForm {\n // fmt.Println(\"key:\", k)\n // fmt.Println(\"val:\", strings.Join(v, \"\"))\n // }\n\t\n\t// If this is a POST, add post data\n\tif r.Method == \"POST\" {\n\t r.ParseForm()\n\t request = append(request, \"\\n\")\n\t request = append(request, r.Form.Encode())\n\t} \n\t // Return the request as a string\n\t return strings.Join(request, \"\\n\")\n }", "title": "" }, { "docid": "a091b5ee832029af636e949c13cd09cb", "score": "0.55150783", "text": "func generateBaseString(r *gohttp.Request, paramString string) string {\n\tmethod := strings.ToUpper(r.Method)\n\turlString := fmt.Sprintf(\"%s://%s%s\", r.URL.Scheme, r.URL.Host, r.URL.Path)\n\treturn fmt.Sprintf(\"%s&%s&%s\", method, encodeURI(urlString), encodeURI(paramString))\n}", "title": "" }, { "docid": "a64d626af25a3af0a26d03952b13389c", "score": "0.55121595", "text": "func (m *Message) String() string {\n\tfields := \"\"\n\tfor _, f := range m.req.fields {\n\t\tfields += f.String() + \",\"\n\t}\n\tif len(fields) > 0 {\n\t\tfields = fields[:len(fields)-1]\n\t}\n\n\tstr := `{\"request\":[` + fields + `]`\n\n\tif m.resp != nil {\n\t\tstr += `,\"response\":` + m.resp.String()\n\t}\n\n\tif m.errs != nil && len(m.errs.Types()) > 1 {\n\t\terrs, _ := NewUnionSchema(m.errs.Types()[1:])\n\t\tstr += `,\"errors\":` + errs.String()\n\t}\n\n\tstr += \"}\"\n\treturn str\n}", "title": "" }, { "docid": "9cb9b01a321b6e3981f3ecf0ddd54671", "score": "0.5508205", "text": "func (s ConversationLogsRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "be96920f88a24170bb85eddd36506609", "score": "0.55012596", "text": "func buildMetricsV2DefinitionRequestString(metricID string) string {\n\treturn fmt.Sprintf(\"%s/%s\", dynatrace.MetricsPath, url.PathEscape(metricID))\n}", "title": "" }, { "docid": "cf2e8fcf03eee60bfeaaa5a137817dff", "score": "0.5497551", "text": "func (addReq *AddRequest) String() (dump string) {\n\tdump = fmt.Sprintf(\"dn: %s\\n\", addReq.Entry.DN)\n\tfor _, attr := range addReq.Entry.Attributes {\n\t\tfor _, val := range attr.Values {\n\t\t\tdump += fmt.Sprintf(\"%s: %s\\n\", attr.Name, val)\n\t\t}\n\t}\n\tdump += fmt.Sprintf(\"\\n\")\n\treturn\n}", "title": "" }, { "docid": "83f322405d264f468d479c4ae1afd244", "score": "0.5492839", "text": "func (session *OAuthSession) mkBaseStringRequest(request *http.Request) (string, map[string]string) {\n\theader := session.mkAuthorizationHeader()\n\tvals := request.URL.Query()\n\tfor k, v := range header {\n\t\tvals[k] = []string{v}\n\t}\n\treturn request.Method + \"&\" + Escape(baseURI(request.URL)) + \"&\" +\n\t\tEscape(encodeParameters(vals)), header\n}", "title": "" }, { "docid": "00c860bdc8adcc5691df5cbf55756d43", "score": "0.5476946", "text": "func (s LogSettingsRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b52172f748ac459c340674822640b2af", "score": "0.54691005", "text": "func (o LunMapRequest) String() string {\n\tvar buffer bytes.Buffer\n\tif o.AdditionalReportingNodePtr != nil {\n\t\tbuffer.WriteString(fmt.Sprintf(\"%s: %v\\n\", \"additional-reporting-node\", *o.AdditionalReportingNodePtr))\n\t} else {\n\t\tbuffer.WriteString(fmt.Sprintf(\"additional-reporting-node: nil\\n\"))\n\t}\n\tif o.ForcePtr != nil {\n\t\tbuffer.WriteString(fmt.Sprintf(\"%s: %v\\n\", \"force\", *o.ForcePtr))\n\t} else {\n\t\tbuffer.WriteString(fmt.Sprintf(\"force: nil\\n\"))\n\t}\n\tif o.InitiatorGroupPtr != nil {\n\t\tbuffer.WriteString(fmt.Sprintf(\"%s: %v\\n\", \"initiator-group\", *o.InitiatorGroupPtr))\n\t} else {\n\t\tbuffer.WriteString(fmt.Sprintf(\"initiator-group: nil\\n\"))\n\t}\n\tif o.LunIdPtr != nil {\n\t\tbuffer.WriteString(fmt.Sprintf(\"%s: %v\\n\", \"lun-id\", *o.LunIdPtr))\n\t} else {\n\t\tbuffer.WriteString(fmt.Sprintf(\"lun-id: nil\\n\"))\n\t}\n\tif o.PathPtr != nil {\n\t\tbuffer.WriteString(fmt.Sprintf(\"%s: %v\\n\", \"path\", *o.PathPtr))\n\t} else {\n\t\tbuffer.WriteString(fmt.Sprintf(\"path: nil\\n\"))\n\t}\n\treturn buffer.String()\n}", "title": "" }, { "docid": "34b32d1704eb859446c5bff08c02be7a", "score": "0.5462235", "text": "func (c *CreateSessionRequest) String() string {\n\treturn fmt.Sprintf(\"%v, %v, %v, %v, %v, %v, %v, %d, %d\",\n\t\tc.TypeID,\n\t\tc.RequestHeader,\n\t\tc.ClientDescription,\n\t\tc.ServerURI,\n\t\tc.EndpointURL,\n\t\tc.ClientNonce,\n\t\tc.ClientCertificate,\n\t\tc.RequestedSessionTimeout,\n\t\tc.MaxResponseMessageSize,\n\t)\n}", "title": "" }, { "docid": "f259d65029c85010c6baecda08690295", "score": "0.5453731", "text": "func (tx *Transaction) ParseRequestString(data string) error {\n\tbuf := bufio.NewReader(strings.NewReader(data))\n\treq, err := http.ReadRequest(buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = tx.ParseRequestObjectHeaders(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = tx.ParseRequestObjectBody(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1f3f23b6eeeffe4d644dd809f9490f66", "score": "0.5448717", "text": "func (o *Trustorauditqueryrequest) String() string {\n \n o.TrusteeUserIds = []string{\"\"} \n \n \n \n o.Facets = []Facet{{}} \n o.Filters = []Filter{{}} \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "a08ef4b176e6fd8c7ddb8dca386c97c3", "score": "0.54450893", "text": "func (s *RequestModifier) ReadString() (string, error) {\n\tbuf, err := ioutil.ReadAll(s.Request.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\ts.Bytes(buf)\n\treturn string(buf), nil\n}", "title": "" }, { "docid": "f485031f26e27d47f98920d5ac1701fe", "score": "0.54285413", "text": "func (s InvalidRequestException) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f485031f26e27d47f98920d5ac1701fe", "score": "0.54285413", "text": "func (s InvalidRequestException) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f485031f26e27d47f98920d5ac1701fe", "score": "0.54285413", "text": "func (s InvalidRequestException) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0374b96889f4b2861fffd7b270181520", "score": "0.5426518", "text": "func (d *DirectRequestJobSpec) String() (string, error) {\n\tdirectRequestTemplateString := `type = \"directrequest\"\nschemaVersion = 1\nname = \"{{.Name}}\"\nmaxTaskDuration = \"99999s\"\ncontractAddress = \"{{.ContractAddress}}\"\nexternalJobID = \"{{.ExternalJobID}}\"\nminIncomingConfirmations = {{.MinIncomingConfirmations}}\nobservationSource = \"\"\"\n{{.ObservationSource}}\n\"\"\"`\n\treturn MarshallTemplate(d, \"Direct Request Job\", directRequestTemplateString)\n}", "title": "" }, { "docid": "1f174b8b93af3907b3efeb2b79ea5fc5", "score": "0.5419732", "text": "func (req *Request) parseRequest(str string) error {\n\tchunks := strings.Split(str, \" \")\n\tif len(chunks) != 3 {\n\t\treturn fmt.Errorf(\"invalid request format\")\n\t}\n\n\treq.Method = chunks[0]\n\treq.Path = chunks[1]\n\treq.Proto = chunks[2]\n\n\treturn nil\n}", "title": "" }, { "docid": "cdc86552248060c1ac357dd31c3dedd7", "score": "0.54174024", "text": "func (s StandardsSubscriptionRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "020654631a3ba32ec2ce439161431b29", "score": "0.54125357", "text": "func (r NRequestCommon) String() string {\n\tls := new(common.LogString)\n\tls.AddF(\"Type: %s\\n\", r.Rtype.String())\n\tls.AddF(\"ID: %v\\n\", r.ID)\n\tls.AddF(\"Route: %s\\n\", r.Route.String())\n\treturn ls.Box(40)\n}", "title": "" }, { "docid": "60f4214855c612001ca84597f683748b", "score": "0.53890544", "text": "func (client *DictionaryClient) putStringValidCreateRequest(ctx context.Context, arrayBody map[string]*string, options *DictionaryClientPutStringValidOptions) (*policy.Request, error) {\n\turlPath := \"/dictionary/prim/string/foo1.foo2.foo3\"\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, arrayBody); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "0583d4ca33b0dce08167b1e408e59797", "score": "0.5387476", "text": "func (ctx *RequestCtx) String() string {\n\treturn fmt.Sprintf(\"#%016X - %s<->%s - %s %s\", ctx.ID(), ctx.LocalAddr(), ctx.RemoteAddr(), ctx.Request.Header.Method(), ctx.URI().FullURI())\n}", "title": "" }, { "docid": "9c721adf9e991729cc39fe5a14d49ad6", "score": "0.53874636", "text": "func (o *Replacerequest) String() string {\n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "32377232f3ebaf0df16fca3c65925914", "score": "0.53783435", "text": "func RequestKeyValueString(ctx *fasthttp.RequestCtx, key string) string {\n\tj, err := json.Marshal(ctx.UserValue(key))\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(j)\n}", "title": "" }, { "docid": "1772f826323e9406147bb68644da384a", "score": "0.53780526", "text": "func (o *Faxsendrequest) String() string {\n \n o.Addresses = []string{\"\"} \n \n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "7c597462d9de1b7780a4bdcc0812490c", "score": "0.53744924", "text": "func (j *JSONReq) JSONString() string {\n\treturn string(j.data)\n}", "title": "" }, { "docid": "fe81e33a1164370ebeb79c74dd685a88", "score": "0.5368812", "text": "func (o *Bureschedulerequest) String() string {\n \n \n o.AgentIds = []string{\"\"} \n o.ActivityCodeIds = []string{\"\"} \n o.ManagementUnitIds = []string{\"\"} \n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "b1910c853bef41d9ec0a39993a6b5e13", "score": "0.5364088", "text": "func (o *Coachingslotsrequest) String() string {\n \n \n o.AttendeeIds = []string{\"\"} \n o.FacilitatorIds = []string{\"\"} \n o.InterruptibleAppointmentIds = []string{\"\"} \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "9ba32c64981fcda48324767679a51691", "score": "0.53620034", "text": "func crInfoString(cr *cmapi.CertificateRequest) string {\n\tif cr == nil {\n\t\treturn \"No CertificateRequest found for this Certificate\\n\"\n\t}\n\n\tcrFormat := `\n Name: %s\n Namespace: %s\n Conditions:\n %s`\n\tconditionMsg := \"\"\n\tfor _, con := range cr.Status.Conditions {\n\t\tconditionMsg += fmt.Sprintf(\" %s: %s, Reason: %s, Message: %s\\n\", con.Type, con.Status, con.Reason, con.Message)\n\t}\n\tif conditionMsg == \"\" {\n\t\tconditionMsg = \" No Conditions set\\n\"\n\t}\n\tinfos := fmt.Sprintf(crFormat, cr.Name, cr.Namespace, conditionMsg)\n\treturn fmt.Sprintf(\"CertificateRequest:%s\", infos)\n}", "title": "" }, { "docid": "4025f3d3da073286be0eb5c31af27ba4", "score": "0.5360075", "text": "func (c *JwtMiddleware) String() string {\n\treturn fmt.Sprintf(\"service=%v required=%v\", c.Service, c.Required)\n}", "title": "" }, { "docid": "fe3f4b3edee6fcc6cc669caa31b6450d", "score": "0.53552645", "text": "func (s IpAddressRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7d348461b1d950b32683d1ed176ad708", "score": "0.5321609", "text": "func (o SnapmirrorQuiesceRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "2a77b0e542dd5c3e1111ea91327126cc", "score": "0.5312068", "text": "func ParseReq(txt string) (*Req, error) {\n\tlyx := strings.HasPrefix(txt, \"\\n\")\n\thead := txt\n\tif len(head) > 40 {\n\t\thead = head[:40]\n\t}\n\tdefid := ReReqID.FindStringSubmatchIndex(txt)\n\tif len(defid) == 0 {\n\t\tif reReqIDBad.MatchString(head) {\n\t\t\treturn nil, fmt.Errorf(\"malformed requirement: found only malformed ID: %q (doesn't match %q)\", head, ReReqID)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"malformed requirement: missing ID in first 40 characters: %q\", head)\n\t}\n\n\tif lyx {\n\t\tif defid[0] > 20 {\n\t\t\treturn nil, fmt.Errorf(\"malformed requirement: too much heading garbage before ID: %q\", head)\n\t\t}\n\t} else {\n\t\tif defid[0] > 0 {\n\t\t\treturn nil, fmt.Errorf(\"malformed requirement: ID must be at the start of the title: %q\", head)\n\t\t}\n\t}\n\n\tr := &Req{\n\t\tID: txt[defid[0]:defid[1]],\n\t\tAttributes: map[string]string{},\n\t}\n\n\t// chop defining ID and any punctuation\n\ttxt = strings.TrimLeftFunc(txt[defid[1]:], unicode.IsPunct)\n\ttxt = strings.TrimLeftFunc(txt, unicode.IsSpace)\n\n\tvar attributesStart int\n\tkwdMatches := reReqKWD.FindAllStringSubmatchIndex(txt, -1)\n\tif len(kwdMatches) == 0 {\n\t\treturn nil, fmt.Errorf(\"requirement %s contains no attributes\", r.ID)\n\t}\n\tif lyx {\n\t\tattributesStart = kwdMatches[0][0]\n\t} else {\n\t\tattributesStart = strings.Index(txt, \"\\n###### Attributes:\\n\")\n\t}\n\tfor i, v := range kwdMatches {\n\t\tkey := strings.ToUpper(txt[v[4]:v[5]])\n\t\tif key == \"PARENT\" { // make our lives easier, accept both, output only PARENTS\n\t\t\tkey = \"PARENTS\"\n\t\t}\n\t\te := len(txt)\n\t\tif i < len(kwdMatches)-1 {\n\t\t\te = kwdMatches[i+1][0]\n\t\t}\n\t\tif _, ok := r.Attributes[key]; ok {\n\t\t\treturn nil, fmt.Errorf(\"requirement %s contains duplicate attribute: %q\", r.ID, key)\n\t\t}\n\t\tr.Attributes[key] = strings.TrimSpace(txt[v[1]:e])\n\t}\n\n\t// TEXT is anything up to the first keyword we found\n\ttxt = txt[:attributesStart]\n\n\t// PARENTS must be punctuation/space separated list of parseable req-ids.\n\tparents := r.Attributes[\"PARENTS\"]\n\tparmatch := ReReqID.FindAllStringSubmatchIndex(parents, -1)\n\tfor i, ids := range parmatch {\n\t\tval := parents[ids[0]:ids[1]]\n\t\tr.ParentIds = append(r.ParentIds, val)\n\t\tif i > 0 {\n\t\t\tsep := parents[parmatch[i-1][1]:ids[0]]\n\t\t\tif strings.TrimFunc(sep, func(r rune) bool { return unicode.IsSpace(r) || unicode.IsPunct(r) }) != \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"requirement %s parents: unparseable as list of requirement ids: %q in %q\", r.ID, sep, parents)\n\t\t\t}\n\t\t}\n\t}\n\n\tlevel, ok := config.ReqTypeToReqLevel[r.ReqType()]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Invalid request type: %q\", r.ReqType())\n\t}\n\tr.Level = level\n\n\tparts := strings.SplitN(strings.TrimSpace(txt), \"\\n\", 2)\n\tr.Title = parts[0]\n\tr.Body = formatBodyAsHTML(parts[1])\n\treturn r, nil\n}", "title": "" }, { "docid": "08791f2b20126dd77893380481819173", "score": "0.5305574", "text": "func (c *Context) String(s string) error {\n\treturn e(\"response string error\", c.Write([]byte(s)))\n}", "title": "" }, { "docid": "f9d4a28560c05d11c04d93623f744c44", "score": "0.53002816", "text": "func (m *MigoHTTPRequest) String() (data string, err error) {\n\tdataByte, err := m.Bytes()\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn string(dataByte), nil\n}", "title": "" }, { "docid": "5c4558727d5e4649d6105eb1b77e25b9", "score": "0.5295826", "text": "func (req *CreateNetworkContainerRequest) String() string {\n\treturn fmt.Sprintf(\"CreateNetworkContainerRequest\"+\n\t\t\"{Version: %s, NetworkContainerType: %s, NetworkContainerid: %s, PrimaryInterfaceIdentifier: %s, \"+\n\t\t\"LocalIPConfiguration: %+v, IPConfiguration: %+v, SecondaryIPConfigs: %+v, MultitenancyInfo: %+v, \"+\n\t\t\"AllowHostToNCCommunication: %t, AllowNCToHostCommunication: %t}\",\n\t\treq.Version, req.NetworkContainerType, req.NetworkContainerid, req.PrimaryInterfaceIdentifier, req.LocalIPConfiguration,\n\t\treq.IPConfiguration, req.SecondaryIPConfigs, req.MultiTenancyInfo, req.AllowHostToNCCommunication, req.AllowNCToHostCommunication)\n}", "title": "" }, { "docid": "705563aff437d3e3a6e5bb9f960c1c0f", "score": "0.529285", "text": "func BodyString(ctx context.Context) string {\n\treturn string(Body(ctx))\n}", "title": "" }, { "docid": "82a0062f901081fdf7a852b2b6fe77e0", "score": "0.52852833", "text": "func (r BidRequest) String() string {\n\treturn fmt.Sprintf(\"[%s;%d]\", r.ID, len(r.Impressions))\n}", "title": "" }, { "docid": "8543d4db0f63266a1c4eaf7238cea750", "score": "0.52840936", "text": "func (v *UpdateDomainRequest) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [7]string\n\ti := 0\n\tif v.Name != nil {\n\t\tfields[i] = fmt.Sprintf(\"Name: %v\", *(v.Name))\n\t\ti++\n\t}\n\tif v.UpdatedInfo != nil {\n\t\tfields[i] = fmt.Sprintf(\"UpdatedInfo: %v\", v.UpdatedInfo)\n\t\ti++\n\t}\n\tif v.Configuration != nil {\n\t\tfields[i] = fmt.Sprintf(\"Configuration: %v\", v.Configuration)\n\t\ti++\n\t}\n\tif v.ReplicationConfiguration != nil {\n\t\tfields[i] = fmt.Sprintf(\"ReplicationConfiguration: %v\", v.ReplicationConfiguration)\n\t\ti++\n\t}\n\tif v.SecurityToken != nil {\n\t\tfields[i] = fmt.Sprintf(\"SecurityToken: %v\", *(v.SecurityToken))\n\t\ti++\n\t}\n\tif v.DeleteBadBinary != nil {\n\t\tfields[i] = fmt.Sprintf(\"DeleteBadBinary: %v\", *(v.DeleteBadBinary))\n\t\ti++\n\t}\n\tif v.FailoverTimeoutInSeconds != nil {\n\t\tfields[i] = fmt.Sprintf(\"FailoverTimeoutInSeconds: %v\", *(v.FailoverTimeoutInSeconds))\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"UpdateDomainRequest{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "98b4374c4faeb0346b4ff24c5ca07edd", "score": "0.5281658", "text": "func GetStringBodyHTTPRequest(r *http.Request) *string {\n\tif r == nil {\n\t\treturn nil\n\t}\n\n\theaders, err := httputil.DumpRequest(r, false)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\theadersAndBody, err := httputil.DumpRequest(r, true)\n\tif err != nil || len(headersAndBody) == 0 {\n\t\treturn nil\n\t}\n\n\tbody := headersAndBody[len(headers):]\n\ts := string(bytes.TrimSpace(body))\n\treturn &s\n}", "title": "" }, { "docid": "324bafdaf43afcce9aa634ae6a1c3356", "score": "0.5276855", "text": "func mandatoryStringr(str, err string) Stringr {\n\ts := Stringr{}\n\ts.Value = str\n\tif str == \"\" {\n\t\ts.IsValid = false\n\t\ts.Error = fmt.Errorf(err)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "121e62dfb41dd22cdf5246a8fb9d0f86", "score": "0.5263949", "text": "func (v *RegisterDomainRequest) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [14]string\n\ti := 0\n\tif v.Name != nil {\n\t\tfields[i] = fmt.Sprintf(\"Name: %v\", *(v.Name))\n\t\ti++\n\t}\n\tif v.Description != nil {\n\t\tfields[i] = fmt.Sprintf(\"Description: %v\", *(v.Description))\n\t\ti++\n\t}\n\tif v.OwnerEmail != nil {\n\t\tfields[i] = fmt.Sprintf(\"OwnerEmail: %v\", *(v.OwnerEmail))\n\t\ti++\n\t}\n\tif v.WorkflowExecutionRetentionPeriodInDays != nil {\n\t\tfields[i] = fmt.Sprintf(\"WorkflowExecutionRetentionPeriodInDays: %v\", *(v.WorkflowExecutionRetentionPeriodInDays))\n\t\ti++\n\t}\n\tif v.EmitMetric != nil {\n\t\tfields[i] = fmt.Sprintf(\"EmitMetric: %v\", *(v.EmitMetric))\n\t\ti++\n\t}\n\tif v.Clusters != nil {\n\t\tfields[i] = fmt.Sprintf(\"Clusters: %v\", v.Clusters)\n\t\ti++\n\t}\n\tif v.ActiveClusterName != nil {\n\t\tfields[i] = fmt.Sprintf(\"ActiveClusterName: %v\", *(v.ActiveClusterName))\n\t\ti++\n\t}\n\tif v.Data != nil {\n\t\tfields[i] = fmt.Sprintf(\"Data: %v\", v.Data)\n\t\ti++\n\t}\n\tif v.SecurityToken != nil {\n\t\tfields[i] = fmt.Sprintf(\"SecurityToken: %v\", *(v.SecurityToken))\n\t\ti++\n\t}\n\tif v.IsGlobalDomain != nil {\n\t\tfields[i] = fmt.Sprintf(\"IsGlobalDomain: %v\", *(v.IsGlobalDomain))\n\t\ti++\n\t}\n\tif v.HistoryArchivalStatus != nil {\n\t\tfields[i] = fmt.Sprintf(\"HistoryArchivalStatus: %v\", *(v.HistoryArchivalStatus))\n\t\ti++\n\t}\n\tif v.HistoryArchivalURI != nil {\n\t\tfields[i] = fmt.Sprintf(\"HistoryArchivalURI: %v\", *(v.HistoryArchivalURI))\n\t\ti++\n\t}\n\tif v.VisibilityArchivalStatus != nil {\n\t\tfields[i] = fmt.Sprintf(\"VisibilityArchivalStatus: %v\", *(v.VisibilityArchivalStatus))\n\t\ti++\n\t}\n\tif v.VisibilityArchivalURI != nil {\n\t\tfields[i] = fmt.Sprintf(\"VisibilityArchivalURI: %v\", *(v.VisibilityArchivalURI))\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"RegisterDomainRequest{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "a32726eac243f2d03f29b4bbabbe16a0", "score": "0.5252864", "text": "func (m *MitigationRequest) String() (result string) {\n\tspaces3 := \" \"\n\tspaces6 := spaces3 + spaces3\n\tspaces9 := spaces6 + spaces3\n\tresult = \"\\n \\\"ietf-dots-signal-channel:mitigation-scope\\\":\\n\"\n\tfor key, scope := range m.MitigationScope.Scopes {\n\t\tresult += fmt.Sprintf(\"%s\\\"%s[%d]\\\":\\n\", spaces3, \"scope\", key+1)\n\t\tif scope.MitigationId != nil {\n\t\t\tresult += fmt.Sprintf(\"%s\\\"%s\\\": %d\\n\", spaces6, \"mid\", *scope.MitigationId)\n\t\t}\n\t\tif scope.TargetPrefix != nil {\n\t\t\tfor k, v := range scope.TargetPrefix {\n\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s[%d]\\\": %s\\n\", spaces6, \"target-prefix\", k+1, v)\n\t\t\t}\n\t\t}\n\t\tif scope.TargetPortRange != nil {\n\t\t\tfor k, v := range scope.TargetPortRange {\n\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s[%d]\\\":\\n\", spaces6, \"target-port-range\", k+1)\n\t\t\t\tif v.LowerPort != nil {\n\t\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s\\\": %d\\n\", spaces9, \"lower-port\", *v.LowerPort)\n\t\t\t\t}\n\t\t\t\tif v.UpperPort != nil {\n\t\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s\\\": %d\\n\", spaces9, \"upper-port\", *v.UpperPort)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif scope.TargetProtocol != nil {\n\t\t\tfor k, v := range scope.TargetProtocol {\n\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s[%d]\\\": %d\\n\", spaces6, \"target-protocol\", k+1, v)\n\t\t\t}\n\t\t}\n\t\tif scope.FQDN != nil {\n\t\t\tfor k, v := range scope.FQDN {\n\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s[%d]\\\": %s\\n\", spaces6, \"target-fqdn\", k+1, v)\n\t\t\t}\n\t\t}\n\t\tif scope.URI != nil {\n\t\t\tfor k, v := range scope.URI {\n\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s[%d]\\\": %s\\n\", spaces6, \"target-uri\", k+1, v)\n\t\t\t}\n\t\t}\n\t\tif scope.AliasName != nil {\n\t\t\tfor k, v := range scope.AliasName {\n\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s[%d]\\\": %s\\n\", spaces6, \"alias-name\", k+1, v)\n\t\t\t}\n\t\t}\n\t\tif scope.SourcePrefix != nil {\n\t\t\tfor k, v := range scope.SourcePrefix {\n\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s[%d]\\\": %s\\n\", spaces6, \"ietf-dots-call-home:source-prefix\", k+1, v)\n\t\t\t}\n\t\t}\n\t\tif scope.SourcePortRange != nil {\n\t\t\tfor k, v := range scope.SourcePortRange {\n\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s[%d]\\\":\\n\", spaces6, \"ietf-dots-call-home:source-port-range\", k+1)\n\t\t\t\tif v.LowerPort != nil {\n\t\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s\\\": %d\\n\", spaces9, \"lower-port\", *v.LowerPort)\n\t\t\t\t}\n\t\t\t\tif v.UpperPort != nil {\n\t\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s\\\": %d\\n\", spaces9, \"upper-port\", *v.UpperPort)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif scope.SourceICMPTypeRange != nil {\n\t\t\tfor k, v := range scope.SourceICMPTypeRange {\n\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s[%d]\\\":\\n\", spaces6, \"ietf-dots-call-home:source-icmp-type-range\", k+1)\n\t\t\t\tif v.LowerType != nil {\n\t\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s\\\": %d\\n\", spaces9, \"lower-type\", *v.LowerType)\n\t\t\t\t}\n\t\t\t\tif v.UpperType != nil {\n\t\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s\\\": %d\\n\", spaces9, \"upper-type\", *v.UpperType)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif scope.AclList != nil {\n\t\t\tfor k, v := range scope.AclList {\n\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s[%d]\\\":\\n\", spaces6, \"ietf-dots-signal-control:acl-list\", k+1)\n\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s\\\": %s\\n\", spaces9, \"ietf-dots-signal-control:acl-name\", v.AclName)\n\t\t\t\tif v.ActivationType != nil {\n\t\t\t\t\tresult += fmt.Sprintf(\"%s\\\"%s\\\": %d\\n\", spaces9, \"ietf-dots-signal-control:activation-type\", *v.ActivationType)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif scope.Lifetime != nil {\n\t\t\tresult += fmt.Sprintf(\"%s\\\"%s\\\": %d\\n\", spaces6, \"lifetime\", *scope.Lifetime)\n\t\t}\n\t\tif scope.AttackStatus != nil {\n\t\t\tresult += fmt.Sprintf(\"%s\\\"%s\\\": %d\\n\", spaces6, \"attack-status\", *scope.AttackStatus)\n\t\t}\n\t\tif scope.TriggerMitigation != nil {\n\t\t\tresult += fmt.Sprintf(\"%s\\\"%s\\\": %t\\n\", spaces6, \"trigger-mitigation\", *scope.TriggerMitigation)\n\t\t}\n\t\tfor k, v := range scope.TotalAttackTraffic {\n\t\t\tresult += fmt.Sprintf(\"%s\\\"%s[%d]\\\":\\n\", spaces6, \"ietf-dots-telemetry:total-attack-traffic\", k+1)\n\t\t\tresult += v.String(spaces6)\n\t\t}\n\t\tfor k, v := range scope.AttackDetail {\n\t\t\tresult += fmt.Sprintf(\"%s\\\"%s[%d]\\\":\\n\", spaces6, \"ietf-dots-telemetry:attack-detail\", k+1)\n\t\t\tresult += v.String(spaces6)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "0be47b10699c824c4293bc498f07fe87", "score": "0.52448756", "text": "func (logger *Logger) flushReq(b *bytes.Buffer, req *request) {\n\tif req.format == \"\" {\n\t\tmsg := fmt.Sprint(req.v...)\n\t\tmsg = logger.genLog(req.level, msg)\n\t\tfmt.Fprintln(b, msg)\n\t} else {\n\t\tmsg := fmt.Sprintf(req.format, req.v...)\n\t\tmsg = logger.genLog(req.level, msg)\n\t\tfmt.Fprintln(b, msg)\n\t}\n}", "title": "" }, { "docid": "64804352da34b32caa8e4f73fd60eb2b", "score": "0.5239721", "text": "func NewRequest(reqStr string) (*Request, error) {\n\tvar r Request\n\tif err := json.Unmarshal([]byte(reqStr), &r); err != nil {\n\t\tlog.Println(\"Error parsing line: \", err)\n\t\treturn nil, err\n\t}\n\tif a, err := strconv.ParseFloat(strings.Trim(r.Amount, \"$\"), 64); err != nil {\n\t\tlog.Println(\"Error parsing amount: \", err)\n\t\treturn nil, err\n\t} else {\n\t\tr.ParsedAmount = a\n\t}\n\t//if t, err := time.Parse(\"2006-01-02T22:04:05Z\", r.Time); err != nil {\n\tif t, err := time.Parse(time.RFC3339, r.Time); err != nil {\n\t\tlog.Println(\"Error parsing time: \", err)\n\t\treturn nil, err\n\t} else {\n\t\tr.ParsedTime = t\n\t}\n\treturn &r, nil\n}", "title": "" } ]
c05d0d9718a6fa62d252dce18caac6af
NewLedgerVoucherAttachmentUploadAttachmentParamsWithContext creates a new LedgerVoucherAttachmentUploadAttachmentParams object with the default values initialized, and the ability to set a context for a request
[ { "docid": "686c6dca36ba16f72d564fbf46dccd36", "score": "0.8011552", "text": "func NewLedgerVoucherAttachmentUploadAttachmentParamsWithContext(ctx context.Context) *LedgerVoucherAttachmentUploadAttachmentParams {\n\tvar ()\n\treturn &LedgerVoucherAttachmentUploadAttachmentParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" } ]
[ { "docid": "d243f177cdc6cdab3c50231168a98985", "score": "0.7876268", "text": "func (o *LedgerVoucherAttachmentUploadAttachmentParams) WithContext(ctx context.Context) *LedgerVoucherAttachmentUploadAttachmentParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "22aad67988471d16f7c92fa65fe3ab0f", "score": "0.7714568", "text": "func NewLedgerVoucherAttachmentUploadAttachmentParams() *LedgerVoucherAttachmentUploadAttachmentParams {\n\tvar ()\n\treturn &LedgerVoucherAttachmentUploadAttachmentParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "ac51de6be4206435ee9b7f00de7463a4", "score": "0.68370366", "text": "func NewLedgerVoucherAttachmentUploadAttachmentParamsWithHTTPClient(client *http.Client) *LedgerVoucherAttachmentUploadAttachmentParams {\n\tvar ()\n\treturn &LedgerVoucherAttachmentUploadAttachmentParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "64a969d17be1af78582d2eb33a2dcc16", "score": "0.62636817", "text": "func (o *LedgerVoucherAttachmentUploadAttachmentParams) WithHTTPClient(client *http.Client) *LedgerVoucherAttachmentUploadAttachmentParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "a9dc2bf8afb1b874107513d42d02fa22", "score": "0.6238627", "text": "func NewLedgerVoucherAttachmentUploadAttachmentParamsWithTimeout(timeout time.Duration) *LedgerVoucherAttachmentUploadAttachmentParams {\n\tvar ()\n\treturn &LedgerVoucherAttachmentUploadAttachmentParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "1792a11586d064580688b3c84a17e3f9", "score": "0.6146196", "text": "func (o *LedgerVoucherAttachmentUploadAttachmentParams) WithTimeout(timeout time.Duration) *LedgerVoucherAttachmentUploadAttachmentParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "040f85c923b2b3a8f9be36d9f7943054", "score": "0.5855134", "text": "func (o *LedgerVoucherAttachmentUploadAttachmentParams) WithVoucherID(voucherID int32) *LedgerVoucherAttachmentUploadAttachmentParams {\n\to.SetVoucherID(voucherID)\n\treturn o\n}", "title": "" }, { "docid": "652f69e95e0c071a908b956ca2aaa1f7", "score": "0.5734404", "text": "func (kubernetesServiceApi *KubernetesServiceApiV1) CreateAttachmentWithContext(ctx context.Context, createAttachmentOptions *CreateAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(createAttachmentOptions, \"createAttachmentOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(createAttachmentOptions, \"createAttachmentOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.POST)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = kubernetesServiceApi.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(kubernetesServiceApi.Service.Options.URL, `/v2/storage/createAttachment`, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range createAttachmentOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"kubernetes_service_api\", \"V1\", \"CreateAttachment\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\tbuilder.AddHeader(\"Content-Type\", \"application/json\")\n\tif createAttachmentOptions.XAuthResourceGroupID != nil {\n\t\tbuilder.AddHeader(\"X-Auth-Resource-Group-ID\", fmt.Sprint(*createAttachmentOptions.XAuthResourceGroupID))\n\t}\n\n\tbody := make(map[string]interface{})\n\tif createAttachmentOptions.Cluster != nil {\n\t\tbody[\"cluster\"] = createAttachmentOptions.Cluster\n\t}\n\tif createAttachmentOptions.VolumeAttachmentID != nil {\n\t\tbody[\"volumeAttachmentID\"] = createAttachmentOptions.VolumeAttachmentID\n\t}\n\tif createAttachmentOptions.VolumeID != nil {\n\t\tbody[\"volumeID\"] = createAttachmentOptions.VolumeID\n\t}\n\tif createAttachmentOptions.Worker != nil {\n\t\tbody[\"worker\"] = createAttachmentOptions.Worker\n\t}\n\t_, err = builder.SetBodyContentJSON(body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = kubernetesServiceApi.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalVolumeAttachment)\n\tif err != nil {\n\t\treturn\n\t}\n\tresponse.Result = result\n\n\treturn\n}", "title": "" }, { "docid": "24a83285bb884bcd97be5b8fa2c07523", "score": "0.5516499", "text": "func NewUploadFileParamsWithContext(ctx context.Context) *UploadFileParams {\n\treturn &UploadFileParams{\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "ecb1c6174232a268f11a5ebb8610c90e", "score": "0.54055035", "text": "func (configurationGovernance *ConfigurationGovernanceV1) UpdateAttachmentWithContext(ctx context.Context, updateAttachmentOptions *UpdateAttachmentOptions) (result *Attachment, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(updateAttachmentOptions, \"updateAttachmentOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(updateAttachmentOptions, \"updateAttachmentOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"rule_id\": *updateAttachmentOptions.RuleID,\n\t\t\"attachment_id\": *updateAttachmentOptions.AttachmentID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.PUT)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = configurationGovernance.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(configurationGovernance.Service.Options.URL, `/config/v1/rules/{rule_id}/attachments/{attachment_id}`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range updateAttachmentOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"configuration_governance\", \"V1\", \"UpdateAttachment\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\tbuilder.AddHeader(\"Content-Type\", \"application/json\")\n\tif updateAttachmentOptions.IfMatch != nil {\n\t\tbuilder.AddHeader(\"If-Match\", fmt.Sprint(*updateAttachmentOptions.IfMatch))\n\t}\n\tif updateAttachmentOptions.TransactionID != nil {\n\t\tbuilder.AddHeader(\"Transaction-Id\", fmt.Sprint(*updateAttachmentOptions.TransactionID))\n\t}\n\n\tbody := make(map[string]interface{})\n\tif updateAttachmentOptions.AccountID != nil {\n\t\tbody[\"account_id\"] = updateAttachmentOptions.AccountID\n\t}\n\tif updateAttachmentOptions.IncludedScope != nil {\n\t\tbody[\"included_scope\"] = updateAttachmentOptions.IncludedScope\n\t}\n\tif updateAttachmentOptions.ExcludedScopes != nil {\n\t\tbody[\"excluded_scopes\"] = updateAttachmentOptions.ExcludedScopes\n\t}\n\t_, err = builder.SetBodyContentJSON(body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = configurationGovernance.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalAttachment)\n\tif err != nil {\n\t\treturn\n\t}\n\tresponse.Result = result\n\n\treturn\n}", "title": "" }, { "docid": "1ccc7f8f30dbac0af3d858baacbfa68f", "score": "0.54050624", "text": "func NewUploadFirmwareParamsWithContext(ctx context.Context) *UploadFirmwareParams {\n\treturn &UploadFirmwareParams{\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "04d05f80c6bd5f9612b05ed9fca9945d", "score": "0.5392491", "text": "func (o *LedgerVoucherAttachmentUploadAttachmentParams) WithFile(file runtime.NamedReadCloser) *LedgerVoucherAttachmentUploadAttachmentParams {\n\to.SetFile(file)\n\treturn o\n}", "title": "" }, { "docid": "1991cafc9fabccbb9eb8f8de263e6711", "score": "0.5172862", "text": "func NewGetVolumeAttachmentParamsWithContext(ctx context.Context) *GetVolumeAttachmentParams {\n\tvar ()\n\treturn &GetVolumeAttachmentParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "6ed8f357728473e4e9db6e4f017859bb", "score": "0.49970073", "text": "func (kubernetesServiceApi *KubernetesServiceApiV1) GetAttachmentWithContext(ctx context.Context, getAttachmentOptions *GetAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(getAttachmentOptions, \"getAttachmentOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(getAttachmentOptions, \"getAttachmentOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = kubernetesServiceApi.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(kubernetesServiceApi.Service.Options.URL, `/v2/storage/getAttachment`, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range getAttachmentOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"kubernetes_service_api\", \"V1\", \"GetAttachment\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\tif getAttachmentOptions.XAuthResourceGroupID != nil {\n\t\tbuilder.AddHeader(\"X-Auth-Resource-Group-ID\", fmt.Sprint(*getAttachmentOptions.XAuthResourceGroupID))\n\t}\n\n\tbuilder.AddQuery(\"cluster\", fmt.Sprint(*getAttachmentOptions.Cluster))\n\tbuilder.AddQuery(\"worker\", fmt.Sprint(*getAttachmentOptions.Worker))\n\tbuilder.AddQuery(\"volumeAttachmentID\", fmt.Sprint(*getAttachmentOptions.VolumeAttachmentID))\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = kubernetesServiceApi.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalVolumeAttachment)\n\tif err != nil {\n\t\treturn\n\t}\n\tresponse.Result = result\n\n\treturn\n}", "title": "" }, { "docid": "11d5cdbd8bba23d4c38b03d6ffbd81f7", "score": "0.49329466", "text": "func (configurationGovernance *ConfigurationGovernanceV1) GetAttachmentWithContext(ctx context.Context, getAttachmentOptions *GetAttachmentOptions) (result *Attachment, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(getAttachmentOptions, \"getAttachmentOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(getAttachmentOptions, \"getAttachmentOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"rule_id\": *getAttachmentOptions.RuleID,\n\t\t\"attachment_id\": *getAttachmentOptions.AttachmentID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = configurationGovernance.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(configurationGovernance.Service.Options.URL, `/config/v1/rules/{rule_id}/attachments/{attachment_id}`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range getAttachmentOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"configuration_governance\", \"V1\", \"GetAttachment\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\tif getAttachmentOptions.TransactionID != nil {\n\t\tbuilder.AddHeader(\"Transaction-Id\", fmt.Sprint(*getAttachmentOptions.TransactionID))\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = configurationGovernance.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalAttachment)\n\tif err != nil {\n\t\treturn\n\t}\n\tresponse.Result = result\n\n\treturn\n}", "title": "" }, { "docid": "bae8357419a1dc77f1376ba5f54b2bbc", "score": "0.48903194", "text": "func (*ConfigurationGovernanceV1) NewAttachmentRequest(accountID string, includedScope *RuleScope) (model *AttachmentRequest, err error) {\n\tmodel = &AttachmentRequest{\n\t\tAccountID: core.StringPtr(accountID),\n\t\tIncludedScope: includedScope,\n\t}\n\terr = core.ValidateStruct(model, \"required parameters\")\n\treturn\n}", "title": "" }, { "docid": "41a82a847c135f1c70bed53a5d79d618", "score": "0.48839176", "text": "func (configurationGovernance *ConfigurationGovernanceV1) CreateAttachmentsWithContext(ctx context.Context, createAttachmentsOptions *CreateAttachmentsOptions) (result *CreateAttachmentsResponse, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(createAttachmentsOptions, \"createAttachmentsOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(createAttachmentsOptions, \"createAttachmentsOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"rule_id\": *createAttachmentsOptions.RuleID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.POST)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = configurationGovernance.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(configurationGovernance.Service.Options.URL, `/config/v1/rules/{rule_id}/attachments`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range createAttachmentsOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"configuration_governance\", \"V1\", \"CreateAttachments\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\tbuilder.AddHeader(\"Content-Type\", \"application/json\")\n\tif createAttachmentsOptions.TransactionID != nil {\n\t\tbuilder.AddHeader(\"Transaction-Id\", fmt.Sprint(*createAttachmentsOptions.TransactionID))\n\t}\n\n\tbody := make(map[string]interface{})\n\tif createAttachmentsOptions.Attachments != nil {\n\t\tbody[\"attachments\"] = createAttachmentsOptions.Attachments\n\t}\n\t_, err = builder.SetBodyContentJSON(body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = configurationGovernance.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalCreateAttachmentsResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tresponse.Result = result\n\n\treturn\n}", "title": "" }, { "docid": "2444183abdd45fc39a9e8be427d88b8f", "score": "0.48834863", "text": "func NewGetVnicAttachmentParamsWithContext(ctx context.Context) *GetVnicAttachmentParams {\n\tvar ()\n\treturn &GetVnicAttachmentParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "ca16ff5ed4f8ae2e34a12d384c87444c", "score": "0.4855513", "text": "func NewUploadTLSParamsWithContext(ctx context.Context) *UploadTLSParams {\n\tvar ()\n\treturn &UploadTLSParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "814e9bfb0fbac541c8a2b20f94d46d76", "score": "0.48542398", "text": "func (o *GetVolumeAttachmentParams) WithContext(ctx context.Context) *GetVolumeAttachmentParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "7c94b9fd80df100313151d88ff4ee100", "score": "0.48041943", "text": "func NewAttachment() *AttachmentBuilder {\n\treturn &AttachmentBuilder{}\n}", "title": "" }, { "docid": "d8cba503d5b5cf5c67a01194bf3dc641", "score": "0.4755556", "text": "func NewLedgerVoucherImportDocumentImportDocumentParamsWithContext(ctx context.Context) *LedgerVoucherImportDocumentImportDocumentParams {\n\tvar (\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherImportDocumentImportDocumentParams{\n\t\tSplit: &splitDefault,\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "2f4da3eb890d3d363cc8f410ca3aefd8", "score": "0.4579893", "text": "func (c *CryptoClient) UploadPartWithContext(ctx aws.Context, input *s3.UploadPartInput, opts ...request.Option) (*s3.UploadPartOutput, error) {\n\treq, out := c.UploadPartRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "f3286bf08cc9b26e829ea3ae9a710698", "score": "0.45672145", "text": "func NewAddLibraryAPIVersionParamsWithContext(ctx context.Context) *AddLibraryAPIVersionParams {\n\tvar ()\n\treturn &AddLibraryAPIVersionParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "d577252d1a547d1a7780a0a9e977a971", "score": "0.45298666", "text": "func (kubernetesServiceApi *KubernetesServiceApiV1) DeleteAttachmentWithContext(ctx context.Context, deleteAttachmentOptions *DeleteAttachmentOptions) (response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(deleteAttachmentOptions, \"deleteAttachmentOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(deleteAttachmentOptions, \"deleteAttachmentOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.POST)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = kubernetesServiceApi.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(kubernetesServiceApi.Service.Options.URL, `/v2/storage/deleteAttachment`, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range deleteAttachmentOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"kubernetes_service_api\", \"V1\", \"DeleteAttachment\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Content-Type\", \"application/json\")\n\tif deleteAttachmentOptions.XAuthResourceGroupID != nil {\n\t\tbuilder.AddHeader(\"X-Auth-Resource-Group-ID\", fmt.Sprint(*deleteAttachmentOptions.XAuthResourceGroupID))\n\t}\n\n\tbody := make(map[string]interface{})\n\tif deleteAttachmentOptions.Cluster != nil {\n\t\tbody[\"cluster\"] = deleteAttachmentOptions.Cluster\n\t}\n\tif deleteAttachmentOptions.VolumeAttachmentID != nil {\n\t\tbody[\"volumeAttachmentID\"] = deleteAttachmentOptions.VolumeAttachmentID\n\t}\n\tif deleteAttachmentOptions.VolumeID != nil {\n\t\tbody[\"volumeID\"] = deleteAttachmentOptions.VolumeID\n\t}\n\tif deleteAttachmentOptions.Worker != nil {\n\t\tbody[\"worker\"] = deleteAttachmentOptions.Worker\n\t}\n\t_, err = builder.SetBodyContentJSON(body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tresponse, err = kubernetesServiceApi.Service.Request(request, nil)\n\n\treturn\n}", "title": "" }, { "docid": "d3578cbdcbfbf90cc9c4d2ced713522a", "score": "0.45206103", "text": "func NewAddBodyFatLogParamsWithContext(ctx context.Context) *AddBodyFatLogParams {\n\tvar ()\n\treturn &AddBodyFatLogParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "434a733ae137cf5c6d780efaf6693ce7", "score": "0.4491296", "text": "func NewUploadIssueTemplateParamsWithContext(ctx context.Context) *UploadIssueTemplateParams {\n\tvar (\n\t\tconfirmIgnoreCustomTagUpdatesDefault = bool(false)\n\t)\n\treturn &UploadIssueTemplateParams{\n\t\tConfirmIgnoreCustomTagUpdates: &confirmIgnoreCustomTagUpdatesDefault,\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "7b9dc3d34216e2a2a712f22b3eb4a539", "score": "0.448521", "text": "func (o *LedgerVoucherAttachmentUploadAttachmentParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "ec8b4d32c7bea358dfe0bd680eca98e0", "score": "0.4479981", "text": "func UploadAttachment(ctx *context.Context) {\n\tif !setting.AttachmentEnabled {\n\t\tctx.Error(404, \"attachment is not enabled\")\n\t\treturn\n\t}\n\n\tfile, header, err := ctx.Req.FormFile(\"file\")\n\tif err != nil {\n\t\tctx.Error(500, fmt.Sprintf(\"FormFile: %v\", err))\n\t\treturn\n\t}\n\tdefer file.Close()\n\n\tbuf := make([]byte, 1024)\n\tn, _ := file.Read(buf)\n\tif n > 0 {\n\t\tbuf = buf[:n]\n\t}\n\n\terr = upload.VerifyAllowedContentType(buf, strings.Split(setting.AttachmentAllowedTypes, \",\"))\n\tif err != nil {\n\t\tctx.Error(400, err.Error())\n\t\treturn\n\t}\n\n\tattach, err := models.NewAttachment(&models.Attachment{\n\t\tUploaderID: ctx.User.ID,\n\t\tName: header.Filename,\n\t}, buf, file)\n\tif err != nil {\n\t\tctx.Error(500, fmt.Sprintf(\"NewAttachment: %v\", err))\n\t\treturn\n\t}\n\n\tlog.Trace(\"New attachment uploaded: %s\", attach.UUID)\n\tctx.JSON(200, map[string]string{\n\t\t\"uuid\": attach.UUID,\n\t})\n}", "title": "" }, { "docid": "25a12cd3fcaaa757641f791287866245", "score": "0.4476668", "text": "func (configurationGovernance *ConfigurationGovernanceV1) DeleteAttachmentWithContext(ctx context.Context, deleteAttachmentOptions *DeleteAttachmentOptions) (response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(deleteAttachmentOptions, \"deleteAttachmentOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(deleteAttachmentOptions, \"deleteAttachmentOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"rule_id\": *deleteAttachmentOptions.RuleID,\n\t\t\"attachment_id\": *deleteAttachmentOptions.AttachmentID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.DELETE)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = configurationGovernance.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(configurationGovernance.Service.Options.URL, `/config/v1/rules/{rule_id}/attachments/{attachment_id}`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range deleteAttachmentOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"configuration_governance\", \"V1\", \"DeleteAttachment\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tif deleteAttachmentOptions.TransactionID != nil {\n\t\tbuilder.AddHeader(\"Transaction-Id\", fmt.Sprint(*deleteAttachmentOptions.TransactionID))\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tresponse, err = configurationGovernance.Service.Request(request, nil)\n\n\treturn\n}", "title": "" }, { "docid": "1e3e2c8122e629fe575e48f7f27276b1", "score": "0.4472674", "text": "func (in *TransitGatewayVpcAttachmentParameters) DeepCopy() *TransitGatewayVpcAttachmentParameters {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TransitGatewayVpcAttachmentParameters)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "eec521397b858a102901f4c38e13b3ec", "score": "0.44724834", "text": "func (c *CloudDirectory) AttachObjectWithContext(ctx aws.Context, input *AttachObjectInput, opts ...request.Option) (*AttachObjectOutput, error) {\n\treq, out := c.AttachObjectRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "4e9f3f890711cae08ec4ee3c0ab2117a", "score": "0.44721287", "text": "func (client *Client) UploadPartWithContext(ctx context.Context, request *UploadPartRequest) (*UploadPartResponse, error) {\n\tresult := &UploadPartResponse{}\n\treq := &clientRequest{\n\t\tBucketName: request.BucketName,\n\t\tObjectName: request.ObjectName,\n\t\tMethod: HTTPPut,\n\t\tData: request.Data,\n\t\tQueryHeaderOptions: request,\n\t\tResult: result,\n\t}\n\n\tresp, err := client.do(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\treturn result, err\n}", "title": "" }, { "docid": "c9b6aa4c55242e3d13b9d01b752be9df", "score": "0.4422418", "text": "func NewUpdatePackageParamsWithContext(ctx context.Context) *UpdatePackageParams {\n\tvar ()\n\treturn &UpdatePackageParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "5b73a24dc085ea84e0ecd74833a9ebc3", "score": "0.44124743", "text": "func (c *CloudDirectory) AttachPolicyWithContext(ctx aws.Context, input *AttachPolicyInput, opts ...request.Option) (*AttachPolicyOutput, error) {\n\treq, out := c.AttachPolicyRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "4aa77f1eefea30aff2d9b54d38ccd3a0", "score": "0.43916047", "text": "func (keyRing *KeyRing) SignDetachedWithContext(message *PlainMessage, context *SigningContext) (*PGPSignature, error) {\n\treturn signMessageDetached(\n\t\tkeyRing,\n\t\tmessage.NewReader(),\n\t\tmessage.IsBinary(),\n\t\tcontext,\n\t)\n}", "title": "" }, { "docid": "8693c531ad8a094ffa71e0540dbab1d7", "score": "0.4378487", "text": "func (in *AttachmentParameters) DeepCopy() *AttachmentParameters {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AttachmentParameters)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6df2b05fbe8e66439a24fe1bdba26a45", "score": "0.43745187", "text": "func NewCreateanewTopupVoucherParamsWithContext(ctx context.Context) *CreateanewTopupVoucherParams {\n\tvar ()\n\treturn &CreateanewTopupVoucherParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "8b8d11eab8463e9ee9d0bf126d455374", "score": "0.4339494", "text": "func NewGetVolumeAttachmentParamsWithHTTPClient(client *http.Client) *GetVolumeAttachmentParams {\n\tvar ()\n\treturn &GetVolumeAttachmentParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "3d1888b8ad5fcee23c6785505185dfe4", "score": "0.43348697", "text": "func (in *IamUserPolicyAttachmentParameters) DeepCopy() *IamUserPolicyAttachmentParameters {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IamUserPolicyAttachmentParameters)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5994d8abd0971ddd2c8b5eb4b75695a5", "score": "0.43324146", "text": "func NewPatchWebhookParamsWithContext(ctx context.Context) *PatchWebhookParams {\n\tvar ()\n\treturn &PatchWebhookParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "2488be8a9be9b037355a0a59cad37055", "score": "0.4318736", "text": "func NewAddUpdateWaterGoalParamsWithContext(ctx context.Context) *AddUpdateWaterGoalParams {\n\tvar ()\n\treturn &AddUpdateWaterGoalParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "3bad9105545ea3e47097eb6a1cc49b85", "score": "0.43029657", "text": "func (in *AwsElbAttachment) DeepCopy() *AwsElbAttachment {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AwsElbAttachment)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fc41f6061afa8c8973eac95108a01a46", "score": "0.42996538", "text": "func (c *MediaLive) WaitUntilInputAttachedWithContext(ctx aws.Context, input *DescribeInputInput, opts ...request.WaiterOption) error {\n\tw := request.Waiter{\n\t\tName: \"WaitUntilInputAttached\",\n\t\tMaxAttempts: 20,\n\t\tDelay: request.ConstantWaiterDelay(5 * time.Second),\n\t\tAcceptors: []request.WaiterAcceptor{\n\t\t\t{\n\t\t\t\tState: request.SuccessWaiterState,\n\t\t\t\tMatcher: request.PathWaiterMatch, Argument: \"State\",\n\t\t\t\tExpected: \"ATTACHED\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tState: request.RetryWaiterState,\n\t\t\t\tMatcher: request.PathWaiterMatch, Argument: \"State\",\n\t\t\t\tExpected: \"DETACHED\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tState: request.RetryWaiterState,\n\t\t\t\tMatcher: request.StatusWaiterMatch,\n\t\t\t\tExpected: 500,\n\t\t\t},\n\t\t},\n\t\tLogger: c.Config.Logger,\n\t\tNewRequest: func(opts []request.Option) (*request.Request, error) {\n\t\t\tvar inCpy *DescribeInputInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.DescribeInputRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\tw.ApplyOptions(opts...)\n\n\treturn w.WaitWithContext(ctx)\n}", "title": "" }, { "docid": "d1544ebdf89e4cc0ed237c3aca5f0309", "score": "0.42906117", "text": "func (o *DeleteStorageV1beta1VolumeAttachmentOK) WithPayload(payload *models.IoK8sAPIStorageV1beta1VolumeAttachment) *DeleteStorageV1beta1VolumeAttachmentOK {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "ac44a90696915d564f92ccba25c04a2e", "score": "0.4278891", "text": "func NewUpdateApplicationDetectionRuleParamsWithContext(ctx context.Context) *UpdateApplicationDetectionRuleParams {\n\tvar ()\n\treturn &UpdateApplicationDetectionRuleParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "53d08cb7cecd53bfcf33a5ff81803b04", "score": "0.4274824", "text": "func NewPutPrinterLedParamsWithContext(ctx context.Context) *PutPrinterLedParams {\n\tvar ()\n\treturn &PutPrinterLedParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "8f76d69c7003e189d43611771bc2ebef", "score": "0.42744014", "text": "func (o *UploadTLSParams) WithContext(ctx context.Context) *UploadTLSParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "2bc125258811a71c2185ffb6b40ede03", "score": "0.42637774", "text": "func NewUpdateLocalUserParamsWithContext(ctx context.Context) *UpdateLocalUserParams {\n\tvar ()\n\treturn &UpdateLocalUserParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "192856a0cf025f7c4ba3dec60b40ad5f", "score": "0.4259643", "text": "func NewUpdateSystemFirmwareParamsWithContext(ctx context.Context) *UpdateSystemFirmwareParams {\n\tvar ()\n\treturn &UpdateSystemFirmwareParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "33021f7e431d0b3bfcedbc7babb411af", "score": "0.4249952", "text": "func (o *UploadFirmwareParams) WithContext(ctx context.Context) *UploadFirmwareParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "f62a95677bfc2482db3411a0d15280fe", "score": "0.42447722", "text": "func NewPutLolChatV1MeParamsWithContext(ctx context.Context) *PutLolChatV1MeParams {\n\tvar ()\n\treturn &PutLolChatV1MeParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "9e9403076a1d828303e6d508df1e9638", "score": "0.42357746", "text": "func NewAllowedEmailAddressPostParamsWithContext(ctx context.Context) *AllowedEmailAddressPostParams {\n\tvar ()\n\treturn &AllowedEmailAddressPostParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "b86671edb2cb591c013be63e7f2cff7b", "score": "0.4210156", "text": "func NewUpdateAdvertisementConfigParamsWithContext(ctx context.Context) *UpdateAdvertisementConfigParams {\n\tvar ()\n\treturn &UpdateAdvertisementConfigParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "e29e6fd62d5078fcc07cec093f83174f", "score": "0.42064914", "text": "func (o *UploadFileParams) WithContext(ctx context.Context) *UploadFileParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "89e35662a5784f03a5757fab58265742", "score": "0.41996974", "text": "func (c *CloudDirectory) ListPolicyAttachmentsWithContext(ctx aws.Context, input *ListPolicyAttachmentsInput, opts ...request.Option) (*ListPolicyAttachmentsOutput, error) {\n\treq, out := c.ListPolicyAttachmentsRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "7b9d0c30fba6f6640c63947f0a90efd7", "score": "0.4174073", "text": "func NewImportSpecificationFromFileParamsWithContext(ctx context.Context) *ImportSpecificationFromFileParams {\n\tvar (\n\t\ttidDefault = string(\"default\")\n\t)\n\treturn &ImportSpecificationFromFileParams{\n\t\tTid: tidDefault,\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "2cb6f6514973fc1126858ef0600da144", "score": "0.41720086", "text": "func (in *AwsVolumeAttachment) DeepCopy() *AwsVolumeAttachment {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AwsVolumeAttachment)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6002814121b6e0f197ce0fde23851767", "score": "0.41544235", "text": "func NewLockTicketParamsWithContext(ctx context.Context) *LockTicketParams {\n\tvar ()\n\treturn &LockTicketParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "a6ade4f34b06281d742ac7f1646b24e9", "score": "0.4152694", "text": "func (*ConfigurationGovernanceV1) NewUpdateAttachmentOptions(ruleID string, attachmentID string, ifMatch string, accountID string, includedScope *RuleScope) *UpdateAttachmentOptions {\n\treturn &UpdateAttachmentOptions{\n\t\tRuleID: core.StringPtr(ruleID),\n\t\tAttachmentID: core.StringPtr(attachmentID),\n\t\tIfMatch: core.StringPtr(ifMatch),\n\t\tAccountID: core.StringPtr(accountID),\n\t\tIncludedScope: includedScope,\n\t}\n}", "title": "" }, { "docid": "0e2e10c91a4b60ac38a4b8888cf8d7ae", "score": "0.4139192", "text": "func (webhooks *WebhooksV1) CreateAlertWebhookWithContext(ctx context.Context, createAlertWebhookOptions *CreateAlertWebhookOptions) (result *WebhookSuccessResp, response *core.DetailedResponse, err error) {\n\terr = core.ValidateStruct(createAlertWebhookOptions, \"createAlertWebhookOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"crn\": *webhooks.Crn,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.POST)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = webhooks.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(webhooks.Service.Options.URL, `/v1/{crn}/alerting/destinations/webhooks`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range createAlertWebhookOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"webhooks\", \"V1\", \"CreateAlertWebhook\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\tbuilder.AddHeader(\"Content-Type\", \"application/json\")\n\n\tbody := make(map[string]interface{})\n\tif createAlertWebhookOptions.Name != nil {\n\t\tbody[\"name\"] = createAlertWebhookOptions.Name\n\t}\n\tif createAlertWebhookOptions.URL != nil {\n\t\tbody[\"url\"] = createAlertWebhookOptions.URL\n\t}\n\tif createAlertWebhookOptions.Secret != nil {\n\t\tbody[\"secret\"] = createAlertWebhookOptions.Secret\n\t}\n\t_, err = builder.SetBodyContentJSON(body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = webhooks.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalWebhookSuccessResp)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "75f9aba0c6079007efbf3fd64894be99", "score": "0.4133141", "text": "func NewGetVolumeAttachmentParams() *GetVolumeAttachmentParams {\n\tvar ()\n\treturn &GetVolumeAttachmentParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "b0796f00ea83862d69586b5d6fc587f7", "score": "0.41256016", "text": "func (o *LedgerVoucherImportDocumentImportDocumentParams) WithContext(ctx context.Context) *LedgerVoucherImportDocumentImportDocumentParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "209409b29bee82110a28411716fa57ec", "score": "0.41197938", "text": "func NewPullImageParamsWithContext(ctx context.Context) *PullImageParams {\n\tvar ()\n\treturn &PullImageParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "38461426d024902448f29147fad90dac", "score": "0.41095325", "text": "func NewUploadArchiveParam() *UploadArchiveParam {\n\treturn &UploadArchiveParam{}\n}", "title": "" }, { "docid": "eb7fb3c964e7fb4db8946340bdf29e68", "score": "0.41033936", "text": "func NewIncorrectIngredientParsingParamsWithContext(ctx context.Context) *IncorrectIngredientParsingParams {\n\tvar ()\n\treturn &IncorrectIngredientParsingParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "9b38ebf11eb0fb5463775e62375de7ef", "score": "0.41010115", "text": "func NewPostLdapImportgroupParamsWithContext(ctx context.Context) *PostLdapImportgroupParams {\n\tvar ()\n\treturn &PostLdapImportgroupParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "26c6b0f10147aef525b66e02f9f9f102", "score": "0.40957323", "text": "func NewVolumeAttachment(ctx *pulumi.Context,\n\tname string, args *VolumeAttachmentArgs, opts ...pulumi.ResourceOption) (*VolumeAttachment, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.DeviceName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'DeviceName'\")\n\t}\n\tif args.InstanceId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'InstanceId'\")\n\t}\n\tif args.VolumeId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'VolumeId'\")\n\t}\n\tvar resource VolumeAttachment\n\terr := ctx.RegisterResource(\"aws:ec2/volumeAttachment:VolumeAttachment\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "03fed7797228b89adc1774b14ce11b8d", "score": "0.40907633", "text": "func NewUpdateLdapSettingsParamsWithContext(ctx context.Context) *UpdateLdapSettingsParams {\n\tvar ()\n\treturn &UpdateLdapSettingsParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "a52dad6690857d6e8e942e4be99a526a", "score": "0.40831578", "text": "func NewUpdateCertificateParamsWithContext(ctx context.Context) *UpdateCertificateParams {\n\tvar ()\n\treturn &UpdateCertificateParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "77e9d51a63f61f259ef4f95f4693cd67", "score": "0.4068113", "text": "func (kubernetesServiceApi *KubernetesServiceApiV1) GetAttachmentsWithContext(ctx context.Context, getAttachmentsOptions *GetAttachmentsOptions) (result *VolumeAttachmentList, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(getAttachmentsOptions, \"getAttachmentsOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(getAttachmentsOptions, \"getAttachmentsOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = kubernetesServiceApi.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(kubernetesServiceApi.Service.Options.URL, `/v2/storage/getAttachments`, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range getAttachmentsOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"kubernetes_service_api\", \"V1\", \"GetAttachments\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\tif getAttachmentsOptions.XAuthResourceGroupID != nil {\n\t\tbuilder.AddHeader(\"X-Auth-Resource-Group-ID\", fmt.Sprint(*getAttachmentsOptions.XAuthResourceGroupID))\n\t}\n\n\tbuilder.AddQuery(\"cluster\", fmt.Sprint(*getAttachmentsOptions.Cluster))\n\tbuilder.AddQuery(\"worker\", fmt.Sprint(*getAttachmentsOptions.Worker))\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = kubernetesServiceApi.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalVolumeAttachmentList)\n\tif err != nil {\n\t\treturn\n\t}\n\tresponse.Result = result\n\n\treturn\n}", "title": "" }, { "docid": "52dfaa25564ec83d46c28a2b519e22c9", "score": "0.40678337", "text": "func NewFleetUpdateParamsWithContext(ctx context.Context) *FleetUpdateParams {\n\tvar ()\n\treturn &FleetUpdateParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "bdb53692b7f0f9652fbc2e2e265abcd2", "score": "0.40597686", "text": "func (o *CreateanewTopupVoucherParams) WithContext(ctx context.Context) *CreateanewTopupVoucherParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "bb52389e108bb7d586e9754e1e8047b2", "score": "0.4054238", "text": "func NewAddTemplateParamsWithContext(ctx context.Context) *AddTemplateParams {\n\tvar ()\n\treturn &AddTemplateParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "481d0a326b05ddcf15db86e9c29f6bca", "score": "0.404426", "text": "func NewPostLedgerAccountListParamsWithContext(ctx context.Context) *PostLedgerAccountListParams {\n\tvar ()\n\treturn &PostLedgerAccountListParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "4f49fcff2fcbb7623f08c5a37d41c3e3", "score": "0.40357187", "text": "func NewVerifyAccountParamsWithContext(ctx context.Context) *VerifyAccountParams {\n\tvar ()\n\treturn &VerifyAccountParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "98af0d04a943ea286e0c291d297daca2", "score": "0.40313718", "text": "func (c *CodeCommit) MergePullRequestByThreeWayWithContext(ctx aws.Context, input *MergePullRequestByThreeWayInput, opts ...request.Option) (*MergePullRequestByThreeWayOutput, error) {\n\treq, out := c.MergePullRequestByThreeWayRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "632a122ca2cddf9d840abc865a487349", "score": "0.4029983", "text": "func (o *LedgerVoucherAttachmentUploadAttachmentParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// form file param file\n\tif err := r.SetFileParam(\"file\", o.File); err != nil {\n\t\treturn err\n\t}\n\n\t// path param voucherId\n\tif err := r.SetPathParam(\"voucherId\", swag.FormatInt32(o.VoucherID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fc2743bca1aa61cebf90af4595bfbffb", "score": "0.40293032", "text": "func NewVolumeAttachment(ctx *pulumi.Context,\n\tname string, args *VolumeAttachmentArgs, opts ...pulumi.ResourceOpt) (*VolumeAttachment, error) {\n\tif args == nil || args.DeviceName == nil {\n\t\treturn nil, errors.New(\"missing required argument 'DeviceName'\")\n\t}\n\tif args == nil || args.InstanceId == nil {\n\t\treturn nil, errors.New(\"missing required argument 'InstanceId'\")\n\t}\n\tif args == nil || args.VolumeId == nil {\n\t\treturn nil, errors.New(\"missing required argument 'VolumeId'\")\n\t}\n\tinputs := make(map[string]interface{})\n\tif args == nil {\n\t\tinputs[\"deviceName\"] = nil\n\t\tinputs[\"forceDetach\"] = nil\n\t\tinputs[\"instanceId\"] = nil\n\t\tinputs[\"skipDestroy\"] = nil\n\t\tinputs[\"volumeId\"] = nil\n\t} else {\n\t\tinputs[\"deviceName\"] = args.DeviceName\n\t\tinputs[\"forceDetach\"] = args.ForceDetach\n\t\tinputs[\"instanceId\"] = args.InstanceId\n\t\tinputs[\"skipDestroy\"] = args.SkipDestroy\n\t\tinputs[\"volumeId\"] = args.VolumeId\n\t}\n\ts, err := ctx.RegisterResource(\"aws:ec2/volumeAttachment:VolumeAttachment\", name, true, inputs, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &VolumeAttachment{s: s}, nil\n}", "title": "" }, { "docid": "ec6be626852665705627a025eabddcb7", "score": "0.40193224", "text": "func NewGeIncompatibleBuildTypesParamsWithContext(ctx context.Context) *GeIncompatibleBuildTypesParams {\n\tvar ()\n\treturn &GeIncompatibleBuildTypesParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "be4f829d44cbd895bc299c2604fe2ff0", "score": "0.400464", "text": "func NewLoggerWithContext(ctx context.Context, name string, l send.LevelInfo, opts *LoggerOptions) (send.Sender, error) {\n\tb, err := MakeLoggerWithContext(ctx, name, opts)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"making new logger\")\n\t}\n\n\tif err := b.SetLevel(l); err != nil {\n\t\treturn nil, errors.Wrap(err, \"setting grip level\")\n\t}\n\n\treturn b, nil\n}", "title": "" }, { "docid": "c3b38bdd7a44274cf208cf421c3bcce9", "score": "0.39985794", "text": "func (c *Client) FundWalletWithContext(ctx context.Context, amount string, priority PaymentMethodPriority) (err error) {\n\tpaymentMethod, _ := c.getPaymentMethodByPriority(priority)\n\tendpoint, _ := c.getPaymentMethodEndpoint(paymentMethod)\n\n\twrappedParams := map[string]interface{}{\n\t\t\"amount\": amount,\n\t}\n\n\tout := PaymentMethodObject{}\n\terr = c.post(ctx, endpoint+\"/\"+paymentMethod.ID+\"/charges\", wrappedParams, &out)\n\treturn err\n}", "title": "" }, { "docid": "a6fd71696c55d8bdeb5e47cd468864df", "score": "0.39974064", "text": "func (in *AwsVpnGatewayAttachment) DeepCopy() *AwsVpnGatewayAttachment {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AwsVpnGatewayAttachment)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d67066925e950972a0af09763da17bbf", "score": "0.39958522", "text": "func NewAddEventLoopGroupParamsWithContext(ctx context.Context) *AddEventLoopGroupParams {\n\tvar ()\n\treturn &AddEventLoopGroupParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "78b80687aa30976e58cc7286869bbd90", "score": "0.3993871", "text": "func NewCreateElfImageParamsWithContext(ctx context.Context) *CreateElfImageParams {\n\treturn &CreateElfImageParams{\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "e575bf75b2e3a6f38598e1269f7180a0", "score": "0.39824525", "text": "func NewGetFileAttributesParamsWithContext(ctx context.Context) *GetFileAttributesParams {\n\tvar ()\n\treturn &GetFileAttributesParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "9afc0505c8024fdf25fc9931915ff85f", "score": "0.39807248", "text": "func NewAddEmployeeParamsWithContext(ctx context.Context) *AddEmployeeParams {\n\tvar ()\n\treturn &AddEmployeeParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "012d387be5c625784b6ecbf895b1c549", "score": "0.3978233", "text": "func NewSyncLookmlDashboardParamsWithContext(ctx context.Context) *SyncLookmlDashboardParams {\n\treturn &SyncLookmlDashboardParams{\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "454d9acae4e537b219142aa6ab0d343d", "score": "0.39695215", "text": "func (o *PutPrinterLedParams) WithContext(ctx context.Context) *PutPrinterLedParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "a89de66a53426b8a921f81abaacbce0c", "score": "0.39409652", "text": "func NewCreateEncryptionKeyParamsWithContext(ctx context.Context) *CreateEncryptionKeyParams {\n\tvar ()\n\treturn &CreateEncryptionKeyParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "ac3e675964313c777503010a43262d63", "score": "0.39400944", "text": "func (mr *MockAutoScalingAPIMockRecorder) AttachLoadBalancersWithContext(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, \"AttachLoadBalancersWithContext\", reflect.TypeOf((*MockAutoScalingAPI)(nil).AttachLoadBalancersWithContext), varargs...)\n}", "title": "" }, { "docid": "52cfb21b0f213f6eaa67aa78224b0e63", "score": "0.39363673", "text": "func NewWatchStorageV1beta1VolumeAttachmentUnauthorized() *WatchStorageV1beta1VolumeAttachmentUnauthorized {\n\treturn &WatchStorageV1beta1VolumeAttachmentUnauthorized{}\n}", "title": "" }, { "docid": "825ce7d86ad50e76cf5cea73c5669e45", "score": "0.39295554", "text": "func (configurationGovernance *ConfigurationGovernanceV1) ListAttachmentsWithContext(ctx context.Context, listAttachmentsOptions *ListAttachmentsOptions) (result *AttachmentList, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(listAttachmentsOptions, \"listAttachmentsOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(listAttachmentsOptions, \"listAttachmentsOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"rule_id\": *listAttachmentsOptions.RuleID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = configurationGovernance.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(configurationGovernance.Service.Options.URL, `/config/v1/rules/{rule_id}/attachments`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range listAttachmentsOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"configuration_governance\", \"V1\", \"ListAttachments\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\tif listAttachmentsOptions.TransactionID != nil {\n\t\tbuilder.AddHeader(\"Transaction-Id\", fmt.Sprint(*listAttachmentsOptions.TransactionID))\n\t}\n\n\tif listAttachmentsOptions.Limit != nil {\n\t\tbuilder.AddQuery(\"limit\", fmt.Sprint(*listAttachmentsOptions.Limit))\n\t}\n\tif listAttachmentsOptions.Offset != nil {\n\t\tbuilder.AddQuery(\"offset\", fmt.Sprint(*listAttachmentsOptions.Offset))\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = configurationGovernance.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalAttachmentList)\n\tif err != nil {\n\t\treturn\n\t}\n\tresponse.Result = result\n\n\treturn\n}", "title": "" }, { "docid": "b41542c5b7148b48e1ad9edadbfc0c00", "score": "0.39284688", "text": "func NewLogUploadCompleteParamsWithContext(ctx context.Context) *LogUploadCompleteParams {\n\tvar ()\n\treturn &LogUploadCompleteParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "8321ab9a4df86afdc8526f682df3f9bf", "score": "0.3925972", "text": "func (c *Client) ValidateWebhookWithContext(ctx context.Context, eventBody []byte, headers map[string]interface{}, webhookSecret string) (out *Event, err error) {\n\teasypostHmacSignature, signaturePresent := headers[\"X-Hmac-Signature\"].(string)\n\n\tif signaturePresent {\n\t\tnormalizedSecret := norm.NFKD.String(webhookSecret)\n\t\tencodedSecret := []byte(normalizedSecret)\n\n\t\texpectedSignature := hmac.New(sha256.New, encodedSecret)\n\t\texpectedSignature.Write(eventBody)\n\n\t\tdigest := \"hmac-sha256-hex=\" + hex.EncodeToString(expectedSignature.Sum(nil))\n\n\t\tif hmac.Equal([]byte(digest), []byte(easypostHmacSignature)) {\n\t\t\tvar webhookBody Event\n\t\t\tif err = json.Unmarshal(eventBody, &webhookBody); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t} else {\n\t\t\t\treturn &webhookBody, nil\n\t\t\t}\n\t\t} else {\n\t\t\treturn nil, MismatchWebhookSignatureError\n\t\t}\n\t} else {\n\t\treturn nil, MissingWebhookSignatureError\n\t}\n}", "title": "" }, { "docid": "a9a9a763dcedd4d9bfcab4040f7d716d", "score": "0.39209187", "text": "func (c *CryptoClient) UploadPartWithContextWithPSK(ctx aws.Context, input *s3.UploadPartInput, psk []byte, opts ...request.Option) (*s3.UploadPartOutput, error) {\n\treq, out := c.UploadPartRequestWithPSK(input, psk)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "dfca2df5279a442d5f26990200384678", "score": "0.3918071", "text": "func NewUpdatePluginParamsWithContext(ctx context.Context) *UpdatePluginParams {\n\tvar ()\n\treturn &UpdatePluginParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "14e75a695d7d0b2f2dda0165b3e09fd4", "score": "0.39123046", "text": "func NewUpdateGUIDParamsWithContext(ctx context.Context) *UpdateGUIDParams {\n\tvar ()\n\treturn &UpdateGUIDParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "7241030bb599fef44519fe2ba26fdf01", "score": "0.39095908", "text": "func NewValidateUpdateAwsCredentialParamsWithContext(ctx context.Context) *ValidateUpdateAwsCredentialParams {\n\tvar ()\n\treturn &ValidateUpdateAwsCredentialParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "8383db224c83854914026bc29c47483c", "score": "0.39074978", "text": "func (o *PutLolChatV1MeParams) WithContext(ctx context.Context) *PutLolChatV1MeParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" } ]
446fdef0125ab505355f1bd044ac6ab1
Key function returns key value.
[ { "docid": "1d7972efd23ce9ba8ac74d9877bdb9db", "score": "0.0", "text": "func (e NrcgiValidationError) Key() bool { return e.key }", "title": "" } ]
[ { "docid": "237e5ea3666cb689299b4b70ee6fe271", "score": "0.7397974", "text": "func (m *KeyValue) GetKey()(*string) {\n return m.key\n}", "title": "" }, { "docid": "803a34d99733371be76d0b776cd0d1f5", "score": "0.703695", "text": "func (f binaryEqualsFunc) key() Key {\n\treturn f.k\n}", "title": "" }, { "docid": "19ee60a2c8375ef53fb4cfddcdd2f242", "score": "0.7026126", "text": "func (m *KeyUint) Key() driver.Value { return driver.Value(m.ID) }", "title": "" }, { "docid": "d03ec8194467a3537c1b69d2b4dc1974", "score": "0.69730234", "text": "func (m *OMap) Key(n int) string {\n\treturn m.keys[n]\n}", "title": "" }, { "docid": "b6f3af8e61ec4d701e7592d28caa12f2", "score": "0.69701165", "text": "func (t *Type) Key() *Type", "title": "" }, { "docid": "b7cf6ad40d56ef06fd49c3d9dbb6ca45", "score": "0.69472975", "text": "func (f nullFunc) key() Key {\n\treturn f.k\n}", "title": "" }, { "docid": "a49f3ccf876281b265c748057f7f9c42", "score": "0.682121", "text": "func (v Variable) Key() string {\n\treturn (string)(v)\n}", "title": "" }, { "docid": "8a7abaf41e88d6af5f7052c8b1ee56f8", "score": "0.67752403", "text": "func (i GinJwtSignAlgorithm) Key() string {\n\tif val, ok := _GinJwtSignAlgorithmValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "950111b5d8fac5fff8472dcc4ff73561", "score": "0.6702173", "text": "func (g *Generator) GetKey(K string) interface{} {\n\treturn g.data[K]\n}", "title": "" }, { "docid": "bbddac0cad219025f3f20012db1c6346", "score": "0.6691155", "text": "func (m *SearchBucket) GetKey()(*string) {\n return m.key\n}", "title": "" }, { "docid": "22ff881b756cee2db14639398ad29abe", "score": "0.66223186", "text": "func (f *Filter) getKey(key string) string {\n\tif f.HashKeys {\n\t\th := sha1.New()\n\t\ts := h.Sum([]byte(key))\n\t\treturn fmt.Sprintf(\"%x\", s)\n\t}\n\treturn key\n}", "title": "" }, { "docid": "7e47a533c875f35782644c32f2f2cab9", "score": "0.6602185", "text": "func getKey(ing *extensions.Ingress, t *testing.T) string {\n\tkey, err := keyFunc(ing)\n\tif err != nil {\n\t\tt.Fatalf(\"Unexpected error getting key for Ingress %v: %v\", ing.Name, err)\n\t}\n\treturn key\n}", "title": "" }, { "docid": "45bde8ade6c716ba11d9993d12c48f41", "score": "0.66009104", "text": "func (f *field) Key() string {\n\treturn f.k\n}", "title": "" }, { "docid": "5e774bbf94f3dc7158eb32028b43752a", "score": "0.65937275", "text": "func (i GinBindType) Key() string {\n\tif val, ok := _GinBindTypeValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "84247105b22685c254c81e9f1dbfae52", "score": "0.65673846", "text": "func (c Node) GetKey() string {\n\treturn c.key\n}", "title": "" }, { "docid": "df83f14eadd00b24165605e7d0883509", "score": "0.6555592", "text": "func (m *RegistryKeyState) GetKey()(*string) {\n return m.key\n}", "title": "" }, { "docid": "ea26290e8869c1f7fcb00c31e0291440", "score": "0.65304273", "text": "func (akv StringKeyValue) Key() string {\n\treturn akv.orig.Key\n}", "title": "" }, { "docid": "94518e91e595cf11d7efd617090dd7bb", "score": "0.6521155", "text": "func (a AddItem) Key() string { return string(a) }", "title": "" }, { "docid": "ba6afc72c6b99fe92ef81612268a2b5e", "score": "0.6511681", "text": "func (area *MineArea) GetKey() string {\n\treturn GetKey(area.X, area.Y)\n}", "title": "" }, { "docid": "cfc1d014af7d730b8a806b5c438c8c7e", "score": "0.65062934", "text": "func (d *Disk) getKey(p *DiskParams) []byte {\n\treturn []byte(time_util.TimeToName(time.Unix(p.ExicutionTime, 0), fmt.Sprintf(\"%x\", d.hasher.Sum(nil))))\n}", "title": "" }, { "docid": "57bee6250ce3bbfd5d92eb6509270cb6", "score": "0.64982766", "text": "func (e *OrderedMapElement[K, V]) Key() K {\n\treturn e.element.key\n}", "title": "" }, { "docid": "c9540b31c2264eec843e63587a7bfe28", "score": "0.64867014", "text": "func getKey(cluster *clusteroperator.Cluster, t *testing.T) string {\n\tif key, err := controller.KeyFunc(cluster); err != nil {\n\t\tt.Errorf(\"Unexpected error getting key for Cluster %v: %v\", cluster.Name, err)\n\t\treturn \"\"\n\t} else {\n\t\treturn key\n\t}\n}", "title": "" }, { "docid": "41e8185574e4672bb36f9e4c615a3915", "score": "0.6477575", "text": "func cacheKeyFunc(obj interface{}) (string, error) {\n\tkey := obj.(*cacheEntry).key\n\treturn key, nil\n}", "title": "" }, { "docid": "c1b30a9544ad248c6472dba7c9fc372a", "score": "0.6462233", "text": "func (node *Node) Key() interface{} {\n\treturn fmt.Sprintf(\"%v\", node.contents)\n}", "title": "" }, { "docid": "4cd1fae12489c0eddabd6e6ebec35f93", "score": "0.6456774", "text": "func (s *Mem) Key(key interface{}) string {\n\treturn fmt.Sprintf(\"%v-%v\", s.prefix, key)\n}", "title": "" }, { "docid": "8b9ae8fdf30da95eceab8676b4ed299b", "score": "0.6456152", "text": "func (vrfs *VRFShare) GetKey() datastore.Key {\n\treturn datastore.ToKey(fmt.Sprintf(\"%v\", vrfs.Round))\n}", "title": "" }, { "docid": "8f42856c5526858a3829519858c56546", "score": "0.6448241", "text": "func stringKeyFunc(obj interface{}) (string, error) {\n\tkey := obj.(*nodeidentity.Info).InstanceID\n\treturn key, nil\n}", "title": "" }, { "docid": "0ab65b85ae62582bf3cfad453497098b", "score": "0.6435275", "text": "func (e Enum) GetKey(value any) string {\n\tfor k, v := range e {\n\t\tif reflect.DeepEqual(v, value) {\n\t\t\treturn k\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "67bef58f6e77ca86bd9629dc74cdd3cc", "score": "0.6423325", "text": "func (m *Map) Key() Type { return m.key }", "title": "" }, { "docid": "9545326007d4799e8522c24226a1e51b", "score": "0.6412427", "text": "func getKey(w http.ResponseWriter, ps httprouter.Params) (string, bool){\n\treturn ps.ByName(\"id\"), true\n}", "title": "" }, { "docid": "e31abbef6059cb9fcd34e34edbbb4e15", "score": "0.64096636", "text": "func (v *Value) GetKey() *string {\n\tret := C.zj_GetKey(v.V)\n\tif ret == nil {\n\t\treturn nil\n\t}\n\tretStr := C.GoString(ret)\n\treturn &retStr\n}", "title": "" }, { "docid": "69872c159e0992fec741300e3123ce96", "score": "0.6403262", "text": "func (f *Factor) Key() string { return f.ID }", "title": "" }, { "docid": "3eee1cf616c7a5ad1fa588d75fdb5635", "score": "0.6395327", "text": "func (c *KeyValueChanger) Key() (string, error) {\n\tif c.err != nil {\n\t\treturn \"\", c.err\n\t}\n\treturn c.node.content.key().(string), nil\n}", "title": "" }, { "docid": "407602c455a65254b7647f924bca8635", "score": "0.63929945", "text": "func (a DataNodeKV) Key() string {\n\treturn a.K\n}", "title": "" }, { "docid": "8570ae57c0ab11d1a8cb540852b0e61f", "score": "0.6382585", "text": "func GetKey(allkeys [][]byte, loc Where) []byte {\n\tif loc == Left {\n\t\treturn allkeys[0]\n\t}\n\tif loc == Right {\n\t\treturn allkeys[len(allkeys)-1]\n\t}\n\t// select a random index between 1 and allkeys-2\n\t// nolint:gosec\n\tidx := rand.Int()%(len(allkeys)-2) + 1\n\treturn allkeys[idx]\n}", "title": "" }, { "docid": "eb246715dc9dc9dc8c38dcf6a54180dd", "score": "0.6378694", "text": "func KeyFunc(name, namespace string) string {\n\tif len(namespace) == 0 {\n\t\treturn name\n\t}\n\treturn namespace + \"/\" + name\n}", "title": "" }, { "docid": "52e49acc7a9996ab1ed4fa75dd79b910", "score": "0.63715774", "text": "func (it *Iterator) Key() string { return it.n.k }", "title": "" }, { "docid": "4cfea236fca94ea42af264640ac08559", "score": "0.63671046", "text": "func (s *session) getKey() string {\n\treturn s.uuid\n}", "title": "" }, { "docid": "a4b8f936e27c09f223b71339d041a5a5", "score": "0.635377", "text": "func (o SchedulingNodeAffinityOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SchedulingNodeAffinity) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c05e8f1d7e269c6fca4e703875309fd9", "score": "0.63430053", "text": "func (i SNSProtocol) Key() string {\n\tif val, ok := _SNSProtocolValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "ead3bd833cd777321e9646243794e52f", "score": "0.63418114", "text": "func (it *Iterator) Key() interface{} { return it.n.k }", "title": "" }, { "docid": "bdf38bbc4f4d87c37dbe7d9bbb289e3c", "score": "0.6339266", "text": "func getkey(key ...interface{}) interface{} {\n\tif len(key) > 0 {\n\t\treturn key[0]\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "acf23639d5be0415c2671c9be3f510e6", "score": "0.63258415", "text": "func (i SNSSubscribeAttribute) Key() string {\n\tif val, ok := _SNSSubscribeAttributeValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "32f74166c14a590f8cad35c12ce5db6f", "score": "0.6319039", "text": "func (it *iterator) Key() []byte {\n\tif len(it.keys) > 0 {\n\t\treturn []byte(it.keys[0])\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "01b4827067335cb6b50c638a1b7ba9a1", "score": "0.630293", "text": "func (this *DefaultHandler) GetKey(xesRedis redo.XesRedisBase) (ret string) {\n\tdefer func() {\n\t\tif xesRedis.GetCtx() == nil {\n\t\t\treturn\n\t\t}\n\t\tbench := xesRedis.GetCtx().Value(\"IS_BENCHMARK\")\n\t\tif cast.ToString(bench) == \"1\" {\n\t\t\tret = \"benchmark_\" + ret\n\t\t}\n\t}()\n\n\tkeyInfo := this.getKeyInfo(xesRedis)\n\tkey := cast.ToString(keyInfo[\"key\"])\n\tif key == \"\" {\n\t\tret = xesRedis.GetKeyName()\n\t\treturn\n\t}\n\tret = fmt.Sprintf(key, (xesRedis.GetKeyParams())...)\n\treturn\n}", "title": "" }, { "docid": "69867f57f2c7be87c64f5a28aa6e65d9", "score": "0.6300368", "text": "func (st *MemStorage) GetKey(gun, role string) (algorithm string, public []byte, err error) {\n\t// no need for lock. It's ok to return nil if an update\n\t// wasn't observed\n\tg, ok := st.keys[gun]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\tk, ok := g[role]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\n\treturn k.algorithm, k.public, nil\n}", "title": "" }, { "docid": "0c1b0b6b067b625902cbcb70aeb2b735", "score": "0.6298253", "text": "func (e *EntrySet) Get(key string) string {\n return e.keys[key]\n}", "title": "" }, { "docid": "49dfc0fd086dae1f84a206eb911b648f", "score": "0.6296133", "text": "func (v *V) Key() string {\n\treturn v.key\n}", "title": "" }, { "docid": "a38e472ddf532a0cc11c4a8a56af123e", "score": "0.6295445", "text": "func (it *Iter) Key() byte { return it.top().key }", "title": "" }, { "docid": "d52b6c1e24e6cc1d568383204b0821e1", "score": "0.6281786", "text": "func (s Stash) Key() string {\n\tvals := utils.MapValues(s.payload)\n\tif len(vals) < 1 {\n\t\treturn \"\"\n\t}\n\n\treturn fmt.Sprintf(\"$%s\", vals[0])\n}", "title": "" }, { "docid": "571c9eaff990cf65d30f0cb1125086af", "score": "0.6279424", "text": "func (i SNSPlatformApplicationAttribute) Key() string {\n\tif val, ok := _SNSPlatformApplicationAttributeValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "bd5da7ae2c92f203fe70385309cebd8b", "score": "0.6277453", "text": "func (o Operator) Key() string {\n\treturn fmt.Sprintf(\"operator.%s\", o.Aid)\n}", "title": "" }, { "docid": "164677dc1576aaf3ee7926997220c326", "score": "0.6277033", "text": "func (i *StringIterator) Key() Object {\n\treturn &Int{Value: int64(i.i - 1)}\n}", "title": "" }, { "docid": "5ae5791db648030a0a094b76c707f80e", "score": "0.62735796", "text": "func (mci *XMCacheIterator) Key() []byte {\n\tif mci.err != nil || mci.dir == dirReleased {\n\t\treturn nil\n\t}\n\tswitch mci.index {\n\tcase 0, 1:\n\t\treturn mci.iters[mci.index].Key()\n\tcase 2:\n\t\tif mci.mc.isPenetrate {\n\t\t\treturn mci.mIter.Key()\n\t\t}\n\t\treturn nil\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d0e97067e92211369524d4d90782805e", "score": "0.6269087", "text": "func (s *Arena) getKey(offset uint32, size uint16) []byte {\n\treturn s.data[offset : offset+uint32(size)]\n}", "title": "" }, { "docid": "3a15446cf6e42e1f2edbd79ba1dd4ecb", "score": "0.6262938", "text": "func (o ReservationAffinityOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ReservationAffinity) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1005e016964ae19c0fd24207710d9eff", "score": "0.62600297", "text": "func (f DefaultField) Key() string {\n\treturn f.K\n}", "title": "" }, { "docid": "58f195b29c13c426b25837bd68000651", "score": "0.6259835", "text": "func Key(v string) predicate.Blob {\n\treturn predicate.Blob(\n\t\tfunc(s *sql.Selector) {\n\t\t\ts.Where(sql.EQ(s.C(FieldKey), v))\n\t\t},\n\t)\n}", "title": "" }, { "docid": "49680efa7c553f52346395562464e011", "score": "0.6242855", "text": "func (m Match) Key() string {\n\treturn fmt.Sprintf(\"match:%s\", m.ID())\n}", "title": "" }, { "docid": "5413da883595763c3d9e86cb969b9e92", "score": "0.62427336", "text": "func (d *Activity) KeyVal() string {\n\treturn d.ExteralID\n}", "title": "" }, { "docid": "b6e356bb45ded92f0697be581852e790", "score": "0.6239893", "text": "func (key twofishKey) Key() []byte {\n\treturn key[:]\n}", "title": "" }, { "docid": "334c6cc61f7315ad6d53235116bcb0b8", "score": "0.6226979", "text": "func getKey(data string) string {\n\tsign := md5.Sum([]byte(data))\n\tsignStr := fmt.Sprintf(\"%x\", sign)\n\treturn signStr[:7]\n}", "title": "" }, { "docid": "697f629e69530e973bd814a20f3599f7", "score": "0.62228185", "text": "func (l *LangPackStringPluralized) GetKey() (value string) {\n\tif l == nil {\n\t\treturn\n\t}\n\treturn l.Key\n}", "title": "" }, { "docid": "c16cec578a02cc6531a703c38060c040", "score": "0.6216291", "text": "func (t Task) Key() string {\n\treturn fmt.Sprintf(\"%s:%s\", t.Name, t.ID)\n}", "title": "" }, { "docid": "828aa5d124a00ec9712926f80a21013a", "score": "0.62118614", "text": "func (k Keys) RangeKey() interface{} { return k[1] }", "title": "" }, { "docid": "ea64e79bd0521ef5c1631a2593943889", "score": "0.6209014", "text": "func (d *DStarLite) keyFor(s *dStarLiteNode) key {\n\t/*\n\t procedure CalculateKey(s)\n\t {01”} return [min(g(s), rhs(s)) + h(s_start, s) + k_m; min(g(s), rhs(s))];\n\t*/\n\tk := key{1: math.Min(s.g, s.rhs)}\n\tk[0] = k[1] + d.heuristic(d.s.Node, s.Node) + d.keyModifier\n\treturn k\n}", "title": "" }, { "docid": "c4a820b64655b31548fa55224cbc098b", "score": "0.62075627", "text": "func (stateID StateID) Key() string {\n\treturn string(stateID.LastAppHash)\n}", "title": "" }, { "docid": "520d18e6ea352545ae5568275cc21b67", "score": "0.619765", "text": "func (m *Metric) GetKey() string {\n\tif m == nil || m.Key == nil {\n\t\treturn \"\"\n\t}\n\treturn *m.Key\n}", "title": "" }, { "docid": "1c70cc3088e27d7e883f1540acca5330", "score": "0.6197426", "text": "func (u User) Key() interface{} {\n\treturn u.ID\n}", "title": "" }, { "docid": "60f810f86c215dffc869ad6cc2a6c95e", "score": "0.61971486", "text": "func (b *BitSet) Key() string {\n\tif b == nil {\n\t\treturn \"\"\n\t} else {\n\t\treturn string(b.Bits.Bytes())\n\t}\n}", "title": "" }, { "docid": "715f92074e1596760e3ba8dc81ce3594", "score": "0.6196739", "text": "func (e EnumByte) Key() EnumByteKey {\n return EnumByteKey(e)\n}", "title": "" }, { "docid": "62a3ddeaf298c31d91f8ffe7d8285b7d", "score": "0.6192416", "text": "func (n *lnode) key() []byte {\n\tbuf := (*[maxAllocSize]byte)(unsafe.Pointer(n))\n\treturn buf[n.pos : n.pos+n.ksize]\n}", "title": "" }, { "docid": "786e0023e3574eda7cc422a17a73498f", "score": "0.6191223", "text": "func (p *pv) key() pvKey {\n\treturn newPVKey(p.Cluster, p.Name)\n}", "title": "" }, { "docid": "bb00124ba41c64cb9b85fea692e18383", "score": "0.6183839", "text": "func (i *MapIterator) Key() Object {\n\tk := i.k[i.i-1]\n\treturn &String{Value: k}\n}", "title": "" }, { "docid": "2bb159dec1f2236486062277a6147fe2", "score": "0.6179522", "text": "func (k *KVItem) Key() (interface{}, error) {\n\tvar cKey unsafe.Pointer\n\tvar keySize C.uint64_t\n\tvar keyType C.tiledb_datatype_t\n\tret := C.tiledb_kv_item_get_key(k.context.tiledbContext, k.tiledbKVItem, &cKey, &keyType, &keySize)\n\n\tif ret != C.TILEDB_OK {\n\t\treturn nil, fmt.Errorf(\"Error getting key for KVItem: %s\", k.context.LastError())\n\t}\n\n\tswitch Datatype(keyType) {\n\tcase TILEDB_INT8:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_int8_t\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.int8_t)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]int8, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = int8(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn int8(*(*C.int8_t)(cKey)), nil\n\t\t}\n\tcase TILEDB_INT16:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_int16_t\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.int16_t)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]int16, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = int16(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn int16(*(*C.int16_t)(cKey)), nil\n\t\t}\n\tcase TILEDB_INT32:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_int32_t\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.int32_t)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]int32, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = int32(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn int32(*(*C.int32_t)(cKey)), nil\n\t\t}\n\tcase TILEDB_INT64:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_int64_t\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.int64_t)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]int64, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = int64(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn int64(*(*C.int64_t)(cKey)), nil\n\t\t}\n\tcase TILEDB_UINT8:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_uint8_t\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.uint8_t)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]uint8, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = uint8(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn int8(*(*C.uint8_t)(cKey)), nil\n\t\t}\n\tcase TILEDB_UINT16:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_uint16_t\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.uint16_t)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]uint16, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = uint16(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn int16(*(*C.uint16_t)(cKey)), nil\n\t\t}\n\tcase TILEDB_UINT32:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_uint32_t\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.uint32_t)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]uint32, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = uint32(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn int32(*(*C.uint32_t)(cKey)), nil\n\t\t}\n\tcase TILEDB_UINT64:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_uint64_t\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.uint64_t)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]uint64, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = uint64(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn int64(*(*C.uint64_t)(cKey)), nil\n\t\t}\n\tcase TILEDB_FLOAT32:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_float\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.float)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]float32, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = float32(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn float32(*(*C.float)(cKey)), nil\n\t\t}\n\tcase TILEDB_FLOAT64:\n\t\t// If the key size is greater than the size of a single value in bytes it is an array\n\t\telements := int(keySize) / C.sizeof_double\n\t\tif elements > 1 {\n\t\t\ttmpslice := (*[1 << 30]C.double)(unsafe.Pointer(cKey))[:elements:elements]\n\t\t\tretSlice := make([]float64, elements)\n\t\t\tfor i, s := range tmpslice {\n\t\t\t\tretSlice[i] = float64(s)\n\t\t\t}\n\t\t\treturn retSlice, nil\n\t\t} else {\n\t\t\treturn float64(*(*C.double)(cKey)), nil\n\t\t}\n\tcase TILEDB_CHAR:\n\t\telements := int(keySize) / C.sizeof_char\n\t\treturn C.GoStringN((*C.char)(cKey), C.int(elements)), nil\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Unsupported tiledb key type: %v\", keyType)\n\t}\n\n\treturn nil, fmt.Errorf(\"Error getting key for KVItem\")\n}", "title": "" }, { "docid": "d92e93a86c5871d179a757de71cecf45", "score": "0.6177141", "text": "func (u Users) Key(luid *windows.LUID) (int64, error) {\r\n\tif luid == nil {\r\n\t\treturn 0, errors.New(\"got empty LUID pointer\")\r\n\t}\r\n\tkey := int64(int64(luid.HighPart<<32) + int64(luid.LowPart))\r\n\treturn key, nil\r\n}", "title": "" }, { "docid": "eb3153167343c68d258ffcc8e85112d2", "score": "0.6172575", "text": "func (a *Anime) Key() string {\n\treturn fmt.Sprintf(\"anime:%d\", a.ID)\n}", "title": "" }, { "docid": "beb8e789f1940ee28651be2a26cd4a2c", "score": "0.61719537", "text": "func (m MapEntry) Key() interface{} {\n\treturn m.key\n}", "title": "" }, { "docid": "2f1204b7fef938e5693b96c7e3fc32f5", "score": "0.6170614", "text": "func (f KeyMakerFunc) KeyFor(r *http.Request) string {\n\treturn f(r)\n}", "title": "" }, { "docid": "3b8970f5f15b8e0df3b1146342981cb7", "score": "0.6162783", "text": "func (t *TimeSeries) GetKey() string {\n\treturn t.key\n}", "title": "" }, { "docid": "ec0b3d790e2721de271d3fc8161ba99c", "score": "0.61570954", "text": "func (m *Map) Get(key string) string {\n\tif m.IsEmpty() {\n\t\treturn \"\"\n\t}\n\thash := m.hash([]byte(key))\n\tn := node{hash: hash, key: key}\n\titer := floor(&m.nodes.Tree, &n)\n\tif iter == m.nodes.End() {\n\t\titer = m.nodes.Begin()\n\t}\n\treturn iter.Node().Key.(*node).key\n}", "title": "" }, { "docid": "847e4409738eecb63c771e9b08ba5c3f", "score": "0.6154456", "text": "func (t *ScheduledTask) Key() string {\n\treturn fmt.Sprintf(taskKeyFormat, keyPrefixScheduled, t.ID, t.score)\n}", "title": "" }, { "docid": "dd43d6eab39aa52c51887f8b4f346e2d", "score": "0.6152929", "text": "func (it *iterator) Key() []byte {\n\treturn it.current.key\n}", "title": "" }, { "docid": "ba856cb3615da0063622433a2a45dd15", "score": "0.615149", "text": "func (eln *EmptyLeafNode) GetKey() []byte {\n\treturn nil\n}", "title": "" }, { "docid": "14c241f480e72d0c774d2dc389f60cae", "score": "0.61509156", "text": "func (h dataUsageHash) Key() string {\n\treturn string(h)\n}", "title": "" }, { "docid": "a91f8301bfa9f59b7acb6baf07655def", "score": "0.61395836", "text": "func (c *Container) Key() string {\n\tc.Lock()\n\tdefer c.Unlock()\n\treturn c.ID\n}", "title": "" }, { "docid": "338aaaa53d2d107c22be90a109940c44", "score": "0.6138672", "text": "func (c Repository) GetKey(key string) string {\n\tval, err := c.Client.Get(key).Result()\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treturn val\n}", "title": "" }, { "docid": "797a317d2558388f92ea5aec71779e5f", "score": "0.61365676", "text": "func (f Base) Key() string {\n\treturn f.key\n}", "title": "" }, { "docid": "68566950a31e28bd9576f640e7e3b3d3", "score": "0.613636", "text": "func (o StudioComponentScriptParameterKeyValueOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v StudioComponentScriptParameterKeyValue) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7537054a6b01ab85badf3ae1b16f23f9", "score": "0.61338246", "text": "func (o *ResourceDefinitionFilter) GetKey() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Key\n}", "title": "" }, { "docid": "5d1634771afe6f87079640fe4d79e6ca", "score": "0.6133771", "text": "func (it *KeyAccess_Iterator) Key() interface{} {\n\treturn it.node.key\n}", "title": "" }, { "docid": "3942e016851b31d2fdb0e748320dd538", "score": "0.6129422", "text": "func (b Bucket) Key() interface{} {\n\treturn b[\"key\"]\n}", "title": "" }, { "docid": "e97009b67c5dc93732d00ffc2edbbc88", "score": "0.61284614", "text": "func (m *Map) Get(key string) string {\n\tif m.IsEmpty() {\n\t\treturn \"\"\n\t}\n\n\thash := int(m.hash([]byte(key)))\n\n\t// Binary search for appropriate replica.\n\tidx := sort.Search(len(m.keys), func(i int) bool { return m.keys[i] >= hash })\n\n\t// Means we have cycled back to the first replica.\n\tif idx == len(m.keys) {\n\t\tidx = 0\n\t}\n\n\treturn m.hashMap[m.keys[idx]]\n}", "title": "" }, { "docid": "49069ade2b5f14028a4e0a7207731f84", "score": "0.612092", "text": "func (c *Counter) GetKey() string {\n\treturn c.key\n}", "title": "" }, { "docid": "8e2e2771eee65941c8cf800b2393345d", "score": "0.6119081", "text": "func Key(id string, fallback string) Reference {\n\treturn key{id, fallback}\n}", "title": "" }, { "docid": "dac037cabf1e894cc59b1a9aeab10a77", "score": "0.61121005", "text": "func (a *PositionalAttribute) Key() string {\n\treturn AttrPositionalIndex + strconv.Itoa(a.Index)\n}", "title": "" }, { "docid": "14bf6fcb2165527ff10e33cb86f648c7", "score": "0.611087", "text": "func (n *Node) Key() interface{} {\n\treturn n.key\n}", "title": "" }, { "docid": "657d89748b605628ef978188ac72c989", "score": "0.6106958", "text": "func (e Timing) Key() string {\n\treturn e.Name\n}", "title": "" }, { "docid": "711c88ebf9dae858e7af3fefc1c45810", "score": "0.6106701", "text": "func Key(key string) query.Extractor {\n\treturn &keyExtractor{key}\n}", "title": "" }, { "docid": "d918bbafbe8974c39cc7225c3daf2f5d", "score": "0.61020154", "text": "func (i *Iterator) Key() []byte {\n\treturn i.iterator.Item().KeyCopy(nil)\n}", "title": "" }, { "docid": "294f7d52e97ebefc1e3482637afe2eeb", "score": "0.6100722", "text": "func (m *Metric) Key() string {\n\treturn fmt.Sprintf(\"<%s%d%s>\", m.Name, m.Timestamp, m.Tags)\n}", "title": "" } ]
4c162fded189adc6519abc0c0d14121c
newRunAnsibleCmd returns a command that will run an ansible operator.
[ { "docid": "7d029b364b4f0cc9ff25bf0be6438be1", "score": "0.85398453", "text": "func newRunAnsibleCmd() *cobra.Command {\n\tvar flags *aoflags.AnsibleOperatorFlags\n\trunAnsibleCmd := &cobra.Command{\n\t\tUse: \"ansible\",\n\t\tShort: \"Runs as an ansible operator\",\n\t\tLong: `Runs as an ansible operator. This is intended to be used when running\nin a Pod inside a cluster. Developers wanting to run their operator locally\nshould use \"up local\" instead.`,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tlogf.SetLogger(zap.Logger())\n\n\t\t\treturn ansible.Run(flags)\n\t\t},\n\t}\n\tflags = aoflags.AddTo(runAnsibleCmd.Flags())\n\n\treturn runAnsibleCmd\n}", "title": "" } ]
[ { "docid": "df80d562e7c14d31213b9e3602605499", "score": "0.6011268", "text": "func Ansible() *cobra.Command {\n\n\tcmd := &cobra.Command{\n\t\tUse: \"build\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\n\t\t\tvim, scenario, err := initJettison()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer vim.Database().Close()\n\n\t\t\tdeployer := internal.NewDeployer(scenario, vim)\n\n\t\t\t_, err = deployer.Execute(jettypes.AnsiblePlaybook)\n\t\t\t_, err = deployer.Execute(jettypes.AnsibleInventory)\n\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(RegeneratePlaybook())\n\tcmd.AddCommand(RegenerateInventory())\n\n\treturn cmd\n}", "title": "" }, { "docid": "d4aa10aedb2dc6b35a8f0fb72c1059b4", "score": "0.5691511", "text": "func newCmd(ctx Context, script string) *exec.Cmd {\n\tinterpreter := defaultInterpreter\n\tif len(ctx.Interpreter) > 0 {\n\t\tinterpreter = ctx.Interpreter\n\t}\n\n\tpath := interpreter[0]\n\targs := []string{script}\n\tif len(interpreter) > 1 {\n\t\targs = append(interpreter[1:], args...)\n\t}\n\n\tcmd := execCommand(path, args...)\n\tcmd.Dir = ctx.Dir\n\treturn cmd\n}", "title": "" }, { "docid": "c27fa46ac2a071d077169d261fc952a9", "score": "0.56428766", "text": "func newCommand(dir, name string, args ...string) *exec.Cmd {\n\tcmd := exec.Command(name, args...)\n\tcmd.Dir = dir\n\tcmd.Stderr = os.Stderr\n\tcmd.Stdout = os.Stdout\n\treturn cmd\n}", "title": "" }, { "docid": "f50a394c7e967ab06ae38d74b9ab7d85", "score": "0.56276023", "text": "func newPingCmd(args *launchArgs) (*pingCmd, error) {\n\treturn &pingCmd{}, nil\n}", "title": "" }, { "docid": "660f1e41bda9ab99f16b2e6d4f997302", "score": "0.5601639", "text": "func newCmdRunner(p runCmdProperties) (Runner, error) {\n\tif p.code == \"\" {\n\t\treturn nil, errors.New(\"No code specified to run\")\n\t}\n\n\tcmd := runCmd{}\n\n\tpath, err := exec.LookPath(strings.Fields(p.runner)[0])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcmd.Path = path\n\tcmd.Args = append(cmd.Args, strings.Fields(p.runner)...)\n\terr = cmd.writeTempFile(p.code, p.fileExtension)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcmd.Args = append(cmd.Args, cmd.tmpFile)\n\tcmd.Dir = p.workdir\n\tcmd.Env = append(cmd.Env, os.Environ()...)\n\tcmd.Env = append(cmd.Env, p.env...)\n\tcmd.Stdin = os.Stdin\n\n\treturn &cmd, nil\n}", "title": "" }, { "docid": "f2e061eaaba50dd3b011e5d978b78518", "score": "0.5369812", "text": "func NewRemoteCommand(rootSettings *environment.AirshipCTLSettings) *cobra.Command {\n\tremoteRootCmd := &cobra.Command{\n\t\tUse: \"remote\",\n\t\tShort: \"Control remote entities, i.e. hosts.\",\n\t}\n\n\tpowerOffCmd := NewPowerOffCommand(rootSettings)\n\tremoteRootCmd.AddCommand(powerOffCmd)\n\n\tpowerStatusCmd := NewPowerStatusCommand(rootSettings)\n\tremoteRootCmd.AddCommand(powerStatusCmd)\n\n\trebootCmd := NewRebootCommand(rootSettings)\n\tremoteRootCmd.AddCommand(rebootCmd)\n\n\treturn remoteRootCmd\n}", "title": "" }, { "docid": "f404edb77abfd0ae8a47df11fb7ed98f", "score": "0.5363182", "text": "func newExecCommand(devfileObj parser.DevfileObj, command v1alpha2.Command) *execCommand {\n\treturn &execCommand{\n\t\tcommand: command,\n\t\tdevfileObj: devfileObj,\n\t}\n}", "title": "" }, { "docid": "896bbef221ad1029bde035e6646270cd", "score": "0.52979004", "text": "func (e *DefaultExecutor) ansibleExec(name string, args []string) (int, error) {\n\tif e.Writer == nil {\n\t\te.Writer = os.Stdout\n\t}\n\n\t// Fake exit code for return in direct error cases\n\texitCode := 555\n\n\tcmd := exec.Command(name, args...)\n\n\t// Scan Stderr\n\tcmdStderr, err := cmd.StderrPipe()\n\tif err != nil {\n\t\treturn exitCode, err\n\t}\n\terrrScan := bufio.NewScanner(cmdStderr)\n\tgo func() {\n\t\tfor errrScan.Scan() {\n\t\t\tfmt.Fprintf(e.Writer, \"%s\\n\", errrScan.Text())\n\t\t}\n\t}()\n\n\t// Scan Stdout\n\tcmdStdout, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn exitCode, err\n\t}\n\toutScan := bufio.NewScanner(cmdStdout)\n\tgo func() {\n\t\tfor outScan.Scan() {\n\t\t\tfmt.Fprintf(e.Writer, \"%s\\n\", outScan.Text())\n\t\t}\n\t}()\n\n\t// Start command\n\terr = cmd.Start()\n\tif err != nil {\n\t\treturn exitCode, err\n\t}\n\n\t// Wait for command finish\n\terr = cmd.Wait()\n\tif err != nil {\n\t\tif exitErr, ok := err.(*exec.ExitError); ok {\n\t\t\tif stat, ok := exitErr.Sys().(syscall.WaitStatus); ok {\n\t\t\t\texitCode = stat.ExitStatus()\n\t\t\t}\n\t\t}\n\t\treturn exitCode, err\n\t}\n\n\twaitStat := cmd.ProcessState.Sys().(syscall.WaitStatus)\n\texitCode = waitStat.ExitStatus()\n\n\treturn exitCode, nil\n}", "title": "" }, { "docid": "8e83176556c552f197a453dca175d2b0", "score": "0.52968746", "text": "func newUpgradeCmd(fs afero.Fs) *cobra.Command {\n\toptions := defaultOptions\n\tvar parameters []string\n\tupgradeCmd := &cobra.Command{\n\t\tUse: \"upgrade <name>\",\n\t\tShort: \"Upgrade KUDO package.\",\n\t\tLong: upgradeDesc,\n\t\tExample: upgradeExample,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\t// Prior to command execution we parse and validate passed arguments\n\t\t\tvar err error\n\t\t\toptions.Parameters, err = install.GetParameterMap(parameters)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.WithMessage(err, \"could not parse arguments\")\n\t\t\t}\n\t\t\treturn runUpgrade(args, options, fs, &Settings)\n\t\t},\n\t}\n\n\tupgradeCmd.Flags().StringVar(&options.InstanceName, \"instance\", \"\", \"The instance name.\")\n\tupgradeCmd.Flags().StringArrayVarP(&parameters, \"parameter\", \"p\", nil, \"The parameter name and value separated by '='\")\n\tupgradeCmd.Flags().StringVar(&options.RepoName, \"repo\", \"\", \"Name of repository configuration to use. (default defined by context)\")\n\tupgradeCmd.Flags().StringVar(&options.PackageVersion, \"version\", \"\", \"A specific package version on the official repository. When installing from other sources than official repository, version from inside operator.yaml will be used. (default to the most recent)\")\n\n\treturn upgradeCmd\n}", "title": "" }, { "docid": "2acb8960b92a8debd67782d7ad53b59c", "score": "0.52579904", "text": "func newConnectCmd() *subcommands.Command {\n\treturn &subcommands.Command{\n\t\tUsageLine: \"connect -dir <path> -server <server> -user <name>\",\n\t\tShortDesc: \"connects to a swarming server\",\n\t\tLongDesc: \"Connects to a Swarming server.\",\n\t\tCommandRun: func() subcommands.CommandRun {\n\t\t\tcmd := &connectCmd{}\n\t\t\tcmd.Initialize()\n\t\t\tcmd.Flags.StringVar(&cmd.dir, \"dir\", \"\", \"Path to use as the Swarming bot directory.\")\n\t\t\tcmd.Flags.StringVar(&cmd.provider, \"provider\", \"\", \"Provider server URL to retrieve Swarming server URL from.\")\n\t\t\tcmd.Flags.StringVar(&cmd.server, \"server\", \"\", \"Deprecated. Use -provider.\")\n\t\t\tcmd.Flags.StringVar(&cmd.user, \"user\", \"\", \"Name of the local user to start the Swarming bot process as.\")\n\t\t\tcmd.Flags.StringVar(&cmd.python, \"python\", defaultFlagPython(), \"Path to the python to start the Swarming bot process.\")\n\t\t\treturn cmd\n\t\t},\n\t}\n}", "title": "" }, { "docid": "420e92f8fa487a23fb183f61436d2c93", "score": "0.52492636", "text": "func NewCmd(args []string) (cmd Cmd) {\n\tif len(args) < 2 {\n\t\tcmd.Usage(\"subcommand required: run|inventory\\n\")\n\t}\n\n\tcmd.Process = args[0]\n\tcmd.Command = args[1]\n\n\tif len(args) > 2 {\n\t\tcmd.Args = args[2:]\n\t} else {\n\t\tcmd.Args = []string{}\n\t}\n\n\tcmd.FlagSet = flag.NewFlagSet(cmd.Process, flag.ExitOnError)\n\tcmd.FlagSet.Usage = func() {\n\t\tfmt.Fprintf(os.Stderr, \"Usage of %s:\\n\", os.Args[0])\n\t\tcmd.FlagSet.PrintDefaults()\n\t\tos.Exit(2)\n\t}\n\n\treturn cmd\n}", "title": "" }, { "docid": "76ca3cd18a2f5f75b45997ac36cb5c81", "score": "0.52453566", "text": "func newCreateAuthenticatorCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Command {\n\toptions := edgeOptions{\n\t\tCommonOptions: common.CommonOptions{Factory: f, Out: out, Err: errOut},\n\t\tOutputJSONResponse: false,\n\t}\n\n\tcmd := &cobra.Command{\n\t\tUse: \"authenticator\",\n\t\tShort: \"creates an authenticator for an identity managed by the Ziti Edge Controller\",\n\t\tLong: \"creates an authenticator for an identity managed by the Ziti Edge Controller\",\n\t}\n\n\tcmd.AddCommand(newCreateAuthenticatorUpdb(\"updb\", options))\n\n\treturn cmd\n}", "title": "" }, { "docid": "d60ed42ee637a17fcd70a7b825b936ed", "score": "0.520991", "text": "func NewCommand(\n\t_ context.Context,\n\t_ *sync.WaitGroup,\n\tlc logger.LoggingClient,\n\tconf *config.ConfigurationStruct,\n\targs []string) (interfaces.Command, error) {\n\tcmd := cmd{\n\t\tloggingClient: lc,\n\t\tclient: pkg.NewRequester(lc).Insecure(),\n\t\tconfiguration: conf,\n\t\tretryTimeout: defaultRetryTimeout,\n\t}\n\tvar dummy string\n\n\tflagSet := flag.NewFlagSet(CommandName, flag.ContinueOnError)\n\tflagSet.StringVar(&dummy, \"confdir\", \"\", \"\") // handled by bootstrap; duplicated here to prevent arg parsing errors\n\n\terr := flagSet.Parse(args)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to parse command: %s: %w\", strings.Join(args, \" \"), err)\n\t}\n\n\treturn &cmd, nil\n}", "title": "" }, { "docid": "c22657419bac7f18ed0dc0ee32b82436", "score": "0.5121858", "text": "func newAgentCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"agent\",\n\t\tShort: \"Starts listening for NBD connections\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tif err := config.Read(); err != nil {\n\t\t\t\tlog.Fatalf(\"Failed to read config files: %s\", err)\n\t\t\t}\n\t\t},\n\t}\n\n\treturn cmd\n}", "title": "" }, { "docid": "9e6aa5ce7349b0641707040d02322794", "score": "0.5117516", "text": "func (commandRunner CommandRunner) createCommand(cmdLine []string, workdir string, env map[string]string) (*exec.Cmd, error) {\n\n\tvar cmdPath string\n\tvar cmdArgs []string\n\n\tswitch len(cmdLine) {\n\tcase 0:\n\t\treturn nil, ErrEmptyCommand\n\tcase 1:\n\t\tcmdPath = cmdLine[0]\n\t\tcmdArgs = make([]string, 0)\n\tdefault:\n\t\tcmdPath = cmdLine[0]\n\t\tcmdArgs = cmdLine[1:]\n\t}\n\n\tcommand := exec.Command(cmdPath, cmdArgs...)\n\tcommand.Env = os.Environ()\n\tif workdir != \"\" {\n\t\tcommand.Dir = workdir\n\t}\n\n\tfor key, val := range env {\n\t\tcommand.Env = append(command.Env, fmt.Sprintf(\"%s=%s\", key, val))\n\t}\n\n\treturn command, nil\n\n}", "title": "" }, { "docid": "e9e05468f877523bc9304328e2c52285", "score": "0.50884783", "text": "func NewCommand() *cobra.Command {\n\topts, err := options.NewOptions()\n\tif err != nil {\n\t\tklog.Fatalf(\"can't get options: %v\", err)\n\t}\n\tcmd := &cobra.Command{\n\t\tUse: \"operator\",\n\t\tLong: \"operator watches CRD and creates CI/CD flow\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tklog.Infof(\"Version: %v\", version.Version())\n\t\t\tprintFlags(cmd.Flags())\n\n\t\t\tcfg, err := opts.Config()\n\t\t\tif err != nil {\n\t\t\t\tklog.Fatalf(\"can't parse options to config: %v\", err)\n\t\t\t}\n\n\t\t\tstopCh := make(chan struct{})\n\t\t\tif err := Run(cfg, stopCh); err != nil {\n\t\t\t\tklog.Fatalf(\"run operator failed: %v\", err)\n\t\t\t}\n\t\t},\n\t}\n\topts.AddFlags(cmd.Flags())\n\n\tcmd.AddCommand(NewVersionCmd())\n\n\treturn cmd\n}", "title": "" }, { "docid": "a451518ed7a67b3844e09159917cd934", "score": "0.5011706", "text": "func New(dir, name string, args ...string) Command {\n\tc := Command{\n\t\tcmd: exec.Command(name, args...),\n\t}\n\tc.cmd.Dir = dir\n\n\treturn c\n}", "title": "" }, { "docid": "b6ac378ad0a0546421ea273061df5e46", "score": "0.49929675", "text": "func NewSubCmd() *cobra.Command {\n\treturn subCmd\n}", "title": "" }, { "docid": "ebf150c61dcd28852cda0c72bb28b447", "score": "0.49775767", "text": "func NewCmd() *cobra.Command {\n\tnewCmd := &cobra.Command{\n\t\tUse: \"migrate\",\n\t\tShort: \"Adds source code to an operator\",\n\t\tLong: `operator-sdk migrate adds a main.go source file and any associated source files` +\n\t\t\t`for an operator that is not of the \"go\" type.`,\n\t\tRunE: migrateRun,\n\t\tDeprecated: \"and will be removed prior to operator-sdk v1.0.0\",\n\t}\n\n\tnewCmd.Flags().StringVar(&headerFile, \"header-file\", \"\",\n\t\t\"Path to file containing headers for generated Go files. Copied to hack/boilerplate.go.txt\")\n\tnewCmd.Flags().StringVar(&repo, \"repo\", \"\",\n\t\t\"Project repository path. Used as the project's Go import path. This must be set if outside of \"+\n\t\t\t\"$GOPATH/src (e.g. github.com/example-inc/my-operator)\")\n\n\treturn newCmd\n}", "title": "" }, { "docid": "b177f91634e00e52f8a2d24c4c8cf744", "score": "0.49774888", "text": "func New(cmd string) Interface {\n\tcmdSplit := strings.Split(cmd, \" \")\n\tname := cmdSplit[0]\n\targs := cmdSplit[1:]\n\tc := exec.Command(name, args...)\n\n\treturn &command{*c}\n}", "title": "" }, { "docid": "63ab92b0458e97ee32706254e747660b", "score": "0.4971685", "text": "func NewAddCommand(activityRepo persistence.ActivityRepository) *cobra.Command {\n\taddCmd := &cobra.Command{\n\t\tUse: \"add\",\n\t\tShort: \"Adds a new activity\",\n\t\tLong: \"Registers a new activity to be tracked. You can also add an alias to the activity.\",\n\t\tArgs: cobra.ExactArgs(1),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tactivity := core.Activity{Name: args[0], Alias: cmd.Flag(\"alias\").Value.String()}\n\t\t\terrUpdate := activityRepo.Update(activity)\n\t\t\tif errUpdate != nil {\n\t\t\t\tfmt.Println(errUpdate)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t},\n\t}\n\tadd := addCommand{}\n\taddCmd.Flags().StringVarP(&add.alias, \"alias\", \"a\", \"\", \"Activity alias\")\n\tadd.baseCmd = addCmd\n\treturn addCmd\n}", "title": "" }, { "docid": "ead637482c24a618f1bf9788dfc5c8f3", "score": "0.4963881", "text": "func NewCommand(deployerName string, newDeployer types.NewDeployer) *cobra.Command {\n\topt := &options{}\n\tcmd := &cobra.Command{\n\t\tUse: fmt.Sprintf(\"%s %s\", shim.BinaryName, deployerName),\n\t\t// we defer showing usage, so that we can include deployer and test\n\t\t// specific usage in RealMain(...)\n\t\tSilenceUsage: true,\n\t\tSilenceErrors: true,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\treturn runE(cmd, args, opt, deployerName, newDeployer)\n\t\t},\n\t}\n\n\t// we implement custom flag parsing below\n\tcmd.DisableFlagParsing = true\n\n\treturn cmd\n}", "title": "" }, { "docid": "ae082d9d749ab840e38747bf6e95efad", "score": "0.4946355", "text": "func NewCommandDeployer(name string) *cobra.Command {\n\tcfg := &config{\n\t\tConfig: clientcmd.NewConfig(),\n\t}\n\n\tcmd := &cobra.Command{\n\t\tUse: fmt.Sprintf(\"%s%s\", name, clientcmd.ConfigSyntax),\n\t\tShort: \"Run the OpenShift deployer\",\n\t\tLong: longCommandDesc,\n\t\tRun: func(c *cobra.Command, args []string) {\n\t\t\tif err := deploy(cfg); err != nil {\n\t\t\t\tglog.Fatal(err)\n\t\t\t}\n\t\t},\n\t}\n\n\tflag := cmd.Flags()\n\tcfg.Config.Bind(flag)\n\tflag.StringVar(&cfg.DeploymentName, \"deployment\", util.Env(\"OPENSHIFT_DEPLOYMENT_NAME\", \"\"), \"The deployment name to start\")\n\tflag.StringVar(&cfg.Namespace, \"namespace\", util.Env(\"OPENSHIFT_DEPLOYMENT_NAMESPACE\", \"\"), \"The deployment namespace\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "e919180a0121dc92fdcee901e4562b6e", "score": "0.49415892", "text": "func NewRunner(cmd *exec.Cmd) *Runner {\n\treturn &Runner{\n\t\ttemplateCmd: cmd,\n\t\tcmdString: strings.Join(cmd.Args, \" \"),\n\t\tmu: &sync.Mutex{},\n\t}\n}", "title": "" }, { "docid": "de1889dbff0633b67c5669f66e96b62d", "score": "0.49405584", "text": "func New(settings *environment.Settings) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: use,\n\t\tShort: desc,\n\t\tLong: longDesc,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tcmd.HelpFunc()(cmd, args)\n\t\t},\n\t}\n\n\tcmd.AddCommand(\n\t\tinstantiatecmd.New(settings),\n\t\tapprovecmd.New(settings),\n\t\tcommitcmd.New(settings),\n\t)\n\n\treturn cmd\n}", "title": "" }, { "docid": "e1e9ab14340f596a2f5dea5426f4ffa2", "score": "0.4912186", "text": "func NewCommand(ctx context.Context, name string, c *Opts) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: name,\n\t\tShort: name + \" implements the Liqo Virtual Kubelet logic.\",\n\t\tLong: name + \" implements the Liqo Virtual Kubelet logic.\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\treturn runRootCommand(ctx, c)\n\t\t},\n\t}\n\treturn cmd\n}", "title": "" }, { "docid": "211850f23ab057114a98652aac60a002", "score": "0.49111083", "text": "func (r Environments) NewCommand(ctx context.Context, name string) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: name[strings.LastIndex(name, \".\")+1:] + \" [flags] COMMAND\",\n\t\tArgs: require.Args(r.validation),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\trbytes, err := ioutil.ReadAll(cmd.InOrStdin())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttail := make([]string, 0)\n\t\t\t_ = json.Unmarshal(rbytes, &tail)\n\n\t\t\tout := cmd.OutOrStdout()\n\t\t\targs = append(args, tail...)\n\t\t\tenv, _ := cmd.Flags().GetString(\"env\")\n\t\t\treturn r.run(ctx, out, env, name, args)\n\t\t},\n\t\tSilenceErrors: true,\n\t\tSilenceUsage: true,\n\t}\n\n\tcmd.SetHelpFunc(r.helpFunc(cmd.HelpFunc()))\n\tcmd.SetHelpCommand(&cobra.Command{Hidden: true})\n\n\tflags := cmd.Flags()\n\tflags.SortFlags = false\n\tflags.StringP(\n\t\t\"env\", \"e\", global.DefaultEnvironment,\n\t\t\"Run with env `ENV` configurations.\",\n\t)\n\tflags.Bool(\"help\", false, \"Show help information.\")\n\treturn cmd\n}", "title": "" }, { "docid": "d21253f51c9cd76a05195dd451ce49f9", "score": "0.49085903", "text": "func createCommand(command string) *exec.Cmd {\n\n\targs, err := shellwords.Parse(command)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn nil\n\t}\n\n\tif len(args) > 1 {\n\t\treturn exec.Command(args[0], (args[1:])...)\n\n\t}\n\treturn exec.Command(args[0])\n\n}", "title": "" }, { "docid": "8fcaafe47f36741309c7bd591e84c0ce", "score": "0.49078125", "text": "func getRunTestRemoteCommand() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"test [tests]\",\n\t\tShort: \"Run integration tests on Kubernetes\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\trunTestsRemote(cmd, \"test\", args)\n\t\t},\n\t}\n\tcmd.Flags().StringP(\"cluster\", \"c\", getDefaultCluster(), \"the cluster on which to run the test\")\n\tcmd.Flags().Lookup(\"cluster\").Annotations = map[string][]string{\n\t\tcobra.BashCompCustom: {\"__onit_get_clusters\"},\n\t}\n\tcmd.Flags().IntP(\"timeout\", \"t\", 60*10, \"test timeout in seconds\")\n\treturn cmd\n}", "title": "" }, { "docid": "bd3e2e98f51b6b251077f4519e5d1e3b", "score": "0.49048933", "text": "func New(settings *environment.Settings) *cobra.Command {\n\treturn newCmd(settings, nil)\n}", "title": "" }, { "docid": "d8603ba5c1400f1c6bcbc7dc970c9b58", "score": "0.489399", "text": "func NewCmd(cmdStr string) (*exec.Cmd, error) {\n\tsegments, err := shellquote.Split(cmdStr)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"can't parse command\")\n\t}\n\treturn exec.Command(segments[0], segments[1:]...), nil\n}", "title": "" }, { "docid": "06355abc4351674accf518ade41ebfd5", "score": "0.48800847", "text": "func NewCommand(cmd string) *Command {\n\treturn &Command{\n\t\tCmd: cmd,\n\t\tTimeout: 1 * time.Minute,\n\t\texecuted: false,\n\t\tEnv: []string{},\n\t}\n}", "title": "" }, { "docid": "1569990a2bbf6bffc8a8f042a7f0225f", "score": "0.48515087", "text": "func newCmdFail(streams genericclioptions.IOStreams) *cobra.Command {\n\to := newfailOptions(streams, cmdFail)\n\n\tcmd := &cobra.Command{\n\t\tUse: \"fail [ExtendedDaemonSet name]\",\n\t\tShort: \"fail canary deployment\",\n\t\tExample: failExample,\n\t\tSilenceUsage: true,\n\t\tRunE: func(c *cobra.Command, args []string) error {\n\t\t\tif err := o.complete(c, args); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := o.validate(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn o.run()\n\t\t},\n\t}\n\n\to.configFlags.AddFlags(cmd.Flags())\n\n\treturn cmd\n}", "title": "" }, { "docid": "4e18f1cbad99223a4f4182ef821ae1bc", "score": "0.48456243", "text": "func NewNewCommand(owner string, repo string, args []string) NewCommand {\n\treturn NewCommand{\n\t\tOwner: owner,\n\t\tRepo: repo,\n\n\t\tBaseCommand: subcommand.BaseCommand{\n\t\t\tArgs: args,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "8b26886c779f232dc639e7280dbb2607", "score": "0.48300907", "text": "func newInstallCmd(client *http.Client) *cobra.Command {\n\tiCli := &installCli{httpClient: client}\n\n\tinstallCmd := &cobra.Command{\n\t\tUse: \"install version\",\n\t\tShort: \"Installs the specified go binary version from local or remote.\",\n\t\tLong: heredoc.Doc(`\n\t\t\tInstalls the specified go binary version from local or remote.\n\t\t\tIt fetches the version from the remote if not found locally before installing it.\n\t\t`),\n\t\tArgs: cobra.ExactArgs(1),\n\t\tPreRunE: iCli.setupConfig,\n\t\tRunE: iCli.run,\n\t}\n\n\tsetupInstallCliFlags(installCmd)\n\n\treturn installCmd\n}", "title": "" }, { "docid": "f326246272d0c065bddcb74132f852af", "score": "0.4818648", "text": "func NewCmdUpgradeIngress(f Factory, out io.Writer, errOut io.Writer) *cobra.Command {\n\toptions := &UpgradeIngressOptions{\n\t\tCreateOptions: CreateOptions{\n\t\t\tCommonOptions: CommonOptions{\n\t\t\t\tFactory: f,\n\t\t\t\tOut: out,\n\t\t\t\tErr: errOut,\n\t\t\t},\n\t\t},\n\t}\n\n\tcmd := &cobra.Command{\n\t\tUse: \"ingress\",\n\t\tShort: \"Upgrades Ingress rules\",\n\t\tAliases: []string{\"ing\"},\n\t\tLong: upgradeIngressLong,\n\t\tExample: upgradeIngressExample,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\toptions.Cmd = cmd\n\t\t\toptions.Args = args\n\t\t\terr := options.Run()\n\t\t\tCheckErr(err)\n\t\t},\n\t}\n\tcmd.Flags().BoolVarP(&options.Cluster, \"cluster\", \"\", false, \"Enable cluster wide Ingress upgrade\")\n\tcmd.Flags().StringArrayVarP(&options.Namespaces, \"namespaces\", \"\", []string{}, \"Namespaces to upgrade\")\n\tcmd.Flags().BoolVarP(&options.SkipCertManager, \"skip-certmanager\", \"\", false, \"Skips certmanager installation\")\n\treturn cmd\n}", "title": "" }, { "docid": "5eb9506643fce944ad3c8a8b3756faaa", "score": "0.4815259", "text": "func NewConvertCmd() *cobra.Command {\n\to := converter.New()\n\n\tcmd := &cobra.Command{\n\t\tUse: \"convert-kubeconfig\",\n\t\tShort: \"convert kubeconfig to use exec auth module\",\n\t\tSilenceUsage: true,\n\t\tRunE: func(c *cobra.Command, args []string) error {\n\t\t\to.Flags = c.Flags()\n\t\t\to.UpdateFromEnv()\n\n\t\t\tif err := o.Validate(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tpathOptions := clientcmd.NewDefaultPathOptions()\n\t\t\tpathOptions.LoadingRules.ExplicitPath, _ = o.Flags.GetString(\"kubeconfig\")\n\n\t\t\tif err := converter.Convert(o, pathOptions); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\to.AddFlags(cmd.Flags())\n\n\treturn cmd\n}", "title": "" }, { "docid": "5f6daabdb54efd5f202e214f4aaafc07", "score": "0.48131377", "text": "func AnsibleExec(v Task, t string) {\n\t// test with time sleep\n\ttime.Sleep(5 * time.Second)\n\tif v.Command.SU {\n\t\tfmt.Println(\"ansible-playbook -i inventories/\"+v.Inventory+\"/hosts\", v.Command.Playbook, \"--ask-su-pass -u\", v.Command.User, \"--tags\", t)\n\t} else {\n\t\tfmt.Println(\"ansible-playbook -i inventories/\"+v.Inventory+\"/hosts\", v.Command.Playbook, \"-u\", v.Command.User, \"--tags\", t)\n\t}\n}", "title": "" }, { "docid": "b5079be0cff24bb95d2a21c2348a510d", "score": "0.48115015", "text": "func ParseAnsibleCommands(ansibleStep *v1alpha1.AnsibleStep) ([]byte, error) {\n\tbuf := &bytes.Buffer{}\n\tvar dockerfile []byte\n\n\tansibleTemplateFunc := template.FuncMap{\n\t\t\"DirExists\": utils.DirExists,\n\t\t\"newLine\": func() string { return \"\\n\" },\n\t}\n\n\t// add newline to buffer before appending ansible commands\n\t//buf.WriteString(\"\\n\")\n\tbox := packr.NewBox(v1alpha1.AnsibleTemplateDir)\n\tfile, err := box.Find(v1alpha1.AnsibleTemplate)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tansibleTemplate, err := template.New(\"Ansible\").Funcs(ansibleTemplateFunc).Parse(string(file))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := validate.SetAnsibleDefaultIfNotPresent(ansibleStep); err != nil {\n\t\treturn nil, err\n\t}\n\n\tansibleStep.Workspace = fmt.Sprintf(\"%s/%s\", v1alpha1.AnsibleBase, ansibleStep.Workspace)\n\tif err := ansibleTemplate.Execute(buf, ansibleStep); err != nil {\n\t\treturn nil, err\n\t}\n\tdockerfileBytes := buf.Bytes()\n\tdockerfile = append(dockerfile, dockerfileBytes...)\n\treturn dockerfile, nil\n\n}", "title": "" }, { "docid": "a1e30da57e36d34d2eabe4312df2e9e4", "score": "0.4809668", "text": "func NewCommand(\n\t_ context.Context,\n\t_ *sync.WaitGroup,\n\tlc logger.LoggingClient,\n\tconfiguration *config.ConfigurationStruct,\n\targs []string) (interfaces.Command, error) {\n\n\tcmd := cmd{\n\t\tloggingClient: lc,\n\t\tclient: pkg.NewRequester(lc).Insecure(),\n\t\tconfiguration: configuration,\n\t}\n\tvar dummy string\n\n\tflagSet := flag.NewFlagSet(CommandName, flag.ContinueOnError)\n\tflagSet.StringVar(&dummy, \"confdir\", \"\", \"\") // handled by bootstrap; duplicated here to prevent arg parsing errors\n\tflagSet.StringVar(&cmd.httpURL, \"url\", \"\", \"get the status code returning from the input http URL address\")\n\n\terr := flagSet.Parse(args)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to parse command: %s: %w\", strings.Join(args, \" \"), err)\n\t}\n\n\tif len(cmd.httpURL) == 0 {\n\t\treturn nil, fmt.Errorf(\"%s %s: argument --url is required\", os.Args[0], CommandName)\n\t}\n\n\treturn &cmd, nil\n}", "title": "" }, { "docid": "62a5d331429da54fc83a0d7dc5e57ec9", "score": "0.4796065", "text": "func NewCommand(cmd string) *Command {\n\t// TODO: optional pwd, env, ...\n\tpwd, _ := os.Getwd()\n\n\t// Generate ID: timestamp, so if we runt the exact same command it doesn't conflict\n\tnow := time.Now()\n\ttimestamp := strconv.FormatInt(now.UTC().UnixNano(), 10)\n\tbs := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf(\"%s|%s\", cmd, timestamp)))\n\tid := string(bs)\n\n\tc := &Command{\n\t\tID: id,\n\t\tLogFile: \"\",\n\t\tRunning: false,\n\t\tPwd: pwd,\n\t\tCmdString: cmd,\n\t\tStartTime: now,\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "c80d2e5635baf41007cd2b9510987bc2", "score": "0.47958162", "text": "func GetNewCommand(cap int) *Command {\n\tcmd := Command{}\n\tcmd.args = make([]interface{}, 0, cap)\n\n\treturn &cmd\n}", "title": "" }, { "docid": "177f6645f7f834ed127dc85e7250fc33", "score": "0.479403", "text": "func NewRestartCmd() *cobra.Command {\n\tcmd := &RestartCmd{}\n\trestartCmd := &cobra.Command{\n\t\tUse: \"restart\",\n\t\tShort: \"Restarts the container if the restart helper is present\",\n\t\tArgs: cobra.NoArgs,\n\t\tRunE: cmd.Run,\n\t}\n\n\treturn restartCmd\n}", "title": "" }, { "docid": "33b8b4fcc2abefe59507b3b653a1f71a", "score": "0.47909075", "text": "func NewCmd(name string, arg ...string) *Cmd {\n\treturn &Cmd{\n\t\tcmd: exec.Command(name, arg...),\n\t}\n}", "title": "" }, { "docid": "eb677fe226c3febf683fbdc9f8bf98ed", "score": "0.47807097", "text": "func NewCmdDockerCompose(fullName string, f *clientcmd.Factory, in io.Reader, out, errout io.Writer) *cobra.Command {\n\toptions := &DockerComposeOptions{\n\t\tAction: configcmd.BulkAction{\n\t\t\tOut: out,\n\t\t\tErrOut: errout,\n\t\t},\n\t\tIn: in,\n\t\tGenerator: DockerComposeV1GeneratorName,\n\t}\n\tcmd := &cobra.Command{\n\t\tUse: \"docker-compose -f COMPOSEFILE\",\n\t\tShort: \"Import a docker-compose.yml project into OpenShift (experimental)\",\n\t\tLong: dockerComposeLong,\n\t\tExample: fmt.Sprintf(dockerComposeExample, fullName),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tkcmdutil.CheckErr(options.Complete(f, cmd, args))\n\t\t\tkcmdutil.CheckErr(options.Validate())\n\t\t\tif err := options.Run(); err != nil {\n\t\t\t\t// TODO: move met to kcmdutil\n\t\t\t\tif err == cmdutil.ErrExit {\n\t\t\t\t\tos.Exit(1)\n\t\t\t\t}\n\t\t\t\tkcmdutil.CheckErr(err)\n\t\t\t}\n\t\t},\n\t}\n\tusage := \"Filename, directory, or URL to docker-compose.yml file to use\"\n\tkubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage)\n\tcmd.MarkFlagRequired(\"filename\")\n\n\tcmd.Flags().String(\"generator\", options.Generator, \"The name of the API generator to use.\")\n\tcmd.Flags().StringVar(&options.AsTemplate, \"as-template\", \"\", \"If set, generate a template with the provided name\")\n\n\toptions.Action.BindForOutput(cmd.Flags())\n\tcmd.Flags().String(\"output-version\", \"\", \"The preferred API versions of the output objects\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "9290b870d2749a32ce3da0d70d1b92dc", "score": "0.47693852", "text": "func NewCommand(cmd string, args ...string) *Command {\n\treturn &Command{\n\t\texec.Command(cmd, args...),\n\t\t[]Cleaner{bytes.TrimSpace},\n\t}\n}", "title": "" }, { "docid": "2dd9d2b5a2b80b4705aaf5f8ec91413d", "score": "0.47690907", "text": "func newAddCommand(ctx context.Context) *cobra.Command {\n\tvar addCmd = &cobra.Command{\n\t\tUse: add.UseCommand,\n\t\tShort: add.LiqoctlAddShortHelp,\n\t\tLong: add.LiqoctlAddLongHelp,\n\t}\n\taddCmd.AddCommand(newAddClusterCommand(ctx))\n\treturn addCmd\n}", "title": "" }, { "docid": "e2d288416ce2e96820e3ccfe2c5e8a8b", "score": "0.47685534", "text": "func NewCommand() *CommandRunner {\n\treturn &CommandRunner{\n\t\tenv: map[string]string{},\n\t}\n}", "title": "" }, { "docid": "3a7e71fb97470bb96afe1b0b311478be", "score": "0.47647458", "text": "func NewCommand() (*exec.Cmd, error) {\n\tvar cmd *exec.Cmd\n\tswitch len(os.Args) {\n\tcase 0, 1:\n\t\treturn nil, fmt.Errorf(\"provide a binary which should be started\")\n\tcase 2:\n\t\tcmd = exec.Command(os.Args[1])\n\tdefault:\n\t\tcmd = exec.Command(os.Args[1], os.Args[2:]...)\n\t}\n\n\treturn cmd, nil\n}", "title": "" }, { "docid": "3f5ccc0f77efc201071d399a2309c6c4", "score": "0.47643375", "text": "func AdminTaskCommand(c Config, a AdminTaskArgs) *exec.Cmd {\n\tp := filepath.Join(c.BinDir, \"lucifer\")\n\targs := make([]string, 0, 6)\n\targs = append(args, \"admintask\")\n\targs = append(args, \"-autotestdir\", c.AutotestPath)\n\targs = appendCommonArgs(args, a.TaskArgs)\n\n\targs = append(args, \"-host\", a.Host)\n\targs = append(args, \"-task\", a.Task)\n\tif a.GCPProject != \"\" {\n\t\targs = append(args, \"-gcp-project\", a.GCPProject)\n\t}\n\n\tcmd := exec.Command(p, args...)\n\treturn cmd\n}", "title": "" }, { "docid": "96a5c34e24946e2efb57c224bfad0854", "score": "0.47395965", "text": "func RunAnsiblePlaybook(inventory string, playbook string) (cmdStdout string, cmdStderr string, exitCode int){\n\tvar cmd *exec.Cmd\n\n\tcmd = exec.Command(\"ansible-playbook\", \"-i\", inventory, playbook)\n\n\treturn RunCommand(cmd)\n}", "title": "" }, { "docid": "7ed0669293d826015995f5e1c119a69c", "score": "0.47356638", "text": "func newDiffCommand() *cobra.Command {\n\tc := &diffCommand{}\n\n\tcommand := &cobra.Command{\n\t\tUse: \"diff [flags]\",\n\t\tShort: fmt.Sprintf(\"Diff the state of a cluster with manifests\"),\n\t\tLong: `Discovers the differences between the actual kapps installed on a cluster compared \nto the kapps that should be present/absent according to the manifests.\n\nThis command checks the current state of a cluster by consulting the configured \nSource-of-Truth. It compares that against the list of kapps specified in the \nmanifests to be present or absent and then calculates which kapps should be \ninstalled and deleted.\n\nWhen run with '--extended' this command will also include the contents of each\nkapp's 'sugarkube.yaml' file (if it exists). This can be used to inform e.g.\na CI/CD system about the secrets that a kapp needs during installation.\n`,\n\t\tRunE: c.run,\n\t}\n\n\tf := command.Flags()\n\tf.BoolVar(&c.extended, \"extended\", false, \"include each kapp's 'sugarkube.yaml' file in output\")\n\n\treturn command\n}", "title": "" }, { "docid": "dc2bafeae3ecf0801b15dffae652087a", "score": "0.47331083", "text": "func NewCmd(ctx context.Context, args ...string) *Cmd {\n\tctx2, cancel := context.WithCancel(ctx)\n\tc := exec.CommandContext(ctx2, args[0], args[1:]...) // panic on empty args\n\tcmd := &Cmd{Cmd: c, ctx: ctx2, cancelCtx: cancel}\n\tcmd.copy.closers = map[io.Closer]*sync.Once{}\n\treturn cmd\n}", "title": "" }, { "docid": "d565b2d9d0a5994eb3142dd499ba00ec", "score": "0.4724508", "text": "func (self *Framework) PuppetAIOCmd(command string, def string) string {\n\treturn PuppetAIOCmd(command, def)\n}", "title": "" }, { "docid": "23f2ad928d9bf31ab4416ed129081135", "score": "0.47238895", "text": "func getRunCommand(registry *runner.TestRegistry) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"run {test,suite}\",\n\t\tShort: \"Run integration tests\",\n\t}\n\tcmd.AddCommand(getRunSuiteRemoteCommand(registry))\n\tcmd.AddCommand(getRunTestRemoteCommand())\n\treturn cmd\n}", "title": "" }, { "docid": "41188995252fc4cafc8987ecff599fef", "score": "0.4718059", "text": "func NewNativeDeployCommand(cli *Cli) *cobra.Command {\n\tc := new(NativeDeployCommand)\n\tc.cli = cli\n\tc.cmd = &cobra.Command{\n\t\tUse: \"deploy BINARY\",\n\t\tShort: \"[Deprecated] Deploy a native contract.\",\n\t\tArgs: cobra.MinimumNArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tctx := context.TODO()\n\t\t\treturn c.deploy(ctx, args[0])\n\t\t},\n\t}\n\tc.addFlags()\n\treturn c.cmd\n}", "title": "" }, { "docid": "9a194b334c18b35d868eddca62098461", "score": "0.47177592", "text": "func NewCMD(logger *zap.Logger) *CMD {\n\tc := &CMD{\n\t\tlogger: logger,\n\t}\n\n\troot := c.rootCommand()\n\tserve := c.serveCommand()\n\tmock := c.mockCommand()\n\n\troot.AddCommand(serve)\n\troot.AddCommand(mock)\n\n\tc.cmd = root\n\n\treturn c\n}", "title": "" }, { "docid": "66f92d80bcc898c89454f8f49cb06736", "score": "0.47127083", "text": "func NewConfigCommand(rootSettings *environment.AirshipCTLSettings) *cobra.Command {\n\tconfigRootCmd := &cobra.Command{\n\t\tUse: \"config\",\n\t\tDisableFlagsInUseLine: true,\n\t\tShort: \"Modify airshipctl config files\",\n\t\tLong: `Modify airshipctl config files using subcommands\nlike \"airshipctl config set-context my-context\" `,\n\t}\n\tconfigRootCmd.AddCommand(NewCmdConfigSetCluster(rootSettings))\n\tconfigRootCmd.AddCommand(NewCmdConfigGetCluster(rootSettings))\n\tconfigRootCmd.AddCommand(NewCmdConfigSetContext(rootSettings))\n\tconfigRootCmd.AddCommand(NewCmdConfigGetContext(rootSettings))\n\tconfigRootCmd.AddCommand(NewCmdConfigInit(rootSettings))\n\tconfigRootCmd.AddCommand(NewCmdConfigSetAuthInfo(rootSettings))\n\tconfigRootCmd.AddCommand(NewCmdConfigGetAuthInfo(rootSettings))\n\tconfigRootCmd.AddCommand(NewCmdConfigUseContext(rootSettings))\n\n\treturn configRootCmd\n}", "title": "" }, { "docid": "f68930419402b49db96155546678c52c", "score": "0.47029322", "text": "func NewCommand(c config.Flags) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"vn-agent\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\treturn run(&c)\n\t\t},\n\t}\n\n\tinstallFlags(cmd.Flags(), &c)\n\treturn cmd\n}", "title": "" }, { "docid": "dc8ad9ba65e5927237591f429f08b8f2", "score": "0.47005862", "text": "func newCommand(cmd string) (*mdm.Command, error) {\n\t// assemble a fake struct just for marshalling to plist\n\tfCmd := &struct {\n\t\tCommandUUID string\n\t\tCommand struct {\n\t\t\tRequestType string\n\t\t}\n\t}{\n\t\tCommandUUID: cmd,\n\t\tCommand: struct{ RequestType string }{cmd},\n\t}\n\t// marshal it to plist\n\trawBytes, err := plist.Marshal(fCmd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// return a real *mdm.Command which includes the marshalled JSON\n\treturn &mdm.Command{\n\t\tCommandUUID: fCmd.CommandUUID,\n\t\tCommand: fCmd.Command,\n\t\tRaw: rawBytes,\n\t}, nil\n}", "title": "" }, { "docid": "3eddf6e2939c0bd0e467574c24954817", "score": "0.4696081", "text": "func Command(name string, arg ...string) *exec.Cmd", "title": "" }, { "docid": "7d7548efa6c03e27d3f905e95987155d", "score": "0.4692973", "text": "func newArchiveCommand() *cobra.Command {\n\tvar forceNoDefaultIgnores bool\n\tvar forceDefaultIgnores bool\n\n\tcmd := &cobra.Command{\n\t\tUse: \"archive <path-to-archive>\",\n\t\tShort: \"create an archive suitable for deployment\",\n\t\tArgs: cmdutil.SpecificArgs([]string{\"path-to-archive\"}),\n\t\tRun: cmdutil.RunFunc(func(cmd *cobra.Command, args []string) error {\n\t\t\tif forceDefaultIgnores && forceNoDefaultIgnores {\n\t\t\t\treturn errors.New(\"can't specify --no-default-ignores and --default-ignores at the same time\")\n\t\t\t}\n\n\t\t\tproj, path, err := workspace.DetectProjectAndPath()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tuseDeafultIgnores := proj.UseDefaultIgnores()\n\n\t\t\tif forceDefaultIgnores {\n\t\t\t\tuseDeafultIgnores = true\n\t\t\t} else if forceNoDefaultIgnores {\n\t\t\t\tuseDeafultIgnores = false\n\t\t\t}\n\n\t\t\t// path is the path to the Pulumi.yaml file. Need its parent directory.\n\t\t\tdir := filepath.Dir(path)\n\t\t\tarchiveContents, err := archive.Process(dir, useDeafultIgnores)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"creating archive\")\n\t\t\t}\n\n\t\t\treturn ioutil.WriteFile(args[0], archiveContents.Bytes(), 0644)\n\t\t}),\n\t}\n\tcmd.PersistentFlags().BoolVar(\n\t\t&forceNoDefaultIgnores, \"--no-default-ignores\", false,\n\t\t\"Do not use default ignores, regardless of Pulumi.yaml\")\n\tcmd.PersistentFlags().BoolVar(\n\t\t&forceDefaultIgnores, \"--default-ignores\", false,\n\t\t\"Use default ignores, regardless of Pulumi.yaml\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "c689aaa98c37d42acf192c2114856ffb", "score": "0.46911386", "text": "func NewCmdRunner() (*CmdRunnerLocal, error) {\n\treturn &CmdRunnerLocal{}, nil\n}", "title": "" }, { "docid": "27becbd5360f80bc120d4ead6766d2bc", "score": "0.46463507", "text": "func newNodesCommand(base jenkinsCommand, cfg config.Jenkins) bot.Command {\n\treturn &nodesCommand{base, cfg}\n}", "title": "" }, { "docid": "55adad30c7201b0833fa3cf8909faab0", "score": "0.46451542", "text": "func NewCommand(cli *cli.Wrapper) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tArgs: cobra.NoArgs,\n\t\tUse: \"version\",\n\t\tShort: \"Print the rostamctl CLI version\",\n\t\tLong: \"Print the rostamctl CLI version\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tfmt.Println(fmt.Sprintf(\"rostamctl version %s\", Version()))\n\t\t\treturn nil\n\t\t},\n\t}\n\n\treturn cmd\n}", "title": "" }, { "docid": "128768dce79c4610d41fda5d62f95bd7", "score": "0.46423426", "text": "func NewCmd(bashCmd string) (*Cmd, error) {\n\tif bashCmd == \"\" {\n\t\treturn nil, errors.New(\"Invalid Argument\")\n\t}\n\tparams, err := shellquote.Split(bashCmd)\n\tif err != nil {\n\t\treturn nil, pkgerrors.Wrap(err, \"Split bash arguments\")\n\t}\n\n\tname := params[0]\n\tcmd := Cmd{\n\t\tName: name,\n\t\tArgs: params[1:],\n\t\tStdin: os.Stdin,\n\t\tStdout: os.Stdout,\n\t\tStderr: os.Stderr,\n\t}\n\treturn &cmd, nil\n}", "title": "" }, { "docid": "1d89fdafc4e537422e4fb486e73d5c2e", "score": "0.4634509", "text": "func newNewCmd(name string) *cobra.Command {\n\ttype options struct {\n\t\tdir string\n\t}\n\to := &options{}\n\tcmd := &cobra.Command{\n\t\tUse: fmt.Sprintf(\"%s [name] [key:value] [key:value]...\", name),\n\t\tShort: \"Generate new enum file\",\n\t\tLong: ``,\n\t\tArgs: func(cmd *cobra.Command, args []string) error {\n\t\t\tif len(args) < 1 {\n\t\t\t\treturn errors.New(\"requires enum name\")\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\treturn runNewCmd(args[0], args[1:])\n\t\t},\n\t}\n\n\tcmd.Flags().StringVarP(&o.dir, \"dir\", \"d\", \"goenum\", \"output dir for enum yaml\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "e8976e19bf37b00b849db700ebaa2680", "score": "0.46269378", "text": "func remoteAddCmd(remote string) *exec.Cmd {\n\tlogrus.Trace(\"returning remoteAddCmd\")\n\n\treturn exec.Command(\n\t\t\"git\",\n\t\t\"remote\",\n\t\t\"add\",\n\t\t\"origin\",\n\t\tremote,\n\t)\n}", "title": "" }, { "docid": "9bf3a8c43df28315fa2dd91549f409ab", "score": "0.46220416", "text": "func NewCommand(\n\tname string,\n\tbuilder appflag.Builder,\n\tmoduleReaderProvider bufcli.ModuleReaderProvider,\n) *appcmd.Command {\n\tflags := newFlags()\n\treturn &appcmd.Command{\n\t\tUse: name,\n\t\tShort: \"Check that the input location has no breaking changes compared to the against location.\",\n\t\tArgs: cobra.NoArgs,\n\t\tRun: builder.NewRunFunc(\n\t\t\tfunc(ctx context.Context, container applog.Container) error {\n\t\t\t\treturn run(ctx, container, flags, moduleReaderProvider)\n\t\t\t},\n\t\t),\n\t\tBindFlags: flags.Bind,\n\t}\n}", "title": "" }, { "docid": "1dc687a6eae3221873e4abe465c35b3f", "score": "0.46172687", "text": "func newRunnerPodForCR(cr *litmuschaosv1alpha1.ChaosEngine, aUUID types.UID, aExList []string) *corev1.Pod {\n\tlabels := map[string]string{\n\t\t\"app\": cr.Name,\n\t}\n\treturn &corev1.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name + \"-runner\",\n\t\t\tNamespace: cr.Namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: corev1.PodSpec{\n ServiceAccountName: \"chaos-operator\",\n\t\t\tContainers: []corev1.Container{\n\t\t\t\t{\n\t\t\t\t\tName: \"chaos-runner\",\n\t\t\t\t\tImage: \"openebs/ansible-runner:ci\",\n\t\t\t\t\tCommand: []string{\"/bin/bash\"},\n //TODO: Reconcile will restart tests. This has to be addressed \n Args: []string{\"-c\", \"ansible-playbook ./executor/test.yml -i /etc/ansible/hosts -vv; exit 0\"},\n Env: []corev1.EnvVar{\n {\n Name: \"CHAOSENGINE\",\n Value: cr.Name,\n },\n {\n Name: \"APP_LABEL\",\n Value: cr.Spec.Appinfo.Applabel,\n },\n {\n Name: \"APP_NAMESPACE\",\n Value: cr.Namespace,\n },\n {\n Name: \"EXPERIMENT_LIST\",\n //Value: fmt.Sprintf(strings.Join(aExList,\",\")),\n Value: fmt.Sprint(strings.Join(aExList,\",\")),\n },\n\t\t\t\t },\n },\n\t\t\t\t{\n\t\t\t\t\tName: \"chaos-exporter\",\n\t\t\t\t\tImage: \"litmuschaos/chaos-exporter:ci\",\n Env: []corev1.EnvVar{\n {\n Name: \"CHAOSENGINE\",\n Value: cr.Name,\n },\n {\n Name: \"APP_UUID\",\n Value: string(aUUID),\n },\n },\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "4b4687be3a9215cecf909bcc4c401693", "score": "0.46132526", "text": "func NewCmd(pConfig *cmd.PrepareConfiguration, loaders []cli.ResourceLoader) *cli.Command {\n\treturn &cli.Command{\n\t\tName: \"prepare\",\n\t\tDescription: `Prepare command.`,\n\t\tConfiguration: pConfig,\n\t\tRun: func(_ []string) error {\n\t\t\treturn prepareCommand(pConfig)\n\t\t},\n\t\tResources: loaders,\n\t}\n}", "title": "" }, { "docid": "9b1fb18934eefd50833cccf279a0d12a", "score": "0.4611857", "text": "func NewCommandRun() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"run <workload.py> | --image <imagename> | --psRawImage <ps raw image name> --workerRawImage <worker raw image name>\",\n\t\tArgs: cobra.MaximumNArgs(1),\n\t\tShort: \"create new-learningTask\",\n\t\tLong: `create new-learningTask`,\n\t\tRun: runWorkflow,\n\t}\n\n\t//set local flag\n\tutils.AddImageFlag(cmd)\n\tutils.AddNameSpaceFlag(cmd)\n\tutils.AddNameFlag(cmd)\n\tutils.AddSchedulerFlag(cmd)\n\tutils.AddNrPsFlag(cmd)\n\tutils.AddNrWorkerFlag(cmd)\n\tutils.AddGpuFlag(cmd)\n\tutils.AddPsRawImageFlag(cmd)\n\tutils.AddWorkerRawImageFlag(cmd)\n\tutils.AddDryRunFlag(cmd)\n\tutils.AddBaseImageFlag(cmd)\n\tutils.AddEntryPointFlag(cmd)\n\tutils.AddParametersFlag(cmd)\n\tutils.AddTimeoutFlag(cmd)\n\tutils.AddPvcFlag(cmd)\n\tutils.AddMountPathFlag(cmd)\n\tutils.AddPriorityFlag(cmd)\n\t//add subcommand\n\treturn cmd\n}", "title": "" }, { "docid": "66eed9b86da0d7fc126cf73ac41faede", "score": "0.461126", "text": "func newCmdAddTransformer(fSys filesys.FileSystem) *cobra.Command {\n\tvar o addTransformerOptions\n\n\tcmd := &cobra.Command{\n\t\tUse: \"transformer\",\n\t\tShort: \"Add the name of a file containing a transformer to the kustomization file.\",\n\t\tExample: `\n\t\tadd transformer {filepath}`,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\terr := o.Validate(args)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = o.Complete(cmd, args)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn o.RunAddTransformer(fSys)\n\t\t},\n\t}\n\treturn cmd\n}", "title": "" }, { "docid": "2431faf4c6d9fccb5a6b0b4814119cb2", "score": "0.46034145", "text": "func (g *Git) createCommand(dir string, params ...string) *exec.Cmd {\n\treturn g.Cli.command(dir, append([]string{\"--no-pager\"}, params...)...)\n}", "title": "" }, { "docid": "076b3ef225089ab0dbb4fed9fd8f4007", "score": "0.45912057", "text": "func New() *PdkCmd {\n\texe, _ := exec.LookPath(\"cmd.exe\")\n\treturn &PdkCmd{\n\t\texe: exe,\n\t}\n}", "title": "" }, { "docid": "44996280e45afba99740f86df581b0ce", "score": "0.4581309", "text": "func NewRunCommand(in io.Reader, out, errorOut io.Writer) *cobra.Command {\n\tcalmOpts := CalmOptions{}\n\n\tcalmCommand := &cobra.Command{\n\t\tUse: \"calm [flags] <command> <command arg1>...\",\n\t\tShort: \"run a program using cgroup resource limits\",\n\t\tExample: \"calm google-chrome\",\n\t\tArgs: cobra.MinimumNArgs(1),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tcalmOpts.CommandToRun = args[0]\n\t\t\tcalmOpts.Args = args[1:]\n\n\t\t\terr := calmOpts.Run(in, out, errorOut)\n\t\t\tif err != nil {\n\t\t\t\terrorOut.Write([]byte(err.Error() + \"\\n\"))\n\t\t\t}\n\t\t},\n\t}\n\n\tflags := calmCommand.PersistentFlags()\n\tflags.BoolVar(&calmOpts.Debug, \"debug\", false, debugUsage)\n\tflags.StringVarP(&calmOpts.User, \"user\", \"u\", \"\", userUsage)\n\tflags.StringVarP(&calmOpts.Memory, \"memory\", \"m\", \"\", memoryUsage)\n\tflags.StringVarP(&calmOpts.CPU, \"cpu\", \"c\", \"\", cpuUsage)\n\n\treturn calmCommand\n}", "title": "" }, { "docid": "890d6e26aea615860060f976e34b0f1e", "score": "0.45805657", "text": "func (app *App) NewCommand(name, useFor string, config func(c *Command)) *Command {\n\treturn NewCommand(name, useFor, config)\n}", "title": "" }, { "docid": "890d6e26aea615860060f976e34b0f1e", "score": "0.45805657", "text": "func (app *App) NewCommand(name, useFor string, config func(c *Command)) *Command {\n\treturn NewCommand(name, useFor, config)\n}", "title": "" }, { "docid": "eac7f2ae59079e5e0d6b4480c0c478ca", "score": "0.45787668", "text": "func newTaskCmdBuilder(w *Workflow) (c *taskCmdBuilder, err error) {\n\tc = &taskCmdBuilder{\n\t\tenv: map[string]string{},\n\t\tvars: map[string]string{},\n\t}\n\n\t// loads OS environment variables into the taskCmdBuilder context\n\tfor _, e := range os.Environ() {\n\t\tpair := strings.Split(e, \"=\")\n\t\tname := pair[0]\n\t\tvalue := pair[1]\n\t\tc.env[name] = value\n\t}\n\n\t// process vars defined in the workflow\n\tif w.Vars != nil {\n\t\tfor n, v := range w.Vars {\n\t\t\tc.vars[n], err = c.expand(v)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrapf(err, \"error expanding the %q var\", n)\n\t\t\t}\n\t\t}\n\t}\n\n\t// process additional environment variables defined in the workflow\n\tif w.Env != nil {\n\t\tfor n, v := range w.Env {\n\t\t\tc.env[n], err = c.expand(v)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrapf(err, \"error expanding the %q env var\", n)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "e26564d5e4189bdb37f2a73b96e7466f", "score": "0.45773283", "text": "func NewCmdUpgrade(streams genericclioptions.IOStreams) *cobra.Command {\n\to := NewOptions(streams)\n\n\tcmd := &cobra.Command{\n\t\tUse: \"upgrade [DatadogAgent name]\",\n\t\tShort: \"Wait until the rolling-update of all agent components is finished\",\n\t\tExample: \"./check-operator upgrade datadog-agent\",\n\t\tSilenceUsage: true,\n\t\tRunE: func(c *cobra.Command, args []string) error {\n\t\t\tif err := o.Complete(c, args); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := o.Validate(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn o.Run()\n\t\t},\n\t}\n\n\to.ConfigFlags.AddFlags(cmd.Flags())\n\n\treturn cmd\n}", "title": "" }, { "docid": "e679737dbaf8b51804f3d6e5a8da036e", "score": "0.45735884", "text": "func NewCmd(streams genericclioptions.IOStreams) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"accurate\",\n\t\tShort: \"Subcommand for Accurate\",\n\t\tLong: `accurate is a subcommand of kubectl to manage Accurate features.`,\n\t\tVersion: accurate.Version,\n\t\tPersistentPreRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcmd.SilenceUsage = true\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tconfig := genericclioptions.NewConfigFlags(true)\n\tconfig.AddFlags(cmd.Flags())\n\n\tcmd.AddCommand(newListCmd(streams, config))\n\tcmd.AddCommand(newNamespaceCmd(streams, config))\n\tcmd.AddCommand(newTemplateCmd(streams, config))\n\tcmd.AddCommand(newSubCmd(streams, config))\n\n\treturn cmd\n}", "title": "" }, { "docid": "dec3f0f8753272e2193ed24d15d0cb9b", "score": "0.4570891", "text": "func NewCommand(o *Options) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"export TRIAL_NAME\",\n\t\tShort: \"Export trial parameters to an application or experiment\",\n\t\tLong: \"Export trial parameters to an application or experiment from the specified trial\",\n\n\t\tPreRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcommander.SetStreams(&o.IOStreams, cmd)\n\n\t\t\tvar err error\n\t\t\tif o.ExperimentsAPI == nil {\n\t\t\t\terr = commander.SetExperimentsAPI(&o.ExperimentsAPI, o.Config, cmd)\n\t\t\t}\n\n\t\t\tif len(args) != 1 {\n\t\t\t\treturn fmt.Errorf(\"a trial name must be specified\")\n\t\t\t}\n\n\t\t\to.trialName = args[0]\n\n\t\t\treturn err\n\t\t},\n\t\tRunE: commander.WithContextE(o.runner),\n\t}\n\n\tcmd.Flags().StringSliceVarP(&o.inputFiles, \"filename\", \"f\", []string{\"\"}, \"experiment and related manifest `files` to export, - for stdin\")\n\tcmd.Flags().BoolVarP(&o.patchOnly, \"patch\", \"p\", false, \"export only the patch\")\n\tcmd.Flags().BoolVarP(&o.patchedTarget, \"patched-target\", \"t\", false, \"export only the patched resource\")\n\n\t_ = cmd.MarkFlagRequired(\"filename\")\n\t_ = cmd.MarkFlagFilename(\"filename\", \"yml\", \"yaml\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "02d74be57474d91da4ba9d29f74bce11", "score": "0.45650312", "text": "func makeEtcdctlCommand(node *ssh.Node) {\n\tnode.Logger(\"create etcdctl command\")\n\tcmdCtx := []byte(\"#!/bin/bash\\n\" +\n\t\t\"kubectl -n kube-system exec etcd-$(hostname -s)\" +\n\t\t\" -- etcdctl\" +\n\t\t\" --cacert=/etc/kubernetes/pki/etcd/ca.crt\" +\n\t\t\" --cert=/etc/kubernetes/pki/etcd/healthcheck-client.crt\" +\n\t\t\" --key=/etc/kubernetes/pki/etcd/healthcheck-client.key $@\")\n\n\terr := node.Sudo().ScpContent(cmdCtx, \"/usr/local/bin/etcdctl\")\n\tutils.Panic(err, \"create etcdctl command\")\n\n\terr = node.Sudo().Cmd(\"chmod +x /usr/local/bin/etcdctl\")\n\tutils.Panic(err, \"change etcdctl model\")\n}", "title": "" }, { "docid": "98610e2abb184fd7252f62d1ca92f93e", "score": "0.4564893", "text": "func getAddSimulatorCommand() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"simulator [name]\",\n\t\tShort: \"Add a device simulator to the test cluster\",\n\t\tArgs: cobra.MaximumNArgs(1),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\t// If a simulator name was not provided, generate one from a UUID.\n\t\t\tvar name string\n\t\t\tif len(args) > 0 {\n\t\t\t\tname = args[0]\n\t\t\t} else {\n\t\t\t\tname = fmt.Sprintf(\"device-%d\", newUUIDInt())\n\t\t\t}\n\n\t\t\t// Create the simulator configuration from the configured preset\n\t\t\tconfigName, _ := cmd.Flags().GetString(\"preset\")\n\n\t\t\t// Get the onit controller\n\t\t\tcontroller, err := runner.NewController()\n\t\t\tif err != nil {\n\t\t\t\texitError(err)\n\t\t\t}\n\n\t\t\t// Get the cluster ID\n\t\t\tclusterID, err := cmd.Flags().GetString(\"cluster\")\n\t\t\tif err != nil {\n\t\t\t\texitError(err)\n\t\t\t}\n\n\t\t\t// Get the cluster controller\n\t\t\tcluster, err := controller.GetCluster(clusterID)\n\t\t\tif err != nil {\n\t\t\t\texitError(err)\n\t\t\t}\n\n\t\t\t// Create the simulator configuration\n\t\t\tconfig := &runner.SimulatorConfig{\n\t\t\t\tConfig: configName,\n\t\t\t}\n\n\t\t\t// Add the simulator to the cluster\n\t\t\tif status := cluster.AddSimulator(name, config); status.Failed() {\n\t\t\t\texitStatus(status)\n\t\t\t} else {\n\t\t\t\tfmt.Println(name)\n\t\t\t}\n\t\t},\n\t}\n\n\tcmd.Flags().StringP(\"cluster\", \"c\", getDefaultCluster(), \"the cluster to which to add the simulator\")\n\tcmd.Flags().Lookup(\"cluster\").Annotations = map[string][]string{\n\t\tcobra.BashCompCustom: {\"__onit_get_clusters\"},\n\t}\n\tcmd.Flags().StringP(\"preset\", \"p\", \"default\", \"simulator preset to apply\")\n\treturn cmd\n}", "title": "" }, { "docid": "5c56e264b365bec2aa154ae287546d11", "score": "0.45611382", "text": "func NewCmd(o *cli.Options) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"alpha\",\n\t\tShort: \"Experimental commands\",\n\t\tLong: `Alpha commands are experimental, unreleased features that should only be used by the Kyma team. Use at your own risk.\n`,\n\t}\n\n\tcmd.AddCommand(create.NewCmd(o))\n\tcmd.AddCommand(list.NewCmd(o))\n\tcmd.AddCommand(enable.NewCmd(o))\n\tcmd.AddCommand(disable.NewCmd(o))\n\tcmd.AddCommand(deploy.NewCmd(deploy.NewOptions(o)))\n\tcmd.AddCommand(sign.NewCmd(o))\n\tcmd.AddCommand(verify.NewCmd(o))\n\n\treturn cmd\n}", "title": "" }, { "docid": "a4bf637fbedb4df0555e3a684510c7dd", "score": "0.45546415", "text": "func NewCommand() *cobra.Command {\n\tc := &command{}\n\tcmd := kustomize.NewPluginRunner(c, kustomize.WithTransformerFilenameFlag(), kustomize.WithPrinter(c.print))\n\tcmd.Use = \"env\"\n\tcmd.Short = \"Extract environment mappings\"\n\tcmd.Long = \"Extracts config map and secret environment assignments\"\n\n\tcmd.Flags().StringVar(&c.Shell, \"shell\", \"\", \"force environment to be configured for a specific `shell`\")\n\tcmd.Flags().BoolVarP(&c.Unset, \"unset\", \"u\", false, \"unset variables instead of setting them\")\n\tcmd.Flags().StringVar(&c.ConfigMapLabelSelector, \"configmap-selector\", \"\", \"`selector` to filter ConfigMaps on\")\n\tcmd.Flags().StringVar(&c.SecretLabelSelector, \"secret-selector\", \"\", \"`selector` to filter Secrets on\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "0c5559853b3832dd99184f252465b40a", "score": "0.45543033", "text": "func NewCommand(\n\tname string,\n\tbuilder appflag.Builder,\n) *appcmd.Command {\n\tflags := newFlags()\n\treturn &appcmd.Command{\n\t\tUse: name + \" <directory>\",\n\t\tShort: \"Update the modules dependencies. Updates the \" + buflock.ExternalConfigFilePath + \" file.\",\n\t\tLong: \"Gets the latest digests for the specified references in the config file, \" +\n\t\t\t\"and writes them and their transitive dependencies to the \" +\n\t\t\tbuflock.ExternalConfigFilePath +\n\t\t\t` file. The first argument is the directory of the local module to update. If no argument is specified, defaults to \".\"`,\n\t\tArgs: cobra.MaximumNArgs(1),\n\t\tRun: builder.NewRunFunc(\n\t\t\tfunc(ctx context.Context, container appflag.Container) error {\n\t\t\t\treturn run(ctx, container, flags)\n\t\t\t},\n\t\t\tbufcli.NewErrorInterceptor(),\n\t\t),\n\t\tBindFlags: flags.Bind,\n\t}\n}", "title": "" }, { "docid": "60a2532da372325b07974322754dabff", "score": "0.4546899", "text": "func newGetCmd() *cobra.Command {\n\tgetCmd := &cobra.Command{\n\t\tUse: \"get instances\",\n\t\tShort: \"Gets all available instances.\",\n\t\tExample: getExample,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\treturn get.Run(args, &Settings)\n\t\t},\n\t}\n\n\treturn getCmd\n}", "title": "" }, { "docid": "a26a7c196c0412af60e80e2d3027ea1f", "score": "0.4537505", "text": "func newRun(_cmd *cobra.Command, _args []string) {\n\tpath, err := filepath.EvalSymlinks(dstPath)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tif !filepath.IsAbs(dstPath) {\n\t\t\t\tcwd, err := os.Getwd()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\t\t\t\tpath = filepath.Join(cwd, dstPath)\n\t\t\t} else {\n\t\t\t\tpath = dstPath\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\tctx := &templates.TmplCtx{\n\t\tPkgName: pkgName,\n\t\tMirPkgName: mirPkgName,\n\t\tMirVersion: mirVersion,\n\t\tEngVersion: engVersion,\n\t}\n\tif err = genProject(ctx, path, style); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "ccbcb2e6ee33a56ec99857d8dd1c2eec", "score": "0.45369503", "text": "func NewCmd(use string) Builder {\n\treturn &builder{\n\t\tcmd: cobra.Command{\n\t\t\tUse: use,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "858fb1b1b5bc548f53f4597a3646cd36", "score": "0.45317534", "text": "func New(args []string) pakelib.Command {\n\treturn &mkdir{\n\t\targs: args,\n\t}\n}", "title": "" }, { "docid": "c3316f2490285c8368bcae58ca08c9c4", "score": "0.45294484", "text": "func createPluginCommand() *model.Command {\n\treturn &model.Command{\n\t\tTrigger: pluginCommand,\n\t}\n}", "title": "" }, { "docid": "75c88db06d4e1eccdf02d7dc9137f821", "score": "0.4523683", "text": "func NewIAMCommand() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"iamsvc\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tif err := runMain(cmd, args); err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t\treturn\n\t\t\t}\n\t\t},\n\t}\n\n\taddHTTPTransportFlags(cmd.Flags())\n\taddAuthNFlags(cmd)\n\taddRepoFlags(cmd)\n\n\treturn cmd\n}", "title": "" }, { "docid": "548446f07cf2f9968624b4320eb1d1cb", "score": "0.45217282", "text": "func newConfigFromCmdReq(cr protocol.CmdRequestV1Cmd) config.ConfigEntry {\n\t// executable is provided\n\tif cr.Command != \"\" {\n\t\treturn config.ConfigEntry{\n\t\t\tInstanceName: cr.Name,\n\t\t\tExec: append([]string{cr.Command}, cr.Args...),\n\t\t\tEnv: cr.Env,\n\t\t\tInterval: \"0\",\n\t\t}\n\n\t}\n\n\t// executable would be looked up by integration name\n\treturn config.ConfigEntry{\n\t\tInstanceName: cr.Name,\n\t\tCLIArgs: cr.Args,\n\t\tEnv: cr.Env,\n\t\tInterval: \"0\",\n\t}\n}", "title": "" }, { "docid": "133e50f775de6551c48103b9f9034532", "score": "0.45215237", "text": "func NewAddCommand(ctx context.Context) *cobra.Command {\n\topts := &Options{}\n\tcmd := &cobra.Command{\n\t\tUse: \"add COMPONENT_ARCHIVE_PATH [RESOURCE_PATH...]\",\n\t\tArgs: cobra.MinimumNArgs(1),\n\t\tShort: \"Adds a resource to an component archive\",\n\t\tLong: fmt.Sprintf(`\nadd generates resources from a resource template and adds it to the given component descriptor in the component archive.\nIf the resource is already defined (quality by identity) in the component-descriptor it will be overwritten.\n\nThe component archive can be specified by the first argument, the flag \"--archive\" or as env var \"COMPONENT_ARCHIVE_PATH\".\nThe component archive is expected to be a filesystem archive. If the archive is given as tar please use the export command.\n\nThe resource template can be defined by specifying a file with the template with \"resource\" or it can be given through stdin.\n\nThe resource template is a multidoc yaml file so multiple templates can be defined.\n\n<pre>\n\n---\nname: 'myimage'\ntype: 'ociImage'\nrelation: 'external'\nversion: 0.2.0\naccess:\n type: ociRegistry\n imageReference: eu.gcr.io/gardener-project/component-cli:0.2.0\n...\n---\nname: 'myconfig'\ntype: 'json'\nrelation: 'local'\ninput:\n type: \"file\"\n path: \"some/path\"\n mediaType: \"application/octet-stream\" # optional, defaulted to \"application/octet-stream\" or \"application/gzip\" if compress=true \n...\n---\nname: 'myconfig'\ntype: 'json'\nrelation: 'local'\ninput:\n type: \"dir\"\n path: /my/path\n compress: true # defaults to false\n includeFiles: # optional; list of shell file patterns\n - \"*.txt\"\n excludeFiles: # optional; list of shell file patterns\n - \"*.txt\"\n mediaType: \"application/gzip\" # optional, defaulted to \"application/x-tar\" or \"application/gzip\" if compress=true \n preserveDir: true # optional, defaulted to false; if true, the top level folder \"my/path\" is included\n followSymlinks: true # optional, defaulted to false; if true, symlinks are resolved and the content is included in the tar\n...\n\n</pre>\n\nAlternativly the resources can also be defined as list of resources (both methods can also be combined).\n\n<pre>\n\n---\nresources:\n- name: 'myimage'\n type: 'ociImage'\n relation: 'external'\n version: 0.2.0\n access:\n type: ociRegistry\n imageReference: eu.gcr.io/gardener-project/component-cli:0.2.0\n\n- name: 'myconfig'\n type: 'json'\n relation: 'local'\n input:\n type: \"file\"\n path: \"some/path\"\n mediaType: \"application/octet-stream\" # optional, defaulted to \"application/octet-stream\" or \"application/gzip\" if compress=true\n\n</pre>\n\n%s\n`, opts.TemplateOptions.Usage()),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tif err := opts.Complete(args); err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\n\t\t\tif err := opts.Run(ctx, logger.Log, osfs.New()); err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t},\n\t}\n\n\topts.AddFlags(cmd.Flags())\n\n\treturn cmd\n}", "title": "" }, { "docid": "c3fd26fb886083c06c2d1d67e32747f5", "score": "0.45158413", "text": "func NewDisconnectCmd(globalFlags *flags.GlobalFlags) *cobra.Command {\n\tcmd := &DisconnectCmd{\n\t\tGlobalFlags: globalFlags,\n\t\tlog: log.GetInstance(),\n\t}\n\n\tcobraCmd := &cobra.Command{\n\t\tUse: \"disconnect\",\n\t\tShort: \"Disconnects from a virtual cluster\",\n\t\tLong: `\n#######################################################\n################# vcluster disconnect #################\n#######################################################\nDisconnect switches back the kube context if\nvcluster connect --update-current was used\n\nExample:\nvcluster connect --update-current\nvcluster disconnect\n#######################################################\n\t`,\n\t\tArgs: cobra.NoArgs,\n\t\tRunE: func(cobraCmd *cobra.Command, args []string) error {\n\t\t\treturn cmd.Run(cobraCmd, args)\n\t\t},\n\t}\n\n\treturn cobraCmd\n}", "title": "" }, { "docid": "7c768a6b9a9f6b85b91b744c3ce54681", "score": "0.4515635", "text": "func NewUpgradeCmd() *cobra.Command {\n\tcobraCmd := &cobra.Command{\n\t\tUse: \"upgrade\",\n\t\tAliases: []string{\"u\"},\n\t\tShort: \"Performs upgrade operations on Kyma Runtimes.\",\n\t\tLong: \"Performs upgrade operations on Kyma Runtimes.\",\n\t}\n\n\tcobraCmd.AddCommand(NewUpgradeKymaCmd())\n\tcobraCmd.AddCommand(NewUpgradeClusterCommand())\n\treturn cobraCmd\n}", "title": "" }, { "docid": "46263117c8d722c817a69d55999f5471", "score": "0.45135817", "text": "func newPullCmd() *cobra.Command {\n\topt := manager.TransferOptions{Pull: true}\n\tcmd := &cobra.Command{\n\t\tUse: \"pull <cluster-name> <remote-path> <local-path>\",\n\t\tShort: \"(EXPERIMENTAL) Transfer files or directories from host in the tidb cluster to local\",\n\t\tHidden: true,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif len(args) != 3 {\n\t\t\t\treturn cmd.Help()\n\t\t\t}\n\n\t\t\tclusterName := args[0]\n\t\t\topt.Remote = args[1]\n\t\t\topt.Local = args[2]\n\t\t\tclusterReport.ID = scrubClusterName(clusterName)\n\t\t\tteleCommand = append(teleCommand, scrubClusterName(clusterName))\n\n\t\t\treturn cm.Transfer(clusterName, opt, gOpt)\n\t\t},\n\t}\n\n\tcmd.Flags().StringSliceVarP(&gOpt.Roles, \"role\", \"R\", nil, \"Only exec on host with specified roles\")\n\tcmd.Flags().StringSliceVarP(&gOpt.Nodes, \"node\", \"N\", nil, \"Only exec on host with specified nodes\")\n\tcmd.Flags().IntVarP(&opt.Limit, \"limit\", \"l\", 0, \"Limits the used bandwidth, specified in Kbit/s\")\n\tcmd.Flags().BoolVar(&opt.Compress, \"compress\", false, \"Compression enable. Passes the -C flag to ssh(1) to enable compression.\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "fe238f14a824ce73d8a640c6d7f24c0f", "score": "0.45134318", "text": "func NewCmdDelegate(im IngressMessage, subm []string) CmdDelegate {\n\treturn CmdDelegate{\n\t\tIngressMessage: im,\n\t\tSubmatches: subm,\n\t\tresponse: \"\",\n\t}\n}", "title": "" }, { "docid": "310f30a0312fe430d7945407efd8fb9f", "score": "0.45086622", "text": "func NewShellCmd(command string) *ShellCmd {\n\titems := strings.Split(command, \" \")\n\tcmd := items[0]\n\targs := items[1:]\n\treturn NewShellCmdWithArgs(cmd, args...)\n}", "title": "" } ]
d64a6c24d2bbc6cb8fb3a5191acb7e07
NewConnection connects and starts reading from a Dtx based service on the device
[ { "docid": "fc3407a3023b3db6c9f3181287d37d36", "score": "0.58379674", "text": "func NewConnection(device ios.DeviceEntry, serviceName string) (*Connection, error) {\n\tconn, err := ios.ConnectToService(device, serviceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trequestChannelMessages := make(chan Message, 5)\n\n\t// The global channel has channelCode 0, so we need to start with channelCodeCounter==1\n\tdtxConnection := &Connection{deviceConnection: conn, channelCodeCounter: 1, requestChannelMessages: requestChannelMessages}\n\n\t// The global channel is automatically present and used for requesting other channels and some other methods like notifyPublishedCapabilities\n\tglobalChannel := Channel{\n\t\tchannelCode: 0,\n\t\tmessageIdentifier: 5, channelName: \"global_channel\", connection: dtxConnection,\n\t\tmessageDispatcher: NewGlobalDispatcher(requestChannelMessages, dtxConnection),\n\t\tresponseWaiters: map[int]chan Message{},\n\t\tregisteredMethods: map[string]chan Message{},\n\t\tdefragmenters: map[int]*FragmentDecoder{},\n\t\ttimeout: 5 * time.Second,\n\t}\n\tdtxConnection.globalChannel = &globalChannel\n\tgo reader(dtxConnection)\n\n\treturn dtxConnection, nil\n}", "title": "" } ]
[ { "docid": "08672c73387ab6845b7d04f547dfb86e", "score": "0.57090706", "text": "func reader(dtxConn *Connection) {\n\tfor {\n\t\treader := dtxConn.deviceConnection.Reader()\n\t\tmsg, err := ReadMessage(reader)\n\t\tif err != nil {\n\t\t\terrText := err.Error()\n\t\t\tif err == io.EOF || strings.Contains(errText, \"use of closed network\") {\n\t\t\t\tlog.Debug(\"DTX Connection with EOF\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Errorf(\"error reading dtx connection %+v\", err)\n\t\t\treturn\n\t\t}\n\t\tif _channel, ok := dtxConn.activeChannels.Load(msg.ChannelCode); ok {\n\t\t\tchannel := _channel.(*Channel)\n\t\t\tchannel.Dispatch(msg)\n\t\t} else {\n\t\t\tdtxConn.globalChannel.Dispatch(msg)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "df4ca0e23a5d709bdca54d326fa22c10", "score": "0.5544647", "text": "func newConn(t *testing.T) *Conn {\n\t// defer traceThisFunction()()\n\t<-listening\n\tconn, err := socket.Dial(os.Getuid(), os.Getpid())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn &Conn{\n\t\tconn: conn,\n\t\tinput: bufio.NewReader(conn),\n\t\toutput: bufio.NewWriter(conn),\n\t}\n}", "title": "" }, { "docid": "fdc49ee7a5fc0db746280158b74549fa", "score": "0.55418915", "text": "func (c *client) connRead(ctx context.Context) {\n\tprotCtl := ctx.Value(\"protocol.ctl\").(controller.Controller)\n\n\tdefer ctx.Cancel(fmt.Errorf(\"connection read finished\"))\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase <-protCtl.Finished():\n\t\t\treturn\n\t\tcase mes := <-protCtl.MessageGet():\n\t\t\tif mes == nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tctx.Child(\"mes.process\", c.connMesProcess).\n\t\t\t\tValueSet(\"mes\", mes).Go()\n\t\tcase req := <-protCtl.RequestGet():\n\t\t\tif req == nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tpanic(fmt.Errorf(\"unsupported request: %T\", req))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5fd8955770c1ea6f29ca3f6c10b64d00", "score": "0.5451132", "text": "func newConnection() (*Connection, error) {\n\n\tfd, err := syscall.Socket(syscall.AF_NETLINK, syscall.SOCK_DGRAM, syscall.NETLINK_GENERIC)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconn := new(Connection)\n\tconn.fd = fd\n\tconn.seq = 0\n\tconn.pid = uint32(os.Getpid())\n\tconn.addr.Family = syscall.AF_NETLINK\n\tconn.rbuf = bufio.NewReader(conn)\n\terr = syscall.Bind(fd, &conn.addr)\n\tif err != nil {\n\t\tsyscall.Close(fd)\n\t\treturn nil, err\n\t}\n\treturn conn, err\n}", "title": "" }, { "docid": "4cf6a4f68f896b64f1834810973bdd7a", "score": "0.54497445", "text": "func NewConnection(ctx context.Context, db *sqlx.DB, mutex *sync.Mutex) (Connection, error) {\n\t// Discover TTYs\n\tmatches, err := filepath.Glob(\"/dev/cu.usb*\")\n\tif err != nil {\n\t\tlogrus.Fatalf(\"Failed to glob /dev/tty[A-Za-z]*\")\n\t}\n\n\tusbMatches, err := filepath.Glob(\"/dev/ttyUSB*\")\n\tif err != nil {\n\t\tlogrus.Fatalf(\"Failed to glob /dev/tty[A-Za-z]*\")\n\t}\n\n\tacmMatches, err := filepath.Glob(\"/dev/ttyACM*\")\n\tif err != nil {\n\t\tlogrus.Fatalf(\"Failed to glob /dev/tty[A-Za-z]*\")\n\t}\n\n\tmatches = append(matches, usbMatches...)\n\tmatches = append(matches, acmMatches...)\n\n\t// Attempt to connect to a discovered TTY and say hello to initialize\n\tvar tty *serial.Port\n\tfor _, match := range matches {\n\t\tc := &serial.Config{Name: match, Baud: 115200, ReadTimeout: 7 * time.Second}\n\t\ttty, err = serial.OpenPort(c)\n\t\tif err != nil {\n\t\t\t// Failed to open TTY\n\t\t\tlogrus.Fatal(err.Error())\n\t\t}\n\n\t\tlogrus.Debug(\"Opening\", match)\n\t\tconnection := Connection{\n\t\t\tInterface: tty,\n\t\t\tDB: db,\n\t\t\tMutex: mutex,\n\t\t}\n\n\t\tlogrus.Info(\"Waking up arduino...\")\n\t\tattempt1 := connection.Command(ctx, 0)\n\t\tif attempt1 {\n\t\t\treturn connection, nil\n\t\t}\n\t\ttime.Sleep(100 * time.Millisecond)\n\t\tattempt2 := connection.Command(ctx, 0)\n\t\tif attempt2 {\n\t\t\treturn connection, nil\n\t\t}\n\n\t\treturn Connection{}, fmt.Errorf(\"failed to recieve hello response back\")\n\t}\n\n\tpanic(\"Failed to connect to any TTY\")\n}", "title": "" }, { "docid": "b154b085a62b3d14a293d71a132991f7", "score": "0.5394035", "text": "func (s *Service) connect() {\n\tconnection, err := dbus.SessionBus()\n\tif err != nil {\n\t\tlog.Panicf(\"Cannot connect to session dbus. Error: %v\", err)\n\t}\n\ts.Connection = connection\n}", "title": "" }, { "docid": "982e281c826614e5365eeef6f106002e", "score": "0.5380066", "text": "func (c *cstor) initiateConnection() error {\n\tconn, err := dialFunc(c.socketPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif conn != nil {\n\t\tc.conn = conn\n\t\tc.conn.SetDeadline(time.Now().Add(5 * time.Second))\n\t\tc.readHeader()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "feab7ad820360189159841b181cdfdea", "score": "0.5365576", "text": "func (transport *dustClient) Dial(address string) (net.Conn, error) {\n\tconn, dialErr := net.Dial(\"tcp\", address)\n\tif dialErr != nil {\n\t\treturn conn, dialErr\n\t}\n\n\ttransportConn, err := Dust.BeginRawStreamClient(conn, transport.serverPubkey)\n\tif err != nil {\n\t\tcloseErr := conn.Close()\n\t\tif closeErr != nil {\n\t\t\tlog.Errorf(\"could not close\")\n\t\t}\n\t\treturn conn, dialErr\n\t}\n\n\treturn transportConn, err\n}", "title": "" }, { "docid": "3630546cd6aff1db58d28d94ac762dbd", "score": "0.53459054", "text": "func (clt *client) connect() error {\n\tclt.connectLock.Lock()\n\tif clt.Status() == StatusConnected {\n\t\tclt.connectLock.Unlock()\n\t\treturn nil\n\t}\n\n\t// Dial and await approval\n\tendpointMeta, err := clt.dial()\n\tif err != nil {\n\t\tclt.connectLock.Unlock()\n\t\treturn err\n\t}\n\n\t// Start heartbeat\n\tgo clt.heartbeat.start(\n\t\tendpointMeta.ReadTimeout - endpointMeta.ReadTimeout/4,\n\t)\n\n\t// Setup reader thread\n\tgo func() {\n\t\tdefer func() {\n\t\t\t// Set status\n\t\t\tclt.setStatus(StatusDisconnected)\n\t\t\tselect {\n\t\t\tcase clt.readerClosing <- true:\n\t\t\tdefault:\n\t\t\t}\n\t\t}()\n\t\tfor {\n\t\t\t// Get a message buffer from the pool\n\t\t\tmsg := clt.messagePool.Get()\n\n\t\t\tif err := clt.conn.Read(msg, time.Time{}); err != nil {\n\t\t\t\t// Return message object back to the pool\n\t\t\t\tmsg.Close()\n\n\t\t\t\t// Set connection status to disconnected\n\t\t\t\tclt.setStatus(StatusDisconnected)\n\n\t\t\t\t// Stop heartbeat\n\t\t\t\tclt.heartbeat.stop()\n\n\t\t\t\t// Call hook\n\t\t\t\tclt.impl.OnDisconnected()\n\n\t\t\t\t// Try to reconnect if autoconn wasn't disabled.\n\t\t\t\t// reconnect in another goroutine to let this one die\n\t\t\t\t// and free up the socket\n\t\t\t\tif atomic.LoadInt32(&clt.autoconnect) == autoconnectEnabled {\n\t\t\t\t\tgo func() {\n\t\t\t\t\t\tclt.tryAutoconnect(context.Background(), false)\n\t\t\t\t\t}()\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Try to handle the message\n\t\t\tif err := clt.handleMessage(msg); err != nil {\n\t\t\t\tclt.options.ErrorLog.Print(\"message handler failed:\", err)\n\t\t\t}\n\t\t}\n\t}()\n\n\tclt.setStatus(StatusConnected)\n\n\t// Read the current sessions key if there is any\n\tclt.sessionLock.RLock()\n\tif clt.session == nil {\n\t\tclt.sessionLock.RUnlock()\n\t\tclt.connectLock.Unlock()\n\t\treturn nil\n\t}\n\tsessionKey := clt.session.Key\n\tclt.sessionLock.RUnlock()\n\n\t// Set session restoration deadline\n\tctx, closeCtx := context.WithTimeout(\n\t\tcontext.Background(),\n\t\tclt.options.DefaultRequestTimeout,\n\t)\n\n\t// Try to restore session if necessary\n\tif err := clt.restoreSession(\n\t\tctx,\n\t\t[]byte(sessionKey),\n\t); err != nil {\n\t\t// Just log a warning and still return nil,\n\t\t// even if session restoration failed,\n\t\t// because we only care about the connection establishment\n\t\t// in this method\n\t\tclt.options.WarnLog.Printf(\n\t\t\t\"Couldn't restore session on reconnection: %s\",\n\t\t\terr,\n\t\t)\n\n\t\t// Reset the session\n\t\tclt.sessionLock.Lock()\n\t\tclt.session = nil\n\t\tclt.sessionLock.Unlock()\n\n\t\tclt.connectLock.Unlock()\n\t\tcloseCtx()\n\t\treturn nil\n\t}\n\n\tclt.connectLock.Unlock()\n\tcloseCtx()\n\treturn nil\n}", "title": "" }, { "docid": "78d2578697a5c9be2bc68f7370a04255", "score": "0.5318423", "text": "func (server *MQTTServer) connect() {\n\t//mypid := os.Getpid()\n\topts := mqtt.NewClientOptions()\n\topts.AddBroker(server.Url)\n\topts.SetUsername(server.User)\n\topts.SetPassword(server.Pass)\n\topts.SetClientID(server.ClientID)\n\topts.SetCleanSession(true)\n\t//opts.SetKeepAlive(10)\n\topts.SetMaxReconnectInterval(30)\n\topts.SetWill(server.Prefix+\"/\"+\"solarmon\", \"OFFLINE\", 0, true)\n\topts.SetAutoReconnect(true)\n\topts.SetProtocolVersion(4)\n\n\tserver.ClientHandle = mqtt.NewClient(opts)\n\tConnToken := server.ClientHandle.Connect()\n\tfor !ConnToken.WaitTimeout(5 * time.Second) {\n\t}\n\tif err := ConnToken.Error(); err != nil {\n\t\tfmt.Printf(\"MQTT Connection problem: %s\\n\", err)\n\t\t//log.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "ee1f673cbf9c306ca98964342e48421d", "score": "0.5305202", "text": "func (conn *Connection) Open() error {\n\n\tlog.Println(\"creating new hive connection \")\n\n\ttrans, _ := thrift.NewTSocket(conn.Server)\n\ttrans.Open()\n\n\tprotocolfac := thrift.NewTBinaryProtocolFactoryDefault()\n\n\tconn.Client = thrifthive.NewTCLIServiceClientFactory(trans, protocolfac)\n\n\tsreq := thrifthive.NewTOpenSessionReq()\n\tsreq.ClientProtocol = 6\n\tsreq.Username = &_user\n\tsreq.Password = &_password\n\n\tr, err := conn.Client.OpenSession(sreq)\n\tif err != nil {\n\t\tlog.Println(\"err=\", err)\n\t\treturn err\n\t}\n\n\tlog.Println(\"rsp=\", r)\n\tconn.SessionHandle = r.SessionHandle\n\n\treturn nil\n}", "title": "" }, { "docid": "203edd891da4f3a4271c00f5a33eea3e", "score": "0.530474", "text": "func (c *Client) Connect(ident string) error {\n\taddress := fmt.Sprintf(\"%s:%d\", c.Gateway, tradfriPort)\n\tlog.Printf(\"Connecting to gateway: %s\\n\", address)\n\n\tif c.psk == \"\" {\n\t\terr := c.generatePSK(address, ident)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvar err error\n\tc.connection, err = canopus.DialDTLS(address, ident, c.psk)\n\treturn err\n}", "title": "" }, { "docid": "9d675a38dd071c36051e10f19fd4e7e7", "score": "0.5302891", "text": "func (c *client) Connect() error {\n\tmqttOpts := mqtt.NewClientOptions().AddBroker(c.opts.DeviceAddress)\n\tmqttOpts.SetUsername(c.opts.Username)\n\tmqttOpts.SetPassword(c.opts.Password)\n\tmqttOpts.SetDefaultPublishHandler(func(client mqtt.Client, msg mqtt.Message) { sendMessageCallback(c.opts.CallbackChan, msg) })\n\tmqttClient := mqtt.NewClient(mqttOpts)\n\tif token := mqttClient.Connect(); token.Wait() && token.Error() != nil {\n\t\treturn token.Error()\n\t}\n\tmqttClient.Subscribe(c.getDeviceTopic(\"status/current\"), 0, nil)\n\tc.MqttClient = mqttClient\n\treturn nil\n}", "title": "" }, { "docid": "0896168dc7328680769450b1c30a49d6", "score": "0.5272012", "text": "func newConnection(url string, config *Config) *Connection {\n\tstreadwayConfig := &streadway.Config{\n\t\tSASL: config.SASL,\n\t\tVhost: config.Vhost,\n\t\tChannelMax: config.ChannelMax,\n\t\tFrameSize: config.FrameSize,\n\t\tHeartbeat: config.Heartbeat,\n\t\tTLSClientConfig: config.TLSClientConfig,\n\t\tProperties: config.Properties,\n\t\tLocale: config.Locale,\n\t\tDial: config.Dial,\n\t}\n\n\t// Create our robust connection object\n\ttransportConn := &transportConnection{\n\t\tBasicConnection: nil,\n\t\tdialURL: url,\n\t\tdialConfig: config,\n\t\tstreadwayConfig: streadwayConfig,\n\t}\n\n\tmanager := newTransportManager(\n\t\tcontext.Background(), transportConn, \"CONNECTION\",\n\t)\n\t// Use the logger from the config\n\tmanager.logger = config.Logger\n\n\tconn := &Connection{\n\t\ttransportConn: transportConn,\n\t\ttransportManager: manager,\n\t}\n\n\treturn conn\n}", "title": "" }, { "docid": "6e12640ac9c178c31a0f3d0d1008d737", "score": "0.5262742", "text": "func (dsf *socketConnSource) newConn() (conn net.Conn, err error) {\n\tvar out bytes.Buffer\n\n\tcmd := exec.Command(\"i3\", \"--get-socketpath\")\n\tcmd.Stdout = &out\n\terr = cmd.Run()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpath := strings.TrimSpace(out.String())\n\tconn, err = net.Dial(\"unix\", path)\n\treturn\n}", "title": "" }, { "docid": "c435a1a53b8c080f95530031cdfd661f", "score": "0.5240091", "text": "func newConnection(s *websocket.Conn, user *User) {\r\n\tc := &Connection{\r\n\t\tsocket: s,\r\n\t\tsend: make(chan *message, SENDCHANNELSIZE),\r\n\t\tblocksend: make(chan *blockSend),\r\n\t\tstop: make(chan bool),\r\n\t\tuser: user,\r\n\t\tlastactive: time.Now(),\r\n\t\tping: make(chan time.Time, 2),\r\n\t\tRWMutex: sync.RWMutex{},\r\n\t}\r\n\r\n\tgo c.writePumpText()\r\n\tc.readPumpText()\r\n\r\n}", "title": "" }, { "docid": "57a063008169a26a0db00478efddb76a", "score": "0.5232001", "text": "func (conn *myconn) NewTX() (tx, error) {\n\tTempTXID++\n\tfmt.Printf(\"NewTX\\n\")\n\tm := new(mytx)\n\tm.Conn = conn\n\tm.Aborted = false\n\tm.Commited = false\n\tm.LocalTransactionID = TempTXID\n\tm.ProofOfWorkChannel = make(chan bool)\n\tm.WorkDone = false\n\tm.ValidatedChannel = make(chan bool)\n\tTX = m\n\n\tnewTransactionReq := NewTransactionReq{\n\t\tClient: m.Conn.ListenAddress,\n\t\tLocalTransactionID: m.LocalTransactionID,\n\t}\n\n\tvar success bool\n\t// send request in order\n\tfor i:=0; i<len(m.Conn.nodes); i++ {\n\t\tfmt.Println(\"Current nodeIP is: \", m.Conn.nodes[i])\n\t\tnodeIP := m.Conn.nodes[i]\n\n\t\tclient := m.Conn.rpcClients[nodeIP]\n\t\terr := client.Call(\"ClientToNode.ClientNewTransaction\", newTransactionReq, &success)\n\t\tif err != nil {\n\t\t\tdelete(m.Conn.rpcClients, nodeIP)\n\t\t\tm.Conn.nodes = append(m.Conn.nodes[:i], m.Conn.nodes[i+1:]...)\n\t\t\ti--\n\t\t}\n\t}\n\t// for index, client := range m.Conn.rpcClients {\n\t// \terr := client.Call(\"ClientToNode.ClientNewTransaction\", newTransactionReq, &success)\n\t// \tif err != nil {\n\t// \t\tdelete(m.Conn.rpcClients, index)\n\t// \t}\n\t// }\n\n\treturn m, nil\n}", "title": "" }, { "docid": "d2bf7bbf785ed6a4096c23f5fe810e59", "score": "0.5225579", "text": "func newConnectionTransport(config *Config) (*connectionTransport, error) {\n\ttransport := &connectionTransport{\n\t\tbaseTransport: newBaseTransport(config),\n\t\tlisten: true,\n\t\tstopHeartbeat: make(chan bool),\n\t}\n\n\tif err := transport.setOptions(config.Options); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn transport, nil\n}", "title": "" }, { "docid": "4d5a306dd7ab8b0a840c817bbc472ccf", "score": "0.5201354", "text": "func (manager *DeviceManager) ReceivedNewConnection(client *comm.Client) {\n\tclient.OnDisconnect(manager.DisconnectUnmanagedClient)\n\tclient.OnPacket(manager.ReceiveUnmanagedPacket)\n\tmanager.UnmanagedConnections.Add(client)\n}", "title": "" }, { "docid": "63f24e5c47900c7f11334013cb2c6424", "score": "0.51870346", "text": "func (self *IRConn) Dial(host string, sslConf *SSLConfig) error {\n\n log.Printf(\"Connecting to %v...\", host)\n con, err := net.Dial(\"tcp\", host)\n if err != nil {\n log.Printf(\"failed %v\", err)\n return err\n }\n\n if sslConf.UseSSL {\n log.Println(\"Using SSL\")\n conf := &tls.Config{InsecureSkipVerify: sslConf.SkipVerify}\n con = tls.Client(con, conf)\n }\n\n log.Printf(\"Connected successfully to %v\", host)\n self.con = con\n self.write = make(chan string)\n self.read = make(chan string)\n\n go func() {\n reader := bufio.NewReader(con)\n defer con.Close()\n\n self.read <- \"connected\"\n for {\n if msg, err := reader.ReadString('\\n'); err == nil {\n self.read <- msg\n } else {\n log.Printf(\"%v\", err)\n close(self.read)\n break\n }\n }\n }()\n\n go func() {\n defer con.Close()\n\n for {\n msg, ok := <-self.write\n if !ok {\n break\n }\n\n if len(msg) > 510 {\n msg = msg[0:510]\n }\n\n if _, err := self.con.Write([]byte(msg + \"\\r\\n\")); err != nil {\n log.Printf(\"%v\", err)\n break\n }\n\n log.Printf(\"--> %v\", msg)\n }\n }()\n\n return nil\n}", "title": "" }, { "docid": "4c5fc91b88fc6257e319b636708cf460", "score": "0.51835644", "text": "func (c *mqttclient) Connect() Token {\n\tvar err error\n\n\t// make connection\n\tif strings.Contains(c.opts.Servers, \"ssl://\") {\n\t\turl := strings.TrimPrefix(c.opts.Servers, \"ssl://\")\n\t\tc.conn, err = tls.Dial(\"tcp\", url, nil)\n\t\tif err != nil {\n\t\t\treturn &mqtttoken{err: err}\n\t\t}\n\t} else if strings.Contains(c.opts.Servers, \"tcp://\") {\n\t\turl := strings.TrimPrefix(c.opts.Servers, \"tcp://\")\n\t\tc.conn, err = net.Dial(\"tcp\", url)\n\t\tif err != nil {\n\t\t\treturn &mqtttoken{err: err}\n\t\t}\n\t} else {\n\t\t// invalid protocol\n\t\treturn &mqtttoken{err: errors.New(\"invalid protocol\")}\n\t}\n\n\tc.mid = 1\n\tc.inbound = make(chan packets.ControlPacket, 10)\n\tc.stop = make(chan struct{})\n\tc.incomingPubChan = make(chan *packets.PublishPacket, 10)\n\tc.msgRouter.matchAndDispatch(c.incomingPubChan, c.opts.Order, c)\n\n\t// send the MQTT connect message\n\tconnectPkt := packets.NewControlPacket(packets.Connect).(*packets.ConnectPacket)\n\tconnectPkt.Qos = 0\n\tif c.opts.Username != \"\" {\n\t\tconnectPkt.Username = c.opts.Username\n\t\tconnectPkt.UsernameFlag = true\n\t}\n\n\tif c.opts.Password != \"\" {\n\t\tconnectPkt.Password = []byte(c.opts.Password)\n\t\tconnectPkt.PasswordFlag = true\n\t}\n\n\tconnectPkt.ClientIdentifier = c.opts.ClientID\n\tconnectPkt.ProtocolVersion = byte(c.opts.ProtocolVersion)\n\tconnectPkt.ProtocolName = \"MQTT\"\n\tconnectPkt.Keepalive = 60\n\n\terr = connectPkt.Write(c.conn)\n\tif err != nil {\n\t\treturn &mqtttoken{err: err}\n\t}\n\n\t// TODO: handle timeout as ReadPacket blocks until it gets a packet.\n\t// CONNECT response.\n\tpacket, err := packets.ReadPacket(c.conn)\n\tif err != nil {\n\t\treturn &mqtttoken{err: err}\n\t}\n\tif packet != nil {\n\t\tack, ok := packet.(*packets.ConnackPacket)\n\t\tif ok {\n\t\t\tif ack.ReturnCode != 0 {\n\t\t\t\treturn &mqtttoken{err: errors.New(packet.String())}\n\t\t\t}\n\t\t\tc.connected = true\n\t\t}\n\t}\n\n\tgo readMessages(c)\n\tgo processInbound(c)\n\n\treturn &mqtttoken{}\n}", "title": "" }, { "docid": "a61e8e24c84a0150f09913c3c7fd0b78", "score": "0.51254576", "text": "func openConnection(ln net.Listener) {\n\tfmt.Println(\"Waiting for connection...\")\n\trpc.Accept(ln) // wait for connection\n\topenConnection(ln) // go wait for further connections\n}", "title": "" }, { "docid": "30386ad64594f94bdb201203871be3b2", "score": "0.5125286", "text": "func (this *SamsungTv) Connect() error {\n if err := this.Agent.Connect(); err != nil {\n return err\n }\n\n msg := samsungtv.CreateAuthenticateMessage(samsungtv.GetRemoteControlInfo())\n return this.Agent.Send([]byte(msg))\n}", "title": "" }, { "docid": "1ff8231a1dcbc70ebd080463aa6f23d1", "score": "0.51245725", "text": "func connect(opts *mqtt.ClientOptions, BrokerURL string) mqtt.Client {\n\n\tclient := mqtt.NewClient(opts)\n\n\ttoken := client.Connect()\n\tif token.Wait() && token.Error() != nil {\n\t\tpanic(token.Error())\n\t} else {\n\t\tfmt.Println(\"Mqtt server is ready: \", BrokerURL)\n\t}\n\n\treturn client\n}", "title": "" }, { "docid": "a0a07656aaa9bbb8ef43a8ddc4938e5d", "score": "0.5124371", "text": "func (mqtt_client Client) Connect(clientID string) mqtt.Client {\n\t// opts := createClientOptions(clientId, uri)\n\topts := mqtt.NewClientOptions()\n\t// opts.AddBroker(fmt.Sprintf(\"tcp://%s:%d\", mqtt_client.Hostname,mqtt_client.Port))\n\topts.AddBroker(fmt.Sprintf(\"tcp://%s:%d\", mqtt_client.Hostname, mqtt_client.Port))\n\topts.SetUsername(mqtt_client.Username)\n\topts.SetPassword(mqtt_client.Password)\n\topts.SetClientID(clientID)\n\tclient := mqtt.NewClient(opts)\n\ttoken := client.Connect()\n\tfor !token.WaitTimeout(3 * time.Second) {\n\t}\n\tif err := token.Error(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn client\n}", "title": "" }, { "docid": "b70a54fd2c7f6325cc1fca7c6227532a", "score": "0.5116567", "text": "func Connect(busType StandardBus) (*Connection, error) {\n\tvar address string\n\n\tswitch busType {\n\tcase SessionBus:\n\t\taddress = os.Getenv(\"DBUS_SESSION_BUS_ADDRESS\")\n\n\tcase SystemBus:\n\t\tif address = os.Getenv(\"DBUS_SYSTEM_BUS_ADDRESS\"); len(address) == 0 {\n\t\t\taddress = \"unix:path=/var/run/dbus/system_bus_socket\"\n\t\t}\n\n\tdefault:\n\t\treturn nil, errors.New(\"Unknown bus\")\n\t}\n\n\ttrans, err := newTransport(address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbus := new(Connection)\n\tif bus.conn, err = trans.Dial(); err != nil {\n\t\treturn nil, err\n\t}\n\tbus.setConnOpen(true)\n\n\tif err = authenticate(bus.conn, nil); err != nil {\n\t\tbus.Close()\n\t\treturn nil, err\n\t}\n\n\tbus.busProxy = BusDaemon{bus.Object(BUS_DAEMON_NAME, BUS_DAEMON_PATH)}\n\tbus.messageFilters = []*MessageFilter{}\n\tbus.methodCallReplies = make(map[uint32]chan<- *Message)\n\tbus.objectPathHandlers = make(map[ObjectPath]chan<- *Message)\n\tbus.signalMatchRules = make(signalWatchSet)\n\tbus.nameInfo = make(map[string]*nameInfo)\n\n\tgo bus.receiveLoop()\n\tif bus.UniqueName, err = bus.busProxy.Hello(); err != nil {\n\t\tbus.Close()\n\t\treturn nil, err\n\t}\n\n\treturn bus, nil\n}", "title": "" }, { "docid": "c48e5783581e7cead6e057cb3e3e134d", "score": "0.5114825", "text": "func (s *Service) Connect() (err error) {\n\ts.hc, err = s.GetClient(mgmt.ServiceManagementScope)\n\tif err != nil {\n\t\treturn\n\t}\n\ts.api, err = mgmt.New(s.hc)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "16ae611b25be030c9fdf6598ca6cdc0b", "score": "0.510568", "text": "func Connect(done chan<- error, rdy chan<- struct{}, sig <-chan struct{}) {\n\tsession, err := dbsession.GetInstance()\n\tif err == nil {\n\t\terr = session.Ping()\n\t}\n\tif err != nil {\n\t\tfmt.Println(fmt.Errorf(\"DATABASE-ERROR: \" + err.Error()))\n\t\tclose(rdy)\n\t\tdone <- err\n\t\treturn\n\t}\n\tclose(rdy)\n\n\t<-sig // stop service loop\n\ttime.Sleep(100 * time.Millisecond)\n\tfmt.Println(\"\\tDatabase session .. \")\n\n\terr = session.Ping() // maybe use refresh then close?\n\n\tif err != nil {\n\t\tdone <- nil // error cant pint closed connection\n\t\treturn\n\t}\n\n\t// Ping worked, so close the connection\n\tsession.Close()\n\tdone <- nil\n}", "title": "" }, { "docid": "b2e8a1b13e0ac2f3c763e42d711a96b6", "score": "0.50978774", "text": "func (b *Client) Connect(conn io.ReadWriteCloser) (err error) {\n\tif b.connected {\n\t\treturn ErrConnected\n\t}\n\n\tb.connection = conn\n\tb.Reset()\n\n\tinitFunc := b.ProtocolVersionQuery\n\n\tb.Once(b.Event(\"ProtocolVersion\"), func(data interface{}) {\n\t\tinitFunc = b.FirmwareQuery\n\t})\n\n\tb.Once(b.Event(\"FirmwareQuery\"), func(data interface{}) {\n\t\tinitFunc = b.CapabilitiesQuery\n\t})\n\n\tb.Once(b.Event(\"CapabilityQuery\"), func(data interface{}) {\n\t\tinitFunc = b.AnalogMappingQuery\n\t})\n\n\tb.Once(b.Event(\"AnalogMappingQuery\"), func(data interface{}) {\n\t\tinitFunc = func() error { return nil }\n\t\tb.ReportDigital(0, 1)\n\t\tb.ReportDigital(1, 1)\n\t\tb.connected = true\n\t})\n\n\tfor {\n\t\tif err := initFunc(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := b.process(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif b.connected {\n\t\t\tgo func() {\n\t\t\t\tfor {\n\t\t\t\t\tif !b.connected {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\n\t\t\t\t\tif err := b.process(); err != nil {\n\t\t\t\t\t\tb.Publish(b.Event(\"Error\"), err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}()\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "1db6da390d4e6b3d31f83959400887aa", "score": "0.50478005", "text": "func (c *connHdl) connect() {\n\tif c.spec.password != DefaultRedisPassword {\n\t\targs := [][]byte{[]byte(c.spec.password)}\n\t\tif _, e := c.ServiceRequest(&AUTH, args); e != nil {\n\t\t\tpanic(e)\n\t\t\t//\t\t\tpanic(fmt.Errorf(\"<ERROR> Authentication failed - %s\", e.Message()))\n\t\t}\n\t}\n\tif c.spec.db != DefaultRedisDB {\n\t\targs := [][]byte{[]byte(fmt.Sprintf(\"%d\", c.spec.db))}\n\t\tif _, e := c.ServiceRequest(&SELECT, args); e != nil {\n\t\t\tpanic(e)\n\t\t\t//\t\t\tpanic(fmt.Errorf(\"<ERROR> REDIS_DB Select failed - %s\", e.Message()))\n\t\t}\n\t}\n\t// REVU - pretty please TODO do the customized log\n\t//\tlog.Printf(\"<INFO> %s - CONNECTED\", c)\n\treturn\n}", "title": "" }, { "docid": "41fe8cb846ab2fbba854563057ae4ddc", "score": "0.5043542", "text": "func (d *device) connect(ctx context.Context) error {\n\td.mu.Lock()\n\tdefer d.mu.Unlock()\n\n\tif d.dev != nil {\n\t\treturn nil\n\t}\n\n\tlog.Infof(\"Connecting to %q.\", d.addr)\n\tdev, err := btapi.GetDeviceByAddress(d.addr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't get device with address %q: %v\", d.addr, err)\n\t}\n\n\tt := time.NewTicker(retryDelay)\n\tdefer t.Stop()\nF:\n\tfor {\n\t\terr := dev.Connect()\n\t\tif err == nil {\n\t\t\tbreak F\n\t\t}\n\t\tlog.Warningf(\"Can't connect to device %q: %v. Will retry.\", d.addr, err)\n\n\t\tselect {\n\t\tcase <-t.C:\n\t\t\tcontinue F\n\t\tcase <-ctx.Done():\n\t\t\treturn fmt.Errorf(\"while connecting to %q: %v\", d.addr, ctx.Err())\n\t\t}\n\t}\n\n\td.dev = dev\n\treturn nil\n}", "title": "" }, { "docid": "e0e8170c45f5259b50640e4490a70bc2", "score": "0.5023236", "text": "func NewConnection(nodes []string) connection {\n\tfmt.Printf(\"NewConnection\\n\")\n\n\tvar sortedNodes []string\n\n\tc := new(myconn)\n\tc.rpcClients = make(map[string]*rpc.Client)\n\tfor _, nodeIP := range nodes {\n\t\tclient, err := rpc.Dial(\"tcp\", nodeIP)\n\t\t// checkError(\"\", err, true)\n\t\tif err == nil {\n\t\t\t// fmt.Println(\"client: \", client)\n\t\t\t// fmt.Println(\"clients: \", c.rpcClients)\n\t\t\t// c.rpcClients = append(c.rpcClients, client)\n\t\t\tc.rpcClients[nodeIP] = client\n\t\t\tsortedNodes = append(sortedNodes, nodeIP)\n\t\t}\n\t}\n\n\tlocalListenAddress, err := net.InterfaceAddrs()\n\tcheckError(\"Cannot get local IP address\", err, true)\n\n\t// sort nodes list\n\tsort.Strings(sortedNodes)\n\tc.nodes = sortedNodes\n\tfmt.Println(\"Sorted nodes: \", sortedNodes)\n\n\tipFound := false\n\tfor _, a := range localListenAddress {\n\t\tif ipnet, ok := a.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {\n\t\t\tif ipnet.IP.To4() != nil {\n\t\t\t\tipFound = true\n\t\t\t\tc.ListenAddress = ipnet.IP.String() + \":0\"\n\t\t\t\t// fmt.Println(\"ListenAddress set as: \", c.ListenAddress)\n\t\t\t\t// TESTING on windows\n\t\t\t\t// c.ListenAddress = \"127.0.0.1\" + \":0\"\n\t\t\t\t// fmt.Println(\"NOW ListenAddress set as: \", c.ListenAddress)\n\t\t\t}\n\t\t}\n\t}\n\tif ipFound != true {\n\t\terr = fmt.Errorf(\"Unable to set client IP and Port for listening\")\n\t\tpanic(err)\n\t}\n\n\t// go func() {\n\tcServer := rpc.NewServer()\n\tnc := new(NodeToClient)\n\tcServer.Register(nc)\n\n\tl, err := net.Listen(\"tcp\", c.ListenAddress)\n\tcheckError(\"\", err, true)\n\n\tfmt.Println(\"listen on: \", l.Addr().String())\n\tc.ListenAddress = l.Addr().String()\n\n\t// need to get public port\n\t_, port, _ := net.SplitHostPort(c.ListenAddress)\n\thost := getPublicIp()\n\tc.ListenAddress = net.JoinHostPort(host, port)\n\tfmt.Println(\"ListenAddress set as: \", c.ListenAddress)\n\n\tvar success bool\n\tfor _, client := range c.rpcClients {\n\t\t_ = client.Call(\"ClientToNode.ClientListenAddress\", c.ListenAddress, &success)\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tconn, err := l.Accept()\n\t\t\tcheckError(\"\", err, false)\n\t\t\tgo cServer.ServeConn(conn)\n\t\t}\n\t}()\n\n\treturn c\n}", "title": "" }, { "docid": "17570a698ff12fa214ecd0eb1894efaf", "score": "0.50200915", "text": "func listenConnection(proxy *Core.Proxy, tcpListener *net.TCPListener, table *Encryption.Table) {\n\tLogging.NormalLogger.Println(\"local is waiting for connection\")\n\tfor {\n\t\tlocalTcpConn, _ := tcpListener.AcceptTCP()\n\t\tserverTcpConn, err := net.DialTCP(\"tcp\", nil, proxy.GetServerHost())\n\t\tif err != nil {\n\t\t\tLogging.ErrorLogger.Fatal(\"terminating: server is not running\")\n\t\t}\n\n\t\tLogging.NormalLogger.Println(\"accepted a connection\")\n\t\tLogging.NormalLogger.Printf(localTcpConn.LocalAddr().String())\n\t\tLogging.NormalLogger.Printf(serverTcpConn.LocalAddr().String())\n\t\tLogging.NormalLogger.Printf(localTcpConn.RemoteAddr().String())\n\t\tLogging.NormalLogger.Printf(serverTcpConn.RemoteAddr().String())\n\t\tconnection := Core.NewConnectionHandler(localTcpConn, serverTcpConn, proxy.GetDevice(), table)\n\t\tgo connection.TransferData()\n\t}\n}", "title": "" }, { "docid": "b03dc78e3589f9345c2fdb4f6b9e2dee", "score": "0.5017503", "text": "func NewConnection(dialBus func() (*dbus.Conn, error)) (*Conn, error) {\n\tsysconn, err := dialBus()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsigconn, err := dialBus()\n\tif err != nil {\n\t\tsysconn.Close()\n\t\treturn nil, err\n\t}\n\n\tc := &Conn{\n\t\tsysconn: sysconn,\n\t\tsysobj: systemdObject(sysconn),\n\t\tsigconn: sigconn,\n\t\tsigobj: systemdObject(sigconn),\n\t}\n\n\tc.subStateSubscriber.ignore = make(map[dbus.ObjectPath]int64)\n\tc.jobListener.jobs = make(map[dbus.ObjectPath]chan<- string)\n\n\t// Setup the listeners on jobs so that we can get completions\n\tc.sigconn.BusObject().Call(\"org.freedesktop.DBus.AddMatch\", 0,\n\t\t\"type='signal', interface='org.freedesktop.systemd1.Manager', member='JobRemoved'\")\n\n\tc.dispatch()\n\treturn c, nil\n}", "title": "" }, { "docid": "b75025d9061bd2c39be5f0ad98bcb5c2", "score": "0.49963054", "text": "func (s *SSD1306Driver) Connection() gobot.Connection { return s.connector.(gobot.Connection) }", "title": "" }, { "docid": "4827c2680d38f8ec424993322408a575", "score": "0.49912816", "text": "func (f *SerialAdaptor) Connect() (errs []error) {\n\tif f.port == nil {\n\t\tc := &serial.Config{Name: f.portName, Baud: 115200}\n\t\tsp, err := serial.OpenPort(c)\n\t\tif err != nil {\n\t\t\treturn []error{err}\n\t\t}\n\t\tf.port = sp\n\t}\n\n\tgo func() {\n\t\tinchar := make([]byte, 1)\n\t\tline := make([]byte, 0, 128)\n\t\tfor {\n\t\t\tn, err := f.port.Read(inchar)\n\t\t\tif err != nil || n != 1 {\n\t\t\t\tf.Publish(f.Event(Error), err)\n\t\t\t\tlog.Fatal(err)\n\t\t\t} else if inchar[0] == '\\n' || inchar[0] == '\\r' {\n\t\t\t\t//log.Printf(\"%d %q\", n, line)\n\t\t\t\tf.Publish(f.Event(Data), line)\n\t\t\t\tline = line[0:0]\n\t\t\t} else {\n\t\t\t\tline = append(line, inchar[0])\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn\n}", "title": "" }, { "docid": "f454be8e95db71ce92254bed1752cb27", "score": "0.49786907", "text": "func (m *MQTTClient) Connect() {\n\tcli := m.Client\n\tif token := cli.Connect(); token.Wait() && token.Error() != nil {\n\t\tpanic(token.Error())\n\t}\n\tfmt.Println(\"Connected\")\n}", "title": "" }, { "docid": "cb89f8925e9f11f171f6f03795a1a032", "score": "0.49780074", "text": "func newConn(rwc net.Conn, srv *BfeServer) (c *conn, err error) {\n\tc = new(conn)\n\tc.remoteAddr = rwc.RemoteAddr().String()\n\tc.server = srv\n\tc.rwc = rwc\n\tc.sr = liveSwitchReader{r: c.rwc}\n\tc.lr = io.LimitReader(&c.sr, noLimit).(*io.LimitedReader)\n\tbr := srv.BufioCache.newBufioReader(c.lr)\n\tbw := srv.BufioCache.newBufioWriterSize(c.rwc, 4<<10)\n\tc.buf = bfe_bufio.NewReadWriter(br, bw)\n\tc.reqSN = 0\n\n\tc.session = bfe_basic.NewSession(rwc)\n\tvip, vport, err := bfe_util.GetVipPort(rwc)\n\tif err == nil {\n\t\tc.session.Vip = vip\n\t\tc.session.Vport = vport\n\n\t\t// get product if vip -> product table is set\n\t\tsf := srv.GetServerConf()\n\t\tproduct, err := sf.HostTable.LookupProductByVip(vip.String())\n\t\tif err == nil {\n\t\t\tc.session.Product = product\n\t\t}\n\n\t\tlog.Logger.Debug(\"newConn(): VIP: %v, Port: %v, Product: %v\", c.session.Vip.String(), vport, product)\n\t} else {\n\t\tlog.Logger.Debug(\"newConn(): GetVip: %s\", err.Error())\n\t}\n\n\tif sc, ok := rwc.(*bfe_tls.Conn); ok {\n\t\tc.session.IsSecure = true\n\t\tsc.SetConnParam(c.session)\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "8725b52912626ba4464a54cd29ad7ba5", "score": "0.49747464", "text": "func OpenConnection(url string, port string, user string, pass string) *Proxy {\n\tlog.Println(\"A heavy process to create my connection with database\")\n\ttime.Sleep(2 * time.Second)\n\treturn &Proxy{\n\t\tapplication: &Application{},\n\t\turl: url,\n\t\tport: port,\n\t\tuser: user,\n\t\tpass: pass,\n\t}\n}", "title": "" }, { "docid": "6627aa814a2862d193e56f56e91d718c", "score": "0.49726024", "text": "func (dht *DHT) Dial(ctx context.Context, n NetworkNode) (*grpc.ClientConn, error) {\n\treturn dht.networking.getConn(n)\n}", "title": "" }, { "docid": "02e2f1129a05c0be8e4088b129e39f6f", "score": "0.49654514", "text": "func (t *TSaslClientTransport) Open() error {\n\tprotocol := thrift.NewTBinaryProtocolFactoryDefault()\n\tcli := tcliservice.NewTCLIServiceClientFactory(t, protocol)\n\n\tif ! t.TSocket.IsOpen() {\n\t\tif err := t.TSocket.Open(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif t.SaslClient != nil {\n\t\treturn errors.New(\"Already open!\")\n\t}\n\n\tt.SaslClient = t.SaslClientFactory\n\tmech, ir, err := t.SaslClient.Start()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// send initial message\n\tif _, err := t.sendMessage(START, []byte(mech)); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := t.sendMessage(OK, ir); err != nil {\n\t\treturn err\n\t}\n\n\tfor {\n\t\tstatus, payload, err := t.recvMessage()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif status != OK && status != COMPLETE {\n\t\t\treturn errors.New(fmt.Sprintf(\"Bad status:%d %s\", status, string(payload)))\n\t\t}\n\n\t\tif status == COMPLETE {\n\t\t\tbreak\n\t\t}\n\n\t\tresponse, err := t.SaslClient.Next(payload)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tt.sendMessage(OK, response)\n\t}\n\n\t//fmt.Println(\"connection built, opening session...\")\n\n\treq := tcliservice.NewTOpenSessionReq()\n\treq.Username = &t.User\n\treq.Password = &t.Passwd\n\treq.ClientProtocol = tcliservice.TProtocolVersion_HIVE_CLI_SERVICE_PROTOCOL_V1\n\n\tsession, err := cli.OpenSession(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tt.Client = cli\n\tt.Session = session.SessionHandle\n\tt.opened = true\n\treturn nil\n}", "title": "" }, { "docid": "673122fafa4b1bbc4ac8d642d4a4a34e", "score": "0.49625838", "text": "func (c *Client) Connect(ctx context.Context) error {\n\tlogger.Info(ctx, \"Invoked-connectGrpcServer\")\n\t// log.Info(\"Invoked-connectGrpcServer\", log.Opts{\"peer-ID\": peerID})\n\topts := c.getDialOpts(ctx)\n\t// Establishing the server connection\n\tconn, err := g.Dial(c.uri, opts...)\n\tif err != nil {\n\t\tlogger.Error(ctx, \"Grpc-client-connection-failed\", log.Fields{\"error\": err})\n\t\treturn err\n\t}\n\tc.conn = conn\n\tlogger.Info(ctx, \"Connection-established\", log.Fields{\"conn\": conn})\n\t// Constructing a client object\n\tc.hwMgmtSvcClient = dmi.NewNativeHWManagementServiceClient(conn)\n\treturn nil\n}", "title": "" }, { "docid": "7df2edf179f0aab5ed5676da691ac714", "score": "0.4958539", "text": "func (e *ExternalUDPEgress) Open() {\n\taddr, err := net.ResolveUDPAddr(\"udp\", e.Host+\":\"+e.Port)\n\tif err != nil {\n\t\tlog.ERROR.Println(err)\n\t}\n\n\te.Conn, err = net.DialUDP(\"udp\", nil, addr)\n\tif err != nil {\n\t\tlog.ERROR.Println(err)\n\t}\n\n\tgo func(channel <-chan interface{}) {\n\t\tdefer e.Conn.Close()\n\t\tencoder := gob.NewEncoder(e.Conn)\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase data := <-channel:\n\t\t\t\terr := encoder.Encode(&data)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.ERROR.Println(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}(e.Channel_)\n\n\tlog.INFO.Println(\"ExternalUDPEgress: connector \" + e.Name_ + \" is opened.\")\n}", "title": "" }, { "docid": "fab87a60a53f8246002d27b1ec432d7f", "score": "0.49399558", "text": "func Client(adapterID string, dev *device.Device1) (err error) {\n\n\tif adapterID == \"\" {\n\t\treturn fmt.Errorf(\"Adapter name not provided\")\n\t}\n\n\tif dev == nil {\n\t\treturn fmt.Errorf(\"Device not provided\")\n\t}\n\n\t//Connect DBus System bus\n\tconn, err := dbus.SystemBus()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// do not reuse agent0 from service\n\tagent.NextAgentPath()\n\n\tag := agent.NewSimpleAgent()\n\terr = agent.ExposeAgent(conn, ag, agent.CapNoInputNoOutput, true)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"SimpleAgent: %s\", err)\n\t}\n\n\t// a, err := adapter.GetAdapterFromDevicePath(dev.Path())\n\t// if err != nil {\n\t// \treturn err\n\t// }\n\n\tchanges, err := dev.WatchProperties()\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase ev := <-changes:\n\t\t\t\tlog.Infof(\"updated %s=%v\", ev.Name, ev.Value)\n\n\t\t\t\tif !dev.Properties.Connected {\n\t\t\t\t\terr = connect(dev, ag, adapterID)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Errorf(\"connect err: %s\", err)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}()\n\n\terr = connect(dev, ag, adapterID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// retrieveServices(a, dev)\n\n\tselect {}\n\t// return nil\n}", "title": "" }, { "docid": "074f3012437c2f61ba4fca22083735da", "score": "0.49340147", "text": "func NewConnection(addr string, key StaticKey) (Conn, error) {\n\tnconn, err := net.DialTimeout(\"tcp\", addr, time.Duration(10*time.Second))\n\tif err != nil {\n\t\treturn nil, ConnError{Op: \"dial\", Addr: addr, Err: err}\n\t}\n\n\toconn := &conn{\n\t\taddr: addr,\n\t\tnconn: nconn,\n\t\tseqNum: 1,\n\t}\n\n\t// New Session\n\tnewp := &packet{\n\t\tseqNum: oconn.nextSeqNum(),\n\t\tmsgType: msgClientReqNewSession,\n\t}\n\ttimeout := time.Now().Add(time.Second * 15)\n\terr = oconn.sendPacket(newp, timeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tackSessionp, err := oconn.recvPacket(timeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif ackSessionp.msgType != msgControllerAckNewSession {\n\t\treturn nil, fmt.Errorf(\"Could not establish new session with controller\")\n\t}\n\tas := ackNewSession{}\n\terr = ackSessionp.unmarshal(&as)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toconn.protoVersion = as.ProtoVersion\n\toconn.sessionKey, err = createSessionKey(key, as.SessionID[:])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create session key - %s\", err)\n\t}\n\n\toconn.cipher, err = aes.NewCipher(oconn.sessionKey[:])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create client cipher - %s\", err.Error())\n\t}\n\tfmt.Printf(\"Proto: %d\\n\", as.ProtoVersion)\n\n\t// Secure connection\n\tsecp := &packet{\n\t\tseqNum: oconn.nextSeqNum(),\n\t\tmsgType: msgClientReqSecureConnection,\n\t\tdata: as.SessionID[:],\n\t}\n\terr = oconn.sendPacket(secp, timeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tackSecurep, err := oconn.recvPacket(timeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif ackSecurep.msgType != msgControllerAckSecureConnection {\n\t\treturn nil, fmt.Errorf(\"Client generated wrong session key\")\n\t}\n\tsec := ackSecureSession{}\n\terr = ackSecurep.unmarshal(&sec)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif sec.SessionID != as.SessionID {\n\t\treturn nil, fmt.Errorf(\"Failed to match session id on secure connection.\")\n\t}\n\n\treturn oconn, err\n}", "title": "" }, { "docid": "2a5ab153a87e15c12a58a852a500ba86", "score": "0.4933147", "text": "func (c *mqttConn) initConn() (p *packet.ConnectPacket) {\n\tselect {\n\tcase <-time.After(10e9):\n\t\tc.closeConn(\"waitting for connect packet timeout\", false)\n\tcase pr := <-c.readch:\n\t\tack := new(packet.ConnackPacket)\n\t\tif pr.Err == packet.ErrProtocol {\n\t\t\tack.Code = packet.CodeConnackRefusedProtocol\n\t\t\tack.WriteTo(c.cnn) //sync write\n\t\t\tc.closeConn(\"protocol err\", false)\n\t\t\treturn\n\t\t}\n\t\tif pr.Err != nil {\n\t\t\tc.closeConn(\"parse the first connect packet err:\"+pr.Err.Error(), false)\n\t\t\treturn\n\t\t}\n\t\tif pr.P == nil {\n\t\t\tc.closeConn(\"connect fail\", false)\n\t\t\treturn\n\t\t}\n\t\tif pr.P.ControlType() != packet.TypeCONNECT {\n\t\t\tc.closeConn(\"the first packet is not a connect packet\", false)\n\t\t\treturn\n\t\t}\n\n\t\tp = pr.P.(*packet.ConnectPacket)\n\t\tif bool(p.UserNameFlag) && authCheck != nil && !authCheck(string(p.UserName), string(p.Password)) {\n\t\t\tack.Code = packet.CodeConnackRefusedUnauthorized\n\t\t\tack.WriteTo(c.cnn)\n\t\t\tc.closeConn(\"auth fail\", false)\n\t\t\tp = nil\n\t\t\treturn\n\t\t}\n\n\t\tc.clientId = string(p.ClientId)\n\t\tc.deadline = time.Second * time.Duration(p.KeepAlive)\n\n\t\tgo c.write()\n\t\tgo c.keepalive()\n\n\t\tif c.initSession() {\n\t\t\tc.publishOld(bool(p.CleanSession))\n\t\t}\n\n\t\tif p.CleanSession {\n\t\t\tack.AckFlags = 1\n\t\t}\n\t\tack.Code = packet.CodeConnackAccepted\n\t\tc.writech <- ack\n\n\t\tConnRegistry.Add(c.clientId, c)\n\n\t}\n\treturn\n}", "title": "" }, { "docid": "c563ed6664076838735a8e1cdcf204df", "score": "0.49309722", "text": "func (this *protocol) _keepConnected(aInstance *conf.Instance, aConnection *net.Conn, aCloser io.Closer){\n\tvar byteBuffer *bytes.Buffer\n\tbuffer := make([]byte,2000)\n\tconnection := (*aConnection)\n\tdefer func() {\n\t\tconnection.Close()\n\t}()\n\tvar command string\n\tvar arguments, remain []byte\n\tvar needMore int\n\t// while the service is running\n\tfor this.context.GetBundle().GetState() == osgi.ACTIVE {\n\t\ttime.Sleep(500 * time.Millisecond)\n\t\t//this.logger.Println(\"DEBUG after sleep\")\n\t\t// reintroduce remain from previous command\n\t\tif len(remain) > 0 {\n\t\t\t//this.logger.Println(\"Reusing remain\",remain)\n\t\t\tbuffer = remain\n\t\t} else {\n\t\t\t//this.logger.Println(\"Listening to remote\")\n\t\t\tcount,err := connection.Read(buffer)\n\t\t\tif err != nil {\n\t\t\t\tif aCloser != nil {\n\t\t\t\t\taCloser.Close()\n\t\t\t\t}\n\t\t\t\tthis.logger.Println(\"INFO Lost connection with\",aInstance.Name(),err)\n\t\t\t\tevent.Bus.FireEvent(&InstanceDisconnected{Instance : aInstance})\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tbuffer = buffer[0:count]\n\t\t}\n\t\t//this.logger.Println(\"DEBUG after Read\",buffer,string(buffer))\n\t\t// Parse data received\n\t\tcommand, arguments, remain, needMore = this._splitCommand(buffer)\n\t\t//this.logger.Println(\"DEBUG after split\",command,string(arguments),remain,needMore)\n\t\tif needMore != 0 {\n\t\t\t//this.logger.Println(\"Unfinished\",arguments,\", need\",needMore,\"bytes\")\n\t\t\tvar bufferNeeded bytes.Buffer // Todo in the future use a swap in disk for ITEM command\n\t\t\tremain = this._takeMore(connection,needMore,&bufferNeeded)\n\t\t\targuments = append(arguments,bufferNeeded.Bytes()...)\n\t\t\t//this.logger.Println(\"Finally got\",string(arguments))\n\t\t}\n\t\t//this.logger.Println(\"DEBUG after Parse\",command,string(arguments))\n\t\t// Process the command\n\t\t//this.logger.Println(\"DEBUG Received command \" + command,remain)\n\t\t// Received HELLO from called\n\t\tif command == \"HELLO\" { // On est côté appelant, on reçoit la réponse de l'appelé, on lui envoie la configuration\n\t\t\tbuffer := bytes.NewBuffer(arguments)\n\t\t\tdecoder := json.NewDecoder(buffer)\n\t\t\tvar info currentInstanceInformation\n\t\t\tdecoder.Decode(&info)\n\t\t\tthis.logger.Println(\"DEBUG HELLO received\",info)\n\t\t\taInstance.Groups = info.Groups\n\t\t\tthis._sendConfiguration(&connection)\n\t\t} else if command == \"INSTANCES\" { // Receive instance list\n\t\t\tvar newInstances []*conf.Instance\n\t\t\tbyteBuffer = bytes.NewBuffer(arguments)\n\t\t\tdecoder := json.NewDecoder(byteBuffer)\n\t\t\tdecoder.Decode(&newInstances)\n\t\t\tfor _,newInstance := range newInstances {\n\t\t\t\t//this.logger.Println(\"DEBUG Received instance :\",newInstance)\n\t\t\t\tnewInstance.Connected = false // ensure the Instance will not be considered as connected\n\t\t\t\tevent.Bus.FireEvent(&InstanceReceived{Instance : newInstance, From : aInstance})\n\t\t\t}\n\t\t} else if command == \"TOPICS\" { // Receive topic list\n\t\t\tvar distributedTopics []*conf.Topic\n\t\t\tbyteBuffer = bytes.NewBuffer(arguments)\n\t\t\tdecoder := json.NewDecoder(byteBuffer)\n\t\t\tdecoder.Decode(&distributedTopics)\n\t\t\tfor _,topic := range distributedTopics {\n\t\t\t\tthis.logger.Println(\"DEBUG Received topic :\",topic)\n\t\t\t\tevent.Bus.FireEvent(&TopicReceived{Topic : topic, From : aInstance})\n\t\t\t}\n\t\t} else if command == \"ITEM\" { // Receive item\n\t\t\tvar item *SharedItem\n\t\t\tbyteBuffer = bytes.NewBuffer(arguments)\n\t\t\tdecoder := json.NewDecoder(byteBuffer)\n\t\t\tdecoder.Decode(&item)\n\t\t\t//this.logger.Println(\"DEBUG Received item :\",item)\n\t\t\tevent.Bus.FireEvent(&ItemReceived{Item : item, From : aInstance})\n\t\t} else if command == \"ITEM-CONTENT\" { // Receive item\n\t\t\tthis.logger.Println(\"DEBUG Received item content :\",string(arguments))\n\t\t\tvar i = 0\n\t\t\tfor arguments[i] != DIEZE {\n\t\t\t\ti++\n\t\t\t}\n\t\t\tid := string(arguments[0:i])\n\t\t\tcontent := arguments[i+1:]\n\t\t\tthis.logger.Println(\"DEBUG Received item content : id = \",id,\" content = \",string(content))\n\t\t\tevent.Bus.FireEvent(&ItemContentReceived{ID : id, Content : content, From : aInstance})\n\t\t} else if command == \"ITEM-REMOVE\" { // Remove item\n\t\t\tevent.Bus.FireEvent(&ItemRemoved{ID : string(arguments), From : aInstance})\n\t\t} else if command == \"ERROR\" {\n\t\t\tthis.logger.Println(\"WARNING Received ERROR :\",arguments)\n\t\t} else {\n\t\t\tthis.logger.Println(\"WARNING Not supported command\")\n\t\t\tthis.sendCommand(\"ERROR\",[]byte(\"NOT SUPPORTED COMMAND '\"+command+\"'\"),connection)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "282bc3dda6253e2aa2eec612e30b1a2f", "score": "0.4930806", "text": "func (pc *pooledConnectImpl) Begin() error {\n\treturn pc.directConnection.Begin()\n}", "title": "" }, { "docid": "428a6326e4367c13143cf05ff4767b71", "score": "0.49294034", "text": "func (conn *AMQP10Connector) Connect() error {\n\tif err := conn.connect(\"in\"); err != nil {\n\t\tconn.logger.Metadata(map[string]interface{}{\n\t\t\t\"error\": err,\n\t\t})\n\t\tconn.logger.Debug(\"Failed to create incoming connection\")\n\t\treturn err\n\t}\n\n\tif err := conn.connect(\"out\"); err != nil {\n\t\tconn.logger.Metadata(map[string]interface{}{\n\t\t\t\"error\": err,\n\t\t})\n\t\tconn.logger.Debug(\"Failed to create ougoing connection\")\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "44a9b56196fe63c59b016c76f7a4492a", "score": "0.49188244", "text": "func RelayServiceRequest(host string, port int, handler ServiceConnectionHandler) {\n connection := fmt.Sprintf(\"%s:%d\", host, port)\n glog.V(1).Info(\"Connecting to relay on \", connection)\n relayServerConn, err := net.Dial(\"tcp\", connection)\n if err != nil {\n glog.Exit(\"Connecting to relay server \", err)\n }\n defer relayServerConn.Close()\n\n // Keep processing Messages on control channel\n dec := gob.NewDecoder(relayServerConn)\n var mess Message\n\n for {\n readErr := dec.Decode(&mess)\n if readErr != nil {\n glog.Exit(\"Reading \", readErr, \", mess is \", mess)\n }\n glog.V(2).Info(\"Read Message: \", mess)\n\n switch mess.Action {\n case NewService:\n exposedAddress := fmt.Sprintf(\"%s:%s\", host, mess.Data)\n fmt.Println(\"Established relay address:\", exposedAddress)\n case NewConnectionOnService:\n relayAddress := fmt.Sprintf(\"%s:%s\", host, mess.Data)\n conn, err := net.Dial(\"tcp\", relayAddress)\n if err != nil {\n glog.Exit(\"Connecting to relay server \", err)\n }\n go handler(conn)\n\n case EndConnectionOnService:\n // Not sure what I need to do here. Probably use channel from above to blast all routines\n\n default:\n glog.Warning(\"Unknown Action: \", mess.Action)\n }\n }\n}", "title": "" }, { "docid": "419d12cd17f40ba9254071dfb03321a2", "score": "0.49167022", "text": "func NewConnection(server string, nodes []string, tags []string) (Connection, error) {\n\tobject := NewAutomationObject()\n\titems, err := object.TryConnect(server, nodes)\n\tif err != nil {\n\t\treturn &opcConnectionImpl{}, err\n\t}\n\terr = items.Add(tags...)\n\tif err != nil {\n\t\treturn &opcConnectionImpl{}, err\n\t}\n\tconn := opcConnectionImpl{\n\t\tAutomationObject: object,\n\t\tAutomationItems: items,\n\t\tServer: server,\n\t\tNodes: nodes,\n\t}\n\n\treturn &conn, nil\n}", "title": "" }, { "docid": "cb80d840babeae265eeb122f91e8cbb6", "score": "0.49089056", "text": "func (c *Client) doConnect() error {\n\t// Create the influxBD client\n\tif c.influxClient == nil {\n\t\tinfluxClient, err := influxDBClient.NewHTTPClient(influxDBClient.HTTPConfig{\n\t\t\tAddr: c.serverAddress,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tc.influxClient = influxClient\n\n\t\tlogger.V(2).Printf(\"InfluxDB client created\")\n\t}\n\n\t// Test the conectivity to the server\n\t_, _, pingErr := c.influxClient.Ping(5 * time.Second)\n\tif pingErr != nil {\n\t\treturn pingErr\n\t}\n\n\t// Create the database\n\tquery := influxDBClient.Query{\n\t\tCommand: fmt.Sprintf(\"CREATE DATABASE %s\", c.dataBaseName),\n\t}\n\tanswer, err := c.influxClient.Query(query)\n\t// If the query creation failed\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If the answer failed we print and return the error\n\tif answer.Error() != nil {\n\t\treturn answer.Error()\n\t}\n\n\t// If the query and the answer succed the database is created and we create a BatchPoints\n\tbp, _ := influxDBClient.NewBatchPoints(influxDBClient.BatchPointsConfig{\n\t\tDatabase: c.dataBaseName,\n\t\tPrecision: \"s\",\n\t})\n\tc.influxDBBatchPoints = bp\n\n\tlogger.V(2).Printf(\"Database created: %s\", c.dataBaseName)\n\n\treturn nil\n}", "title": "" }, { "docid": "421d48981f4565634cafd4abab7f8f1b", "score": "0.49081206", "text": "func newConnHdl(spec *ConnectionSpec) (hdl *connHdl) {\n\tloginfo := \"newConnHdl\"\n\n\thdl = new(connHdl)\n\t// REVU - this is silly\n\tif hdl == nil {\n\t\tpanic(fmt.Errorf(\"%s(): failed to allocate connHdl\", loginfo))\n\t}\n\n\tvar mode, addr string\n\tif spec.port == 0 { // REVU - no special values (it was a contrib) TODO add flag to connspec.\n\t\tmode = UNIX\n\t\taddr = spec.host\n\t} else {\n\t\tmode = TCP\n\t\taddr = fmt.Sprintf(\"%s:%d\", spec.host, spec.port)\n\t\t_, e := net.ResolveTCPAddr(TCP, addr)\n\t\tif e != nil {\n\t\t\tpanic(fmt.Errorf(\"%s(): failed to resolve remote address %s\", loginfo, addr))\n\t\t}\n\t}\n\n\tconn, e := net.Dial(mode, addr)\n\tswitch {\n\tcase e != nil:\n\t\tpanic(fmt.Errorf(\"%s(): could not open connection\", loginfo))\n\tcase conn == nil:\n\t\tpanic(fmt.Errorf(\"%s(): net.Dial returned nil, nil (?)\", loginfo))\n\tdefault:\n\t\tconfigureConn(conn, spec)\n\t\thdl.spec = spec\n\t\thdl.conn = conn\n\t\thdl.connected = true\n\t\tbufsize := 4096\n\t\thdl.reader = bufio.NewReaderSize(conn, bufsize)\n\t}\n\treturn\n}", "title": "" }, { "docid": "0d7d2d9936be89205c1f5d8cc9d2e6fe", "score": "0.49067134", "text": "func (c *EvtClient) Connect() (err error) {\n\t//timeout, _ := context.WithTimeout(context.Background(), 5*time.Second)\n\t//_, err = c.client.Connect(timeout, opcode.EventReadyResumed)\n\t_, err = c.client.Connect(opcode.NoOPCode)\n\treturn\n}", "title": "" }, { "docid": "0657c7077722f58b2eccdf63ab8a0532", "score": "0.4904433", "text": "func (n *node) ConnectTo(p *node) error {\n\tif n.id != p.id && n.conn[p.id] != nil {\n\t\t// already connected\n\t\treturn nil\n\t}\n\n\tvar (\n\t\taesSecret = make([]byte, 16)\n\t\tmacSecret = make([]byte, 16)\n\t\tegressMACinit = make([]byte, 32)\n\t\tingressMACinit = make([]byte, 32)\n\t)\n\tfor _, s := range [][]byte{aesSecret, macSecret, egressMACinit, ingressMACinit} {\n\t\trand.Read(s)\n\t}\n\tfd0, fd1, err := pipes.TCPPipe()\n\tif err != nil {\n\t\tfmt.Println(\"fail to init tcp pipe\")\n\t\treturn err\n\t}\n\n\t//fd0.SetReadDeadline(time.Now().Add(time.Second * 200))\n\t//fd1.SetWriteDeadline(time.Now().Add(time.Second * 200))\n\n\ts1 := secrets{\n\t\tAES: aesSecret,\n\t\tMAC: macSecret,\n\t\tEgressMAC: sha3.NewKeccak256(),\n\t\tIngressMAC: sha3.NewKeccak256(),\n\t}\n\ts1.EgressMAC.Write(egressMACinit)\n\ts1.IngressMAC.Write(ingressMACinit)\n\tn.conn[p.id] = &connection{\n\t\trw: newRLPXFrameRW(fd0, s1),\n\t\tfd: fd0,\n\t\tclose: make(chan bool),\n\t\tpeer: p,\n\t}\n\n\ts2 := secrets{\n\t\tAES: aesSecret,\n\t\tMAC: macSecret,\n\t\tEgressMAC: sha3.NewKeccak256(),\n\t\tIngressMAC: sha3.NewKeccak256(),\n\t}\n\ts2.EgressMAC.Write(ingressMACinit)\n\ts2.IngressMAC.Write(egressMACinit)\n\n\tif n.id != p.id {\n\t\tp.conn[n.id] = &connection{\n\t\t\trw: newRLPXFrameRW(fd1, s2),\n\t\t\tfd: fd1,\n\t\t\tclose: make(chan bool),\n\t\t\tpeer: n,\n\t\t}\n\t} else {\n\t\t// connect to itself\n\t\tp.conn[n.id+\"0\"] = &connection{\n\t\t\trw: newRLPXFrameRW(fd1, s2),\n\t\t\tfd: fd1,\n\t\t\tclose: make(chan bool),\n\t\t\tpeer: n,\n\t\t}\n\t}\n\n\treadLoop := func(id string, conn *connection, node *node) {\n\t\tfor {\n\t\t\tmsg, err := conn.rw.ReadMsg()\n\t\t\tif err != nil {\n\t\t\t\tnetErr, ok := err.(net.Error)\n\t\t\t\tif ok && netErr.Timeout() {\n\t\t\t\t\tlog.Debug(\"Node tcp read timeout\", \"id\", id)\n\t\t\t\t} else {\n\t\t\t\t\tlog.Debug(\"Node got tcp error\", \"id\", id, \"error\", err)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif node.feedMsg {\n\t\t\t\tnode.feed.Send(msg)\n\t\t\t}\n\t\t}\n\n\t\tconn.close <- true\n\t}\n\n\tgo readLoop(n.id, n.conn[p.id], n)\n\tif n.id != p.id {\n\t\tgo readLoop(p.id, p.conn[n.id], p)\n\t} else {\n\t\tgo readLoop(p.id, p.conn[n.id+\"0\"], p)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5bd578f7c6bb28269a33fb22726a36b0", "score": "0.49006462", "text": "func NewConnection(w rest.ResponseWriter, r *rest.Request) {\n\tws, err := upgrader.Upgrade(w.(http.ResponseWriter), r.Request, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer ws.Close()\n\n\twsClients[ws] = true\n\tfor {\n\t\tvar msg model.Subscription\n\t\terr := ws.ReadJSON(&msg)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\tdelete(wsClients, ws)\n\t\t\tdelete(clientSubscriptions, ws)\n\t\t\tbreak\n\t\t}\n\t\tclientSubscriptions[ws] = msg.Addresses\n\t\tupdateClient(ws)\n\t}\n}", "title": "" }, { "docid": "75a5cd96a9c6b6eb2bead954a7741c80", "score": "0.48965126", "text": "func (h *Handler) Connect(device *iot.Device, authInfo *iot.AuthInfo) error {\n\treturn nil\n}", "title": "" }, { "docid": "1d1307d7b8c4193fbf4184f8cc1bbe0f", "score": "0.48907956", "text": "func mqttStart(suppliedString string) {\n connectString := suppliedString\n if strings.Contains(suppliedString, \"@\") {\n // looks like authentication is required for this server\n userpwhost := strings.TrimPrefix(suppliedString, \"tcp://\")\n userpw, host, found := strings.Cut(userpwhost, \"@\")\n if !found {\n fmt.Println(\"Whoops, there is an issue with your MQTT-connectString:\")\n fmt.Println(\"suppliedString: \", suppliedString)\n fmt.Println(\"userpwhost: \", userpwhost)\n }\n user, pw, found = strings.Cut(userpw, \":\")\n if !found {\n fmt.Println(\"Whoops, there is an issue with your MQTT-connectString:\")\n fmt.Println(\"suppliedString: \", suppliedString)\n fmt.Println(\"userpwhost: \", userpwhost)\n }\n connectString = \"tcp://\" + host\n }\n\tclientsettings := MQTT.NewClientOptions().AddBroker(connectString)\n\tclientsettings.SetClientID(\"CAN2MQTT\")\n\tclientsettings.SetDefaultPublishHandler(handleMQTT)\n if strings.Contains(suppliedString, \"@\") {\n clientsettings.SetCredentialsProvider(userPwCredProv)\n }\n\tclient = MQTT.NewClient(clientsettings)\n\tif dbg {\n\t\tfmt.Printf(\"mqtthandler: starting connection to: %s\\n\", connectString)\n\t}\n\tif token := client.Connect(); token.Wait() && token.Error() != nil {\n\t\tfmt.Println(\"mqtthandler: Oh no an error occured...\")\n\t\tpanic(token.Error())\n\t}\n\tif dbg {\n\t\tfmt.Printf(\"mqtthandler: connection established!\\n\")\n\t}\n}", "title": "" }, { "docid": "b7205bd77f98a99f3017e311b33a5c6c", "score": "0.48836097", "text": "func connect() (conn net.Conn, err error) {\n\tlogger(\"Connecting to Server: \", *server)\n\n\tconn, err = net.Dial(\"tcp\", *server)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tresp, err := read(conn)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tlogger(\"Connected to Server Version: \", resp)\n\n\treturn\n}", "title": "" }, { "docid": "580272718494659fa3f988a235f1d6af", "score": "0.48787126", "text": "func (x *GoSNMP) Connect() error {\n\tConn, err := net.DialTimeout(\"udp\", fmt.Sprintf(\"%s:%d\", x.Target, x.Port), x.Timeout)\n\tif err == nil {\n\t\tx.Conn = Conn\n\t\tx.requestID = getRandomRequestID()\n\t} else {\n\t\treturn fmt.Errorf(\"Error establishing connection to host: %s\\n\", err.Error())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "858b20cc9872182a21789bbb50f2f977", "score": "0.48769015", "text": "func (c *ClientClass) Dial() (chan Message, error) {\n\tconn, err := net.Dial(c.network, c.address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprint(\"Create new connection from client\")\n\tconnection, err := NewConnection(&conn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.conn = connection\n\n\treturn connection.Reads, nil\n}", "title": "" }, { "docid": "892356ccf9f3621d52506788ceef6a1e", "score": "0.48742524", "text": "func New(opts ...Option) Initial {\n\ts := &impl{\n\t\tstate: stateConnecting,\n\t\tquit: make(chan struct{}),\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(s)\n\t}\n\n\ts.txAvailable = make(chan int, 1)\n\ts.txTopicAlias = make(map[string]uint16)\n\ts.rxTopicAlias = make(map[uint16]string)\n\ts.txTimer = time.NewTimer(1 * time.Second)\n\ts.txTimer.Stop()\n\n\ts.started.Add(1)\n\ts.pubIn.onRelease = s.onReleaseIn\n\ts.pubOut.onRelease = s.onReleaseOut\n\n\ts.log = configuration.GetLogger().Named(\"connection\")\n\n\treturn s\n}", "title": "" }, { "docid": "18fad406ee233a77618d95ac9e936f4c", "score": "0.48732245", "text": "func (c *Conn) Connect() {\n\tservice:=flag.Lookup(\"service\").Value.(flag.Getter).Get().(string)\n\n\ttcpAddr, err := net.ResolveTCPAddr(\"tcp4\", flag.Lookup(\"service\").Value.(flag.Getter).Get().(string))\n\tif err != nil {\n\t\tpanic(err)\n\n\t}\n\tusetls:=flag.Lookup(\"tls\").Value.(flag.Getter).Get().(bool)\n\n\tc.conn, err = resolveConn(usetls, service, *tcpAddr)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tpanic(err)\n\t}\n\t_, err = c.conn.Write(header)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "870b9dc66a503b2ea635c108ece945c4", "score": "0.48687547", "text": "func (client *Client) Connect(addr string, onRevMsg CallBack) error {\n\tclient.connStr = addr\n\tclient.onRevMsg = onRevMsg\n\tclient.conn, client.lastErr = net.Dial(\"tcp\", client.connStr)\n\tif client.lastErr != nil {\n\t\tclient.conn = nil\n\t\treturn client.lastErr\n\t} else {\n\t\tgo client.readConn()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bfbb55ce3d28310505c328a870a48069", "score": "0.48611698", "text": "func (ch *Channel) newConnection(conn net.Conn, outboundHP string, initialState connectionState, events connectionEvents) *Connection {\n\topts := &ch.connectionOptions\n\n\tchecksumType := opts.ChecksumType\n\tif checksumType == ChecksumTypeNone {\n\t\tchecksumType = ChecksumTypeCrc32C\n\t}\n\n\tsendBufferSize := opts.SendBufferSize\n\tif sendBufferSize <= 0 {\n\t\tsendBufferSize = 512\n\t}\n\n\trecvBufferSize := opts.RecvBufferSize\n\tif recvBufferSize <= 0 {\n\t\trecvBufferSize = 512\n\t}\n\n\tframePool := opts.FramePool\n\tif framePool == nil {\n\t\tframePool = DefaultFramePool\n\t}\n\n\tconnID := nextConnID.Inc()\n\tlog := ch.log.WithFields(LogFields{\n\t\t{\"connID\", connID},\n\t\t{\"localAddr\", conn.LocalAddr()},\n\t\t{\"remoteAddr\", conn.RemoteAddr()},\n\t}...)\n\tpeerInfo := ch.PeerInfo()\n\tlog.Debugf(\"created for %v (%v) local: %v remote: %v\",\n\t\tpeerInfo.ServiceName, peerInfo.ProcessName, conn.LocalAddr(), conn.RemoteAddr())\n\tc := &Connection{\n\t\tchannelConnectionCommon: ch.channelConnectionCommon,\n\n\t\tconnID: connID,\n\t\tconn: conn,\n\t\tframePool: framePool,\n\t\tstate: initialState,\n\t\tsendCh: make(chan *Frame, sendBufferSize),\n\t\tstopCh: make(chan struct{}),\n\t\tlocalPeerInfo: peerInfo,\n\t\tcheckedProcessPrefixes: opts.CheckedProcessPrefixes,\n\t\toutboundHP: outboundHP,\n\t\tchecksumType: checksumType,\n\t\tinbound: newMessageExchangeSet(log, messageExchangeSetInbound),\n\t\toutbound: newMessageExchangeSet(log, messageExchangeSetOutbound),\n\t\thandler: channelHandler{ch},\n\t\tevents: events,\n\t\tcommonStatsTags: ch.commonStatsTags,\n\t}\n\tc.log = log\n\tc.inbound.onRemoved = c.checkExchanges\n\tc.outbound.onRemoved = c.checkExchanges\n\tc.inbound.onAdded = c.onExchangeAdded\n\tc.outbound.onAdded = c.onExchangeAdded\n\n\tif ch.relayHosts != nil {\n\t\tc.relay = NewRelayer(ch, c)\n\t}\n\n\tgo c.readFrames(connID)\n\tgo c.writeFrames(connID)\n\treturn c\n}", "title": "" }, { "docid": "97782f934bc3b17d706e0415199b15e9", "score": "0.4857815", "text": "func (transport *MattermostTransport) connect() {\n\t// Create the client.\n\ttransport.client = model.NewAPIv4Client(transport.server)\n\n\t// Check server connection\n\tif props, response := transport.client.GetOldClientConfig(\"\"); response.Error != nil {\n\t\ttransport.log.Fatalf(\"Couldn't connect to Mattermost at %s.\", transport.server)\n\t} else {\n\t\ttransport.log.Infof(\"Connected to %s, running version %s.\", transport.server, props[\"Version\"])\n\t}\n\n\t// Login.\n\tif user, response := transport.client.Login(transport.user, transport.password); response.Error != nil {\n\t\ttransport.log.Fatalf(\"Login failed as %s.\", transport.user)\n\t} else {\n\t\ttransport.mmUser = user\n\t\ttransport.log.Infof(\"Logged in as %s (%s).\", user.Username, user.Id)\n\t}\n\ttransport.sendEvent(events.EventConnected, \"\", true, \"\", transport.botName, transport.mmUser.Id, \"\")\n}", "title": "" }, { "docid": "dd0912357678eab4421af2db555a6721", "score": "0.48488536", "text": "func newClient(room *Room, conn net.Conn, name string) *client {\n\tc := client{\n\t\tname: name,\n\t\troom: room,\n\t\treader: bufio.NewReader(conn),\n\t\twriter: bufio.NewWriter(conn),\n\t\tconn: conn,\n\t}\n\n\tc.wg.Add(1)\n\tgo c.read()\n\n\treturn &c\n}", "title": "" }, { "docid": "973ad797377420b800d3c386954209e0", "score": "0.4846142", "text": "func (c *ServerConn) openDataConn() (net.Conn, error) {\n\tport, err := c.pasv()\n\t// port, err = c.pasv()\n\t// port, err = c.pasv()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Build the new net address string\n\taddr := fmt.Sprintf(\"%s:%d\", c.host, port)\n\t// conn, err := net.DialTimeout(\"tcp\", addr, time.Duration(2400)*time.Second)\n\tconn, err := net.Dial(\"tcp\", addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn conn, nil\n}", "title": "" }, { "docid": "a890f57277c9ec5383f2ce4365fa448b", "score": "0.48449594", "text": "func StartMonitoring(ctx context.Context, device structs.Device, v *kramer.Via) *kramer.PersistentViaConnection {\n\tv.Debugf(\"Building Connection and starting read buffer for %s\\n\", device.Address)\n\tv.Address = device.Address\n\tpconn, err := v.PersistConnection(ctx)\n\tfor err != nil {\n\t\tv.Errorf(\"Retry Failed, Trying again in 10 seconds\")\n\t\tv.Errorf(\"Error: %v\", err)\n\t\ttime.Sleep(reconnInterval)\n\t\tpconn, err = v.PersistConnection(ctx)\n\t}\n\n\t// start event node\n\t_ = messenger()\n\n\troomID := fmt.Sprintf(\"%s-%s\", buildingID, room)\n\n\t// build base event to send along with each event\n\tevent := events.Event{\n\t\tGeneratingSystem: pihost,\n\t\tAffectedRoom: events.GenerateBasicRoomInfo(roomID),\n\t\tTargetDevice: events.GenerateBasicDeviceInfo(device.ID),\n\t\tUser: hostname,\n\t}\n\n\tevent.AddToTags(events.DetailState, events.AutoGenerated, events.Via)\n\n\tgo readPump(ctx, device, pconn, event, v)\n\tgo writePump(ctx, device, pconn, v)\n\treturn pconn\n}", "title": "" }, { "docid": "14a2e4d0718997f957bdff6926af6325", "score": "0.4841293", "text": "func handleConn(conn net.Conn) {\n\tdefer conn.Close()\n\tvar udpConn = conn.(*kcp.UDPSession)\n\tudpConn.SetWindowSize(128, 128)\n\tudpConn.SetNoDelay(1, 10, 2, 1)\n\tudpConn.SetStreamMode(true)\n\tfmt.Println(\"client connect\", udpConn.RemoteAddr(), conn.RemoteAddr())\n\n\tvar buffer = make([]byte, 1024)\n\tfor {\n\t\t//conn.SetReadDeadline(time.Now().Add(30 * time.Second))\n\t\tbytesRead, err := udpConn.Read(buffer)\n\t\tif err != nil {\n\t\t\t//log.Printf(\"Read: %v\", err, udpConn.RemoteAddr())\n\t\t\tbreak\n\t\t}\n\n\t\t//\n\t\tvar e Event\n\t\terr2 := json.Unmarshal(buffer[:bytesRead], &e)\n\t\tif err2 != nil {\n\t\t\tlog.Fatal(err2)\n\t\t}\n\n\t\tswitch e.EventName {\n\t\tcase \"registerUser\":\n\t\t\tti, valid := checkToken(e.TokenData)\n\t\t\tif valid {\n\n\t\t\t\tNewUser().setOnline(ti.UserInfo, udpConn)\n\n\t\t\t} else {\n\t\t\t\tif _, err := udpConn.Write([]byte(\"Token is not valid\")); err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"broadcast\":\n\t\t\t// get data form json\n\t\t\tjsonData := []byte(buffer[:bytesRead])\n\t\t\tmatch.Broadcast(jsonData)\n\t\tcase \"saveMatchData\":\n\t\t\t_, valid := checkToken(e.TokenData)\n\t\t\tif valid {\n\t\t\t\tmatch.SaveMatchData(e.Data.(string))\n\t\t\t} else {\n\t\t\t\tif _, err := udpConn.Write([]byte(\"Token is not valid\")); err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"matchState\":\n\t\t\t_, valid := checkToken(e.TokenData)\n\t\t\tif valid {\n\t\t\t\tmatchState.watchMatchState(e.Data.(string))\n\t\t\t} else {\n\t\t\t\tif _, err := udpConn.Write([]byte(\"Token is not valid\")); err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\tlog.Fatal(\"cant find any event name\")\n\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "436080b20475bf24aaf65f5a5d81dd4f", "score": "0.48410466", "text": "func NewConnected() *Connected {\n\t// Service setup\n\tinner := service.NewService()\n\tconnected := Connected{Service: inner}\n\tconnected.Caller = &connected\n\tconnected.Hostname, _ = os.Hostname()\n\tconnected.OldDeviceList = make(map[string]bool)\n\treturn &connected\n}", "title": "" }, { "docid": "5c67bbe3a3920465f54b9bcdf744adb3", "score": "0.48400158", "text": "func initialiseConnection() (*TestConnection, *Client, *config.Config) {\n conf := config.NewConfig()\n conf.UseTLS = false\n\n testConn := NewTestConnection()\n testConn.ToRead = append(testConn.ToRead, \"+OK\\r\\n\")\n\n toTest := NewClient(*conf)\n toTest.Dialer = func(net string, server string) (net.Conn, error) {\n return testConn, nil\n }\n \n toTest.Connect()\n testConn.TimesReadCalled = 0\n \n return testConn, toTest, conf\n}", "title": "" }, { "docid": "c4063a9ce9d172a74a9cf8e197d44064", "score": "0.48383528", "text": "func start(dev *globals.OPCUADev) {\n\tvar protocolConfig configmap.ProtocolConfigOPCUA\n\tif err := json.Unmarshal([]byte(dev.Instance.PProtocol.ProtocolConfigs), &protocolConfig); err != nil {\n\t\tklog.Error(err)\n\t\treturn\n\t}\n\n\tvar protocolCommConfig configmap.ProtocolCommonConfigOPCUA\n\tif err := json.Unmarshal([]byte(dev.Instance.PProtocol.ProtocolCommonConfig), &protocolCommConfig); err != nil {\n\t\tklog.Error(err)\n\t\treturn\n\t}\n\n\tklog.V(4).Info(\"Protocolconfig: \", protocolConfig, protocolCommConfig)\n\tclient, err := initOPCUA(protocolConfig, protocolCommConfig)\n\tif err != nil {\n\t\tklog.Error(err)\n\t\treturn\n\t}\n\tdev.OPCUAClient = client\n\n\tinitTwin(dev)\n\tinitData(dev)\n\n\tif err := initSubscribeMqtt(dev.Instance.ID); err != nil {\n\t\tklog.Error(err)\n\t\treturn\n\t}\n\n\tinitGetStatus(dev)\n}", "title": "" }, { "docid": "e256564dd2fd6d9a34a0fed5a14612c5", "score": "0.48349237", "text": "func (sb *Service) NewConn(seed []byte) Connection {\n\treturn stratImpl[sb.Strat](sb, seed)\n}", "title": "" }, { "docid": "7073b3bc45f06d77588f52907313da82", "score": "0.48320156", "text": "func newClient() (*client, error) {\n\tc, err := genetlink.Dial(nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn initClient(c)\n}", "title": "" }, { "docid": "9af0b37a30d8d34b8802dac1050a4cfb", "score": "0.48312554", "text": "func newConn(c conn) *Conn {\n\tgc := &Conn{\n\t\tc: c,\n\t}\n\n\tgc.Family = &FamilyService{c: gc}\n\n\treturn gc\n}", "title": "" }, { "docid": "4491be8116b5e8b277740b6ad19409a9", "score": "0.48284373", "text": "func Connect(ctx context.Context, addr string, timeout time.Duration) (*Device, error) {\n\tvar device *Device\n\tif err := testing.Poll(ctx, func(ctx context.Context) error {\n\t\tif err := Command(ctx, \"connect\", addr).Run(testexec.DumpLogOnError); err != nil {\n\t\t\treturn testing.PollBreak(errors.Wrap(err, \"failed to run adb connect\"))\n\t\t}\n\t\tdevices, err := Devices(ctx)\n\t\tif err != nil {\n\t\t\treturn testing.PollBreak(errors.Wrap(err, \"failed to get the devices\"))\n\t\t}\n\t\tfor _, d := range devices {\n\t\t\tif d.Serial == addr {\n\t\t\t\tdevice = d\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\treturn errors.New(\"device not connected yet\")\n\t}, &testing.PollOptions{Interval: time.Second, Timeout: timeout}); err != nil {\n\t\treturn nil, err\n\t}\n\treturn device, nil\n}", "title": "" }, { "docid": "a9445a110bb77daa1a01dc8947b82081", "score": "0.48281017", "text": "func NewConn() (*Conn, error) {\n\tconn, err := dbus.SystemBusPrivate()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to init private conn to system bus: %v\", err)\n\t}\n\tmethods := []dbus.Auth{dbus.AuthExternal(strconv.Itoa(os.Getuid()))}\n\terr = conn.Auth(methods)\n\tif err != nil {\n\t\tconn.Close()\n\t\treturn nil, fmt.Errorf(\"failed to auth with external method: %v\", err)\n\t}\n\terr = conn.Hello()\n\tif err != nil {\n\t\tconn.Close()\n\t\treturn nil, fmt.Errorf(\"failed to make hello call: %v\", err)\n\t}\n\treturn &Conn{\n\t\tconn: conn,\n\t\tobj: conn.Object(dbusDest, dbus.ObjectPath(dbusPath)),\n\t}, nil\n}", "title": "" }, { "docid": "925aacfdaf56cbd54f0f44979cf707e3", "score": "0.48280045", "text": "func (host *Host) createConnection(peerID string, pi *PeerInfo) error {\n\tcstr := fmt.Sprintf(\"%s:%d\", pi.IP, pi.Port)\n\taddr, err := net.ResolveTCPAddr(\"tcp\", cstr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tconn, err := net.DialTCP(\"tcp\", nil, addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Create peer, place in mapping\n\tpeer := &Peer{PeerID: peerID, socket: conn, trustline: &Trustline{0, 0}, data: make(chan []byte), pending: true}\n\thost.register <- peer\n\tgo host.receive(peer)\n\tgo host.send(peer)\n\treturn nil\n}", "title": "" }, { "docid": "6959ea3bd4db5e2654e19d173869f838", "score": "0.48260182", "text": "func rawConnectSingle(host string) {\n\t// Dialing connection to host:port\n\tconn, _ := net.DialTimeout(\"tcp\", host, time.Second)\n\t// Print if connection can be opened\n\tif conn != nil {\n\t\tdefer conn.Close()\n\t\tfmt.Println(\"Open\", host)\n\t}\n}", "title": "" }, { "docid": "031570b813064d28637f542b3f48c0a1", "score": "0.48158517", "text": "func onConnectAngel() {\n\tfmt.Println(\"Connected\")\n\terr := socketClient.Subscribe()\n\tif err != nil {\n\t\tfmt.Println(\"err: \", err)\n\t}\n}", "title": "" }, { "docid": "db45bb9a85306a5c89bf423b7b2bf28d", "score": "0.48154882", "text": "func newDevice(name string, role int, io ioHandle) *device {\n\td := device{role: role, io: io, txChan: make(chan gopacket.Packet, 10),\n\t\trxChannels: make(map[uint64]chan gopacket.Packet)}\n\td.init()\n\treturn &d\n}", "title": "" }, { "docid": "217cb622e28b05f1b2c7be9fd31cc855", "score": "0.48120984", "text": "func newTxService(channelID string) (*TxServiceImpl, errors.Error) {\n\t// we need to use once here to initialize metrics because newTxService is called from multiple snaps\n\tonce.Do(func() { metrics = txnSnapClient.NewMetrics(metricsutil.GetMetricsInstance()) })\n\tclient, err := txnSnapClient.GetInstance(channelID, metrics)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(errors.TxClientInitError, err, \"Cannot initialize client\")\n\t}\n\treturn &TxServiceImpl{\n\t\tFcClient: client,\n\t}, nil\n}", "title": "" }, { "docid": "7b60207306eaef1f17ee53f393345680", "score": "0.48117873", "text": "func (c *Client) initActiveDataConn() (*activeDataConn, error) {\n\t// open data connection\n\tconn, addr, err := newActiveDataConn()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// get port number of listener\n\t_, port, err := net.SplitHostPort(addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// get local address of client\n\thost, _, err := net.SplitHostPort(c.localAddr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// issue port command\n\tif err := c.issuePortCommand(host, port); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn conn, nil\n}", "title": "" }, { "docid": "d3424cfb5e2e21a1f5b75282bda02ebb", "score": "0.4811706", "text": "func (o *APManger) ServerNewConnection(con net.Conn, expireTimeout time.Duration, key string) {\n\tdefer con.Close()\n\told := o.removeConnection(key)\n\tif old != nil {\n\t\told.Close()\n\t}\n\tlog.Println(\"add RouteConnection:\", con.RemoteAddr().String())\n\trc := newAPConnection(con, expireTimeout)\n\to.addConnection(key, rc)\n\trc.readLoop()\n\tlog.Println(\"remove RouteConnection:\", con.RemoteAddr().String(), \" alive time:\", int64(time.Now().Sub(rc.birthTime)/time.Second))\n\to.removeConnection(key)\n\trc.Close()\n}", "title": "" }, { "docid": "dc0ceaa9eaf689b233666273d20c4294", "score": "0.48067933", "text": "func (sc *SimpleClient) Connect() session.Session {\n\tsessionID := id.Create()\n\tprocessID := id.Create()\n\tsession := session.NewSession(sessionID, sc.id, processID)\n\tsc.sessions[processID] = session\n\tsc.startSession(processID)\n\tsc.log.\n\t\tDebug().\n\t\tStr(processID.String(), \"connected\").\n\t\tMsg(\"session created\")\n\treturn session\n}", "title": "" }, { "docid": "0117ab445cba6d0d808338069e680825", "score": "0.4804966", "text": "func (c *Client) Connect() error {\n\t// connect over TCP\n\tb := fmt.Sprintf(\"%s:%s\", c.Config.server, c.Config.port)\n\tconn, err := net.Dial(\"tcp\", b)\n\tif err != nil {\n\t\tlog.Error().Err(err).\n\t\t\tStr(\"source\", \"goqtt\").\n\t\t\tStr(\"broker\", b).\n\t\t\tMsg(\"could not connect to server\")\n\t\treturn fmt.Errorf(\"could not connect to server: %v\", err)\n\t}\n\tc.conn = conn\n\n\t// create Connect packet\n\tvar cp packets.ConnectPacket\n\tcp.CreatePacket()\n\tcp.KeepAlive = []byte{0, byte(c.Config.keepAlive)}\n\tcp.ClientIdentifier = c.Config.clientId\n\n\t// send packet\n\terr = c.sendPacket(&cp)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not write Connect packet: %v\", err)\n\t}\n\n\t// read response and verify it's a CONNACK packet\n\tr, err := c.readResponse()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not read response for %s: %v\", cp.Name(), err)\n\t}\n\tif _, ok := r.(*packets.ConnackPacket); !ok {\n\t\ttypeErrorResponseLogger(cp.Name(), r.Name(), r)\n\t\treturn fmt.Errorf(\"did not receive a CONNACK packet, got %s instead\", r.Name())\n\t}\n\n\t// start a keepAlive process which will send Ping packets to prevent a disconnect\n\t// TODO I don't think this should be called in here - should be a background thing for a Client\n\tgo c.keepAlivePing()\n\treturn nil\n}", "title": "" }, { "docid": "706b6bc93eff8f69e9f0a9f5e40e5016", "score": "0.4804764", "text": "func newIPCConnection(ctx context.Context, endpoint string) (net.Conn, error) {\n\treturn nil, errNotSupported\n}", "title": "" }, { "docid": "d1feb4969e8648e4c07fefcb4c4062d3", "score": "0.47979224", "text": "func (c *SwimringClient) Connect() error {\n\tvar err error\n\tc.client, err = rpc.Dial(\"tcp\", fmt.Sprintf(\"%s:%d\", c.address, c.port))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "707347495bc944fa8b633622fb72c7a9", "score": "0.47836682", "text": "func Connect(host, port string, key []byte) (*Omni, error) {\n\tvar omni Omni\n\tomni.key = key\n\tomni.buf = make([]byte, 512)\n\n\taddress, err := net.ResolveTCPAddr(\"tcp\", net.JoinHostPort(host, port))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tomni.address = address\n\n\t// Connect to the Omni controller\n\tc, err := net.DialTCP(\"tcp\", nil, omni.address)\n\tif err != nil {\n\t\tif c != nil {\n\t\t\tc.Close()\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tomni.c = c\n\tomni.c.SetKeepAlivePeriod(time.Duration(30) * time.Second)\n\tomni.c.SetKeepAlive(true)\n\n\terr = omni.negotiateNewSession()\n\tif err != nil {\n\t\tomni.c.Close()\n\t\treturn nil, err\n\t}\n\n\treturn &omni, nil\n}", "title": "" }, { "docid": "6c4192a50eb33b60cc6c95eca8e0e435", "score": "0.47751626", "text": "func newConnection(packetChan chan<- *Packet, waitGroup *sync.WaitGroup, ifi *net.Interface, port int, pType packetType) (*connection, error) {\n\n\tvar (\n\t\tconn *net.UDPConn\n\t\terr error\n\t)\n\n\t// Use the appropriate initializer.\n\tswitch pType {\n\tcase multicast:\n\t\tconn, err = multicastConnection(ifi, port)\n\tcase broadcast:\n\t\tconn, err = broadcastConnection(ifi, port)\n\t}\n\n\t// Check for an error.\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create the connection.\n\tc := &connection{\n\t\tstopChan: make(chan interface{}),\n\t\tconn: conn,\n\t}\n\n\t// Spawn a goroutine to read from the socket.\n\tgo c.run(packetChan, waitGroup)\n\n\treturn c, nil\n}", "title": "" }, { "docid": "86d847090497a25939f475d4d3600581", "score": "0.4773827", "text": "func (b *broker) connect() error {\n\tb.mutex.Lock()\n\tdefer b.mutex.Unlock()\n\n\tif b.stanConn == nil {\n\t\tvar err error\n\t\tb.stanConn, err = stan.Connect(b.config.ClusterID, b.config.ClientID, b.stanOptions...)\n\t\tif err != nil {\n\t\t\treturn logger.Wrapf(err,\n\t\t\t\t\"Failed to connect to NATS server=\\\"%s\\\", cluster=\\\"%s\\\" as client=\\\"%s\\\"\",\n\t\t\t\tb.config.URL, b.config.ClusterID, b.config.ClientID)\n\t\t}\n\t\tlog.Infof(\"Connected to NATS server \\\"%s\\\" cluster \\\"%s\\\" as client \\\"%s\\\"\",\n\t\t\tb.config.URL, b.config.ClusterID, b.config.ClientID)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2ee330aaf8e8b834311d07a1358448a9", "score": "0.4772002", "text": "func (c *Client) Connet() error {\n\tc.conn = MQTT.NewClient(c.opts)\n\tif token := c.conn.Connect(); token.Wait() && token.Error() != nil {\n\t\treturn token.Error()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9e5e76ac3605c58c5d86fd48150e3d8d", "score": "0.47647122", "text": "func newConn() *Conn {\n\tc := &Conn{\n\t\tsendLogLimit: rate.NewLimiter(rate.Every(1*time.Minute), 1),\n\t\taddrsByUDP: make(map[netaddr.IPPort]*AddrSet),\n\t\taddrsByKey: make(map[key.Public]*AddrSet),\n\t\tderpRecvCh: make(chan derpReadResult),\n\t\tudpRecvCh: make(chan udpReadResult),\n\t\tderpStarted: make(chan struct{}),\n\t\tpeerLastDerp: make(map[key.Public]int),\n\t}\n\tc.endpointsUpdateWaiter = sync.NewCond(&c.mu)\n\treturn c\n}", "title": "" }, { "docid": "c2ed38e81be78a954290b642cb1c6fd3", "score": "0.47642004", "text": "func NewConnection(t tLogger, port int) *nats.Conn {\n\turl := fmt.Sprintf(\"nats://127.0.0.1:%d\", port)\n\tnc, err := nats.Connect(url)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to create default connection: %v\\n\", err)\n\t\treturn nil\n\t}\n\treturn nc\n}", "title": "" }, { "docid": "dd7398cd34a9f80654356c3cc9f8add0", "score": "0.47636446", "text": "func (c *mqttclient) ReadPacket() (packets.ControlPacket, error) {\n\t// check for data first...\n\tif net.ActiveDevice.IsSocketDataAvailable() {\n\t\treturn packets.ReadPacket(c.conn)\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "6617335d0d573c25fcf5742b1d7ec279", "score": "0.47623336", "text": "func Connect(addr string) (*ServerConn, error) {\n\tif strings.Contains(addr, \":\") == false {\n\t\taddr = addr + \":21\"\n\t}\n\tconn, err := textproto.Dial(\"tcp\", addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ta := strings.SplitN(addr, \":\", 2)\n\tc := &ServerConn{conn, a[0]}\n\n\t// _, _, err = c.conn.ReadCodeLine(StatusReady)\n\t_, _, err = MyReadCodeLine(c.conn, StatusReady)\n\tif err != nil {\n\t\tc.Quit()\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "885feb0f6d5d99670ecaa04031109c22", "score": "0.47569513", "text": "func OpenConnection() (err error) {\n\tvar dB *sql.DB // I am read only but cheap. Please use me when possible.\n\tvar dBWrite *sql.DB // I am read-write, but expensive. Please only use me for writing.\n\n\t// Open the main database connection (read)\n\terr = openDatabaseConnection(\n\t\tconfig.DatabaseRead.Host+\":\"+config.DatabaseRead.Port,\n\t\tconfig.DatabaseRead.Name,\n\t\tconfig.DatabaseRead.User,\n\t\tconfig.DatabaseRead.Password,\n\t\t&dB,\n\t\tconfig.DatabaseRead.Driver,\n\t\tconfig.DatabaseRead.MaxOpenConnections,\n\t\tconfig.DatabaseRead.MaxIdleConnections,\n\t\tconfig.DatabaseRead.MaxConnectionTime,\n\t)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Open a write connection if found and different from the read\n\tif len(config.DatabaseWrite.Host) == 0 || (config.DatabaseWrite.Host+\":\"+config.DatabaseWrite.Port) == (config.DatabaseRead.Host+\":\"+config.DatabaseRead.Port) {\n\t\tdBWrite = dB\n\t} else {\n\t\terr = openDatabaseConnection(\n\t\t\tconfig.DatabaseWrite.Host+\":\"+config.DatabaseWrite.Port,\n\t\t\tconfig.DatabaseWrite.Name,\n\t\t\tconfig.DatabaseWrite.User,\n\t\t\tconfig.DatabaseWrite.Password,\n\t\t\t&dBWrite,\n\t\t\tconfig.DatabaseWrite.Driver,\n\t\t\tconfig.DatabaseWrite.MaxOpenConnections,\n\t\t\tconfig.DatabaseWrite.MaxIdleConnections,\n\t\t\tconfig.DatabaseWrite.MaxConnectionTime,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Set the new connections\n\tReadDatabase = NewAPIDatabase(dB, dBWrite)\n\tWriteDatabase = NewAPIDatabase(dBWrite, dBWrite)\n\n\treturn\n}", "title": "" }, { "docid": "233d88eb660b89b1661c3cd0151dd7fe", "score": "0.47563913", "text": "func connect(ctx context.Context, target string, logger log.Logger) (firstReplySuccess bool, err error) {\n\tctx, cancel := context.WithTimeout(ctx, 5*time.Second)\n\n\tconn, err := grpc.DialContext(ctx, target, grpc.WithInsecure(), grpc.WithBlock())\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"dial target, err: %w\", err)\n\t}\n\n\tc := gengrpc.NewStreamingServiceClient(conn)\n\n\tstream, err := c.GetRandomDataStream(context.Background(), &gengrpc.Request{})\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"get random data stream, err: %w\", err)\n\t}\n\n\tresp, err := stream.Recv()\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"receive data from stream, err: %w\", err)\n\t}\n\n\terr = ValidateReply(resp.Reply)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"validate reply, err: %w\", err)\n\t}\n\n\t// At this point - consider the connection to be successfully established.\n\n\tgo func() {\n\t\tdefer cancel()\n\n\t\tprocess(stream, logger)\n\n\t\tcloseErr := conn.Close()\n\t\tif closeErr != nil {\n\t\t\t_ = level.Error(logger).Log(\"err\", fmt.Errorf(\"receive data from stream, err: %w\", closeErr))\n\t\t\treturn\n\t\t}\n\t}()\n\n\tconst errReply = \"unexpected err\"\n\n\treturn resp.Reply != errReply, nil\n}", "title": "" }, { "docid": "3db469af01a2ad872399b8db3a1ab6a3", "score": "0.4752661", "text": "func (c *Conn) Open() error {\n\tp, err := serial.OpenPort(&c.device)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.port = p\n\tc.isOpen = true\n\treturn nil\n}", "title": "" } ]
d3936a1dfca7531a2be657cab4a172fa
newDaemonstools returns a Daemonstools
[ { "docid": "e6b6d15b5aae2a118b9ee72f69d2918c", "score": "0.8454878", "text": "func newDaemonstools(c *UalterV1beta1Client, namespace string) *daemonstools {\n\treturn &daemonstools{\n\t\tclient: c.RESTClient(),\n\t\tns: namespace,\n\t}\n}", "title": "" } ]
[ { "docid": "01d48514ae92f233b4d94f53e2ba3b91", "score": "0.6083178", "text": "func (c *daemonstools) Create(ctx context.Context, daemonstool *v1beta1.Daemonstool, opts v1.CreateOptions) (result *v1beta1.Daemonstool, err error) {\n\tresult = &v1beta1.Daemonstool{}\n\terr = c.client.Post().\n\t\tNamespace(c.ns).\n\t\tResource(\"daemonstools\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tBody(daemonstool).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "530f8e3816b7f9170c86416761a49802", "score": "0.6007417", "text": "func newDaemonset(cr *mygroup2v1alpha1.KataSet) *appsv1.DaemonSet {\n labels := map[string]string{\n \"app\": cr.Name,\n }\n //return &corev1.Pod{\n \n return &appsv1.DaemonSet{\n \t\tTypeMeta: metav1.TypeMeta{\n \t\t\tKind: \"DaemonSet\",\n \t\t\tAPIVersion: \"apps/v1\",\n \t\t},\n \t\tObjectMeta: metav1.ObjectMeta{\n \t\t\tName: cr.Name + \"-daemonset\",\n \t\t\tNamespace: cr.Namespace,\n \t\t},\n \tSpec: appsv1.DaemonSetSpec{\n \t\t\tSelector: &metav1.LabelSelector{\n \t\t\tMatchLabels: labels,\n \t\t},\n \t\t\n \t\tTemplate: corev1.PodTemplateSpec{\n \tObjectMeta: metav1.ObjectMeta{\n Name: cr.Name + \"-pod\",\n Namespace: cr.Namespace,\n Labels: labels,\n \t},\n \tSpec: corev1.PodSpec{\n HostPID: true,\n Containers: []corev1.Container{\n {\n Name: \"kata-install\",\n Image: \"sowjarao/kata-install\",\n SecurityContext: &corev1.SecurityContext{\n Privileged: func() *bool { b := true; return &b }(),\n },\n VolumeMounts: []corev1.VolumeMount{{\n Name: \"install-script\",\n MountPath: \"/host\",\n }},\n },\n },\n Volumes: []corev1.Volume{{\n Name: \"install-script\",\n VolumeSource: corev1.VolumeSource{\n HostPath: &corev1.HostPathVolumeSource{\n Path: \"/tmp/install\",\n },\n },\n }},\n \t},\n \t\t},\n \t},\n \t \t}\n}", "title": "" }, { "docid": "9e89af89feafc9daef97436b10a16972", "score": "0.59713644", "text": "func newDaemon(name, description string, kind Kind,\n\tdependencies []string) (Daemon, error) {\n\n\t// newer subsystem must be checked first\n\tif _, err := os.Stat(\"/run/systemd/system\"); err == nil {\n\t\treturn &systemDRecord{name, description, kind, dependencies}, nil\n\t}\n\treturn &systemDRecord{name, description, kind, dependencies}, nil\n}", "title": "" }, { "docid": "7680b4eb6a5d237fe66100b0ba720021", "score": "0.59343773", "text": "func newDaemon(t *testing.T) (*Daemon, func()) {\n\t// Logging\n\tresetLogger := logging.Testing(t)\n\n\t// Test directory\n\tdir, err := ioutil.TempDir(\"\", \"lxd-integration-test\")\n\trequire.NoError(t, err)\n\n\t// Test certificates\n\trequire.NoError(t, os.Mkdir(filepath.Join(dir, \"var\"), 0755))\n\trequire.NoError(t, setupTestCerts(filepath.Join(dir, \"var\")))\n\n\t// Daemon\n\tdaemon := NewDaemon(newConfig(), newOS(dir))\n\trequire.NoError(t, daemon.Init())\n\n\tcleanup := func() {\n\t\trequire.NoError(t, daemon.Stop())\n\t\trequire.NoError(t, os.RemoveAll(dir))\n\t\tresetLogger()\n\t}\n\n\treturn daemon, cleanup\n}", "title": "" }, { "docid": "3fe15636a8ec3aadad7495f31cf26f8f", "score": "0.5694102", "text": "func (c *daemonstools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Daemonstool, err error) {\n\tresult = &v1beta1.Daemonstool{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"daemonstools\").\n\t\tName(name).\n\t\tVersionedParams(&options, scheme.ParameterCodec).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "523771e218236f385dd9b75649a73430", "score": "0.5685403", "text": "func newConfig() *DaemonConfig {\n\treturn &DaemonConfig{}\n}", "title": "" }, { "docid": "7f4bd48c40e4945dbff7f0c228263af2", "score": "0.56477237", "text": "func New(repo repo.Interface, http bool, address string, n int) (*Client, error) {\n\t// create a client with simple information.\n\tcli := &Client{\n\t\trepo: repo,\n\t\tdaemons: n,\n\t}\n\n\t// create the service to hold daemons.\n\tcli.service = NewService(n, cli.process, cli.onError)\n\n\t// create the channel for client connections.\n\tcli.clients = make(chan *httputil.ClientConn, n)\n\n\t// for each daemon, create one client connection for them to work with.\n\tfor i := 0; i < n; i++ {\n\t\tconn, err := createConn(http, address)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tcli.clients <- httputil.NewClientConn(conn, nil)\n\t}\n\n\tlog.Info.Printf(\"%d daemons clients created.\", n)\n\n\t// create a dedicated client connection for side requests.\n\tconn, err := createConn(http, address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcli.dedicated = httputil.NewClientConn(conn, nil)\n\n\tcli.events, err = NewEventsMonitor(http, address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Info.Printf(\"Docker client created.\")\n\n\treturn cli, nil\n}", "title": "" }, { "docid": "b0deee4f81c4ee187fdedbc1716e5352", "score": "0.56009597", "text": "func newServer(service string, cfg *config.Config) common.Daemon {\n\treturn &server{\n\t\tcfg: cfg,\n\t\tname: service,\n\t\tdoneC: make(chan struct{}),\n\t}\n}", "title": "" }, { "docid": "e6f01ad034ebf34197ed3fca799a1cce", "score": "0.5581594", "text": "func NewDaemon() (Daemon, error) {\n\tdaemonConfig := config.DaemonConfig{}\n\tif err := daemonConfig.ReadConfig(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := daemonConfig.ValidateConfig(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tpodEventHandler := resEvenHandler.NewPodEventHandler()\n\tclient, err := k8sClient.NewK8sClient()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpluginLoader := sm.NewPluginLoader()\n\tgetSmClientFunc, err := pluginLoader.LoadPlugin(path.Join(\n\t\tdaemonConfig.PluginPath, daemonConfig.Plugin+\".so\"), sm.InitializePluginFunc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsmClient, err := getSmClientFunc()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Try to validate if subnet manager is reachable in backoff loop\n\tvar validateErr error\n\tif err := wait.ExponentialBackoff(backoffValues, func() (bool, error) {\n\t\tif err := smClient.Validate(); err != nil {\n\t\t\tlog.Warn().Msgf(\"%v\", err)\n\t\t\tvalidateErr = err\n\t\t\treturn false, nil\n\t\t}\n\t\treturn true, nil\n\t}); err != nil {\n\t\treturn nil, validateErr\n\t}\n\n\tguidPool, err := guid.NewPool(&daemonConfig.GUIDPool)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Reset guid pool with already allocated guids to avoid collisions\n\terr = syncGuidPool(smClient, guidPool)\n\n\tpodWatcher := watcher.NewWatcher(podEventHandler, client)\n\treturn &daemon{\n\t\tconfig: daemonConfig,\n\t\twatcher: podWatcher,\n\t\tkubeClient: client,\n\t\tguidPool: guidPool,\n\t\tsmClient: smClient,\n\t\tguidPodNetworkMap: make(map[string]string)}, nil\n}", "title": "" }, { "docid": "898f36e5b0faa7e392951822c64f5d74", "score": "0.5543942", "text": "func NewDaemon(namer Namer, tags []string, opts ...DaemonOption) (Interface, error) {\n\td := &demon{\n\t\tbase: LocalDomain,\n\t\tnamer: namer,\n\t\ttags: tags,\n\t}\n\tfor _, option := range opts {\n\t\tif err := option(d); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn d, nil\n}", "title": "" }, { "docid": "0b1613d4e29b495870ba35f7cb81e46f", "score": "0.5517918", "text": "func NewDaemonService(sm *gnet.ServiceManager, daemon *Daemon) *DaemonService {\n\tvar swd DaemonService\n\tswd.Daemon = daemon\n\tswd.ServiceManager = sm\n\t//associate service with channel 0\n\tswd.Service = sm.AddService(\n\t\t[]byte(\"Skywire Daemon\"),\n\t\t[]byte(\"{service:'Skywire Daemon',version=0\"),\n\t\t0, &swd)\n\n\treturn &swd\n}", "title": "" }, { "docid": "b035509edd8fb5db9be2dae7379ca60c", "score": "0.5403521", "text": "func newSDSService(st cache.SecretManager) *sdsservice {\n\treturn &sdsservice{\n\t\tst: st,\n\t}\n}", "title": "" }, { "docid": "2e1677443b2c17d7f9542800e03b2267", "score": "0.5400979", "text": "func buildDaemonSet(cfg *kubeadmapi.MasterConfiguration, name string, podSpec *v1.PodSpec) *extensions.DaemonSet {\n\t// Mutate the PodSpec so it's suitable for self-hosting\n\tmutatePodSpec(cfg, name, podSpec)\n\n\t// Return a DaemonSet based on that Spec\n\treturn &extensions.DaemonSet{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: addSelfHostedPrefix(name),\n\t\t\tNamespace: metav1.NamespaceSystem,\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"k8s-app\": addSelfHostedPrefix(name),\n\t\t\t},\n\t\t},\n\t\tSpec: extensions.DaemonSetSpec{\n\t\t\tTemplate: v1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"k8s-app\": addSelfHostedPrefix(name),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSpec: *podSpec,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "6ab13980174ed911b8d45f5aa3a2e5d7", "score": "0.5364784", "text": "func newServiceManager(c *Server, o *Overlay) *serviceManager {\n\tservices := make(map[ServiceID]Service)\n\ts := &serviceManager{services, c, network.NewRoutineDispatcher()}\n\tids := ServiceFactory.registeredServiceIDs()\n\tfor _, id := range ids {\n\t\tname := ServiceFactory.Name(id)\n\t\tlog.Lvl3(\"Starting service\", name)\n\t\tcont := newContext(c, o, id, s)\n\t\ts, err := ServiceFactory.start(name, cont)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Trying to instantiate service:\", err)\n\t\t}\n\t\tlog.Lvl3(\"Started Service\", name)\n\t\tservices[id] = s\n\t\tc.websocket.registerService(name, s)\n\t}\n\tlog.Lvl3(c.Address(), \"instantiated all services\")\n\treturn s\n}", "title": "" }, { "docid": "8f48b614b99811aff555176c5b67c465", "score": "0.53611827", "text": "func newManageds(c *KubextprojV1alpha1Client, namespace string) *manageds {\n\treturn &manageds{\n\t\tclient: c.RESTClient(),\n\t\tns: namespace,\n\t}\n}", "title": "" }, { "docid": "69367037155e0ceccd2ed7cafcd206b9", "score": "0.53056103", "text": "func newDaskWorkerGroups(c *KubernetesV1Client, namespace string) *daskWorkerGroups {\n\treturn &daskWorkerGroups{\n\t\tclient: c.RESTClient(),\n\t\tns: namespace,\n\t}\n}", "title": "" }, { "docid": "a67f306632cc24e9a55802eb3bc7cb7d", "score": "0.52983755", "text": "func New(\n\tnodeName string,\n\tnamespace string,\n\tstdoutToSocket bool,\n\tkubeClient *kubernetes.Clientset,\n\tptpUpdate *LinuxPTPConfUpdate,\n\tstopCh <-chan struct{},\n\tplugins []string,\n\thwconfigs *[]ptpv1.HwConfig,\n\trefreshNodePtpDevice *bool,\n\tcloseManager chan bool,\n\tpmcPollInterval int,\n) *Daemon {\n\tif !stdoutToSocket {\n\t\tRegisterMetrics(nodeName)\n\t}\n\tInitializeOffsetMaps()\n\tpluginManager := registerPlugins(plugins)\n\teventChannel := make(chan event.EventChannel, 50)\n\treturn &Daemon{\n\t\tnodeName: nodeName,\n\t\tnamespace: namespace,\n\t\tstdoutToSocket: stdoutToSocket,\n\t\tkubeClient: kubeClient,\n\t\tptpUpdate: ptpUpdate,\n\t\tpluginManager: pluginManager,\n\t\thwconfigs: hwconfigs,\n\t\trefreshNodePtpDevice: refreshNodePtpDevice,\n\t\tpmcPollInterval: pmcPollInterval,\n\t\t//TODO:Enable only for GM\n\t\tprocessManager: &ProcessManager{\n\t\t\tprocess: nil,\n\t\t\teventChannel: eventChannel,\n\t\t\tptpEventHandler: event.Init(nodeName, stdoutToSocket, eventSocket, eventChannel, closeManager, Offset, ClockState),\n\t\t},\n\t\tstopCh: stopCh,\n\t}\n}", "title": "" }, { "docid": "bd0a2ac51758d5afe24fcaec64b8ed65", "score": "0.52772033", "text": "func (c *daemonstools) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DaemonstoolList, err error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\tresult = &v1beta1.DaemonstoolList{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"daemonstools\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "87f23beff92835b5086baed420212b20", "score": "0.5256292", "text": "func New(cfg *config.Config) Daemon {\n\treturn Daemon{\n\t\tcfg: cfg,\n\t}\n}", "title": "" }, { "docid": "aee0cbe09acc9908f0260cdddf52c3e4", "score": "0.52535766", "text": "func New() *Daemon {\n\treturn &Daemon{\n\t\tIn: make(chan msg.Message),\n\t\tOut: make(map[types.MessageType]chan msg.Message),\n\t\tErr: make(chan msg.Message),\n\t\tctx: srvc.NewDefaultContext(),\n\t\tservices: make(map[types.ServiceType]srvc.Service),\n\t}\n\n}", "title": "" }, { "docid": "7691b4e93df27326299091a1c71ba898", "score": "0.5240278", "text": "func newKubeManager(framework *framework.Framework, dnsDomain string) *kubeManager {\n\treturn &kubeManager{\n\t\tframework: framework,\n\t\tclientSet: framework.ClientSet,\n\t\tdnsDomain: dnsDomain,\n\t}\n}", "title": "" }, { "docid": "57ac1c5694f5545de2dde67dc21ce2e3", "score": "0.5221799", "text": "func (c *controller) newDaemonSetExpected(rawObj client.Object) *apps.DaemonSet {\n\tdevicePlugin := rawObj.(*devicepluginv1.DsaDevicePlugin)\n\n\tyes := true\n\tno := false\n\tdaemonSet := apps.DaemonSet{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"DaemonSet\",\n\t\t\tAPIVersion: \"apps/v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: c.ns,\n\t\t\tName: \"intel-dsa-plugin\",\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"app\": appLabel,\n\t\t\t},\n\t\t},\n\t\tSpec: apps.DaemonSetSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"app\": appLabel,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: v1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"app\": appLabel,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\tAutomountServiceAccountToken: &no,\n\t\t\t\t\tContainers: []v1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: appLabel,\n\t\t\t\t\t\t\tEnv: []v1.EnvVar{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"NODE_NAME\",\n\t\t\t\t\t\t\t\t\tValueFrom: &v1.EnvVarSource{\n\t\t\t\t\t\t\t\t\t\tFieldRef: &v1.ObjectFieldSelector{\n\t\t\t\t\t\t\t\t\t\t\tFieldPath: \"spec.nodeName\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tArgs: getPodArgs(devicePlugin),\n\t\t\t\t\t\t\tImage: devicePlugin.Spec.Image,\n\t\t\t\t\t\t\tImagePullPolicy: \"IfNotPresent\",\n\t\t\t\t\t\t\tSecurityContext: &v1.SecurityContext{\n\t\t\t\t\t\t\t\tSELinuxOptions: &v1.SELinuxOptions{\n\t\t\t\t\t\t\t\t\tType: \"container_device_plugin_t\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tReadOnlyRootFilesystem: &yes,\n\t\t\t\t\t\t\t\tAllowPrivilegeEscalation: &no,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tVolumeMounts: []v1.VolumeMount{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"devfs\",\n\t\t\t\t\t\t\t\t\tMountPath: \"/dev/dsa\",\n\t\t\t\t\t\t\t\t\tReadOnly: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"chardevs\",\n\t\t\t\t\t\t\t\t\tMountPath: \"/dev/char\",\n\t\t\t\t\t\t\t\t\tReadOnly: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"sysfs\",\n\t\t\t\t\t\t\t\t\tMountPath: \"/sys/bus/dsa\",\n\t\t\t\t\t\t\t\t\tReadOnly: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"kubeletsockets\",\n\t\t\t\t\t\t\t\t\tMountPath: \"/var/lib/kubelet/device-plugins\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tNodeSelector: map[string]string{\"kubernetes.io/arch\": \"amd64\"},\n\t\t\t\t\tVolumes: []v1.Volume{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"devfs\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tHostPath: &v1.HostPathVolumeSource{\n\t\t\t\t\t\t\t\t\tPath: \"/dev/dsa\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"chardevs\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tHostPath: &v1.HostPathVolumeSource{\n\t\t\t\t\t\t\t\t\tPath: \"/dev/char\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"sysfs\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tHostPath: &v1.HostPathVolumeSource{\n\t\t\t\t\t\t\t\t\tPath: \"/sys/bus/dsa\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"kubeletsockets\",\n\t\t\t\t\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\t\t\t\t\tHostPath: &v1.HostPathVolumeSource{\n\t\t\t\t\t\t\t\t\tPath: \"/var/lib/kubelet/device-plugins\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\t// add the optional init container\n\tif devicePlugin.Spec.InitImage != \"\" {\n\t\taddInitContainer(&daemonSet, devicePlugin)\n\t}\n\n\treturn &daemonSet\n}", "title": "" }, { "docid": "93afdd22a1bb5a61e82f043ba4e37532", "score": "0.52008474", "text": "func newSchemaMgr(sEx SessionExecutor, main, node, entity string) *schemaMgr {\n\tsm := &schemaMgr{\n\t\treq: make(chan schemaMessage),\n\t\tresp: make(chan CommonReply),\n\t\tsEx: sEx,\n\t\tcache: newDBCache(),\n\t\tdaemonWG: sync.WaitGroup{},\n\t\tmainTable: main,\n\t\tnodeTable: node,\n\t\tentityTable: entity,\n\t}\n\tsm.daemonWG.Add(1)\n\tgo sm.run()\n\treturn sm\n}", "title": "" }, { "docid": "3812acc3a7c8def99d7e43e307038cee", "score": "0.51993936", "text": "func New(cfg *config.Config) Daemon {\n\treturn Daemon{cfg: cfg, monitor: wireguard.NewMonitor()}\n}", "title": "" }, { "docid": "067c1678076ecb0f86f37f8b243caf28", "score": "0.51988566", "text": "func NewDaemon(config Config, db *bolt.DB, defaultConns []string) (*Daemon, error) {\n\tconfig = config.preprocess()\n\tvs, err := NewVisor(config.Visor, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpex, err := pex.New(config.Pex, defaultConns)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\td := &Daemon{\n\t\tConfig: config.Daemon,\n\t\tMessages: NewMessages(config.Messages),\n\t\tPex: pex,\n\t\tVisor: vs,\n\n\t\tDefaultConnections: defaultConns, //passed in from top level\n\n\t\texpectingIntroductions: NewExpectIntroductions(),\n\t\tconnectionMirrors: NewConnectionMirrors(),\n\t\tmirrorConnections: NewMirrorConnections(),\n\t\tipCounts: NewIPCount(),\n\t\t// TODO -- if there are performance problems from blocking chans,\n\t\t// Its because we are connecting to more things than OutgoingMax\n\t\t// if we have private peers\n\t\tonConnectEvent: make(chan ConnectEvent, config.Daemon.OutgoingMax),\n\t\tonDisconnectEvent: make(chan DisconnectEvent, config.Daemon.OutgoingMax),\n\t\tconnectionErrors: make(chan ConnectionError, config.Daemon.OutgoingMax),\n\t\toutgoingConnections: NewOutgoingConnections(config.Daemon.OutgoingMax),\n\t\tpendingConnections: NewPendingConnections(config.Daemon.PendingMax),\n\t\tmessageEvents: make(chan MessageEvent, config.Pool.EventChannelSize),\n\t\tquitC: make(chan chan struct{}),\n\t}\n\n\td.Gateway = NewGateway(config.Gateway, d)\n\td.Messages.Config.Register()\n\td.Pool = NewPool(config.Pool, d)\n\n\treturn d, nil\n}", "title": "" }, { "docid": "432858d652e7a6f1318ed56aa421c507", "score": "0.5192151", "text": "func newOptions(opts ...Option) ServiceOptions {\n\topt := ServiceOptions{\n\t\t// Servers: []server.Server{DefaultServer},\n\t\tContext: context.Background(),\n\t\tExit: make(chan struct{}),\n\t}\n\n\tfor _, o := range opts {\n\t\to(&opt)\n\t}\n\n\treturn opt\n}", "title": "" }, { "docid": "a9f71ad15ee643fce78b9b16483b3035", "score": "0.5186171", "text": "func NewDaemon() (*Daemon, error) {\n\tqueueLen := setting.MailService.QueueLength\n\tworkers := setting.MailService.Workers\n\n\t// Validate input.\n\tif queueLen < 0 {\n\t\treturn nil, fmt.Errorf(\"mail daemon: invalid queue length: %v\", queueLen)\n\t} else if workers < 1 {\n\t\treturn nil, fmt.Errorf(\"mail daemon: invalid workers routines: %v\", workers)\n\t}\n\n\td := &Daemon{\n\t\tmailQueue: make(chan *Message, queueLen),\n\t\tcloseChan: make(chan struct{}),\n\t}\n\n\t// Create a sender for each mail worker routine.\n\tfor i := 0; i < workers; i++ {\n\t\ts, err := createSender()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tgo d.processMailQueue(s)\n\t}\n\n\treturn d, nil\n}", "title": "" }, { "docid": "52d8c5b9e3bfb72672c4c771358fa3ac", "score": "0.5179177", "text": "func NewDaemon(secrets secrets.Secrets, logger logging.Logger) *Daemon {\n\treturn &Daemon{\n\t\tlogger: logger.WithField(\"package\", \"daemon\"),\n\t\tsecrets: secrets,\n\t}\n}", "title": "" }, { "docid": "44cf7f97e89227661f4ddd6e417d1966", "score": "0.51502484", "text": "func newServiceDeployer(api *API, env map[string]string, options ...DeployServiceOption) *serviceDeployer {\n\td := &serviceDeployer{\n\t\tapi: api,\n\t\tenv: env,\n\t}\n\tfor _, option := range options {\n\t\toption(d)\n\t}\n\treturn d\n}", "title": "" }, { "docid": "fcca62328d26c1b6e3b9f1e2a7664834", "score": "0.51346093", "text": "func NewDaemon() Daemon {\n\treturn &daemon{}\n}", "title": "" }, { "docid": "b7cd468c2daa87b330375f13c4e3eea8", "score": "0.51140183", "text": "func NewServer(members []string, domain string, dnsAddr string, httpAddr string, dataDir string, rt, wt time.Duration, secret string, nameservers []string) (s *Server) {\n\ts = &Server{\n\t\tmembers: members,\n\t\tdomain: domain,\n\t\tdomainLabels: dns.CountLabel(dns.Fqdn(domain)),\n\t\tdnsAddr: dnsAddr,\n\t\thttpAddr: httpAddr,\n\t\treadTimeout: rt,\n\t\twriteTimeout: wt,\n\t\trouter: mux.NewRouter(),\n\t\tregistry: registry.New(),\n\t\tdataDir: dataDir,\n\t\tdnsHandler: dns.NewServeMux(),\n\t\twaiter: new(sync.WaitGroup),\n\t\tsecret: secret,\n\t\tnameservers: nameservers,\n\t}\n\n\tif _, err := os.Stat(s.dataDir); os.IsNotExist(err) {\n\t\tlog.Fatal(\"Data directory does not exist: \", dataDir)\n\t\treturn\n\t}\n\n\t// DNS\n\ts.dnsHandler.Handle(\".\", s)\n\n\tauthWrapper := s.authHTTPWrapper\n\n\t// API Routes\n\ts.router.HandleFunc(\"/skydns/services/{uuid}\", authWrapper(s.addServiceHTTPHandler)).Methods(\"PUT\")\n\ts.router.HandleFunc(\"/skydns/services/{uuid}\", authWrapper(s.getServiceHTTPHandler)).Methods(\"GET\")\n\ts.router.HandleFunc(\"/skydns/services/{uuid}\", authWrapper(s.removeServiceHTTPHandler)).Methods(\"DELETE\")\n\ts.router.HandleFunc(\"/skydns/services/{uuid}\", authWrapper(s.updateServiceHTTPHandler)).Methods(\"PATCH\")\n\n\ts.router.HandleFunc(\"/skydns/callbacks/{uuid}\", authWrapper(s.addCallbackHTTPHandler)).Methods(\"PUT\")\n\n\t// External API Routes\n\t// /skydns/services #list all services\n\ts.router.HandleFunc(\"/skydns/services/\", authWrapper(s.getServicesHTTPHandler)).Methods(\"GET\")\n\t// /skydns/regions #list all regions\n\ts.router.HandleFunc(\"/skydns/regions/\", authWrapper(s.getRegionsHTTPHandler)).Methods(\"GET\")\n\t// /skydns/environnments #list all environments\n\ts.router.HandleFunc(\"/skydns/environments/\", authWrapper(s.getEnvironmentsHTTPHandler)).Methods(\"GET\")\n\n\t// Raft Routes\n\ts.router.HandleFunc(\"/raft/join\", s.joinHandler).Methods(\"POST\")\n\treturn\n}", "title": "" }, { "docid": "4d8d20dcac3705ec85e926f182d1d7b2", "score": "0.5099766", "text": "func New(env *env.Env) *Daemon {\n\treturn &Daemon{\n\t\tmonitors: make(map[db.MonitorID]*monitor),\n\t\tstop: make(chan struct{}),\n\t\tstopped: make(chan struct{}),\n\t\tEnv: env,\n\t}\n}", "title": "" }, { "docid": "a8660fc202d8a38cb4f4e642dc080095", "score": "0.5087744", "text": "func NewDaemonSet(namespace, name string, visitors ...func(o runtime.Object)) *appsv1.DaemonSet {\n\tds := &appsv1.DaemonSet{}\n\tInitialize(ds, namespace, name, visitors...)\n\treturn ds\n}", "title": "" }, { "docid": "5de5d3168b82331770f10f2e21421d4a", "score": "0.5080392", "text": "func createDaemonSet(ctx context.Context, cli client.Client, ds *appsv1.DaemonSet) error {\n\tif err := cli.Create(ctx, ds); err != nil {\n\t\treturn fmt.Errorf(\"failed to create daemonset %s/%s: %w\", ds.Namespace, ds.Name, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "438741cd6ab4e8b8c06f8d0a6387e585", "score": "0.5046587", "text": "func NewLavaTools(c *lava.Connection, opt Options) (con Lavatools, err error) {\n\tretry, err := newLavaToolsRetry(c, opt)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tcache, err := newLavaToolsCache(c, retry, opt)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tobj := lt{c: c,\n\t\tpollInterval: opt.PollInterval,\n\t\tinvalidTimeout: opt.InvalidTimeout,\n\t\tretryCount: opt.RetryCount,\n\t\tcache: cache,\n\t\tretry: retry,\n\t}\n\tcon = obj\n\treturn\n}", "title": "" }, { "docid": "2092dc152463fdb5f8788607bfae6961", "score": "0.5032337", "text": "func newCertManager(\n\tclientset kubernetes.Interface,\n\tcomponentName,\n\tcertDir,\n\tcommonName string,\n\torganizations,\n\tdnsNames []string,\n\tipAddrs []net.IP) (certificate.Manager, error) {\n\tcertificateStore, err :=\n\t\tcertificate.NewFileStore(componentName, certDir, certDir, \"\", \"\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to initialize the server certificate store: %v\", err)\n\t}\n\n\tgetTemplate := func() *x509.CertificateRequest {\n\t\treturn &x509.CertificateRequest{\n\t\t\tSubject: pkix.Name{\n\t\t\t\tCommonName: commonName,\n\t\t\t\tOrganization: organizations,\n\t\t\t},\n\t\t\tDNSNames: dnsNames,\n\t\t\tIPAddresses: ipAddrs,\n\t\t}\n\t}\n\n\tcertManager, err := certificate.NewManager(&certificate.Config{\n\t\tClientFn: func(current *tls.Certificate) (clicert.CertificateSigningRequestInterface, error) {\n\t\t\treturn clientset.CertificatesV1beta1().CertificateSigningRequests(), nil\n\t\t},\n\t\tGetTemplate: getTemplate,\n\t\tUsages: []certificates.KeyUsage{\n\t\t\tcertificates.UsageAny,\n\t\t},\n\t\tCertificateStore: certificateStore,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to initialize server certificate manager: %v\", err)\n\t}\n\n\treturn certManager, nil\n}", "title": "" }, { "docid": "0f275c516aef88618a065f92f70e860e", "score": "0.50295883", "text": "func (t *TyphaDaemon) CreateServer() {\n\t// Health monitoring, for liveness and readiness endpoints.\n\tt.healthAggregator = health.NewHealthAggregator()\n\n\t// Now create the Syncer and caching layer (one pipeline for each syncer we support).\n\tt.addSyncerPipeline(syncproto.SyncerTypeFelix, t.DatastoreClient.FelixSyncerByIface)\n\tt.addSyncerPipeline(syncproto.SyncerTypeBGP, t.DatastoreClient.BGPSyncerByIface)\n\tt.addSyncerPipeline(syncproto.SyncerTypeTunnelIPAllocation, t.DatastoreClient.TunnelIPAllocationSyncerByIface)\n\tt.addSyncerPipeline(syncproto.SyncerTypeNodeStatus, t.DatastoreClient.NodeStatusSyncerByIface)\n\n\t// Create the server, which listens for connections from Felix.\n\tt.Server = syncserver.New(\n\t\tt.CachesBySyncerType,\n\t\tsyncserver.Config{\n\t\t\tMaxMessageSize: t.ConfigParams.ServerMaxMessageSize,\n\t\t\tMinBatchingAgeThreshold: t.ConfigParams.ServerMinBatchingAgeThresholdSecs,\n\t\t\tMaxFallBehind: t.ConfigParams.ServerMaxFallBehindSecs,\n\t\t\tNewClientFallBehindGracePeriod: t.ConfigParams.ServerNewClientFallBehindGracePeriod,\n\t\t\tPingInterval: t.ConfigParams.ServerPingIntervalSecs,\n\t\t\tPongTimeout: t.ConfigParams.ServerPongTimeoutSecs,\n\t\t\tHandshakeTimeout: t.ConfigParams.ServerHandshakeTimeoutSecs,\n\t\t\tDropInterval: t.ConfigParams.ConnectionDropIntervalSecs,\n\t\t\tShutdownTimeout: t.ConfigParams.ShutdownTimeoutSecs,\n\t\t\tShutdownMaxDropInterval: t.ConfigParams.ShutdownConnectionDropIntervalMaxSecs,\n\t\t\tMaxConns: t.ConfigParams.MaxConnectionsUpperLimit,\n\t\t\tPort: t.ConfigParams.ServerPort,\n\t\t\tHealthAggregator: t.healthAggregator,\n\t\t\tKeyFile: t.ConfigParams.ServerKeyFile,\n\t\t\tCertFile: t.ConfigParams.ServerCertFile,\n\t\t\tCAFile: t.ConfigParams.CAFile,\n\t\t\tClientCN: t.ConfigParams.ClientCN,\n\t\t\tClientURISAN: t.ConfigParams.ClientURISAN,\n\t\t},\n\t)\n}", "title": "" }, { "docid": "bd92e8a680f59765dd1f26e84b34ad73", "score": "0.50121874", "text": "func NewCommand() *cobra.Command {\n\n\tvar cmd = &cobra.Command{\n\t\tUse: \"daemon\",\n\t\tShort: \"Last.Backend Open-source PaaS\",\n\t\tLong: `Open-source system for automating deployment, scaling, and management of containerized applications.`,\n\t\tRunE: func(cmd *cobra.Command, args []string) (err error) {\n\n\t\t\tvar cfg = config.Config{}\n\n\t\t\t// short-circuit on help\n\t\t\thelp, err := cmd.Flags().GetBool(\"help\")\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"\\\"help\\\" flag is non-bool, programmer error, please correct\")\n\t\t\t}\n\t\t\tif help {\n\t\t\t\treturn cmd.Help()\n\t\t\t}\n\n\t\t\tcfgFile, err := cmd.Flags().GetString(\"config\")\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"\\\"config\\\" flag is non-string, programmer error, please correct\")\n\t\t\t}\n\n\t\t\tprintFlags(cmd.Flags())\n\n\t\t\tvar (\n\t\t\t\tsigs = make(chan os.Signal)\n\t\t\t)\n\n\t\t\tif cfgFile != \"\" {\n\t\t\t\tif err := SetConfigFromFile(cfgFile, &cfg); err != nil {\n\t\t\t\t\treturn errors.Wrapf(err, \"can not be set server config from file\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif err := SetConfigFromEnvs(&cfg); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"can not be set server config from envs\")\n\t\t\t}\n\n\t\t\tif err := SetConfigFromFlags(cmd.Flags(), &cfg); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"can not be set server config from flags\")\n\t\t\t}\n\n\t\t\tapp, err := daemon.New(cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"can not init daemon process\")\n\t\t\t}\n\t\t\tif err := app.Run(); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"can not run daemon process\")\n\t\t\t}\n\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-sigs:\n\t\t\t\t\tapp.Stop()\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t},\n\t}\n\n\tcmd.PersistentFlags().BoolP(\"help\", \"h\", false, fmt.Sprintf(\"Help for %s\", cmd.Name()))\n\n\tcmd.Flags().StringP(\"config\", \"c\", \"\", \"set config path\")\n\tcmd.Flags().Bool(\"agent\", false, \"Only agent mode\")\n\tcmd.Flags().Bool(\"no-schedule\", false, \"Disable schedule mode\")\n\tcmd.Flags().StringP(\"access-token\", \"\", \"\", \"Access token to NodeClient server\")\n\tcmd.Flags().StringP(\"bind-address\", \"\", config.DefaultBindServerAddress, \"Bind address for listening\")\n\tcmd.Flags().UintP(\"bind-port\", \"\", config.DefaultBindServerPort, \"Bind address for listening\")\n\tcmd.Flags().BoolP(\"tls-verify\", \"\", false, \"Enable check tls for NodeClient server\")\n\tcmd.Flags().StringP(\"tls-cert-file\", \"\", \"\", \"TLS cert file path\")\n\tcmd.Flags().StringP(\"tls-private-key-file\", \"\", \"\", \"TLS private key file path\")\n\tcmd.Flags().StringP(\"tls-ca-file\", \"\", \"\", \"TLS certificate authority file path\")\n\tcmd.Flags().StringP(\"vault-token\", \"\", \"\", \"Vault access token\")\n\tcmd.Flags().StringP(\"vault-endpoint\", \"\", \"\", \"Vault access endpoint\")\n\tcmd.Flags().StringP(\"domain-internal\", \"\", config.DefaultInternalDomain, \"Default external domain for cluster\")\n\tcmd.Flags().StringP(\"domain-external\", \"\", \"\", \"Internal domain name for cluster\")\n\tcmd.Flags().StringP(\"services-cidr\", \"\", config.DefaultCIDR, \"Services IP CIDR for internal IPAM service\")\n\tcmd.Flags().StringP(\"root-dir\", \"\", \"\", \"Set root directory (Default: /var/lib/lastbackend/)\")\n\tcmd.Flags().StringP(\"storage-driver\", \"\", \"\", \"Set storage driver (Default: overlay)\")\n\tcmd.Flags().StringP(\"node-bind-address\", \"\", config.DefaultBindServerAddress, \"Set bind address for NodeClient server\")\n\tcmd.Flags().UintP(\"node-bind-port\", \"\", config.DefaultBindServerPort, \"Set listening port binding for NodeClient server\")\n\tcmd.Flags().BoolP(\"node-tls-verify\", \"\", false, \"Enable check tls for NodeClient server\")\n\tcmd.Flags().StringP(\"node-tls-ca-file\", \"\", \"\", \"Set path to ca file for NodeClient server\")\n\tcmd.Flags().StringP(\"node-tls-cert-file\", \"\", \"\", \"Set path to cert file for NodeClient server\")\n\tcmd.Flags().StringP(\"node-tls-private-key-file\", \"\", \"\", \"Set path to key file for NodeClient server\")\n\tcmd.Flags().StringP(\"api-address\", \"\", \"\", \"Set endpoint for rest client\")\n\tcmd.Flags().BoolP(\"api-tls-verify\", \"\", false, \"Enable check tls for rest client\")\n\tcmd.Flags().StringP(\"api-tls-ca-file\", \"\", \"\", \"Set path to ca file for rest client\")\n\tcmd.Flags().StringP(\"api-tls-cert-file\", \"\", \"\", \"Set path to cert file for rest client\")\n\tcmd.Flags().StringP(\"api-tls-private-key-file\", \"\", \"\", \"Set path to key file rest client\")\n\tcmd.Flags().StringP(\"manifest-dir\", \"\", \"\", \"Set directory path to manifest\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "7ed6eff3c30b50d399111f8a790893e2", "score": "0.501023", "text": "func New(\n\trootMount string,\n\tnodeName string,\n\toperatingSystem string,\n\tnodeUpdaterClient NodeUpdaterClient,\n\tfileSystemClient FileSystemClient,\n\tonceFrom string,\n) (*Daemon, error) {\n\tloginClient, err := login1.New()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error establishing connection to logind dbus: %v\", err)\n\t}\n\n\tosImageURL, osVersion, err := nodeUpdaterClient.GetBootedOSImageURL(rootMount)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error reading osImageURL from rpm-ostree: %v\", err)\n\t}\n\n\tglog.Infof(\"Booted osImageURL: %s (%s)\", osImageURL, osVersion)\n\n\tdn := &Daemon{\n\t\tname: nodeName,\n\t\tOperatingSystem: operatingSystem,\n\t\tNodeUpdaterClient: nodeUpdaterClient,\n\t\tloginClient: loginClient,\n\t\trootMount: rootMount,\n\t\tfileSystemClient: fileSystemClient,\n\t\tbootedOSImageURL: osImageURL,\n\t\tonceFrom: onceFrom,\n\t}\n\n\treturn dn, nil\n}", "title": "" }, { "docid": "2ebef9362eece86e48f2047543cb814e", "score": "0.50091195", "text": "func TestNewDaemonSetDSA(t *testing.T) {\n\tplugin := &devicepluginv1.DsaDevicePlugin{}\n\tc := &controller{}\n\n\texpected := c.newDaemonSetExpected(plugin)\n\tactual := c.NewDaemonSet(plugin)\n\n\tif !reflect.DeepEqual(expected, actual) {\n\t\tt.Errorf(\"expected and actuall daemonsets differ: %+s\", diff.ObjectGoPrintDiff(expected, actual))\n\t}\n}", "title": "" }, { "docid": "d239ec81b61922baec0ec90c0b2cc50b", "score": "0.4991948", "text": "func NewBuilder(ctxt context.Context,\n\tworkspaceRoot string,\n\tworkerCount int,\n\tverbose bool,\n\tbuild, host, target string,\n\tdownloadDir, toolsDir, cacheDir, stampDir string) *Builder {\n\n\tif workspaceRoot == \"\" {\n\t\tworkspaceRoot = path.Join(\".\", \".sonbyg\")\n\t}\n\tabsWspRoot, err := filepath.Abs(workspaceRoot)\n\tif err != nil {\n\t\tlog.Panicf(\"Could create workspace root path %v\", err)\n\t}\n\tv := utils.NewVariables(os.Environ())\n\tif runtime.GOOS == \"windows\" {\n\t\tv[\"PATH\"] = v[\"Path\"]\n\t}\n\tb := &Builder{\n\t\tVerbose: verbose,\n\t\tWorkspaceRoot: absWspRoot,\n\t\tctxt: ctxt}\n\tv[\"WORKSPACE\"] = absWspRoot\n\tif downloadDir == \"\" {\n\t\tdownloadDir = path.Join(absWspRoot, \"downloads\")\n\t}\n\tif toolsDir == \"\" {\n\t\ttoolsDir = path.Join(absWspRoot, \"tools\")\n\t}\n\tif cacheDir == \"\" {\n\t\tcacheDir = path.Join(absWspRoot, \"cache\")\n\t}\n\tif stampDir == \"\" {\n\t\tstampDir = path.Join(absWspRoot, \"stamps\")\n\t}\n\tv[\"VERBOSE\"] = verbose\n\tv[\"BUILD\"] = build\n\tv[\"HOST\"] = host\n\tv[\"TARGET\"] = target\n\tv[\"CACHE_DIR\"], _ = filepath.Abs(cacheDir)\n\tv[\"TOOLS_DIR\"], _ = filepath.Abs(toolsDir)\n\tv[\"DOWNLOAD_DIR\"], _ = filepath.Abs(downloadDir)\n\tv[\"STAMPS_DIR\"], _ = filepath.Abs(stampDir)\n\tb.Variables = v\n\tb.EstablishPath(755, v[\"CACHE_DIR\"].(string))\n\tb.EstablishPath(755, v[\"TOOLS_DIR\"].(string))\n\tb.EstablishPath(755, v[\"DOWNLOAD_DIR\"].(string))\n\tb.EstablishPath(755, v[\"STAMPS_DIR\"].(string))\n\n\tb.workerDoneChan = make(chan bool)\n\tb.workers = make([]*Worker, workerCount)\n\tfor i := range b.workers {\n\t\tb.workers[i] = NewWorker(ctxt, b.workerDoneChan)\n\t}\n\tb.tasks = make(map[string]*Task)\n\tb.operations = make(map[string]Operation)\n\tb.artifacts = make(map[string]*Artifact)\n\n\treturn b\n}", "title": "" }, { "docid": "8fe65d20228af698839a9d1dc9234255", "score": "0.49847695", "text": "func (this *Manager) newWorkers() {\n var worker IWorker\n this.workers = make([]IWorker, 0)\n for seq, file := range this.option.files {\n worker = workerConstructors[this.option.Kind()](this, this.option.Kind(), file, uint16(seq+1))\n this.workers = append(this.workers, worker)\n }\n\n this.Println(\"all worker instances created\")\n}", "title": "" }, { "docid": "23c5f45d2a8d1516a136fa4078a2b110", "score": "0.4974921", "text": "func newTestServicesConfig(td *ldtestdata.TestDataSource) Config {\n\tldConfig := ld.Config{\n\t\tDataSource: td,\n\t}\n\n\tldClient, err := ld.MakeCustomClient(\"fake\", ldConfig, 0)\n\tif err != nil {\n\t\tpanic(\"Error initializing mock LaunchDarkly client\")\n\t}\n\n\treturn Config{\n\t\tclock: clock.NewMock(),\n\t\tldClient: ldClient,\n\t}\n}", "title": "" }, { "docid": "1928e70eeaadd3106cb21a99e92b24c6", "score": "0.49729913", "text": "func NewDaemon(c DaemonConfig, k8sClient Kubelet, consulClient *consulApi.Client) *Daemon {\n\treturn &Daemon{\n\t\tc: c,\n\t\tk8sClient: k8sClient,\n\t\tconsulClient: consulClient,\n\n\t\tlocalK8sState: make(map[string]*Pod),\n\t\tsyncCh: make(chan chan error),\n\t}\n}", "title": "" }, { "docid": "658137f0685c57ebc2b107f4ff8d3831", "score": "0.49634358", "text": "func NewFileSystem(ctx context.Context, opt ...NewFSOpt) (_ fspkg.FileSystem, retErr error) {\n\tvar fs filesystem\n\tfor _, o := range opt {\n\t\terr := o(&fs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Try to reconnect to running daemons\n\tif err := fs.manager.Reconnect(ctx); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to reconnect daemons\")\n\t}\n\n\t// Both SharedInstance and PrefetchInstance use shared daemon\n\tif fs.mode == fspkg.SharedInstance || fs.mode == fspkg.PrefetchInstance {\n\t\tisPrefetch := fs.mode == fspkg.PrefetchInstance\n\n\t\t// Check if daemon is already running\n\t\td, err := fs.manager.GetByID(daemon.SharedNydusDaemonID)\n\t\tif err == nil && d != nil {\n\t\t\tlog.G(ctx).Infof(\"daemon(ID=%s) is already running and reconnected\", daemon.SharedNydusDaemonID)\n\t\t\treturn &fs, nil\n\t\t}\n\n\t\td, err = fs.newSharedDaemon()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to init shared daemon\")\n\t\t}\n\n\t\tdefer func() {\n\t\t\tif retErr != nil {\n\t\t\t\tfs.manager.DeleteDaemon(d)\n\t\t\t}\n\t\t}()\n\t\tif err := fs.manager.StartDaemon(d); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to start shared daemon\")\n\t\t}\n\n\t\t// We don't need to wait instance to be ready in\n\t\t// PrefetchInstance mode, as we want to return snapshot to\n\t\t// containerd as soon as possible, and prefetch instance is\n\t\t// only for prefetch.\n\t\tif !isPrefetch {\n\t\t\tif err := fs.WaitUntilReady(ctx, daemon.SharedNydusDaemonID); err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"failed to wait shared daemon\")\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &fs, nil\n}", "title": "" }, { "docid": "d976cc4981a02d09f5011ddc4018fbc5", "score": "0.4954211", "text": "func newDefaultSecurityManager(servingOptions *options.ServingOptions) *defaultSecurityManager {\n\trealmOptions := NewRealmOptionsWithFile(servingOptions.RealmConfigFile)\n\trealms := []Realm{}\n\n\tfor _, options := range realmOptions {\n\t\trealms = append(realms, NewRealm(options))\n\t}\n\treturn &defaultSecurityManager{\n\t\tmutex: sync.RWMutex{},\n\t\tservingOptions: servingOptions,\n\t\trealms: realms,\n\t}\n}", "title": "" }, { "docid": "683e7a76f5201965b78e4037ec679692", "score": "0.49512258", "text": "func New(name, description string, kind Kind,\n\tdependencies ...string) (Daemon, error) {\n\n\tswitch runtime.GOOS {\n\tcase \"linux\":\n\t\tif kind != SystemDaemon {\n\t\t\treturn nil, errors.New(\"Invalid daemon kind specified\")\n\t\t}\n\t}\n\n\treturn newDaemon(strings.Join(strings.Fields(name), \"_\"), description,\n\t\tkind, dependencies)\n}", "title": "" }, { "docid": "da2b60a008c0d82fd6083caf2671e658", "score": "0.4941275", "text": "func New(workers uint) Pool {\n\n\tif workers == 0 {\n\t\tpanic(\"invalid workers '0'\")\n\t}\n\n\tp := &pool{\n\t\tworkers: workers,\n\t}\n\n\tp.initialize()\n\n\treturn p\n}", "title": "" }, { "docid": "ba04f1ce276107cb0228ff31896ba170", "score": "0.49402893", "text": "func (dsf *Farm) spawnDaemonSet(\n\tctx context.Context,\n\tunlocker consul.TxnUnlocker,\n\tdsFields ds_fields.DaemonSet,\n\tdsLogger logging.Logger,\n) *childDS {\n\tds := New(\n\t\tdsFields,\n\t\tdsf.dsStore,\n\t\tdsf.store,\n\t\tdsf.txner,\n\t\tdsf.labeler,\n\t\tdsf.watcher,\n\t\tdsf.labelsAggregationRate,\n\t\tdsLogger,\n\t\tdsf.healthChecker,\n\t\tdsf.rateLimitInterval,\n\t\tdsf.cachedPodMatch,\n\t\tdsf.healthWatchDelay,\n\t\tdsf.dsRetryInterval,\n\t\tunlocker,\n\t\tdsf.statusStore,\n\t\tdsf.statusWritingInterval,\n\t)\n\n\tupdatedCh := make(chan ds_fields.DaemonSet)\n\tdeletedCh := make(chan ds_fields.DaemonSet)\n\tctx, cancel := context.WithCancel(ctx)\n\n\tdesiresCh := ds.WatchDesires(ctx, updatedCh, deletedCh)\n\n\tif dsf.monitorHealth {\n\t\tgo func() {\n\t\t\t// daemon sets are deployed to many servers and deploys are very slow. This means that\n\t\t\t// 1) the data size for each health response is huge which can suck up bandwidth\n\t\t\t// 2) the metrics aren't going to change very frequently, so a low sample rate is acceptable\n\t\t\taggregateHealth := replication.AggregateHealth(ds.PodID(), *dsf.healthChecker, dsf.healthWatchDelay)\n\t\t\tticks := time.NewTicker(dsf.healthWatchDelay)\n\n\t\t\tdefer aggregateHealth.Stop()\n\t\t\tdefer ticks.Stop()\n\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn\n\t\t\t\tcase <-ticks.C:\n\t\t\t\t\teligible, err := ds.EligibleNodes()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tdsLogger.WithError(err).Warnf(\"Error finding eligible nodes; can't count healthy nodes\")\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tnumHealthy := aggregateHealth.NumHealthyOf(eligible)\n\t\t\t\t\tnumUnhealthy := aggregateHealth.NumUnhealthyOf(eligible)\n\t\t\t\t\tnumUnknownHealth := aggregateHealth.NumUnknownHealthOf(eligible)\n\t\t\t\t\tnumWarningHealth := aggregateHealth.NumWarningHealthOf(eligible)\n\n\t\t\t\t\tfor _, name := range ds.MetricNames(\"healthy\") {\n\t\t\t\t\t\tgauge := metrics.GetOrRegisterGauge(name, p2metrics.Registry)\n\t\t\t\t\t\tgauge.Update(int64(numHealthy))\n\t\t\t\t\t}\n\n\t\t\t\t\tfor _, name := range ds.MetricNames(\"critical\") {\n\t\t\t\t\t\tgauge := metrics.GetOrRegisterGauge(name, p2metrics.Registry)\n\t\t\t\t\t\tgauge.Update(int64(numUnhealthy))\n\t\t\t\t\t}\n\n\t\t\t\t\tfor _, name := range ds.MetricNames(\"unknown\") {\n\t\t\t\t\t\tgauge := metrics.GetOrRegisterGauge(name, p2metrics.Registry)\n\t\t\t\t\t\tgauge.Update(int64(numUnknownHealth))\n\t\t\t\t\t}\n\n\t\t\t\t\tfor _, name := range ds.MetricNames(\"warning\") {\n\t\t\t\t\t\tgauge := metrics.GetOrRegisterGauge(name, p2metrics.Registry)\n\t\t\t\t\t\tgauge.Update(int64(numWarningHealth))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\tgo func() {\n\t\t// This loop will check the error channel of the child and if\n\t\t// the child's error channel closes, close the child.\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase err, ok := <-desiresCh:\n\t\t\t\tif err != nil {\n\t\t\t\t\tdsf.logger.Errorf(\"An error has occurred in spawned ds '%v':, %v\", ds.ID(), err)\n\t\t\t\t}\n\t\t\t\tif !ok {\n\t\t\t\t\t// child error channel closed\n\t\t\t\t\tdsf.logger.Errorf(\"Child ds '%v' error channel closed, removing ds now\", ds.ID())\n\t\t\t\t\tdsf.childMu.Lock()\n\t\t\t\t\tdsf.closeChild(ds.ID())\n\t\t\t\t\tdsf.childMu.Unlock()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\treturn &childDS{\n\t\tds: ds,\n\t\tcancel: cancel,\n\t\tupdatedCh: updatedCh,\n\t\tdeletedCh: deletedCh,\n\t\terrCh: desiresCh,\n\t\tunlocker: unlocker,\n\t}\n}", "title": "" }, { "docid": "9a114e6b15f42fb683041849b5f5094d", "score": "0.49398652", "text": "func New(root *cobra.Command) *DaemonOptions {\n\tvar opt *DaemonOptions\n\tif root == nil {\n\t\topt = &DaemonOptions{\n\t\t\tflags: pflag.NewFlagSet(os.Args[0], pflag.ContinueOnError),\n\t\t\tviper: viper.New(),\n\t\t}\n\t} else {\n\t\topt = &DaemonOptions{\n\t\t\tflags: root.PersistentFlags(),\n\t\t\tviper: viper.New(),\n\t\t}\n\t}\n\n\t// options for root and daemon\n\topt.flags.BoolVarP(&opt.ShowVersion, \"version\", \"v\", false,\n\t\t\"Print the version.\")\n\n\topt.flags.BoolVarP(&opt.ShowHelp, \"help\", \"h\", false,\n\t\t\"Print the helper info.\")\n\n\topt.flags.BoolVarP(&opt.ShowConfig, \"print-config\", \"c\", false,\n\t\t\"Print the configuration info.\")\n\n\topt.flags.StringVarP(&opt.ConfigFile, \"config-file\", \"f\", \"config.yaml\",\n\t\t\"Load server configuration from a yaml file rather than line flags.\")\n\n\thomeRoot, err := homedir.Expand(\"~/.pando\")\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"expand home dir failed when new options: %v\", err))\n\t}\n\topt.flags.StringVarP(&opt.PandoRoot, \"pando-root\", \"r\", homeRoot,\n\t\t\"Pando root directory which stores data and config file.\")\n\n\topt.flags.BoolVarP(&opt.DisableSpeedTest, \"disable-speedtest\", \"p\", false,\n\t\t\"Init server configuration without Internet connection speed test.\")\n\n\topt.flags.StringVar(&opt.LogLevel, \"log-level\", \"debug\",\n\t\t\"Log level of Pando.\")\n\n\t// options for server address\n\topt.flags.StringVar(&opt.ServerAddress.AdminListenAddress, \"admin-listen-addr\", defaultAdminListenAddress,\n\t\tfmt.Sprintf(\"Admin server listen address(in multiaddress format, like %s).\", defaultAdminListenAddress))\n\n\topt.flags.StringVar(&opt.ServerAddress.HttpAPIListenAddress, \"http-listen-addr\", defaultHttpAPIListenAddress,\n\t\tfmt.Sprintf(\"Http server listen address(in multiaddress format, like %s).\", defaultHttpAPIListenAddress))\n\n\topt.flags.StringVar(&opt.ServerAddress.GraphqlListenAddress, \"graphql-listen-addr\", defaultGraphqlListenAddress,\n\t\tfmt.Sprintf(\"Graphql server listen address(in multiaddress format, like %s).\", defaultGraphqlListenAddress))\n\n\topt.flags.StringVar(&opt.ServerAddress.ProfileListenAddress, \"profile-listen-addr\", defaultProfileListenAddress,\n\t\tfmt.Sprintf(\"Profile server listen address(in multiaddress format, like %s).\", defaultProfileListenAddress))\n\n\topt.flags.BoolVar(&opt.ServerAddress.DisableP2PServer, \"p2p-server-disable\", defaultDisableP2PServer,\n\t\t\"Disable libp2p server.\")\n\n\topt.flags.StringVar(&opt.ServerAddress.P2PAddress, \"p2p-address\", defaultP2PAddress,\n\t\tfmt.Sprintf(\"P2P hosting address(in multiaddress format, like %s).\", defaultP2PAddress))\n\n\topt.flags.StringVar(&opt.ServerAddress.ExternalIP, \"external-ip\", \"unknown\",\n\t\tfmt.Sprintf(\"Pando public IP address for API serve\"))\n\n\t// options for datastore\n\topt.flags.StringVar(&opt.DataStore.Type, \"datastore-type\", defaultDataStoreType,\n\t\t\"Datastore type, support levelds only for now.\")\n\n\topt.flags.StringVar(&opt.DataStore.Dir, \"datastore-dir\", defaultDataStoreDir,\n\t\t\"Directory of datastore files.\")\n\n\topt.flags.StringVar(&opt.DataStore.SnapShotInterval, \"snapshot-interval\", defaultSnapShotInterval,\n\t\t\"interval to generate snapshot for meta.\")\n\n\t// options for cachestore\n\topt.flags.StringVar(&opt.CacheStore.Dir, \"cachestore-dir\", defaultCacheStoreDir,\n\t\t\"Directory of cachestore files.\")\n\n\t// options for metastore\n\topt.flags.StringVar(&opt.MetaCache.Type, \"metacache\", defaultMetaCacheType,\n\t\t\"Type of metastore, only support mongodb for now\")\n\n\topt.flags.StringVar(&opt.MetaCache.ConnectionURI, \"metacache-connection-uri\", defaultMetaCacheConnectionURI,\n\t\t\"Connection URI of metacache\")\n\n\t// options for discovery\n\topt.flags.StringVar(&opt.Discovery.LotusGateway, \"discovery-lotus-gateway\", defaultLotusGateway,\n\t\t\"Lotus gateway address.\")\n\n\topt.flags.BoolVar(&opt.Discovery.Policy.Allow, \"discovery-policy-allow\", defaultAllow,\n\t\t\"Discovery allow all origin source host.\")\n\n\topt.flags.BoolVar(&opt.Discovery.Policy.Trust, \"discovery-policy-trust\", defaultTrust,\n\t\t\"Enable discovery white-list.\")\n\n\topt.Discovery.PollInterval = defaultPollInterval.String()\n\n\topt.Discovery.PollRetryAfter = defaultPollRetryAfter.String()\n\n\topt.Discovery.PollStopAfter = defaultPollStopAfter.String()\n\n\topt.Discovery.RediscoverWait = defaultRediscoverWait.String()\n\n\topt.Discovery.Timeout = defaultDiscoveryTimeout.String()\n\n\t// options for rate limits\n\topt.flags.IntSliceVar(&opt.AccountLevel.Threshold, \"account-level\", defaultAccountLevel,\n\t\t\"Rank the accounts then set rate limits for them.\")\n\n\topt.flags.BoolVar(&opt.RateLimit.Enable, \"ratelimit-enable\", defaultEnable,\n\t\t\"Enable rate limiter (default: false).\")\n\n\topt.flags.Float64Var(&opt.RateLimit.Bandwidth, \"ratelimit-bandwidth\", defaultBandwidth,\n\t\t\"Bandwidth of this runtime.\")\n\n\topt.flags.Float64Var(&opt.RateLimit.SingleDAGSize, \"ratelimit-single-dag-size\", defaultSingleDAGSize,\n\t\t\"Estimated single DAG size to receive from providers.\")\n\n\t// options for backup\n\topt.flags.StringVar(&opt.Backup.EstuaryGateway, \"backup-estuary-gateway\", defaultEstGateway,\n\t\t\"Estuary gateway address used to backup metadata files.\")\n\n\topt.flags.StringVar(&opt.Backup.ShuttleGateway, \"backup-shuttle-gateway\", defaultShuttleGateway,\n\t\t\"Estuary shuttle gateway address used to backup metadata files.\")\n\n\topt.flags.StringVar(&opt.Backup.APIKey, \"backup-apikey\", \"\",\n\t\t\"Estuary api key used to backup metadata files.\")\n\n\topt.flags.StringVar(&opt.Backup.BackupGenInterval, \"backup-gencar-interval\", defaultBackupGenInterval.String(),\n\t\t\"Interval for Pando to generate car files for providers' meta data.\")\n\n\topt.flags.StringVar(&opt.Backup.BackupEstInterval, \"backup-estuary-interval\", defaultBackupEstInterval.String(),\n\t\t\"Interval for Pando to back up car files to estuary.\")\n\n\topt.flags.StringVar(&opt.Backup.EstCheckInterval, \"backup-check-estuary-interval\", defaultEstCheckInterval.String(),\n\t\t\"Interval for Pando to check backup deal status in estuary.\")\n\n\t_ = opt.viper.BindPFlags(opt.flags)\n\n\treturn opt\n}", "title": "" }, { "docid": "220473e42db097c183c5a03835cc33aa", "score": "0.49374545", "text": "func newWorker(name string, poolSize int, queueMax int) pool {\n\tpool := pool{\n\t\tname: name,\n\t\tpoolSize: poolSize,\n\t\tchannel: make(chan interface{}, queueMax),\n\t}\n\treturn pool\n}", "title": "" }, { "docid": "5a6e5425798b079d5ad3e42c3a43207e", "score": "0.49203306", "text": "func NewCLUSTERS(config configuration.CONFIGURATION) *CLUSTERS_IMPL {\r\n client := new(CLUSTERS_IMPL)\r\n client.config = config\r\n return client\r\n}", "title": "" }, { "docid": "c3a2d7b9f6614649430e63281257d32f", "score": "0.4919169", "text": "func newDaemonSetForCR(cr *storageosv1.Job) (*appsv1.DaemonSet, error) {\n\tdefaultLabels := map[string]string{\n\t\t\"daemonset\": cr.Name + \"-daemonset-job\",\n\t\t\"job\": cr.Name,\n\t}\n\n\tselectorMap, err := labels.ConvertSelectorToLabelsMap(cr.Spec.GetLabelSelector())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Merge the default labels with the job label selector.\n\t// The label selector labels must be present in all the DaemonSet Pods.\n\tmergedLabels := labels.Merge(defaultLabels, selectorMap)\n\n\tdset := &appsv1.DaemonSet{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name + \"-daemonset-job\",\n\t\t\tNamespace: cr.Namespace,\n\t\t},\n\t\tSpec: appsv1.DaemonSetSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: mergedLabels,\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: mergedLabels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"job-container\",\n\t\t\t\t\t\t\tImage: cr.Spec.Image,\n\t\t\t\t\t\t\tArgs: cr.Spec.Args,\n\t\t\t\t\t\t\tVolumeMounts: []corev1.VolumeMount{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: \"target\",\n\t\t\t\t\t\t\t\t\tMountPath: cr.Spec.MountPath,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tVolumes: []corev1.Volume{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"target\",\n\t\t\t\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\t\t\t\tHostPath: &corev1.HostPathVolumeSource{\n\t\t\t\t\t\t\t\t\tPath: cr.Spec.HostPath,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\t// Add pod tolerations if defined.\n\ttolerations := cr.Spec.Tolerations\n\tfor i := range tolerations {\n\t\tif tolerations[i].Operator == corev1.TolerationOpExists && tolerations[i].Value != \"\" {\n\t\t\treturn nil, fmt.Errorf(\"key(%s): toleration value must be empty when `operator` is 'Exists'\", tolerations[i].Key)\n\t\t}\n\t}\n\tif len(tolerations) > 0 {\n\t\tdset.Spec.Template.Spec.Tolerations = cr.Spec.Tolerations\n\t}\n\n\t// Add node affinity if defined.\n\tif len(cr.Spec.NodeSelectorTerms) > 0 {\n\t\tdset.Spec.Template.Spec.Affinity = &corev1.Affinity{NodeAffinity: &corev1.NodeAffinity{\n\t\t\tRequiredDuringSchedulingIgnoredDuringExecution: &corev1.NodeSelector{\n\t\t\t\tNodeSelectorTerms: cr.Spec.NodeSelectorTerms,\n\t\t\t},\n\t\t}}\n\t}\n\n\treturn dset, nil\n}", "title": "" }, { "docid": "f5035d010b951275936a4c6f77543172", "score": "0.49158967", "text": "func newPackerManager(be Saver, key *crypto.Key) *packerManager {\n\treturn &packerManager{\n\t\tbe: be,\n\t\tkey: key,\n\t}\n}", "title": "" }, { "docid": "23cc8431bae7f579d6cd6824e77251e9", "score": "0.48983008", "text": "func newWorkersPool(\n\tread func(container *Container) (map[string][]byte, error),\n\trequests chan *workerRequest,\n\tresults chan *workerResponse,\n\tworkersCount int,\n) *workersPool {\n\tp := &workersPool{\n\t\tread: read,\n\t\trequests: requests,\n\t\tresults: results,\n\t\tstop: make(chan struct{}),\n\t}\n\tfor i := 0; i < workersCount; i++ {\n\t\tp.AddWorker()\n\t}\n\treturn p\n}", "title": "" }, { "docid": "147458d743c3048c40cf995155b39270", "score": "0.48958027", "text": "func newSTDOutputManager() *STDOutputManager {\n\treturn &STDOutputManager{}\n}", "title": "" }, { "docid": "9eaa9eaa4f376c2b68d49abd18c19f21", "score": "0.48944625", "text": "func createWorkerPool(workers int) error {\n\tfor w := 1; w <= workers; w++ {\n\t\tvar worker ReverseDNSWorker\n\t\tgo worker.start(w)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "953644f3664f806042145c85390563c8", "score": "0.48876294", "text": "func (test *Test) createDaemonSet(namespace string, d *appsv1.DaemonSet) error {\n\ttest.Debugf(\"creating daemonset %s\", d.Name)\n\n\td.Namespace = namespace\n\t_, err := test.harness.kubeClient.AppsV1().DaemonSets(namespace).Create(context.TODO(), d, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create daemonset %s: %w\", d.Name, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "23c33cac13f62613921c38fb26bcd308", "score": "0.4879595", "text": "func NewWorkers(twEpoch int64) (Workers, error) {\n\tif twEpoch == 0 {\n\t\ttwEpoch = DefaultTwEpoch\n\t}\n\tidWorkers := make(map[int32]*IDWorker)\n\tmaxID := -1 ^ (-1 << (workerIDBits + datacenterIDBits))\n\tfor idx := 0; idx <= maxID; idx++ {\n\t\tdatacenter := idx >> workerIDBits\n\t\tworker := idx & maxWorkerID\n\t\tidWorker, err := NewIDWorker(int32(worker), int32(datacenter), twEpoch)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"NewIdWorker(%d) error(%v)\", worker, err)\n\t\t\treturn nil, err\n\t\t}\n\t\tidWorkers[int32(idx)] = idWorker\n\t}\n\treturn Workers(idWorkers), nil\n}", "title": "" }, { "docid": "96cb9583a8acd8ef98b1aedf59932954", "score": "0.48752823", "text": "func newClientSet(runOutsideKcluster bool) (*kubernetes.Clientset, error) {\n\n\tkubeConfigLocation := \"\"\n\n\tif runOutsideKcluster == true {\n\t\thomeDir := os.Getenv(\"HOME\")\n\t\tkubeConfigLocation = filepath.Join(homeDir, \".kube\", \"config\")\n\t}\n\n\t// use the current context in kubeconfig\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", kubeConfigLocation)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn kubernetes.NewForConfig(config)\n}", "title": "" }, { "docid": "ed279ab30ccd80b5722399c76d00ad8e", "score": "0.48731288", "text": "func newDbusConnManager(rootless bool) *dbusConnManager {\n\tdbusMu.Lock()\n\tdefer dbusMu.Unlock()\n\tif dbusInited && rootless != dbusRootless {\n\t\tpanic(\"can't have both root and rootless dbus\")\n\t}\n\tdbusInited = true\n\tdbusRootless = rootless\n\treturn &dbusConnManager{}\n}", "title": "" }, { "docid": "d8a62647f2f0794b284902fcd7dfb1c3", "score": "0.48727807", "text": "func newDomainCLI(\n\tc *cli.Context,\n\tisAdminMode bool,\n) *domainCLIImpl {\n\n\tvar frontendClient serviceFrontend.Interface\n\tvar domainHandler domain.Handler\n\tif !isAdminMode {\n\t\tfrontendClient = initializeFrontendClient(c)\n\t} else {\n\t\tdomainHandler = initializeAdminDomainHandler(c)\n\t}\n\treturn &domainCLIImpl{\n\t\tfrontendClient: frontendClient,\n\t\tdomainHandler: domainHandler,\n\t}\n}", "title": "" }, { "docid": "bb539cf6b4e679b77a9d48831bcea697", "score": "0.4856308", "text": "func (fs *filesystem) createNewDaemon(snapshotID string, imageID string) (*daemon.Daemon, error) {\n\tvar (\n\t\td *daemon.Daemon\n\t\terr error\n\t)\n\tif d, err = daemon.NewDaemon(\n\t\tdaemon.WithSnapshotID(snapshotID),\n\t\tdaemon.WithSocketDir(fs.SocketRoot()),\n\t\tdaemon.WithConfigDir(fs.ConfigRoot()),\n\t\tdaemon.WithSnapshotDir(fs.SnapshotRoot()),\n\t\tdaemon.WithLogDir(fs.LogRoot()),\n\t\tdaemon.WithCacheDir(fs.cacheMgr.CacheDir()),\n\t\tdaemon.WithImageID(imageID),\n\t\tdaemon.WithLogLevel(fs.logLevel),\n\t); err != nil {\n\t\treturn nil, err\n\t}\n\tif err = fs.manager.NewDaemon(d); err != nil {\n\t\treturn nil, err\n\t}\n\treturn d, nil\n}", "title": "" }, { "docid": "2e4d59095590d59b14c787dfd4510a43", "score": "0.4839091", "text": "func New() *Mgr { return &Mgr{} }", "title": "" }, { "docid": "c695421544c902e53d1874e05549df45", "score": "0.4838341", "text": "func newWorker(factory *CallbackFactory, makeWorker WorkerFactory, options ...Option) (Worker, error) {\n\t// Create worker.\n\tw := &worker{\n\t\tfactory: factory,\n\t}\n\n\t// Apply configuration\n\tapplyDefaults(w)\n\tfor _, option := range options {\n\t\toption(w)\n\t}\n\n\t// Dial RPC server and add client to worker.\n\tif client, err := makeWorker(w.host); err == nil {\n\t\tw.client = client\n\t} else {\n\t\treturn nil, err\n\t}\n\n\t// Register RPC/gob data type.\n\tregisterTypes()\n\n\treturn w, nil\n}", "title": "" }, { "docid": "d6baa843ebbe1f5c77c4bfa2a1405c61", "score": "0.48181716", "text": "func (c *daemonstools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"daemonstools\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch(ctx)\n}", "title": "" }, { "docid": "a2e578eb6eebce9608a7fcc46cfd405e", "score": "0.48057637", "text": "func New(workers int) *Pool {\n\twg := &sync.WaitGroup{}\n\tinput := make(chan Work)\n\toutput := make(chan Work)\n\tstop := make(chan struct{})\n\tpool := &Pool{waiter: wg,\n\t\tTodo: input,\n\t\tResults: output,\n\t\tStop: stop,\n\t}\n\n\tfor i := 0; i < workers; i++ {\n\t\tw := &Worker{\n\t\t\twaiter: wg,\n\t\t\ttodo: input,\n\t\t\tresults: output,\n\t\t\tstop: stop,\n\t\t}\n\t\tpool.workers = append(pool.workers, w)\n\n\t\t// Increment the wait group\n\t\tpool.waiter.Add(1)\n\n\t\t// start the worker in it's own go routine\n\t\tgo pool.workers[i].Start()\n\t}\n\treturn pool\n}", "title": "" }, { "docid": "2023dd754dd18f97137bcde03d27b5d3", "score": "0.48022464", "text": "func newManager(options Options) *manager {\n\treturn &manager{\n\t\tclose: make(chan bool),\n\t\tclient: options.Client,\n\t\tnow: time.Now,\n\t\tsyncRate: defaultSyncRate,\n\t\tbuckets: map[string]*bucket{},\n\t\tbucketToSyncQueue: make(chan *bucket, syncQueueSize),\n\t\tbaseURL: options.BaseURL,\n\t\tnumSyncWorkers: defaultNumSyncWorkers,\n\t\tdupCache: ResultCache{size: resultCacheBufferSize},\n\t\tbucketsSyncing: map[*bucket]struct{}{},\n\t\torg: options.Org,\n\t}\n}", "title": "" }, { "docid": "c6f25444cfa4b7dc9ec34e55842f9549", "score": "0.48018634", "text": "func NewSwarm(t *testing.T, testEnv *environment.Execution, ops ...daemon.Option) *daemon.Daemon {\n\tt.Helper()\n\tskip.If(t, testEnv.IsRemoteDaemon)\n\tskip.If(t, testEnv.DaemonInfo.OSType == \"windows\")\n\tskip.If(t, testEnv.IsRootless, \"rootless mode doesn't support Swarm-mode\")\n\tif testEnv.DaemonInfo.ExperimentalBuild {\n\t\tops = append(ops, daemon.WithExperimental())\n\t}\n\td := daemon.New(t, ops...)\n\td.StartAndSwarmInit(t)\n\treturn d\n}", "title": "" }, { "docid": "023bd30dfb59559c7e34992af5d7b703", "score": "0.47983637", "text": "func newSimpleCertificateManager(cfg *certificateManagerConfig, w certificateWriter) (certificateManager, error) {\n\tif err := validateCertManagerConfig(cfg); err != nil {\n\t\treturn nil, err\n\t}\n\tif w == nil {\n\t\treturn nil, fmt.Errorf(\"certificate manager requires a certificate writer\")\n\t}\n\treturn &simpleCertificateManager{cfg, w, make(map[string]certificateFile, 0)}, nil\n}", "title": "" }, { "docid": "9b543f1da0b17ba05d9f1b8d35e90d8f", "score": "0.4788433", "text": "func newSecurityService(client drpc.DomainSocketClient) *SecurityService {\n\treturn &SecurityService{\n\t\tdrpc: client,\n\t}\n}", "title": "" }, { "docid": "3ec0cd40edc672e928dc360d6b31c1fe", "score": "0.47875664", "text": "func newBasicWalletManagementService(conf configure.Conf, logger log.Logger) (*basicWalletManagementService, error) {\n\tdb, err := orm.DB(conf.DBInfo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tredisPool := redis.NewPool(conf.Redis)\n\twkClient, err := walletKeyGrpcClient.New(conf.ConsulAddress, logger)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"walletKeyGrpcClient: %s\", err.Error())\n\t}\n\n\tbas := basicWalletManagementService{\n\t\tbiz: repository.New(redisPool, db),\n\t\tKeySrv: wkClient,\n\t}\n\treturn &bas, nil\n}", "title": "" }, { "docid": "5bb3cf3967cd4cf9848bdafdbead02d3", "score": "0.4784386", "text": "func newDraughtsmanConfigs(c *CoreV1alpha1Client, namespace string) *draughtsmanConfigs {\n\treturn &draughtsmanConfigs{\n\t\tclient: c.RESTClient(),\n\t\tns: namespace,\n\t}\n}", "title": "" }, { "docid": "356fbb08728a9bccd986200c74c0a083", "score": "0.47703758", "text": "func (r *RedisCache) newPool(servers []string, password string) *roundRobinPools {\n\tpools := make([]*redis.Pool, len(servers))\n\tfor i, s := range servers {\n\t\tpools[i] = &redis.Pool{\n\t\t\tMaxIdle: 3,\n\t\t\tIdleTimeout: 240 * time.Second,\n\t\t\tDial: func() (redis.Conn, error) {\n\t\t\t\tserver := s\n\t\t\t\tc, err := redis.Dial(\"tcp\", server)\n\t\t\t\tif err != nil {\n\t\t\t\t\tr.Log.Error(\"can not dial redis instance: \"+server, err)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif password != \"\" {\n\t\t\t\t\tif _, err := c.Do(\"AUTH\", password); err != nil {\n\t\t\t\t\t\tc.Close()\n\t\t\t\t\t\tr.Log.Error(\"incorrect redis password for instance: \"+server, err)\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn c, err\n\t\t\t},\n\t\t\tTestOnBorrow: func(c redis.Conn, t time.Time) error {\n\t\t\t\t_, err := c.Do(\"PING\")\n\t\t\t\treturn err\n\t\t\t},\n\t\t}\n\t}\n\treturn &roundRobinPools{\n\t\tpools: pools,\n\t}\n}", "title": "" }, { "docid": "41b8db4014f2eb501fd0d6ca5ae728a7", "score": "0.47635072", "text": "func New(cfg Config, opts ...Option) (*Dashboardd, error) {\n\td := &Dashboardd{\n\t\tConfig: cfg,\n\t\tstopping: make(chan struct{}, 1),\n\t\trunning: &atomic.Value{},\n\t\twg: &sync.WaitGroup{},\n\t\terrChan: make(chan error, 1),\n\t}\n\n\t// prepare server TLS config\n\ttlsServerConfig, err := cfg.TLS.ToServerTLSConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\td.httpServer = &http.Server{\n\t\tAddr: fmt.Sprintf(\"%s:%d\", d.Host, d.Port),\n\t\tHandler: httpRouter(d),\n\t\tWriteTimeout: 15 * time.Second,\n\t\tReadTimeout: 15 * time.Second,\n\t\tTLSConfig: tlsServerConfig,\n\t}\n\tfor _, o := range opts {\n\t\tif err := o(d); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn d, nil\n}", "title": "" }, { "docid": "0e65aafd1386583e698b061b0c728331", "score": "0.47618297", "text": "func NewDNSServer(domain string, randomize bool, maxIPsPerRecord int) *DNSServer {\n\treturn &DNSServer{\n\t\tDomain: domain + \".\",\n\t\tsoaRecord: dns.SOA{},\n\t\tsoaMutex: sync.RWMutex{},\n\t\taRecords: map[string][]net.IP{},\n\t\tnsRecords: map[string][]string{},\n\t\tnsMutex: sync.RWMutex{},\n\t\tcnameRecords: map[string]string{},\n\t\tsrvRecords: map[string][]SRVRecord{},\n\t\tcnameMutex: sync.RWMutex{},\n\t\taMutex: sync.RWMutex{},\n\t\tsrvMutex: sync.RWMutex{},\n\t\trandomize: randomize,\n\t\tmaxIPsPerRecord: maxIPsPerRecord,\n\t}\n}", "title": "" }, { "docid": "a5f4a897d51fc81de097f178c08299c5", "score": "0.47602293", "text": "func createSumService() *sumService {\r\n\t// load settings from environment variables\r\n\tname := quark.GetEnvVar(\"SUM_SERVICE_NAME\")\r\n\tversion := quark.GetEnvVar(\"SUM_SERVICE_VERSION\")\r\n\tgp := quark.GetEnvVar(\"SUM_SERVICE_PORT\")\r\n\tdiscovery := quark.GetEnvVar(\"DISCOVERY\")\r\n\ttAddr := quark.GetEnvVar(\"TRACER\")\r\n\tbAddr := quark.GetEnvVar(\"BROKER\")\r\n\r\n\tport, err := strconv.Atoi(gp)\r\n\tif err != nil {\r\n\t\tpanic(\"Incorrect port value!\")\r\n\t}\r\n\r\n\taddr, err := quark.GetHostAddress(port)\r\n\tif err != nil {\r\n\t\tpanic(\"Cannot resolve host address!\")\r\n\t}\r\n\r\n\t// initialize sumService service\r\n\ts := &sumService{\r\n\t\tServiceBase: quark.NewService(\r\n\t\t\tquark.Name(name),\r\n\t\t\tquark.Version(version),\r\n\t\t\tquark.Address(addr),\r\n\t\t\tquark.Discovery(consul.NewServiceDiscovery(discovery)),\r\n\t\t\tquark.Metrics(prometheus.NewMetricsExposer()),\r\n\t\t\tquark.Tracer(zipkin.NewTracer(tAddr, name, addr)),\r\n\t\t\tquark.Broker(rabbitmq.NewMessageBroker(bAddr))),\r\n\t}\r\n\ts.Log().SetLevel(logger.DebugLevel)\r\n\r\n\treturn s\r\n}", "title": "" }, { "docid": "48524297c90e6be6fbe68c1fce835b52", "score": "0.47524053", "text": "func NewPool(dsn string) Pool {\n\tp := Pool{pool: &sync.Pool{}}\n\tp.user, p.passw, p.sid = SplitDSN(dsn)\n\treturn p\n}", "title": "" }, { "docid": "e773b8ae748a2c14d1b69282d2eb5aa7", "score": "0.47489983", "text": "func New(cfg config.Config) (GarmDaemon, error) {\n\ttoken, err := service.NewTokenService(cfg.Token)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"token service instantiate failed\")\n\t}\n\n\tresolver := service.NewResolver(cfg.Mapping)\n\t// set up mapper\n\tcfg.Athenz.AuthZ.Mapper = service.NewResourceMapper(resolver)\n\tcfg.Athenz.AuthN.Mapper = service.NewUserMapper(resolver)\n\n\t// set token source (function pointer)\n\tcfg.Athenz.AuthZ.Token = token.GetToken\n\n\tathenz, err := service.NewAthenz(cfg.Athenz, service.NewLogger(cfg.Logger))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"athenz service instantiate failed\")\n\t}\n\n\treturn &garm{\n\t\tcfg: cfg,\n\t\ttoken: token,\n\t\tathenz: athenz,\n\t\tserver: service.NewServer(cfg.Server, router.New(cfg.Server, handler.New(athenz))),\n\t}, nil\n}", "title": "" }, { "docid": "0eeab9037a1e24ec7e917f5adac6e447", "score": "0.4748142", "text": "func (c *daemonstools) Update(ctx context.Context, daemonstool *v1beta1.Daemonstool, opts v1.UpdateOptions) (result *v1beta1.Daemonstool, err error) {\n\tresult = &v1beta1.Daemonstool{}\n\terr = c.client.Put().\n\t\tNamespace(c.ns).\n\t\tResource(\"daemonstools\").\n\t\tName(daemonstool.Name).\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tBody(daemonstool).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "d7ccaa7bfdb6e35ba0c7b35800657e09", "score": "0.4744622", "text": "func NewDPTool(verbose bool, user string, pass string) *DPTool {\n\treturn &DPTool{verbose, user, pass}\n}", "title": "" }, { "docid": "daa4644e994d9a0227f20fdcd0851f5d", "score": "0.47410807", "text": "func New(svc shortservice.Service, logger log.Logger, duration metrics.Histogram) Set {\n\tvar createEndpoint endpoint.Endpoint\n\t{\n\t\tcreateEndpoint = MakeCreateEndpoint(svc)\n\t\tcreateEndpoint = ratelimit.NewErroringLimiter(rate.NewLimiter(50, 1))(createEndpoint)\n\t\tcreateEndpoint = circuitbreaker.Gobreaker(gobreaker.NewCircuitBreaker(gobreaker.Settings{}))(createEndpoint)\n\t\tcreateEndpoint = LoggingMiddleware(log.With(logger, \"method\", \"Create\"))(createEndpoint)\n\t\tcreateEndpoint = InstrumentingMiddleware(duration.With(\"method\", \"Create\"))(createEndpoint)\n\t}\n\tvar lookupEndpoint endpoint.Endpoint\n\t{\n\t\tlookupEndpoint = MakeLookupEndpoint(svc)\n\t\tlookupEndpoint = ratelimit.NewErroringLimiter(rate.NewLimiter(100, 500))(lookupEndpoint)\n\t\tlookupEndpoint = circuitbreaker.Gobreaker(gobreaker.NewCircuitBreaker(gobreaker.Settings{}))(lookupEndpoint)\n\t\tlookupEndpoint = LoggingMiddleware(log.With(logger, \"method\", \"Lookup\"))(lookupEndpoint)\n\t\tlookupEndpoint = InstrumentingMiddleware(duration.With(\"method\", \"Lookup\"))(lookupEndpoint)\n\t}\n\treturn Set{\n\t\tCreateEndpoint: createEndpoint,\n\t\tLookupEndpoint: lookupEndpoint,\n\t}\n}", "title": "" }, { "docid": "3eda4fbbfd2a8ad619ca5a0e6036657b", "score": "0.47369742", "text": "func New() *Tool {\n\tvar obj Tool\n\tobj.InitObject(\"tool\")\n\treturn &obj\n}", "title": "" }, { "docid": "cfef7608020de945a1f1ebae990b148d", "score": "0.47366357", "text": "func New(address string) (Suite, error) {\n\ts := suite{\n\t\tresourceMap: make(map[string]*Resource),\n\t}\n\n\tpool, err := dockertest.NewPool(address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.pool = pool\n\n\treturn &s, nil\n}", "title": "" }, { "docid": "dc54822e8b4a35bcdfacc9079c808ba0", "score": "0.4733952", "text": "func GetDaemonlessClient(systemContext types.SystemContext, store storage.Store, isolationSpec, blobCacheDirectory string, imageOptimizationPolicy buildapiv1.ImageOptimizationPolicy) (client DockerClient, err error) {\n\treturn nil, errors.New(\"building images without an engine not supported on this platform\")\n}", "title": "" }, { "docid": "fb01136ffc5303aa61e1d86df6cec196", "score": "0.47263563", "text": "func newService(cfg ...Config) *Service {\n\tc := DefaultConfig()\n\tif len(cfg) > 0 {\n\t\tc = cfg[0]\n\t}\n\n\tr := &Service{Config: &c}\n\treturn r\n}", "title": "" }, { "docid": "ece0f713579770b2a04933de52ea3333", "score": "0.47256655", "text": "func New(c *Config) *Databus {\n\tif c.Buffer == 0 {\n\t\tc.Buffer = 1024\n\t}\n\td := &Databus{\n\t\tconf: c,\n\t\tmsgs: make(chan *Message, c.Buffer),\n\t\tmarked: make(map[int32]int64),\n\t\tclosed: _open,\n\t}\n\n\tif !c.Direct && env.DeployEnv != \"\" && env.DeployEnv != env.DeployEnvDev {\n\t\td.dis = discovery.Build(_appid)\n\t\te := d.dis.Watch()\n\t\tselect {\n\t\tcase <-e:\n\t\t\td.disc()\n\t\tcase <-time.After(10 * time.Second):\n\t\t\tpanic(\"init discovery err\")\n\t\t}\n\t\tgo d.discoveryproc(e)\n\t\tlog.Info(\"init databus discvoery info successfully\")\n\t}\n\tif c.Action == _actionSub || c.Action == _actionAll {\n\t\tif d.dis == nil {\n\t\t\td.d = d.dial\n\t\t} else {\n\t\t\td.d = d.dialInstance\n\t\t}\n\t\tgo d.subproc()\n\t}\n\tif c.Action == _actionPub || c.Action == _actionAll {\n\t\t// new pool\n\t\td.p = d.redisPool(c)\n\t\tif d.dis != nil {\n\t\t\td.p.New = func(ctx context.Context) (io.Closer, error) {\n\t\t\t\treturn d.dialInstance()\n\t\t\t}\n\t\t}\n\t}\n\treturn d\n}", "title": "" }, { "docid": "d1a318991edc07d0abb876c273c89c70", "score": "0.4720881", "text": "func newEngine(ctx context.Context, ws []*Worker, wts WorkerTasks) (*engine, error) {\n\n\tif ctx == nil {\n\t\treturn nil, errorf(\"nil context\")\n\t}\n\n\t// check workers and build a map from workerid to Worker\n\tworkers := map[WorkerID]*Worker{}\n\tfor _, w := range ws {\n\t\tif _, ok := workers[w.WorkerID]; ok {\n\t\t\treturn nil, errorf(\"duplicate worker: WorkerID=%q\", w.WorkerID)\n\t\t}\n\t\tif w.Instances <= 0 || w.Instances > maxInstances {\n\t\t\treturn nil, errorf(\"instances must be in 1..%d range: WorkerID=%q\", maxInstances, w.WorkerID)\n\t\t}\n\t\tif w.Work == nil {\n\t\t\treturn nil, errorf(\"work function cannot be nil: WorkerID=%q\", w.WorkerID)\n\t\t}\n\t\tworkers[w.WorkerID] = w\n\t}\n\n\t// create each taskID context\n\twidtasks := WorkerTasks{}\n\n\tfor wid, ts := range wts {\n\t\t// for empty task lists, continue\n\t\tif len(ts) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\t// check the worker exists\n\t\tif _, ok := workers[wid]; !ok {\n\t\t\treturn nil, errorf(\"tasks for undefined worker: WorkerID=%q\", wid)\n\t\t}\n\t\t// save the task list of the worker in the engine\n\t\twidtasks[wid] = ts\n\t}\n\n\treturn &engine{\n\t\tworkers: workers,\n\t\twidtasks: widtasks,\n\t\tctx: ctx,\n\t\tworkersList: ws,\n\t}, nil\n}", "title": "" }, { "docid": "2ff4dccd64d4cb416e3e3099be797246", "score": "0.47147822", "text": "func NewDB(opt *Option, scriptDB int, redisScriptDefinition string, scripts *map[string]string) (*Scriptor, error) {\n\tif opt == nil {\n\t\treturn nil, errors.New(\"'option' cannot be nil\")\n\t}\n\n\t// new scriptor\n\ts := &Scriptor{}\n\ts.sRedisClientSyncOnce.Do(func() {\n\t\ts.Client = opt.Create()\n\t\ts.scripts = make(map[string]string)\n\t\ts.redisScriptDB = scriptDB\n\n\t\t// if redisScriptDefinition is not empty, use the default\n\t\tif redisScriptDefinition != \"\" {\n\t\t\ts.redisScriptDefinition = redisScriptDefinition\n\t\t} else {\n\t\t\ts.redisScriptDefinition = scriptDefinition\n\t\t}\n\t})\n\n\ts.CTX = context.Background()\n\n\t// ping the redis server\n\t_, err := s.Client.Ping(s.CTX).Result()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// load all scripts or register scripts\n\tscriptDescriptor, err := NewScriptDescriptor(s.CTX, s.Client, scripts, s.redisScriptDefinition, s.redisScriptDB)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.scripts = scriptDescriptor.contrainer\n\n\treturn s, nil\n}", "title": "" }, { "docid": "48c69456812b4a9a9685d87ddbd1dbbd", "score": "0.4713957", "text": "func NewLibstore(masterServerHostPort, myHostPort string, mode LeaseMode) (Libstore, error) {\n\tcli, err := rpc.DialHTTP(\"tcp\", masterServerHostPort)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlibstore := &libstore{client: cli}\n\tlibstore.myHostPort = myHostPort\n\tlibstore.masterServerHostPort = masterServerHostPort\n\tlibstore.mode = mode\n\tlibstore.connections = make(map[string]*rpc.Client)\n\tlibstore.queryTimestamps = make(map[string][]time.Time)\n\tlibstore.leases = make(map[string]storagerpc.Lease)\n\tlibstore.cache = make(map[string]interface{})\n\tlibstore.lock = &sync.Mutex{}\n\tlibstore.connections[masterServerHostPort] = cli\n\t// Get all storage server nodes.\n\ttryTimes := 0\n\targs := &storagerpc.GetServersArgs{}\n\treply := &storagerpc.GetServersReply{}\n\tfor tryTimes < 5 {\n\t\tcli.Call(\"StorageServer.GetServers\", args, reply)\n\t\tif reply.Status == storagerpc.OK {\n\t\t\tfmt.Println(\"reply OK\")\n\t\t\tbreak\n\t\t}\n\t\tfmt.Println(reply.Status)\n\t\ttryTimes++\n\t\ttime.Sleep(1000 * time.Millisecond)\n\t}\n\tlibstore.storageServerNodes = reply.Servers\n\tsort.Sort(ByID(libstore.storageServerNodes))\n\t// upbound := len(libstore.storageServerNodes)\n\t// i := 1\n\t// fmt.Println(\"before try\")\n\t// for i < upbound {\n\t// \tnode := libstore.storageServerNodes[i]\n\t// \tconn, _ := rpc.DialHTTP(\"tcp\", node.HostPort)\n\t// \tlibstore.connections[node.HostPort] = conn\n\t// }\n\t//lib := new(librpc.RemoteLeaseCallbacks)\n\trpc.RegisterName(\"LeaseCallbacks\", librpc.Wrap(libstore))\n\treturn libstore, nil\n}", "title": "" }, { "docid": "2291dd04565b3bd89eda7574e1e81f25", "score": "0.47137097", "text": "func newDefaultWorkerService() *WorkerService {\n\treturn &WorkerService{\n\t\tWorkload: Workload{\n\t\t\tType: aws.String(manifestinfo.WorkerServiceType),\n\t\t},\n\t\tWorkerServiceConfig: WorkerServiceConfig{\n\t\t\tImageConfig: ImageWithHealthcheck{},\n\t\t\tSubscribe: SubscribeConfig{},\n\t\t\tTaskConfig: TaskConfig{\n\t\t\t\tCPU: aws.Int(256),\n\t\t\t\tMemory: aws.Int(512),\n\t\t\t\tCount: Count{\n\t\t\t\t\tValue: aws.Int(1),\n\t\t\t\t\tAdvancedCount: AdvancedCount{ // Leave advanced count empty while passing down the type of the workload.\n\t\t\t\t\t\tworkloadType: manifestinfo.WorkerServiceType,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tExecuteCommand: ExecuteCommand{\n\t\t\t\t\tEnable: aws.Bool(false),\n\t\t\t\t},\n\t\t\t},\n\t\t\tNetwork: NetworkConfig{\n\t\t\t\tVPC: vpcConfig{\n\t\t\t\t\tPlacement: PlacementArgOrString{\n\t\t\t\t\t\tPlacementString: placementStringP(PublicSubnetPlacement),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tEnvironments: map[string]*WorkerServiceConfig{},\n\t}\n}", "title": "" }, { "docid": "8a02084aea90b7c7662242cf0a43f9b4", "score": "0.47129452", "text": "func NewTool(driver *ToolComponent) *Tool {\n\treturn &Tool{\n\t\tDriver: driver,\n\t}\n}", "title": "" }, { "docid": "8a02084aea90b7c7662242cf0a43f9b4", "score": "0.47129452", "text": "func NewTool(driver *ToolComponent) *Tool {\n\treturn &Tool{\n\t\tDriver: driver,\n\t}\n}", "title": "" }, { "docid": "9b07fc141d0a02979260d39bfabea9c6", "score": "0.47126678", "text": "func newDogstatsdAgent(conf *MConf) (d *DataDogAgentClient, err error) {\n\tdefer recoverFromPanic(&err)\n\n\td = new(DataDogAgentClient)\n\terr = d.Init(conf)\n\tif err != nil {\n\t\tlogMsg(errMsgTag, err, conf)\n\t\treturn nil, err\n\t}\n\treturn d, err\n}", "title": "" }, { "docid": "d9b374498c997449ebfa9c40b328f8e5", "score": "0.4710735", "text": "func BatchNewDrand(t *testing.T, n int, insecure bool, sch *crypto.Scheme, beaconID string, opts ...ConfigOption) (\n\tdaemons []*DrandDaemon, drands []*BeaconProcess, group *key.Group, dir string, certPaths []string,\n) {\n\tt.Logf(\"Creating %d nodes for beaconID %s\", n, beaconID)\n\tvar privs []*key.Pair\n\tif insecure {\n\t\tprivs, group = test.BatchIdentities(n, sch, beaconID)\n\t} else {\n\t\tprivs, group = test.BatchTLSIdentities(n, sch, beaconID)\n\t}\n\n\tports := test.Ports(n)\n\tdaemons = make([]*DrandDaemon, n)\n\tdrands = make([]*BeaconProcess, n)\n\n\t// notice t.TempDir means the temp directory is deleted thanks to t.Cleanup at the end\n\tdir = t.TempDir()\n\n\tcertPaths = make([]string, n)\n\tkeyPaths := make([]string, n)\n\tdirs := make([]string, n)\n\n\tfor i := 0; i < n; i++ {\n\t\tdirs[i] = path.Join(dir, fmt.Sprintf(\"drand-%d\", i))\n\t\tif err := os.MkdirAll(dirs[i], 0o777); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\tif !insecure {\n\t\tfor i := 0; i < n; i++ {\n\t\t\tcertPath := path.Join(dirs[i], fmt.Sprintf(\"server-%d.crt\", i))\n\t\t\tkeyPath := path.Join(dirs[i], fmt.Sprintf(\"server-%d.key\", i))\n\n\t\t\tif httpscerts.Check(certPath, keyPath) != nil {\n\t\t\t\th, _, err := gnet.SplitHostPort(privs[i].Public.Address())\n\t\t\t\trequire.NoError(t, err)\n\t\t\t\terr = httpscerts.Generate(certPath, keyPath, h)\n\t\t\t\trequire.NoError(t, err)\n\t\t\t}\n\t\t\tcertPaths[i] = certPath\n\t\t\tkeyPaths[i] = keyPath\n\t\t}\n\t}\n\n\tfor i := 0; i < n; i++ {\n\t\ts := test.NewKeyStore()\n\n\t\trequire.NoError(t, s.SaveKeyPair(privs[i]))\n\n\t\t// give each one their own private folder\n\t\tconfOptions := []ConfigOption{\n\t\t\tWithConfigFolder(dirs[i]),\n\t\t}\n\n\t\tconfOptions = append(confOptions, WithTestDB(t, test.ComputeDBName())...)\n\t\tconfOptions = append(confOptions, WithPrivateListenAddress(privs[i].Public.Address()))\n\t\tif !insecure {\n\t\t\tconfOptions = append(confOptions,\n\t\t\t\tWithTLS(certPaths[i], keyPaths[i]),\n\t\t\t\tWithTrustedCerts(certPaths...))\n\t\t} else {\n\t\t\tconfOptions = append(confOptions, WithInsecure())\n\t\t}\n\n\t\tconfOptions = append(confOptions,\n\t\t\tWithControlPort(ports[i]),\n\t\t\tWithLogLevel(test.LogLevel(t), false),\n\t\t\tWithMemDBSize(100),\n\t\t)\n\t\t// add options in last so it overwrites the default\n\t\tconfOptions = append(confOptions, opts...)\n\n\t\tt.Logf(\"Creating node %d\", i)\n\n\t\tdaemon, err := NewDrandDaemon(NewConfig(confOptions...))\n\t\trequire.NoError(t, err)\n\n\t\tbp, err := daemon.InstantiateBeaconProcess(beaconID, s)\n\t\trequire.NoError(t, err)\n\n\t\tdaemons[i] = daemon\n\t\tdrands[i] = bp\n\n\t\t// Make sure to stop all daemon after each test\n\t\tt.Cleanup(func() {\n\t\t\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\t\t\tdefer cancel()\n\t\t\tdaemon.Stop(ctx)\n\t\t})\n\t}\n\n\treturn daemons, drands, group, dir, certPaths\n}", "title": "" }, { "docid": "587a52b12e602df3ef1f7211e3566968", "score": "0.4708736", "text": "func New(middleware []Middleware, db repo.PostgresDatabase) DevelopmentKitService {\n\tvar svc DevelopmentKitService = NewBasicDevelopmentKitService(db)\n\tfor _, m := range middleware {\n\t\tsvc = m(svc)\n\t}\n\treturn svc\n}", "title": "" }, { "docid": "ee8db9e9ea4c92b8fe8da2cb3f769118", "score": "0.47075897", "text": "func newPool(server, password string, db int) *redis.Pool {\n\treturn &redis.Pool{\n\t\tMaxIdle: 3,\n\t\tIdleTimeout: 240 * time.Second,\n\t\tDial: func() (redis.Conn, error) {\n\t\t\tc, err := redis.Dial(\"tcp\", server, redis.DialDatabase(db))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif password != \"\" {\n\t\t\t\tif _, err := c.Do(\"AUTH\", password); err != nil {\n\t\t\t\t\tc.Close()\n\t\t\t\t\tlog.Errorf(\"occur error at newPool: %v\\n\", err)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn c, err\n\t\t},\n\t\tTestOnBorrow: func(c redis.Conn, t time.Time) error {\n\t\t\t_, err := c.Do(\"PING\")\n\t\t\treturn err\n\t\t},\n\t}\n}", "title": "" }, { "docid": "5bba31b9281899583b7f428d0859ff82", "score": "0.47028613", "text": "func NewPool(workers int) (pool *Pool) {\n\tpool = new(Pool)\n\tpool.numWorkers = workers\n\tpool.jobWantedPipe = make(chan chan *Job)\n\tpool.donePipe = make(chan *Job)\n\tpool.addPipe = make(chan *Job)\n\tpool.resultWantedPipe = make(chan chan *Job)\n\tpool.jobsReadyToRun = list.New()\n\tpool.jobsCompleted = list.New()\n\tpool.workingWantedPipe = make(chan chan bool)\n\tpool.statsWantedPipe = make(chan chan stats)\n\tpool.workerKillPipe = make(chan bool)\n\tpool.supervisorKillPipe = make(chan bool)\n\tpool.interval = 1\n\t// start the supervisor here so we can accept jobs before a Run call\n\tpool.startSupervisor()\n\treturn\n}", "title": "" }, { "docid": "40eb4572fdf278e6d7f7f4cf70af090a", "score": "0.47006118", "text": "func newGroup(p Params) Group {\n\trun := &multiple{\n\t\tLogger: p.Logger,\n\t\tService: group.New(group.WithShutdownTimeout(p.Shutdown)),\n\t}\n\n\tp.Logger.Info(\"added workers\", zap.Int(\"count\", len(p.Group)))\n\n\tfor i := range p.Group {\n\t\tif p.Group[i] == nil {\n\t\t\tp.Logger.Warn(\"ignore nil service\", zap.Int(\"position\", i))\n\n\t\t\tcontinue\n\t\t}\n\n\t\trun.Add(run.prepareActor(p.Group[i]))\n\t}\n\n\treturn run\n}", "title": "" }, { "docid": "aabc47de135550a45cec6ee774060dc8", "score": "0.4695003", "text": "func New(ds ds.Datastore, wm ffs.WalletManager, sched ffs.Scheduler) (*Manager, error) {\n\treturn &Manager{\n\t\tauth: auth.New(ds),\n\t\tds: ds,\n\t\twm: wm,\n\t\tsched: sched,\n\t\tinstances: make(map[ffs.APIID]*api.API),\n\t}, nil\n}", "title": "" } ]
52f3c799a190eb73b29c079035765f12
NewAnnouncement creates a new announcement and starts its goroutine
[ { "docid": "bfd6e35eccff45ed9a20653c943ebe21", "score": "0.67519796", "text": "func NewAnnouncement(line string) (*Announcement, error) {\n\tvar announcement Announcement\n\n\terr := announcement.parse(line)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &announcement, nil\n}", "title": "" } ]
[ { "docid": "f9bf5a1e681aa0416ee890834595cb21", "score": "0.6654848", "text": "func NewAnnouncementServer(ctx context.Context, cmd chan<- command) *AnnouncementServer {\n\tvar as AnnouncementServer\n\tas.announcements = make([]*Announcement, 0, 1)\n\tas.commandQueue = cmd\n\tas.ctx = ctx\n\n\tgo as.start()\n\n\treturn &as\n}", "title": "" }, { "docid": "499e28b89f28a79140bbbb64d11645e1", "score": "0.62525266", "text": "func AnnounceNew(id ID, ob Item) *Announce {\n\ta := ActivityNew(id, AnnounceType, ob)\n\to := Announce(*a)\n\treturn &o\n}", "title": "" }, { "docid": "8e31328a7d627c448781ba30a06ec159", "score": "0.56962126", "text": "func NewServiceAnnouncementAttachment()(*ServiceAnnouncementAttachment) {\n m := &ServiceAnnouncementAttachment{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "7daa9b3452ec1dfdf41f1ab7bf67d763", "score": "0.5685762", "text": "func (a *Announce) Announce(i *api.Instance, ttl time.Duration) error {\n\tdata, err := json.Marshal(i)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq, err := http.NewRequest(\"PUT\", a.endpoint+\"/v0/node/instances/\"+a.app, bytes.NewBuffer(data))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err := a.client.Do(req)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// currently we do not care about body, though it may have a useful error in it\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusCreated {\n\t\treturn fmt.Errorf(\"unexpected status: %d\", resp.StatusCode)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ab7c5a4a91c0e4000da474715cab6b2c", "score": "0.56191933", "text": "func (as *AnnouncementServer) AddAnnouncement(line string) error {\n\n\tannouncement, err := NewAnnouncement(line)\n\tif err != nil {\n\t\treturn err\n\t}\n\tas.Lock()\n\tdefer as.Unlock()\n\n\tas.announcements = append(as.announcements, announcement)\n\treturn nil\n}", "title": "" }, { "docid": "d792662571983962536d2ba4da2fc246", "score": "0.5608937", "text": "func (a *AnnouncementHandler) PostAnnouncement(ctx *fasthttp.RequestCtx) {\n\tvar input model.InputAnnouncement\n\n\tparam := ctx.UserValue(\"ukmID\").(string)\n\n\tukmID, _ := strconv.Atoi(param)\n\n\tbody := ctx.Request.Body()\n\t_ = json.Unmarshal(body, &input)\n\n\tctx.Response.Header.SetContentType(\"application/json\")\n\n\tresult, err := a.AnnouncementUC.ValidationPostAnnouncement(context.Background(), ukmID, input)\n\tif err != nil {\n\t\t_ = json.NewEncoder(ctx).Encode(err)\n\t\treturn\n\t}\n\n\t_ = json.NewEncoder(ctx).Encode(result)\n}", "title": "" }, { "docid": "9cc7db50a156e259feaa36d526c1e33f", "score": "0.5564466", "text": "func NewServiceAnnouncementBase()(*ServiceAnnouncementBase) {\n m := &ServiceAnnouncementBase{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "a6aecbb4f92151335a13b463cfe2f0b6", "score": "0.5521726", "text": "func (a *announcer) Announcing(resultCh chan<- *AnnounceResult) error {\n\tvar res *AnnounceResult\n\tvar err error\n\tvar interval int\n\n\tlogs.Debug(\"Announcer\", \"Starting announcer to %s\", a.url)\n\tres, interval, err = a.announce(\"started\")\n\tif err != nil {\n\t\tclose(resultCh)\n\t\treturn fmt.Errorf(\"Failed to announce started: %s\", err)\n\t}\n\n\tresultCh <- res\n\n\tfor {\n\t\tselect {\n\t\tcase <-time.After(time.Second * time.Duration(interval)):\n\t\t\tlogs.Debug(\"Announcer\", \"Announcing regularly to %s\", a.url)\n\t\t\tres, interval, err = a.announce(\"\")\n\t\t\tif err != nil {\n\t\t\t\tclose(resultCh)\n\t\t\t\treturn fmt.Errorf(\"Failed to announce regularly: %s\", err)\n\t\t\t}\n\n\t\t\tresultCh <- res\n\t\tcase signal := <-a.signalCh:\n\t\t\t// signifies stop\n\t\t\tif signal {\n\t\t\t\tlogs.Debug(\"Announcer\", \"Announcing stopped to %s\", a.url)\n\t\t\t\ta.announce(\"stopped\")\n\t\t\t\tclose(resultCh)\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tlogs.Debug(\"Announcer\", \"Announcing completed to %s\", a.url)\n\t\t\t\tres, interval, err = a.announce(\"completed\")\n\t\t\t\tif err != nil {\n\t\t\t\t\tclose(resultCh)\n\t\t\t\t\treturn fmt.Errorf(\"Failed to announce completed: %s\", err)\n\t\t\t\t}\n\n\t\t\t\tresultCh <- res\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "57e32fc5abd78d0c93011da5f61844bf", "score": "0.5396077", "text": "func (a *Actor) Announce(url string) {\n\t// our announcements are public. Public stuff have a \"To\" to the url below\n\ttoURL := []string{\"https://www.w3.org/ns/activitystreams#Public\"}\n\thash, id := a.newItemID()\n\n\tannounce := make(map[string]interface{})\n\n\tannounce[\"@context\"] = context()\n\tannounce[\"id\"] = id\n\tannounce[\"type\"] = \"Announce\"\n\tannounce[\"object\"] = url\n\tannounce[\"actor\"] = a.iri\n\tannounce[\"to\"] = toURL\n\n\t// cc this to all our followers one by one\n\t// I've seen activities to just include the url of the\n\t// collection but for now this works.\n\n\t// It seems that sharedInbox will be deprecated\n\t// so this is probably a better idea anyway (#APConf)\n\tannounce[\"cc\"] = a.followersSlice()\n\n\t// add a timestamp\n\tannounce[\"published\"] = time.Now().Format(time.RFC3339)\n\n\ta.appendToOutbox(announce[\"id\"].(string))\n\ta.saveItem(hash, announce)\n\ta.sendToFollowers(announce)\n}", "title": "" }, { "docid": "55075c2519ad99453f40cf64b9a51f5e", "score": "0.5361702", "text": "func (starkdb *Db) publishAnnouncement(message []byte) error {\n\tif !starkdb.isOnline() {\n\t\treturn ErrNodeOffline\n\t}\n\tif len(starkdb.project) == 0 {\n\t\treturn ErrNoProject\n\t}\n\treturn starkdb.ipfsClient.SendMessage(starkdb.ctx, starkdb.project, message)\n}", "title": "" }, { "docid": "cae580fa7d77649793306fe2a3f289f4", "score": "0.53166324", "text": "func makeSignedAnnouncement(na modules.NetAddress) ([]byte, error) {\n\tsk, pk, err := crypto.GenerateKeyPair()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tspk := types.SiaPublicKey{\n\t\tAlgorithm: types.SignatureEd25519,\n\t\tKey: pk[:],\n\t}\n\treturn modules.CreateAnnouncement(na, spk, sk)\n}", "title": "" }, { "docid": "20efc6e969734e355180abc51d5567d4", "score": "0.5303504", "text": "func (c *Volley) NewAcknowledgement(pb.Journal) message.Message { return new(Volley) }", "title": "" }, { "docid": "81de7f44ea04239d75306dd9c2b32b0a", "score": "0.5223011", "text": "func Announce(topic string, channel string, port int, ips []string) *Command {\n\tvar params = [][]byte{[]byte(topic), []byte(channel), []byte(strconv.Itoa(port))}\n\treturn &Command{[]byte(\"ANNOUNCE\"), params, []byte(strings.Join(ips, \"\\n\"))}\n}", "title": "" }, { "docid": "d771f542837efd1e994c505cc7802126", "score": "0.51917523", "text": "func (c *Client) Announce(req poke.AnnounceRequest) (poke.OptionalAnnounceResponse, error) {\n\tif ip := req.IP.To4(); ip != nil {\n\t\treq.IP = ip\n\t}\n\n\tif poke.Debug {\n\t\tlog.Printf(\"Announcing: %+v\", req)\n\t}\n\n\tif c.autoConnect {\n\t\tconnID, err := c.manualConnect()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tc.connectionID = connID\n\t}\n\n\ttransactionID := atomic.AddUint32(tid, 1)\n\ttoReturn := poke.AnnounceResponse{\n\t\tPeers: make([]poke.Peer, 0),\n\t}\n\tpacket, err := prepareAnnounce(req, c.connectionID, transactionID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Prepare a receive buffer.\n\tbuf := make([]byte, 1024)\n\n\t// Send announce.\n\t_, err = c.conn.Write(packet)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Receive response.\n\tn, err := c.conn.Read(buf)\n\tif err != nil {\n\t\tif strings.HasSuffix(err.Error(), \"i/o timeout\") {\n\t\t\treturn nil, errors.New(\"announce: I/O timeout on receive\")\n\t\t}\n\t\treturn nil, fmt.Errorf(\"announce: %s\", err)\n\t}\n\tif n < 20 {\n\t\treturn nil, errors.New(\"announce: Did not receive at least 20 bytes\")\n\t}\n\n\t// Check transaction ID.\n\ttransID := binary.BigEndian.Uint32(buf[4:8])\n\tif transID != transactionID {\n\t\treturn nil, errors.New(\"announce: transaction IDs do not match\")\n\t}\n\n\t// Parse action.\n\taction := binary.BigEndian.Uint32(buf[:4])\n\tif action != 1 {\n\t\tif action == 3 {\n\t\t\terrVal := string(buf[8:n])\n\t\t\treturn poke.ErrorResponse(errVal), nil\n\t\t\t//return nil, fmt.Errorf(\"announce: tracker responded with error: %s\", errVal)\n\t\t}\n\t\treturn nil, errors.New(\"announce: tracker responded with action != 1\")\n\t}\n\n\ttoReturn.Interval = int(binary.BigEndian.Uint32(buf[8:12]))\n\ttoReturn.Incomplete = int(binary.BigEndian.Uint32(buf[12:16]))\n\ttoReturn.Complete = int(binary.BigEndian.Uint32(buf[16:20]))\n\n\tif (n-20)%6 != 0 {\n\t\treturn nil, fmt.Errorf(\"announce: unexpected announce response length: %d\", n)\n\t}\n\n\tnumPeers := (n - 20) / 6\n\tfor i := 0; i < numPeers; i++ {\n\t\ttoReturn.Peers = append(toReturn.Peers,\n\t\t\tpoke.Peer{\n\t\t\t\tIP: net.IP(buf[20+6*i : 24+6*i]),\n\t\t\t\tPort: binary.BigEndian.Uint16(buf[24+6*i : 26+6*i]),\n\t\t\t})\n\t}\n\n\tif poke.Debug {\n\t\tlog.Printf(\"Got announce response: %+v\", toReturn)\n\t}\n\n\treturn toReturn, nil\n}", "title": "" }, { "docid": "6efc4a51577b9fed5a9dc494427a8157", "score": "0.51090235", "text": "func NewAnnounceAnswer(interval, minInterval int, peers []models.Peer) *models.AnnounceAnswer {\n\tpeers_clean := make([]interface{}, len(peers))\n\tfor index, item := range peers {\n\t\tpeer := make(map[string]interface{}, 3)\n\t\tpeer[\"id\"] = item.PeerId\n\t\tpeer[\"ip\"] = item.Ip\n\t\tpeers_clean[index] = peer\n\t}\n\treturn &models.AnnounceAnswer{interval, minInterval, peers_clean}\n}", "title": "" }, { "docid": "056e3affa29834290ed3948fa203cb39", "score": "0.5104705", "text": "func (h AnnounceHandler) ServeAnnounce(w AnnounceResponseWriter, r *AnnounceRequest) {\n\tctx := context.Background()\n\th(ctx, w, r)\n}", "title": "" }, { "docid": "71776390e3a073b4f349dfdf63b19593", "score": "0.5050851", "text": "func New(app string, options ...OptionFunc) (*Announce, error) {\n\ta := &Announce{\n\t\tapp: app,\n\t\tendpoint: DefaultEndpoint,\n\t\tclient: &http.Client{\n\t\t\tTimeout: time.Duration(5 * time.Second),\n\t\t},\n\t}\n\n\tfor _, option := range options {\n\t\tif err := option(a); err != nil {\n\t\t\tf := runtime.FuncForPC(reflect.ValueOf(option).Pointer()).Name()\n\t\t\treturn nil, fmt.Errorf(\"failure in function %s: %s\", f, err)\n\t\t}\n\t}\n\n\treturn a, nil\n}", "title": "" }, { "docid": "73154e02bdc407f84b9a9bf1f9ad2de9", "score": "0.49710703", "text": "func (a *AnnouncementRepository) Posting(ctx context.Context, ukmID int, input model.InputAnnouncement) (*ent.Announcement, error) {\n\tannouncement, err := a.DB.Announcement.Create().\n\t\tSetTitle(input.Title).\n\t\tSetDescription(input.Description).\n\t\tSetTime(input.Time).\n\t\tSetOwnerAnnouncementID(ukmID).\n\t\tSave(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn announcement, nil\n}", "title": "" }, { "docid": "ca1f180768fbda4cdff810a8252507fe", "score": "0.49407542", "text": "func (o *InlineResponse20054Projects) SetAnnouncement(v string) {\n\to.Announcement = &v\n}", "title": "" }, { "docid": "16a2f49d6c0a2c3e358f070fd972b7d7", "score": "0.49356875", "text": "func Announce(mAddr, srcAddr, name string) error {\n\tif name == \"\" {\n\t\treturn fmt.Errorf(\"announce: empty name is not valid\")\n\t}\n\n\tgo respondToQueries(mAddr, srcAddr, name)\n\n\treturn Broadcast(mAddr, srvc{typ: TypeAnnounce, name: name, srcAddr: srcAddr}.String())\n}", "title": "" }, { "docid": "bf1d4b5cfa98dce8c916991d678e8dda", "score": "0.48980564", "text": "func NewPrefixAnnouncement(data *Data) (*PrefixAnnouncement, error) {\n\tp := new(PrefixAnnouncement)\n\tp.data = data\n\tif !p.Valid() {\n\t\treturn nil, errors.New(\"PrefixAnnouncement name does not meet requirements\")\n\t}\n\treturn p, nil\n}", "title": "" }, { "docid": "3d8789712551800d1d20c549ea458cb6", "score": "0.48766246", "text": "func NewAnnouncementRepository(db *ent.Client) announcement.RepositoryAnnouncement {\n\treturn &AnnouncementRepository{DB: db}\n}", "title": "" }, { "docid": "032e52aaeb74c78eeb912b3cd6c7a9f9", "score": "0.484524", "text": "func (o *NiaapiSoftwareEolAllOf) SetAnnouncementDate(v time.Time) {\n\to.AnnouncementDate = &v\n}", "title": "" }, { "docid": "42789f4420ac6e3c95ad393066760863", "score": "0.479088", "text": "func (a *AnnouncementHandler) GetAnnouncement(ctx *fasthttp.RequestCtx) {\n\tparam := ctx.UserValue(\"ukmID\").(string)\n\n\tukmID, _ := strconv.Atoi(param)\n\n\tctx.Response.Header.SetContentType(\"application/json\")\n\n\tresult, err := a.AnnouncementUC.GetSpecificAnnouncement(context.Background(), ukmID)\n\tif err != nil {\n\t\t_ = json.NewEncoder(ctx).Encode(err)\n\t\treturn\n\t}\n\n\t_ = json.NewEncoder(ctx).Encode(result)\n}", "title": "" }, { "docid": "b7b4716e0d3c0e528398647883ee081d", "score": "0.47908443", "text": "func NewNetworkConfigServiceAnnouncement() *NetworkConfigServiceAnnouncement {\n\tthis := NetworkConfigServiceAnnouncement{}\n\treturn &this\n}", "title": "" }, { "docid": "4637f7f86848d494764df6fc5a299f5b", "score": "0.47767654", "text": "func Announce(\n\tctx context.Context,\n\trrclass dns.RRClass,\n\tname, serviceType, protocol string,\n\tpriority, weight, port uint16,\n\ttext map[string]string,\n) error {\n\treturn DefaultServices.Announce(ctx, rrclass, name, serviceType, protocol, priority, weight, port, text)\n}", "title": "" }, { "docid": "5faf0bbcae10e3c3ddd80e446ec050d1", "score": "0.47360843", "text": "func (o *InlineResponse20054Projects) SetShowAnnouncement(v bool) {\n\to.ShowAnnouncement = &v\n}", "title": "" }, { "docid": "e0c7b1515bbc542bc800ad3707d24e9e", "score": "0.4727546", "text": "func NewAnnouncementHandler(announcementUC announcement.UsecaseAnnouncement) *AnnouncementHandler {\n\treturn &AnnouncementHandler{AnnouncementUC: announcementUC}\n}", "title": "" }, { "docid": "c7af0c1358a2a817c38cb25f7a7acd2f", "score": "0.47252902", "text": "func (n *Node) newAdvertisement() *advertisement {\n\treturn &advertisement{\n\t\tVersionType: vrrpVersionType,\n\t\tVRID: n.VRID,\n\t\tPriority: n.Priority,\n\t\tAdvertInt: uint16(n.MasterAdvertInterval / time.Millisecond / 10), // AdvertInt is in centiseconds\n\t}\n}", "title": "" }, { "docid": "1e643815c1ad346d5b2582783d76e01a", "score": "0.4720942", "text": "func (consensus *Consensus) announce(block *types.Block) {\n\tblockHash := block.Hash()\n\tcopy(consensus.blockHash[:], blockHash[:])\n\n\t// prepare message and broadcast to validators\n\tencodedBlock, err := rlp.EncodeToBytes(block)\n\tif err != nil {\n\t\tconsensus.getLogger().Debug().Msg(\"[Announce] Failed encoding block\")\n\t\treturn\n\t}\n\tencodedBlockHeader, err := rlp.EncodeToBytes(block.Header())\n\tif err != nil {\n\t\tconsensus.getLogger().Debug().Msg(\"[Announce] Failed encoding block header\")\n\t\treturn\n\t}\n\n\tconsensus.block = encodedBlock\n\tconsensus.blockHeader = encodedBlockHeader\n\tmsgToSend := consensus.constructAnnounceMessage()\n\n\t// save announce message to FBFTLog\n\tmsgPayload, _ := proto.GetConsensusMessagePayload(msgToSend)\n\t// TODO(chao): don't unmarshall the message here and direclty pass the original object.\n\tmsg := &msg_pb.Message{}\n\t_ = protobuf.Unmarshal(msgPayload, msg)\n\tFPBTMsg, err := ParseFBFTMessage(msg)\n\tif err != nil {\n\t\tconsensus.getLogger().Warn().Err(err).Msg(\"[Announce] Unable to parse FPBT message\")\n\t\treturn\n\t}\n\n\t// TODO(chao): review FPBT log data structure\n\tconsensus.FBFTLog.AddMessage(FPBTMsg)\n\tconsensus.getLogger().Debug().\n\t\tStr(\"MsgBlockHash\", FPBTMsg.BlockHash.Hex()).\n\t\tUint64(\"MsgViewID\", FPBTMsg.ViewID).\n\t\tUint64(\"MsgBlockNum\", FPBTMsg.BlockNum).\n\t\tMsg(\"[Announce] Added Announce message in FPBT\")\n\tconsensus.FBFTLog.AddBlock(block)\n\n\t// Leader sign the block hash itself\n\tconsensus.Decider.AddSignature(\n\t\tquorum.Prepare, consensus.PubKey, consensus.priKey.SignHash(consensus.blockHash[:]),\n\t)\n\tif err := consensus.prepareBitmap.SetKey(consensus.PubKey, true); err != nil {\n\t\tconsensus.getLogger().Warn().Err(err).Msg(\"[Announce] Leader prepareBitmap SetKey failed\")\n\t\treturn\n\t}\n\n\t// Construct broadcast p2p message\n\tif err := consensus.msgSender.SendWithRetry(\n\t\tconsensus.blockNum, msg_pb.MessageType_ANNOUNCE, []nodeconfig.GroupID{\n\t\t\tnodeconfig.NewGroupIDByShardID(nodeconfig.ShardID(consensus.ShardID)),\n\t\t}, host.ConstructP2pMessage(byte(17), msgToSend)); err != nil {\n\t\tconsensus.getLogger().Warn().\n\t\t\tStr(\"groupID\", string(nodeconfig.NewGroupIDByShardID(\n\t\t\t\tnodeconfig.ShardID(consensus.ShardID),\n\t\t\t))).\n\t\t\tMsg(\"[Announce] Cannot send announce message\")\n\t} else {\n\t\tconsensus.getLogger().Info().\n\t\t\tStr(\"blockHash\", block.Hash().Hex()).\n\t\t\tUint64(\"blockNum\", block.NumberU64()).\n\t\t\tMsg(\"[Announce] Sent Announce Message!!\")\n\t}\n\n\tconsensus.getLogger().Debug().\n\t\tStr(\"From\", consensus.phase.String()).\n\t\tStr(\"To\", FBFTPrepare.String()).\n\t\tMsg(\"[Announce] Switching phase\")\n\tconsensus.switchPhase(FBFTPrepare, true)\n}", "title": "" }, { "docid": "0ff3d4b4aa397725fa91f3d0a4782116", "score": "0.46993047", "text": "func (as *AnnouncementServer) Get(index int) (Announcement, error) {\n\tas.Lock()\n\tdefer as.Unlock()\n\n\tif index < 0 || index >= len(as.announcements) {\n\t\treturn Announcement{}, errors.New(\"invalid announcement index\")\n\t}\n\n\toriginal := as.announcements[index]\n\n\tcpy := Announcement{\n\t\tDelay: original.Delay,\n\t\tMessage: original.Message,\n\t}\n\n\treturn cpy, nil\n}", "title": "" }, { "docid": "c4053d049053764b5d1131c1e67fca77", "score": "0.4674812", "text": "func (as *AnnouncementServer) Delete(index int) (Announcement, error) {\n\tas.Lock()\n\tdefer as.Unlock()\n\n\tif index < 0 || index >= len(as.announcements) {\n\t\treturn Announcement{}, errors.New(\"invalid announcement index\")\n\t}\n\n\ta := as.announcements[index]\n\n\t// create copy without cancel & context\n\tcpy := Announcement{\n\t\tDelay: a.Delay,\n\t\tMessage: a.Message,\n\t}\n\n\tas.announcements = append(as.announcements[:index], as.announcements[index+1:]...)\n\treturn cpy, nil\n}", "title": "" }, { "docid": "685085da0e6c75afd7e66ba76e8be6c3", "score": "0.4661844", "text": "func Announce(message string, delay time.Duration) {\n\tgo func() {\n\t\ttime.Sleep(delay)\n\t\tfmt.Println(message)\n\t}() // Note the parentheses - must call the function.\n}", "title": "" }, { "docid": "0d9a55bf02b1779ae50ff5cc5b1915f6", "score": "0.46449837", "text": "func (o *InlineResponse20054Projects) HasAnnouncement() bool {\n\tif o != nil && o.Announcement != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6087e5a31e6e1813326960ef4da9d800", "score": "0.46211037", "text": "func newActivity(a *Agent) *activity {\n\tnewAAIs := world.NewAAIs(a.unitId)\n\n\tac := &activity{\n\t\tatomicActionInterfaces: map[*world.AtomicActionInterface]*atomicActionType{},\n\t}\n\n\tfor aai := range newAAIs {\n\t\taat := a.newAtomicActionType(aai)\n\t\tac.atomicActionInterfaces[aai] = aat\n\t\ta.mind.addItem(aat, 1.0)\n\t}\n\ta.mind.mergeNewThoughts()\n\n\treturn ac\n}", "title": "" }, { "docid": "b82bd41b25d5b3422ed762b945e45577", "score": "0.45541996", "text": "func (a *AnnouncementHandler) UpdateAnnouncement(ctx *fasthttp.RequestCtx) {\n\tvar input model.InputAnnouncement\n\n\tparam := ctx.UserValue(\"announcementID\").(string)\n\n\tannoncementID, _ := strconv.Atoi(param)\n\n\tbody := ctx.Request.Body()\n\t_ = json.Unmarshal(body, &input)\n\n\tctx.Response.Header.SetContentType(\"application/json\")\n\n\tresult, err := a.AnnouncementUC.UpdateOneAnnouncement(context.Background(), annoncementID, input)\n\tif err != nil {\n\t\t_ = json.NewEncoder(ctx).Encode(err)\n\t\treturn\n\t}\n\n\t_ = json.NewEncoder(ctx).Encode(result)\n}", "title": "" }, { "docid": "67d30228fece198caae98c685022081d", "score": "0.45155182", "text": "func NewApproval()(*Approval) {\n m := &Approval{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "403c6dfc31ea20cde8dbe97059008e31", "score": "0.45029256", "text": "func NewAnnouncer(name string, port int) *Announcer {\n\tif port < 0 || port > 65535 {\n\t\tpanic(\"port number outside of legal range\")\n\t}\n\tif strings.Contains(name, \":\") {\n\t\tpanic(\"service name contains illegal colon\")\n\t}\n\treturn &Announcer{\n\t\tname: name,\n\t\tport: port,\n\t\twg: &sync.WaitGroup{},\n\t}\n}", "title": "" }, { "docid": "4e3adbc45c315304e9bbbb370c4f870d", "score": "0.4470174", "text": "func FindAnnouncements(mctx MetaContext, unreadOnly bool) (newAnncs bool, err error) {\n\tmessages, err := mctx.API().GetTextMessages(mctx.Prog.AnnounceChannel, unreadOnly)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\t// Do not read anything older than hour.\n\tcutoff := time.Now().Add(-1 * time.Hour)\n\tfor _, msg := range messages {\n\t\tsentAt := time.Unix(msg.SentAt, 0)\n\t\tif sentAt.Before(cutoff) {\n\t\t\tbreak\n\t\t}\n\t\tkbdev := KBDev{\n\t\t\tDevice: msg.Sender.DeviceName,\n\t\t\tUsername: msg.Sender.Username,\n\t\t}\n\t\tpeer, ok := mctx.Prog.KeybasePeers[kbdev]\n\t\tif !ok {\n\t\t\t// Sender is not a peer\n\t\t\tcontinue\n\t\t}\n\n\t\tif peer.Active && msg.Id <= peer.LastAnnouncement.MessageID {\n\t\t\t// We've already seen this one.\n\t\t\tcontinue\n\t\t}\n\n\t\tparsed, ok := ParseAnnounceMsg(msg.Content.Text.Body)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tparsed.SentAt = sentAt\n\t\tparsed.MessageID = msg.Id\n\n\t\tpeer.Active = true\n\t\tpeer.Endpoint = parsed.Endpoint\n\t\tpeer.PublicKey = parsed.PublicKey\n\n\t\tpeer.LastAnnouncement = parsed\n\t\tmctx.Prog.KeybasePeers[kbdev] = peer\n\n\t\tfmt.Printf(\"+ %v is announcing %q (msg ID: %d)\\n\", kbdev, msg.Content.Text.Body, msg.Id)\n\t\tnewAnncs = true\n\t}\n\treturn newAnncs, nil\n}", "title": "" }, { "docid": "bdca58823ddea9f0ea5e78ec4a69d1ae", "score": "0.4455488", "text": "func New(nodeID string, module *pubsub.Module) *Module {\n\tm := &Module{pubsubClient: module, nodeID: nodeID, cbs: map[string]func(){}}\n\n\t// Start the background routines\n\tgo m.applyForLeaderPosition()\n\tgo m.renewYourLeaderPosition()\n\n\treturn m\n}", "title": "" }, { "docid": "432dfcd8bee05ba3f1dbf7be5cf03603", "score": "0.44112188", "text": "func New(name string, handlers ...NotificationHandler) *Actor {\n\tcfg, err := config.ActorBotClientInfo(name)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tc, err := client.New(&cfg)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tlog.SLogger.Debugf(\"init the actor %s.\", name)\n\n\treturn &Actor{\n\t\tName: name,\n\t\tLineCh: make(chan string),\n\t\tBlockCh: make(chan string),\n\t\tUnBlockCh: make(chan string),\n\t\tNtfHandler: handlers,\n\t\tclient: c,\n\t\tisListening: false,\n\t}\n}", "title": "" }, { "docid": "3aca0d2612d2cc4b16684e0c241c5031", "score": "0.44101018", "text": "func (t *HTTPTracker) Announce(ctx context.Context, req tracker.AnnounceRequest) (*tracker.AnnounceResponse, error) {\n\t// Some private trackers require that first two parameters be info_hash and peer_id.\n\t// This is the reason we don't use url.Values to encode query params.\n\tvar sb strings.Builder\n\tsb.WriteString(t.rawURL)\n\tif strings.ContainsRune(t.rawURL, '?') {\n\t\tsb.WriteString(\"&info_hash=\")\n\t} else {\n\t\tsb.WriteString(\"?info_hash=\")\n\t}\n\tsb.WriteString(percentEscape(req.Torrent.InfoHash))\n\tsb.WriteString(\"&peer_id=\")\n\tsb.WriteString(percentEscape(req.Torrent.PeerID))\n\tsb.WriteString(\"&port=\")\n\tsb.WriteString(strconv.Itoa(req.Torrent.Port))\n\tsb.WriteString(\"&uploaded=\")\n\tsb.WriteString(strconv.FormatInt(req.Torrent.BytesUploaded, 10))\n\tsb.WriteString(\"&downloaded=\")\n\tsb.WriteString(strconv.FormatInt(req.Torrent.BytesDownloaded, 10))\n\tsb.WriteString(\"&left=\")\n\tsb.WriteString(strconv.FormatInt(req.Torrent.BytesLeft, 10))\n\tsb.WriteString(\"&compact=1\")\n\tsb.WriteString(\"&no_peer_id=1\")\n\tsb.WriteString(\"&numwant=\")\n\tsb.WriteString(strconv.Itoa(req.NumWant))\n\n\tif req.Event != tracker.EventNone {\n\t\tsb.WriteString(\"&event=\")\n\t\tsb.WriteString(req.Event.String())\n\t}\n\tif t.trackerID != \"\" {\n\t\tsb.WriteString(\"&trackerid=\")\n\t\tsb.WriteString(t.trackerID)\n\t}\n\tsb.WriteString(\"&key=\")\n\tsb.WriteString(hex.EncodeToString(req.Torrent.PeerID[16:20]))\n\n\tt.log.Debugf(\"making request to: %q\", sb.String())\n\n\thttpReq, err := http.NewRequest(http.MethodGet, sb.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thttpReq = httpReq.WithContext(ctx)\n\n\thttpReq.Header.Set(\"User-Agent\", t.userAgent)\n\n\tdoReq := func() (int, http.Header, []byte, error) {\n\t\tresp, err := t.http.Do(httpReq)\n\t\tif err != nil {\n\t\t\treturn 0, nil, nil, err\n\t\t}\n\t\tt.log.Debugf(\"tracker responded %d with %d bytes body\", resp.StatusCode, resp.ContentLength)\n\t\tdefer resp.Body.Close()\n\t\tif resp.ContentLength > t.maxResponseLength {\n\t\t\treturn 0, resp.Header, nil, fmt.Errorf(\"tracker respsonse too large: %d\", resp.ContentLength)\n\t\t}\n\t\tr := io.LimitReader(resp.Body, t.maxResponseLength)\n\t\tdata, err := ioutil.ReadAll(r)\n\t\treturn resp.StatusCode, resp.Header, data, err\n\t}\n\n\tcode, header, body, err := doReq()\n\tif uerr, ok := err.(*url.Error); ok && uerr.Err == context.Canceled {\n\t\treturn nil, context.Canceled\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tt.log.Debugf(\"read %d bytes from body\", len(body))\n\n\tvar response announceResponse\n\terr = bencode.DecodeBytes(body, &response)\n\tif err != nil {\n\t\tif code != 200 {\n\t\t\treturn nil, &StatusError{\n\t\t\t\tCode: code,\n\t\t\t\tHeader: header,\n\t\t\t\tBody: string(body),\n\t\t\t}\n\t\t}\n\t\treturn nil, tracker.ErrDecode\n\t}\n\n\tif response.FailureReason != \"\" {\n\t\tretryIn, _ := strconv.Atoi(response.RetryIn)\n\t\treturn nil, &tracker.Error{\n\t\t\tFailureReason: response.FailureReason,\n\t\t\tRetryIn: time.Duration(retryIn) * time.Minute,\n\t\t}\n\t}\n\n\tif response.TrackerID != \"\" {\n\t\tt.trackerID = response.TrackerID\n\t}\n\n\t// Peers may be in binary or dictionary model.\n\tvar peers []*net.TCPAddr\n\tif len(response.Peers) > 0 {\n\t\tif response.Peers[0] == 'l' {\n\t\t\tpeers, err = parsePeersDictionary(response.Peers)\n\t\t} else {\n\t\t\tvar b []byte\n\t\t\terr = bencode.DecodeBytes(response.Peers, &b)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, tracker.ErrDecode\n\t\t\t}\n\t\t\tpeers, err = tracker.DecodePeersCompact(b)\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tt.log.Debugf(\"got %d peers\", len(peers))\n\n\t// Filter external IP\n\tif len(response.ExternalIP) != 0 {\n\t\tvar filtered int\n\t\tfor i, p := range peers {\n\t\t\tif !bytes.Equal(p.IP[:], response.ExternalIP) {\n\t\t\t\tpeers[i] = p\n\t\t\t\tfiltered++\n\t\t\t}\n\t\t}\n\t\tpeers = peers[:filtered]\n\t}\n\n\treturn &tracker.AnnounceResponse{\n\t\tInterval: time.Duration(response.Interval) * time.Second,\n\t\tMinInterval: time.Duration(response.MinInterval) * time.Second,\n\t\tLeechers: response.Incomplete,\n\t\tSeeders: response.Complete,\n\t\tPeers: peers,\n\t\tWarningMessage: response.WarningMessage,\n\t}, nil\n}", "title": "" }, { "docid": "5002154b2afccef490323fa9d15037f3", "score": "0.4399887", "text": "func (d *DHT) OnAnnouncePeer(msg kmsg.Msg, remote *net.UDPAddr) error {\n\tif msg.A == nil {\n\t\treturn fmt.Errorf(\"bad message no A: %v\", msg)\n\t}\n\n\ttarget := msg.A.InfoHash\n\tif len(target) != 20 {\n\t\treturn fmt.Errorf(\"bad info_hash len: %v\", msg)\n\t}\n\n\ttoken := msg.A.Token\n\tif token == \"\" {\n\t\treturn fmt.Errorf(\"bad token len: %v\", token)\n\t}\n\n\tif d.tokenServer.ValidToken(token, remote) == false {\n\t\treturn d.Error(remote, msg.T, kmsg.ErrorBadToken)\n\t}\n\n\tpeer := &Peer{IP: remote.IP, Port: msg.A.Port}\n\tif msg.A.ImpliedPort != 0 {\n\t\tpeer.Port = remote.Port\n\t}\n\tadded := d.peerStore.AddPeer(target, *peer)\n\tif added == false {\n\t\treturn fmt.Errorf(\"add peer failed added: %v\", added)\n\t}\n\n\treturn d.Respond(remote, msg.T, kmsg.Return{})\n}", "title": "" }, { "docid": "2fb62c9e9b1d7d70bc931916277c887c", "score": "0.43986943", "text": "func TestHTTPAnnounce(t *testing.T) {\n\tlog.Println(\"TestHTTPAnnounce()\")\n\n\t// Load config\n\tconfig, err := common.LoadConfig()\n\tif err != nil {\n\t\tt.Fatalf(\"Could not load configuration: %s\", err.Error())\n\t}\n\tcommon.Static.Config = config\n\n\t// Generate mock data.FileRecord\n\tfile := data.FileRecord{\n\t\tInfoHash: \"6465616462656566303030303030303030303030\",\n\t\tVerified: true,\n\t}\n\n\t// Save mock file\n\tif err := file.Save(); err != nil {\n\t\tt.Fatalf(\"Failed to save mock file: %s\", err.Error())\n\t}\n\n\t// Generate fake announce query\n\tquery := url.Values{}\n\tquery.Set(\"info_hash\", \"deadbeef\")\n\tquery.Set(\"ip\", \"127.0.0.1\")\n\tquery.Set(\"port\", \"5000\")\n\tquery.Set(\"uploaded\", \"0\")\n\tquery.Set(\"downloaded\", \"0\")\n\tquery.Set(\"left\", \"0\")\n\n\t// Create a HTTP tracker, trigger an announce\n\ttracker := HTTPTracker{}\n\tres := tracker.Announce(query, file)\n\tlog.Println(string(res))\n\n\t// Unmarshal response\n\tannounce := AnnounceResponse{}\n\tif err := bencode.Unmarshal(bytes.NewReader(res), &announce); err != nil {\n\t\tt.Fatalf(\"Failed to unmarshal bencode announce response\")\n\t}\n\n\t// Delete mock file\n\tif err := file.Delete(); err != nil {\n\t\tt.Fatalf(\"Failed to delete mock file: %s\", err.Error())\n\t}\n}", "title": "" }, { "docid": "c980dcaa3569cc1715456e84a501fb57", "score": "0.43922085", "text": "func newAgent(config agentConfig) (*agent, error) {\n\tif err := config.checkAndSetDefaults(); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tnoop := func() {}\n\treturn &agent{\n\t\tagentConfig: config,\n\t\tstate: AgentInitial,\n\t\tcancel: noop,\n\t\tdrainCancel: noop,\n\t\tdoneConnecting: make(chan struct{}),\n\t\tproxySigner: config.proxySigner,\n\t}, nil\n}", "title": "" }, { "docid": "9984625d1a96c92fecac2f5b7941b961", "score": "0.43905553", "text": "func New(config *Config) (*Agent, error) {\n\tif err := config.validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tag := &Agent{\n\t\tconfig: config,\n\t\ttasks: make(map[string]*api.Task),\n\t\tassigned: make(map[string]*api.Task),\n\t\tcontrollers: make(map[string]exec.Controller),\n\t\treports: make(map[string]taskStatusReport),\n\t\tshutdown: make(map[string]struct{}),\n\t\tremove: make(map[string]struct{}),\n\n\t\tstatusq: make(chan taskStatusReport),\n\t\tremovedq: make(chan string),\n\n\t\tstarted: make(chan struct{}),\n\t\tready: make(chan struct{}),\n\t\tstopped: make(chan struct{}),\n\t\tclosed: make(chan struct{}),\n\t}\n\treturn ag, nil\n}", "title": "" }, { "docid": "1eedb760e34ff6db1a0da196b8dc89f6", "score": "0.4389698", "text": "func newMember(s *discordgo.Session, event *discordgo.GuildMemberAdd) {\n\ts.ChannelMessageSend(ANNOUNCEID, \"New member joined. Welcome @\"+event.Member.User.Username)\n\n}", "title": "" }, { "docid": "7dfec152383780a2b4d9654f30b6a4f4", "score": "0.43832135", "text": "func AnnounceHandler(ctx *macaron.Context, log *logs.BeeLogger) (int, []byte) {\n\tconst bencodErrFormat = \"d8:failure reason%d:%se\"\n\tinfoHash, peer, err := getAnnounceInput(ctx)\n\tif err != nil {\n\t\treturn 200, []byte(fmt.Sprintf(bencodErrFormat, len(err.Error()), err.Error()))\n\t}\n\n\tif resp, err := bttracker.TS.Announce(infoHash, peer); err != nil {\n\t\treturn 200, []byte(fmt.Sprintf(bencodErrFormat, len(err.Error()), err.Error()))\n\t} else {\n\t\treturn 200, resp\n\t}\n}", "title": "" }, { "docid": "fa91c7991289146ecb63fdd1bacaac00", "score": "0.43651938", "text": "func (r *Resolver) ProjectAnnouncement() generated.ProjectAnnouncementResolver {\n\treturn &projectAnnouncementResolver{r}\n}", "title": "" }, { "docid": "49a5b99244286eac25758de2a8fc0cbb", "score": "0.43582502", "text": "func New(b *beat.Beat, cfg *common.Config) (beat.Beater, error) {\n\tconfig := config.DefaultConfig\n\tif err := cfg.Unpack(&config); err != nil {\n\t\treturn nil, fmt.Errorf(\"Error reading config file: %v\", err)\n\t}\n\n\tbt := &Nvidiagpubeat{\n\t\tdone: make(chan struct{}),\n\t\tconfig: config,\n\t}\n\treturn bt, nil\n}", "title": "" }, { "docid": "19010e7cdf91992bcf191c5c217d5d3e", "score": "0.4339826", "text": "func New() Announcer {\n\treturn Announcer{\n\t\twriteLog: true,\n\t}\n}", "title": "" }, { "docid": "53b08a9bf4d692d62fd88f5db6e62ef3", "score": "0.43389505", "text": "func (a *Announcement) Dial() (*grpc.ClientConn, error) {\n\tif a.NetAddress == \"\" {\n\t\treturn nil, errors.New(\"Can not dial this component\")\n\t}\n\tif a.Certificate == \"\" {\n\t\treturn api.Dial(strings.Split(a.NetAddress, \",\")[0])\n\t}\n\treturn api.DialWithCert(strings.Split(a.NetAddress, \",\")[0], a.Certificate)\n}", "title": "" }, { "docid": "0894610a8ecee10fea548dded7d65fa6", "score": "0.4333617", "text": "func NewAgent(config *config.Config) (*Agent, error) {\n\ta := &Agent{\n\t\tConfig: config,\n\t}\n\treturn a, nil\n}", "title": "" }, { "docid": "702b03d86cb63a16f654839a5e06f0d8", "score": "0.4332896", "text": "func (h *ThreadsService) handleAnnounce(thrd *Thread, hash mh.Multihash, block *pb.ThreadBlock) error {\n\tif _, err := thrd.handleAnnounceBlock(hash, block); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "532b783ea770905b10f462f4d49466df", "score": "0.43286", "text": "func(articleCtrl *ArticleController) PostArticleNew(w http.ResponseWriter, r *http.Request){\n\tarticleCtrl.Init(w,r,\"ArticleController\")\n\tfmt.Println(\"PostArticleNew\")\n\t//data:=articleCtrl.Params\n\t//id,_:= strconv.ParseInt(articleCtrl.Request.Form[\"id\"][0],0,64)\n\tok:= services.ArticleService.AddArticle(articleCtrl.Params)\n\tio.WriteString(w,fmt.Sprintf(\"%v\",ok))\n\t/*\n\tarticleCtrl.Layout=append(articleCtrl.Layout,\"master/header.tpl\") \n\tarticleCtrl.Layout=append(articleCtrl.Layout,\"master/footer.tpl\") \n\tarticleCtrl.Layout=append(articleCtrl.Layout,\"article/list.tpl\") \n\tarticleCtrl.TplNames=\"content\"\n\terr:=articleCtrl.Render()\n\tif err!=nil{\n\t\tfmt.Println(\"render article post error\",err)\n\t}\n\t*/\n}", "title": "" }, { "docid": "fa0a6e067a524280367baeb046e72621", "score": "0.43243855", "text": "func New(ds ClusterDAGService, p *api.AddParams, out chan *api.AddedOutput) *Adder {\n\t// Discard all progress update output as the caller has not provided\n\t// a channel for them to listen on.\n\tif out == nil {\n\t\tout = make(chan *api.AddedOutput, 100)\n\t\tgo func() {\n\t\t\tfor range out {\n\t\t\t}\n\t\t}()\n\t}\n\n\treturn &Adder{\n\t\tdgs: ds,\n\t\tparams: p,\n\t\toutput: out,\n\t}\n}", "title": "" }, { "docid": "aa4db5b9e614a20e186cc543d9185a6b", "score": "0.42978376", "text": "func NewNotification()(*Notification) {\n m := &Notification{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "d1efc42ddf14c91af496c978e0f4777c", "score": "0.42970434", "text": "func AnnounceAlive(nt, usn string, location interface{}, server string, maxAge int, localAddr string) error {\n\tlocProv, err := toLocationProvider(location)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// dial multicast UDP packet.\n\tconn, err := multicast.Listen(&multicast.AddrResolver{Addr: localAddr})\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\t// build and send message.\n\taddr, err := multicast.SendAddr()\n\tif err != nil {\n\t\treturn err\n\t}\n\tmsg := &aliveDataProvider{\n\t\thost: addr,\n\t\tnt: nt,\n\t\tusn: usn,\n\t\tlocation: locProv,\n\t\tserver: server,\n\t\tmaxAge: maxAge,\n\t}\n\tif _, err := conn.WriteTo(msg, addr); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cf7c0c969aff1830ecac485273185de3", "score": "0.42794245", "text": "func (a *AnnouncementRepository) Delete(ctx context.Context, announcementID int) error {\n\terr := a.DB.Announcement.DeleteOneID(\n\t\tannouncementID,\n\t).\n\t\tExec(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bc85f6d9ee8e6f8180c844768c789779", "score": "0.42758465", "text": "func NewHamAnnounce() (*HamAnnounce, error) {\n\ta := HamAnnounce{}\n\tvar err error\n\tif a.reAnnounce, err = regexp.Compile(`^announce\\s+(.*)$`); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &a, nil\n}", "title": "" }, { "docid": "37d15cdf96afdd2886bd9a53a6dbec19", "score": "0.42749202", "text": "func (c *ArticlesController) New(ctx *fiber.Ctx) error {\n\tctx.Render(\"articles/new\", fiber.Map{}, \"layouts/base\")\n\treturn nil\n}", "title": "" }, { "docid": "bf70587f5e86a4ec3f1677c481cffdb7", "score": "0.42596516", "text": "func (w FederatingWrappedCallbacks) announce(c context.Context, a vocab.ActivityStreamsAnnounce) error {\n\tid, err := GetId(a)\n\tif err != nil {\n\t\treturn err\n\t}\n\top := a.GetActivityStreamsObject()\n\t// Create anonymous loop function to be able to properly scope the defer\n\t// for the database lock at each iteration.\n\tloopFn := func(iter vocab.ActivityStreamsObjectPropertyIterator) error {\n\t\tobjId, err := ToId(iter)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := w.db.Lock(c, objId); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer w.db.Unlock(c, objId)\n\t\tif owns, err := w.db.Owns(c, objId); err != nil {\n\t\t\treturn err\n\t\t} else if !owns {\n\t\t\treturn nil\n\t\t}\n\t\tt, err := w.db.Get(c, objId)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts, ok := t.(shareser)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"cannot add Announce to Shares collection for type %T\", t)\n\t\t}\n\t\t// Get 'shares' property on the object, creating default if\n\t\t// necessary.\n\t\tshares := s.GetActivityStreamsShares()\n\t\tif shares == nil {\n\t\t\tshares = streams.NewActivityStreamsSharesProperty()\n\t\t\ts.SetActivityStreamsShares(shares)\n\t\t}\n\t\t// Get 'shares' value, defaulting to a collection.\n\t\tsharesT := shares.GetType()\n\t\tif sharesT == nil {\n\t\t\tcol := streams.NewActivityStreamsCollection()\n\t\t\tsharesT = col\n\t\t\tshares.SetActivityStreamsCollection(col)\n\t\t}\n\t\t// Prepend the activity's 'id' on the 'shares' Collection or\n\t\t// OrderedCollection.\n\t\tif col, ok := sharesT.(itemser); ok {\n\t\t\titems := col.GetActivityStreamsItems()\n\t\t\tif items == nil {\n\t\t\t\titems = streams.NewActivityStreamsItemsProperty()\n\t\t\t\tcol.SetActivityStreamsItems(items)\n\t\t\t}\n\t\t\titems.PrependIRI(id)\n\t\t} else if oCol, ok := sharesT.(orderedItemser); ok {\n\t\t\toItems := oCol.GetActivityStreamsOrderedItems()\n\t\t\tif oItems == nil {\n\t\t\t\toItems = streams.NewActivityStreamsOrderedItemsProperty()\n\t\t\t\toCol.SetActivityStreamsOrderedItems(oItems)\n\t\t\t}\n\t\t\toItems.PrependIRI(id)\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"shares type is neither a Collection nor an OrderedCollection: %T\", sharesT)\n\t\t}\n\t\terr = w.db.Update(c, t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\tif op != nil {\n\t\tfor iter := op.Begin(); iter != op.End(); iter = iter.Next() {\n\t\t\tif err := loopFn(iter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif w.Announce != nil {\n\t\treturn w.Announce(c, a)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8d8eb28f5eae0b2c6cbb22326ddcc160", "score": "0.42439583", "text": "func NewLearningAssignment()(*LearningAssignment) {\n m := &LearningAssignment{\n LearningCourseActivity: *NewLearningCourseActivity(),\n }\n return m\n}", "title": "" }, { "docid": "8f98dcbcd111634d4c1b39c4e7195a26", "score": "0.42416543", "text": "func (o *NiaapiSoftwareEolAllOf) HasAnnouncementDate() bool {\n\tif o != nil && o.AnnouncementDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c4fe27f79130fc5f2d8b2b2ea96ae9a3", "score": "0.42354095", "text": "func (o *NiaapiSoftwareEolAllOf) GetAnnouncementDate() time.Time {\n\tif o == nil || o.AnnouncementDate == nil {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.AnnouncementDate\n}", "title": "" }, { "docid": "cd9881ad024cbf6646331e6e0ceaa87b", "score": "0.42339337", "text": "func NewBeaconAgent(aup service.AppSupervisor) (*BeaconAgent, error) {\n conn, err := net.ListenUDP(\"udp4\", &net.UDPAddr{IP: net.IPv4zero, Port: POCKET_AGENT_PORT})\n if err != nil {\n return nil, errors.WithStack(err)\n }\n conn.SetReadBuffer(PC_MAX_UCAST_UDP_BUF_SIZE)\n conn.SetWriteBuffer(PC_MAX_UCAST_UDP_BUF_SIZE)\n agent := &BeaconAgent{\n AppSupervisor: aup,\n conn: conn,\n }\n agent.read()\n agent.write()\n return agent, nil\n}", "title": "" }, { "docid": "13ef8148dfdddef341e83db6d262197f", "score": "0.42338082", "text": "func NewElection(ctx context.Context, cli *clientv3.Client, sessionTTL int, key, id, addr string, notifyBlockTime time.Duration) (*Election, error) {\n\tctx2, cancel2 := context.WithCancel(ctx)\n\te := &Election{\n\t\tcli: cli,\n\t\tsessionTTL: sessionTTL,\n\t\tkey: key,\n\t\tinfo: &CampaignerInfo{\n\t\t\tID: id,\n\t\t\tAddr: addr,\n\t\t},\n\t\tnotifyBlockTime: notifyBlockTime,\n\t\tleaderCh: make(chan *CampaignerInfo, 1),\n\t\tech: make(chan error, 1), // size 1 is enough\n\t\tcancel: cancel2,\n\t\tl: log.With(zap.String(\"component\", \"election\")),\n\t}\n\te.infoStr = e.info.String()\n\n\t// try create a session before enter the campaign loop.\n\t// so we can detect potential error earlier.\n\tsession, err := e.newSession(ctx, newSessionDefaultRetryCnt)\n\tif err != nil {\n\t\tcancel2()\n\t\treturn nil, terror.ErrElectionCampaignFail.Delegate(err, \"create the initial session\")\n\t}\n\n\te.bgWg.Add(1)\n\tgo func() {\n\t\tdefer e.bgWg.Done()\n\t\te.campaignLoop(ctx2, session)\n\t}()\n\treturn e, nil\n}", "title": "" }, { "docid": "3c718049e894d0ebcc8187e27321c138", "score": "0.42246675", "text": "func (h *ThreadsService) newNotification(header *pb.ThreadBlockHeader, ntype repo.NotificationType) (*repo.Notification, error) {\n\tdate, err := ptypes.Timestamp(header.Date)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &repo.Notification{\n\t\tId: ksuid.New().String(),\n\t\tDate: date,\n\t\tActorId: header.Author,\n\t\tType: ntype,\n\t}, nil\n}", "title": "" }, { "docid": "7c3c590a2b0306daa811e16e86ff1744", "score": "0.4223611", "text": "func newPublication(pubType string, name string, pg int, pub string) (iPublication, error) {\n\t// Create publication based on specified type\n\tif pubType == \"newspaper\" {\n\t\treturn createNewspaper(name, pg, pub), nil\n\t}\n\n\tif pubType == \"magazine\" {\n\t\treturn createMagazine(name, pg, pub), nil\n\t}\n\t\n\treturn nil, fmt.Errorf(\"No such publication\")\n}", "title": "" }, { "docid": "c10e32470a0ac91b8a1e96d2d6f90838", "score": "0.42163458", "text": "func (service *PunishmentServiceImpl) New(ctx context.Context, server string, userID bson.ObjectId, address string, punisherID bson.ObjectId, reason string, silent bool, _type string, expiresAt int64) *Punishment {\n\tpunishment := &Punishment{\n\t\tID: bson.NewObjectId(),\n\t\tServer: server,\n\t\tUserID: userID,\n\t\tAddress: address,\n\t\tPunisherID: punisherID,\n\t\tReason: reason,\n\t\tSilent: silent,\n\t\tType: _type,\n\t\tExpiresAt: time.Unix(0, expiresAt*int64(time.Millisecond)),\n\t\tCreatedAt: time.Now(),\n\t\tUpdatedAt: time.Now(),\n\t}\n\n\treturn punishment\n}", "title": "" }, { "docid": "e5036d4c879f7cd69e7443a4619024f9", "score": "0.4211214", "text": "func (o *InlineResponse20054Projects) GetAnnouncement() string {\n\tif o == nil || o.Announcement == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Announcement\n}", "title": "" }, { "docid": "194dfcdcf03091a01eb64f36ef14a855", "score": "0.42052537", "text": "func New(deadline time.Time) *Deadline {\n\treturn &Deadline{unixNano: deadline.UnixNano()}\n}", "title": "" }, { "docid": "b9eecc9046ecc07ef9c8f4a706fb9753", "score": "0.4195752", "text": "func New(announceUrl string, info *torrent_info.TorrentInfo, port int, peerId string) Tracker {\n\ttracker := Tracker{\n\t\tAnnounceUrl: announceUrl,\n\t\tTorrentInfo: info,\n\t\tPeerId: peerId,\n\t\tPort: port,\n\t}\n\treturn tracker\n}", "title": "" }, { "docid": "02223b1247840b4d70dabf19f3b18271", "score": "0.4191264", "text": "func trackerAnnounce(ctx context.Context, t *Torrent) {\n\ttn := t.rand.Perm(len(t.trackers))\n\tfor _, i := range tn {\n\t\ttl := t.trackers[i]\n\t\tfor _, tr := range tl {\n\t\t\tstate, _ := tr.GetState()\n\t\t\tif state == tracker.Ready {\n\t\t\t\tgo trackerAnnounceSingle(ctx, t, tr)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif state != tracker.Error {\n\t\t\t\t// skip to next tier\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1da3a8fe062c38d76d56af071cdb9ed0", "score": "0.41839823", "text": "func Announce(ni NetInfo) {\n log.Print(\"Announcing timeout: \", *timeout)\n for i, _ := range ni.PublishAddrs {\n id_str := fmt.Sprintf(\"ID=%s\", ni.ID)\n addr_str := fmt.Sprintf(\"Address=%s\", ni.PublishAddrs[i])\n s, err := bonjour.Register(\"IPFS\",\n *service,\n \"\",\n ni.Port[i],\n []string{id_str, addr_str},\n nil )\n if err != nil {\n log.Fatal(err)\n }\n time.Sleep(1 * time.Second)\n s.Shutdown()\n }\n}", "title": "" }, { "docid": "83b65b59afb6becfcfd5f8a0b57f2a22", "score": "0.41794854", "text": "func (p *providerDealEnvironment) AnnounceIndex(ctx context.Context, deal storagemarket.MinerDeal) (advertCid cid.Cid, err error) {\n\tmt := p.p.metadataForDeal(deal)\n\n\t// ensure we have a connection with the full node host so that the index provider gossip sub announcements make their\n\t// way to the filecoin bootstrapper network\n\tif err := p.p.meshCreator.Connect(ctx); err != nil {\n\t\treturn cid.Undef, fmt.Errorf(\"cannot publish index record as indexer host failed to connect to the full node: %w\", err)\n\t}\n\n\treturn p.p.indexProvider.NotifyPut(ctx, nil, deal.ProposalCid.Bytes(), mt)\n}", "title": "" }, { "docid": "84a43bcbad39f7e36220b7f7cfceff89", "score": "0.41667926", "text": "func (c MsgAgencyCreator) Create() xpost.Courier {\n\treturn newMsgAgency()\n}", "title": "" }, { "docid": "3c4fcc3cec761a3b93f908930bb19dc2", "score": "0.41662136", "text": "func (c *client) GetAnnouncementsChannel() <-chan a.Announcement {\n\treturn c.announcements\n}", "title": "" }, { "docid": "fcf2d7930518bd0c0f1bad8a3a1c2e2f", "score": "0.41654432", "text": "func (s NotificationService) New(n Notification) {\n\tnotification, _ := json.Marshal(n)\n\tWindow().Call(\"goappNewNotification\", string(notification))\n}", "title": "" }, { "docid": "4be6b98d2f8106c1c5b5a500c7cf2193", "score": "0.41641328", "text": "func init() {\n\tannouncer = New()\n}", "title": "" }, { "docid": "1d268d9590c376ffe3bd538933cd425f", "score": "0.4162528", "text": "func (c *Client) AnnounceTorrent(id string) error {\n\targs := rpctypes.AnnounceTorrentRequest{ID: id}\n\tvar reply rpctypes.AnnounceTorrentResponse\n\treturn c.client.Call(\"Session.AnnounceTorrent\", args, &reply)\n}", "title": "" }, { "docid": "543b5b291e5a186240ae05bac3fce0bd", "score": "0.41606238", "text": "func (c *Client) GetAnnouncementsChannel() <-chan interface{} {\n\treturn c.announcements\n}", "title": "" }, { "docid": "19f96b99815604f0e3207704570de63b", "score": "0.41577694", "text": "func newFollower(configuration *configpb.Configuration, followerID string, followerAddress *configpb.ServiceAddress) (*follower, error) {\n\t// Connect to the leader\n\tconn, err := dial(configuration.Leader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlogger.Printf(\"Connected to leader at address %v\", configuration.Leader)\n\treturn &follower{\n\t\tid: followerID,\n\t\taddress: followerAddress,\n\t\tstore: make(map[string]*data),\n\t\tstoreMutex: sync.Mutex{},\n\t\tdone: make(chan bool),\n\t\tconn: conn,\n\t\tleader: lpb.NewLeaderClient(conn),\n\t}, nil\n}", "title": "" }, { "docid": "db09ea606195f558661a88816216d3db", "score": "0.41438743", "text": "func (b *Bot) New(c NewRequest) (string,error) {\n d,err := b.doPost(\"/bot\", c)\n if err != nil {\n return \"\", err\n }\n\n nr := &NewResponse{}\n json.Unmarshal(d, nr)\n\n return nr.ID, nil\n}", "title": "" }, { "docid": "f901fda8302111171719ed96b40f7bf2", "score": "0.41386664", "text": "func newNode(index int) *Node {\n\ts := Node{index: index, state: false,\n\t\tresp: make(chan *Package), occupied: make(chan bool), hunt: make(chan bool)}\n\treturn &s\n}", "title": "" }, { "docid": "f1a894abbd942b7e41f92ee661d5072b", "score": "0.4138381", "text": "func Announce(h hash.Hash, ipv6 bool) error {\n\tt := Get(h)\n\tif t == nil {\n\t\treturn os.ErrNotExist\n\t}\n\tselect {\n\tcase t.Event <- peer.TorAnnounce{ipv6}:\n\t\treturn nil\n\tcase <-t.Done:\n\t\treturn ErrTorrentDead\n\t}\n}", "title": "" }, { "docid": "948f3ee3c7d33606cd92b0accc4e2822", "score": "0.412756", "text": "func NewAgent(host string, clientID string) (a *Agent) {\n\ta = &Agent{}\n\ta.clientID = clientID\n\n\t// mqtt.DEBUG = log.New(os.Stdout, \"\", 0)\n\t// mqtt.ERROR = log.New(os.Stdout, \"\", 0)\n\topts := mqtt.NewClientOptions().AddBroker(host).SetClientID(clientID)\n\topts.SetKeepAlive(5 * time.Second)\n\topts.SetPingTimeout(5 * time.Second)\n\topts.OnConnectionLost = func(c mqtt.Client, err error) {\n\t\tlog.WithField(\"error\", err).Info(\"Lost connection\")\n\t}\n\topts.OnConnect = func(c mqtt.Client) {\n\t\tlog.Info(\"Connect\")\n\n\t\t//Subscribe here, otherwise after connection lost,\n\t\t//you may not receive any message\n\t\tfor _, s := range a.subscriptions {\n\t\t\tif token := c.Subscribe(s.topic, 2, s.handler); token.Wait() && token.Error() != nil {\n\t\t\t\tlog.WithField(\"error\", token.Error()).Error(\"Can't subscribe\")\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tlog.WithField(\"topic\", s.topic).Info(\"Resubscribe\")\n\t\t}\n\t}\n\ta.client = mqtt.NewClient(opts)\n\n\tgo func() {\n\t\tdone := make(chan os.Signal)\n\t\tsignal.Notify(done, os.Interrupt)\n\t\t<-done\n\t\tlog.Info(\"Shutting down agent\")\n\t\ta.Close()\n\t}()\n\n\treturn a\n}", "title": "" }, { "docid": "82b794c4f0786011ca61aa2eb6659ae2", "score": "0.41245234", "text": "func newNode(ctx context.Context, requests chan *Cmd, replies chan *Cmd,\n\tevents chan *Event) *node {\n\tn := &node{\n\t\tctx: ctx,\n\t\trequests: requests,\n\t\treplies: replies,\n\t\tevents: events,\n\t\tmsgs: make(chan *ZreMsg),\n\t\tterminated: make(chan interface{}),\n\t\tbeaconPort: zreDiscoveryPort,\n\t\tbeacon: NewBeacon(),\n\t\tinbox: zmq.NewRouter(ctx),\n\t\tpeers: make(map[string]*Peer),\n\t\tpeerGroups: make(map[string]*Group),\n\t\townGroups: make(map[string]*Group),\n\t\theaders: make(map[string]string),\n\t}\n\tn.uuid = make([]byte, 16)\n\tio.ReadFull(rand.Reader, n.uuid)\n\t// Default name for node is first 6 characters of UUID:\n\t// the shorter string is more readable in logs\n\tn.name = fmt.Sprintf(\"%.3X\", n.uuid)\n\tn.wg.Add(1)\n\tgo n.actor()\n\treturn n\n}", "title": "" }, { "docid": "f7e38c61888f1ff80f18cee891fd1495", "score": "0.4124258", "text": "func (o *InlineResponse20054Projects) GetShowAnnouncement() bool {\n\tif o == nil || o.ShowAnnouncement == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.ShowAnnouncement\n}", "title": "" }, { "docid": "e1d77b085a584e86ee5d91f52e5834b6", "score": "0.41200548", "text": "func New(headline field.HeadlineField) (m News) {\n\tm.Message = quickfix.NewMessage()\n\tm.Header = fix42.NewHeader(&m.Message.Header)\n\tm.Body = &m.Message.Body\n\tm.Trailer.Trailer = &m.Message.Trailer\n\n\tm.Header.Set(field.NewMsgType(\"B\"))\n\tm.Set(headline)\n\n\treturn\n}", "title": "" }, { "docid": "2d992884b603af88e4e68e51f4ef06ea", "score": "0.4114929", "text": "func (s *BaseSpeaker) DecideAnnouncement(ruleId string, result bool) (string, bool, bool) {\n\treturn ruleId, result, true\n}", "title": "" }, { "docid": "4873200e2381e568c905fd5fc8c35fa7", "score": "0.41041613", "text": "func (pool *BlockPool) newBlockEndorsement(msg *blockEndorseMsg) {\n\tpool.lock.Lock()\n\tdefer pool.lock.Unlock()\n\n\teSig := &CandidateEndorseSigInfo{\n\t\tEndorsedProposer: msg.EndorsedProposer,\n\t\tSignature: msg.EndorserSig,\n\t\tForEmpty: msg.EndorseForEmpty,\n\t}\n\tpool.addBlockEndorsementLocked(msg.GetBlockNum(), msg.Endorser, eSig)\n}", "title": "" }, { "docid": "74a8aa3a4255090a1d2f50f040edbbfd", "score": "0.41023904", "text": "func NewAgent(influxdbClient client.Client, interval time.Duration) *Agent {\n\treturn &Agent{\n\t\tinterval: interval,\n\t\tinfluxdbClient: influxdbClient,\n\t}\n}", "title": "" }, { "docid": "1375b8634b5ec87d6fc34c439d64a9b2", "score": "0.41012838", "text": "func (h handler) CreateConsignment(ctx context.Context, req *pb.Consignment, resp *pb.Response) error {\n\t// create session\n\trepo :=h.GetRepo()\n\tdefer repo.Close()\n // check for available vessel\n vesselResponse, err:=h.vesselClient.FindAvailable(ctx, &vesselpb.Specification{\n\tCapacity: int32(len(req.Containers)),\n\tMaxWeight: req.Weight, \n })\n if err != nil {\n\treturn err\n }\n log.Printf(\"found vessel: %s\\n\", vesselResponse.Vessel.Name)\n // We set the VesselId as the vessel we got back from our\n // vessel service\n req.VesselId = vesselResponse.Vessel.Id\n // Save our consignment\n if err:=repo.Create(req); err!=nil {\n\t return err\n }\n resp.Created = true\n resp.Consignment = req\n return nil \n}", "title": "" }, { "docid": "1e57ca050ea352adb067f190b56b5a98", "score": "0.40992555", "text": "func New(callback Callback) *Fetcher {\n\tloggerInstance := logger.MakeInstance()\n\treturn &Fetcher{\n\t\tnotify: make(chan *announcesBatch, maxQueuedAnns),\n\t\tinject: make(chan *inject, maxQueuedInjects),\n\t\tquit: make(chan struct{}),\n\t\tannounces: make(map[string]int),\n\t\tannounced: make(map[hash.Event][]*oneAnnounce),\n\t\tfetching: make(map[hash.Event]*oneAnnounce),\n\t\tfetchingTime: make(map[hash.Event]time.Time),\n\t\tcallback: callback,\n\n\t\tPeriodic: logger.Periodic{Instance: loggerInstance},\n\t}\n}", "title": "" }, { "docid": "7a9d49283ba55798bdd4edae29eabd45", "score": "0.40943572", "text": "func newNode(index int) *Node {\n\ts := Node{index: index, ask: make(chan NextHopInfo), read: make(chan ReadInfo), write: make(chan WriteInfo), receive: make(chan Package), queue: make(chan StandardPackage, 1000), receiveStandardPack: make(chan StandardPackage)}\n\treturn &s\n}", "title": "" }, { "docid": "021196a9717ef365ae5de8dc1896ef45", "score": "0.4094264", "text": "func NewDeadline(t time.Time) *Deadline {\n\treturn &Deadline{t}\n}", "title": "" }, { "docid": "d2d29fc92e906ae017c36509fed9686d", "score": "0.40881705", "text": "func New(config Config) (*Agent, error) {\n\ta := &Agent{\n\t\tConfig: config,\n\t\tshutdowns: make(chan struct{}),\n\t}\n\tsetup := []func() error{\n\t\ta.setupLogger,\n\t\ta.setupMux,\n\t\ta.setupLog,\n\t\ta.setupServer,\n\t\ta.setupMembership,\n\t}\n\tfor _, fn := range setup {\n\t\tif err := fn(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tgo a.serve()\n\treturn a, nil\n}", "title": "" }, { "docid": "74796782f784295039ba289e2d7ccbdb", "score": "0.40805867", "text": "func New(in drivers.In, out drivers.Out, opts ...Option) *Arp {\n\ta := &Arp{\n\t\tin: in,\n\t\tout: out,\n\n\t\tnotePoolOctave: 0,\n\t\tchannelIn: -1,\n\t\tchannelOut: 0,\n\t\ttempoBPM: 120.00,\n\n\t\tstart: make(chan [2]uint8, 100),\n\t\tstop: make(chan bool),\n\t\tstopped: make(chan bool),\n\t\tnoteDist: make(chan time.Duration),\n\t\tnoteLen: make(chan time.Duration),\n\t\t//messages: make(chan midi.Message, 100),\n\t\tmessages: make(chan timeStampedMessage, 100),\n\t\tnextArpNote: make(chan bool),\n\t\tfinishScheduler: make(chan bool),\n\t\tfinishListener: make(chan bool),\n\t\tfinishedScheduler: make(chan bool),\n\t\tfinishedListener: make(chan bool),\n\t}\n\n\ta.Reset()\n\n\tCCDirectionSwitch(midi.GeneralPurposeButton1Switch)(a)\n\tCCTimeInterval(midi.GeneralPurposeSlider1)(a)\n\tCCStyle(midi.GeneralPurposeSlider2)(a)\n\n\tfor _, opt := range opts {\n\t\topt(a)\n\t}\n\n\treturn a\n}", "title": "" }, { "docid": "30377877c2605944bb26903e5c563841", "score": "0.4065705", "text": "func New(current func(string), expireDuration *time.Duration) *Broker {\n\ts := &Broker{\n\t\tmessages: make(chan *amp.Msg, 1024),\n\t\tloopWork: make(chan func()),\n\t\tclosed: make(chan struct{}),\n\t\tspreaders: make(map[string]*spreader),\n\t\tconsumerNames: make(map[amp.Sender]map[string]int64),\n\t\tcurrent: current,\n\t\texpireDuration: expireDuration,\n\t}\n\tgo s.loop()\n\treturn s\n}", "title": "" } ]
1d0424c7f55d2047d65e70b5023a1360
StartCalls gets all the calls that were made to Start. Check the length with: len(mockedHarborProjectController.StartCalls())
[ { "docid": "71893ea99b89f9c6a14f6584df41b2d2", "score": "0.8853412", "text": "func (mock *HarborProjectControllerMock) StartCalls() []struct {\n\tCtx context.Context\n\tThreadiness int\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tThreadiness int\n\t}\n\tlockHarborProjectControllerMockStart.RLock()\n\tcalls = mock.calls.Start\n\tlockHarborProjectControllerMockStart.RUnlock()\n\treturn calls\n}", "title": "" } ]
[ { "docid": "f537dc85d5ca92a21192d4c3458b4ef3", "score": "0.8404681", "text": "func (mock *SourceCodeRepositoryControllerMock) StartCalls() []struct {\n\tCtx context.Context\n\tThreadiness int\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tThreadiness int\n\t}\n\tlockSourceCodeRepositoryControllerMockStart.RLock()\n\tcalls = mock.calls.Start\n\tlockSourceCodeRepositoryControllerMockStart.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "40891fb67218c31e5d8b7a28c7533c50", "score": "0.73838097", "text": "func (mock *partitionDelegateMock) startCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tmock.lockstart.RLock()\n\tcalls = mock.calls.start\n\tmock.lockstart.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "f9ca186be67e99d96cdd3c88af7cedd7", "score": "0.7255726", "text": "func (mock *WordSearchServiceMock) StartRESTCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockWordSearchServiceMockStartREST.RLock()\n\tcalls = mock.calls.StartREST\n\tlockWordSearchServiceMockStartREST.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "315fc2108e50e5708bb06822d28c95a2", "score": "0.6829929", "text": "func (mock *HarborProjectControllerMock) SyncCalls() []struct {\n\tCtx context.Context\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t}\n\tlockHarborProjectControllerMockSync.RLock()\n\tcalls = mock.calls.Sync\n\tlockHarborProjectControllerMockSync.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "986e0d11066e4858f12354edcc755fba", "score": "0.67162126", "text": "func (mock *MiddlewareMock) InitCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockMiddlewareMockInit.RLock()\n\tcalls = mock.calls.Init\n\tlockMiddlewareMockInit.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "6b57325619df30bb2210aade367807d5", "score": "0.66901416", "text": "func (mock *HarborProjectInterfaceMock) WatchCalls() []struct {\n\tOpts v1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts v1.ListOptions\n\t}\n\tlockHarborProjectInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockHarborProjectInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "c40e4749aded6565c6a35201cf67d210", "score": "0.66665715", "text": "func (mock *HarborProjectControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockHarborProjectControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockHarborProjectControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "8d4dd8bccf79b4767db19424d2f47f71", "score": "0.6644162", "text": "func (mock *HarborProjectControllerMock) EnqueueCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockHarborProjectControllerMockEnqueue.RLock()\n\tcalls = mock.calls.Enqueue\n\tlockHarborProjectControllerMockEnqueue.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "a3ba01059260d7deebb4014ad528cac3", "score": "0.662232", "text": "func (mock *HarborProjectInterfaceMock) ListCalls() []struct {\n\tOpts v1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts v1.ListOptions\n\t}\n\tlockHarborProjectInterfaceMockList.RLock()\n\tcalls = mock.calls.List\n\tlockHarborProjectInterfaceMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "66accfa7f9ffc78f43386fbf55223ba0", "score": "0.65996873", "text": "func (mock *HarborProjectListerMock) GetCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockHarborProjectListerMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockHarborProjectListerMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "3f0a45db7993d5f4820a95bd17631047", "score": "0.6571797", "text": "func (mock *MiddlewareMock) RunCalls() []struct {\n\tCtx context.Context\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t}\n\tlockMiddlewareMockRun.RLock()\n\tcalls = mock.calls.Run\n\tlockMiddlewareMockRun.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "dc7c749f8ea713b15ecd3879f8a6ae4c", "score": "0.65490276", "text": "func (mock *NeoConnMock) BeginCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockNeoConnMockBegin.RLock()\n\tcalls = mock.calls.Begin\n\tlockNeoConnMockBegin.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "2ce84f8cbc8cae2a93031120e6dabc33", "score": "0.6495788", "text": "func (mock *ModuleControllerMock) WatchCalls() []struct {\n\tNamespace string\n\tOpts v1b.ListOptions\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tOpts v1b.ListOptions\n\t}\n\tlockModuleControllerMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockModuleControllerMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "273ff06c88db3de5cd7a9f1b8006e2fb", "score": "0.6451551", "text": "func (mock *HarborProjectListerMock) ListCalls() []struct {\n\tNamespace string\n\tSelector labels.Selector\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tSelector labels.Selector\n\t}\n\tlockHarborProjectListerMockList.RLock()\n\tcalls = mock.calls.List\n\tlockHarborProjectListerMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "0da5a16a24bb0d0aaf27dde625a7a372", "score": "0.6429108", "text": "func (mock *ModuleClientMock) WatchCalls() []struct {\n\tNamespace string\n\tOpts v1b.ListOptions\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tOpts v1b.ListOptions\n\t}\n\tlockModuleClientMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockModuleClientMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "ef204ce44dcc3507713ad2902c0c7eeb", "score": "0.63626593", "text": "func (mock *ProjectAlertGroupInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockProjectAlertGroupInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockProjectAlertGroupInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "5c59032793b41d356a91a3339382eef7", "score": "0.63594604", "text": "func (mock *HarborProjectInterfaceMock) ControllerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockHarborProjectInterfaceMockController.RLock()\n\tcalls = mock.calls.Controller\n\tlockHarborProjectInterfaceMockController.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "d816feee06cef61fb9ccac83577adc3f", "score": "0.63425326", "text": "func (mock *WordSearchServiceMock) StartGRPCCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockWordSearchServiceMockStartGRPC.RLock()\n\tcalls = mock.calls.StartGRPC\n\tlockWordSearchServiceMockStartGRPC.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "bd20df1f6c86b3ea68895e1620b53e79", "score": "0.63328594", "text": "func (mock *ModuleControllerMock) EnqueueCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockModuleControllerMockEnqueue.RLock()\n\tcalls = mock.calls.Enqueue\n\tlockModuleControllerMockEnqueue.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "5a88e0ad57a41630e4479f0eb9750383", "score": "0.6331143", "text": "func (mock *ProjectAlertGroupControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockProjectAlertGroupControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockProjectAlertGroupControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "45dcd368452bfea95e64b9e22e02fd12", "score": "0.63216573", "text": "func (mock *ProjectAlertGroupControllerMock) EnqueueCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockProjectAlertGroupControllerMockEnqueue.RLock()\n\tcalls = mock.calls.Enqueue\n\tlockProjectAlertGroupControllerMockEnqueue.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "fd3b1285422d7253116ad023cfd717ac", "score": "0.6319557", "text": "func (mock *SourceCodeRepositoryControllerMock) EnqueueCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockSourceCodeRepositoryControllerMockEnqueue.RLock()\n\tcalls = mock.calls.Enqueue\n\tlockSourceCodeRepositoryControllerMockEnqueue.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "0fe516d139680294bcb7cf68cd6e0020", "score": "0.63164115", "text": "func (mock *SourceCodeRepositoryControllerMock) SyncCalls() []struct {\n\tCtx context.Context\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t}\n\tlockSourceCodeRepositoryControllerMockSync.RLock()\n\tcalls = mock.calls.Sync\n\tlockSourceCodeRepositoryControllerMockSync.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "55fd7041883528014b87bc73983c5d9e", "score": "0.6298255", "text": "func (mock *HarborProjectInterfaceMock) GetCalls() []struct {\n\tName string\n\tOpts v1.GetOptions\n} {\n\tvar calls []struct {\n\t\tName string\n\t\tOpts v1.GetOptions\n\t}\n\tlockHarborProjectInterfaceMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockHarborProjectInterfaceMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "3a3bad61acd18c97d43f43cb9d20afd1", "score": "0.6296675", "text": "func (mock *HttpClientMock) RequestCalls() []struct {\n\tCtx context.Context\n\tMethod string\n\tAddress string\n\tHeader http.Header\n\tParameters string\n\tPayload []byte\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tMethod string\n\t\tAddress string\n\t\tHeader http.Header\n\t\tParameters string\n\t\tPayload []byte\n\t}\n\tmock.lockRequest.RLock()\n\tcalls = mock.calls.Request\n\tmock.lockRequest.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "b89697927175c52352ff85c082bd3fac", "score": "0.6287198", "text": "func (mock *RkeK8sServiceOptionControllerMock) EnqueueCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockRkeK8sServiceOptionControllerMockEnqueue.RLock()\n\tcalls = mock.calls.Enqueue\n\tlockRkeK8sServiceOptionControllerMockEnqueue.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "5c826a963c149a1c019f15ac31c6c04d", "score": "0.6278733", "text": "func (mock *HorizontalPodAutoscalerInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockHorizontalPodAutoscalerInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockHorizontalPodAutoscalerInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "f6145b83bb6051f10aab7c42e72a4274", "score": "0.6272367", "text": "func (mock *ProjectAlertGroupInterfaceMock) ListCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockProjectAlertGroupInterfaceMockList.RLock()\n\tcalls = mock.calls.List\n\tlockProjectAlertGroupInterfaceMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "da0a49a748d8225f9acdeac037955074", "score": "0.62632006", "text": "func (mock *SourceCodeRepositoryInterfaceMock) WatchCalls() []struct {\n\tOpts v1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts v1.ListOptions\n\t}\n\tlockSourceCodeRepositoryInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockSourceCodeRepositoryInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "0e26a6b168db221b1982bfba16b79922", "score": "0.6256035", "text": "func (mmBeginPulse *mDispatcherMockBeginPulse) Calls() []*DispatcherMockBeginPulseParams {\n\tmmBeginPulse.mutex.RLock()\n\n\targCopy := make([]*DispatcherMockBeginPulseParams, len(mmBeginPulse.callArgs))\n\tcopy(argCopy, mmBeginPulse.callArgs)\n\n\tmmBeginPulse.mutex.RUnlock()\n\n\treturn argCopy\n}", "title": "" }, { "docid": "6ca10939bec0b5c1882c43e8256d0aef", "score": "0.62452483", "text": "func (mock *HorizontalPodAutoscalerListerMock) GetCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockHorizontalPodAutoscalerListerMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockHorizontalPodAutoscalerListerMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "2bedd32e592b6b8afd0acd9fc32e178a", "score": "0.62420493", "text": "func (mock *ModuleControllerMock) ListCalls() []struct {\n\tNamespace string\n\tOpts v1b.ListOptions\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tOpts v1b.ListOptions\n\t}\n\tlockModuleControllerMockList.RLock()\n\tcalls = mock.calls.List\n\tlockModuleControllerMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "ea3fcc5b9c2e85e235f1a8a42b3b0af6", "score": "0.6226814", "text": "func (mock *ServiceMock) HealthCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockServiceMockHealth.RLock()\n\tcalls = mock.calls.Health\n\tlockServiceMockHealth.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "ad1c676bcf598a1a7a4a24ffaabe39b3", "score": "0.6220108", "text": "func (mock *HorizontalPodAutoscalerInterfaceMock) ListCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockHorizontalPodAutoscalerInterfaceMockList.RLock()\n\tcalls = mock.calls.List\n\tlockHorizontalPodAutoscalerInterfaceMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "4c415a7e4a7adb9807d17092cf947cfd", "score": "0.61855394", "text": "func (mock *SourceCodeRepositoryControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockSourceCodeRepositoryControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockSourceCodeRepositoryControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "77ab5c6decd530677bb1d01d1f194e3e", "score": "0.6183707", "text": "func (mock *ReplicaSetInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockReplicaSetInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockReplicaSetInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "1e6e153295e8145a2409db19cb662502", "score": "0.6183199", "text": "func (mock *ProgramMock) RunCalls() []struct {\n\tInput string\n} {\n\tvar calls []struct {\n\t\tInput string\n\t}\n\tlockProgramMockRun.RLock()\n\tcalls = mock.calls.Run\n\tlockProgramMockRun.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "6da45ad27321ffc946ff5aad62e6a0db", "score": "0.6180853", "text": "func (mock *GroupControllerMock) EnqueueCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockGroupControllerMockEnqueue.RLock()\n\tcalls = mock.calls.Enqueue\n\tlockGroupControllerMockEnqueue.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "a93252231b4d4a9d1eba182fb3320657", "score": "0.61739105", "text": "func (mock *BuilderMock) BuildCalls() []struct {\n\tProject packager.Locator\n} {\n\tvar calls []struct {\n\t\tProject packager.Locator\n\t}\n\tmock.lockBuild.RLock()\n\tcalls = mock.calls.Build\n\tmock.lockBuild.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "bd51356886d98b907965c5528c5f12ca", "score": "0.61713696", "text": "func (mock *HarborProjectsGetterMock) HarborProjectsCalls() []struct {\n\tNamespace string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t}\n\tlockHarborProjectsGetterMockHarborProjects.RLock()\n\tcalls = mock.calls.HarborProjects\n\tlockHarborProjectsGetterMockHarborProjects.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "7cb121f6a2c89abe2a2643312452f250", "score": "0.6171047", "text": "func (mock *NamespacedServiceAccountTokenInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockNamespacedServiceAccountTokenInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockNamespacedServiceAccountTokenInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "089c6757fee1b83a2f9107bbffab73be", "score": "0.6167338", "text": "func (mock *HorizontalPodAutoscalerControllerMock) EnqueueCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockHorizontalPodAutoscalerControllerMockEnqueue.RLock()\n\tcalls = mock.calls.Enqueue\n\tlockHorizontalPodAutoscalerControllerMockEnqueue.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "602a23dcf09ded978eb8f47a24362351", "score": "0.6167047", "text": "func (mock *GroupInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockGroupInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockGroupInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "cee22e9169714a470011a4f0f16be997", "score": "0.6165108", "text": "func (mock *ModuleControllerMock) GetCalls() []struct {\n\tNamespace string\n\tName string\n\tOptions v1b.GetOptions\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t\tOptions v1b.GetOptions\n\t}\n\tlockModuleControllerMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockModuleControllerMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "41b72b427a059483dd5e7536b5755596", "score": "0.61561334", "text": "func (mock *HorizontalPodAutoscalerControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockHorizontalPodAutoscalerControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockHorizontalPodAutoscalerControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "547100f7ca75a17e14959782e3a9dad9", "score": "0.6151672", "text": "func (mock *LogstashControllerMock) KillCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tmock.lockKill.RLock()\n\tcalls = mock.calls.Kill\n\tmock.lockKill.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "84eb1967377d7dde5507276a003fb494", "score": "0.6145317", "text": "func (mock *mockRideEnvironment) invocationCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tmock.lockinvocation.RLock()\n\tcalls = mock.calls.invocation\n\tmock.lockinvocation.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "ea07e91846ebd836c33e7e7eeaa547d0", "score": "0.61300045", "text": "func (mock *SwitchMock) SendCalls() []struct {\n\tData string\n\tProtocolID int\n} {\n\tvar calls []struct {\n\t\tData string\n\t\tProtocolID int\n\t}\n\tlockSwitchMockSend.RLock()\n\tcalls = mock.calls.Send\n\tlockSwitchMockSend.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "3c2c52b9caa15c03614ef71a2aade028", "score": "0.6113046", "text": "func (mock *ReplicaSetControllerMock) EnqueueCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockReplicaSetControllerMockEnqueue.RLock()\n\tcalls = mock.calls.Enqueue\n\tlockReplicaSetControllerMockEnqueue.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "671df613faadd9c926126fe9894bbfef", "score": "0.6111578", "text": "func (mock *NamespacedServiceAccountTokenControllerMock) EnqueueCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockNamespacedServiceAccountTokenControllerMockEnqueue.RLock()\n\tcalls = mock.calls.Enqueue\n\tlockNamespacedServiceAccountTokenControllerMockEnqueue.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "102d5993771a64a2022b2190313e9779", "score": "0.610997", "text": "func (mock *ModuleClientMock) ListCalls() []struct {\n\tNamespace string\n\tOpts v1b.ListOptions\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tOpts v1b.ListOptions\n\t}\n\tlockModuleClientMockList.RLock()\n\tcalls = mock.calls.List\n\tlockModuleClientMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "b59ab74df6c446ce9e657ccba576b662", "score": "0.6093549", "text": "func (mmIs *mLoggerMockIs) Calls() []*LoggerMockIsParams {\n\tmmIs.mutex.RLock()\n\n\targCopy := make([]*LoggerMockIsParams, len(mmIs.callArgs))\n\tcopy(argCopy, mmIs.callArgs)\n\n\tmmIs.mutex.RUnlock()\n\n\treturn argCopy\n}", "title": "" }, { "docid": "f165682661ade960711d1d65b6db203d", "score": "0.6067712", "text": "func (mock *SenderMock) SendCalls() []struct {\n\tE event.Event\n} {\n\tvar calls []struct {\n\t\tE event.Event\n\t}\n\tmock.lockSend.RLock()\n\tcalls = mock.calls.Send\n\tmock.lockSend.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "a09204cdb3381c7d36bbffa2c2e3b231", "score": "0.60565245", "text": "func (mock *TelegramNotifMock) SendCalls() []struct {\n\tChanID string\n\tItem feed.Item\n} {\n\tvar calls []struct {\n\t\tChanID string\n\t\tItem feed.Item\n\t}\n\tmock.lockSend.RLock()\n\tcalls = mock.calls.Send\n\tmock.lockSend.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "8eb9ada054204290db0169d64e2b7dc9", "score": "0.60523766", "text": "func (mock *HarborProjectInterfaceMock) CreateCalls() []struct {\n\tIn1 *v3.HarborProject\n} {\n\tvar calls []struct {\n\t\tIn1 *v3.HarborProject\n\t}\n\tlockHarborProjectInterfaceMockCreate.RLock()\n\tcalls = mock.calls.Create\n\tlockHarborProjectInterfaceMockCreate.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "45f0254a9970ada5059f27669ddc2cb1", "score": "0.605017", "text": "func (mock *GroupControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockGroupControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockGroupControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "933de8102de18487cd9239534561eb5a", "score": "0.6049231", "text": "func (mock *SourceCodeRepositoryInterfaceMock) ListCalls() []struct {\n\tOpts v1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts v1.ListOptions\n\t}\n\tlockSourceCodeRepositoryInterfaceMockList.RLock()\n\tcalls = mock.calls.List\n\tlockSourceCodeRepositoryInterfaceMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "c1c4345a06cb8f5114176466d5d53ca4", "score": "0.6049133", "text": "func (mock *ProjectAlertGroupInterfaceMock) ControllerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockProjectAlertGroupInterfaceMockController.RLock()\n\tcalls = mock.calls.Controller\n\tlockProjectAlertGroupInterfaceMockController.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "b47fb33a9fa59f2778b5b94ce605a13f", "score": "0.6045865", "text": "func (mock *RkeK8sServiceOptionControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockRkeK8sServiceOptionControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockRkeK8sServiceOptionControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "f13de18cd0924cfd01b98b3326fcdf00", "score": "0.6043365", "text": "func (mock *CatalogTemplateVersionControllerMock) EnqueueCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockCatalogTemplateVersionControllerMockEnqueue.RLock()\n\tcalls = mock.calls.Enqueue\n\tlockCatalogTemplateVersionControllerMockEnqueue.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "fa66c362d9e7f1c6f78f5f190e5eb80b", "score": "0.60406876", "text": "func (mock *ProjectAlertGroupListerMock) GetCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockProjectAlertGroupListerMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockProjectAlertGroupListerMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "0fd03fca16b33939accf0fec94731066", "score": "0.6038402", "text": "func (mock *ModuleControllerMock) CreateCalls() []struct {\n\tIn1 *v1a.Module\n} {\n\tvar calls []struct {\n\t\tIn1 *v1a.Module\n\t}\n\tlockModuleControllerMockCreate.RLock()\n\tcalls = mock.calls.Create\n\tlockModuleControllerMockCreate.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e2ae3f5c4bf77a4532f4ca3a9a69efbb", "score": "0.6036397", "text": "func (mock *SourceCodeRepositoryInterfaceMock) ControllerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockSourceCodeRepositoryInterfaceMockController.RLock()\n\tcalls = mock.calls.Controller\n\tlockSourceCodeRepositoryInterfaceMockController.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "c64c5b4818f8435f6f225c62fdd63ffc", "score": "0.6030007", "text": "func (mock *IConsumerGroupMock) InitialiseCalls() []struct {\n\tCtx context.Context\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t}\n\tlockIConsumerGroupMockInitialise.RLock()\n\tcalls = mock.calls.Initialise\n\tlockIConsumerGroupMockInitialise.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "50ba792efc28fc08ccea2ee97060a003", "score": "0.6024616", "text": "func (mock *HorizontalPodAutoscalerInterfaceMock) GetCalls() []struct {\n\tName string\n\tOpts metav1.GetOptions\n} {\n\tvar calls []struct {\n\t\tName string\n\t\tOpts metav1.GetOptions\n\t}\n\tlockHorizontalPodAutoscalerInterfaceMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockHorizontalPodAutoscalerInterfaceMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "a052e5e67e5b80f2688582c151b236bc", "score": "0.6008115", "text": "func (mock *CatalogTemplateVersionInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockCatalogTemplateVersionInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockCatalogTemplateVersionInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "ec95b6bffcb0fba6561af295d65ebd83", "score": "0.6006513", "text": "func (mock *IProducerMock) InitialiseCalls() []struct {\n\tCtx context.Context\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t}\n\tlockIProducerMockInitialise.RLock()\n\tcalls = mock.calls.Initialise\n\tlockIProducerMockInitialise.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "8b62858d072b453a756783d3bb7d7bfd", "score": "0.59964347", "text": "func (mock *NodeDriverControllerMock) EnqueueCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockNodeDriverControllerMockEnqueue.RLock()\n\tcalls = mock.calls.Enqueue\n\tlockNodeDriverControllerMockEnqueue.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e93465d0998315a4440c0dcbd5b1734e", "score": "0.59958917", "text": "func (mock *ReplicaSetListerMock) GetCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockReplicaSetListerMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockReplicaSetListerMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "f6b6a6b240307fa8667d0c3e661c580c", "score": "0.5990588", "text": "func (mock *HorizontalPodAutoscalerListerMock) ListCalls() []struct {\n\tNamespace string\n\tSelector labels.Selector\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tSelector labels.Selector\n\t}\n\tlockHorizontalPodAutoscalerListerMockList.RLock()\n\tcalls = mock.calls.List\n\tlockHorizontalPodAutoscalerListerMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e594fdae73a56ae833c6c8d2f5f66e7f", "score": "0.59891146", "text": "func (mock *ClusterRegistrationTokenInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockClusterRegistrationTokenInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockClusterRegistrationTokenInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "c8b103ac832c4b78b37c9721c94ce8bc", "score": "0.5987406", "text": "func (mmPanicf *mLoggerMockPanicf) Calls() []*LoggerMockPanicfParams {\n\tmmPanicf.mutex.RLock()\n\n\targCopy := make([]*LoggerMockPanicfParams, len(mmPanicf.callArgs))\n\tcopy(argCopy, mmPanicf.callArgs)\n\n\tmmPanicf.mutex.RUnlock()\n\n\treturn argCopy\n}", "title": "" }, { "docid": "d96a48f0effd875af60848b99840c537", "score": "0.5984585", "text": "func (mock *ProjectAlertGroupListerMock) ListCalls() []struct {\n\tNamespace string\n\tSelector labels.Selector\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tSelector labels.Selector\n\t}\n\tlockProjectAlertGroupListerMockList.RLock()\n\tcalls = mock.calls.List\n\tlockProjectAlertGroupListerMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "d77c18b5fcbcb614b37e844b24797341", "score": "0.5975312", "text": "func (mock *RkeK8sServiceOptionInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockRkeK8sServiceOptionInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockRkeK8sServiceOptionInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "30f41a6a0bf3bf1d75d53d6ac6073807", "score": "0.59723634", "text": "func (mock *HorizontalPodAutoscalerInterfaceMock) ControllerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockHorizontalPodAutoscalerInterfaceMockController.RLock()\n\tcalls = mock.calls.Controller\n\tlockHorizontalPodAutoscalerInterfaceMockController.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "a9cbc666ec66584db24c7090ea270eca", "score": "0.5964327", "text": "func (mock *SourceCodeRepositoryListerMock) GetCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockSourceCodeRepositoryListerMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockSourceCodeRepositoryListerMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "31fac2b599fb6e68b308a24daf6a1aa1", "score": "0.59568644", "text": "func (mock *NamespacedServiceAccountTokenInterfaceMock) ControllerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockNamespacedServiceAccountTokenInterfaceMockController.RLock()\n\tcalls = mock.calls.Controller\n\tlockNamespacedServiceAccountTokenInterfaceMockController.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "51fecb6b0aa5a4a3f416bef52ac118e4", "score": "0.59484696", "text": "func (mock *RkeK8sServiceOptionInterfaceMock) ListCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockRkeK8sServiceOptionInterfaceMockList.RLock()\n\tcalls = mock.calls.List\n\tlockRkeK8sServiceOptionInterfaceMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "e77cc44d23b70501be7f65248609f54e", "score": "0.59477574", "text": "func (mock *HarborProjectControllerMock) GenericCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockHarborProjectControllerMockGeneric.RLock()\n\tcalls = mock.calls.Generic\n\tlockHarborProjectControllerMockGeneric.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "62ff5c0e283aa9f5ad77e66bafb7a8f3", "score": "0.5946751", "text": "func (mmOpenedRequests *mFilamentCalculatorMockOpenedRequests) Calls() []*FilamentCalculatorMockOpenedRequestsParams {\n\tmmOpenedRequests.mutex.RLock()\n\n\targCopy := make([]*FilamentCalculatorMockOpenedRequestsParams, len(mmOpenedRequests.callArgs))\n\tcopy(argCopy, mmOpenedRequests.callArgs)\n\n\tmmOpenedRequests.mutex.RUnlock()\n\n\treturn argCopy\n}", "title": "" }, { "docid": "e5d70eaa9e2e70fd3bc6130a860c3ffe", "score": "0.5940324", "text": "func (mock *GroupInterfaceMock) ListCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockGroupInterfaceMockList.RLock()\n\tcalls = mock.calls.List\n\tlockGroupInterfaceMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "817479c3dbfb2d04a68eec62914d00ce", "score": "0.5937929", "text": "func (mmRequests *mFilamentCalculatorMockRequests) Calls() []*FilamentCalculatorMockRequestsParams {\n\tmmRequests.mutex.RLock()\n\n\targCopy := make([]*FilamentCalculatorMockRequestsParams, len(mmRequests.callArgs))\n\tcopy(argCopy, mmRequests.callArgs)\n\n\tmmRequests.mutex.RUnlock()\n\n\treturn argCopy\n}", "title": "" }, { "docid": "557c4fb55aec68265aa9ac513ca1ab4b", "score": "0.593357", "text": "func (mock *ModuleClientMock) GetCalls() []struct {\n\tNamespace string\n\tName string\n\tOptions v1b.GetOptions\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t\tOptions v1b.GetOptions\n\t}\n\tlockModuleClientMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockModuleClientMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "518cf97f6ee5de16277d094e231a9d9d", "score": "0.59304786", "text": "func (mock *ProjectAlertGroupInterfaceMock) GetCalls() []struct {\n\tName string\n\tOpts metav1.GetOptions\n} {\n\tvar calls []struct {\n\t\tName string\n\t\tOpts metav1.GetOptions\n\t}\n\tlockProjectAlertGroupInterfaceMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockProjectAlertGroupInterfaceMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "63a1469fa96fae8d8420f205fcb432ed", "score": "0.5929382", "text": "func (mock *IGitMock) PushCalls() []struct {\n\tGitContext common_models.GitContext\n} {\n\tvar calls []struct {\n\t\tGitContext common_models.GitContext\n\t}\n\tmock.lockPush.RLock()\n\tcalls = mock.calls.Push\n\tmock.lockPush.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "c72fb8ae013bd2b0e5d3c818545859bf", "score": "0.5920434", "text": "func (mock *LocationsByDriverAndTimeGetterMock) GetCalls() []struct {\n\tDriverID string\n\tFrom time.Time\n} {\n\tvar calls []struct {\n\t\tDriverID string\n\t\tFrom time.Time\n\t}\n\tlockLocationsByDriverAndTimeGetterMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockLocationsByDriverAndTimeGetterMockGet.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "26a0822fec16a3338aab0b2cfd4b2504", "score": "0.5919845", "text": "func (mock *ReplicaSetInterfaceMock) ListCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockReplicaSetInterfaceMockList.RLock()\n\tcalls = mock.calls.List\n\tlockReplicaSetInterfaceMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "9cf9c8c97e93c84c0e29fe8bc20be63b", "score": "0.5919541", "text": "func (mock *CatalogTemplateVersionControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockCatalogTemplateVersionControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockCatalogTemplateVersionControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "1227c100748368d13318573c421eb13c", "score": "0.59123", "text": "func (mock *NamespacedServiceAccountTokenInterfaceMock) ListCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockNamespacedServiceAccountTokenInterfaceMockList.RLock()\n\tcalls = mock.calls.List\n\tlockNamespacedServiceAccountTokenInterfaceMockList.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "0830774d27b357a67aa6e846d1ae4e3d", "score": "0.59102076", "text": "func (m *MockIDEA) Calls(arg0 map[string]string, arg1 error) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Calls\", arg0, arg1)\n}", "title": "" }, { "docid": "48ade6c859609e873c45928ad8ff83b3", "score": "0.59049094", "text": "func (mock *NodeDriverInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockNodeDriverInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockNodeDriverInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "8f0f69dc7765f5f2f350c7ddb9d0a61c", "score": "0.59040195", "text": "func (mock *InitialiserMock) DoGetHealthCheckCalls() []struct {\n\tCfg *config.Config\n\tBuildTime string\n\tGitCommit string\n\tVersion string\n} {\n\tvar calls []struct {\n\t\tCfg *config.Config\n\t\tBuildTime string\n\t\tGitCommit string\n\t\tVersion string\n\t}\n\tmock.lockDoGetHealthCheck.RLock()\n\tcalls = mock.calls.DoGetHealthCheck\n\tmock.lockDoGetHealthCheck.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "7dce0aac165179445702d52e857ae714", "score": "0.58992064", "text": "func (mock *InitialiserMock) DoGetHealthCheckCalls() []struct {\n\tCfg *config.Config\n\tBuildTime string\n\tGitCommit string\n\tVersion string\n} {\n\tvar calls []struct {\n\t\tCfg *config.Config\n\t\tBuildTime string\n\t\tGitCommit string\n\t\tVersion string\n\t}\n\tlockInitialiserMockDoGetHealthCheck.RLock()\n\tcalls = mock.calls.DoGetHealthCheck\n\tlockInitialiserMockDoGetHealthCheck.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "ebd66acb6a06e5164d22ea064c80adce", "score": "0.58916765", "text": "func (mmMiddleware *mMiddlewareMockMiddleware) Calls() []*MiddlewareMockMiddlewareParams {\n\tmmMiddleware.mutex.RLock()\n\n\targCopy := make([]*MiddlewareMockMiddlewareParams, len(mmMiddleware.callArgs))\n\tcopy(argCopy, mmMiddleware.callArgs)\n\n\tmmMiddleware.mutex.RUnlock()\n\n\treturn argCopy\n}", "title": "" }, { "docid": "10140c4eacf463f6c53b34e3b784fd5a", "score": "0.5888543", "text": "func (mock *ModuleClientMock) CreateCalls() []struct {\n\tIn1 *v1a.Module\n} {\n\tvar calls []struct {\n\t\tIn1 *v1a.Module\n\t}\n\tlockModuleClientMockCreate.RLock()\n\tcalls = mock.calls.Create\n\tlockModuleClientMockCreate.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "2898fdc3b57ac246246325ba95be3863", "score": "0.5884836", "text": "func (mock *HarborProjectInterfaceMock) DeleteCalls() []struct {\n\tName string\n\tOptions *v1.DeleteOptions\n} {\n\tvar calls []struct {\n\t\tName string\n\t\tOptions *v1.DeleteOptions\n\t}\n\tlockHarborProjectInterfaceMockDelete.RLock()\n\tcalls = mock.calls.Delete\n\tlockHarborProjectInterfaceMockDelete.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "da24202888a3eb659187485ea225dec8", "score": "0.58718455", "text": "func (mmPanic *mLoggerMockPanic) Calls() []*LoggerMockPanicParams {\n\tmmPanic.mutex.RLock()\n\n\targCopy := make([]*LoggerMockPanicParams, len(mmPanic.callArgs))\n\tcopy(argCopy, mmPanic.callArgs)\n\n\tmmPanic.mutex.RUnlock()\n\n\treturn argCopy\n}", "title": "" }, { "docid": "6225c52fa16cb860b329ce68abc7bc4b", "score": "0.5870264", "text": "func (mmTakeFirst *mRequestsQueueMockTakeFirst) Calls() []*RequestsQueueMockTakeFirstParams {\n\tmmTakeFirst.mutex.RLock()\n\n\targCopy := make([]*RequestsQueueMockTakeFirstParams, len(mmTakeFirst.callArgs))\n\tcopy(argCopy, mmTakeFirst.callArgs)\n\n\tmmTakeFirst.mutex.RUnlock()\n\n\treturn argCopy\n}", "title": "" }, { "docid": "3791d57034fc984d3b742ea60fde43fe", "score": "0.5868834", "text": "func (mock *ReplicaSetControllerMock) ListerCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockReplicaSetControllerMockLister.RLock()\n\tcalls = mock.calls.Lister\n\tlockReplicaSetControllerMockLister.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "adba505c4886e978bdf0d209e7885285", "score": "0.5868467", "text": "func (mock *ClusterRegistrationTokenControllerMock) EnqueueCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockClusterRegistrationTokenControllerMockEnqueue.RLock()\n\tcalls = mock.calls.Enqueue\n\tlockClusterRegistrationTokenControllerMockEnqueue.RUnlock()\n\treturn calls\n}", "title": "" } ]
8b21fcbc9e736dbf5cc401b534191fcf
Requires Authentication Predefined Parameter Functions
[ { "docid": "7a83dc3a4043dd324bc27a8fa83067bd", "score": "0.0", "text": "func TypeId(id int) util.KVP {\n\treturn util.KVP{Key:\"type_id\", Value:strconv.Itoa(id)}\n}", "title": "" } ]
[ { "docid": "cabfbe32283941277caac04e0ce1e9ea", "score": "0.60859954", "text": "func AUTHCommand(c *redigo.CommandArg) {\n\n}", "title": "" }, { "docid": "fd2b0909831f1b115c6f290695be3dcf", "score": "0.59169155", "text": "func SimpleAuth(fn http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlinktopassword := os.Getenv(passwordEnv)\n\t\tif len(linktopassword) > 0 {\n\t\t\tpassword := r.Form.Get(\"password\")\n\t\t\tif linktopassword != password {\n\t\t\t\terrortext := \"Password param incorrect\"\n\t\t\t\thttp.Error(w, errortext, http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tfn(w, r)\n\t}\n}", "title": "" }, { "docid": "a0d9f7ca09ed1b11ca6dab10f2725e53", "score": "0.5886674", "text": "func ABasicAuth(paraList ...interface{}) *BasicAuthMidware {\n var ret=BasicAuthMidware{\n realm: \"The Site\",\n Action: nil,\n }\n if len(paraList)==1 {\n var tmp, ok=paraList[0].(func(string, string) bool)\n if !ok {\n panic(INVALID_PARAMETER)\n }\n ret.inspector=tmp\n } else if len(paraList)==2 {\n var tmp, ok=paraList[1].(string)\n if !ok {\n panic(INVALID_PARAMETER)\n }\n switch elem1:=paraList[0].(type) {\n case func(string, string) bool:\n ret.inspector=elem1\n ret.realm=tmp\n case string:\n ret.inspector=generateInspector(elem1, tmp)\n default:\n panic(INVALID_PARAMETER)\n }\n } else if len(paraList)==3 {\n var e1, o1=paraList[0].(string)\n var e2, o2=paraList[1].(string)\n var e3, o3=paraList[2].(string)\n if o1 && o2 && o3 {\n ret.inspector=generateInspector(e1, e2)\n ret.realm=e3\n } else {\n panic(INVALID_PARAMETER)\n }\n } else {\n panic(INVALID_PARAMETER)\n }\n\n return &ret\n}", "title": "" }, { "docid": "442fb595097a770471ce6004df1ee39c", "score": "0.58509475", "text": "func Auth() bm.HandlerFunc {\n\treturn func(c *bm.Context) {\n\t\treq := c.Request\n\t\tnoAuth := false\n\t\tfor _, v := range _filter {\n\t\t\tif v == req.URL.Path {\n\t\t\t\tnoAuth = true\n\t\t\t}\n\t\t}\n\t\tif noAuth || c.Request.Method == http.MethodOptions {\n\t\t\tc.Next()\n\t\t\treturn\n\t\t}\n\t\tkey := req.Header.Get(_authorization)\n\t\tif key == \"\" {\n\t\t\ttoken := req.URL.Query().Get(_token)\n\t\t\tif token != \"\" {\n\t\t\t\tb, e := base64.URLEncoding.DecodeString(token)\n\t\t\t\tif e != nil {\n\t\t\t\t\tc.JSON(nil, _failTokenError)\n\t\t\t\t\tc.Abort()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tkey = string(b)\n\t\t\t}\n\t\t}\n\t\tif key == \"\" {\n\t\t\tc.JSON(nil, _noTokenError)\n\t\t\tc.Abort()\n\t\t\treturn\n\t\t}\n\t\tsecret := os.Getenv(_envSecret)\n\t\tif secret == \"\" {\n\t\t\tc.JSON(nil, _osEnvError)\n\t\t\tc.Abort()\n\t\t\treturn\n\t\t}\n\t\t// NOTE: 请求登录鉴权服务接口,拿到对应的用户id\n\t\tp, err := verifyToken(secret, key)\n\t\tif err != nil {\n\t\t\tc.JSON(nil, err)\n\t\t\tc.Abort()\n\t\t\treturn\n\t\t}\n\t\tc.Set(metadata.Mid, p.MID)\n\t\tc.Set(Pid, p.PID)\n\t\tc.Set(Role, p.Role)\n\t\tc.Set(IsAdmin, p.IsAdmin)\n\t\tif md, ok := metadata.FromContext(c); ok {\n\t\t\tmd[metadata.Mid] = p.MID\n\t\t\tmd[Pid] = p.PID\n\t\t\tmd[Role] = p.Role\n\t\t\tmd[IsAdmin] = p.IsAdmin\n\t\t}\n\t\tc.Next()\n\t}\n}", "title": "" }, { "docid": "ec0bad1b9cd0727d70229521f86b34d0", "score": "0.58129793", "text": "func RequireAuth(c *gin.Context) {\n\ttoken := c.Request.FormValue(\"api_key\")\n\n\tif token == \"\" {\n\t\tErrorResponse(401, \"Missing 'api_key' patameter\", c)\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tif token != os.Getenv(\"API_KEY\") {\n\t\tErrorResponse(401, \"Invalid api key\", c)\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tc.Next()\n}", "title": "" }, { "docid": "0d3e5a58aee62feac3e472b58bd2f0c7", "score": "0.57440585", "text": "func RequireSuperuser(handler func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request) {\n return func (c http.ResponseWriter, req *http.Request) {\n // Gets the current session\n session, err := GetSession(c, req)\n if err != nil || session.Values[\"secret\"] != systemConf.AuthSecret {\n // Return error\n http.Error(c, \"Unauthorized\", http.StatusUnauthorized)\n return\n }\n\n // Call the encapsulated function\n handler(c, req)\n }\n}", "title": "" }, { "docid": "31b54b374f513214802ee7223afbae6b", "score": "0.57237643", "text": "func ScopedCredentials(scope interface{}) Expr { return fn1(\"credentials\", scope) }", "title": "" }, { "docid": "5bba5af3325bea1cb82d0af69289c4fc", "score": "0.5686484", "text": "func redirectPolicyFunc(req *http.Request, via []*http.Request) error {\n\t req.SetBasicAuth(cfg.Username,cfg.Password)\n return nil\n}", "title": "" }, { "docid": "d2c735fa5d92da81933b978e90553b94", "score": "0.5682897", "text": "func RequireAuth(handler func(conn http.ResponseWriter, req *http.Request)) func(conn http.ResponseWriter, req *http.Request) {\n\treturn func(conn http.ResponseWriter, req *http.Request) {\n\t\tif mode.IsAuthorized(req) {\n\t\t\thandler(conn, req)\n\t\t} else {\n\t\t\tSendUnauthorized(conn)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a214f96f3328c26b62311792fd406430", "score": "0.5677199", "text": "func HAuthAuthenticated(c *gin.Context) {\n\n}", "title": "" }, { "docid": "bb9df494d668e501423e56f84d8b3285", "score": "0.5676838", "text": "func AuthRequired() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\t// Check if the token is a Bearer token\n\t\tauthorizationHeader := strings.TrimSpace(c.GetHeader(\"authorization\"))\n\t\ts := persistence.GetUserRepository()\n\t\tif authorizationHeader != \"\" {\n\t\t\t// Token need to return user info\n\t\t\tif strings.Contains(authorizationHeader, \"Bearer\"){\n\t\t\t\tauth_slice := strings.Fields(authorizationHeader)\n\t\t\t\tif valid, username := crypto.ValidateToken(auth_slice[1]); !valid{\n\t\t\t\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{\"error\": \"unauthorized : token not accepted\"})\n\t\t\t\t\treturn\n\t\t\t\t} else {\n\t\t\t\t\tif user , err := s.GetByUsername(username); err != nil {\n\t\t\t\t\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{\"error\": \"unauthorized : token not accepted\"})\n\t\t\t\t\t} else {\n\t\t\t\t\t\tc.Set(\"user\", user)\n\t\t\t\t\t\tc.Next()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t\t// API Key\n\t\t\t\t\tif user, err := s.GetbyKey(authorizationHeader); err != nil {\n\t\t\t\t\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{\"error\": \"unauthorized : api_key not valid\"})\n\t\t\t\t\t} else {\n\t\t\t\t\t\tc.Set(\"user\", user)\n\t\t\t\t\t\tc.Next()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}else{\n\t\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{\"error\": \"No authorization header found\"})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b9b3f78b19e5399f00f549104f45c323", "score": "0.5647429", "text": "func authCheckFunc(myAPI *api.API, r *http.Request, suffix string) AuthCheckerFunc {\n\treturn func() *api.TerminalSettings {\n\t\thttpResponse, authResponse, err := myAPI.PreAuthorize(suffix, r)\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\t\tdefer httpResponse.Body.Close()\n\n\t\tif httpResponse.StatusCode != http.StatusOK || authResponse == nil {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn authResponse.Terminal\n\t}\n}", "title": "" }, { "docid": "ecc573690de0159d9e8af6b4eeb554b1", "score": "0.5640638", "text": "func AuthRequired() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\t_, ok := c.Get(\"userId\")\n\t\tif !ok {\n\t\t\tc.AbortWithError(http.StatusUnauthorized, fmt.Errorf(\"Unauthorized\"))\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "36e1e16c5d829ce409b52ed9a320178a", "score": "0.56178826", "text": "func RequireTokenAuthentication(rw http.ResponseWriter, req *http.Request, method string, next http.HandlerFunc) {\n\tresponse := json.New()\n\t// log.Info(\"Inside RequireTokenAuthentication\")\n\tif req.Header.Get(\"Authorization\") != \"\" {\n\t\t//Decode the token and get the accountID\n\t\tif authUser, err := DoTokenDecode(req.Header.Get(\"Authorization\")); err == nil {\n\t\t\t//Validate the token\n\t\t\tDoValidateToken(rw, req, authUser, method, next)\n\t\t} else {\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorln(\"Failed while decoding JWT token: \", err.Error())\n\t\t\t} else {\n\t\t\t\t// log.Println(\"AccountID in Token: \", authUser.AccountID)\n\t\t\t\tlog.Error(\"AccountID in the request is mismatched with JWT Token\")\n\t\t\t}\n\t\t\tresponse.Put(\"reason\", \"Unauthorized\")\n\t\t\trw.WriteHeader(http.StatusForbidden)\n\t\t\trw.Write([]byte(response.ToString()))\n\t\t}\n\t} else {\n\t\tlog.Errorln(\"Request header does not contain auth token \")\n\t\tresponse.Put(\"reason\", \"Request header does not contain auth token\")\n\t\trw.WriteHeader(http.StatusForbidden)\n\t\trw.Write([]byte(response.ToString()))\n\t}\n}", "title": "" }, { "docid": "8ea53d420496911763a323d3a342f463", "score": "0.5515885", "text": "func RequireAuthentication(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// Make sure an Authorization header was provided\n\t\ttoken := r.Header.Get(\"Authorization\")\n\t\tif token == \"\" {\n\t\t\thttp.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\t\ttoken = strings.TrimPrefix(token, \"Bearer \")\n\t\t// This is where token validation would be done. For this boilerplate,\n\t\t// we just check and make sure the token matches a hardcoded string\n\t\tif token != ValidBearer {\n\t\t\thttp.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\t\t// Assuming that passed, we can execute the authenticated handler\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "14d47f735d7c53a87cc32dd0451c09da", "score": "0.549271", "text": "func Auth(h AuthedHandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tu := GetUser(r)\n\t\tif ValidUser(u) {\n\t\t\th(w, r, u)\n\t\t}\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "2ed4542146dafe875813e85b544c94c5", "score": "0.5468811", "text": "func AuthenticateApiToken(originalHandler http.Handler) http.Handler {\n return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request){\n req.ParseForm()\n apiToken := req.Header.Get(\"API_KEY\")\n if apiToken == \"\" {\n apiToken = req.Form.Get(\"apiKey\")\n }\n if apiToken != os.Getenv(\"AUTH_TOKEN\") {\n resp.WriteHeader(http.StatusUnauthorized)\n fmt.Fprint(resp, \"Not Authorized!\")\n return\n }\n originalHandler.ServeHTTP(resp, req)\n })\n}", "title": "" }, { "docid": "a9440330b7f9653c88d6893367b40d6c", "score": "0.54686433", "text": "func UserGet(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\n}", "title": "" }, { "docid": "1f315197799baa39525946ab32a511e6", "score": "0.5439216", "text": "func auth(username, password string) error {\n\treturn errors.New(\"not implemented\")\n}", "title": "" }, { "docid": "bfcf216b633d8c85a49bea6f2ff4be49", "score": "0.54282", "text": "func Credentials() Expr { return fn1(\"credentials\", NullV{}) }", "title": "" }, { "docid": "b197f70c4d468cc1dcba415f5d8ad006", "score": "0.54150736", "text": "func (oa apiAuth) authRequired(url string, operationSecuritySchemes SpecSecuritySchemes) (bool, SpecSecuritySchemes) {\n\t// TODO: check in the OpenAPI spec whether operation overrides global schemes or can complement global configuration?\n\tif len(operationSecuritySchemes) != 0 {\n\t\tlog.Printf(\"operation security policies found for '%s' (overriding global security config if applicable). Selected the following based on order of appearance in the list %+v\", url, operationSecuritySchemes)\n\t\treturn true, operationSecuritySchemes\n\t}\n\tlog.Printf(\"operation security schemes missing, falling back to global security schemes (if there's any)\")\n\tif oa.globalSecuritySchemes != nil && len(*oa.globalSecuritySchemes) != 0 {\n\t\tlog.Printf(\"the global configuration contains security schemes, selected the following based on order of appearance in the list %+v\", oa.globalSecuritySchemes)\n\t\treturn true, *oa.globalSecuritySchemes\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "64a52ca4acfb52d7d4a7eab037990398", "score": "0.53886056", "text": "func testAuthenticatedConsoleAvailableValidUserPass(t *testing.T) {\n\tconst expectedReturnCode = 200\n\n\t// Get context for Public\n\tpubCluster, err := testRunner.GetPublicContext(1)\n\tassert.Assert(t, err)\n\n\ttestConsoleAccess(t, pubCluster, flowURL+\"/sites/\", \"admin\", \"admin\", expectedReturnCode)\n}", "title": "" }, { "docid": "6eef5de7968fda1266847de0bed098bc", "score": "0.5377227", "text": "func Auth(fn func(w http.ResponseWriter, r *http.Request, param httprouter.Params)) func(w http.ResponseWriter, r *http.Request, param httprouter.Params) {\n\treturn func(w http.ResponseWriter, r *http.Request, param httprouter.Params) {\n\t\t// Grab the token from the header\n\t\tauthToken := r.Header.Get(\"Authorization\")\n\t\tauthArr := strings.Split(authToken, \" \")\n\t\tif len(authArr) != 2 {\n\t\t\t// Token is missing, returns with error code 401 Unauthorized\n\t\t\tlog.Println(\"Missing auth token\")\n\t\t\tresponses.WriteErrorResponse(w, http.StatusUnauthorized, \"Missing auth token\")\n\t\t\treturn\n\t\t}\n\t\ttknStr := authArr[1]\n\t\tclaims := &Token{}\n\t\t// Validate the token\n\t\ttkn, err := jwt.ParseWithClaims(tknStr, claims, func(token *jwt.Token) (interface{}, error) {\n\t\t\treturn verifyKey, nil\n\t\t})\n\t\tif err != nil {\n\t\t\tswitch err.(type) {\n\t\t\tcase *jwt.ValidationError:\n\t\t\t\t// Something was wrong during the validation\n\t\t\t\tvErr := err.(*jwt.ValidationError)\n\t\t\t\tswitch vErr.Errors {\n\t\t\t\tcase jwt.ValidationErrorExpired:\n\t\t\t\t\tlog.Printf(\"Token Expired: %+v\\n\", vErr.Errors)\n\t\t\t\t\tresponses.WriteErrorResponse(w, http.StatusUnauthorized, \"Token Expired, get a new one\")\n\t\t\t\t\treturn\n\t\t\t\tdefault:\n\t\t\t\t\tlog.Printf(\"ValidationError error: %+v\\n\", vErr.Errors)\n\t\t\t\t\tresponses.WriteErrorResponse(w, http.StatusForbidden, \"Error while Parsing Token\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\t// Something else went wrong\n\t\t\t\tlog.Printf(\"Token parse error: %v\\n\", err)\n\t\t\t\tresponses.WriteErrorResponse(w, http.StatusInternalServerError, \"Malformed authentication token\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif !tkn.Valid {\n\t\t\t// Token is invalid, maybe not signed on this server\n\t\t\tlog.Println(\"Token is not valid\")\n\t\t\tresponses.WriteErrorResponse(w, http.StatusUnauthorized, \"Token is not valid\")\n\t\t\treturn\n\t\t}\n\t\tctx := context.WithValue(r.Context(), \"user_id\", claims.UserID)\n\t\tfn(w, r.WithContext(ctx), param)\n\t}\n}", "title": "" }, { "docid": "37cc91fb3d777938551918f5de18a72a", "score": "0.5376439", "text": "func mustAuthenticate(sess *session, tag string, commandName string) *response {\n\tmessage := commandName + \" not authenticated\"\n\tsess.log(message)\n\treturn bad(tag, message)\n}", "title": "" }, { "docid": "64ecc286c4bfca6df4de826ef719b32c", "score": "0.5350257", "text": "func Authn(perm string, w http.ResponseWriter, r *http.Request) (string, error) {\n\tvar err error\n\tw.Header().Set(\"WWW-Authenticate\", `Basic realm=\"Restricted\"`)\n\n\t// Need to run the HTTP library `BasicAuth` even if `BasicAuth == false`, as\n\t// this function currently encapsulates authorization as well, and this is\n\t// the call where we get the username to check the RBAC settings\n\tusername, password, authOK := r.BasicAuth()\n\tif AuditFlag {\n\t\tlog.Infof(\"[audit] %s username=[%s] method=[%s] ip=[%s] ok=[%t] \", perm, username, r.Method, r.RemoteAddr, authOK)\n\t}\n\n\t// Check to see if this user is authenticated\n\t// If BasicAuth is \"disabled\", skip the authentication; o/w/ check if the\n\t// authentication passed\n\tif !BasicAuth {\n\t\tlog.Debugf(\"BasicAuth disabled, Skipping Authentication %s username=[%s]\", perm, username)\n\t} else {\n\t\tlog.Debugf(\"Authentication Attempt %s username=[%s]\", perm, username)\n\t\tif !authOK {\n\t\t\thttp.Error(w, \"Not Authorized. Basic Authentication credentials must be provided according to RFC 7617, Section 2.\", 401)\n\t\t\treturn \"\", errors.New(\"Not Authorized: Credentials do not comply with RFC 7617\")\n\t\t}\n\t}\n\n\tif !BasicAuthCheck(username, password) {\n\t\tlog.Errorf(\"Authentication Failed %s username=[%s]\", perm, username)\n\t\thttp.Error(w, \"Not authenticated in apiserver\", 401)\n\t\treturn \"\", errors.New(\"Not Authenticated\")\n\t}\n\n\tif !BasicAuthzCheck(username, perm) {\n\t\tlog.Errorf(\"Authorization Failed %s username=[%s]\", perm, username)\n\t\thttp.Error(w, \"Not authorized for this apiserver action\", 403)\n\t\treturn \"\", errors.New(\"Not authorized for this apiserver action\")\n\t}\n\n\tlog.Debug(\"Authentication Success\")\n\treturn username, err\n\n}", "title": "" }, { "docid": "64ecc286c4bfca6df4de826ef719b32c", "score": "0.5350257", "text": "func Authn(perm string, w http.ResponseWriter, r *http.Request) (string, error) {\n\tvar err error\n\tw.Header().Set(\"WWW-Authenticate\", `Basic realm=\"Restricted\"`)\n\n\t// Need to run the HTTP library `BasicAuth` even if `BasicAuth == false`, as\n\t// this function currently encapsulates authorization as well, and this is\n\t// the call where we get the username to check the RBAC settings\n\tusername, password, authOK := r.BasicAuth()\n\tif AuditFlag {\n\t\tlog.Infof(\"[audit] %s username=[%s] method=[%s] ip=[%s] ok=[%t] \", perm, username, r.Method, r.RemoteAddr, authOK)\n\t}\n\n\t// Check to see if this user is authenticated\n\t// If BasicAuth is \"disabled\", skip the authentication; o/w/ check if the\n\t// authentication passed\n\tif !BasicAuth {\n\t\tlog.Debugf(\"BasicAuth disabled, Skipping Authentication %s username=[%s]\", perm, username)\n\t} else {\n\t\tlog.Debugf(\"Authentication Attempt %s username=[%s]\", perm, username)\n\t\tif !authOK {\n\t\t\thttp.Error(w, \"Not Authorized. Basic Authentication credentials must be provided according to RFC 7617, Section 2.\", 401)\n\t\t\treturn \"\", errors.New(\"Not Authorized: Credentials do not comply with RFC 7617\")\n\t\t}\n\t}\n\n\tif !BasicAuthCheck(username, password) {\n\t\tlog.Errorf(\"Authentication Failed %s username=[%s]\", perm, username)\n\t\thttp.Error(w, \"Not authenticated in apiserver\", 401)\n\t\treturn \"\", errors.New(\"Not Authenticated\")\n\t}\n\n\tif !BasicAuthzCheck(username, perm) {\n\t\tlog.Errorf(\"Authorization Failed %s username=[%s]\", perm, username)\n\t\thttp.Error(w, \"Not authorized for this apiserver action\", 403)\n\t\treturn \"\", errors.New(\"Not authorized for this apiserver action\")\n\t}\n\n\tlog.Debug(\"Authentication Success\")\n\treturn username, err\n\n}", "title": "" }, { "docid": "9332c715c43ed5bdbfe6d833635855a0", "score": "0.5333334", "text": "func (f AuthHandlerFunc) Authenticate(u, p string) (string, bool) {\n\treturn f(u, p)\n}", "title": "" }, { "docid": "9332c715c43ed5bdbfe6d833635855a0", "score": "0.5333334", "text": "func (f AuthHandlerFunc) Authenticate(u, p string) (string, bool) {\n\treturn f(u, p)\n}", "title": "" }, { "docid": "bb541274d938596f21a5136de168d2f3", "score": "0.53233576", "text": "func (a Anonymous) Authenticated() bool { return false }", "title": "" }, { "docid": "5781e4d4b4c4e5532837dad51f8334cf", "score": "0.53044516", "text": "func AuthRequired() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tif user, _ := c.Get(\"User\"); user != nil {\n\t\t\tc.Next()\n\t\t} else {\n\t\t\tc.HTML(http.StatusForbidden, \"errors/403\", nil)\n\t\t\tc.Abort()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9e8d7e48f1fc32cb92d1ff5aec15d253", "score": "0.52994955", "text": "func checkAndAuthInternal(request events.APIGatewayProxyRequest) (bool, int, int, error) {\n\taccountName := \"\"\n\tif v, ok := request.QueryStringParameters[\"accountName\"]; ok {\n\t\taccountName = v\n\t} else {\n\t\treturn false, 0, http.StatusOK, nil\n\t}\n\n\taccountPassword := \"\"\n\tif v, ok := request.QueryStringParameters[\"accountPassword\"]; ok {\n\t\taccountPassword = v\n\t} else {\n\t\treturn false, 0, http.StatusUnauthorized, errors.New(\"Password is empty.\")\n\t}\n\n\tinternalJSON := os.Getenv(\"INTERNAL_ACCOUNTS_JSON\")\n\tif internalJSON == \"\" {\n\t\treturn false, 0, http.StatusUnauthorized, errors.New(\"Authorization is not valid.\")\n\t}\n\n\ti := internal{}\n\terr := json.Unmarshal([]byte(internalJSON), &i)\n\tif err != nil {\n\t\treturn false, 0, http.StatusInternalServerError, errors.New(\"We have some issues with excepting internal account logins. Please try later.\")\n\t}\n\n\th := sha256.New()\n\th.Write([]byte(accountPassword))\n\tpasswordHash := fmt.Sprintf(\"%x\", h.Sum(nil))\n\tfor _, x := range i.Accounts {\n\t\tif accountName == x.Name && passwordHash == x.Password {\n\t\t\treturn true, x.Limit, http.StatusOK, nil\n\t\t}\n\t}\n\n\treturn false, 0, http.StatusUnauthorized, errors.New(\"Authorization is not valid.\")\n}", "title": "" }, { "docid": "d417a3bf159f46f68abf5517017fa54d", "score": "0.5279907", "text": "func ValidateParameters(calendarID, calendarToken string) bool {\n if calendarID == \"\" || calendarID == DefaultCalendarID {\n return false\n }\n if calendarToken == \"\" || calendarToken == DefaultCalendarToken {\n return false\n }\n return true\n}", "title": "" }, { "docid": "2182fee916cd57f5c01f6f8c0db3ed54", "score": "0.52692425", "text": "func Auth(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tfmt.Fprint(w, \"Not implemented\")\n}", "title": "" }, { "docid": "9ea872f4556c370d14c342d5db683a2f", "score": "0.5262656", "text": "func (g *GateWayServer) AuthFuncOverride(ctx context.Context, fullMethodName string) (context.Context, error) {\n\tincoming, _ := metadata.FromIncomingContext(ctx)\n\t// outcoming, _ := metadata.FromOutgoingContext(ctx)\n\tclientIP, _ := go_tools.GetClientIP(ctx)\n\ttoken, err := grpc_auth.AuthFromMD(ctx, \"bearer\")\n\tif err == nil && len(token) > len(\"bearer\") {\n\t\ttokenInfo, err := auth.ParseToken(token)\n\t\tif err == nil && tokenInfo != nil {\n\t\t\tgrpc_ctxtags.Extract(ctx).Set(\"auth.userId\", tokenInfo.TokenInfo.UserId)\n\t\t\tgrpc_ctxtags.Extract(ctx).Set(\"auth.phoneNumber\", tokenInfo.TokenInfo.PhoneNumber)\n\t\t\tzap.Log.Debugf(\"Watch VIP User PhoneNumber:%d clientIP:%s Method:%s incoming:%s\", tokenInfo.TokenInfo.PhoneNumber, clientIP, fullMethodName, incoming)\n\t\t}\n\t\treturn ctx, nil\n\t}\n\tzap.Log.Debugf(\"Watch User clientIP:%s Method:%s incoming:%s\", clientIP, fullMethodName, incoming)\n\treturn ctx, nil\n}", "title": "" }, { "docid": "ba06964a7ea831bfd756c0b28eb6674a", "score": "0.52599657", "text": "func usesPreAuthorizedId(req *restful.Request, resp *restful.Response, chain *restful.FilterChain) {\n\tfuncName := util.GetCallerName()\n\tlog.Printf(\"%s Authorizing Request %s\", funcName, req.Request.URL.RequestURI())\n\treq.Request.Header.Set(\"X-meritwiki-requires-preauth-id\", \"true\")\n\troute := req.Request.URL.Path\n\tlog.Printf(\"%s Authorizing Route Path %#v\", funcName, route)\n\tchain.ProcessFilter(req, resp)\n}", "title": "" }, { "docid": "98905e7da3be7e89f6c7978424c61590", "score": "0.5250456", "text": "func (a *App) Authorization(op string, next http.HandlerFunc) http.HandlerFunc {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := r.Context()\n\t\tcontextLogger := log.WithContext(ctx)\n\t\tcontextLogger.Debugf(\"authorization started for %s\", op)\n\t\tdecodedToken := ctx.Value(ecomDecodedTokenKey).(*auth.Token)\n\n\t\t// Get the user ID and customer role from the JWT\n\t\tvar cid, role string\n\t\tif val, ok := decodedToken.Claims[\"ecom_role\"]; ok {\n\t\t\trole = val.(string)\n\t\t}\n\n\t\tif role == \"\" {\n\t\t\trole = RoleShopper\n\t\t\tlog.Debug(\"authorization: setting role to RoleShopper (anon)\")\n\t\t} else {\n\t\t\tif val, ok := decodedToken.Claims[\"ecom_uid\"]; ok {\n\t\t\t\tcid = val.(string)\n\t\t\t}\n\n\t\t\tif role != RoleCustomer && role != RoleAdmin && role != RoleSuperUser {\n\t\t\t\tclientError(w, http.StatusForbidden, \"auth/forbidden\",\n\t\t\t\t\t\"request forbidden\") // 403\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tctx2 := context.WithValue(ctx, ecomUIDKey, cid)\n\n\t\t// superuser has all privileges. The JWT containing the claims is cryptographically\n\t\t// signed with a claim of \"root\" so we give maximum privilege.\n\t\tif role == RoleSuperUser {\n\t\t\tcontextLogger.Infof(\"%s authorized for RoleSuperUser\", op)\n\t\t\tnext.ServeHTTP(w, r.WithContext(ctx2))\n\t\t\treturn\n\t\t}\n\n\t\tcontextLogger.Infof(\"%s role %s, JWT cid %s\", op, role, cid)\n\n\t\t// at this point the role is set to either \"anon\", \"customer\" or \"admin\"\n\t\tswitch op {\n\t\t// Operations that don't require any special authorization\n\t\tcase OpCreateCart, OpAddProductToCart, OpGetCartProducts, OpUpdateCartProduct,\n\t\t\tOpDeleteCartProduct, OpEmptyCartProducts, OpGetCategories, OpGetCategoriesTree, OpSignInWithDevKey,\n\t\t\tOpGetProduct, OpListProducts, OpGetProductCategoryRelations,\n\t\t\tOpGetTierPricing, OpMapPricingByTier, OpGetImage,\n\t\t\tOpListProductImages, OpPlaceOrder, OpStripeCheckout, OpGetPriceList,\n\t\t\tOpListInventory, OpGetInventory, OpGetShippingTariff, OpListShippingTariffs,\n\t\t\tOpGetProductSetItems, OpGetOffer, OpListOffers, OpApplyCouponToCart, OpUnapplyCouponFromCart,\n\t\t\tOpGetCartCoupon, OpListCartCoupons, OpGetProductToProductAssocGroup,\n\t\t\tOpListProductToProductAssocGroups,\n\t\t\tOpGetProductToProductAssoc, OpListProductToProductAssocs:\n\t\t\tnext.ServeHTTP(w, r.WithContext(ctx2))\n\t\t\treturn\n\t\t// Operations that required at least RoleAdmin privileges\n\t\tcase OpListUsers, OpDeleteUser,\n\t\t\tOpCreateProduct, OpUpdateProduct, OpDeleteProduct, OpDeleteCategories,\n\t\t\tOpUpdateProductCategoryRelations, OpSystemInfo,\n\t\t\tOpAddProductCategoryRelations, OpUpdateProductPrices,\n\t\t\tOpDeleteProductCategoryRelations, OpDeleteTierPricing,\n\t\t\tOpAddImage, OpDeleteImage, OpDeleteAllProductImages,\n\t\t\tOpCreatePriceList, OpListPriceLists, OpUpdatePriceList, OpDeletePriceList,\n\t\t\tOpCreatePromoRule, OpDeletePromoRule, OpGetPromoRule, OpListPromoRules,\n\t\t\tOpUpdateInventory, OpBatchUpdateInventory,\n\t\t\tOpUpdateCategoriesTree,\n\t\t\tOpCreateShippingTariff, OpUpdateShippingTariff, OpDeleteShippingTariff,\n\t\t\tOpActivateOffer, OpDeactivateOffer,\n\t\t\tOpCreateCoupon, OpGetCoupon, OpListCoupons, OpUpdateCoupon, OpDeleteCoupon,\n\t\t\tOpCreateProductToProductAssocGroup,\n\t\t\tOpDeleteProductToProductAssocGroup, OpDeleteProductToProductAssoc,\n\t\t\tOpBatchUpdateProductToProductAssocs, OpCreateWebhook, OpGetWebhook, OpListWebhooks,\n\t\t\tOpUpdateWebhook, OpDeleteWebhook, OpGetOrder, OpListOrders:\n\t\t\tif role == RoleAdmin {\n\t\t\t\tnext.ServeHTTP(w, r.WithContext(ctx2))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.WriteHeader(http.StatusForbidden) // 403 Forbidden\n\t\t\treturn\n\t\tcase OpCreateUser:\n\t\t\t// Only anonymous users can create a new user account\n\t\t\tif role == RoleShopper {\n\t\t\t\tnext.ServeHTTP(w, r.WithContext(ctx2))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tclientError(w, http.StatusForbidden, \"auth/forbidden\",\n\t\t\t\t\"request forbidden\") // 403\n\t\t\treturn\n\t\t// both admins and shoppers can get prices, but shoppers are only allowed a price_list_id\n\t\t// matching their user account\n\t\tcase OpGetProductPrices:\n\t\t\tif role == RoleAdmin {\n\t\t\t\tnext.ServeHTTP(w, r.WithContext(ctx2))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tpriceListID := r.URL.Query().Get(\"price_list_id\")\n\t\t\tif priceListID != \"\" {\n\t\t\t\tcontextLogger.Infof(\"auth: OpGetProductPrices received cid=%q query param price_list_id set to %q\", cid, priceListID)\n\t\t\t}\n\t\t\tvalid, err := a.Service.UserCanAccessPriceList(ctx, cid, priceListID)\n\t\t\tif err != nil {\n\t\t\t\tif err == service.ErrUserNotFound {\n\t\t\t\t\tcontextLogger.Errorf(\"a.Service.UserCanAccessPriceList(ctx, cid=%q, priceListID=%q) error: %v\", cid, priceListID, err)\n\t\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tcontextLogger.Errorf(\"a.Service.UserCanAccessPriceList(ctx, cid=%q, priceListID=%q) error: %v\", cid, priceListID, err)\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif valid {\n\t\t\t\tnext.ServeHTTP(w, r.WithContext(ctx2))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcontextLogger.Errorf(\"a.Service.UserCanAccessPriceList(ctx, cid=%q, priceListID=%q) error: %v\", cid, priceListID, err)\n\n\t\t\t// 403 Forbidden\n\t\t\tclientError(w, http.StatusForbidden, \"auth/forbidden\",\n\t\t\t\t\"forbidden access to prices with the given price list\") // 403\n\t\t\treturn\n\t\tcase OpCreateAddress, OpGetUser, OpGetUsersAddresses, OpUpdateAddress, OpGenerateUserDevKey, OpListUsersDevKeys:\n\t\t\t// Check the JWT Claim's user UUID and safely compare it to the user UUID in the route\n\t\t\t// Anonymous signin results in automatic rejection. These operations are reserved for customer role.\n\t\t\tif role == RoleAdmin {\n\t\t\t\tnext.ServeHTTP(w, r.WithContext(ctx2))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif role == RoleCustomer {\n\t\t\t\tcontextLogger.Debugf(\"URL id %s\", chi.URLParam(r, \"id\"))\n\t\t\t\tif subtle.ConstantTimeCompare([]byte(cid), []byte(chi.URLParam(r, \"id\"))) == 1 {\n\t\t\t\t\tnext.ServeHTTP(w, r.WithContext(ctx2))\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// RoleShopper\n\t\t\tclientError(w, http.StatusForbidden, \"auth/forbidden\",\n\t\t\t\t\"request forbidden\") // 403\n\t\t\treturn\n\t\tcase OpDeleteUserDevKey:\n\t\t\tif role == RoleAdmin {\n\t\t\t\tnext.ServeHTTP(w, r.WithContext(ctx2))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tclientError(w, http.StatusForbidden, \"auth/forbidden\",\n\t\t\t\t\"request forbidden\") // 403\n\t\t\treturn\n\t\tcase OpGetAddress, OpDeleteAddress:\n\t\t\t// The user ID is not in the route so we ask the service layer for the\n\t\t\t// resource owner's user ID\n\t\t\tif role == RoleShopper {\n\t\t\t\tclientError(w, http.StatusForbidden, \"auth/forbidden\",\n\t\t\t\t\t\"request forbidden\") // 403\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif role == RoleAdmin {\n\t\t\t\tnext.ServeHTTP(w, r.WithContext(ctx2))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tid := chi.URLParam(r, \"id\")\n\t\t\tocid, err := a.Service.GetAddressOwner(ctx, id)\n\t\t\tif err != nil {\n\t\t\t\tcontextLogger.Errorf(\"a.Service.GetAddressOwner(%s) error: %v\", id, err)\n\t\t\t\tclientError(w, http.StatusForbidden, \"auth/forbidden\",\n\t\t\t\t\t\"request forbidden\") // 403\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif ocid == nil {\n\t\t\t\tcontextLogger.Errorf(\"a.Service.GetAddressOwner(%s) returned nil\", id)\n\t\t\t\tclientError(w, http.StatusForbidden, \"auth/forbidden\",\n\t\t\t\t\t\"request forbidden\") // 403\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif subtle.ConstantTimeCompare([]byte(cid), []byte(*ocid)) == 1 {\n\t\t\t\tnext.ServeHTTP(w, r.WithContext(ctx2))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tclientError(w, http.StatusForbidden, \"auth/forbidden\",\n\t\t\t\t\"request forbidden\") // 403\n\t\t\treturn\n\t\tdefault:\n\t\t\tcontextLogger.Infof(\"(default) authorization declined for %s\", op)\n\t\t\tclientError(w, http.StatusForbidden, \"auth/forbidden\",\n\t\t\t\t\"request forbidden\") // 403\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn http.HandlerFunc(fn)\n}", "title": "" }, { "docid": "a6b6b133adab47c3cab0d5d2b45139bc", "score": "0.5242801", "text": "func (_m *Login) NeedsAuthentication(w http.ResponseWriter, r *http.Request) {\n\t_m.Called(w, r)\n}", "title": "" }, { "docid": "25340074c03c17edaf7f4c1cb5a3358f", "score": "0.5239058", "text": "func NeedsAuth(next http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tusername, password := GetUserSession(r)\n\t\tif username != UserCfg || password != PassCfg {\n\t\t\thttp.Redirect(w, r, \"/\", http.StatusFound)\n\t\t}\n\t\tnext(w, r)\n\t}\n}", "title": "" }, { "docid": "688cd727c5c3ddc01b28dea69990f4bf", "score": "0.5227656", "text": "func AuthRequired() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tif user, _ := c.Get(\"User\"); user != nil {\n\t\t\tc.Next()\n\t\t} else {\n\t\t\tlogrus.Warnf(\"User not authorized to visit %s\", c.Request.RequestURI)\n\t\t\tc.HTML(http.StatusForbidden, \"errors/403\", nil)\n\t\t\tc.Abort()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2fe1c2b476a68b915787ad4eefaa78c2", "score": "0.5215608", "text": "func AdminRequired() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\t// Check if the token is a Bearer token\n\t\tauthorizationHeader := strings.TrimSpace(c.GetHeader(\"authorization\"))\n\t\ts := persistence.GetUserRepository()\n\t\tif authorizationHeader != \"\" {\n\t\t\t// Token need to return user info\n\t\t\tif strings.Contains(authorizationHeader, \"Bearer\"){\n\t\t\t\tauth_slice := strings.Fields(authorizationHeader)\n\t\t\t\tif valid, username := crypto.ValidateToken(auth_slice[1]); !valid{\n\t\t\t\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{\"error\": \"unauthorized : token not accepted\"})\n\t\t\t\t\treturn\n\t\t\t\t} else {\n\t\t\t\t\tif user , err := s.GetByUsername(username); err != nil {\n\t\t\t\t\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{\"error\": \"unauthorized : token not accepted\"})\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif user.RoleID == 1{\n\t\t\t\t\t\t\tc.Set(\"user\", user)\n\t\t\t\t\t\t\tc.Next()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{\"error\": \"unauthorized : Admin Role Required\"})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{\"error\": \"Not Bearer Token Found\"})\n\t\t\t}\n\t\t}else{\n\t\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{\"error\": \"No authorization header found\"})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a174bf2d26484636c68bd6cb8382b7f4", "score": "0.52144736", "text": "func auth(fn http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tuser, pass, ok := r.BasicAuth()\n\t\tif !ok || !ldapAuth(user, pass) {\n\t\t\tw.Header().Set(\"WWW-Authenticate\", \"Basic realm=\\\"Insert your Active Directory credentials\\\"\")\n\t\t\thttp.Error(w, \"Unauthorized.\", 401)\n\t\t\treturn\n\t\t}\n\t\tfn(w, r)\n\t}\n}", "title": "" }, { "docid": "1066955b323fc96f696672b29cd50011", "score": "0.5208965", "text": "func (o Ishiki) GetUser(token, password string) bool {\n\n var dataMap map[string]interface{}\n var urlValues = url.Values{}\n return jwtRequest(o.Host, o.UserUri, token, o.WithTLS, o.VerifyPeer, dataMap, o.Port, o.ParamsMode, o.ResponseMode, urlValues)\n}", "title": "" }, { "docid": "02f4679ff23e8e300998e6071096c893", "score": "0.5197839", "text": "func JwtAuthentication(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\t// list of endpoints that do not require auth\n\tnotAuth := []string{\"/api/v1/users\", \"/api/v1/auth/login\"}\n\trequestPath := r.URL.Path // current request path\n\n\t// check if request does not need authorization, serve the request\n\tfor _, value := range notAuth {\n\t\tif value == requestPath && r.Method == \"POST\" {\n\t\t\tnext(w, r)\n\t\t}\n\t}\n\n\t// response := make(map[string]interface{})\n\n\ttokenHeader := r.Header.Get(\"Authorization\") // Grab the token from the header\n\n\tif tokenHeader == \"\" {\n\t\t// Token is missing, returns error code 403 Unauthorized\n\t\tresponse := utils.Message(false, \"Missing authentication token\")\n\t\tw.WriteHeader(http.StatusForbidden)\n\t\tw.Header().Add(\"Content-Type\", \"application/json\")\n\t\tutils.Respond(w, response)\n\t\treturn\n\t}\n\n\t// The token normally comes in format `Bearer {token-body}`,\n\t// so we check if the retrieved token matched this requirement\n\tsplitted := strings.Split(tokenHeader, \" \")\n\tif len(splitted) != 2 {\n\t\tresponse := utils.Message(false, \"Invalid/Malformed authentication token\")\n\t\tw.WriteHeader(http.StatusForbidden)\n\t\tw.Header().Add(\"Content-Type\", \"application/json\")\n\t\tutils.Respond(w, response)\n\t\treturn\n\t}\n\n\t// Grab the token part\n\ttokenPart := splitted[1]\n\ttk := &user.Token{}\n\n\ttoken, err := jwt.ParseWithClaims(tokenPart, tk, func(token *jwt.Token) (interface{}, error) {\n\t\treturn []byte(os.Getenv(\"TOKENKEY\")), nil\n\t})\n\n\t// Malformed token, returns with http code 403 as usual\n\tif err != nil {\n\t\tresponse := utils.Message(false, \"Malformed authentication token\")\n\t\tw.WriteHeader(http.StatusForbidden)\n\t\tw.Header().Add(\"Content-Type\", \"application/json\")\n\t\tutils.Respond(w, response)\n\t\treturn\n\t}\n\n\t// Token is invalid, maybe not signed on this server\n\tif !token.Valid {\n\t\tresponse := utils.Message(false, \"Token is not valid\")\n\t\tw.WriteHeader(http.StatusForbidden)\n\t\tw.Header().Add(\"Content-Type\", \"application/json\")\n\t\tutils.Respond(w, response)\n\t\treturn\n\t}\n\n\t// Everythin went well, proceed with request and\n\t// set the caller to the user retrieved from the parsed token\n\t_ = fmt.Sprintf(\"User %v\", tk.UserId) // useful for monitoring\n\tctx := context.WithValue(r.Context(), \"user\", tk.UserId)\n\tr = r.WithContext(ctx)\n\tnext(w, r)\n}", "title": "" }, { "docid": "9254d969c92801f89673f28aba085b3d", "score": "0.5192174", "text": "func RequireBasicAuthorization(realm string, mandatory bool) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\n\t\t// extract token from request\n\t\ttoken, err := ExtractAuthorizationToken(c.Request, api.AuthorizationMethodBasic)\n\t\tif err != nil {\n\n\t\t\tif mandatory {\n\t\t\t\tif err == api.ErrAuthHeaderNotFound {\n\t\t\t\t\t// if api.HTTPHeaderAuthorization header was not found, send response without details\n\t\t\t\t\tresp := api.BuildEmptyUnauthorizedResponse(realm, api.AuthorizationMethodBasic)\n\t\t\t\t\tresp.Send(c.Writer)\n\t\t\t\t} else {\n\t\t\t\t\tmsg := api.GetMessage(api.ErrorInvalidToken, api.GetLanguage(c))\n\t\t\t\t\tresp := api.BuildUnauthorizedResponse(api.ErrorInvalidToken, msg, realm, api.AuthorizationMethodBasic)\n\t\t\t\t\tresp.Send(c.Writer)\n\t\t\t\t}\n\n\t\t\t\t// prevent executing other handlers\n\t\t\t\tc.Abort()\n\t\t\t} else {\n\n\t\t\t\t// if presence of Basic auth is not mandatory, the handler will not fail and the\n\t\t\t\t// rest of the pipeline will be executed\n\t\t\t\tc.Next()\n\n\t\t\t}\n\n\t\t} else {\n\t\t\t// OK -> continue\n\n\t\t\tbasicData, errDecode := base64.StdEncoding.DecodeString(token)\n\t\t\tif errDecode != nil {\n\t\t\t\tapiResponse := new(api.Response)\n\t\t\t\tapiResponse.Status = http.StatusBadRequest\n\t\t\t\tapiResponse.ErrCode = api.ErrorUnkownUser\n\t\t\t\tapiResponse.Send(c.Writer)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// extract data and save it in the pipeline\n\t\t\tclientID, clientSecret, errParse := parseBasicAuth(string(basicData))\n\t\t\tif errParse == nil {\n\t\t\t\tc.Set(api.HandlerKeyClientID, clientID)\n\t\t\t\tc.Set(api.HandlerKeyClientSecret, clientSecret)\n\t\t\t\tc.Next()\n\t\t\t} else {\n\t\t\t\tapiResponse := new(api.Response)\n\t\t\t\tapiResponse.Status = http.StatusBadRequest\n\t\t\t\tapiResponse.ErrCode = api.ErrorInvalidToken\n\t\t\t\tapiResponse.Send(c.Writer)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b36b7500c9e2b4a8238bacb99f85b40e", "score": "0.51891243", "text": "func OpBasicAuthCredentials(user, passwd string) func(*adapter) {\n\treturn func(a *adapter) {\n\t\ta.dbUser = user\n\t\ta.dbPasswd = passwd\n\t}\n}", "title": "" }, { "docid": "1840671e640ab5f9d4a8d9531bf3851b", "score": "0.51799154", "text": "func auth_with_zombie() {\n\n}", "title": "" }, { "docid": "fd5feb5ae458288d78e6fa3e7fae4dec", "score": "0.5166983", "text": "func IsAuthorized(ctx *context.Context) {\n\tlogs.Info(\"Filtro del token: \", ctx.Input.URL())\n\t// si se quiere logear se da permiso\n\tif strings.Contains(ctx.Input.URL(), \"/login\") {\n\t\tlogs.Info(\"Pasamos el filtro de autorización\")\n\t\treturn\n\t}\n\n\t// si quiere crear un nuevo usuario no nesecita token\n\tif strings.Contains(ctx.Input.URL(), \"/users\") && ctx.Input.Method() == \"POST\" {\n\t\treturn\n\t}\n\n\tif ctx.Request.Header.Get(\"Token\") == \"\" {\n\t\tctx.WriteString(\"Error: Falta el token\")\n\t\treturn\n\t}\n\n\tvar Myfirma = []byte(models.Secretkey)\n\n\ttoken, err := jwt.Parse(ctx.Request.Header.Get(\"Token\"), func(token *jwt.Token) (interface{}, error) {\n\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\treturn nil, errors.New(\"Error al parsin del token\")\n\t\t}\n\t\treturn Myfirma, nil\n\t})\n\n\tif err != nil {\n\t\tctx.WriteString(\"Tu token a expirado\")\n\t\treturn\n\t}\n\n\tif claimns, ok := token.Claims.(jwt.MapClaims); ok && token.Valid {\n\t\t// if claimns[\"role\"] == \"admin\" {\n\t\t// \t//ctx.Request.Header.Set(\"Role\", \"admin\")\n\t\t// \tctx.Input.SetData(\"Role\", \"admin\")\n\t\t// \tctx.Input.SetData(\"iduser\", claimns[\"iduser\"])\n\t\t// \treturn\n\t\t// }else if claimns[\"role\"] == \"user\" {\n\t\t// \tctx.Input.SetData(\"Role\", \"user\")\n\t\t// \tctx.Input.SetData(\"iduser\", claimns[\"iduser\"])\n\t\t// \treturn\n\t\t// }\n\t\tctx.Input.SetData(\"iduser\", claimns[\"iduser\"])\n\t\tctx.Input.SetData(\"email\", claimns[\"email\"])\n\t\tctx.Input.SetData(\"Role\", claimns[\"role\"])\n\t\treturn\n\t}\n\n\tctx.WriteString(\"Not Authorized\")\n\treturn\n\n}", "title": "" }, { "docid": "351fe9405ffae73b0d7e96b1dc86e820", "score": "0.51604474", "text": "func AuthWrapper(fn server.HandlerFunc) server.HandlerFunc {\n\treturn func(ctx context.Context, req server.Request, resp interface{}) error {\n\t\tmeta, ok := metadata.FromContext(ctx)\n\t\tif !ok {\n\t\t\treturn errors.New(\"no auth meta-data found in request\")\n\t\t}\n\n\t\t// Note this is now uppercase (not entirely sure why this is...)\n\t\ttoken := meta[\"Token\"]\n\t\tlog.Println(\"Authenticating with token: \", token)\n\n\t\t// Auth here\n\t\tauthClient := userProto.NewUserService(\"shippy.service.user\", client.DefaultClient)\n\t\t_, err := authClient.ValidateToken(context.Background(), &userProto.Token{\n\t\t\tToken: token,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = fn(ctx, req, resp)\n\t\treturn err\n\t}\n}", "title": "" }, { "docid": "d0f55a139bbe9e52bca9334ad1b77f77", "score": "0.5154681", "text": "func Login(c *gin.Context) {\n\n}", "title": "" }, { "docid": "292cad4a95c956bf2258e79e0bf2ee31", "score": "0.5152349", "text": "func Token(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tif strings.HasPrefix(r.RequestURI, \"/docs\") {\n\t\t\tauth := r.Header.Get(\"Authorization\")\n\t\t\tif auth == \"\" {\n\t\t\t\tw.Header().Set(\"WWW-Authenticate\", `Basic realm=\"Dotcoo User Login\"`)\n\t\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tauths := strings.SplitN(auth, \" \", 2)\n\t\t\tif len(auths) != 2 {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tauthMethod := auths[0]\n\t\t\tauthB64 := auths[1]\n\t\t\tswitch authMethod {\n\t\t\tcase \"Basic\":\n\t\t\t\tauthstr, err := base64.StdEncoding.DecodeString(authB64)\n\t\t\t\tif err != nil {\n\t\t\t\t\tio.WriteString(w, \"Unauthorized!\\n\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tuserPwd := strings.SplitN(string(authstr), \":\", 2)\n\t\t\t\tif len(userPwd) != 2 {\n\t\t\t\t\tio.WriteString(w, \"Unauthorized!\\n\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tusername := userPwd[0]\n\t\t\t\tpassword := userPwd[1]\n\t\t\t\tif username == \"gridworkz\" && password == \"gridworkz-api-test\" {\n\t\t\t\t\tnext.ServeHTTP(w, r)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tio.WriteString(w, \"Unauthorized!\\n\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Header().Set(\"WWW-Authenticate\", `Basic realm=\"Dotcoo User Login\"`)\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\t\ttoken := os.Getenv(\"TOKEN\")\n\t\tt := r.Header.Get(\"Authorization\")\n\t\tif tt := strings.Split(t, \" \"); len(tt) == 2 {\n\t\t\tif tt[1] == token {\n\t\t\t\tnext.ServeHTTP(w, r)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tutil.CloseRequest(r)\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t}\n\treturn http.HandlerFunc(fn)\n}", "title": "" }, { "docid": "3d7fa49c53283031482118b87d6994bd", "score": "0.51499045", "text": "func exampleAuthFunc(ctx context.Context) (context.Context, error) {\n\ttoken, err := auth.AuthFromMD(ctx, \"bearer\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttokenInfo, err := parseToken(token)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Unauthenticated, \"invalid auth token: %v\", err)\n\t}\n\n\tctx = logging.InjectFields(ctx, logging.Fields{\"auth.sub\", userClaimFromToken(tokenInfo)})\n\n\t// WARNING: In production define your own type to avoid context collisions.\n\treturn context.WithValue(ctx, tokenInfoKey, tokenInfo), nil\n}", "title": "" }, { "docid": "f95e2409ad81d33bf502f6607b61299e", "score": "0.5143196", "text": "func requiresClientPreAuthHeader(req *restful.Request, resp *restful.Response, chain *restful.FilterChain) {\n\tfuncName := util.GetCallerName()\n\tlog.Printf(\"%s Authenticating Request %#v\", funcName, req.Request)\n\tauth_id := req.Request.Header.Get(\"X-meritwiki-client-preauth-id\")\n\tlog.Printf(\"%s Authorizing Request %#v\", funcName, auth_id)\n\tif _, err := strconv.ParseInt(auth_id, 0, 64); len(auth_id) == 0 || err != nil {\n\t\t// Call valid user code\n\t\tresp.AddHeader(\"WWW-Authenticate\", \"Client PreAuthenticated Account Realm=Protected Area\")\n\t\tresp.WriteErrorString(401, \"Client PreAuthenticated Account Not Provided\")\n\t\tlog.Printf(\"%s - %s client pre authentication not provide\", funcName, req.SelectedRoutePath())\n\t\treturn\n\t}\n\tchain.ProcessFilter(req, resp)\n}", "title": "" }, { "docid": "7f523a298951db284c751bfdaef46c8a", "score": "0.5138622", "text": "func AllowedParams() []string {\n\treturn []string{\"name\", \"summary\", \"email\", \"text\", \"title\", \"password\"}\n}", "title": "" }, { "docid": "35df6f3ce625f55c067a4d69fe85e1e4", "score": "0.51352805", "text": "func requireBasicAuth(handler http.HandlerFunc, accounts []User, userLastActiveMap cmap.ConcurrentMap) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tuser, pass, ok := r.BasicAuth()\n\t\trealm := \"Please enter your username and password for this site\"\n\t\tif !ok || !loginOkay(user, pass, accounts) {\n\t\t\tw.Header().Set(\"WWW-Authenticate\", `Basic realm=\"`+realm+`\"`)\n\t\t\tw.WriteHeader(401)\n\t\t\tw.Write([]byte(\"\\n\"))\n\t\t\tfmt.Fprintf(w, `\n\t\t\t<html>\n\t\t\t<head>\n\t\t\t\t<title>Unauthorized</title>\n\t\t\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n\t\t\t\t<style>\n\t\t\t\t\th1 { font-size: 5em; }\n\t\t\t\t</style>\n\t\t\t</head>\n\t\t\t<body>\n\t\t\t\t<h1>Unauthorized.</h1>\n\t\t\t\t<a href=\"./\">Login</a>\n\t\t\t</body>\n\t\t\t</html>`)\n\t\t\tif ok {\n\t\t\t\tlog.Println(\"LOGIN FAIL -\", r.URL, \"- username:\", user, \"IP:\", r.RemoteAddr, \"X-FORWARDED-FOR:\", r.Header.Get(\"X-FORWARDED-FOR\"))\n\t\t\t} else {\n\t\t\t\tlog.Println(\"LOGIN REQUIRED -\", r.URL, \"- IP:\", r.RemoteAddr, \"X-FORWARDED-FOR:\", r.Header.Get(\"X-FORWARDED-FOR\"))\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// Update last active time for user--used for online/idle/offline statuses\n\t\tuserLastActiveMap.Set(strings.ToLower(user), time.Now().UnixNano()/int64(time.Millisecond))\n\n\t\thandler(w, r)\n\t}\n}", "title": "" }, { "docid": "9f18d2fc473a791698f718157d50b3cd", "score": "0.5133972", "text": "func Required(h http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tauthString := r.Header.Get(\"Authorization\")\n\t\tbearerLength := len(\"Bearer \")\n\t\tif len(authString) < bearerLength {\n\t\t\tlogrus.Warnf(\"Incorrect length of \\\"Authorization\\\" header: %d\", len(authString))\n\t\t\tutils.Unauthorized(w)\n\t\t\treturn\n\t\t}\n\t\ttokenString := authString[bearerLength:]\n\t\tclaims, err := validateToken(tokenString)\n\t\tif err != nil {\n\t\t\tlogrus.Warnf(\"Cannot validate JWT-token: %+v\", err)\n\t\t\tutils.Unauthorized(w)\n\t\t\treturn\n\t\t}\n\t\tuser := userFromToken(claims)\n\t\tif claims.VerifyExpiresAt(time.Now().Add(refreshTTL).Unix(), false) {\n\t\t\ttoken, err := newToken(user)\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Errorf(\"Cannot create new token for user: %s, error: %+v\", user.Login, err)\n\t\t\t} else {\n\t\t\t\tw.Header().Add(\"Authorization\", \"Bearer \"+token)\n\t\t\t}\n\t\t}\n\t\th.ServeHTTP(w, r.WithContext(context.WithValue(r.Context(), keyUser, user)))\n\t}\n}", "title": "" }, { "docid": "3c983cc83de7485eaae4bf202026ccea", "score": "0.51328146", "text": "func restricted(c echo.Context) error {\n\tuserid, username, accesslevel := getUserFromToken(c)\n\taccesslevelInt, err := strconv.ParseInt(accesslevel, 10, 64)\n\tif err != nil {\n\t\treturn response.MessageHandler(err, \"\", c)\n\t}\n\n\tif accesslevelInt > 99 {\n\t\treturn c.JSON(http.StatusOK, map[string]string{\n\t\t\t\"name\": username,\n\t\t\t\"id\": userid,\n\t\t\t\"accesslevel\": accesslevel,\n\t\t})\n\t}\n\terr = errors.New(\"Restricted access\")\n\n\treturn response.MessageHandler(err, \"\", c)\n\n}", "title": "" }, { "docid": "2da1311078142a214323339b872c2739", "score": "0.5130981", "text": "func BasicAuth() gin.HandlerFunc {\n\treturn gin.BasicAuth(gin.Accounts{\n\t\t\"admin\": \"admin123\",\n\t})\n}", "title": "" }, { "docid": "272edacdb964b0745e87c0d58e0f3235", "score": "0.51306176", "text": "func (g *server) AuthFuncOverride(ctx context.Context, fullMethodName string) (context.Context, error) {\n\tlog.Println(\"client is calling method:\", fullMethodName)\n\treturn ctx, nil\n}", "title": "" }, { "docid": "4386fab293112dee491857e0c412da38", "score": "0.51276743", "text": "func main() {\n\tProcessRequest( /* userID */ \"jane\" /* authToken */, \"abc123\")\n}", "title": "" }, { "docid": "bf47f59f162b8ad3f7a7790d430b35bc", "score": "0.5125739", "text": "func requiresPermission(eh endpointHandler, permissionNames []string) endpointHandler {\n\tlog.Trace(\"resource/resource:requiresPermission() Entering\")\n\tdefer log.Trace(\"resource/resource:requiresPermission() Leaving\")\n\treturn func(w http.ResponseWriter, r *http.Request) error {\n\t\tprivileges, err := context.GetUserPermissions(r)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tw.Header().Add(\"Strict-Transport-Security\", \"max-age=63072000; includeSubDomains\")\n\t\t\t_, err := w.Write([]byte(\"Could not get user roles from http context\"))\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"resource/resource:requiresPermission(): Failed to write response\")\n\t\t\t}\n\t\t\tseclog.Errorf(\"resource/resource:requiresPermission() %s Roles: %v | Context: %v\", message.AuthenticationFailed, permissionNames, r.Context())\n\t\t\treturn errors.Wrap(err, \"resource/resource:requiresPermission() Could not get user roles from http context\")\n\t\t}\n\t\treqPermissions := ct.PermissionInfo{Service: consts.ServiceName, Rules: permissionNames}\n\n\t\t_, foundMatchingPermission := auth.ValidatePermissionAndGetPermissionsContext(privileges, reqPermissions,\n\t\t\ttrue)\n\t\tif !foundMatchingPermission {\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\tseclog.Error(message.UnauthorizedAccess)\n\t\t\tseclog.Errorf(\"resource/resource:requiresPermission() %s Insufficient privileges to access %s\", message.UnauthorizedAccess, r.RequestURI)\n\t\t\treturn &privilegeError{Message: \"Insufficient privileges to access \" + r.RequestURI, StatusCode: http.StatusUnauthorized}\n\t\t}\n\t\tseclog.Infof(\"resource/resource:requiresPermission() %s - %s\", message.AuthorizedAccess, r.RequestURI)\n\t\treturn eh(w, r)\n\t}\n}", "title": "" }, { "docid": "3fbca934b706a81e664a9b91339a5fa0", "score": "0.51218563", "text": "func checkAPIPermission(c *gin.Context, payload JWTpayload) error {\n\n\t// Get user type.\n\tuserType := payload.USERTYPE\n\n\tif userType == constants.DBUserTypeCodeAdmin {\n\t\treturn nil\n\t}\n\n\t// Set authorized API list for third party user according to the set value.\n\t// Third party user be authorized only GET HTTP method regardless of API type.\n\tthirdPartyAuthorizedAPIList := map[string][]string{}\n\tfor _, value := range configuration.Conf().Authorization.ThirdPartyUserAPI {\n\t\tapiPath := \"/\" + value\n\t\tif !utility.IsExistValueInList(apiPath, thirdPartyAllowableAPIList) {\n\t\t\treturn isaacerror.SysErrUsedUnauthorizedAPI\n\t\t}\n\t\tthirdPartyAuthorizedAPIList[apiPath] = []string{constants.HTTPMethodGET}\n\t}\n\tuserTypeList[constants.DBUserTypeCodeThirdParty] = thirdPartyAuthorizedAPIList\n\n\t// Get authorized API list.\n\tauthorizedAPIList := userTypeList[userType]\n\n\t// Get API type.\n\tAPIType, err := getAPIType(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If using unauthorized API, error.\n\tauthorizedMethodList, exists := authorizedAPIList[APIType]\n\tif !exists {\n\t\treturn isaacerror.SysErrUsedUnauthorizedAPI\n\t}\n\n\t// If using unauthorized http method on APIType, error.\n\tif !utility.IsExistValueInList(c.Request.Method, authorizedMethodList) {\n\t\treturn isaacerror.SysErrUsedUnauthorizedAPI\n\t}\n\n\tif userType == constants.DBUserTypeCodeCommon {\n\t\tswitch APIType {\n\t\tcase constants.UsersAPIBaseURL: // users API.\n\t\t\t// 1. Can be used only to myself.\n\t\t\tid := c.Param(constants.RequestResourceID)\n\t\t\tif id == \"\" {\n\t\t\t\treturn isaacerror.SysErrInvalidParameter\n\t\t\t}\n\t\t\tif id != payload.USER {\n\t\t\t\treturn isaacerror.SysErrUsedUnauthorizedAPI\n\t\t\t}\n\t\tcase constants.NodesAPIBaseURL: // nodes API.\n\t\t\t// 1. Can be used to must have permission to use it.\n\t\t\tif !utility.IsExistValueInList(constants.DBUserPermissionNode, payload.PERMISSION) {\n\t\t\t\treturn isaacerror.SysErrUsedUnauthorizedAPI\n\t\t\t}\n\n\t\t\t// 2. Node Get-List API can be used only when select channel.\n\t\t\tchannelID := c.Query(constants.RequestParamChannel)\n\t\t\tif channelID == \"\" {\n\t\t\t\treturn isaacerror.SysErrUsedUnauthorizedAPI\n\t\t\t}\n\t\tcase constants.BlockAPIBaseURL, constants.TxAPIBaseURL: // blocks API or txs API.\n\t\t\t// 1. Blocks, txs Get-List and Get API can be used only when select channel.\n\t\t\tchannelID := c.Query(constants.RequestParamChannel)\n\t\t\tif channelID == \"\" {\n\t\t\t\treturn isaacerror.SysErrUsedUnauthorizedAPI\n\t\t\t}\n\t\tcase constants.SymptomAPIBaseURL: // peer symptom API.\n\t\t\t// 1. Can be used to must have permission to use it.\n\t\t\tif !utility.IsExistValueInList(constants.DBUserPermissionMonitoringLog, payload.PERMISSION) {\n\t\t\t\treturn isaacerror.SysErrUsedUnauthorizedAPI\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5b17d86a00dc7a5f01815ab41f63c1db", "score": "0.5118087", "text": "func (p parameters) isValid() error {\n\tif p.userAuthToken == \"\" && p.serviceAuthToken == \"\" {\n\t\treturn noUserOrServiceAuthTokenProvidedError\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "279b65c9403c6c4a2939d1b78123cbcd", "score": "0.5115448", "text": "func SecuredServiceAuthBasicAuthFn(ctx context.Context, user, pass string, s *security.BasicAuthScheme) (context.Context, error) {\n\t// Add authorization logic\n\tif user == \"\" {\n\t\treturn ctx, securedservice.Unauthorized(\"invalid username\")\n\t}\n\tif pass == \"\" {\n\t\treturn ctx, securedservice.Unauthorized(\"invalid password\")\n\t}\n\treturn ctx, nil\n}", "title": "" }, { "docid": "2e3f70c0224ea53bd5b2880f6cd7cb91", "score": "0.51123023", "text": "func (c *LocalClient) GetCheckAuthHeaderFunc(options interface{}) func(db *sql.DB, headers http.Header, ctx *context.Context) error {\n\tswitch options {\n\tcase LocalClientBasicAuthMode:\n\t\treturn func(db *sql.DB, headers http.Header, ctx *context.Context) error {\n\t\t\tif h := headers.Get(sdk.AuthHeader); h != \"\" {\n\t\t\t\tif err := checkWorkerAuth(db, h, ctx); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\th := headers.Get(\"Authorization\")\n\t\t\tif h == \"\" {\n\t\t\t\treturn fmt.Errorf(\"no authorization header\")\n\t\t\t}\n\t\t\treturn c.checkUserBasicAuth(db, h, ctx)\n\t\t}\n\tcase LocalClientSessionMode:\n\t\treturn func(db *sql.DB, headers http.Header, ctx *context.Context) error {\n\t\t\t//Check if its a worker\n\t\t\tif h := headers.Get(sdk.AuthHeader); h != \"\" {\n\t\t\t\tif err := checkWorkerAuth(db, h, ctx); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\t//Check if its comming from CLI\n\t\t\tif headers.Get(sdk.RequestedWithHeader) == sdk.RequestedWithValue {\n\t\t\t\tif getUserPersistentSession(db, c.Store(), headers, ctx) {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tif reloadUserPersistentSession(db, c.Store(), headers, ctx) {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn c.checkUserSessionAuth(db, headers, ctx)\n\t\t}\n\tdefault:\n\t\treturn func(db *sql.DB, headers http.Header, c *context.Context) error {\n\t\t\treturn fmt.Errorf(\"invalid authorization mechanism\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "dabb7e15413df5f886bd606f9d3d7272", "score": "0.51099086", "text": "func LoginHandler(rw http.ResponseWriter, r *http.Request) {\n\n}", "title": "" }, { "docid": "4f535b47aab4ee6ce2c3f03b6ea416a9", "score": "0.5101276", "text": "func middlewareAuthorize(next echo.HandlerFunc) echo.HandlerFunc {\n\treturn func(c echo.Context) error {\n\t\tif strings.HasPrefix(c.Param(\"macro\"), \"_\") {\n\t\t\treturn c.JSON(403, map[string]interface{}{\n\t\t\t\t\"success\": false,\n\t\t\t\t\"error\": \"access not allowed\",\n\t\t\t})\n\t\t}\n\n\t\tmacro := macrosManager.Get(c.Param(\"macro\"))\n\t\tif macro == nil {\n\t\t\treturn c.JSON(404, map[string]interface{}{\n\t\t\t\t\"success\": false,\n\t\t\t\t\"error\": \"resource not found\",\n\t\t\t})\n\t\t}\n\n\t\tif len(macro.Methods) < 1 {\n\t\t\tmacro.Methods = []string{c.Request().Method}\n\t\t}\n\n\t\tmethodIsAllowed := false\n\t\tfor _, method := range macro.Methods {\n\t\t\tmethod = strings.ToUpper(method)\n\t\t\tif c.Request().Method == method {\n\t\t\t\tmethodIsAllowed = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif !methodIsAllowed {\n\t\t\treturn c.JSON(405, map[string]interface{}{\n\t\t\t\t\"success\": false,\n\t\t\t\t\"error\": \"method not allowed\",\n\t\t\t})\n\t\t}\n\n\t\t// for _, endpoint := range macro.Authorizers {\n\t\t// \tparts := strings.SplitN(endpoint, \" \", 2)\n\t\t// \tif len(parts) < 2 {\n\t\t// \t\treturn c.JSON(500, map[string]interface{}{\n\t\t// \t\t\t\"success\": false,\n\t\t// \t\t\t\"error\": fmt.Sprintf(\"authorizer: %s is invalid\", endpoint),\n\t\t// \t\t})\n\t\t// \t}\n\t\t// \tresp, err := resty.R().SetHeaders(map[string]string{\n\t\t// \t\t\"Authorization\": c.Request().Header.Get(\"Authorization\"),\n\t\t// \t}).Execute(parts[0], parts[1])\n\t\t// \tif err != nil {\n\t\t// \t\treturn c.JSON(500, map[string]interface{}{\n\t\t// \t\t\t\"success\": false,\n\t\t// \t\t\t\"error\": err.Error(),\n\t\t// \t\t})\n\t\t// \t}\n\t\t// \tif resp.StatusCode() >= 400 {\n\t\t// \t\treturn c.JSON(resp.StatusCode(), map[string]interface{}{\n\t\t// \t\t\t\"success\": false,\n\t\t// \t\t\t\"error\": resp.Status(),\n\t\t// \t\t})\n\t\t// \t}\n\t\t// }\n\n\t\tc.Set(\"macro\", macro)\n\n\t\treturn next(c)\n\t}\n}", "title": "" }, { "docid": "a6437566ec328a54acb85f69b09a9a10", "score": "0.5099019", "text": "func (s *server) authorized(h http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t//Map to work as authorization scheme.\n\t\tallowedUser := make(map[string]bool)\n\t\tallowedUser[\"postmannen@gmail.com\"] = true\n\t\tallowedUser[\"hanslad@gmail.com\"] = true\n\t\tallowedUser[\"oeystbe2@gmail.com\"] = true\n\n\t\t//Check for cookie, and if found put the result in 'session'.\n\t\tvar err error\n\t\tsession, err := s.store.Get(r, \"cookie-name\")\n\t\tif err != nil {\n\t\t\tlog.Printf(\"--- error: d.store.get failed: %v\\n\", err)\n\t\t}\n\n\t\t//Check if user is authenticated.\n\t\tif auth, ok := session.Values[\"authenticated\"].(bool); !ok || !auth {\n\t\t\thttp.Error(w, \"Not authenticated\", http.StatusForbidden)\n\t\t\tlog.Println(\"info: user not authenticated\")\n\t\t\treturn\n\t\t}\n\n\t\t//Check if user if authorized for access to page.\n\t\tif eMail, ok := session.Values[\"email\"].(string); !ok || eMail != \"\" {\n\t\t\t_, ok := allowedUser[eMail]\n\t\t\tif !ok {\n\t\t\t\thttp.Error(w, \"Not authorized..\", http.StatusForbidden)\n\t\t\t\tlog.Println(\"info: not authorized: \", eMail)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\ts.Email = session.Values[\"email\"].(string)\n\t\ts.Authenticated = session.Values[\"authenticated\"].(bool)\n\n\t\t//We need to execute the HandlerFunc.\n\t\th(w, r)\n\n\t}\n\n}", "title": "" }, { "docid": "9b0e4201459c39ca072b14b6c853c99a", "score": "0.5094971", "text": "func OffertoroAuthRequired(secretKey string) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tdata := fmt.Sprintf(\"%v-%v-%v\", c.Query(\"oid\"), c.Query(\"user_id\"), secretKey)\n\t\tif sign := fmt.Sprintf(\"%x\", md5.Sum([]byte(data))); sign != c.Query(\"sig\") {\n\t\t\thttprequest, _ := httputil.DumpRequest(c.Request, true)\n\t\t\tlogrus.WithFields(logrus.Fields{\n\t\t\t\t\"event\": models.EventOffertoroInvalidSignature,\n\t\t\t\t\"user_id\": c.Query(\"user_id\"),\n\t\t\t\t\"signature\": sign,\n\t\t\t\t\"q_signature\": c.Query(\"sig\"),\n\t\t\t\t\"request\": string(httprequest),\n\t\t\t}).Error(\"signature not matched\")\n\t\t\tc.String(http.StatusForbidden, \"0\")\n\t\t\treturn\n\t\t}\n\n\t\tc.Next()\n\t}\n}", "title": "" }, { "docid": "46aa21850dd9d8a25ca66b66bb5adca4", "score": "0.5091648", "text": "func UsesUnexportedAsParameter(a unexportedButUsedInParameter) {}", "title": "" }, { "docid": "d2cc13d2aa734c5004d34b1d0abd6224", "score": "0.50892663", "text": "func basicAuth(authenticator auth.Authenticator, hf http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tuser, pwd, ok := r.BasicAuth()\n\t\tisValid := authenticator.Authenticate(user, pwd)\n\n\t\tif !ok || !isValid {\n\t\t\tw.Header().Set(\"WWW-Authenticate\", \"Basic Realm=\\\"Strava Login\\\"\")\n\t\t\thttp.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)\n\t\t} else {\n\t\t\tctx := context.WithValue(r.Context(), \"username\", user)\n\t\t\thf(w, r.WithContext(ctx))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b6f8255acfe55b79e2d37785af1e1d04", "score": "0.5086495", "text": "func authHandler(w http.ResponseWriter, r *http.Request) {\n\tusername := r.Header.Get(cfg.UsernameHeader)\n\tpassword := r.Header.Get(cfg.PasswordHeader)\n\tif validUser(username, password) {\n\t\tw.WriteHeader(http.StatusOK)\n\t} else {\n\t\tw.WriteHeader(http.StatusForbidden)\n\t}\n}", "title": "" }, { "docid": "dabb1d7f68a00351a4d59dde957cb9a2", "score": "0.50845975", "text": "func Auth(c *context.Context) {\n\tbeego.Debug(\"checking.....\")\n}", "title": "" }, { "docid": "5fbcac477c8df5d1822fa2bcf24dd50e", "score": "0.50820076", "text": "func requireAuth(w http.ResponseWriter) {\n\tw.Header().Set(\"WWW-Authenticate\", \"Basic realm=\\\"Authorization Required\\\"\")\n\thttp.Error(w, \"Not Authorized\", http.StatusUnauthorized)\n}", "title": "" }, { "docid": "1162090b76cec4ce9733d7a25d92e5e4", "score": "0.5081806", "text": "func EscalatedAuthRequired() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\t_, ok := c.Get(\"userId\")\n\t\tif !ok {\n\t\t\tc.AbortWithError(http.StatusUnauthorized, fmt.Errorf(\"Unauthorized\"))\n\t\t\treturn\n\t\t}\n\t\tescalated, ok := c.Get(\"escalated\")\n\t\tif !ok || escalated == false {\n\t\t\tc.AbortWithError(http.StatusUnauthorized, fmt.Errorf(\"Escalated privileges expired\"))\n\t\t\treturn\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "a42aeaf4389575d07bb399e7541f4b6b", "score": "0.50735265", "text": "func utilsdisplayapipasswordcmd() {\n\tfmt.Println(httpClient.Password)\n}", "title": "" }, { "docid": "82a744360c1c52035dae638cf82d8a16", "score": "0.507112", "text": "func (s *managerRPCServer) AuthFuncOverride(ctx context.Context, fullMethodName string) (context.Context, error) {\n\treturn ctx, nil\n}", "title": "" }, { "docid": "a534a099e0cc3d7dd2b7c2db856b4dc5", "score": "0.50695115", "text": "func auth(ctx context.Context, db *db.PgDB, fullMethod string,\n\textConfig *model.ExternalSessions,\n) (*model.User, *model.UserSession, error) {\n\tif unauthenticatedMethods[fullMethod] {\n\t\treturn nil, nil, nil\n\t}\n\n\treturn GetUser(ctx)\n}", "title": "" }, { "docid": "1f5ebd282f4594c23c22be6f432b54e0", "score": "0.50644094", "text": "func exampleAuthFunc(ctx context.Context) (context.Context, error) {\n\ttoken, err := grpc_auth.AuthFromMD(ctx, \"bearer\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttokenInfo, err := parseToken(token)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Unauthenticated, \"invalid auth token: %v\", err)\n\t}\n\n\tgrpc_ctxtags.Extract(ctx).Set(\"auth.sub\", userClaimFromToken(tokenInfo))\n\n\t// WARNING: in production define your own type to avoid context collisions\n\tnewCtx := context.WithValue(ctx, \"tokenInfo\", tokenInfo)\n\n\treturn newCtx, nil\n}", "title": "" }, { "docid": "1f5ebd282f4594c23c22be6f432b54e0", "score": "0.50644094", "text": "func exampleAuthFunc(ctx context.Context) (context.Context, error) {\n\ttoken, err := grpc_auth.AuthFromMD(ctx, \"bearer\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttokenInfo, err := parseToken(token)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Unauthenticated, \"invalid auth token: %v\", err)\n\t}\n\n\tgrpc_ctxtags.Extract(ctx).Set(\"auth.sub\", userClaimFromToken(tokenInfo))\n\n\t// WARNING: in production define your own type to avoid context collisions\n\tnewCtx := context.WithValue(ctx, \"tokenInfo\", tokenInfo)\n\n\treturn newCtx, nil\n}", "title": "" }, { "docid": "34e3a54bd6ef70ee7e60d4dace6f2914", "score": "0.5063433", "text": "func CustomAuth(scheme string, username string, password string, realm string, parameters map[string]any) AuthToken {\n\ttokens := map[string]any{\n\t\tkeyScheme: scheme,\n\t\tkeyPrincipal: username,\n\t}\n\n\tif password != \"\" {\n\t\ttokens[keyCredentials] = password\n\t}\n\n\tif realm != \"\" {\n\t\ttokens[keyRealm] = realm\n\t}\n\n\tif len(parameters) > 0 {\n\t\ttokens[\"parameters\"] = parameters\n\t}\n\n\treturn AuthToken{Tokens: tokens}\n}", "title": "" }, { "docid": "fd69c2b2e502ff4c91a4b97598796c25", "score": "0.5054873", "text": "func Authorize(fn func(http.ResponseWriter, *http.Request)) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Host != \"localhost:4030\" {\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\tfmt.Fprint(w, \"Unauthorized\")\n\t\t} else {\n\t\t\tfn(w, r)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c858ef2ebded3b5a124bcfaaedaa28a6", "score": "0.5054248", "text": "func AccessControl(main gin.HandlerFunc, allowedTokens map[string]bool, errMsg string) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tiface, ok := c.Get(TokenName)\n\t\tif !ok {\n\t\t\tlog.Println(\"System error: token wasn't found in context\")\n\t\t\treturn\n\t\t}\n\n\t\ttoken := iface.(string)\n\n\t\tif _, ok := allowedTokens[token]; !ok {\n\t\t\tc.Writer.WriteHeader(http.StatusUnauthorized)\n\t\t\tif errMsg != \"\" {\n\t\t\t\tc.Writer.Write([]byte(errMsg))\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tmain(c)\n\t}\n}", "title": "" }, { "docid": "674dabde4fd87a24215ddde44e053058", "score": "0.50515443", "text": "func Auth(username, password string) Validator {\n\treturn ValidateFunc(func(c *Credential) bool {\n\t\treturn c.Authorization && c.Username == username && c.Password == password\n\t})\n}", "title": "" }, { "docid": "9b22b574eae5023b81af23bd7f98175d", "score": "0.5051261", "text": "func PathSecurityValidation(ps *PathSecurity, w http.ResponseWriter, r *http.Request) bool {\n\t// Regarde si authentifier\n\tuser, err := ValidUserCookie(r)\n\tif err != nil {\n\t\t// redirige vers login avec message d'erreur et l'url qu'on voulait allez\n\t\trl := &RedirectLogin{\n\t\t\tMessage: err.Error(),\n\t\t\tURL: r.URL.String(),\n\t\t}\n\t\tRedirectTo(w, r, \"/auth/login\", rl)\n\t\treturn false\n\t}\n\n\tvar errAccess *DeniedAccess\n\t// valide que le token est encore bon\n\n\t// Valide que le role est correcte\n\tif !IsOneSet(ps.RoleRequired, user.Role) {\n\t\terrAccess = &DeniedAccess{\n\t\t\tBadField: \"role\",\n\t\t\tMessage: \"Role incorrect\",\n\t\t}\n\t}\n\t// Regarde s'il s'agit d'un usager ou group ou autre\n\tvar right Right\n\tvar needed Right\n\tif user.Username == ps.Owner {\n\t\tright = ps.Right[0]\n\t} else if InGroup(user, ps.Group) {\n\t\tright = ps.Right[1]\n\t} else {\n\t\tright = ps.Right[2]\n\t}\n\t// Regarde le type de request et regarde si on peut la faire avec les droits\n\tswitch r.Method {\n\tcase \"GET\":\n\t\tneeded = RightRead\n\tcase \"POST\", \"PUT\", \"DELETE\":\n\t\tneeded = RightWrite\n\tdefault:\n\t\tneeded = RightExecute\n\t}\n\tif !right.Have(needed) {\n\t\terrAccess = &DeniedAccess{\n\t\t\tBadField: \"right\",\n\t\t\tMessage: fmt.Sprintf(\"Your right are %v but needed %v\", right, needed),\n\t\t}\n\t}\n\n\tif errAccess != nil {\n\t\tRedirectTo(w, r, \"/denied\", errAccess)\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "90c2fe9dcbc00e72ceb6b1f4d6cd99ba", "score": "0.50455195", "text": "func testAuthenticatedConsoleAvailableInvalidUserPass(t *testing.T) {\n\n\tconst expectedReturnCode = 401\n\n\t// Get context for Private\n\tpubCluster, err := testRunner.GetPublicContext(1)\n\tassert.Assert(t, err)\n\n\tusername := \"skupper-user\"\n\tpassword := \"not-real-pass\"\n\n\ttestConsoleAccess(t, pubCluster, flowURL+\"/sites/\", username, password, expectedReturnCode)\n}", "title": "" }, { "docid": "5f962427978a22a103fef0dfa0a7245c", "score": "0.5044497", "text": "func Authorize(token string) func(s *sling.Sling) *sling.Sling {\r\n\treturn func(s *sling.Sling) *sling.Sling {\r\n\t\treturn s.Set(\"Authorization\", \"bearer \"+token)\r\n\t}\r\n}", "title": "" }, { "docid": "9327364bb1dfe8d7a597fd9b32ef8241", "score": "0.5036424", "text": "func (self *HTTPServer) Authenticated(c *gin.Context, requiredParams []string) (url.Values, bool) {\n\terr := c.Request.ParseForm()\n\tif err != nil {\n\t\tc.JSON(\n\t\t\thttp.StatusOK,\n\t\t\tgin.H{\n\t\t\t\t\"success\": false,\n\t\t\t\t\"reason\": \"Malformed request package\",\n\t\t\t},\n\t\t)\n\t\treturn c.Request.Form, false\n\t}\n\n\tif !self.authEnabled {\n\t\treturn c.Request.Form, true\n\t}\n\n\tparams := c.Request.Form\n\tif !IsIntime(params.Get(\"nonce\")) {\n\t\tc.JSON(\n\t\t\thttp.StatusOK,\n\t\t\tgin.H{\n\t\t\t\t\"success\": false,\n\t\t\t\t\"reason\": \"Your nonce is invalid\",\n\t\t\t},\n\t\t)\n\t\treturn c.Request.Form, false\n\t}\n\n\tfor _, p := range requiredParams {\n\t\tif params.Get(p) == \"\" {\n\t\t\tc.JSON(\n\t\t\t\thttp.StatusOK,\n\t\t\t\tgin.H{\n\t\t\t\t\t\"success\": false,\n\t\t\t\t\t\"reason\": fmt.Sprintf(\"Required param (%s) is missing. Param name is case sensitive\", p),\n\t\t\t\t},\n\t\t\t)\n\t\t\treturn c.Request.Form, false\n\t\t}\n\t}\n\n\tsigned := c.GetHeader(\"signed\")\n\tmessage := c.Request.Form.Encode()\n\tknsign := self.auth.KNSign(message)\n\tlog.Printf(\n\t\t\"Signing message(%s) to check authentication. Expected \\\"%s\\\", got \\\"%s\\\"\",\n\t\tmessage, knsign, signed)\n\tif signed == knsign {\n\t\treturn params, true\n\t} else {\n\t\tc.JSON(\n\t\t\thttp.StatusOK,\n\t\t\tgin.H{\n\t\t\t\t\"success\": false,\n\t\t\t\t\"reason\": \"Invalid signed token\",\n\t\t\t},\n\t\t)\n\t\treturn params, false\n\t}\n}", "title": "" }, { "docid": "6586b04c163a199a28a781dde84e8e87", "score": "0.5035158", "text": "func IfAuth(client *elastic.Client, handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, p httpr.Params)) func(w http.ResponseWriter, r *http.Request, p httpr.Params) {\n\treturn func(w http.ResponseWriter, r *http.Request, p httpr.Params) {\n\t\tvar token string\n\t\tif token = r.FormValue(\"token\"); token == \"\" {\n\t\t\tif token = r.Header.Get(\"Authorization\"); token == \"\" {\n\t\t\t\tif token = r.Header.Get(\"authorization\"); token == \"\" {\n\t\t\t\t\twriteResponse(w, http.StatusUnauthorized, \"borg-api: Missing access token\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tu, err := endpoints.NewEndpoints(nil, client, nil).GetUser(token)\n\t\tif err != nil || u == nil {\n\t\t\t// github may not recognize the token, return an error\n\t\t\twriteResponse(w, http.StatusUnauthorized, \"borg-api: Invalid access token\")\n\t\t\treturn\n\t\t}\n\t\t// no errors, process the handler\n\t\tctx := context.WithValue(context.Background(), \"token\", token)\n\t\tctx = context.WithValue(ctx, \"userId\", u.Id)\n\t\thandler(ctx, w, r, p)\n\t}\n}", "title": "" }, { "docid": "1ec7c2fdbde417f01247cccc38db7b15", "score": "0.50340784", "text": "func RequireAccessToken(realm string, authServiceURL string, authClient string) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\t// extract token from request\n\t\ttoken, err := ExtractAuthorizationToken(c.Request, api.AuthorizationMethodBearer)\n\t\tif err != nil {\n\n\t\t\tif err == api.ErrAuthHeaderNotFound {\n\t\t\t\t// if api.HTTPHeaderAuthorization header was not found, send response without details\n\t\t\t\tresp := api.BuildEmptyUnauthorizedResponse(realm, api.AuthorizationMethodBearer)\n\t\t\t\tresp.Send(c.Writer)\n\t\t\t} else {\n\t\t\t\tmsg := api.GetMessage(api.ErrorInvalidToken, api.GetLanguage(c))\n\t\t\t\tresp := api.BuildUnauthorizedResponse(api.ErrorInvalidToken, msg, realm, api.AuthorizationMethodBearer)\n\t\t\t\tresp.Send(c.Writer)\n\t\t\t}\n\n\t\t\t// prevent executing other handlers\n\t\t\tc.Abort()\n\n\t\t} else {\n\n\t\t\t// validate extracted token\n\t\t\tid, errToken := authentication.ValidateToken(token, authServiceURL, authClient)\n\t\t\tif errToken != nil {\n\n\t\t\t\tswitch errToken {\n\n\t\t\t\tcase api.ErrInvalidToken:\n\n\t\t\t\t\t// why this? avoid token validity check if the operation is Logout; I don't like it, but\n\t\t\t\t\t// this will prevent 401 during logout if the token ha expired.\n\n\t\t\t\t\tif c.Request.URL.Path != \"/v1/auth/revoke\" {\n\t\t\t\t\t\tapi.BuildUnauthorizedResponse(api.ErrorInvalidToken, errToken.Error(), realm, api.AuthorizationMethodBearer).Send(c.Writer)\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tc.Set(api.HandlerKeyTokenID, id)\n\t\t\t\t\t\tc.Next()\n\t\t\t\t\t}\n\n\t\t\t\tcase api.ErrAuthService:\n\t\t\t\t\tapi.BuildInternalErrorResponse().Send(c.Writer)\n\n\t\t\t\tdefault:\n\t\t\t\t\tapi.BuildUnauthorizedResponse(api.ErrorInvalidToken, errToken.Error(), realm, api.AuthorizationMethodBearer).Send(c.Writer)\n\n\t\t\t\t}\n\n\t\t\t\t// prevent executing other handlers\n\t\t\t\tc.Abort()\n\n\t\t\t} else {\n\t\t\t\t// Before executing the next stage in the pipeline, add the ID extracted from the token\n\t\t\t\t// as a Header in the request, so it's available to the rest of the pipeline\n\t\t\t\tc.Set(api.HandlerKeyTokenID, id)\n\t\t\t\tc.Next()\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fbe4c711f677f3823ebfdf7172c37b82", "score": "0.50261503", "text": "func int sqlite3_set_authorizer(\n sqlite3 *db,\n int (*xAuth)", "title": "" }, { "docid": "d98f6213c220d07b46e8ffe5c12ee401", "score": "0.50232106", "text": "func authenticateRequest(request *http.Request, defaultResource resource) (ok bool) {\n\treturn ((request.Method == http.MethodGet) && (defaultResource.forbidden()&get == 0)) ||\n\t\t((request.Method == http.MethodPut) && (defaultResource.forbidden()&set == 0)) ||\n\t\t((request.Method == http.MethodPost) && (defaultResource.forbidden()&create == 0)) ||\n\t\t((request.Method == http.MethodDelete) && (defaultResource.forbidden()&delete == 0))\n}", "title": "" }, { "docid": "f55dc2566adfc117336b051c016ec0e0", "score": "0.5021832", "text": "func authPassThrough(log *log.Logger, w http.ResponseWriter, req *http.Request, authData *serviceauth.Token, target *targetPassThroughAuth) bool {\n\tswitch target.config.Type {\n\tcase AuthPassThroughNone:\n\t\treturn true\n\tcase AuthPassThroughPureHub:\n\t\treturn authInjectPureHub(log, w, req, target)\n\tcase AuthPassThroughSitePro:\n\t\treturn authInjectSitePro(log, w, req, target)\n\tcase AuthPassThroughECS:\n\t\treturn authInjectECS(log, w, req, target)\n\tcase AuthPassThroughCouchDB:\n\t\treturn authInjectCouchDB(log, w, req, authData, target)\n\tdefault:\n\t\treturn true\n\t}\n}", "title": "" }, { "docid": "e84b565383ee133c8fac96a428b04120", "score": "0.50040215", "text": "func Auth() func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tbearer := r.Header.Get(\"Authorization\")\n\t\t\ts := strings.Split(bearer, \" \")\n\n\t\t\tlog.Default().Println(\"test\")\n\n\t\t\tif len(s) != 2 {\n\t\t\t\tlog.Default().Println(\"split\")\n\t\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\ttoken, err := jwt.ParseWithClaims(s[1], &user.WithClaims{}, func(t *jwt.Token) (interface{}, error) {\n\t\t\t\treturn user.AuthToken, nil\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tlog.Default().Println(\"token parse\", err)\n\t\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif !token.Valid {\n\t\t\t\tlog.Default().Println(\"not valid token\")\n\t\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tclaims, ok := token.Claims.(*user.WithClaims)\n\t\t\tif !ok {\n\t\t\t\tlog.Default().Println(\"claims\", ok)\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tr = r.WithContext(context.WithValue(r.Context(), user.CtxKey(), claims.ToUser()))\n\t\t\tnext.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "37326f7d69dbac188436b92125b40954", "score": "0.50010496", "text": "func (is infoServer) AuthFuncOverride(\n\tctx context.Context,\n\tfullMethodName string,\n) (context.Context, error) {\n\treturn ctx, nil\n}", "title": "" }, { "docid": "0dcd4c905e695f108a4acd7f6df1a07c", "score": "0.49999374", "text": "func authenticate(next http.Handler) http.Handler {\n return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n token := r.Header.Get(\"X-Auth-Token\")\n if token == \"\" {\n w.WriteHeader(401)\n w.Write([]byte(`[{\"code\":\"no_auth_token\"}]`))\n return\n }\n user, err := authenticator.Check(token)\n if err != nil {\n w.WriteHeader(401)\n w.Write([]byte(`[{\"code\":\"invalid_auth_token\"}]`))\n return\n }\n ctx := context.WithValue(r.Context(), \"user\", user)\n next.ServeHTTP(w, r.WithContext(ctx))\n })\n}", "title": "" }, { "docid": "05e9e5b043f242ba088b900c5ef74754", "score": "0.4994614", "text": "func checkAuth(au Authenticator, logger *log.Logger) Adapter {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tok, err := au.Authenticate(r)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Println(\"Error in authentication: \" + err.Error())\n\t\t\t\tWriteMessage(http.StatusBadRequest, \"Authorization token in invalid format\", w)\n\t\t\t} else if !ok {\n\t\t\t\tWriteMessage(http.StatusUnauthorized, \"Invalid Token\", w)\n\t\t\t} else {\n\t\t\t\th.ServeHTTP(w, r)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "954a27deb31c5b03e63d7261911debc4", "score": "0.4992932", "text": "func mustAuth(handler http.Handler) http.Handler {\n\treturn &withAuthHandler{handler}\n}", "title": "" }, { "docid": "4e6807d44f9322bb6813bf11c3809c26", "score": "0.49851474", "text": "func Authorization(next http.Handler) http.Handler {\n\t// TODO: Pensar em um jeito talvez de desconsiderar o token e utilizar o certificado p/ garantir a segurança na comunicação dos serviços com a api\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif !strings.Contains(r.RequestURI, \"/auth/login\") {\n\t\t\tpayload, err := token.Validate(r.Header.Get(\"Authorization\"))\n\t\t\tif err != nil {\n\t\t\t\thttp.Error(w, err.Error(), http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif value, ok := payload[\"code\"]; ok {\n\t\t\t\tr.Header.Add(\"username\", value.(string))\n\t\t\t} else {\n\t\t\t\thttp.Error(w, \"invalid token\", http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif value, ok := payload[\"language_code\"]; ok && r.Header.Get(\"Content-Language\") == \"\" {\n\t\t\t\tr.Header.Add(\"Content-Language\", value.(string))\n\t\t\t}\n\t\t}\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "b8341c03519ff27a85e86c27ba894395", "score": "0.49789506", "text": "func Protect(handler http.Handler) http.Handler {\n return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {\n /*\n userToken := req.Header.Get(\"\")\n if userToken == \"\" {\n //no token in header, Returns no authorization error.\n http.Error(res, http.StatusText(401), 401)\n return\n }\n token, err := jwt.Parse(userToken, func(token *jwt.Token) (interface{}, error) {\n //parsed token lookups are done with a callback\n if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n return nil, fmt.Errorf(\"Unexpected signing method: %v\", token.Header[\"alg\"])\n }\n return []byte(config.JwtSecret), nil\n })\n\n if err == nil && token.Valid {\n */\n //let the http request go through\n handler.ServeHTTP(res, req)\n /*\n } else {\n //unauthorized error\n http.Error(res, http.StatusText(401), 401)\n return\n }\n */\n\n })\n}", "title": "" }, { "docid": "fe4210fddc6e203ddcd33c0a3eef7f1f", "score": "0.4974544", "text": "func validate(username, password string) bool {\n\tif username == GetUsername() && password == GetPassword() {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "9668e098de5a4fd361f2abbb4354df66", "score": "0.49704096", "text": "func Authenticator(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := r.Context()\n\t\tmr := ctx.Value(ContextMinimumRole).(model.Roles)\n\n\t\tkey, pat, err := extractKeyFromRequest(r)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tca := &cache.Auth{}\n\n\t\t// do we have this key on cache already\n\t\tvar a Auth\n\t\tif err := ca.Exists(key, &a); err != nil {\n\t\t\tlog.Println(\"error while trying to get cache auth\", err)\n\t\t}\n\n\t\tif len(a.Email) > 0 {\n\t\t\tctx = context.WithValue(ctx, ContextAuth, a)\n\t\t} else {\n\t\t\tfmt.Println(\"database call for auth\", key)\n\t\t\tdb := ctx.Value(ContextDatabase).(*data.DB)\n\n\t\t\tid, _ := model.ParseToken(key)\n\t\t\tacct, user, err := db.Users.Auth(id, key, pat)\n\t\t\tif err != nil {\n\t\t\t\thttp.Error(w, \"invalid token key\", http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\ta.AccountID = acct.ID\n\t\t\ta.Email = user.Email\n\t\t\ta.UserID = user.ID\n\n\t\t\t// save it to cache\n\t\t\tca.Set(key, a, 30*time.Second)\n\n\t\t\tctx = context.WithValue(ctx, ContextAuth, a)\n\t\t}\n\n\t\t// we authorize the request\n\t\tif mr < a.Role {\n\t\t\thttp.Error(w, \"not authorized\", http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "title": "" } ]
b85784ac23de6ed37a500513b69018d3
IP address of service endpoint of the App Service Environment.
[ { "docid": "48e5d23dca0cabb87ee4e942e21c5094", "score": "0.6810012", "text": "func (o GetAppServiceEnvironmentResultOutput) ServiceIpAddress() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetAppServiceEnvironmentResult) string { return v.ServiceIpAddress }).(pulumi.StringOutput)\n}", "title": "" } ]
[ { "docid": "42b9170f91f07a4ff9b8bb8b0816c3a7", "score": "0.699545", "text": "func (s Wrapper) IPAddress() service.IpAddress {\n\treturn s.Service\n}", "title": "" }, { "docid": "006676406c20ca14692c1815386c2f90", "score": "0.67773956", "text": "func GetServiceAddr(container *dc.Container, portID string) string {\n\treturn \"http://127.0.0.1:\" + GetPort(container, portID)\n}", "title": "" }, { "docid": "04bd7118dc6e723e97b342ac3fe69605", "score": "0.67084414", "text": "func (appNode *appEntity) GetIPAddress() (string, error) {\n\treturn appNode.ipAddress, nil\n}", "title": "" }, { "docid": "d57e831ebada3a175b84daea85e5445d", "score": "0.6698119", "text": "func (ep *Endpoint) GetIP() string {\n\treturn ep.Interface.IPAddress\n}", "title": "" }, { "docid": "4d8cd96132173cbf19c6179ef22408ab", "score": "0.6457174", "text": "func GetAddressFromService(service *apiv1.Service) string {\n\tswitch service.Spec.Type {\n\tcase apiv1.ServiceTypeNodePort:\n\tcase apiv1.ServiceTypeClusterIP:\n\t\treturn service.Spec.ClusterIP\n\tcase apiv1.ServiceTypeExternalName:\n\t\treturn service.Spec.ExternalName\n\tcase apiv1.ServiceTypeLoadBalancer:\n\t\t{\n\t\t\tif len(service.Status.LoadBalancer.Ingress) > 0 {\n\t\t\t\tingress := service.Status.LoadBalancer.Ingress[0]\n\t\t\t\tif ingress.Hostname != \"\" {\n\t\t\t\t\treturn ingress.Hostname\n\t\t\t\t}\n\t\t\t\treturn ingress.IP\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "d17a69685af655912712cca6192741db", "score": "0.64436823", "text": "func (s *service) Addr() string {\n\treturn fmt.Sprintf(\"%s:%d\", s.addr, s.port)\n}", "title": "" }, { "docid": "d153c27653ce61bfd6a024be350c0e21", "score": "0.6417725", "text": "func GetAppServerAddress() string {\n\treturn config.ExternalName + \":\" + config.Ports.ExtRest\n}", "title": "" }, { "docid": "e621113596d60587749b74095a2a5d7e", "score": "0.6369788", "text": "func getIpAddress() string {\n\tipAddress := \"172.17.0.1\"\n\treturn ipAddress\n}", "title": "" }, { "docid": "92f6d8e1ab24cd9b76f4402216959aae", "score": "0.63597906", "text": "func (hp *HostPort) Addr() string { return hp.String() }", "title": "" }, { "docid": "6f99ca3ff9b99999157c433844fa8cb1", "score": "0.6354848", "text": "func GetIPFromEndpoint(endpoint string) string {\n\thost, _, err := net.SplitHostPort(endpoint)\n\tif err != nil {\n\t\tlogger.Errorf(\"failed to split ip and port for endpoint %q. %v\", endpoint, err)\n\t}\n\treturn host\n}", "title": "" }, { "docid": "5fd2969f90725cf94f31b3203f11fb0b", "score": "0.6342303", "text": "func (s *Service) Addr() net.Addr { return s.ln.Addr() }", "title": "" }, { "docid": "000832f09eab6532cdd1917ec1ad313c", "score": "0.62903744", "text": "func getIPAddress(env *manager.KaraokeManager) string {\n\tec2IPv4URL := \"http://169.254.169.254/latest/meta-data/public-ipv4\"\n\tdefaultExternalIPAddressURL := \"http://ipconfig.me\"\n\tipv4 := sendGetRequest(env, ec2IPv4URL)\n\tif ipv4 != \"\" {\n\t\treturn ipv4\n\t}\n\treturn sendGetRequest(env, defaultExternalIPAddressURL)\n}", "title": "" }, { "docid": "4ec477de02273f05d83748853f76d946", "score": "0.6259586", "text": "func (c *Container) GetIPAddress(ctx context.Context) (string, error) {\n\tinspect, err := inspectContainer(ctx, c)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn inspect.NetworkSettings.Gateway, nil\n}", "title": "" }, { "docid": "17fa721de060bba6b63f7b286439e87c", "score": "0.6210906", "text": "func (s *SNSService) Endpoint() string {\n\treturn s.endpoint\n}", "title": "" }, { "docid": "bca56174efeae58ff6774b4872d8a7f7", "score": "0.619615", "text": "func (o EndpointAttachmentOutput) EndpointIp() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *EndpointAttachment) pulumi.StringOutput { return v.EndpointIp }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "714de6cdda0278121eb7145d6be9f28f", "score": "0.6184618", "text": "func (c *WinRM) IPAddress() string {\n\treturn c.Address\n}", "title": "" }, { "docid": "d416f29e8e053307d4e21e3a9355f49f", "score": "0.6181176", "text": "func GetEndpoint(s *model.Service, e *model.Environment) (string, error) {\n\tif e.Provider.IsTestProvider() {\n\t\treturn \"\", nil\n\t}\n\tserviceName := s.Name\n\tc, err := client.Get(e.Provider)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tsClient := c.CoreV1().Services(e.Name)\n\ttries := 0\n\tfor tries < 30 {\n\t\ttries++\n\t\ttime.Sleep(6 * time.Second)\n\t\tk8Service, err := sClient.Get(getLoadBalancerName(serviceName), metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"Error getting kubernetes service: %s\", err)\n\t\t}\n\t\tif k8Service.Name == \"\" {\n\t\t\treturn \"\", nil\n\t\t}\n\t\tif len(k8Service.Status.LoadBalancer.Ingress) > 0 {\n\t\t\treturn k8Service.Status.LoadBalancer.Ingress[0].IP, nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"External load balancer not created after 3 minutes\")\n}", "title": "" }, { "docid": "b25c6eded8731fadb6ad7cd866d59e24", "score": "0.61680186", "text": "func PublicAddr() string {\n return env.LocalAddr() // use the internal address\n}", "title": "" }, { "docid": "99a42e46ada3dd43f913c16b183ff657", "score": "0.61601853", "text": "func (o LookupEndpointResultOutput) EndpointIp() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupEndpointResult) string { return v.EndpointIp }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7c2b61671b5a4758ade49df4dd527b84", "score": "0.6158115", "text": "func getExternalIPForService(serviceName string, namespace string) string {\n\tvar externalAddress string\n\tservice, err := ClientSet.CoreV1().Services(namespace).Get(context.Background(), serviceName, metav1.GetOptions{})\n\tif err != nil {\n\t\tlog.Errorf(\"Error retrieving service with name: %s, %e\", serviceName, err)\n\t}\n\n\tfor _, ingress := range service.Status.LoadBalancer.Ingress {\n\t\texternalAddress = ingress.IP\n\t\t// if address.Type == \"InternalIP\" {\n\t\t// \texternalAddress = address\n\t\t// } else {\n\t\t// \tlog.Infof(\"Skipping adding address: %s, of type: %s\", nodeAddress.Address, nodeAddress.Type)\n\t\t// }\n\t}\n\treturn externalAddress\n}", "title": "" }, { "docid": "1bd7a0085d40a8d40faaaf5838ec10eb", "score": "0.6139987", "text": "func Addr(ins spec.Instance) string {\n\tif ins.GetPort() == 0 || ins.GetPort() == 80 {\n\t\tpanic(ins)\n\t}\n\treturn ins.GetHost() + \":\" + strconv.Itoa(ins.GetPort())\n}", "title": "" }, { "docid": "3d618c687f28c2cc079d98b1eb549c72", "score": "0.6107986", "text": "func GetIPAddress(r *http.Request) string {\n\tif r.Header != nil {\n\t\txForwardedFor := r.Header.Get(\"X-Forwarded-For\")\n\t\tif xForwardedFor != \"\" {\n\t\t\tips := strings.Split(xForwardedFor, \",\")\n\t\t\tfor i := range ips {\n\t\t\t\tips[i] = strings.TrimSpace(ips[i])\n\t\t\t}\n\n\t\t\tfor _, ip := range ips {\n\t\t\t\tif ip != \"\" {\n\t\t\t\t\treturn ip\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tipPort := r.RemoteAddr\n\tip, _, err := net.SplitHostPort(ipPort)\n\tif err != nil {\n\t\treturn ipPort\n\t}\n\n\treturn ip\n}", "title": "" }, { "docid": "da8ecfb70f05b6d8aaeae853389a11f2", "score": "0.6087092", "text": "func (s *SecureServingInfo) Address() string {\n\treturn net.JoinHostPort(s.BindAddress, strconv.Itoa(s.BindPort))\n}", "title": "" }, { "docid": "84565c20c9b89574115696eb43a03f71", "score": "0.60804886", "text": "func (c *Localhost) IPAddress() string {\n\treturn \"127.0.0.1\"\n}", "title": "" }, { "docid": "9237bd0273335016e9ca4d0e34f24a81", "score": "0.6035712", "text": "func GetMyIPAddress() (string, error) {\n\tconn, err := net.Dial(\"tcp\", \"keystone-api:5000\")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Cannot get my ip address: %v\", err)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().String()\n\tidx := strings.LastIndex(localAddr, \":\")\n\n\treturn localAddr[0:idx], nil\n}", "title": "" }, { "docid": "3d5af35f61002470513f75aaff4dac7c", "score": "0.60039663", "text": "func (m Machine) IPAddress() string {\n\tipAddr := \"\"\n\tfor _, dataEntry := range m.ResourceData.Entries {\n\t\tif dataEntry.Key == \"NETWORK_LIST\" {\n\t\t\titems := dataEntry.Value.(map[string]interface{})[\"items\"].([]interface{})\n\t\t\tfor _, item := range items {\n\t\t\t\tif item.(map[string]interface{})[\"componentTypeId\"] == \"com.vmware.csp.component.iaas.proxy.provider\" {\n\t\t\t\t\tvalues := item.(map[string]interface{})[\"values\"]\n\t\t\t\t\tfor _, entry := range values.(map[string]interface{})[\"entries\"].([]interface{}) {\n\t\t\t\t\t\tif entry.(map[string]interface{})[\"key\"] == \"NETWORK_ADDRESS\" {\n\t\t\t\t\t\t\tipAddr = entry.(map[string]interface{})[\"value\"].(map[string]interface{})[\"value\"].(string)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn ipAddr\n}", "title": "" }, { "docid": "56eeecf09ff7c7d2a58b0b7e585bee1d", "score": "0.6001645", "text": "func (i *Inbound) Endpoint() string {\n\treturn i.externalAddr\n}", "title": "" }, { "docid": "e51f3fdb84c0b871d91de9b61d417de0", "score": "0.5973663", "text": "func getListenAddress() string {\n\tport := getEnv(EnvPort, \"80\")\n\treturn \":\" + port\n}", "title": "" }, { "docid": "e3d90802351b5e9e80f9fe35a76a620f", "score": "0.5967346", "text": "func getEndpointFromEnv() string {\n\tif endpoint, ok := os.LookupEnv(common.EnvKeyStoreName); ok {\n\t\treturn endpoint\n\t}\n\n\treturn fmt.Sprintf(\"http://%s/api\", common.DNSNameTaskStore)\n}", "title": "" }, { "docid": "62d598fc2b59526d8e508ce842e8a447", "score": "0.5958224", "text": "func (o GetAppServiceEnvironmentResultOutput) InternalIpAddress() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetAppServiceEnvironmentResult) string { return v.InternalIpAddress }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d4b067840d09bf694a8e17e5aef000fb", "score": "0.59490824", "text": "func getLoadBalancerIP(svc *corev1.Service) string {\n\tip := svc.Status.LoadBalancer.Ingress[0].IP\n\treturn ip\n}", "title": "" }, { "docid": "2337a6d333849f435eba12b30656e48a", "score": "0.594872", "text": "func ServicePort() string {\n\treturn \":\" + viper.GetString(\"SERVICE_PORT\")\n}", "title": "" }, { "docid": "909a7c6b41e5c7fef41ed930b3442587", "score": "0.5940734", "text": "func GetIPAddress() string {\r\n\tvar IPadd string\r\n\taddrs, err := net.InterfaceAddrs()\r\n\tif err != nil {\r\n\t\tfmt.Println(\"error:\", err)\r\n\t}\r\n\r\n\tfor _, a := range addrs {\r\n\t\tif ipnet, ok := a.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {\r\n\t\t\tif ipnet.IP.To4() != nil {\r\n\t\t\t\tIPadd = ipnet.IP.String()\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn IPadd\r\n}", "title": "" }, { "docid": "6fd2330eedb878204999f968aa373c17", "score": "0.5937739", "text": "func (s *ipaddrsrvc) IP(ctx context.Context) (res string, err error) {\n\ts.logger.Print(\"ipaddr.ip\")\n\ts.logger.Print(ctx)\n\treturn \"your ip address here: as a service\", nil\n}", "title": "" }, { "docid": "588d216bb3c3d43112b4fca98eb48428", "score": "0.5909403", "text": "func (n *Node) Address() string {\n\tif s := n.InfoAttrFirstValidValueAmong(\"service-tls-std\", \"service-clear-std\", \"service\"); s != common.NOT_AVAILABLE {\n\t\treturn s\n\t}\n\th := *n.origHost\n\treturn h.Name + \":\" + strconv.Itoa(h.Port)\n}", "title": "" }, { "docid": "0bde90082e8977933ce10faa3c4b271c", "score": "0.5905055", "text": "func (a *awsApp) GetEndpointURL() string {\n\tif a.localALPNProxy != nil {\n\t\treturn \"https://\" + a.localALPNProxy.GetAddr()\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "657a921a3410e3a8bd9ad90363bb7828", "score": "0.59037244", "text": "func GetIP() string {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdockerClient, err := client.NewEnvClient()\n\tdefer cancel()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tnodes, err := dockerClient.NodeList(ctx, types.NodeListOptions{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor _, n := range nodes {\n\t\tif n.Spec.Role == swarm.NodeRoleWorker {\n\t\t\tcontinue\n\t\t}\n\t\tif n.ManagerStatus.Leader {\n\t\t\treturn n.Status.Addr\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "012d379d5de7f18ca9967288f50fc2c2", "score": "0.58943784", "text": "func (w Worker) IP() string { return w.container.IP() }", "title": "" }, { "docid": "1535da62871181f2a335a1f72b59e9d6", "score": "0.58932626", "text": "func (o EndpointOutput) IpAddress() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Endpoint) *string { return v.IpAddress }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1535da62871181f2a335a1f72b59e9d6", "score": "0.58932626", "text": "func (o EndpointOutput) IpAddress() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Endpoint) *string { return v.IpAddress }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d6421fb05acb6170f82a16adda45876e", "score": "0.58907646", "text": "func ServiceHostPort(addr net.Addr) string {\n\ttcpAddr, ok := addr.(*net.TCPAddr)\n\tif ok {\n\t\tif tcpAddr.IP.IsUnspecified() {\n\t\t\tpublicIP, err := FindPublicIPv4()\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Unable to determine public IP: %v\", err)\n\t\t\t}\n\t\t\treturn fmt.Sprintf(\"%s:%d\", publicIP.String(), tcpAddr.Port)\n\t\t}\n\t\treturn tcpAddr.String()\n\t}\n\n\tudpAddr, ok := addr.(*net.UDPAddr)\n\tif ok {\n\t\tif udpAddr.IP.IsUnspecified() {\n\t\t\tpublicIP, err := FindPublicIPv4()\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Unable to determine public IP: %v\", err)\n\t\t\t}\n\t\t\treturn fmt.Sprintf(\"%s:%d\", publicIP.String(), udpAddr.Port)\n\t\t}\n\t\treturn udpAddr.String()\n\t}\n\tlog.Printf(\"Listen address isn't TCP or UDP (%T)\", addr)\n\treturn \"\"\n}", "title": "" }, { "docid": "c41b02dd9987a867e94812ec50b7fe79", "score": "0.58889574", "text": "func (s *Service) Addr() net.Addr {\n\treturn s.addr\n}", "title": "" }, { "docid": "2175761852f17e9a26bbcabc303b12e0", "score": "0.58762324", "text": "func (api *API) Address() string {\n\treturn api.Host + \":\" + strconv.Itoa(api.Port)\n}", "title": "" }, { "docid": "a21f048705049b605a3adb3e33048f7b", "score": "0.5857451", "text": "func (cisIpApi *CisIpApiV1) GetServiceURL() string {\n\treturn cisIpApi.Service.GetServiceURL()\n}", "title": "" }, { "docid": "e7de87aa5122c923c7dcc8ac675075f5", "score": "0.5851526", "text": "func (ctx *context) IP() string {\n\treturn strings.Trim(realIP(ctx.request.inner), \"[]\")\n}", "title": "" }, { "docid": "c178a34b49f2aadff97c8f5d93e7c008", "score": "0.5845046", "text": "func GetIPAddress(r *http.Request) string {\n\tclientIP := r.Header.Get(\"X-Forwarded-For\")\n\tif userIP, ok := IPFromRequest(r); ok == nil {\n\t\tlastIP := userIP.String()\n\t\tif clientIP == \"\" {\n\t\t\tclientIP = lastIP\n\t\t} else {\n\t\t\tclientIP += fmt.Sprintf(\", %s\", lastIP)\n\t\t}\n\t}\n\n\treturn clientIP\n}", "title": "" }, { "docid": "c178a34b49f2aadff97c8f5d93e7c008", "score": "0.5845046", "text": "func GetIPAddress(r *http.Request) string {\n\tclientIP := r.Header.Get(\"X-Forwarded-For\")\n\tif userIP, ok := IPFromRequest(r); ok == nil {\n\t\tlastIP := userIP.String()\n\t\tif clientIP == \"\" {\n\t\t\tclientIP = lastIP\n\t\t} else {\n\t\t\tclientIP += fmt.Sprintf(\", %s\", lastIP)\n\t\t}\n\t}\n\n\treturn clientIP\n}", "title": "" }, { "docid": "bd344506818b11dc29a302e1514498a5", "score": "0.58448863", "text": "func (s *AppidAdapter) Addr() string {\n\treturn s.listener.Addr().String()\n}", "title": "" }, { "docid": "1e6813870e07034342c37501fc84f15a", "score": "0.58415896", "text": "func (db *DynamoDBService) Endpoint() string {\n\treturn db.endpoint\n}", "title": "" }, { "docid": "43a9a23d87d4bb6734c2c4a2fc774876", "score": "0.5839542", "text": "func (s *Service) Addr() net.Addr {\n\tif s.ln != nil {\n\t\treturn s.ln.Addr()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e1c3688328cdf32ac36f727989d7fbfd", "score": "0.58389276", "text": "func getIPAddress() string {\n\tvar ip4add = \"localhost\"\n\thost, err := os.Hostname()\n\tif err != nil {\n\t\tpanic(\"Cannot retrieve default hostname of the server\")\n\t}\n\tiparry, err := net.LookupIP(host)\n\tif err != nil {\n\t\tpanic(\"Cannot retrieve IPAddr from the server. Please use config file for providing the values.\")\n\t}\n\tfor _, ip := range iparry {\n\t\tif ip4 := ip.To4(); ip4 != nil {\n\t\t\tip4add = ip.String()\n\t\t}\n\t}\n\treturn ip4add\n}", "title": "" }, { "docid": "b9a230cd13cd3e8533e336c65919d4bf", "score": "0.58211976", "text": "func (c *InsecureServingConfig) Addr() string {\n\treturn net.JoinHostPort(c.Host, strconv.Itoa(c.Port))\n}", "title": "" }, { "docid": "803fa16f7412a44d38322e2f213309e3", "score": "0.5805819", "text": "func (s *Service) Addr() net.Addr {\n\treturn s.ln.Addr()\n}", "title": "" }, { "docid": "803fa16f7412a44d38322e2f213309e3", "score": "0.5805819", "text": "func (s *Service) Addr() net.Addr {\n\treturn s.ln.Addr()\n}", "title": "" }, { "docid": "9dd53df9f152352f3c5a9ec16c4f756f", "score": "0.58026373", "text": "func (m *AuditActor) GetIpAddress()(*string) {\n return m.ipAddress\n}", "title": "" }, { "docid": "92c3a1de180a4e779d665efa0261f860", "score": "0.5793995", "text": "func (o DeploymentOutput) IpAddress() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Deployment) pulumi.StringOutput { return v.IpAddress }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "1d7a1e734862c2be9a0597ed05563ce4", "score": "0.57831156", "text": "func (p *grpcConfig) GetAddress() string {\n\treturn p.IP + \":\" + strconv.Itoa(p.Port)\n}", "title": "" }, { "docid": "96886aa048c7122d0870a3b5184f8f37", "score": "0.5774332", "text": "func (instance *Subnet) GetEndpointIP(ctx context.Context) (_ string, ferr fail.Error) {\n\tdefer fail.OnPanic(&ferr)\n\n\tif valid.IsNil(instance) {\n\t\treturn \"\", fail.InvalidInstanceError()\n\t}\n\n\t// instance.lock.RLock()\n\t// defer instance.lock.RUnlock()\n\n\tvar ip string\n\txerr := instance.Inspect(ctx, func(clonable data.Clonable, _ *serialize.JSONProperties) fail.Error {\n\t\tas, ok := clonable.(*abstract.Subnet)\n\t\tif !ok {\n\t\t\treturn fail.InconsistentError(\"'*abstract.Subnet' expected, '%s' provided\", reflect.TypeOf(clonable).String())\n\t\t}\n\n\t\tif as.VIP != nil && as.VIP.PublicIP != \"\" {\n\t\t\tip = as.VIP.PublicIP\n\t\t} else {\n\t\t\tobjpgw, innerXErr := LoadHost(ctx, instance.Service(), as.GatewayIDs[0])\n\t\t\tif innerXErr != nil {\n\t\t\t\treturn innerXErr\n\t\t\t}\n\n\t\t\tip, innerXErr = objpgw.(*Host).GetPublicIP(ctx)\n\t\t\treturn innerXErr\n\t\t}\n\t\treturn nil\n\t})\n\treturn ip, xerr\n}", "title": "" }, { "docid": "9eb8e0eeabd9ad2aa7b3ebe5102f64d9", "score": "0.57529193", "text": "func findIPAddress(comp *compute.Service, name string) (string, error) {\n\t// We have to look in each zone for the server with the given name.\n\tzones, err := comp.Zones.List(*project).Do()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Failed to list zones: %s\", err)\n\t}\n\tfor _, zone := range zones.Items {\n\t\titem, err := comp.Instances.Get(*project, zone.Name, name).Do()\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, nif := range item.NetworkInterfaces {\n\t\t\tfor _, acc := range nif.AccessConfigs {\n\t\t\t\tif strings.HasPrefix(strings.ToLower(acc.Name), \"external\") {\n\t\t\t\t\treturn acc.NatIP, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"Couldn't find an instance named: %s\", name)\n}", "title": "" }, { "docid": "395342152c91244d675c6762014e3abf", "score": "0.57513493", "text": "func GetAddress() string {\n\treturn Config.Viper.GetString(\"Address\")\n}", "title": "" }, { "docid": "20275ca62e3a368e58d3980b5d13f7b0", "score": "0.57306254", "text": "func (this *Request) Ip() string {\n\treturn this.Ips()[0]\n}", "title": "" }, { "docid": "e169624e9677a7644045acdda0b16954", "score": "0.57303303", "text": "func (c *Config) APIAddr() string {\n\treturn fmt.Sprintf(\":%s\", \"8000\")\n}", "title": "" }, { "docid": "7eaacc3360eea56c4818a02e2d6b6877", "score": "0.5692144", "text": "func (o FastHttpsAppVirtualServerOutput) Ip() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FastHttpsAppVirtualServer) string { return v.Ip }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7c8224ad21abeedb5c74128ea2ed1f3b", "score": "0.56868875", "text": "func (a endpoint) Port() int {\n\treturn a.port\n}", "title": "" }, { "docid": "dde6266b74e22bd2d73cd6a9493b7cf8", "score": "0.5682283", "text": "func (self *BaseController) GetClientIP() string {\n\taddr := self.Ctx.Request.RemoteAddr\n\tipport := strings.Split(addr, \":\")\n\tif len(ipport) == 2 {\n\t\treturn ipport[0]\n\t}\n\treturn addr\n}", "title": "" }, { "docid": "373393e32c253f438bf10b78eddb009c", "score": "0.56767553", "text": "func (m *UserTrainingContentEventInfo) GetIpAddress()(*string) {\n return m.ipAddress\n}", "title": "" }, { "docid": "6e90c1dfc58228976547385fcc11e360", "score": "0.56664574", "text": "func (appConfiguration *AppConfigurationV1) GetServiceURL() string {\n\treturn appConfiguration.Service.GetServiceURL()\n}", "title": "" }, { "docid": "b56f2a576d8b2b86491f4d5363ea15a6", "score": "0.5657824", "text": "func (o ServiceEndpointOutput) Address() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ServiceEndpoint) *string { return v.Address }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b9bde1727a25a9edf3e6b0ebec30a955", "score": "0.5652212", "text": "func GetServiceAddress(service string) (string, error) {\n\treturn fegRegistry.GetServiceAddress(service, protos.ServiceType_SOUTHBOUND)\n}", "title": "" }, { "docid": "fd7f8a947042f358fd0935813a3088e3", "score": "0.56397027", "text": "func (sr *socketResolver) Addr() string { return sr.addr }", "title": "" }, { "docid": "a5074254e17caed38facc0968855ba02", "score": "0.5631156", "text": "func (res *Resolver) Endpoint() (endpoint string) {\n\treturn res.endpoint\n}", "title": "" }, { "docid": "49638cf18a4436e79c54a0f9e3c10bde", "score": "0.56259495", "text": "func (d *Driver) GetIP() (string, error) {\n\t// DockerApiURL looks like: 'tcp://foo.bar:2376'\n\tu, err := url.Parse(d.DockerApiURL)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn strings.Split(u.Host, \":\")[0], nil\n}", "title": "" }, { "docid": "d5219f80682cfe608b0cefa9199d0f3a", "score": "0.5621507", "text": "func (h *httprunner) pubListeningAddr(config *cmn.Config) string {\n\tvar (\n\t\ttestingEnv = config.TestingEnv()\n\t\tk8sDetected = k8s.Detect() == nil\n\t)\n\tif testingEnv && !k8sDetected {\n\t\treturn h.si.PublicNet.TCPEndpoint()\n\t}\n\treturn \":\" + h.si.PublicNet.DaemonPort\n}", "title": "" }, { "docid": "87f101de022710cd61225a1b6c74ff29", "score": "0.5614532", "text": "func getAddress() string {\n\tinterfaces, err := address.GetPrivate()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Prefer 10.x.x.x\n\tprivate := interfaces[0].IP.String()\n\tfor _, addr := range interfaces {\n\t\tif strings.HasPrefix(addr.IP.String(), \"10.\") {\n\t\t\tprivate = addr.IP.String()\n\t\t}\n\t}\n\treturn private\n}", "title": "" }, { "docid": "eaeb5aff51d5b40d1c0f679d1090e8b1", "score": "0.56145054", "text": "func (a *API) IPAddressForRequest(r *http.Request) string {\n\taddr := r.RemoteAddr\n\tif a.Config.ProxyCount > 0 {\n\t\th := r.Header.Get(\"X-Forwarded-For\")\n\t\tif h != \"\" {\n\t\t\tclients := strings.Split(h, \",\")\n\t\t\tif a.Config.ProxyCount > len(clients) {\n\t\t\t\taddr = clients[0]\n\t\t\t} else {\n\t\t\t\taddr = clients[len(clients)-a.Config.ProxyCount]\n\t\t\t}\n\t\t}\n\t}\n\t//TODO: consider refactoring to use regex instead.\n\tif (strings.Contains(addr, \"[\")) { //If addr is ipv6\n\t\tsep_strings := strings.Split(strings.TrimSpace(addr), \":\") //split string at the colons\n\t\tsep_strings = sep_strings[:len(sep_strings) -1] //remove the last string (the port number)\n\t\treturn strings.Join(sep_strings, \":\") //Join the remaining elements back together into one string with the colons in between.\n\t} //If addr is ipv4\n\treturn strings.Split(strings.TrimSpace(addr), \":\")[0]\n}", "title": "" }, { "docid": "730aff1138e9f489f4834343b7dae611", "score": "0.5612232", "text": "func getListenAddress() string {\n\tport := getEnv(\"PORT\", \"1338\")\n\treturn \":\" + port\n}", "title": "" }, { "docid": "5083fe65147e2277dc9b32b6f0ede3e2", "score": "0.56046796", "text": "func (e *EndpointService) Endpoint(party view.Identity) (map[PortName]string, error) {\n\tres, err := e.es.Endpoint(party)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tout := map[PortName]string{}\n\tfor name, s := range res {\n\t\tout[PortName(name)] = s\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "6aa44cc81a488deb077f25d113c7f2ab", "score": "0.5601367", "text": "func (o *StorageNetAppIpInterface) GetIpAddress() string {\n\tif o == nil || o.IpAddress == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.IpAddress\n}", "title": "" }, { "docid": "b23c3530f5aa736624d769f0f278b492", "score": "0.5594023", "text": "func (qs *Server) Addr() string {\n\treturn qs.listener.Addr().String()\n}", "title": "" }, { "docid": "74526419a14c0a7f7c531198e409dbf9", "score": "0.55873615", "text": "func getListenAddress() string {\n\tport := getEnv(\"PORT\", fallback_port)\n\treturn \":\" + port\n}", "title": "" }, { "docid": "2f22f9197e7388f193b2d66b72a339e2", "score": "0.5586648", "text": "func readWireguardEndpointIP(env params.Interface) (endpointIP net.IP, err error) {\n\ts, err := env.Get(\"WIREGUARD_ENDPOINT_IP\", params.Compulsory())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"environment variable WIREGUARD_ENDPOINT_IP: %w\", err)\n\t}\n\n\tendpointIP = net.ParseIP(s)\n\tif endpointIP == nil {\n\t\treturn nil, fmt.Errorf(\"environment variable WIREGUARD_ENDPOINT_IP: %w: %s\",\n\t\t\tErrInvalidIP, s)\n\t}\n\n\treturn endpointIP, nil\n}", "title": "" }, { "docid": "e3cb53e125b0af9ede0265b02b5a10c8", "score": "0.55829966", "text": "func (ksClient *KeystoneClientImpl) serviceEndpoint(serviceType string, availability gophercloud.Availability) (*url.URL, error) {\n\tserviceID, err := ksClient.serviceID(serviceType)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ksClient.endpointURL(serviceID, availability)\n}", "title": "" }, { "docid": "e4570fa177673038e92632a0a9ad2d0f", "score": "0.55806553", "text": "func (r *Request) Endpoint() string {\n\treturn r.endpoint\n}", "title": "" }, { "docid": "040874c0cf7cdfdf5221a0e54439cfe9", "score": "0.5575414", "text": "func (c Client) Endpoint() string {\n\treturn c.endpoint\n}", "title": "" }, { "docid": "eecfa9e482ee6c453210410fe001f749", "score": "0.5573316", "text": "func (o EndpointResponseOutput) IpAddress() pulumi.StringOutput {\n\treturn o.ApplyT(func(v EndpointResponse) string { return v.IpAddress }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "eecfa9e482ee6c453210410fe001f749", "score": "0.5573316", "text": "func (o EndpointResponseOutput) IpAddress() pulumi.StringOutput {\n\treturn o.ApplyT(func(v EndpointResponse) string { return v.IpAddress }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "636829095d4ddaf5c2478bc54b1ada1f", "score": "0.55693096", "text": "func GetServiceAddress(cmd *cobra.Command) string {\n\taddress, _ := cmd.Flags().GetString(ServiceAddress)\n\treturn address\n}", "title": "" }, { "docid": "05ebf2a6c42b85ada60d70c73280387b", "score": "0.5566461", "text": "func (s *VampAdapter) Addr() string {\n\treturn s.listener.Addr().String()\n}", "title": "" }, { "docid": "276c8a2bc5a00228da522cab17cc5c01", "score": "0.5557452", "text": "func (o InstanceOutput) ServiceEndpoint() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.ServiceEndpoint }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9283524874ef2b95d8e2f4410989515f", "score": "0.5556767", "text": "func (o FastHttpAppVirtualServerOutput) Ip() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FastHttpAppVirtualServer) string { return v.Ip }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c3a91e53180224fe1d537ad7b5704a8a", "score": "0.5555245", "text": "func (s *server) Address() string {\n\treturn config.GetString(\"server.address\")\n}", "title": "" }, { "docid": "ebeed3a42a9000783f8f2c3d48e253c1", "score": "0.55543554", "text": "func GetServiceAddress(service string) (string, error) {\n\tregistry.RLock()\n\tdefer registry.RUnlock()\n\n\tlocation, ok := registry.serviceLocations[service]\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"Service %s not registered\", service)\n\t}\n\tif location.Port == 0 {\n\t\treturn \"\", fmt.Errorf(\"Service %s is not available\", service)\n\t}\n\treturn fmt.Sprintf(\"%s:%d\", location.Host, location.Port), nil\n}", "title": "" }, { "docid": "546c5c88f2daa0dc1425fa40a846bd47", "score": "0.55529463", "text": "func GetMainInfraEndpoint() string {\n\treturn \"\"\n}", "title": "" }, { "docid": "ab12ef45f4b5c900edbdec19f768d5ce", "score": "0.55503744", "text": "func (builder *GatewayBuilder) Endpoint() string {\n\treturn fmt.Sprintf(\"https://%s.execute-api.%s.amazonaws.com/prod/%s\",\n\t\taws.StringValue(builder.APIGateway.Id),\n\t\taws.StringValue(builder.Settings.Region),\n\t\tbuilder.Settings.CleanName())\n}", "title": "" }, { "docid": "08f182ac482a147872cedbc7bb30a20d", "score": "0.5548225", "text": "func ListenAddress() (string, error) {\n\tbaseURL := os.Getenv(\"CAMLI_APP_BACKEND_URL\")\n\tif baseURL == \"\" {\n\t\treturn \"\", errors.New(\"CAMLI_APP_BACKEND_URL is undefined\")\n\t}\n\treturn netutil.HostPort(baseURL)\n}", "title": "" }, { "docid": "069806a1cd037f987bf3863fb3200802", "score": "0.5537909", "text": "func getServiceEndpoint(service string) (url.URL, error) {\n\turl, err := url.Parse(os.Getenv(service))\n\tif err != nil {\n\t\treturn *url, fmt.Errorf(\"Failed to retrieve value from ENVIRONMENT_VARIABLE: %s\", service)\n\t}\n\n\tif url.Scheme == \"\" {\n\t\turl.Scheme = \"http\"\n\t}\n\n\treturn *url, nil\n}", "title": "" }, { "docid": "4dac91d465c5c91051fef211220ede44", "score": "0.55185384", "text": "func (h *Http) Addr() string {\n\treturn h.addrAndPort\n}", "title": "" }, { "docid": "582b9adb376091dd4200c22a06cb6b22", "score": "0.5512467", "text": "func getServerAddress(c *models.Configurations) string {\n\treturn fmt.Sprintf(\"%s:%d\", c.Server.Host, c.Server.Port)\n}", "title": "" }, { "docid": "c77973db3712eb4b589682ec613305c5", "score": "0.5510504", "text": "func (o EndpointPtrOutput) IpAddress() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Endpoint) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.IpAddress\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3309a415e06a25d89ea83966d0ae4e2b", "score": "0.55011386", "text": "func (req *Request) IP() string {\n\tips := req.Proxy()\n\tif len(ips) > 0 && ips[0] != \"\" {\n\t\trip, _, err := net.SplitHostPort(ips[0])\n\t\tif err != nil {\n\t\t\trip = ips[0]\n\t\t}\n\t\treturn rip\n\t}\n\tif ip, _, err := net.SplitHostPort(req.Raw().RemoteAddr); err == nil {\n\t\treturn ip\n\t}\n\treturn req.Raw().RemoteAddr\n}", "title": "" } ]
f0ff327e558c7b3e2ed39c479ece3abf
If server receives a validated cHello, remember caller's address.
[ { "docid": "f1fc1c4bafdf8bff5f90bdfc6c5d66fc", "score": "0.598775", "text": "func (p *PuckFS) callerSet(cmd uint16, caller *net.UDPAddr) {\n\tif p.caller == nil {\n\t\t // If nil, we're a client. And we already know the server's address.\n\t\treturn\n\t}\n\tif cmd != cHello {\n\t\treturn // callerSet is only relevant for first packet of connection from client.\n\t}\n\tif p.caller == &unsetCaller {\n\t\tp.caller = caller\n\t} else if p.caller == caller {\n\t\tlog.Fatal(\"Perhaps our earlier cHello reply to the client was lost? Unable to recover.\")\n\t} else {\n\t\tlog.Printf(\"cHello while still listening for a client that didn't Bye.\")\n\t\tp.Close() // Let's assume the old client crashed and let's try to proceed...\n\t\tp.caller = caller\n\t}\n}", "title": "" } ]
[ { "docid": "cf49ad4b0395535f63828c5f758239c6", "score": "0.58831507", "text": "func clientHelloServerName(br *bufio.Reader) (string, bool, string, error) {\n\thdr, err := br.Peek(1)\n\tif err != nil {\n\t\topErr, ok := err.(*net.OpError)\n\t\tif err != io.EOF && (!ok || !opErr.Timeout()) {\n\t\t\tlog.WithoutContext().Debugf(\"Error while Peeking first byte: %s\", err)\n\t\t}\n\t\treturn \"\", false, \"\", err\n\t}\n\n\t// No valid TLS record has a type of 0x80, however SSLv2 handshakes\n\t// start with a uint16 length where the MSB is set and the first record\n\t// is always < 256 bytes long. Therefore typ == 0x80 strongly suggests\n\t// an SSLv2 client.\n\tconst recordTypeSSLv2 = 0x80\n\tconst recordTypeHandshake = 0x16\n\tif hdr[0] != recordTypeHandshake {\n\t\tif hdr[0] == recordTypeSSLv2 {\n\t\t\t// we consider SSLv2 as TLS and it will be refuse by real TLS handshake.\n\t\t\treturn \"\", true, getPeeked(br), nil\n\t\t}\n\t\treturn \"\", false, getPeeked(br), nil // Not TLS.\n\t}\n\n\tconst recordHeaderLen = 5\n\thdr, err = br.Peek(recordHeaderLen)\n\tif err != nil {\n\t\tlog.Errorf(\"Error while Peeking hello: %s\", err)\n\t\treturn \"\", false, getPeeked(br), nil\n\t}\n\n\trecLen := int(hdr[3])<<8 | int(hdr[4]) // ignoring version in hdr[1:3]\n\thelloBytes, err := br.Peek(recordHeaderLen + recLen)\n\tif err != nil {\n\t\tlog.Errorf(\"Error while Hello: %s\", err)\n\t\treturn \"\", true, getPeeked(br), nil\n\t}\n\n\tsni := \"\"\n\tserver := tls.Server(sniSniffConn{r: bytes.NewReader(helloBytes)}, &tls.Config{\n\t\tGetConfigForClient: func(hello *tls.ClientHelloInfo) (*tls.Config, error) {\n\t\t\tsni = hello.ServerName\n\t\t\treturn nil, nil\n\t\t},\n\t})\n\t_ = server.Handshake()\n\n\treturn sni, true, getPeeked(br), nil\n}", "title": "" }, { "docid": "c86ccd29298dfd3df04d06323b3850e2", "score": "0.58251923", "text": "func (c *smtpClient) hello() error {\n\tif !c.didHello {\n\t\tc.didHello = true\n\t\terr := c.ehlo()\n\t\tif err != nil {\n\t\t\tc.helloError = c.helo()\n\t\t}\n\t}\n\treturn c.helloError\n}", "title": "" }, { "docid": "46f34e4b54d25084b7c386d82783afb2", "score": "0.5790417", "text": "func bindHello(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(HelloABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "7e84aca64a97b72c26cdab9ae119c18b", "score": "0.57673836", "text": "func handleClientHello(h *ClientInHandler) (err error) {\n\tvar (\n\t\tciphertext, ciphertextOut []byte\n\t\tversion1, version2 uint32\n\t\tsOneShot, sSession *xa.AesSession\n\t)\n\trng := xr.MakeSystemRNG()\n\tciphertext, err = h.ReadData()\n\tif err == nil {\n\t\tsOneShot, version1, err = xa.ServerDecryptHello(\n\t\t\tciphertext, h.us.ckPriv, rng)\n\t\t_ = version1 // we don't actually use this\n\t}\n\tif err == nil {\n\t\tversion2 = uint32(serverVersion) // a global !\n\t\tsSession, ciphertextOut, err = xa.ServerEncryptHelloReply(\n\t\t\tsOneShot, version2)\n\t\tif err == nil {\n\t\t\th.AesSession = *sSession\n\t\t\terr = h.WriteData(ciphertextOut)\n\t\t}\n\t\tif err == nil {\n\t\t\th.version = version2\n\t\t\th.State = C_HELLO_RCVD\n\t\t}\n\t}\n\t// On any error silently close the connection.\n\tif err != nil {\n\t\t// DEBUG\n\t\tfmt.Printf(\"handleClientHello closing cnx, error was %s\\n\",\n\t\t\terr.Error())\n\t\t// END\n\t\th.Cnx.Close()\n\t}\n\treturn\n}", "title": "" }, { "docid": "964cfcd49bc49c468a13164c8de894e1", "score": "0.5667142", "text": "func (s *Server) SayHello( ctx context.Context, in *PingMessage ) ( *PingMessage, error ) {\n log.Printf( \"Receive message %s\", in.Greeting )\n return &PingMessage{ Greeting: \"bar\" }, nil\n}", "title": "" }, { "docid": "4c86e0275695391ab77c527dd2c33a9f", "score": "0.56647354", "text": "func (c *client) greetHandler(cmd string, arg string) {\n\tswitch cmd {\n\tcase \"HELO\":\n\t\tdomain, err := parseHelloArgument(arg)\n\t\tif err != nil {\n\t\t\tc.Write(\"501\", \"Domain/address argument required for HELO\")\n\t\t\treturn\n\t\t}\n\t\tc.helo = domain\n\t\tc.Write(\"250\", fmt.Sprintf(\"Hello %s\", domain))\n\t\tc.state = 1\n\tcase \"EHLO\":\n\t\tdomain, err := parseHelloArgument(arg)\n\t\tif err != nil {\n\t\t\tc.Write(\"501\", \"Domain/address argument required for EHLO\")\n\t\t\treturn\n\t\t}\n\n\t\tif c.server.useTLS && !c.tlsOn {\n\t\t\tc.Write(\"250\", \"Hello \"+domain+\"[\"+c.remoteHost+\"]\", \"PIPELINING\", \"8BITMIME\", \"STARTTLS\", \"AUTH EXTERNAL CRAM-MD5 LOGIN PLAIN\", fmt.Sprintf(\"SIZE %v\", c.server.maxMessageBytes))\n\t\t\t//c.Write(\"250\", \"Hello \"+domain+\"[\"+c.remoteHost+\"]\", \"8BITMIME\", fmt.Sprintf(\"SIZE %v\", c.server.maxMessageBytes), \"HELP\")\n\t\t} else {\n\t\t\tc.Write(\"250\", \"Hello \"+domain+\"[\"+c.remoteHost+\"]\", \"PIPELINING\", \"8BITMIME\", \"AUTH EXTERNAL CRAM-MD5 LOGIN PLAIN\", fmt.Sprintf(\"SIZE %v\", c.server.maxMessageBytes))\n\t\t}\n\t\tc.helo = domain\n\t\tc.state = 1\n\tdefault:\n\t\tc.ooSeq(cmd)\n\t}\n}", "title": "" }, { "docid": "f79e2e443ceb37320bacc24f9b62edcb", "score": "0.56193495", "text": "func (s *Server) SayHello(ctx context.Context, in *PingMessage) (*PingMessage, error) {\n log.Printf(\"Receive message %s\", in.Greeting)\n return &PingMessage{Greeting: \"bar\"}, nil\n}", "title": "" }, { "docid": "52e9f1790cffde7e5089167eb48e604b", "score": "0.5562074", "text": "func (c *Client) Hello(ctx context.Context, p *HelloPayload) (res string, err error) {\n\tvar ires interface{}\n\tires, err = c.HelloEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(string), nil\n}", "title": "" }, { "docid": "95075a79c5e8bc29ed9b94d0db1a4dda", "score": "0.55422676", "text": "func (s *NodeServer) Hello(ctx context.Context, req *rpcpb.HelloRequest) (*rpcpb.HelloResponse, error) {\n\tresp := &rpcpb.HelloResponse{}\n\n\tif s.networkID != req.NetworkID {\n\t\treturn resp, status.Error(codes.InvalidArgument, \"incompatible network id.\")\n\t}\n\n\tmd, ok := metadata.FromIncomingContext(ctx)\n\tif !ok {\n\t\treturn resp, status.Error(codes.NotFound, \"retrieve incoming context failed\")\n\t}\n\tif len(md.Get(\"addr\")) == 0 || len(md.Get(\"nodeid\")) == 0 {\n\t\treturn resp, status.Error(codes.NotFound, \"network address or nodeid is missing\")\n\t}\n\n\t// Validate node id of the peer.\n\tk, err := crypto.DecodeKey(md.Get(\"nodeid\")[0])\n\tif err != nil {\n\t\treturn resp, status.Error(codes.InvalidArgument, \"decode nodeid to crypto key failed\")\n\t}\n\tif k.Code != crypto.KeyTypeNodeID {\n\t\treturn resp, status.Error(codes.InvalidArgument, \"invalid nodeid key type\")\n\t}\n\ts.nodeKey.Store(md.Get(\"addr\")[0], k)\n\n\t// Add the peer address.\n\tf := &future.Peer{Addr: md.Get(\"addr\")[0]}\n\tf.Init()\n\ts.peerFuture <- f\n\tif err := f.Error(); err != nil {\n\t\tlog.Errorf(\"add peer to peer manager failed: %v\", err)\n\t}\n\n\tgrpc.SendHeader(ctx, metadata.Pairs(\"addr\", s.addr, \"nodeid\", s.nodeID))\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "65abb94e9b27a6acc41e62502b52637e", "score": "0.55335563", "text": "func Hello(s, lan string) string {\n\tif s == \"\" {\n\t\ts = \"i0Ek3\"\n\t}\n\treturn greeting(lan) + s\n}", "title": "" }, { "docid": "de06348d93f2faab5786b1c46fabb20e", "score": "0.5516413", "text": "func NewHelloCaller(address common.Address, caller bind.ContractCaller) (*HelloCaller, error) {\n\tcontract, err := bindHello(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &HelloCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "bc410c711d3f118c488f11cdf39f426c", "score": "0.5465379", "text": "func Hello(req h2.Request) (proto.Message, h2.Error) {\n\trequest := req.Data().(*protoHello.Request)\n\n\t// Error example\n\tif len(request.GetName()) == 0 {\n\t\t// We specify multi error types in the platform layer repository in the 'errors'\n\t\t// package. See: https://godoc.org/github.com/hailocab/platform-layer/errors\n\t\treturn nil, errors.BadRequest(HelloEndpoint, \"You didn't specify a name in the request\")\n\t}\n\n\t// Return response with the message set to `Hello <name>`\n\treturn &protoHello.Response{\n\t\tMessage: proto.String(fmt.Sprintf(\"Hello %q\", request.GetName())),\n\t}, nil\n}", "title": "" }, { "docid": "d7bb54d5a950d84fafa7f1e9accad037", "score": "0.54412496", "text": "func (c *Client) Hello(host, name string) (int, string, error) {\n\treq, err := http.NewRequest(\"GET\", host+\"/hello\", nil)\n\tif err != nil {\n\t\treturn 0, \"\", errors.Wrap(err, \"failed to create request\")\n\t}\n\tresp, err := c.c.Do(req)\n\tif err != nil {\n\t\treturn resp.StatusCode, \"\", errors.Wrap(err, \"failed to request\")\n\t}\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn resp.StatusCode, \"\", errors.Wrap(err, \"failed to read body\")\n\t}\n\treturn resp.StatusCode, string(body), nil\n}", "title": "" }, { "docid": "88327059e2be7755558bfb46598a274a", "score": "0.5362864", "text": "func (proto *Protocol) HELO(args string) (reply *Reply) {\n\tproto.logf(\"Got HELO command, switching to MAIL state\")\n\tproto.state = MAIL\n\tproto.message.Helo = args\n\treturn ReplyOk(\"Hello \" + args)\n}", "title": "" }, { "docid": "d2fa3fdcf4afded84fa9fd9b231b2e94", "score": "0.535043", "text": "func (p *Ping) Hello(ctx context.Context, name string) (string, error) {\n\treturn \"Hello, \" + name, nil\n}", "title": "" }, { "docid": "27f36226030b2abb8fb8372cc9c0446c", "score": "0.5322862", "text": "func (s *Server) Hello(ctx xcontext.Context, req *pb.HelloRequest) (*pb.HelloResponse, error) {\n\tif s.personers.N() == consts.NumPlayers {\n\t\treturn nil, status.Error(codes.Unavailable, \"Connection limit exceeded\")\n\t}\n\tentry := &connectionEntry{\n\t\tName: req.GetName(),\n\t\tResChan: make(chan game.Personer),\n\t}\n\tdefer close(entry.ResChan)\n\ts.connectionQueue <- entry\n\tplayer := <-entry.ResChan\n\tres := &pb.HelloResponse{\n\t\tId: int32(player.GetID()),\n\t\tUuid: player.GetUUID().String(),\n\t\tName: player.GetName(),\n\t\tKind: player.GetKind(),\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "baa07aaba484fb59bf15c7ecab0dcedc", "score": "0.5301273", "text": "func Hello(c *net.Conn) error {\n\n\tfile, err := os.Open(\"./static/pinguin.txt\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tinfo, err := file.Stat()\n\tif err != nil {\n\t\treturn err\n\t}\n\tsize := info.Size()\n\tbuffer := make([]byte, size)\n\tif _, err := file.Read(buffer); err != nil {\n\t\treturn err\n\t}\n\n\terr = file.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := (*c).Write([]byte(\"Welcome to TCP-Chat!\\n\")); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := (*c).Write(buffer); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := (*c).Write([]byte(\"\\n[ENTER YOUR NAME]: \")); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "079ca023a3438f756b939527a26b7dff", "score": "0.52894586", "text": "func (client *Client) hello() error {\n\tvar hello proto.PacketHello\n\terr := client.send(proto.PacketKindHello, proto.PacketHello{\n\t\tMajor: ProtocolMajorVersion,\n\t\tMinor: ProtocolMinorVersion,\n\t\tBuild: client.version,\n\t\tStartID: client.startID,\n\t\tAccountID: client.AccountID,\n\t\tClusterID: client.ClusterID,\n\t\tPacketV2Enabled: true,\n\t\tServerVersion: client.ServerVersion,\n\t\tAgentPermissions: client.AgentPermissions,\n\t\tClusterProvider: client.ClusterProvider,\n\t}, &hello)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogger.Infow(\"hello phase has been finished\",\n\t\t\"client/protocol/major\", ProtocolMajorVersion,\n\t\t\"client/protocol/minor\", ProtocolMinorVersion,\n\t\t\"server/protocol/major\", hello.Major,\n\t\t\"server/protocol/minor\", hello.Minor,\n\t)\n\n\treturn nil\n}", "title": "" }, { "docid": "23c587c726d7d83d1b97fb6504d5e511", "score": "0.52328944", "text": "func (r *Router) Hello() {\n\tl.DEBUG(\"received a HELLO for %s\", r.ip.String())\n\tr.Lock()\n\tif r.up {\n\t\t// just reset the timer\n\t\tr.timer.Reset(r.dead)\n\t\tr.Unlock()\n\t} else {\n\t\t// bring interface up\n\t\tl.INFO(\"router returned to service %s\", r.ip.String())\n\t\tr.Unlock()\n\t\tr.Up()\n\t}\n}", "title": "" }, { "docid": "323783609efd102321dd3612790b222c", "score": "0.5223453", "text": "func (_Hello *HelloRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Hello.Contract.HelloCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "f81f9cae6e9f80bed27258f6958ef3c3", "score": "0.5148477", "text": "func (server *GreeterServer) SayHello(ctx context.Context, request *proto.HelloRequest) (*proto.HelloResponse, error) {\n\treturn &proto.HelloResponse{\n\t\tMessage: fmt.Sprintf(\"Hello %s!\", request.GetName()),\n\t}, nil\n}", "title": "" }, { "docid": "ed922e22f013b6c963165ad184e7a5e9", "score": "0.51193476", "text": "func (proto *Protocol) EHLO(args string) (reply *Reply) {\n\tproto.logf(\"Got EHLO command, switching to MAIL state\")\n\tproto.state = MAIL\n\tproto.message.Helo = args\n\treturn ReplyOk(\"Hello \"+args, \"PIPELINING\", \"AUTH EXTERNAL CRAM-MD5 LOGIN PLAIN\")\n}", "title": "" }, { "docid": "c00c9e7d8710f6e4c2c62c00bf870fe5", "score": "0.5117943", "text": "func hostResponse(ptr uintptr)", "title": "" }, { "docid": "34d7e00f31f85edb8707501890812f11", "score": "0.51008755", "text": "func (r *Resolver) Hello() string {\n\treturn \"world\"\n}", "title": "" }, { "docid": "d0360f1cf0770f0beca069bdf49f1bb2", "score": "0.5080192", "text": "func Hello() string {\n\treturn \"clientlib hello\"\n}", "title": "" }, { "docid": "1306872d27160159162517a60d43a24f", "score": "0.5070543", "text": "func helloFromClient(c *Client, data interface{}) {\n\tlog.Printf(\"hello from client! message: %v\\n\", data)\n\n\t// set and write response message\n\tc.send = Message{Name: \"helloFromServer\", Data: \"hello client!\"}\n\tc.Write()\n}", "title": "" }, { "docid": "08239106be81a2a4711483e0616cbf59", "score": "0.50517154", "text": "func ServeHello(resp http.ResponseWriter, req *http.Request) {\n\tfmt.Println(req.Body, \" \\n###\\n \", req.Header, \" \\n###\\n \", req.Method, \" \\n###\\n \", req.Host, \" \\n###\\n \", req.RemoteAddr)\n\tfmt.Fprint(resp, \"Hi man!\")\n}", "title": "" }, { "docid": "49921f95ce1f460cc71cb8cfd79eb0c9", "score": "0.5022865", "text": "func server_response(local_conn net.Conn, remote_address string) {\n\tload_balancer := get_load_balancer()\n\tlocal_tcpaddr, _ := net.ResolveTCPAddr(\"tcp4\", load_balancer.address)\n\n\tdialer := net.Dialer{\n\t\tLocalAddr: local_tcpaddr,\n\t\tControl: func(network, address string, c syscall.RawConn) error {\n\t\t\treturn c.Control(func(fd uintptr) {\n\t\t\t\t// NOTE: Run with root or use setcap to allow interface binding\n\t\t\t\t// sudo setcap cap_net_raw=eip ./go-dispatch-proxy\n\t\t\t\tif err := syscall.BindToDevice(int(fd), load_balancer.iface); err != nil {\n\t\t\t\t\tlog.Println(\"[WARN] Couldn't bind to interface\", load_balancer.iface)\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t}\n\n\tremote_conn, err := dialer.Dial(\"tcp4\", remote_address)\n\tif err != nil {\n\t\tlog.Println(\"[WARN]\", remote_address, \"->\", load_balancer.address, fmt.Sprintf(\"{%s}\", err))\n\t\tlocal_conn.Write([]byte{5, NETWORK_UNREACHABLE, 0, 1, 0, 0, 0, 0, 0, 0})\n\t\tlocal_conn.Close()\n\t\treturn\n\t}\n\n\tlog.Println(\"[DEBUG]\", remote_address, \"->\", load_balancer.address)\n\tlocal_conn.Write([]byte{5, SUCCESS, 0, 1, 0, 0, 0, 0, 0, 0})\n\tpipe_connections(local_conn, remote_conn)\n}", "title": "" }, { "docid": "12867a81800cf142e3e2061060e69e2e", "score": "0.5022603", "text": "func readServerHello(r io.Reader, clientRandom [32]byte, secret []byte) error {\n\tpacketBuf := bytes.NewBuffer(nil)\n\tr = io.TeeReader(r, packetBuf)\n\n\thandshake, err := readRecord(r)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"handshake record\")\n\t}\n\tif handshake.Type != RecordTypeHandshake {\n\t\treturn errors.Wrap(err, \"unexpected record type\")\n\t}\n\n\tchangeCipher, err := readRecord(r)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"change cipher record\")\n\t}\n\tif changeCipher.Type != RecordTypeChangeCipherSpec {\n\t\treturn errors.Wrap(err, \"unexpected record type\")\n\t}\n\n\tcert, err := readRecord(r)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cert record\")\n\t}\n\tif cert.Type != RecordTypeApplication {\n\t\treturn errors.Wrap(err, \"unexpected record type\")\n\t}\n\n\t// `$record_header = type 1 byte + version 2 bytes + payload_length 2 bytes = 5 bytes`\n\t// `$server_hello_header = type 1 bytes + version 2 bytes + length 3 bytes = 6 bytes`\n\t// `$offset = $record_header + $server_hello_header = 11 bytes`\n\tconst serverRandomOffset = 11\n\tpacket := packetBuf.Bytes()\n\t// Copy original digest.\n\tvar originalDigest [32]byte\n\tcopy(originalDigest[:], packet[serverRandomOffset:serverRandomOffset+32])\n\t// Fill original digest by zeros.\n\tvar zeros [32]byte\n\tcopy(packet[serverRandomOffset:serverRandomOffset+32], zeros[:])\n\n\tmac := hmac.New(sha256.New, secret)\n\tif _, err := mac.Write(clientRandom[:]); err != nil {\n\t\treturn errors.Wrap(err, \"hmac write\")\n\t}\n\tif _, err := mac.Write(packet); err != nil {\n\t\treturn errors.Wrap(err, \"hmac write\")\n\t}\n\tif !bytes.Equal(mac.Sum(nil), originalDigest[:]) {\n\t\treturn errors.New(\"hmac digest mismatch\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "692fb831b7d52f54bee88d200b50fd41", "score": "0.4992859", "text": "func (channel *Channel) onFriendRequest(_ *gotox.Tox, publicKey []byte, message string) {\n\tif channel.callbacks != nil {\n\t\t// strip key of NOSPAM - this is the only instance where it is passed here\n\t\tif len(publicKey) > 32 {\n\t\t\tpublicKey = publicKey[:32]\n\t\t}\n\t\t// all real callbacks are run in separate go routines to keep ToxCore none blocking!\n\t\tgo channel.callbacks.OnFriendRequest(hex.EncodeToString(publicKey), message)\n\t} else {\n\t\tlog.Println(tag, \"No callback for OnNewConnection registered!\")\n\t}\n}", "title": "" }, { "docid": "d0087a7f62d450627a1e5933fec6622e", "score": "0.49740782", "text": "func (h greeter) helloWorld(c *command.Command) *command.Response {\n\tif h.greetingPermitted(c.Username) {\n\t\th.logGreeted(c.Username)\n\n\t\twho := \"world\"\n\n\t\t// c.Argument (string) and c.Arguments ([]string{}) can be used to\n\t\t// determine the output of your command\n\t\tif c.Argument != \"\" {\n\t\t\twho = c.Argument\n\t\t}\n\n\t\treturn &command.Response{\n\t\t\tMessage: \"Hello, \" + who,\n\t\t}\n\t}\n\n\treturn &command.Response{\n\t\tMessage: \"You were greeted recently!\",\n\t}\n}", "title": "" }, { "docid": "9fb965ccc227b0e210e7d8d19131758e", "score": "0.49530777", "text": "func Hello(name string) (string, error) {\n\tif name == \"\" {\n\t\treturn \"\", errors.New(\"empty name\")\n\t}\n\n\tmessage := fmt.Sprintf(\"Hello %v\", name)\n\treturn message, nil\n}", "title": "" }, { "docid": "6c3972348f1b5e6dd5620f769642b3b7", "score": "0.494797", "text": "func SendLeaderMessage(conn net.Conn,ports string) {\r\n\r\n\tmessage :=\"Leader:8002\"\r\n\tconn.Write([]byte(message + \"\\n\"))\r\n\tfmt.Println(\"Leader Update Message Sent to\",ports)\r\n\tmessage,_=bufio.NewReader(conn).ReadString('\\n')\r\n if strings.Contains(message,\"Ack Leader\") {\r\n fmt.Println(\"Successfully updated Leader information by\",ports)\r\n } else {\r\n fmt.Println(\"Not Received Leader Ack from\",ports)\r\n } \r\n}", "title": "" }, { "docid": "4840f5f571d3224b9c8f17798eeb5815", "score": "0.49229264", "text": "func Hello(name string) (string, error){\n\t// Se nenhum nome foi fornecido, retorna um erro com uma mensagem.\n\tif name == \"\" {\n\t\treturn \"\", errors.New(\"empty name\")\n\t}\n\n\t// Se um nome foi recebido, retorna um valor que incorpora o nome\n\t// em uma mensagem de saudação.\n\tmessage := fmt.Sprintf(\"Hi, %v. Welcome!\", name)\n\treturn message, nil\n}", "title": "" }, { "docid": "8e310135b3c5250ef92fadb8de4c99f9", "score": "0.4904016", "text": "func (c *TrainingDataService) Hello(ctx context.Context, in *tds.Empty) (*tds.HelloResponse, error) {\n\tlogr := logger.LocLogger(logger.LogServiceBasic(LogkeyTrainingDataService))\n\tlogr.Debugf(\"function entry\")\n\tlogr.Debugf(\"Hello!\")\n\tout := new(tds.HelloResponse)\n\tout.Msg = \"Hello from ffdl-trainingdata-service!\"\n\tlogr.Debugf(\"function exit\")\n\treturn out, nil\n}", "title": "" }, { "docid": "9e4954dba22e5e9e53067c4b650ac379", "score": "0.49036303", "text": "func hostcall___(msg uint32)", "title": "" }, { "docid": "a12812a0bb45cb1e78b7d953c3512ea9", "score": "0.4903402", "text": "func NewHello(address common.Address, backend bind.ContractBackend) (*Hello, error) {\n\tcontract, err := bindHello(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Hello{HelloCaller: HelloCaller{contract: contract}, HelloTransactor: HelloTransactor{contract: contract}, HelloFilterer: HelloFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "998bb7298112a4aebdbda8223fb0f522", "score": "0.48820326", "text": "func _cgoexp_0807ce82f2a9_hello(a unsafe.Pointer, n int32, ctxt uintptr) {\n\tfn := _cgoexpwrap_0807ce82f2a9_hello\n\t_cgo_runtime_cgocallback(**(**unsafe.Pointer)(unsafe.Pointer(&fn)), a, uintptr(n), ctxt);\n}", "title": "" }, { "docid": "6a8d8890e86dd0738b5ee91324de0dcb", "score": "0.48767927", "text": "func (client *Client) hello() error {\n\tvar hello proto.PacketHello\n\terr := client.send(proto.PacketKindHello, proto.PacketHello{\n\t\tMajor: ProtocolMajorVersion,\n\t\tMinor: ProtocolMinorVersion,\n\t\tBuild: client.version,\n\t\tStartID: client.startID,\n\t\tAccountID: client.AccountID,\n\t\tClusterID: client.ClusterID,\n\t}, &hello)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclient.Infof(\n\t\tkarma.\n\t\t\tDescribe(\"client/protocol/major\", ProtocolMajorVersion).\n\t\t\tDescribe(\"client/protocol/minor\", ProtocolMinorVersion).\n\t\t\tDescribe(\"server/protocol/major\", hello.Major).\n\t\t\tDescribe(\"server/protocol/minor\", hello.Minor),\n\t\t\"hello phase has been finished\",\n\t)\n\n\treturn nil\n}", "title": "" }, { "docid": "5fa8d5985414bac87277ceab51f0cfdf", "score": "0.48759675", "text": "func sayHello(p *ezmesh.Peer) {\n\thn, err := os.Hostname()\n\tif nil != err {\n\t\thn = fmt.Sprintf(\"Hostname:%v\", err)\n\t}\n\tmsg := fmt.Sprintf(\n\t\t\"%v %v/%v %v\",\n\t\thn,\n\t\truntime.GOOS,\n\t\truntime.GOARCH,\n\t\ttime.Since(startTime),\n\t)\n\tp.Broadcast([]byte(msg))\n}", "title": "" }, { "docid": "0ac6145b9c35ec67c541fb904d72579e", "score": "0.48758927", "text": "func (master *Master) requestInfo_whandle(connId int32, msg define.MessageBuffer) {\n\tutils.LogI(\"requestInfo_whandle run\")\n\trspMsg := protocol.SimpleMessageBuffer{}\n\trspMsg.Init(define.Rsp)\n\trspMsg.WriteI32(int32(define.RequestInfoRsp))\n\trspMsg.WriteI32(int32(len(master.connector.ConnectedConns)))\n\tfor otherConnId := range master.connector.ConnectedConns {\n\t\trspMsg.WriteI32(otherConnId)\n\t\tport := master.connector.OtherInfos[otherConnId].ListenPort\n\t\trspMsg.WriteI32(int32(port))\n\t}\n\tconn := master.connector.ConnectedConns[connId]\n\trspMsg.Write(conn)\n}", "title": "" }, { "docid": "a71aafd67d0d24fcfbe612d8b02cbbb9", "score": "0.48720405", "text": "func handle(conn *SocketConnection) {\n\tDebug(\"New incomming connection: %v\", conn.RemoteAddr())\n\tif err := conn.Connect(); err != nil {\n\t\tError(\"Got error while accepting connection: %s\", err)\n\t\treturn\n\t}\n\tanswer, err := conn.ExecuteAnswer(\"\", false)\n\tif err != nil {\n\t\tError(\"Got error while executing answer: %s\", err)\n\t\treturn\n\t}\n\tDebug(\"Answer Message: %s\", answer)\n\tDebug(\"Caller UUID: %s\", answer.GetHeader(\"Caller-Unique-Id\"))\n\n\tcUUID := answer.GetCallUUID()\n\n\tif te, err := conn.ExecuteSet(\"tts_engine\", \"flite\", false); err != nil {\n\t\tError(\"Got error while attempting to set tts_engine: %s\", err)\n\t} else {\n\t\tDebug(\"TTS Engine Msg: %s\", te)\n\t}\n\n\tif tv, err := conn.ExecuteSet(\"tts_voice\", \"slt\", false); err != nil {\n\t\tError(\"Got error while attempting to set tts_voice: %s\", err)\n\t} else {\n\t\tDebug(\"TTS Voice Msg: %s\", tv)\n\t}\n\n\tif sm, err := conn.Execute(\"speak\", goeslMessage, true); err != nil {\n\t\tError(\"Got error while executing speak: %s\", err)\n\t\treturn\n\t} else {\n\t\tDebug(\"Speak Message: %s\", sm)\n\t}\n\n\tif hm, err := conn.ExecuteHangup(cUUID, \"\", false); err != nil {\n\t\tError(\"Got error while executing hangup: %s\", err)\n\t\treturn\n\t} else {\n\t\tDebug(\"Hangup Message: %s\", hm)\n\t}\n\n\tfor {\n\t\tmsg, err := conn.ReadMessage()\n\t\tif err != nil {\n\t\t\t// If it contains EOF, we really dont care...\n\t\t\tif !strings.Contains(err.Error(), \"EOF\") {\n\t\t\t\tError(\"Error while reading Freeswitch message: %s\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tDebug(\"%s\", msg)\n\t}\n}", "title": "" }, { "docid": "9b4039c15f0efaf4241104b234d8f51c", "score": "0.487113", "text": "func (*server) Greet(ctx context.Context, req *greetpb.GreetRequest) (*greetpb.GreetResponse, error) {\n\tfmt.Printf(\"Greet Request received in server %v\", req)\n\tfullName := req.Greeting.GetFirstName() + \" \" + req.Greeting.GetLastName()\n\tresult := \"Hello \" + fullName\n\tres := &greetpb.GreetResponse{\n\t\tResult: result,\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "71d13ad3991f465ed9ef0cd609a6ab1a", "score": "0.48675805", "text": "func sayHello(c fb.GreeterClient) {\n\tlogPrefix := \"client::sayHello\"\n\n\tb := flatbuffers.NewBuilder(0)\n\tn := b.CreateString(name)\n\tfb.HelloRequestStart(b)\n\tfb.HelloRequestAddName(b, n)\n\tb.Finish(fb.HelloRequestEnd(b))\n\n\tr, err := c.SayHello(context.Background(), b)\n\tif err != nil {\n\t\tlog.Fatalf(\"%s failed to say hello: %v\\n\", logPrefix, err)\n\t}\n\tlog.Printf(\"%s %s\\n\", logPrefix, string(r.Message()))\n}", "title": "" }, { "docid": "6a1e2188a827512eeeaa96394f5e5a02", "score": "0.48647535", "text": "func (r *RPC) SayHello(args int, reply *string) error {\n\tlog.Println(\"In rpc call\")\n\t*reply = \"Hello there!\"\n\treturn nil\n}", "title": "" }, { "docid": "e16e71cca4a76a55b455725063d1be37", "score": "0.48643133", "text": "func (hs *clientHandshakeStateTLS13) processHelloRetryRequest() error {\n\tc := hs.c\n\n\tif hs.serverHello.serverShare.group != 0 {\n\t\tc.sendAlert(alertDecodeError)\n\t\treturn errors.New(\"tls: received malformed key_share extension\")\n\t}\n\n\tcurveID := hs.serverHello.selectedGroup\n\tif curveID == 0 {\n\t\tc.sendAlert(alertMissingExtension)\n\t\treturn errors.New(\"tls: received HelloRetryRequest without selected group\")\n\t}\n\tcurveOK := false\n\tfor _, id := range hs.hello.supportedCurves {\n\t\tif id == curveID {\n\t\t\tcurveOK = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !curveOK {\n\t\tc.sendAlert(alertIllegalParameter)\n\t\treturn errors.New(\"tls: server selected unsupported group\")\n\t}\n\tif hs.ecdheParams.CurveID() == curveID {\n\t\tc.sendAlert(alertIllegalParameter)\n\t\treturn errors.New(\"tls: server sent an unnecessary HelloRetryRequest message\")\n\t}\n\tif _, ok := curveForCurveID(curveID); curveID != X25519 && !ok {\n\t\tc.sendAlert(alertInternalError)\n\t\treturn errors.New(\"tls: CurvePreferences includes unsupported curve\")\n\t}\n\tparams, err := generateECDHEParameters(c.config.rand(), curveID)\n\tif err != nil {\n\t\tc.sendAlert(alertInternalError)\n\t\treturn err\n\t}\n\ths.ecdheParams = params\n\ths.hello.keyShares = []keyShare{{group: curveID, data: params.PublicKey()}}\n\n\ths.hello.cookie = hs.serverHello.cookie\n\n\ths.hello.raw = nil\n\tif _, err := c.writeRecord(recordTypeHandshake, hs.hello.marshal()); err != nil {\n\t\treturn err\n\t}\n\n\tmsg, err := c.readHandshake()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserverHello, ok := msg.(*serverHelloMsg)\n\tif !ok {\n\t\tc.sendAlert(alertUnexpectedMessage)\n\t\treturn unexpectedMessageError(serverHello, msg)\n\t}\n\ths.serverHello = serverHello\n\n\tif err := hs.checkServerHelloOrHRR(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "94c01702453ad1fcc01c6205721e83f7", "score": "0.48566446", "text": "func (r *Resolver) Hello() string {\n\treturn \"Hello world!\"\n}", "title": "" }, { "docid": "3a114ee3dbc5435aac0fb9ed8add488f", "score": "0.48493508", "text": "func (network *Network) handleListen(rw http.ResponseWriter, req *http.Request) {\n\tdecoder := json.NewDecoder(req.Body)\n\tvar m msg\n\terr := decoder.Decode(&m)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tvar mes string\n\tvar cl []Contact = nil\n\tvar d []byte = nil\n\t// depending on what message we got we run different\n\tswitch m.Message {\n\tcase \"ping\":\n\t\t// ping handle\n\t\tmes = \"Response from ping\"\n\tcase \"findcontact\":\n\t\t// find contact handle\n\t\tmes = \"Response from findcontact\"\n\t\tcl = network.rt.FindClosestContacts(m.Target.ID, k)\n\tcase \"finddata\":\n\t\t// find data handle\n\t\t// If a corresponding value is present on the recipient, the associated data is returned\n\t\td = network.ht.Get(m.Hash)\n\t\tif d == nil {\n\t\t\t// Otherwise the RPC is equivalent to a FIND_NODE and a set of k triples is returned\n\t\t\tcl = network.rt.FindClosestContacts(m.Target.ID, k)\n\t\t}\n\t\tmes = \"Response from finddata\"\n\tcase \"store\":\n\t\t// store handle\n\t\tnetwork.ht.Put(m.Hash, m.Data)\n\t\tmes = \"Response from store\"\n\tdefault:\n\t\t//log.Println(\"server received an invalid message\")\n\t\tmes = \"Response invalid message\"\n\t}\n\n\trm := response_msg{\n\t\tMessage: mes,\n\t\tContactList: cl,\n\t\tData: d,\n\t\tResponder: *network.rt.me,\n\t}\n\n\tr, err := json.Marshal(rm)\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n\t// adds RPC sender to list\n\tgo network.NetAddCont(m.Sender)\n\n\tfmt.Fprintf(rw, string(r))\n}", "title": "" }, { "docid": "bf32293f7cf34cfda23bf55535bc855e", "score": "0.4845969", "text": "func HandleAddr(request []byte) {\n\tvar payload Addr\n\tdecodeData(request, &payload)\n\t// add the payloads address list to the known knowns\n\tKnownNodes = append(KnownNodes, payload.AddrList...)\n\tfmt.Printf(\"there are %d known nodes\\n\", len(KnownNodes))\n\tRequestBlocks()\n}", "title": "" }, { "docid": "b5041f614b1ef34b6d6a89d6b22d10e5", "score": "0.48434618", "text": "func SayHello(client pb.GreeterClient) {\n\tvar request pb.HelloRequest\n\tr := rand.Intn(parallel)\n\trequest.Name = fmt.Sprintf(\"%d%s\", int32(r), \":Name\")\n\n\tresponse, _ := client.SayHello(context.Background(), &request) //调用远程方法\n\n\t//判断返回结果是否正确\n\tif id, _ := strconv.Atoi(strings.Split(response.Message, \":\")[0]); id != r {\n\t\tlog.Printf(\"response error %#v\", response)\n\t}\n\n}", "title": "" }, { "docid": "829b8d169cb0303a0e37c5bc74cd818c", "score": "0.48310226", "text": "func Hello(name string) (string, error) {\n\t// If no name was provided, return an error.\n\tif name == \"\" {\n\t\treturn \"\", errors.New(\"empty name\")\n\t}\n\t// Return a greeting that embeds the name in a message.\n\tmessage := fmt.Sprintf(randomFormat(), name)\n\treturn message, nil\n}", "title": "" }, { "docid": "99e72f9d09c07e0f8eb227b8892a5b50", "score": "0.48307657", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t//, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1534\")\n\tsockname := masterSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n fmt.Println(err)\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n fmt.Println(\"Error in call function for server\",err)\n\treturn false\n}", "title": "" }, { "docid": "dbe347a261227d929459401535395676", "score": "0.48232186", "text": "func Hello(name string) (string, error) {\n\t// return error if name is empty\n\tif name == \"\" {\n\t\treturn \"\", errors.New(\"empty name\")\n\t}\n\n\t// return greeting\n\tformat := randomFormat()\n\tmessage := fmt.Sprintf(format, name)\n\treturn message, nil\n}", "title": "" }, { "docid": "eaf7c27b4e4900eab9373340f4f18f40", "score": "0.4818953", "text": "func Hello(name string, language string) string {\n\tif name == \"\" {\n\t\tname = \"wsq\"\n\t}\n\n\treturn greetingprefix(language) + \",\" + name\n}", "title": "" }, { "docid": "98be832e058b10d99fdf3df5d274e580", "score": "0.4815382", "text": "func (_Hello *HelloCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Hello.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "a7bd7c9a0cbe2eeee8f0d868ca18fdd0", "score": "0.48107952", "text": "func (bot *Bot) helloHandler(_ *Bot, _ slack.RTMEvent) error {\n\tbot.Log.Info(\"handling hello event\")\n\tbot.infoLock.Lock()\n\tinfo := bot.RTM.GetInfo()\n\tfor i, user := range info.Users {\n\t\t// use &info.Users[i] because &user is a pointer to a local variable!\n\t\tbot.userByName[user.Name] = &info.Users[i]\n\t\tbot.userByID[user.ID] = &info.Users[i]\n\t}\n\n\tfor _, channel := range info.Channels {\n\t\tbot.channelByName[channel.Name] = channel.ID\n\t\tbot.channelByID[channel.ID] = channel.Name\n\t}\n\n\tbot.Team = info.Team\n\tbot.User = info.User\n\tbot.infoLock.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "24d3a4d4f39e900b2c5b072012d3c259", "score": "0.48064765", "text": "func (s *Server) SayHola(ctx context.Context, message *Message) (*Message, error) {\n\tlog.Printf(\"Received message body from client: %s\", message.Body)\n\trespuesta := Message{\n\t\tBody: \"iniciando\",\n\t}\n\treturn &respuesta, nil\n}", "title": "" }, { "docid": "e73b0d23ca6255008e0b9f07ce0b302a", "score": "0.48009297", "text": "func main() {\n\tclient, err := DialHelloService(\"tcp\", \"localhost:12346\")\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\n\tvar reply String\n\terr = client.Hello(String{Value:\"Hello\"}, &reply)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Println(reply.Value)\n}", "title": "" }, { "docid": "a4279455e376bd395be4305fd6c670be", "score": "0.4799904", "text": "func TestValidityOfHelloCommand(t *testing.T) {\n\tcases := []struct {\n\t\tline string\n\t\tvalid bool\n\t\terr error\n\t}{\n\t\t// EHLO & HELO should only have one argument\n\t\t{\"EHLO mail.domain.com\\r\\n\", true, nil},\n\t\t{\"EHLO mail.domain.com \\r\\n\", true, nil},\n\t\t{\"EHLO\\r\\n\", false, invalidCommandArgErr},\n\t\t{\"EHLO \\r\\n\", false, invalidCommandArgErr},\n\t\t{\"EHLO mail.domain.com test\\r\\n\", false, invalidCommandArgErr},\n\t\t{\"EHLO mail.domain.com test 1 2 3\\r\\n\", false, invalidCommandArgErr},\n\n\t\t{\"HELO mail.domain.com\\r\\n\", true, nil},\n\t\t{\"HELO mail.domain.com \\r\\n\", true, nil},\n\t\t{\"HELO\\r\\n\", false, invalidCommandArgErr},\n\t\t{\"HELO \\r\\n\", false, invalidCommandArgErr},\n\t\t{\"HELO mail.domain.com test\\r\\n\", false, invalidCommandArgErr},\n\t\t{\"HELO mail.domain.com test 1 2 3\\r\\n\", false, invalidCommandArgErr},\n\t}\n\n\tfor _, input := range cases {\n\t\tgot, err := command(input.line).ValidHello()\n\t\tif got != input.valid {\n\t\t\tt.Errorf(\"%q.Valid() == %t, expected %t\", input.line, got, input.valid)\n\t\t}\n\n\t\tif (err == nil && input.err != nil) || (err != nil && input.err == nil) {\n\t\t\tt.Errorf(\"from: %q => got: %v, expected: %v\", input.line, err, input.err)\n\t\t}\n\t\tif err != nil && input.err != nil {\n\t\t\tif err.Error() != input.err.Error() {\n\t\t\t\tt.Errorf(\"from: %q => got: %v, expected: %v\", input.line, err, input.err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "de0ba67532610f0f424a81472ce04d70", "score": "0.47981724", "text": "func (c *Client) Goodbye(host, name string) (int, string, error) {\n\treturn 0, \"\", nil\n}", "title": "" }, { "docid": "acf27ceb97630970ca5e0a1b70f47087", "score": "0.47949597", "text": "func (s *Server) SayHello(ctx context.Context, in *PingRequest) (*PingResponse, error) {\n\tlog.Printf(\"Received Celsius Temperature of %f\", in.TemperatureCelsius)\n\treturn &PingResponse{TemperatureFahrenheit: CToF(in.TemperatureCelsius)}, nil\n}", "title": "" }, { "docid": "24aebf999e09b54477089168b62ac9f6", "score": "0.47922117", "text": "func (*GreeterService) SayHello(ctx context.Context, request *helloworld.HelloRequest) (*helloworld.HelloReply, error) {\n\tif request.Name == \"\" {\n\t\treturn nil, errors.New(\"not filled name in the request\")\n\t}\n\n\treturn &helloworld.HelloReply{Message: \"hello \" + request.Name}, nil\n}", "title": "" }, { "docid": "7315125f2989136d14ef32c4b18dceec", "score": "0.47808647", "text": "func _cgoexp_0807ce82f2a9_helloP(a unsafe.Pointer, n int32, ctxt uintptr) {\n\tfn := _cgoexpwrap_0807ce82f2a9_helloP\n\t_cgo_runtime_cgocallback(**(**unsafe.Pointer)(unsafe.Pointer(&fn)), a, uintptr(n), ctxt);\n}", "title": "" }, { "docid": "1d8b45ed9fd077f8b68c66e555d36ac1", "score": "0.47742188", "text": "func (*server) Greet(ctx context.Context, req *greetpb.GreetRequest) (*greetpb.GreetResponse, error) {\n\tfmt.Printf(\"Greet function was invoked with %v\", req)\n\t//use req object to get information out of request\n\tfirstname := req.GetGreeting().GetFirstName()\n\tresult := \"Hello \" + firstname\n\t//GreetResponse takes a string as the result\n\tres := &greetpb.GreetResponse{\n\t\tResult: result,\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "3e4bb47eb275ef3d0f8fd7d3957ae844", "score": "0.47720057", "text": "func HTTPSValidateHello(br *bufio.Reader) ([]byte, error) {\n\tbuff, err := br.Peek(sslHeaderLen)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// check ssl parameters\n\tif len(buff) == 0 {\n\t\treturn nil, errors.New(errNoContent)\n\t}\n\tif buff[0] != sslTypeHandshake {\n\t\treturn nil, errors.New(errNotTLS)\n\t}\n\trecLen := int(buff[3])<<8 | int(buff[4]) // ignoring version in hdr[1:3]\n\treturn br.Peek(sslHeaderLen + recLen)\n}", "title": "" }, { "docid": "def23e3b7201d763992ce4d35759f997", "score": "0.47678995", "text": "func Hello(name string) (string, error) {\n\tif name == \"\" {\n\t\treturn \"\", errors.New(\"empty name\")\n\t}\n\n\tvar message string\n\tmessage = fmt.Sprintf(\"Hi, %v. Welcome!\", name)\n\n\t// or, message := fmt.Sprintf(\"Hi, %v. Welcome!\", name)\n\n\treturn message, nil\n}", "title": "" }, { "docid": "dfab12e7d8717d369e0cd4a31adfc3a7", "score": "0.47670388", "text": "func call(sockname string, rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Printf(\"calling:%s::%s() error: %s\\n\", sockname, rpcname, err)\n\treturn false\n}", "title": "" }, { "docid": "f9f5f97c9cdab9f2ccb9d580cc453f4d", "score": "0.47626686", "text": "func Hello(language, name string) string {\n\tif name == \"\" {\n\t\tname = \"world\"\n\t}\n\treturn getHelloPrefix(language) + name\n}", "title": "" }, { "docid": "bf671cd2e0f63ceb5865bd48584d89d9", "score": "0.4760341", "text": "func (s *GreeterImpl) SayHello(ctx context.Context, args *HelloRequest, reply *HelloReply) (err error) {\n\t// TODO: add business logics\n\n\t// TODO: setting return values\n\t*reply = HelloReply{}\n\n\treturn nil\n}", "title": "" }, { "docid": "5f7e239d00d7e830dade0aec5b930724", "score": "0.47582984", "text": "func Hello(name string) string {\n\tif name == \"\" {\n\t\tname = \"World\"\n\t}\n\treturn englishHelloPrefix + name + exclamation\n}", "title": "" }, { "docid": "29402b1f027e9fc7f6ae4efb91ced6ba", "score": "0.47578266", "text": "func (s *HelloWorldServer) SayHello(ctx context.Context, req *pb.SayHelloRequest) (*pb.HelloReply, error) {\n\treturn &pb.HelloReply{Message: \"Hello, \" + req.Name}, nil\n}", "title": "" }, { "docid": "bfb1a3c20bcffeba96cc22b3ef3e5d32", "score": "0.47574073", "text": "func (cPtr *Contract) Called() bgmcommon.Address {\n\treturn cPtr.CalledAddress\n}", "title": "" }, { "docid": "4a04c4c78ae6fbbcce8a010a036a4bd2", "score": "0.47568497", "text": "func (_Tokenhub *TokenhubCaller) LIGHTCLIENTADDR(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Tokenhub.contract.Call(opts, out, \"LIGHT_CLIENT_ADDR\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "db17bb201c5903cafb39cab2d5adb29b", "score": "0.4752999", "text": "func Hello(name interface{}) (string, bool) {\n\tgreet := \"world\"\n\tif name != nil {\n\t\tswitch s := name.(type) {\n\t\tcase string:\n\t\t\tif strings.TrimSpace(s) != \"\" {\n\t\t\t\tgreet = s\n\t\t\t}\n\t\tcase stringer:\n\t\t\tgreet = s.String()\n\t\tdefault:\n\t\t\treturn \"\", false\n\t\t}\n\t}\n\treturn fmt.Sprintf(\"Hello, %s!\", greet), true\n}", "title": "" }, { "docid": "f5f59708b3b02e280ea78d1da0353c28", "score": "0.47527304", "text": "func (n *NodeCommon) InitialContact(c context.Context, h *protobuf.Hello) (*protobuf.Goto, error) {\n\n\tvar _goto protobuf.Goto\n\tvar msg string\n\n\ts := h.CallerEntity // caller\n\tpr, ok := peer.FromContext(c)\n\tif !ok {\n\t\treturn &_goto, errors.New(\"failed to get peer from ctx\")\n\t}\n\tif pr.Addr == net.Addr(nil) {\n\t\treturn &_goto, errors.New(\"failed to get peer address\")\n\t}\n\n\t// receiver's kind\n\tswitch n.Entity.Kind {\n\tcase \"master\":\n\n\t\t// caller's kind\n\t\tswitch s.Kind {\n\n\t\tcase \"master\":\n\t\t\tmsg = fmt.Sprintf(\"I'm your master.\")\n\t\t\t_goto = protobuf.Goto{Code: 1, Id: n.Entity.Id, Kind: n.Entity.Kind, Address: h.CalledEntity.Address, Port: h.CalledEntity.Port}\n\t\t\t// TODO(greg) add master to this node's children\n\t\t\tn.MastersLock.Lock()\n\t\t\tn.Masters[s.Id] = protobuf.Entity{Id: s.Id, Kind: s.Kind, Address: s.Address, Port: s.Port, LastSeen: ToPbTime(time.Now().UTC())}\n\t\t\tn.MastersLock.Unlock()\n\n\t\tcase \"slave\":\n\t\t\tmsg = fmt.Sprintf(\"I'm your master.\")\n\t\t\tgAk, err := determineGeoAffinityForSlave(n.Entity.GeoAffinities, n.Slaves)\n\t\t\tif err != nil {\n\t\t\t\tmsg = msg + \" \" + err.Error()\n\t\t\t\t_goto = protobuf.Goto{Code: 4}\n\t\t\t} else {\n\t\t\t\tgAs := []*protobuf.GeoAffinity{n.Entity.GeoAffinities[gAk]}\n\t\t\t\tc := protobuf.Coverer{EntityId: s.Id, CovererStartedTime: ToPbTime(time.Now().UTC()), CovererRunning: false}\n\t\t\t\tn.Entity.GeoAffinities[gAk].Coverers = append(n.Entity.GeoAffinities[gAk].Coverers, &c)\n\t\t\t\t_goto = protobuf.Goto{GeoAffinities: gAs, Code: 1, Id: n.Entity.Id, Kind: n.Entity.Kind, Address: h.CalledEntity.Address, Port: h.CalledEntity.Port}\n\t\t\t}\n\t\t\tn.SlavesLock.Lock()\n\t\t\tn.Slaves[s.Id] = protobuf.Entity{Id: s.Id, Kind: s.Kind, Address: s.Address, Port: s.Port, LastSeen: ToPbTime(time.Now().UTC())}\n\t\t\tn.SlavesLock.Unlock()\n\n\t\tcase \"device\":\n\t\t\t// find a good slave\n\t\t\tfmt.Println(pr.Addr.String())\n\t\t\tgS, err := findGoodSlave(n.Slaves)\n\t\t\tif err != nil {\n\t\t\t\tmsg = fmt.Sprintf(\"I don't have any slaves for you.\")\n\t\t\t\t_goto = protobuf.Goto{Code: 4}\n\t\t\t} else {\n\t\t\t\tmsg = fmt.Sprintf(\"Contact the given slave.\")\n\t\t\t\t_goto = protobuf.Goto{Code: 2, Id: gS.Id, Kind: \"slave\", Address: gS.Address, Port: gS.Port}\n\t\t\t}\n\n\t\tcase \"plugin\":\n\t\t\tmsg = fmt.Sprintf(\"Welcome.\")\n\t\t\t_goto = protobuf.Goto{Code: 1, Id: n.Entity.Id, Kind: n.Entity.Kind, Address: h.CalledEntity.Address, Port: h.CalledEntity.Port}\n\t\t\tn.PluginsLock.Lock()\n\t\t\tn.Plugins[s.Id] = protobuf.Entity{Id: s.Id, Kind: s.Kind, Address: s.Address, Port: s.Port, LastSeen: ToPbTime(time.Now().UTC())}\n\t\t\tn.PluginsLock.Unlock()\n\n\t\tcase \"health\":\n\t\t\tmsg = fmt.Sprintf(\"I don't have anything for you.\")\n\t\t\t_goto = protobuf.Goto{Code: 3}\n\n\t\t}\n\n\tcase \"slave\":\n\n\t\t// caller's kind\n\t\tswitch s.Kind {\n\n\t\tcase \"master\":\n\t\t\tmsg = fmt.Sprintf(\"Can't do that.\")\n\t\t\t_goto = protobuf.Goto{Code: 4}\n\n\t\tcase \"slave\":\n\t\t\tmsg = fmt.Sprintf(\"Can't do that.\")\n\t\t\t_goto = protobuf.Goto{Code: 4}\n\n\t\tcase \"device\":\n\t\t\tmsg = fmt.Sprintf(\"Welcome.\")\n\t\t\t_goto = protobuf.Goto{Code: 1, Id: n.Entity.Id, Kind: n.Entity.Kind, Address: h.CalledEntity.Address, Port: h.CalledEntity.Port}\n\t\t\tn.DevicesLock.Lock()\n\t\t\tn.Devices[s.Id] = protobuf.Entity{Id: s.Id, Kind: s.Kind, Address: s.Address, Port: s.Port, LastSeen: ToPbTime(time.Now().UTC())}\n\t\t\tn.DevicesLock.Unlock()\n\n\t\tcase \"plugin\":\n\t\t\tmsg = fmt.Sprintf(\"Welcome.\")\n\t\t\t_goto = protobuf.Goto{Code: 1, Id: n.Entity.Id, Kind: n.Entity.Kind, Address: h.CalledEntity.Address, Port: h.CalledEntity.Port}\n\t\t\tn.PluginsLock.Lock()\n\t\t\tn.Plugins[s.Id] = protobuf.Entity{Id: s.Id, Kind: s.Kind, Address: s.Address, Port: s.Port, LastSeen: ToPbTime(time.Now().UTC())}\n\t\t\tn.PluginsLock.Unlock()\n\n\t\tcase \"health\":\n\t\t\tmsg = fmt.Sprintf(\"I don't have anything for you.\")\n\t\t\t_goto = protobuf.Goto{Code: 3}\n\n\t\t}\n\n\tcase \"device\":\n\n\t\t// caller's kind\n\t\tswitch s.Kind {\n\n\t\tcase \"master\":\n\t\t\tmsg = fmt.Sprintf(\"Can't do that.\")\n\t\t\t_goto = protobuf.Goto{Code: 4}\n\n\t\tcase \"slave\":\n\t\t\tmsg = fmt.Sprintf(\"Can't do that.\")\n\t\t\t_goto = protobuf.Goto{Code: 4}\n\n\t\tcase \"device\":\n\t\t\tmsg = fmt.Sprintf(\"Can't do that.\")\n\t\t\t_goto = protobuf.Goto{Code: 4}\n\n\t\tcase \"plugin\":\n\t\t\tmsg = fmt.Sprintf(\"Welcome.\")\n\t\t\t_goto = protobuf.Goto{Code: 1, Id: n.Entity.Id, Kind: n.Entity.Kind, Address: h.CalledEntity.Address, Port: h.CalledEntity.Port}\n\t\t\t// TODO(greg) add plugin to this node's children\n\t\t\tn.PluginsLock.Lock()\n\t\t\tn.Plugins[s.Id] = protobuf.Entity{Id: s.Id, Kind: s.Kind, Address: s.Address, Port: s.Port, LastSeen: ToPbTime(time.Now().UTC())}\n\t\t\tn.PluginsLock.Unlock()\n\n\t\tcase \"health\":\n\t\t\tmsg = fmt.Sprintf(\"I don't have anything for you.\")\n\t\t\t_goto = protobuf.Goto{Code: 3}\n\n\t\t}\n\n\t}\n\n\t_goto.Message = msg + fmt.Sprintf(\" You: %s (%s). Me: %s (%s). My Master: %s (%s). My Parent: %s (%s).\",\n\t\ts.Id, s.Kind, n.Entity.Id, n.Entity.Kind, n.Master.Id, n.Master.Kind, n.Parent.Id, n.Parent.Kind)\n\n\treturn &_goto, nil\n}", "title": "" }, { "docid": "9bedd7b59e2ef94e7d74390bf68d4f27", "score": "0.47507033", "text": "func (hs *clientHandshakeStateTLS13) checkServerHelloOrHRR() error {\n\tc := hs.c\n\n\tif hs.serverHello.supportedVersion == 0 {\n\t\tc.sendAlert(alertMissingExtension)\n\t\treturn errors.New(\"tls: server selected TLS 1.3 using the legacy version field\")\n\t}\n\n\tif hs.serverHello.supportedVersion != VersionTLS13 {\n\t\tc.sendAlert(alertIllegalParameter)\n\t\treturn errors.New(\"tls: server selected an invalid version after a HelloRetryRequest\")\n\t}\n\n\tif hs.serverHello.vers != VersionTLS12 {\n\t\tc.sendAlert(alertIllegalParameter)\n\t\treturn errors.New(\"tls: server sent an incorrect legacy version\")\n\t}\n\n\tif hs.serverHello.nextProtoNeg ||\n\t\tlen(hs.serverHello.nextProtos) != 0 ||\n\t\ths.serverHello.ocspStapling ||\n\t\ths.serverHello.ticketSupported ||\n\t\ths.serverHello.secureRenegotiationSupported ||\n\t\tlen(hs.serverHello.secureRenegotiation) != 0 ||\n\t\tlen(hs.serverHello.alpnProtocol) != 0 ||\n\t\tlen(hs.serverHello.scts) != 0 {\n\t\tc.sendAlert(alertUnsupportedExtension)\n\t\treturn errors.New(\"tls: server sent a ServerHello extension forbidden in TLS 1.3\")\n\t}\n\n\tif !bytes.Equal(hs.hello.sessionId, hs.serverHello.sessionId) {\n\t\tc.sendAlert(alertIllegalParameter)\n\t\treturn errors.New(\"tls: server did not echo the legacy session ID\")\n\t}\n\n\tif hs.serverHello.compressionMethod != compressionNone {\n\t\tc.sendAlert(alertIllegalParameter)\n\t\treturn errors.New(\"tls: server selected unsupported compression format\")\n\t}\n\n\tselectedSuite := mutualCipherSuiteTLS13(hs.hello.cipherSuites, hs.serverHello.cipherSuite)\n\tif hs.suite != nil && selectedSuite != hs.suite {\n\t\tc.sendAlert(alertIllegalParameter)\n\t\treturn errors.New(\"tls: server changed cipher suite after a HelloRetryRequest\")\n\t}\n\tif selectedSuite == nil {\n\t\tc.sendAlert(alertIllegalParameter)\n\t\treturn errors.New(\"tls: server chose an unconfigured cipher suite\")\n\t}\n\ths.suite = selectedSuite\n\tc.cipherSuite = hs.suite.id\n\n\treturn nil\n}", "title": "" }, { "docid": "da5650087e6b1f17555ce01b9c53143d", "score": "0.47486398", "text": "func (cb *Cinnabot) SayHello(msg *message) {\n\tcb.SendTextMessage(int(msg.Chat.ID), \"Hello there, \"+msg.From.FirstName+\"!\")\n}", "title": "" }, { "docid": "387c91f76f2289516ca88a5f71c506f3", "score": "0.47472724", "text": "func (s *server) SayHello(ctx context.Context, in *greeter_pb.HelloRequest) (*greeter_pb.HelloReply, error) {\n\tprefix := \"Hello\"\n\t// EXERCISE 1: Translate the prefix using Translator backend.\n\treturn &greeter_pb.HelloReply{Message: prefix + \" \" + in.Name}, nil\n}", "title": "" }, { "docid": "d01c953b84944e8c3f7767e55a73ffb0", "score": "0.47351503", "text": "func HandleAddr(request []byte) {\n\tvar buff bytes.Buffer\n\tvar payload Addr\n\n\t// decode the request into an Addr struct (payload)\n\t// trim the command off the beginning of the bytes\n\tbuff.Write(request[commandLength:])\n\tdec := gob.NewDecoder(&buff)\n\terr := dec.Decode(&payload)\n\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\t// add the known nodes to this current node's known nodes\n\tKnownNodes = append(KnownNodes, payload.AddrList...)\n\tfmt.Printf(\"there are %d known nodes\\n\", len(KnownNodes))\n\n\t// after updating this client's list of known nodes,\n\t// we want to request all of the nodes for the blocks on their blockchain\n\tRequestBlocks()\n}", "title": "" }, { "docid": "2aeffb38c5bf44329094eb582555455d", "score": "0.4730681", "text": "func Hello(username string) (msg string, err error) {\n\twg.Add(1)\n\tdefer wg.Done()\n\n\tif username == \"*\" {\n\t\terr = errors.Wrap(ErrHello, \"Can't say hi to everybody\")\n\t\treturn\n\t}\n\n\tif username == \"\" {\n\t\tusername = \"world\"\n\t}\n\n\tmsg = fmt.Sprintf(\"hello %s\", username)\n\treturn\n}", "title": "" }, { "docid": "742647f8a9e1c4e53df106dac9e2e8b5", "score": "0.47302616", "text": "func (s *GreeterImpl) SayHello(ctx context.Context, args *helloworld.HelloRequest, reply *helloworld.HelloReply) (err error) {\n\t*reply = helloworld.HelloReply{\n\t\tC: args.A * args.B,\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c5e90c09672d2344ed6f0b67151b6d85", "score": "0.47268948", "text": "func (hc *httpConn) LocalAddr() net.Addr { return nullAddr }", "title": "" }, { "docid": "c5e90c09672d2344ed6f0b67151b6d85", "score": "0.47268948", "text": "func (hc *httpConn) LocalAddr() net.Addr { return nullAddr }", "title": "" }, { "docid": "ee713298310657f26786edec59dac81c", "score": "0.4722762", "text": "func sayHello(w http.ResponseWriter, r *http.Request) {\n\t// parse the query parameters of the request and store the parameters in r.Form\n\tr.ParseForm()\n\t// print http request information on the server screen\n\tfmt.Println(\"path: \", r.URL.Path)\n\tfmt.Println(\"scheme: \", r.URL.Scheme)\n\tfor k, v := range r.Form {\n\t\tfmt.Println(\"query parameter: \")\n\t\tfmt.Println(k+\":\", strings.Join(v, \"\"))\n\t}\n\n\t// write response to client\n\tfmt.Fprintf(w, \"Hello, my client!\\n\")\n}", "title": "" }, { "docid": "f1e579ad22e89365b9daf45bba3fd5f3", "score": "0.47141382", "text": "func handleRequest(conn net.Conn){\n\tbuf := make([]byte,1024)\n\treqLen,err := conn.Read(buf)\n\tCheck_NonFatalError(err)\n\tvar receivedMsg shared.OneStringMsg\n\terr = json.Unmarshal(buf[:reqLen],&receivedMsg)\n\tCheck_NonFatalError(err)\n\tfmt.Println(\"message from client:\",receivedMsg.Msg)\n\tconn.Write([]byte(\"Message Received.\"))\n\tconn.Close()\n}", "title": "" }, { "docid": "c313ede4284a26c0f634cb54e965b482", "score": "0.47115204", "text": "func Hello(ctx *fasthttp.RequestCtx, ps fasthttprouter.Params) {\n\tfmt.Fprintf(ctx, \"hello, %s!\\n\", ps.ByName(\"name\"))\n}", "title": "" }, { "docid": "7db3160a1b2da81b4744767ebeaa2388", "score": "0.47114807", "text": "func Hello(c *fiber.Ctx) error {\n\treturn c.JSON(fiber.Map{\"status\": \"success\", \"message\": \"Hello i'm ok!\", \"data\": nil})\n}", "title": "" }, { "docid": "be22a2807027e290e4504d47447ee07d", "score": "0.47029856", "text": "func (e *erlang) HandleCall(from etf.Tuple, message etf.Term, state interface{}) (string, etf.Term, interface{}) {\n\tlib.Log(\"ERLANG: HandleCall: %#v, From: %#v\", message, from)\n\tvar newState erlangState = state.(erlangState)\n\n\tswitch m := message.(type) {\n\tcase etf.Tuple:\n\t\tswitch m.Element(1) {\n\t\tcase etf.Atom(\"process_info\"):\n\t\t\targs := m.Element(2).(etf.List)\n\t\t\treply := processInfo(newState.process, args[0].(etf.Pid), args[1])\n\t\t\treturn \"reply\", reply, state\n\t\tcase etf.Atom(\"system_info\"):\n\t\t\targs := m.Element(2).(etf.List)\n\t\t\treply := systemInfo(newState.process, args[0].(etf.Atom))\n\t\t\treturn \"reply\", reply, state\n\n\t\tcase etf.Atom(\"function_exported\"):\n\t\t\treturn \"reply\", true, state\n\t\t}\n\n\t}\n\treturn \"reply\", etf.Atom(\"ok\"), state\n}", "title": "" }, { "docid": "80f862010742c1ff692bcf79c28e6104", "score": "0.46998876", "text": "func (c *GreeterClient) SayHello(ctx context.Context, args *HelloRequest) (reply *HelloReply, err error) {\n\treply = &HelloReply{}\n\terr = c.xclient.Call(ctx, \"SayHello\", args, reply)\n\treturn reply, err\n}", "title": "" }, { "docid": "d870bdb77bddf13e839c3f45e1343e95", "score": "0.46975243", "text": "func (s *BasetnsnamesParserListener) EnterProtocol_info(ctx *Protocol_infoContext) {}", "title": "" }, { "docid": "c12753b5aec61d1bf656c4033f433bef", "score": "0.4684491", "text": "func (o *MicrosoftGraphWindows10NetworkProxyServer) GetAddressOk() (string, bool) {\n\tif o == nil || o.Address == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Address, true\n}", "title": "" }, { "docid": "4084b834ef5fe7e4cc085418fda3af39", "score": "0.46800664", "text": "func Hello(name string) (string, error) {\n\treturn fmt.Sprintf(\"Fuck, %s\", name), nil\n}", "title": "" }, { "docid": "a6f84f31b3618ccb0fc1874ddc158e6f", "score": "0.46771184", "text": "func Hello(name string, language string) string {\n\tif name == \"\" {\n\t\tname = \"World\"\n\t}\n\treturn greetingPrefix(language) + name\n}", "title": "" }, { "docid": "c00de75b086e51cc3e72b64057c01957", "score": "0.46756753", "text": "func (conn TeeConn) LocalAddr() net.Addr { return nil }", "title": "" }, { "docid": "e348f847aa0058dbc373a440812d5f0e", "score": "0.4675576", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\tc, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\t//sockname := masterSock()\n\t//c, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\treturn false\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\tfmt.Println(err)\n\treturn false\n}", "title": "" }, { "docid": "0c487247b1f9cc929a69b21b2d13795c", "score": "0.46730977", "text": "func (c *Conn) clientReadFrom(b []byte, addr net.Addr, p []byte) (int, error) {\n\t// Always require an entry for the server\n\tinfo, _ := c.tlsInfo(addr.Network(), addr.String(), false)\n\tif info == nil {\n\t\t// TODO: can this be used as a timing attack by others to see what servers\n\t\t// I might be connected to?\n\t\treturn 0, &ErrNoServerConnEstablished{addr, b}\n\t}\n\t// Packet can contain multiple messages\n\tfor len(b) > 0 {\n\t\t// Parse the message\n\t\trec := &model.DTLSRecord{}\n\t\tn, err := rec.Unmarshal(b)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tb = b[:n]\n\t\t// TODO: validate message, e.g. version, size, etc\n\t\t// Handle message types\n\t\tswitch rec.Type {\n\t\tcase model.RecordTypeChangeCipherSpec:\n\t\t\tpanic(\"TODO\")\n\t\tcase model.RecordTypeAlert:\n\t\t\tpanic(\"TODO\")\n\t\tcase model.RecordTypeHandshake:\n\t\t\tif err = info.handshake(rec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\tcase model.RecordTypeApplicationData:\n\t\t\tpanic(\"TODO\")\n\t\tdefault:\n\t\t\treturn 0, model.AlertUnexpectedMessage\n\t\t}\n\t}\n\t// This read did nothing\n\treturn 0, nil\n}", "title": "" }, { "docid": "c23cc2b5b3e26ab40fce82786c6576fa", "score": "0.46708396", "text": "func (x *fastReflection_SayHelloRequest) IsValid() bool {\n\treturn x != nil\n}", "title": "" }, { "docid": "e4b3b582c76824a5c58adbdaa4c0fae3", "score": "0.46670058", "text": "func call(srv string, name string, args interface{}, reply interface{}) bool {\n c, err := rpc.Dial(\"unix\", srv)\n if err != nil {\n err1 := err.(*net.OpError)\n if err1.Err != syscall.ENOENT && err1.Err != syscall.ECONNREFUSED {\n fmt.Printf(\"paxos Dial() failed: %v\\n\", err1)\n }\n return false\n }\n defer c.Close()\n \n err = c.Call(name, args, reply)\n if err == nil {\n return true\n }\n\n fmt.Println(err)\n return false\n}", "title": "" }, { "docid": "f0244050e6c2c1dd3c529272cf1ee2a6", "score": "0.4663809", "text": "func onNickInUse(*irc.Message) {\n\tnick := config.Nickname()\n\tpwd := config.NickservPassword()\n\n\tif len(pwd) > 0 {\n\t\tproto.Recover(nick, pwd)\n\t\treturn\n\t}\n\n\tconfig.SetNickname(nick + \"_\")\n\tproto.Nick(config.Nickname(), \"\")\n}", "title": "" }, { "docid": "ec2bbfcc0fe69aa21edae9f4377ae426", "score": "0.46622807", "text": "func call(rpcname string, args interface{}, reply interface{}) bool {\n\t// c, err := rpc.DialHTTP(\"tcp\", \"127.0.0.1\"+\":1234\")\n\tsockname := coordinatorSock()\n\tc, err := rpc.DialHTTP(\"unix\", sockname)\n\tif err != nil {\n\t\tlog.Fatal(\"dialing:\", err)\n\t\t\n\t}\n\tdefer c.Close()\n\n\terr = c.Call(rpcname, args, reply)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tfmt.Println(err)\n\treturn false\n}", "title": "" } ]
588a91f6264f1aebce9ad13807cb666b
JSONString returns path representation is JSON convention
[ { "docid": "d038b3c6c8126c9ce39528e2f224e93d", "score": "0.70013136", "text": "func (fp *DeleteRegionRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" } ]
[ { "docid": "c7f67b1cbff80fa25bd9296e76c25e17", "score": "0.7517738", "text": "func (fpm *RegionalDistribution_FieldPathMap) JSONString() string {\n\treturn strcase.ToLowerCamel(fpm.selector.String()) + \".\" + fpm.key\n}", "title": "" }, { "docid": "866fd80eaca47a91fc030611704b3a43", "score": "0.7401901", "text": "func (fp *Resource_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "b7036dd2a4050076b5a04d929504e064", "score": "0.73710924", "text": "func (fps *Resource_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "552d3ad973f7d82ef0ab48b64e3925fd", "score": "0.73507357", "text": "func (fp *RegionalDistribution_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "18da398072a25b3163949e33cd8ee54d", "score": "0.7334774", "text": "func (fp *ServiceAccount_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "0e15cc29005ccb72519dbaaa5737be74", "score": "0.72852206", "text": "func (fp *Plan_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "efd45d29b84f1f3e705ab1c0a7f46634", "score": "0.72765964", "text": "func (fps *CreateRegionRequest_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "a3772aa5bc2330f99f27d64b9f423638", "score": "0.7266982", "text": "func (fps *Plan_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "95bc8a702b8c617056b79f0657052175", "score": "0.7224437", "text": "func (fp *Allowance_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "9c67aaa081df618a3ba07bd5b48418aa", "score": "0.72132343", "text": "func (fps *UpdateRegionRequest_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "39c88f48a488e6f41ba075e672ad6254", "score": "0.72002214", "text": "func jsonizePath(mi *modelInfo, path string) string {\n\texprs := strings.Split(path, ExprSep)\n\texprs = jsonizeExpr(mi, exprs)\n\treturn strings.Join(exprs, ExprSep)\n}", "title": "" }, { "docid": "733ce6183c4f2530a92e36a728a62d71", "score": "0.71922135", "text": "func (fps *UpdateRegionRequestCAS_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "b7cf31fec103a1c0880d6fbe0e183569", "score": "0.717758", "text": "func (fp *WatchRegionRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "bd82c2ecc302de0d4ecd7973bb4149af", "score": "0.716664", "text": "func JSONPath(fields []string) string {\n\treturn \".\" + strings.Join(fields, \".\")\n}", "title": "" }, { "docid": "4cf6391f6cb58cba097e17c7fbed5d95", "score": "0.7164816", "text": "func JSONPath(fields ...string) string {\n\treturn strings.Join(fields, \".\")\n}", "title": "" }, { "docid": "ba9b05ce75e3ff46575050f04db2d5ac", "score": "0.71544254", "text": "func (fp *WatchRegionsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "3bc97e5d126efce8f4beae2e1272cb19", "score": "0.7142034", "text": "func (fp *LimitPool_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "806a836966623226c764e0fb93e5a0c3", "score": "0.714194", "text": "func (fp *AlertingCondition_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "ee187f2cd0b58d58e097afe93874c63f", "score": "0.7136653", "text": "func jsonizePath(mi *Model, path string) string {\n\texprs := strings.Split(path, ExprSep)\n\texprs = jsonizeExpr(mi, exprs)\n\treturn strings.Join(exprs, ExprSep)\n}", "title": "" }, { "docid": "79082c4ad8e944eb53b45ce8606dbe35", "score": "0.7136409", "text": "func (fps *AlertingCondition_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "2337839d3e675889a971bf03a37e0e20", "score": "0.71234286", "text": "func (fps *BatchGetRegionsResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "128e4dd998465350d3ff71a1dcd4af7a", "score": "0.7121647", "text": "func (fp *GetAuditedResourceDescriptorRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "f862ef55811c7050b9113dd8828d80eb", "score": "0.71206987", "text": "func (fp *WatchRegionResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "64cdda43b9e6fe21d035417821f17e37", "score": "0.71191293", "text": "func (fp *UpdateRegionRequestCAS_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "794ab63fba53c7c92c9596a9a6dae2ad", "score": "0.7113222", "text": "func (fps *LimitPool_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "9be11176095cee62dd8da344ff1c73f3", "score": "0.7112597", "text": "func (fps *WatchRegionsResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "7daa270e7bf892d08f60230067fa3df2", "score": "0.7109355", "text": "func (fp *WatchRegionsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "b5d32e941367a7eac1935d97329895b3", "score": "0.71058834", "text": "func (fp *AcceptProjectInvitationRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "33ad783978051b5a298c3a64f5b0f871", "score": "0.70944095", "text": "func (fps *Limit_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "eb2710da7a36179e0a1eca3a7328de75", "score": "0.7091322", "text": "func (fp *WatchAuditedResourceDescriptorsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "bc279c5b79a8d397b0985e314d9f7b5b", "score": "0.70888054", "text": "func (fp *AlertingConditionSpec_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "b0a23157bd07314ba299e1ff882817a8", "score": "0.70814633", "text": "func (ctx *TemplateContext) JSON(path string) (string, error) {\n\tdata := make(map[string]interface{})\n\tdec := json.NewDecoder(strings.NewReader(ctx.Payload))\n\terr := dec.Decode(&data)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tparts := strings.Split(path, \".\")\n\n\tquery := jsonq.NewQuery(data)\n\tvalue, err := query.Interface(parts...)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// converts int, float, bool, etc to string\n\treturn fmt.Sprintf(\"%v\", value), nil\n}", "title": "" }, { "docid": "2f050a388dbc9450b9a68205f7ddc431", "score": "0.70798934", "text": "func (fp *AlertingConditionState_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "7b3b7d2eb656f187479e474dfbcd7a53", "score": "0.70797354", "text": "func (fps *ListRegionsResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "dd1d3621e6d9cbede7437bde3568198c", "score": "0.7077304", "text": "func (fp *GetRegionRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "4cca0598d14be47b623ffed724c957cc", "score": "0.707492", "text": "func (fp *CreateAuditedResourceDescriptorRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "a10c8953c8ec0ddfa10766f7a5202381", "score": "0.70707524", "text": "func (fp *WatchAuditedResourceDescriptorRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "b2c99e15dca90973d2c57fde5fdf8f6f", "score": "0.70694", "text": "func (fp *UpdateAuditedResourceDescriptorRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "23220f5b30b281b21a84b320b0bd7795", "score": "0.70693713", "text": "func (fp *CreateRegionRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "610d40d911a4bfcdb6b903eac0d1046c", "score": "0.7055222", "text": "func (fp *BatchGetAuditedResourceDescriptorsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "73b9320242271bf64f75b68ade16d13e", "score": "0.7049148", "text": "func (fp *ListMyProjectInvitationsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "700ddd38dd3f61edae83200e63539577", "score": "0.7046603", "text": "func (fp *UpdateAuditedResourceDescriptorRequestCAS_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "7e56a9416d8aa00a2a1afa7135570742", "score": "0.7042263", "text": "func (fp *ListMyProjectInvitationsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "711d86c3ac888fe20b5658f5c6a744cb", "score": "0.7038035", "text": "func (fp *Limit_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "d78cc415ba8ad514027cb8fd38a83a87", "score": "0.70347345", "text": "func (fp *UpdateRegionRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "06cf90d587bf1b4124379b9ba4bc6012", "score": "0.70296365", "text": "func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "8385e33bae2507b151d31e7531316e45", "score": "0.7029585", "text": "func (fp *WatchRegionsResponsePageTokenChange_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "839b9d122f9ff92655214ce124415a0d", "score": "0.7026445", "text": "func (fp *BatchGetRegionsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "5f366b21db17c4b6193e9fd17f32cdc2", "score": "0.7019059", "text": "func (fp *AcceptProjectInvitationResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "21a6c623c8444a93161c052e919d4944", "score": "0.7016165", "text": "func (fps *CreateAuditedResourceDescriptorRequest_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "5a9412935e3ab4d82102d1de06429653", "score": "0.7011748", "text": "func (fp *DeclineProjectInvitationRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "4056ce79be42128bd1897b960a52a451", "score": "0.70003724", "text": "func (fps *ResendProjectInvitationResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "57970116423c24a3f809234c4beccd14", "score": "0.6999028", "text": "func (fps *UpdateLimitPoolRequestCAS_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "f0fb7a128b8042103f5814828686d308", "score": "0.6994651", "text": "func (fp *WatchAuditedResourceDescriptorsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "f577411e73350d26df5f825a765fd193", "score": "0.69941306", "text": "func (fp *ListRegionsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "770e030a7dd286b6d86f05dc2dd134ab", "score": "0.69898975", "text": "func (fps *AlertingConditionSpec_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "0baeca684f4c32e4eeac9cd767286b5c", "score": "0.697637", "text": "func (fp *AlertingConditionSpecTrigger_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "f10629373775141b95e652daf004f6ca", "score": "0.69760895", "text": "func (fp *UpdateLimitPoolRequestCAS_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "64fe4f58526f24f365b53f0982de0677", "score": "0.697197", "text": "func (fps *UpdateAuditedResourceDescriptorRequest_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "d97e4a14fdb0523ae9e8ec0d001f140b", "score": "0.6971926", "text": "func (fps *ListMyProjectInvitationsResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "6a0ec0f5b9552d7bba9ac5640b479962", "score": "0.69709474", "text": "func (fp *BatchGetAuditedResourceDescriptorsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "d28cbb4e45e926b263090b07741e0c5e", "score": "0.6969285", "text": "func (fps *BatchGetAuditedResourceDescriptorsResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "fcc1ee3a9a0c459030de63a1facfd657", "score": "0.6969153", "text": "func (fp *WatchLimitPoolsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "0095a3589f1df90ded47c34ce458ef1b", "score": "0.6960421", "text": "func (fp *BatchGetRegionsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "d23ac0598df5fd53b27399b2b0273c9f", "score": "0.69589317", "text": "func (fp *ResendProjectInvitationRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "770ce5b26193a413956e1a2cf3d6d18c", "score": "0.69552916", "text": "func (fps *UpdateLimitPoolRequest_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "63547ea683a7f5cda73c1f88dfa28d5e", "score": "0.6953104", "text": "func (fp *DeclineProjectInvitationResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "ce69a47dba31e165135111258d5abef8", "score": "0.6951526", "text": "func (fp *WatchAuditedResourceDescriptorResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "75414e17c51ab047cac3545020ecd366", "score": "0.6949307", "text": "func (fps *CreateMetricDescriptorRequest_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "09312caf55294502ad03477ab3525abf", "score": "0.6949205", "text": "func (fp *ListRegionsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "678e4fb7dc8f8c5b3042914423efeb6d", "score": "0.6943099", "text": "func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "8cfa12768af90e37b52e723f2f1d6911", "score": "0.69351846", "text": "func (fps *UpdateAuditedResourceDescriptorRequestCAS_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "781c245abfbbf946bb1b46d82fb06a12", "score": "0.69315046", "text": "func (fp *ListAuditedResourceDescriptorsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "b4c60ec3b8235cf894228e634de41a77", "score": "0.6912344", "text": "func (fps *WatchLimitPoolsResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "205a2d0b6891036fa6fd40f9599e73ff", "score": "0.69121873", "text": "func (fp *ResendProjectInvitationResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "24c099eab6ae35fb5fe8aacef702be23", "score": "0.69083816", "text": "func (fps *WatchAuditedResourceDescriptorsResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "68d30cce54149cbae236c7fba4367634", "score": "0.6906698", "text": "func (fp *WatchLimitPoolRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "5111dbc36b942a9cbe23d37e7d6a08f8", "score": "0.69060737", "text": "func (fp *WatchLimitPoolsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "742acf18aeeebc070877b9323cdd8b7d", "score": "0.69009906", "text": "func (fp *GetMetricDescriptorRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "afea08f7f6fec2712a276b9dee3fee11", "score": "0.6893966", "text": "func (j *JSONData) String(path ...interface{}) (string, error) {\n\tjson, err := j.get(path...)\n\treturn json.MustString(), err\n}", "title": "" }, { "docid": "871b021f26714bd69bc34d0ed55e6c1d", "score": "0.68924534", "text": "func (fp *WatchLimitPoolsResponsePageTokenChange_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "8ad4f656cacd5b3f8ca78f070553e2a5", "score": "0.68843573", "text": "func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) JSONString() string {\n\treturn strcase.ToLowerCamel(fpm.selector.String()) + \".\" + fpm.key\n}", "title": "" }, { "docid": "4a9fb6fca7016fc8cde92e0d55afb9b0", "score": "0.68832546", "text": "func (fp *WatchLimitPoolResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "15a1bfe26d8c6e64674568b40099a9bd", "score": "0.6871419", "text": "func (fp *ListAuditedResourceDescriptorsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "5a02fb22b5532c2cb879ef6c249363d1", "score": "0.68684584", "text": "func (fp *CreateMetricDescriptorRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "193e9e6d09e8089e2df0ec4d1b65a1dd", "score": "0.68502855", "text": "func (fps *ListAuditedResourceDescriptorsResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "528918fdba4504357e9b8dfa1a7f7755", "score": "0.68483186", "text": "func (fp *WatchAuditedResourceDescriptorsResponsePageTokenChange_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "3651a40095f543c57e7c5535c79093ad", "score": "0.68443984", "text": "func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "67a9f67e777d12421a35fd36749c069c", "score": "0.68327385", "text": "func (fps *BatchGetLimitPoolsResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "74afdb57c1237c68a6c8de45751c3d75", "score": "0.6817267", "text": "func (fps *ListMetricDescriptorsResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "9d9a04760ff0fd5fede4817baefca25e", "score": "0.6792042", "text": "func (fp *DeleteLimitPoolRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "aecdf5c59898f587f6a22b40e90ef92b", "score": "0.6783441", "text": "func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "5af5ef45f1d92fd08cc307419d9230f8", "score": "0.6771266", "text": "func (fps *ListLimitPoolsResponse_FieldSubPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fps.selector.String()) + \".\" + fps.subPath.JSONString()\n}", "title": "" }, { "docid": "6a8fcebda8d6bce9b41891b6ca2d2754", "score": "0.6768475", "text": "func (fp *UpdateLimitPoolRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "54b17fd20330abcd5cc23eaa568136af", "score": "0.67466706", "text": "func (fp *DeleteMetricDescriptorRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "1a764d708af3da8ef3e44693324b35c2", "score": "0.67371947", "text": "func (fp *BatchGetLimitPoolsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "2a2ad9806f2698de5d23998ee077b3de", "score": "0.6727323", "text": "func (fp *GetLimitPoolRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "3c5843f227461202cd9e6ebee6a4cc44", "score": "0.6688079", "text": "func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "22cac4696a836ecdaeff622aae410b71", "score": "0.66812015", "text": "func (fp *ListMetricDescriptorsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" }, { "docid": "30d91197977505f2935ac069d5d9b77d", "score": "0.66720194", "text": "func (fp *ListMetricDescriptorsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "title": "" } ]
59561706c51859fca84f9b8658ba8325
Find the minimum between two ints.
[ { "docid": "2751227f5d6390bdc6de889321faa60f", "score": "0.8292288", "text": "func minInt(a, b int) int {\n\tif a <= b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" } ]
[ { "docid": "da60d362d9df8c6649ffb0cf74eacd82", "score": "0.8433884", "text": "func minInt(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "622be7b87e60093d674dd4aea4dbf346", "score": "0.8396316", "text": "func minInt(a int, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "37b15a4782ccf24d2e4b49be22064cea", "score": "0.83174944", "text": "func Min(a, b int) int {\n return int(math.Min(float64(a), float64(b)))\n}", "title": "" }, { "docid": "4f250e4b6ca23c603095505a5fc3f569", "score": "0.82757354", "text": "func minInt(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t} else {\n\t\treturn y\n\t}\n}", "title": "" }, { "docid": "5f17ba9454016cb9e5036e9f3dd09073", "score": "0.8214913", "text": "func IntMin(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "9ac629661adbd0a44a2dffc7aef7bff2", "score": "0.8192837", "text": "func min(a int, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "37830e610f2b8866978d6a96ad6e67e6", "score": "0.81856835", "text": "func min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "11946360b70ac12ab38a87060bec1a36", "score": "0.8184339", "text": "func MinInt(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "11946360b70ac12ab38a87060bec1a36", "score": "0.8184339", "text": "func MinInt(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "11946360b70ac12ab38a87060bec1a36", "score": "0.8184339", "text": "func MinInt(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "11946360b70ac12ab38a87060bec1a36", "score": "0.8184339", "text": "func MinInt(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "8f4814f4ae6ffb18e4efae690c7f1341", "score": "0.81790245", "text": "func IntMin(a, b int) int {\n\tif a > b {\n\t\treturn b\n\t}\n\treturn a\n}", "title": "" }, { "docid": "7d3652c9180be137cdb6639f0d44a04f", "score": "0.81569594", "text": "func min(a int, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "248d69528f8157d7fe0b070b94a4bedc", "score": "0.81492287", "text": "func min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "248d69528f8157d7fe0b070b94a4bedc", "score": "0.81492287", "text": "func min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "248d69528f8157d7fe0b070b94a4bedc", "score": "0.81492287", "text": "func min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "248d69528f8157d7fe0b070b94a4bedc", "score": "0.81492287", "text": "func min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "248d69528f8157d7fe0b070b94a4bedc", "score": "0.81492287", "text": "func min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "248d69528f8157d7fe0b070b94a4bedc", "score": "0.81492287", "text": "func min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "248d69528f8157d7fe0b070b94a4bedc", "score": "0.81492287", "text": "func min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "248d69528f8157d7fe0b070b94a4bedc", "score": "0.81492287", "text": "func min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "248d69528f8157d7fe0b070b94a4bedc", "score": "0.81492287", "text": "func min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "59160f9e38f1fc9eb5845ea5cb601c04", "score": "0.8140613", "text": "func min(a, b int) int {\n\tif b < a {\n\t\treturn b\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "e89c46c55e13a0027d37df09d85dddf3", "score": "0.8133235", "text": "func min(a int, b int) int {\n\tif a < b {\n\t\treturn a\n\t} else {\n\t\treturn b\n\t}\n}", "title": "" }, { "docid": "2a5fedcbad5e405e35d84b0899f5482e", "score": "0.81328773", "text": "func min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t} else {\n\t\treturn b\n\t}\n}", "title": "" }, { "docid": "2a5fedcbad5e405e35d84b0899f5482e", "score": "0.81328773", "text": "func min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t} else {\n\t\treturn b\n\t}\n}", "title": "" }, { "docid": "b2439c7221673099b6860a26233d1fdf", "score": "0.8132307", "text": "func min(a, b int64) int64 {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "b2439c7221673099b6860a26233d1fdf", "score": "0.8132307", "text": "func min(a, b int64) int64 {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "f1c92e1567af7e06214c24691984b8e9", "score": "0.81213254", "text": "func min(a, b int) int {\n\tif b < a {\n\t\treturn b\n\t}\n\treturn a\n}", "title": "" }, { "docid": "f1c92e1567af7e06214c24691984b8e9", "score": "0.81213254", "text": "func min(a, b int) int {\n\tif b < a {\n\t\treturn b\n\t}\n\treturn a\n}", "title": "" }, { "docid": "06ad43dc6f5d51c10626790fc562314f", "score": "0.8119767", "text": "func MinInt(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t} else {\n\t\treturn y\n\t}\n}", "title": "" }, { "docid": "06ad43dc6f5d51c10626790fc562314f", "score": "0.8119767", "text": "func MinInt(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t} else {\n\t\treturn y\n\t}\n}", "title": "" }, { "docid": "cd834feb0b19e59c6397b187fee509c7", "score": "0.80882454", "text": "func Min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "cd834feb0b19e59c6397b187fee509c7", "score": "0.80882454", "text": "func Min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "cd834feb0b19e59c6397b187fee509c7", "score": "0.80882454", "text": "func Min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "cd834feb0b19e59c6397b187fee509c7", "score": "0.80882454", "text": "func Min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "cd834feb0b19e59c6397b187fee509c7", "score": "0.80882454", "text": "func Min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "29f3bc983b6fb75be292b15d85c8219c", "score": "0.8069715", "text": "func min (a, b int) int {\n if a < b {\n return a;\n }\n return b;\n}", "title": "" }, { "docid": "42819270615c895e11535b031989477d", "score": "0.80577874", "text": "func MinInt(x, y int) int {\n\tif x > y {\n\t\treturn y\n\t}\n\treturn x\n}", "title": "" }, { "docid": "a1abbee6d24414790171d305f99dbc38", "score": "0.8055807", "text": "func min(a, b int) int {\r\n\tif a < b {\r\n\t\treturn a\r\n\t}\r\n\treturn b\r\n}", "title": "" }, { "docid": "1029665901ad47fd560ca665f79ed179", "score": "0.80555034", "text": "func min(x, y int64) int64 {\n if x < y {\n return x\n }\n return y\n }", "title": "" }, { "docid": "c0207e8b1edb2f04bd16b737b8701b2e", "score": "0.8055448", "text": "func Min(a int, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "6d1fb628c041408113e629ca0b4516e4", "score": "0.8044045", "text": "func Min(a, b int) int {\n\tif a >= b {\n\t\treturn b\n\t}\n\treturn a\n}", "title": "" }, { "docid": "1a8e7588e0fc62c8eb4c9ce5ce88e749", "score": "0.8039106", "text": "func Min(a, b int) int {\n\tif a <= b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "a2b2743f41c5b3d34694112346d22240", "score": "0.80389106", "text": "func MinInt(x int, y int) int {\n\tif x <= y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "46e82c159a7902124b50e4c9ebe0d606", "score": "0.80177355", "text": "func MinInt(v1 int, v2 int) int {\n\tif v2 < v1 {\n\t\treturn v2\n\t}\n\n\treturn v1\n}", "title": "" }, { "docid": "bc4162ac26655762a683898f7d6aaf86", "score": "0.80131453", "text": "func MIN(a int, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "b4bf183416f9715b62e107cbc1ef8c6a", "score": "0.8007292", "text": "func MinInt(i, j int) int {\n\treturn MinIntA(i, j)\n}", "title": "" }, { "docid": "8afa1a25ea57ea64e827fec4297808a7", "score": "0.7998749", "text": "func MinInt(v1, v2 int) int {\n\tif v1 < v2 {\n\t\treturn v1\n\t}\n\treturn v2\n}", "title": "" }, { "docid": "a53482c2228e5ebf3f74053dcf5f3f20", "score": "0.79942214", "text": "func min(a int, b int) int {\n\tif a > b {\n\t\treturn b\n\t}\n\treturn a\n}", "title": "" }, { "docid": "d10ab830df9b949984233616f284079d", "score": "0.798754", "text": "func Min(a, b int) int {\n\tif a > b {\n\t\treturn b\n\t}\n\n\treturn a\n}", "title": "" }, { "docid": "cd7c119edd4f63ccb896f5562546c00f", "score": "0.79694176", "text": "func min(a, b int) int {\n\tif a > b {\n\t\treturn b\n\t}\n\treturn a\n}", "title": "" }, { "docid": "f0da6181601fd9ff8fa6d11267f2e8b9", "score": "0.7949572", "text": "func MinInt(a, b int) (c int) {\n\tc = a\n\tif c > b {\n\t\tc = b\n\t}\n\treturn\n}", "title": "" }, { "docid": "6af6b36e12aa3eaed6ce880e5d755c05", "score": "0.7946197", "text": "func Min(a, b int) int {\n\tif a > b {\n\t\treturn b\n\t}\n\treturn a\n}", "title": "" }, { "docid": "e380d3dd42092ee15610cddb09ca5d01", "score": "0.79323745", "text": "func imin(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "ebb6cbbcb488595d5ed1273c89f1b4f9", "score": "0.7926582", "text": "func minOf(x, y int) int {\n if x < y {\n return x\n }\n return y\n}", "title": "" }, { "docid": "5f665aeec8758ad259fea0faa4145ee3", "score": "0.7926007", "text": "func _min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "b0c9f061d337ba448196e478a6c04aa5", "score": "0.79231673", "text": "func Min(v1, v2 int64) int64 {\n\treturn MinInt64(v1, v2)\n}", "title": "" }, { "docid": "7926641d897ba3ee28c34ae775a57da3", "score": "0.79213053", "text": "func Min(a int, b int) int {\n\tif a > b {\n\t\treturn b\n\t}\n\treturn a\n}", "title": "" }, { "docid": "1b3621c1af62803eedc9f0cce4e5deee", "score": "0.7901142", "text": "func min(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "1b3621c1af62803eedc9f0cce4e5deee", "score": "0.7901142", "text": "func min(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "1b3621c1af62803eedc9f0cce4e5deee", "score": "0.7901142", "text": "func min(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "1b3621c1af62803eedc9f0cce4e5deee", "score": "0.7901142", "text": "func min(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "484e07eefc5228024451a50d68b56363", "score": "0.7900405", "text": "func min(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t} else {\n\t\treturn y\n\t}\n}", "title": "" }, { "docid": "8863b2646f8645219551833768357182", "score": "0.7892651", "text": "func getMin(a, b int) int {\n\tif a <= b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "cbaefcb32d8263bd727e92ac3639d7aa", "score": "0.7869527", "text": "func min(a, b int32) int32 {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "9fded747353e0429bdf7a93149b02eb2", "score": "0.78605545", "text": "func Min(first int, second int) int {\n\tif first <= second {\n\t\treturn first\n\t}\n\treturn second\n}", "title": "" }, { "docid": "25baaef0e84c02d0bb1db3dc43f139a0", "score": "0.7846399", "text": "func Min(a, b uint64) uint64 {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "c8dc22532f67cfe45ba4fb5f77cc9363", "score": "0.7842933", "text": "func min(x, y int64) int64 {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "d821c60bd1670ebbd9717ca7a46204f4", "score": "0.7841877", "text": "func min(a uint64, b uint64) uint64 {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "c96330670d53661ec3432a27654859cf", "score": "0.78241", "text": "func min(x, y int) int {\n if x <= y {\n return x\n }\n return y\n}", "title": "" }, { "docid": "e8b729ac7f13289d48eb6ac0c28c48b3", "score": "0.78064585", "text": "func Min(x, y int) int {\n if x < y {\n return x\n }\n return y\n}", "title": "" }, { "docid": "2310be0a5898d5e1c816f4b08a5e8b7a", "score": "0.7805878", "text": "func Min(a ...int) int {\n\n\t// Use bitshifting to get the largest possible value for a\n\t// golang integer.\n\tmin := int(^uint(0) >> 1)\n\n\tfor _, i := range a {\n\n\t\t// Smaller? Set the variable then.\n\t\tif i < min {\n\t\t\tmin = i\n\t\t}\n\t}\n\n\treturn min\n}", "title": "" }, { "docid": "3053ce3375fb7fc0d8a25e3ebe2945a0", "score": "0.78056943", "text": "func Min(x, y int64) int64 {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "e45f6639080ff962ecd8a5d92ecdb8e7", "score": "0.78017634", "text": "func Min(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "e45f6639080ff962ecd8a5d92ecdb8e7", "score": "0.78017634", "text": "func Min(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "e45f6639080ff962ecd8a5d92ecdb8e7", "score": "0.78017634", "text": "func Min(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "e45f6639080ff962ecd8a5d92ecdb8e7", "score": "0.78017634", "text": "func Min(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "84c5443d2f901f103fbf2b2f481248ed", "score": "0.7780821", "text": "func MinInt(x int, xs ...int) int {\n\tmin := x\n\tfor _, n := range xs {\n\t\tif n < min {\n\t\t\tmin = n\n\t\t}\n\t}\n\treturn min\n}", "title": "" }, { "docid": "4cf5b01f23bc087deeda13fa57145722", "score": "0.77521485", "text": "func Min(x int, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "1afbf6a4acb979c75ccf35876c46e38c", "score": "0.7743796", "text": "func minInt(x int, others ...int) int {\n\tmin := x\n\tfor _, y := range others {\n\t\tif y < min {\n\t\t\tmin = y\n\t\t}\n\t}\n\treturn min\n}", "title": "" }, { "docid": "63f4f15e6fece8dc754ecea7f9ecafd2", "score": "0.7741462", "text": "func min(x int, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\tif x > y {\n\t\treturn y\n\t}\n\treturn x\n}", "title": "" }, { "docid": "398561d5bcc0e292fd3b8105ceca5259", "score": "0.7727105", "text": "func Min(A, B int) int {\n\tmin := A\n\tif A > B {\n\t\tmin = B\n\t}\n\treturn min\n}", "title": "" }, { "docid": "d81d6716dabc44323872835db1dc9243", "score": "0.7723718", "text": "func MinInt(is ...int) int {\n\tif len(is) < 1 {\n\t\treturn 0\n\t}\n\tmin := is[0]\n\tfor _, i := range is {\n\t\tif i < min {\n\t\t\tmin = i\n\t\t}\n\t}\n\treturn min\n}", "title": "" }, { "docid": "aa37e76c3f8c338366472180d5495157", "score": "0.7716329", "text": "func Min(x, y int) int {\n\tif x < y {\n\t\treturn x\n\n\t} else {\n\t\treturn y\n\t}\n}", "title": "" }, { "docid": "e6772bb36de9f67bf08ae922961fcf67", "score": "0.76916075", "text": "func Min(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n\n}", "title": "" }, { "docid": "7b6a0d50b6761af6b5f534a7e60290f9", "score": "0.7689039", "text": "func min(x, y int64) int64 {\n\treturn y + ((x - y) & ((x - y) >> 63))\n}", "title": "" }, { "docid": "267feeb4bd8048058a1bbd2cf22c3bd5", "score": "0.76786745", "text": "func Min(x, y int) int {\n\tif x > y {\n\t\treturn y\n\t}\n\treturn x\n}", "title": "" }, { "docid": "267feeb4bd8048058a1bbd2cf22c3bd5", "score": "0.76786745", "text": "func Min(x, y int) int {\n\tif x > y {\n\t\treturn y\n\t}\n\treturn x\n}", "title": "" }, { "docid": "549de6d49712feb5e3acba7b5e1d65f6", "score": "0.7664514", "text": "func Minimum(a int, b int) int {\n\tif a > b {\n\t\treturn b\n\t}\n\treturn a\n}", "title": "" }, { "docid": "30a75a3f3a7915f66be82cfdfc774fc6", "score": "0.7658642", "text": "func minPosInt(a, b int) int {\n\tif a < 0 {\n\t\treturn b\n\t}\n\tif b < 0 {\n\t\treturn a\n\t}\n\tif a > b {\n\t\treturn b\n\t}\n\treturn a\n}", "title": "" }, { "docid": "6fcdf205be46b81497d2a213dda1b131", "score": "0.7649517", "text": "func Min(a ...int) int {\n\tmin := int(^uint(0) >> 1) // largest int\n\tfor _, i := range a {\n\t\tif i < min {\n\t\t\tmin = i\n\t\t}\n\t}\n\treturn min\n}", "title": "" }, { "docid": "0fa57f91d10da965cf65dd648e4c8cfe", "score": "0.7647724", "text": "func Min(x1, x2 int) int {\n\tif x1 > x2 {\n\t\treturn x2\n\t}\n\treturn x1\n}", "title": "" }, { "docid": "a0a4a52dbcb294f6535428c1bc425069", "score": "0.764067", "text": "func min(x, y int32) int32 {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "a11371d04047cf974742c862b83649c5", "score": "0.7592162", "text": "func min(x, y uint64) uint64 {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "010e96da4a4beaf1e00f351fb09e21f1", "score": "0.75670946", "text": "func MinInt64(a, b int64) int64 {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "16d35afeb5d37b2833bef1e34e22d84a", "score": "0.7556047", "text": "func min(a, b uint32) uint32 {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "14a55246aed74a46714a0c5a37c32de6", "score": "0.75495136", "text": "func minimum(a int, v ...int) int {\n\tmin := a\n\tvar n int\n\tfor _, n = range v {\n\t\tif n < min {\n\t\t\tmin = n\n\t\t}\n\t}\n\treturn min\n}", "title": "" }, { "docid": "4390b77e6dfbfe57c4f55c71f63321b2", "score": "0.75492024", "text": "func MinInt(nums ...int) int {\n\tif len(nums) == 0 {\n\t\treturn 0\n\t}\n\tmin := nums[0]\n\tfor _, n := range nums[1:] {\n\t\tif n < min {\n\t\t\tmin = n\n\t\t}\n\t}\n\treturn min\n}", "title": "" }, { "docid": "b6102dedce63bce36c824a5270ec52a3", "score": "0.75422424", "text": "func min(ints ...int) int {\n\tif len(ints) == 0 {\n\t\tpanic(\"Cannot compute minimum of no elements\")\n\t}\n\tmin := ints[0]\n\tfor _, v := range ints {\n\t\tif v < min {\n\t\t\tmin = v\n\t\t}\n\t}\n\treturn min\n}", "title": "" } ]
68ca924aacc20c6dab8f98f298707969
GetDefaultAssertions return default assertions for type imap
[ { "docid": "0b8ffe88f74f915270194c9a15c25322", "score": "0.682499", "text": "func (Executor) GetDefaultAssertions() *venom.StepAssertions {\n\treturn &venom.StepAssertions{Assertions: []venom.Assertion{\"result.err ShouldBeEmpty\"}}\n}", "title": "" } ]
[ { "docid": "5ef2946fecd242a8eb94e90aac171f33", "score": "0.6612641", "text": "func DefaultNodeAssertions() NodeAssertions {\n\treturn NodeAssertions{\n\t\tast.KindAutoLink: func(t *testing.T, sa, sb []byte, a, b ast.Node) bool {\n\t\t\tna, nb := a.(*ast.AutoLink), b.(*ast.AutoLink)\n\t\t\treturn assert.Equal(t, na.AutoLinkType, nb.AutoLinkType) &&\n\t\t\t\tassert.Equal(t, na.Protocol, nb.Protocol) &&\n\t\t\t\tassert.Equal(t, na.Label(sa), nb.Label(sb))\n\t\t},\n\t\tast.KindEmphasis: func(t *testing.T, sa, sb []byte, a, b ast.Node) bool {\n\t\t\tna, nb := a.(*ast.Emphasis), b.(*ast.Emphasis)\n\t\t\treturn assert.Equal(t, na.Level, nb.Level)\n\t\t},\n\t\tast.KindFencedCodeBlock: func(t *testing.T, sa, sb []byte, a, b ast.Node) bool {\n\t\t\tna, nb := a.(*ast.FencedCodeBlock), b.(*ast.FencedCodeBlock)\n\t\t\treturn assert.Equal(t, na.Language(sa), nb.Language(sb))\n\t\t},\n\t\tast.KindHTMLBlock: func(t *testing.T, sa, sb []byte, a, b ast.Node) bool {\n\t\t\treturn assert.Equal(t, a.Text(sa), b.Text(sb))\n\t\t},\n\t\tast.KindHeading: func(t *testing.T, sa, sb []byte, a, b ast.Node) bool {\n\t\t\tna, nb := a.(*ast.Heading), b.(*ast.Heading)\n\t\t\treturn assert.Equal(t, na.Level, nb.Level)\n\t\t},\n\t\tast.KindImage: func(t *testing.T, sa, sb []byte, a, b ast.Node) bool {\n\t\t\tna, nb := a.(*ast.Image), b.(*ast.Image)\n\t\t\treturn assert.Equal(t, na.Destination, nb.Destination) &&\n\t\t\t\tassert.Equal(t, na.Title, nb.Title)\n\t\t},\n\t\tast.KindLink: func(t *testing.T, sa, sb []byte, a, b ast.Node) bool {\n\t\t\tna, nb := a.(*ast.Link), b.(*ast.Link)\n\t\t\treturn assert.Equal(t, na.ReferenceType, nb.ReferenceType) &&\n\t\t\t\tAssertEqualBytes(t, na.Label, nb.Label) &&\n\t\t\t\tAssertEqualBytes(t, na.Destination, nb.Destination) &&\n\t\t\t\tAssertEqualBytes(t, na.Title, nb.Title)\n\t\t},\n\t\tast.KindLinkReferenceDefinition: func(t *testing.T, sa, sb []byte, a, b ast.Node) bool {\n\t\t\tna, nb := a.(*ast.LinkReferenceDefinition), b.(*ast.LinkReferenceDefinition)\n\t\t\treturn AssertEqualBytes(t, na.Label, nb.Label) &&\n\t\t\t\tAssertEqualBytes(t, na.Destination, nb.Destination) &&\n\t\t\t\tAssertEqualBytes(t, na.Title, nb.Title)\n\t\t},\n\t\tast.KindList: func(t *testing.T, sa, sb []byte, a, b ast.Node) bool {\n\t\t\tna, nb := a.(*ast.List), b.(*ast.List)\n\t\t\treturn assert.Equal(t, na.Marker, nb.Marker) &&\n\t\t\t\tassert.Equal(t, na.Start, nb.Start) &&\n\t\t\t\tassert.Equal(t, na.IsTight, nb.IsTight)\n\t\t},\n\t\tast.KindRawHTML: func(t *testing.T, sa, sb []byte, a, b ast.Node) bool {\n\t\t\tna, nb := a.(*ast.RawHTML), b.(*ast.RawHTML)\n\t\t\treturn assert.Equal(t, na.Text(sa), nb.Text(sb))\n\t\t},\n\t\tast.KindString: func(t *testing.T, sa, sb []byte, a, b ast.Node) bool {\n\t\t\tna, nb := a.(*ast.String), b.(*ast.String)\n\t\t\treturn assert.Equal(t, na.Value, nb.Value) &&\n\t\t\t\tassert.Equal(t, na.IsRaw(), nb.IsRaw())\n\t\t},\n\t\tast.KindText: func(t *testing.T, sa, sb []byte, a, b ast.Node) bool {\n\t\t\tna, nb := a.(*ast.Text), b.(*ast.Text)\n\t\t\treturn assert.Equal(t, na.Text(sa), nb.Text(sb)) &&\n\t\t\t\tassert.Equal(t, na.SoftLineBreak(), nb.SoftLineBreak()) &&\n\t\t\t\tassert.Equal(t, na.HardLineBreak(), nb.HardLineBreak()) &&\n\t\t\t\tassert.Equal(t, na.IsRaw(), nb.IsRaw())\n\t\t},\n\t\tast.KindWhitespace: func(t *testing.T, sa, sb []byte, a, b ast.Node) bool {\n\t\t\tna, nb := a.(*ast.Whitespace), b.(*ast.Whitespace)\n\t\t\treturn AssertEqualBytes(t, na.Segment.Value(sa), nb.Segment.Value(sb))\n\t\t},\n\t\tast.KindBlockquote: assertNodeNoop,\n\t\tast.KindCodeBlock: assertNodeNoop,\n\t\tast.KindCodeSpan: assertNodeNoop,\n\t\tast.KindDocument: assertNodeNoop,\n\t\tast.KindListItem: assertNodeNoop,\n\t\tast.KindParagraph: assertNodeNoop,\n\t\tast.KindTextBlock: assertNodeNoop,\n\t\tast.KindThematicBreak: assertNodeNoop,\n\t}\n}", "title": "" }, { "docid": "b22a2384ba4bff4b02f19b54782b2009", "score": "0.5587984", "text": "func (ts TestStep) GetAssertions() []string {\n\tvar validAssertions []string\n\n\tfor _, ass := range ts.Assertion {\n\t\tif ass.Type == \"Simple Contains\" {\n\t\t\tvalidAssertions = append(validAssertions, ass.Token)\n\t\t}\n\t}\n\treturn validAssertions\n}", "title": "" }, { "docid": "0cef734394388f3cc84b468b81459ab4", "score": "0.5419854", "text": "func (req Request) GetAssertions() []string {\n\tvar validAssertions []string\n\n\tfor _, ass := range req.Assertion {\n\t\tif ass.Type == \"Simple Contains\" {\n\t\t\tvalidAssertions = append(validAssertions, ass.Token)\n\t\t}\n\t}\n\treturn validAssertions\n}", "title": "" }, { "docid": "4277846aeea3b9523415e6270efc6a05", "score": "0.53964424", "text": "func (o *SyntheticsBrowserTestConfig) GetAssertions() []SyntheticsAssertion {\n\tif o == nil {\n\t\tvar ret []SyntheticsAssertion\n\t\treturn ret\n\t}\n\treturn o.Assertions\n}", "title": "" }, { "docid": "62d05786796d2f5ceeeaf104a2fc1c8e", "score": "0.5378961", "text": "func typeAssertExpr() {\n\tm := map[bool]interface{}{}\n\n\t_ = m[11 != 0].(int)\n}", "title": "" }, { "docid": "ba02cfab5426c4d27befbeff7374d552", "score": "0.5348099", "text": "func TestTypeAssertion(t *testing.T) {\n\ttestAssertE2TOk(t)\n\ttestAssertE2TPanic(t)\n\ttestAssertI2TOk(t)\n\ttestAssertI2TPanic(t)\n\ttestAssertE2T2(t)\n\ttestAssertI2T2(t)\n}", "title": "" }, { "docid": "b60cc9d5abcf598838ae8a19ce2ab0c4", "score": "0.5295285", "text": "func (o *SyntheticsBrowserTestConfig) GetAssertionsOk() (*[]SyntheticsAssertion, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Assertions, true\n}", "title": "" }, { "docid": "931989ec9352e263c25581b7c20608fe", "score": "0.5261907", "text": "func Assert(t *testing.T) *Assertion {\n\treturn &Assertion{t}\n}", "title": "" }, { "docid": "60758902239a0ebe9db89a833c005191", "score": "0.525125", "text": "func TypeAssertionExample() {\n\tvar i interface{} = \"hello\"\n\n\ts := i.(string)\n\tfmt.Println(s)\n\n\ts, ok := i.(string)\n\tfmt.Println(s, ok)\n\n\tf, ok := i.(float64)\n\tfmt.Println(f, ok)\n\n\tf = i.(float64) // panic\n\tfmt.Println(f)\n}", "title": "" }, { "docid": "68430b345e354d47fb918b484e978b4d", "score": "0.5247134", "text": "func GenerateAssertions(out interface{}, shape *api.Shape, prefix string) string {\n\tif shape == nil {\n\t\treturn \"\"\n\t}\n\tswitch t := out.(type) {\n\tcase map[string]interface{}:\n\t\tkeys := util.SortedKeys(t)\n\n\t\tcode := \"\"\n\t\tif shape.Type == \"map\" {\n\t\t\tfor _, k := range keys {\n\t\t\t\tv := t[k]\n\t\t\t\ts := shape.ValueRef.Shape\n\t\t\t\tcode += GenerateAssertions(v, s, prefix+\"[\\\"\"+k+\"\\\"]\")\n\t\t\t}\n\t\t} else if shape.Type == \"jsonvalue\" {\n\t\t\tcode += fmt.Sprintf(\"reflect.DeepEqual(%s, map[string]interface{}%s)\\n\", prefix, walkMap(out.(map[string]interface{})))\n\t\t} else {\n\t\t\tfor _, k := range keys {\n\t\t\t\tv := t[k]\n\t\t\t\tm := findMember(shape, k)\n\t\t\t\ts := shape.MemberRefs[m].Shape\n\t\t\t\tcode += GenerateAssertions(v, s, prefix+\".\"+m+\"\")\n\t\t\t}\n\t\t}\n\t\treturn code\n\tcase []interface{}:\n\t\tcode := \"\"\n\t\tfor i, v := range t {\n\t\t\ts := shape.MemberRef.Shape\n\t\t\tcode += GenerateAssertions(v, s, prefix+\"[\"+strconv.Itoa(i)+\"]\")\n\t\t}\n\t\treturn code\n\tdefault:\n\t\tswitch shape.Type {\n\t\tcase \"timestamp\":\n\t\t\treturn fmtAssertEqual(\n\t\t\t\tfmt.Sprintf(\"time.Unix(%#v, 0).UTC().String()\", out),\n\t\t\t\tfmt.Sprintf(\"%s.UTC().String()\", prefix),\n\t\t\t)\n\t\tcase \"blob\":\n\t\t\treturn fmtAssertEqual(\n\t\t\t\tfmt.Sprintf(\"%#v\", out),\n\t\t\t\tfmt.Sprintf(\"string(%s)\", prefix),\n\t\t\t)\n\t\tcase \"integer\", \"long\":\n\t\t\treturn fmtAssertEqual(\n\t\t\t\tfmt.Sprintf(\"int64(%#v)\", out),\n\t\t\t\tfmt.Sprintf(\"*%s\", prefix),\n\t\t\t)\n\t\tdefault:\n\t\t\tif !reflect.ValueOf(out).IsValid() {\n\t\t\t\treturn fmtAssertNil(prefix)\n\t\t\t}\n\t\t\treturn fmtAssertEqual(\n\t\t\t\tfmt.Sprintf(\"%#v\", out),\n\t\t\t\tfmt.Sprintf(\"*%s\", prefix),\n\t\t\t)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9fc770ddfdae07a510b1b9276dbce4a9", "score": "0.5158929", "text": "func Assert(t *testing.T) assert {\n\treturn assert{t, t.FailNow}\n}", "title": "" }, { "docid": "97d782cf0baadf6e665fb8190bef5134", "score": "0.51334155", "text": "func New(t *testing.T) *Assertions {\n\treturn &Assertions{require.New(t)}\n}", "title": "" }, { "docid": "6c395b9eb98a3a191965d5ddb7124065", "score": "0.5125871", "text": "func (c *LookupCommand) GetDefaultMatchers() []string {\n\tdefaultMatchers := []string{\"^([T|D][0-9]{1,16})$\"}\n\treturn defaultMatchers\n}", "title": "" }, { "docid": "daf640e0d9fc2b08718a16df68a0960b", "score": "0.5114606", "text": "func TestAssert(t *testing.T) {\n T := new(testing.T) // Stub\n\n Go(T).Assert(true)\n if T.Failed() {\n t.Error(\"Assert should not have failed.\")\n }\n\n T = new(testing.T) // Stub\n Go(T).Assert(true, \"should assert\")\n if T.Failed() {\n t.Error(\"Assert should not have failed.\")\n }\n\n T = new(testing.T) // Stub\n Go(T).Assert(1 == 1)\n if T.Failed() {\n t.Error(\"Assert should not have failed.\")\n }\n\n T = new(testing.T) // Stub\n Go(T).Assert(\"a\" == \"a\")\n if T.Failed() {\n t.Error(\"Assert should not have failed.\")\n }\n\n T = new(testing.T) // Stub\n Go(T).Assert(false)\n if !T.Failed() {\n t.Error(\"Assert should have failed.\")\n }\n\n T = new(testing.T) // Stub\n Go(T).Assert(1 != 1)\n if !T.Failed() {\n t.Error(\"Assert should have failed.\")\n }\n}", "title": "" }, { "docid": "109e8780ec7931c4534e3a993138eb8a", "score": "0.50949293", "text": "func New(t *testing.T) *Assertions {\n\treturn &Assertions{assert.New(t)}\n}", "title": "" }, { "docid": "e3a42916b1fe05fa18e94092ea56b6ee", "score": "0.5044427", "text": "func Assert(t testing.TB) (Eq, Ok, No) {\n\teq := func(actual, expected interface{}) {\n\t\tif !reflect.DeepEqual(expected, actual) {\n\t\t\t_, file, line, _ := runtime.Caller(1)\n\t\t\tfmt.Printf(\"%s:%d:\\n\\nwant: %#v\\n\\ngot: %#v\\n\\n\", filepath.Base(file), line, expected, actual)\n\t\t\tt.FailNow()\n\t\t}\n\t}\n\n\tok := func(cond bool, v ...interface{}) {\n\t\tif !cond {\n\t\t\t_, file, line, _ := runtime.Caller(1)\n\t\t\tvar msg string\n\t\t\tif len(v) > 0 {\n\t\t\t\tmsg = fmt.Sprintf(\"%v\", v)\n\t\t\t} else {\n\t\t\t\tmsg = \"fail\"\n\t\t\t}\n\t\t\tfmt.Printf(\"%s:%d: %v\\n\\n\", filepath.Base(file), line, msg)\n\t\t\tt.FailNow()\n\t\t}\n\t}\n\n\tno := func(err error) {\n\t\tif err != nil {\n\t\t\t_, file, line, _ := runtime.Caller(1)\n\t\t\tfmt.Printf(\"%s:%d: unexpected: %s\\n\\n\", filepath.Base(file), line, err.Error())\n\t\t\tt.FailNow()\n\t\t}\n\t}\n\n\treturn eq, ok, no\n}", "title": "" }, { "docid": "388c1e78deb9f5619a3abbfe0af82279", "score": "0.50378734", "text": "func NewAssert(t *testing.T) *assert.Assertions {\n\tt.Helper()\n\n\tif isParallel {\n\t\tt.Parallel()\n\t}\n\n\tassert := assert.New(t)\n\treturn assert\n}", "title": "" }, { "docid": "a7d6e81bcc0c20a587c58bdf18c11862", "score": "0.50276273", "text": "func (t FluentT) AssertThat(actual interface{}) AssertableAny {\n\treturn That(t.t, actual)\n}", "title": "" }, { "docid": "05174d65931173bb106499e6b88da5c5", "score": "0.50062", "text": "func New(t TestingT) *Assertions {\n\treturn &Assertions{\n\t\tt: t,\n\t}\n}", "title": "" }, { "docid": "3e0444a108d9d44bc814c8486affc627", "score": "0.49663636", "text": "func New() *Assert {\n\treturn &Assert{\n\t\tJSONEncoderFunc: newJSONEncoder,\n\t\tJSONDecoderFunc: newJSONDecoder,\n\t\tYAMLEncoderFunc: newYAMLEncoder,\n\t\tYAMLDecoderFunc: newYAMLDecoder,\n\t\tXMLEncoderFunc: newXMLEncoder,\n\t\tXMLDecoderFunc: newXMLDecoder,\n\t\tGolden: golden.New(),\n\t\tNormalizeLineBreaks: true,\n\t}\n}", "title": "" }, { "docid": "b0c8ee09f93c6555677ea0334d6bfb44", "score": "0.49605134", "text": "func NewAssert(t *testing.T) *Assert {\n\ta := cs.NewAssert(t)\n\treturn &Assert{a.Assertions, a, fuzz.New()}\n}", "title": "" }, { "docid": "06387bd8204229ca57d96e4bba478cb2", "score": "0.49380875", "text": "func NewAssert(t *testing.T) *Assert {\n\treturn &Assert{require.New(t)}\n}", "title": "" }, { "docid": "7edbbc093d815a45b4dc84395ac5da78", "score": "0.49223384", "text": "func assertionsToTraitMap(assertionInfo saml2.AssertionInfo) map[string][]string {\n\ttraits := make(map[string][]string)\n\n\tfor _, assr := range assertionInfo.Values {\n\t\tvar vals []string\n\t\tfor _, value := range assr.Values {\n\t\t\tvals = append(vals, value.Value)\n\t\t}\n\t\ttraits[assr.Name] = vals\n\t}\n\n\treturn traits\n}", "title": "" }, { "docid": "5eb4138f3238db050ab922780bf932dd", "score": "0.49152443", "text": "func assertion() {\n\tvar i Printable = &Point{1,2}\n\tp, ok := i.(*Point)\n\tfmt.Println(p, ok) // &{1 2} true\n\n\tvar ii interface{} = \"hello\"\n\t//s := ii.(float64) // panic, if 2nd return val not captured\n\ts,_ := ii.(float64)\n\tfmt.Println(s) // 0 (float64 zero-val)\n\n\t// Use to check type\n\tdo(ii)\n}", "title": "" }, { "docid": "3b338d7e49d247d11033164d1a351ace", "score": "0.4912485", "text": "func AssertMapsEqual(t *testing.T, expected, actual interface{}) {\n\texpValue, actValue := reflect.ValueOf(expected), reflect.ValueOf(actual)\n\tekind, akind := expValue.Kind(), actValue.Kind()\n\tif ekind != reflect.Map && akind != reflect.Map {\n\t\tassert.Fail(t, fmt.Sprintf(\"Type error: Both arguments are not Maps \\nexpected: %+v\\nactual : %+v\", ekind, akind))\n\t} else if ekind != reflect.Map {\n\t\tassert.Fail(t, fmt.Sprintf(\"Type error: expected argument is not a a Map \\nexpected: %+v\", ekind))\n\t} else if akind != reflect.Map {\n\t\tassert.Fail(t, fmt.Sprintf(\"Type error: second argument is not a Map \\nactual : %+v\", akind))\n\t} else if assert.Equal(t, expValue.Len(), actValue.Len()) {\n\t\tfor _, key := range expValue.MapKeys() {\n\t\t\tif assert.True(t, actValue.MapIndex(key).IsValid(), \"Key %v is missing in actual:%v\", key, actValue.MapKeys()) {\n\t\t\t\tAssertMessagesEqual(t, expValue.MapIndex(key).Interface(), actValue.MapIndex(key).Interface())\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0064d53ebd611935822c69e65ceebce9", "score": "0.48858145", "text": "func TestToMap(t *testing.T) {\n\ttestName := \"TestToMap\"\n\n\ttestCases := []struct {\n\t\tname string\n\t\tinput interface{}\n\t\texpected interface{}\n\t\ttyp reflect.Type\n\t\tnonZeroMode bool\n\t}{\n\t\t{\"all_nil\", nil, nil, nil, true},\n\t\t{\"nil_input\", nil, nil, reflect.TypeOf(map[string]interface{}{}), true},\n\t\t{\"nil_type\", map[string]bool{\"1\": true, \"0\": false}, nil, nil, true},\n\t\t{\"map[int]bool -> map[string]interface\", map[int]bool{1: true, 0: false}, map[string]interface{}{\"1\": true, \"0\": false}, reflect.TypeOf(map[string]interface{}{}), true},\n\t\t{\"map[int]interface -> map[string]interface\", map[int]interface{}{0: false, 1: \"one\", 2: 2}, map[string]interface{}{\"0\": false, \"1\": \"one\", \"2\": 2}, reflect.TypeOf(map[string]interface{}{}), true},\n\t\t{\"map[string]bool -> map[int]string\", map[string]bool{\"1\": true, \"0\": false}, map[int]string{0: \"false\", 1: \"true\"}, reflect.TypeOf(map[int]string{}), true},\n\t\t{\"nil_value\", map[string]interface{}{\"k1\": \"value 1\", \"k2\": 1, \"k3\": true, \"k4\": nil}, map[string]string{\"k1\": \"value 1\", \"k2\": \"1\", \"k3\": \"true\", \"k4\": \"\"}, reflect.TypeOf(map[string]string{}), false},\n\t\t{\"nil_key\", map[interface{}]string{\"value 1\": \"k1\", 1.2: \"k2\", false: \"k3\", nil: \"k4\"}, map[string]string{\"value 1\": \"k1\", \"1.2\": \"k2\", \"false\": \"k3\", \"\": \"k4\"}, reflect.TypeOf(map[string]string{}), false},\n\t}\n\tfor _, tc := range testCases {\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\tZeroMode = true\n\t\t\ttestToMap(t, tc.input, tc.expected, tc.typ)\n\t\t\tif tc.nonZeroMode {\n\t\t\t\tZeroMode = false\n\t\t\t\ttestToMap(t, tc.input, tc.expected, tc.typ)\n\t\t\t}\n\t\t})\n\t}\n\n\t{\n\t\tZeroMode = true\n\t\ttypeMap := reflect.TypeOf(map[string]interface{}{})\n\t\tnow := time.Now()\n\t\ttestToMap(t,\n\t\t\tmap[interface{}]interface{}{0: false, \"1\": \"one\", 2: 2, \"3\": now, nil: \"nil key\",\n\t\t\t\t\"map\": map[string]interface{}{\"true\": true, \"false\": \"false\", \"nil\": nil}, \"mapnil\": nil,\n\t\t\t\t\"list\": []interface{}{1, \"2\", true, nil}, \"listnil\": nil},\n\t\t\tmap[string]interface{}{\"0\": false, \"1\": \"one\", \"2\": 2, \"3\": now, \"\": \"nil key\",\n\t\t\t\t\"map\": map[string]interface{}{\"true\": true, \"false\": \"false\", \"nil\": nil}, \"mapnil\": nil,\n\t\t\t\t\"list\": []interface{}{1, \"2\", true, nil}, \"listnil\": nil},\n\t\t\ttypeMap)\n\n\t\tZeroMode = false\n\t\tinput := map[interface{}]interface{}{0: false, \"1\": \"one\", 2: 2, \"3\": now, nil: \"nil key\",\n\t\t\t\"map\": map[string]interface{}{\"true\": true, \"false\": \"false\", \"nil\": nil}, \"mapnil\": nil,\n\t\t\t\"list\": []interface{}{1, \"2\", true, nil}, \"listnil\": nil}\n\t\t_, err := ToMap(input, typeMap)\n\t\tif err == nil {\n\t\t\tt.Fatalf(\"%s failed: input %#v should result error\", testName, input)\n\t\t}\n\t}\n\n\t{\n\t\tinput := map[string]bool{\"one\": true, \"0\": false}\n\t\t_, e := ToMap(input, reflect.TypeOf(map[int]string{}))\n\t\tif e == nil {\n\t\t\tt.Fatalf(\"%s failed: [%#v] should not be convertible to map[int]string!\", testName, input)\n\t\t}\n\t}\n\t{\n\t\tinput := map[bool]string{true: \"1\", false: \"zero\"}\n\t\t_, e := ToMap(input, reflect.TypeOf(map[bool]int{}))\n\t\tif e == nil {\n\t\t\tt.Fatalf(\"%s failed: [%#v] should not be convertible to map[bool]int!\", testName, input)\n\t\t}\n\t}\n\t{\n\t\tinput := \"\"\n\t\t_, e := ToMap(input, reflect.TypeOf(map[int]string{}))\n\t\tif e == nil {\n\t\t\tt.Fatalf(\"%s failed: [%#v] should not be convertible to map!\", testName, input)\n\t\t}\n\t}\n\t{\n\t\tinput := \"\"\n\t\t_, e := Convert(input, reflect.TypeOf(map[int]string{}))\n\t\tif e == nil {\n\t\t\tt.Fatalf(\"%s failed: [%#v] should not be convertible to map!\", testName, input)\n\t\t}\n\t}\n\t{\n\t\tinput := map[string]bool{\"1\": true, \"0\": false}\n\t\t_, e := ToMap(input, TypeString)\n\t\tif e == nil {\n\t\t\tt.Fatalf(\"%s failed: [%#v] should not be convertible to string!\", testName, input)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ef76cde659daf9455f62efce2b58dcbb", "score": "0.4882973", "text": "func typeAssertion() {\n\tvar i interface{} = 1\n\tfmt.Println(i)\n\tj := i.(int)\n\tfmt.Println(j)\n\tj = 2\n\tfmt.Println(i)\n}", "title": "" }, { "docid": "d00e2ce59641697925124b47c4987087", "score": "0.4850161", "text": "func DefaultVerifier(keySetProvider jwk.KeySetProviderFunc, supportedAlgorithms []string) Verifier {\n\treturn &defaultVerifier{\n\t\tkeySetProvider: keySetProvider,\n\t\tsupportedAlgorithms: types.StringArray(supportedAlgorithms),\n\t}\n}", "title": "" }, { "docid": "e063e289208ec8d73d60fefd737a94e4", "score": "0.48448962", "text": "func New(teste *testing.T) func(i interface{}) Info {\n\tt = teste\n\treturn valueToAssert\n}", "title": "" }, { "docid": "66c5306ebdfcff657166bced3dd92cfe", "score": "0.48406658", "text": "func New(t TestingT) *Assertions {\n\trequire := require.New(t)\n\treturn &Assertions{\n\t\tAssertions: require,\n\t\tt: t,\n\t}\n}", "title": "" }, { "docid": "80194a694fe4b2263d7015a30bc3bcdd", "score": "0.48143086", "text": "func (suite *attrCacheTestSuite) TestDefault() {\n\tdefer suite.cleanupTest()\n\tsuite.assert.Equal(suite.attrCache.Name(), \"attr_cache\")\n\tsuite.assert.EqualValues(suite.attrCache.cacheTimeout, 120)\n\tsuite.assert.Equal(suite.attrCache.cacheOnList, true)\n\tsuite.assert.Equal(suite.attrCache.noSymlinks, false)\n}", "title": "" }, { "docid": "8f33064701949530c32a03a7159fc8a0", "score": "0.4772117", "text": "func TestDefaultLoggerConfigValidation(t *testing.T) {\n\t// Tests.\n\tvar tests = []struct {\n\t\tconfig *Config\n\t\texpected string\n\t}{\n\t\t{\t&Config{}, \n\t\t\t\"No default logger was defined.\",\n\t\t},\n\t\t{\n\t\t\t&Config{\n\t\t\t\tDefaultLogger: &LogConfig{}, \n\t\t\t},\n\t\t\t\"The type of the default logger was not defined.\",\n\t\t},\n\t\t{\n\t\t\t&Config{\n\t\t\t\tDefaultLogger: &LogConfig{Type: \"\"}, \n\t\t\t},\n\t\t\t\"The type of the default logger was not defined.\",\n\t\t},\n\t\t{\n\t\t\t&Config{\n\t\t\t\tDefaultLogger: &LogConfig{Type: \"unsupported\"}, \n\t\t\t},\n\t\t\t\"The type of the default logger 'unsupported' was invalid.\",\n\t\t},\t\t\n\t}\n\t// Run tests.\n\tfor _, test := range tests {\n\t\tf := func() {\n \t\ttest.config.validate()\n\t\t}\n\t\tassert.Panics(t, f)\n\t\tassert.PanicsWithValue(t, test.expected, f)\n\t}\n}", "title": "" }, { "docid": "d5f6516475cf12f7569565f6b8b31a5d", "score": "0.4764029", "text": "func (g *Group) Assert(typ Code) *Statement {\n\ts := Assert(typ)\n\tg.items = append(g.items, s)\n\treturn s\n}", "title": "" }, { "docid": "7efd935f2997faeb557a3ea489202c2d", "score": "0.47078374", "text": "func assertNonZero(t *testing.T, i interface{}) {\n\t_assertNonZero(t, i, reflect.ValueOf(i).Type().Name())\n}", "title": "" }, { "docid": "165c24cee8e172c7be77ac0624397933", "score": "0.4703025", "text": "func GetAssertion() *Assertion {\n\treturn &Assertion{\n\t\tContent: object.AllObjects(),\n\t\tContext: globalContext,\n\t\tSubjectName: testSubjectName,\n\t\tSubjectZone: testZone,\n\t}\n}", "title": "" }, { "docid": "e8fc1224ba6810bf589baadd19f306f5", "score": "0.47010332", "text": "func (s *Statement) Assert(typ Code) *Statement {\n\tg := &Group{\n\t\tclose: \")\",\n\t\titems: []Code{typ},\n\t\tmulti: false,\n\t\tname: \"assert\",\n\t\topen: \".(\",\n\t\tseparator: \"\",\n\t}\n\t*s = append(*s, g)\n\treturn s\n}", "title": "" }, { "docid": "35ad9c9afe9d326be608d830f69e01b8", "score": "0.46733597", "text": "func TestCheckBinaryNonConstExprInterfaceXGtrMap(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := interfaceX(nil); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := mapT{}; env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a > b`, env,\n\t\t`invalid operation: a > b (mismatched types eval.interfaceX and eval.mapT)`,\n\t)\n\n}", "title": "" }, { "docid": "7ed7acc16010ca16facd14b67851e354", "score": "0.46636432", "text": "func commonEnvelopeValidations(\n\tt *testing.T,\n\tspan ptrace.Span,\n\tenvelope *contracts.Envelope,\n\texpectedEnvelopeName string) {\n\n\tassert.NotNil(t, envelope)\n\tassert.Equal(t, expectedEnvelopeName, envelope.Name)\n\tassert.Equal(t, toTime(span.StartTimestamp()).Format(time.RFC3339Nano), envelope.Time)\n\tassert.Equal(t, defaultTraceIDAsHex, envelope.Tags[contracts.OperationId])\n\tassert.Equal(t, defaultParentSpanIDAsHex, envelope.Tags[contracts.OperationParentId])\n\tassert.Equal(t, defaultServiceNamespace+\".\"+defaultServiceName, envelope.Tags[contracts.CloudRole])\n\tassert.Equal(t, defaultServiceInstance, envelope.Tags[contracts.CloudRoleInstance])\n\tassert.NotNil(t, envelope.Data)\n\n\tif expectedEnvelopeName == defaultRequestDataEnvelopeName {\n\t\trequestData := envelope.Data.(*contracts.Data).BaseData.(*contracts.RequestData)\n\t\tassert.Equal(t, requestData.Name, envelope.Tags[contracts.OperationName])\n\t}\n}", "title": "" }, { "docid": "8425a60fe33ed340013bf19d601b7789", "score": "0.46315017", "text": "func (tbl *TableInfo) AssertBaseTable() {}", "title": "" }, { "docid": "0179b632715ba46e446c6c07a0a39767", "score": "0.46277517", "text": "func Assert(expected interface{}, actual interface{}) {\n\tif expected != actual {\n\t\tpanic(fmt.Sprintf(\"%v not equal to %v\", expected, actual))\n\t}\n}", "title": "" }, { "docid": "ec32d4313057914e941d59822da7558c", "score": "0.46248937", "text": "func TestCheckBinaryNonConstExprInterfaceYGtrMap(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := interfaceY(nil); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := mapT{}; env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a > b`, env,\n\t\t`invalid operation: a > b (mismatched types eval.interfaceY and eval.mapT)`,\n\t)\n\n}", "title": "" }, { "docid": "dafc1fb0a0c4bf6f4a484a2e9bf6e12e", "score": "0.4613283", "text": "func TestCheckBinaryNonConstExprInterfaceYEqlMap(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := interfaceY(nil); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := mapT{}; env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a == b`, env,\n\t\t`invalid operation: a == b (mismatched types eval.interfaceY and eval.mapT)`,\n\t)\n\n}", "title": "" }, { "docid": "cc587a6d93abdf8c9c58b79acd77a85c", "score": "0.4588752", "text": "func (a *Alarm) Assert(t *testing.T, alarms ...*cloudwatch.MetricAlarm) *Alarm {\n\tvar err error\n\talarms, err = a.filter(alarms)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tswitch l := len(alarms); {\n\tcase l == 0:\n\t\tt.Fatal(\"no matching alarm was found\")\n\tcase l > 1:\n\t\tt.Fatal(\"more than one matching alarm was found\")\n\tdefault:\n\t\ta.alarm = alarms[0]\n\t}\n\n\ta.filters = []shared.Filter{}\n\treturn a\n}", "title": "" }, { "docid": "9e99ef1f3666566d4e1fec25cca3fa83", "score": "0.45781896", "text": "func printInterfaceAssertion(w io.Writer, mes *Message, name string, stream bool) {\n\tvar typ string\n\tif stream {\n\t\ttyp = \"pbs.StreamMessage\"\n\t} else {\n\t\ttyp = \"proto.Message\"\n\t}\n\tfmt.Fprintf(w, \"var _ %s = (*%s)(nil)\\n\\n\", typ, name)\n}", "title": "" }, { "docid": "55078b5a8e8a34530261c79e0a59497d", "score": "0.45726496", "text": "func AssertEquivalent(t *testing.T, actual interface{}, expected interface{}) {\n\n\tassert := assert.New(t)\n\n\tvalExpected := reflect.ValueOf(expected)\n\tvalActual := reflect.ValueOf(actual)\n\ttp := reflect.ValueOf(expected).Elem().Type()\n\n\tfor i := 0; i < tp.NumField(); i++ {\n\t\tfld := tp.Field(i)\n\t\tcolumn := fld.Tag.Get(\"col\")\n\t\tif column == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tif column == \"id\" {\n\t\t\tcontinue\n\t\t}\n\t\tfldExpected := valExpected.Elem().FieldByIndex(fld.Index).Addr().Interface()\n\t\tfldActual := valActual.Elem().FieldByIndex(fld.Index).Addr().Interface()\n\t\tswitch fldExpected.(type) {\n\t\tcase *string:\n\t\t\te := fldExpected.(*string)\n\t\t\ta := fldActual.(*string)\n\t\t\tassert.Equal(a, e)\n\t\tcase *bool:\n\t\t\te := fldExpected.(*bool)\n\t\t\ta := fldActual.(*bool)\n\t\t\tassert.Equal(a, e)\n\t\tcase *time.Time:\n\t\t\te := fldExpected.(*time.Time)\n\t\t\ta := fldActual.(*time.Time)\n\t\t\tassert.True(a.Equal(*e))\n\t\tcase **time.Time:\n\t\t\te := fldExpected.(**time.Time)\n\t\t\ta := fldActual.(**time.Time)\n\t\t\tassert.True((*a).Equal(**e))\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "eead96a467709ae4e70b37c500715f76", "score": "0.4569747", "text": "func TestCheckBinaryNonConstExprInterfaceXEqlMap(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := interfaceX(nil); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := mapT{}; env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a == b`, env,\n\t\t`invalid operation: a == b (mismatched types eval.interfaceX and eval.mapT)`,\n\t)\n\n}", "title": "" }, { "docid": "ab5834d18553ff4ce0520d3330508c36", "score": "0.4564013", "text": "func (ha *HTMLAsserter) AssertAll(selector string) *HTMLAsserter {\n\tsel := ha.Selection.Find(selector)\n\tif sel.Length() < 1 {\n\t\tha.fail.Fatalf(\"selector '%s' didn't yield anything\", selector)\n\t}\n\n\treturn &HTMLAsserter{\n\t\tSelection: sel,\n\t\tra: ha.ra,\n\t\tdoc: ha.doc,\n\t\tfail: ha.fail.Copy().WithHTML(sel),\n\t}\n}", "title": "" }, { "docid": "24c17b4c0b5a5d517894694a05da2df7", "score": "0.4546361", "text": "func AssertZero(t testRunner, value any, msg ...any) {\n\tif test, ok := t.(helper); ok {\n\t\ttest.Helper()\n\t}\n\n\tif !assert.Zero(value) {\n\t\tinternal.Fail(t, \"An object that !!should have its zero value!!, does not have its zero value.\", internal.NewObjectsSingleUnknown(value), msg...)\n\t}\n}", "title": "" }, { "docid": "3babccc2e26fe06e1e5d3e054e02c280", "score": "0.4529943", "text": "func (r *ResolverGenerator) mustAssertToKnownTypes(paramName string) jen.Code {\n\tc := jen.Empty()\n\tfor _, t := range r.types {\n\t\tc = c.Case(\n\t\t\tjen.Func().Parens(\n\t\t\t\tjen.List(\n\t\t\t\t\tjen.Qual(\"context\", \"Context\"),\n\t\t\t\t\tjen.Qual(t.PublicPackage().Path(), t.InterfaceName()),\n\t\t\t\t),\n\t\t\t).Error(),\n\t\t).Block(\n\t\t\tjen.Commentf(\"Do nothing, this callback has a correct signature.\"),\n\t\t).Line()\n\t}\n\tc = c.Default().Block(\n\t\tjen.Return(\n\t\t\tjen.Nil(),\n\t\t\tjen.Qual(\"errors\", \"New\").Call(jen.Lit(\"a callback function is of the wrong signature and would never be called\")),\n\t\t),\n\t)\n\treturn c\n}", "title": "" }, { "docid": "be36e7d0d69da875aaf1bb847b076d61", "score": "0.45289493", "text": "func (o *SyntheticsBrowserTestConfig) SetAssertions(v []SyntheticsAssertion) {\n\to.Assertions = v\n}", "title": "" }, { "docid": "c328b05dc95772c69e16a042a5a39592", "score": "0.45277947", "text": "func testDefaultPathAll(t *testing.T) {\n\ttestDefaultPath(false, false, t)\n\ttestDefaultPath(false, true, t)\n\ttestDefaultPath(true, false, t)\n\ttestDefaultPath(true, true, t)\n}", "title": "" }, { "docid": "3cae212f71e72bcb2abea7197b9fd6b3", "score": "0.4526624", "text": "func checkDefaultCollection(t *testing.T, ro col.ReadOnlyCollection, diff RowDiff) {\n\texpected := map[string]string{}\n\tfor _, id := range idRange(0, defaultCollectionSize) {\n\t\texpected[id] = originalValue\n\t}\n\tif diff.Deleted != nil {\n\t\tfor _, id := range diff.Deleted {\n\t\t\t_, ok := expected[id]\n\t\t\trequire.True(t, ok, \"test specified a deleted row that was not in the original set\")\n\t\t\tdelete(expected, id)\n\t\t}\n\t}\n\tif diff.Changed != nil {\n\t\tfor _, id := range diff.Changed {\n\t\t\t_, ok := expected[id]\n\t\t\trequire.True(t, ok, \"test specified a changed row that was not in the original set\")\n\t\t\texpected[id] = changedValue\n\t\t}\n\t}\n\tif diff.Created != nil {\n\t\tfor _, id := range diff.Created {\n\t\t\t_, ok := expected[id]\n\t\t\trequire.False(t, ok, \"test specified an added row that was already in the original set\")\n\t\t\texpected[id] = changedValue\n\t\t}\n\t}\n\tcheckCollection(t, ro, expected)\n}", "title": "" }, { "docid": "92e85003c18ab6df2b20c1e5ec31f11f", "score": "0.45221588", "text": "func TestCheckBinaryNonConstExprMapEqlInterfaceX(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := mapT{}; env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := interfaceX(nil); env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a == b`, env,\n\t\t`invalid operation: a == b (mismatched types eval.mapT and eval.interfaceX)`,\n\t)\n\n}", "title": "" }, { "docid": "21f623736653feb34043ccb616c27ddb", "score": "0.4521268", "text": "func assert(t *testing.T, ok bool, msg ...interface{}) {\n\tif !ok {\n\t\tt.Error(msg...)\n\t}\n}", "title": "" }, { "docid": "53f42b438295f84f046a9fce102858df", "score": "0.4512905", "text": "func TestCheckBinaryNonConstExprInterfaceZEqlMap(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := interfaceZ(nil); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := mapT{}; env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a == b`, env,\n\t\t`invalid operation: a == b (mismatched types eval.interfaceZ and eval.mapT)`,\n\t)\n\n}", "title": "" }, { "docid": "568f88599c14e4f906db4b7aedf57036", "score": "0.44994214", "text": "func getDefaultFunctions() template.FuncMap {\n\tanswer := sprig.TxtFuncMap()\n\n\t// add extra functionality\n\tanswer[\"toToml\"] = files.ToToml\n\tanswer[\"toYaml\"] = files.ToYaml\n\tanswer[\"fromYaml\"] = files.FromYaml\n\tanswer[\"toJson\"] = files.ToJson\n\tanswer[\"fromJson\"] = files.FromJson\n\tanswer[\"indexOrDefault\"] = indexOrDefault\n\n\t// add functions that sprig doesn't implement cross-platform (that don't work on windows)\n\tanswer[\"filebase\"] = filepath.Base\n\tanswer[\"filedir\"] = filepath.Dir\n\tanswer[\"fileclean\"] = filepath.Clean\n\tanswer[\"fileext\"] = filepath.Ext\n\n\treturn answer\n}", "title": "" }, { "docid": "a33e1a950395882416f8b5f627b9dea8", "score": "0.44992012", "text": "func assert(expected, actual interface{}, t *testing.T) {\n\tt.Helper()\n\tif !reflect.DeepEqual(expected, actual) {\n\t\tt.Fatalf(\"%s: expected: %#[2]v (%[2]T), but got %#[3]v (%[3]T)\", t.Name(), expected, actual)\n\t}\n}", "title": "" }, { "docid": "6141cc914852464a8485e6559dc509c2", "score": "0.44967565", "text": "func (suite *TestGinQuerySuite) TestGetInt64Default(c *C) {\n\ttestCases := []*struct {\n\t\tqueryValue string\n\t\texpectedValue int64\n\t\texpectedViable bool\n\t\thasError bool\n\t}{\n\t\t{\"v1=2120\", 2120, true, false},\n\t\t{\"v1=-33867\", -33867, true, false},\n\t\t{\"\", 50, false, false},\n\t\t{\"v1=abc\", -1, false, true},\n\t}\n\n\tcontext := &gin.Context{}\n\ttestedWrapper := NewQueryWrapper(context)\n\tfor _, testCase := range testCases {\n\t\trequest, _ := http.NewRequest(\"GET\", \"http://127.0.0.1/?\"+testCase.queryValue, nil)\n\t\tcontext.Request = request\n\n\t\ttestedParamValue := testedWrapper.GetInt64Default(\"v1\", 50)\n\t\tc.Assert(testedParamValue.Viable, Equals, testCase.expectedViable)\n\n\t\tif testCase.hasError {\n\t\t\tc.Assert(testedParamValue.Error, NotNil)\n\t\t} else {\n\t\t\tc.Assert(testedParamValue.Error, IsNil)\n\t\t\tc.Assert(testedParamValue.Value, Equals, testCase.expectedValue)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "681b9cdf74d0a0b423743bd455ff642e", "score": "0.4476416", "text": "func TestCheckBinaryNonConstExprMapGtrInterfaceX(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := mapT{}; env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := interfaceX(nil); env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a > b`, env,\n\t\t`invalid operation: a > b (mismatched types eval.mapT and eval.interfaceX)`,\n\t)\n\n}", "title": "" }, { "docid": "4756e3e57c68d2ee9f9f120ca22e477f", "score": "0.44691432", "text": "func Assert(t testing.TB, pred bool) {\n\tif !pred {\n\t\tfatal(t, \"assertion failed\")\n\t}\n}", "title": "" }, { "docid": "fcb2d40d02872a6bda3a0b5c61282aea", "score": "0.44567809", "text": "func TestSimplestPossible(t *testing.T) {\n\tassert := assert.New(t)\n\tmessage := map[string]interface{}{\n\t\t\"a\": \"b\",\n\t}\n\tmatch := map[string]interface{}{\n\t\t\"a\": \"b\",\n\t}\n\tdoesMatch, matchErr := Match(message, match)\n\tassert.Nil(matchErr)\n\tassert.True(doesMatch)\n}", "title": "" }, { "docid": "cb3a18d393634272a60ab56f3e6b5164", "score": "0.44491804", "text": "func TestCheckBinaryNonConstExprXinterfaceXGtrMap(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := XinterfaceX(1); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := mapT{}; env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a > b`, env,\n\t\t`invalid operation: a > b (mismatched types eval.XinterfaceX and eval.mapT)`,\n\t)\n\n}", "title": "" }, { "docid": "c2efb72e0eff89824704bf5e8db950d2", "score": "0.44431514", "text": "func (DefaultAssertionMaker) MakeAssertion(req *IdpAuthnRequest, session *Session) error {\n\tvar attributes = Attributes{}\n\n\tvar attributeConsumingService *AttributeConsumingService\n\tfor _, acs := range req.SPSSODescriptor.AttributeConsumingServices {\n\t\tif acs.IsDefault != nil && *acs.IsDefault {\n\t\t\tattributeConsumingService = &acs\n\t\t\tbreak\n\t\t}\n\t}\n\tif attributeConsumingService == nil {\n\t\tfor _, acs := range req.SPSSODescriptor.AttributeConsumingServices {\n\t\t\tattributeConsumingService = &acs\n\t\t\tbreak\n\t\t}\n\t}\n\tif attributeConsumingService == nil {\n\t\tattributeConsumingService = &AttributeConsumingService{}\n\t}\n\n\tfor _, requestedAttribute := range attributeConsumingService.RequestedAttributes {\n\t\tif requestedAttribute.NameFormat == \"urn:oasis:names:tc:SAML:2.0:attrname-format:basic\" || requestedAttribute.NameFormat == \"urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified\" {\n\t\t\tattrName := requestedAttribute.Name\n\t\t\tattrName = regexp.MustCompile(\"[^A-Za-z0-9]+\").ReplaceAllString(attrName, \"\")\n\t\t\tswitch attrName {\n\t\t\tcase \"email\", \"mail\",\n\t\t\t\t\"emailaddress\":\n\t\t\t\tattributes.Set(&Attribute{\n\t\t\t\t\tFriendlyName: requestedAttribute.FriendlyName,\n\t\t\t\t\tName: requestedAttribute.Name,\n\t\t\t\t\tNameFormat: requestedAttribute.NameFormat,\n\t\t\t\t\tValues: []AttributeValue{{\n\t\t\t\t\t\tType: \"xs:string\",\n\t\t\t\t\t\tValue: session.UserEmail,\n\t\t\t\t\t}},\n\t\t\t\t})\n\t\t\tcase \"name\", \"fullname\", \"cn\", \"commonname\":\n\t\t\t\tattributes.Set(&Attribute{\n\t\t\t\t\tFriendlyName: requestedAttribute.FriendlyName,\n\t\t\t\t\tName: requestedAttribute.Name,\n\t\t\t\t\tNameFormat: requestedAttribute.NameFormat,\n\t\t\t\t\tValues: []AttributeValue{{\n\t\t\t\t\t\tType: \"xs:string\",\n\t\t\t\t\t\tValue: session.UserCommonName,\n\t\t\t\t\t}},\n\t\t\t\t})\n\t\t\tcase \"givenname\", \"firstname\":\n\t\t\t\tattributes.Set(&Attribute{\n\t\t\t\t\tFriendlyName: requestedAttribute.FriendlyName,\n\t\t\t\t\tName: requestedAttribute.Name,\n\t\t\t\t\tNameFormat: requestedAttribute.NameFormat,\n\t\t\t\t\tValues: []AttributeValue{{\n\t\t\t\t\t\tType: \"xs:string\",\n\t\t\t\t\t\tValue: session.UserGivenName,\n\t\t\t\t\t}},\n\t\t\t\t})\n\t\t\tcase \"surname\", \"lastname\", \"familyname\":\n\t\t\t\tattributes.Set(&Attribute{\n\t\t\t\t\tFriendlyName: requestedAttribute.FriendlyName,\n\t\t\t\t\tName: requestedAttribute.Name,\n\t\t\t\t\tNameFormat: requestedAttribute.NameFormat,\n\t\t\t\t\tValues: []AttributeValue{{\n\t\t\t\t\t\tType: \"xs:string\",\n\t\t\t\t\t\tValue: session.UserSurname,\n\t\t\t\t\t}},\n\t\t\t\t})\n\t\t\tcase \"user\", \"username\":\n\t\t\t\tattributes.Set(&Attribute{\n\t\t\t\t\tFriendlyName: requestedAttribute.FriendlyName,\n\t\t\t\t\tName: requestedAttribute.Name,\n\t\t\t\t\tNameFormat: requestedAttribute.NameFormat,\n\t\t\t\t\tValues: []AttributeValue{{\n\t\t\t\t\t\tType: \"xs:string\",\n\t\t\t\t\t\tValue: session.UserName,\n\t\t\t\t\t}},\n\t\t\t\t})\n\t\t\tcase \"uid\", \"userid\", \"id\":\n\t\t\t\tvar value = AttributeValue{Type: \"xs:integer\"}\n\t\t\t\tswitch typ := session.User.(type) {\n\t\t\t\tcase interface{ GetID() string }:\n\t\t\t\t\tvalue.Value = \"xs:string\"\n\t\t\t\t\tvalue.Value = typ.GetID()\n\t\t\t\tcase interface{ GetID() int }:\n\t\t\t\t\tvalue.Value = strconv.Itoa(typ.GetID())\n\t\t\t\tcase interface{ GetID() int64 }:\n\t\t\t\t\tvalue.Value = fmt.Sprintf(\"%d\", typ.GetID())\n\t\t\t\tcase interface{ GetID() int32 }:\n\t\t\t\t\tvalue.Value = fmt.Sprintf(\"%d\", typ.GetID())\n\t\t\t\tdefault:\n\t\t\t\t\tvalue.Value = \"xs:string\"\n\t\t\t\t\tvalue.Value = session.NameID\n\t\t\t\t}\n\t\t\t\tif value.Value != \"\" {\n\t\t\t\t\tattributes.Set(&Attribute{\n\t\t\t\t\t\tFriendlyName: requestedAttribute.FriendlyName,\n\t\t\t\t\t\tName: requestedAttribute.Name,\n\t\t\t\t\t\tNameFormat: requestedAttribute.NameFormat,\n\t\t\t\t\t\tValues: []AttributeValue{value},\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\n\tif session.UserName != \"\" {\n\t\tattributes.Set(&Attribute{\n\t\t\tFriendlyName: \"uid\",\n\t\t\tName: \"urn:oid:0.9.2342.19200300.100.1.1\",\n\t\t\tNameFormat: \"urn:oasis:names:tc:SAML:2.0:attrname-format:uri\",\n\t\t\tValues: []AttributeValue{{\n\t\t\t\tType: \"xs:string\",\n\t\t\t\tValue: session.UserName,\n\t\t\t}},\n\t\t})\n\t}\n\n\tif session.UserEmail != \"\" {\n\t\tattributes.Set(&Attribute{\n\t\t\tFriendlyName: \"email\",\n\t\t\tName: \"urn:oid:1.3.6.1.4.1.1466.115.121.1.39\",\n\t\t\tNameFormat: \"urn:oasis:names:tc:SAML:2.0:attrname-format:uri\",\n\t\t\tValues: []AttributeValue{{\n\t\t\t\tType: \"xs:string\",\n\t\t\t\tValue: session.UserEmail,\n\t\t\t}},\n\t\t})\n\t}\n\n\tif session.UserSurname != \"\" {\n\t\tattributes.Set(&Attribute{\n\t\t\tFriendlyName: \"sn\",\n\t\t\tName: \"urn:oid:2.5.4.4\",\n\t\t\tNameFormat: \"urn:oasis:names:tc:SAML:2.0:attrname-format:uri\",\n\t\t\tValues: []AttributeValue{{\n\t\t\t\tType: \"xs:string\",\n\t\t\t\tValue: session.UserSurname,\n\t\t\t}},\n\t\t})\n\t}\n\n\tif session.UserGivenName != \"\" {\n\t\tattributes.Set(&Attribute{\n\t\t\tFriendlyName: \"givenName\",\n\t\t\tName: \"urn:oid:2.5.4.42\",\n\t\t\tNameFormat: \"urn:oasis:names:tc:SAML:2.0:attrname-format:uri\",\n\t\t\tValues: []AttributeValue{{\n\t\t\t\tType: \"xs:string\",\n\t\t\t\tValue: session.UserGivenName,\n\t\t\t}},\n\t\t})\n\t}\n\n\tif session.UserCommonName != \"\" {\n\t\tattributes.Set(&Attribute{\n\t\t\tFriendlyName: \"cn\",\n\t\t\tName: \"urn:oid:2.5.4.3\",\n\t\t\tNameFormat: \"urn:oasis:names:tc:SAML:2.0:attrname-format:uri\",\n\t\t\tValues: []AttributeValue{{\n\t\t\t\tType: \"xs:string\",\n\t\t\t\tValue: session.UserCommonName,\n\t\t\t}},\n\t\t})\n\t}\n\n\tif len(session.Groups) != 0 {\n\t\tgroupMemberAttributeValues := []AttributeValue{}\n\t\tfor _, group := range session.Groups {\n\t\t\tgroupMemberAttributeValues = append(groupMemberAttributeValues, AttributeValue{\n\t\t\t\tType: \"xs:string\",\n\t\t\t\tValue: group,\n\t\t\t})\n\t\t}\n\t\tattributes.Set(&Attribute{\n\t\t\tFriendlyName: \"eduPersonAffiliation\",\n\t\t\tName: \"urn:oid:1.3.6.1.4.1.5923.1.1.1.1\",\n\t\t\tNameFormat: \"urn:oasis:names:tc:SAML:2.0:attrname-format:uri\",\n\t\t\tValues: groupMemberAttributeValues,\n\t\t})\n\t}\n\n\tif session.Attributes != nil {\n\t\tfor _, attr := range session.Attributes {\n\t\t\tattributes.Merge(attr)\n\t\t}\n\t}\n\n\t// allow for some clock skew in the validity period using the\n\t// issuer's apparent clock.\n\tnotBefore := req.Now.Add(-1 * MaxClockSkew)\n\tvar notOnOrAfterAfter = session.ExpireTime\n\tif notOnOrAfterAfter.IsZero() {\n\t\tnotOnOrAfterAfter = req.Now.Add(MaxIssueDelay)\n\t\tif notBefore.Before(req.Request.IssueInstant) {\n\t\t\tnotBefore = req.Request.IssueInstant\n\t\t\tnotOnOrAfterAfter = notBefore.Add(MaxIssueDelay)\n\t\t}\n\t}\n\n\treq.Assertion = &Assertion{\n\t\tID: fmt.Sprintf(\"id-%x\", randomBytes(20)),\n\t\tIssueInstant: TimeNow(),\n\t\tVersion: \"2.0\",\n\t\tIssuer: Issuer{\n\t\t\tFormat: \"urn:oasis:names:tc:SAML:2.0:nameid-format:entity\",\n\t\t\tValue: req.IDP.Metadata(req.HTTPRequest).EntityID,\n\t\t},\n\t\tSubject: &Subject{\n\t\t\tNameID: &NameID{\n\t\t\t\tFormat: \"urn:oasis:names:tc:SAML:2.0:nameid-format:transient\",\n\t\t\t\tNameQualifier: req.IDP.Metadata(req.HTTPRequest).EntityID,\n\t\t\t\tSPNameQualifier: req.ServiceProviderMetadata.EntityID,\n\t\t\t\tValue: session.NameID,\n\t\t\t},\n\t\t\tSubjectConfirmations: []SubjectConfirmation{\n\t\t\t\t{\n\t\t\t\t\tMethod: \"urn:oasis:names:tc:SAML:2.0:cm:bearer\",\n\t\t\t\t\tSubjectConfirmationData: &SubjectConfirmationData{\n\t\t\t\t\t\tAddress: req.HTTPRequest.RemoteAddr,\n\t\t\t\t\t\tInResponseTo: req.Request.ID,\n\t\t\t\t\t\tNotOnOrAfter: req.Now.Add(MaxIssueDelay),\n\t\t\t\t\t\tRecipient: req.ACSEndpoint.Location,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tConditions: &Conditions{\n\t\t\tNotBefore: notBefore,\n\t\t\tNotOnOrAfter: notOnOrAfterAfter,\n\t\t\tAudienceRestrictions: []AudienceRestriction{\n\t\t\t\t{\n\t\t\t\t\tAudience: Audience{Value: req.ServiceProviderMetadata.EntityID},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tAuthnStatements: []AuthnStatement{\n\t\t\t{\n\t\t\t\tAuthnInstant: session.CreateTime,\n\t\t\t\tSessionIndex: session.Index,\n\t\t\t\tAuthnContext: AuthnContext{\n\t\t\t\t\tAuthnContextClassRef: &AuthnContextClassRef{\n\t\t\t\t\t\tValue: \"urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tAttributeStatements: []AttributeStatement{\n\t\t\t{\n\t\t\t\tAttributes: attributes.Values(),\n\t\t\t},\n\t\t},\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "be91735b88a4acfe1d49959990e115d6", "score": "0.44421408", "text": "func (n *Notification) Assert(t *testing.T, configs ...*Configuration) *Notification {\n\tvar err error\n\tconfigs, err = n.filter(configs)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tswitch l := len(configs); {\n\tcase l == 0:\n\t\tt.Fatal(\"no matching configuration was found\")\n\tcase l > 1:\n\t\tt.Fatal(\"more than one matching configuration was found\")\n\tdefault:\n\t\tn.config = configs[0]\n\t}\n\n\tn.filters = []shared.Filter{}\n\treturn n\n}", "title": "" }, { "docid": "e991faee3d537f8e9adeb616d894ec3a", "score": "0.44402957", "text": "func (c *Client) GetSamlAssertions() error {\n\tif err := c.GetAuthenticationURL(); err != nil {\n\t\treturn err\n\t}\n\n\tif c.Config.Azure.TenantID != \"\" {\n\t\tif err := c.AuthenticateWithAzure(); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else if c.Config.Adfs.Hostname != \"\" {\n\t\tif err := c.AuthenticateWithAdfs(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := c.OutputCurrentState(); err != nil {\n\t\treturn err\n\t}\n\tif err := c.IsSamlAssertionValid(); err != nil {\n\t\treturn err\n\t}\n\tif err := c.IsAwsRoleAvailable(); err == nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4052b7628b30ce2ad7807a4347167841", "score": "0.44382668", "text": "func desiredAssertionStatus0(frame *rtda.Frame) {\n\tframe.OperandStack().PushBoolean(false)\n}", "title": "" }, { "docid": "3a574fb78f67632083e564cf521dc1d0", "score": "0.4427743", "text": "func Assert(tb testing.TB, condition bool, msg string, v ...interface{}) {\n\tassert(tb, false, condition, msg, v...)\n}", "title": "" }, { "docid": "f8ccecde1027280c0940da8e6f9bdf37", "score": "0.44227868", "text": "func (suite *ReflectTestSuite) TestTypeEquivalence() {\n\tsuite.Assert().NotEqual(a, b)\n\tsuite.Assert().NotEqual(b, c)\n\tsuite.Assert().Equal(a, c)\n}", "title": "" }, { "docid": "17e46d2a8d65c59fd945254d7b997d29", "score": "0.4422448", "text": "func Verify(t *testing.T) assert {\n\treturn assert{t, t.Fail}\n}", "title": "" }, { "docid": "7c15f246480cb4f543e1f38c6b45f17c", "score": "0.44176158", "text": "func (r *ResolverGenerator) mustAssertToKnownPredicate(paramName string) jen.Code {\n\tc := jen.Empty()\n\tfor _, t := range r.types {\n\t\tc = c.Case(\n\t\t\tjen.Func().Parens(\n\t\t\t\tjen.List(\n\t\t\t\t\tjen.Qual(\"context\", \"Context\"),\n\t\t\t\t\tjen.Qual(t.PublicPackage().Path(), t.InterfaceName()),\n\t\t\t\t),\n\t\t\t).Parens(\n\t\t\t\tjen.List(\n\t\t\t\t\tjen.Bool(),\n\t\t\t\t\tjen.Error(),\n\t\t\t\t),\n\t\t\t),\n\t\t).Block(\n\t\t\tjen.Commentf(\"Do nothing, this predicate has a correct signature.\"),\n\t\t).Line()\n\t}\n\tc = c.Default().Block(\n\t\tjen.Return(\n\t\t\tjen.Nil(),\n\t\t\tjen.Qual(\"errors\", \"New\").Call(jen.Lit(\"the predicate function is of the wrong signature and would never be called\")),\n\t\t),\n\t)\n\treturn c\n}", "title": "" }, { "docid": "674a98dab5de6ec88587c214a3f44c31", "score": "0.4397685", "text": "func TestNewDefaultDatum(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\tdefer log.Scope(t).Close(t)\n\n\tevalCtx := ast.NewTestingEvalContext(cluster.MakeTestingClusterSettings())\n\tdefer evalCtx.Stop(context.Background())\n\n\ttestCases := []struct {\n\t\tt *types.T\n\t\texpected string\n\t}{\n\t\t{t: types.Bool, expected: \"false\"},\n\t\t{t: types.Int, expected: \"0:::INT8\"},\n\t\t{t: types.Int2, expected: \"0:::INT8\"},\n\t\t{t: types.Int4, expected: \"0:::INT8\"},\n\t\t{t: types.Float, expected: \"0.0:::FLOAT8\"},\n\t\t{t: types.Float4, expected: \"0.0:::FLOAT8\"},\n\t\t{t: types.Decimal, expected: \"0:::DECIMAL\"},\n\t\t{t: types.MakeDecimal(10, 5), expected: \"0:::DECIMAL\"},\n\t\t{t: types.Date, expected: \"'2000-01-01':::DATE\"},\n\t\t{t: types.Timestamp, expected: \"'0001-01-01 00:00:00+00:00':::TIMESTAMP\"},\n\t\t{t: types.Interval, expected: \"'00:00:00':::INTERVAL\"},\n\t\t{t: types.String, expected: \"'':::STRING\"},\n\t\t{t: types.MakeChar(3), expected: \"'':::STRING\"},\n\t\t{t: types.Bytes, expected: \"'\\\\x':::BYTES\"},\n\t\t{t: types.TimestampTZ, expected: \"'0001-01-01 00:00:00+00:00':::TIMESTAMPTZ\"},\n\t\t{t: types.MakeCollatedString(types.MakeVarChar(10), \"de\"), expected: \"'' COLLATE de\"},\n\t\t{t: types.MakeCollatedString(types.VarChar, \"en_US\"), expected: \"'' COLLATE en_US\"},\n\t\t{t: types.Oid, expected: \"26:::OID\"},\n\t\t{t: types.RegClass, expected: \"crdb_internal.create_regclass(2205,'regclass'):::REGCLASS\"},\n\t\t{t: types.Unknown, expected: \"NULL\"},\n\t\t{t: types.Uuid, expected: \"'00000000-0000-0000-0000-000000000000':::UUID\"},\n\t\t{t: types.MakeArray(types.Int), expected: \"ARRAY[]:::INT8[]\"},\n\t\t{t: types.MakeArray(types.MakeArray(types.String)), expected: \"ARRAY[]:::STRING[][]\"},\n\t\t{t: types.OidVector, expected: \"ARRAY[]:::OID[]\"},\n\t\t{t: types.INet, expected: \"'0.0.0.0/0':::INET\"},\n\t\t{t: types.Time, expected: \"'00:00:00':::TIME\"},\n\t\t{t: types.Jsonb, expected: \"'null':::JSONB\"},\n\t\t{t: types.TimeTZ, expected: \"'00:00:00+00:00:00':::TIMETZ\"},\n\t\t{t: types.MakeTuple([]*types.T{}), expected: \"()\"},\n\t\t{t: types.MakeTuple([]*types.T{types.Int, types.MakeChar(1)}), expected: \"(0:::INT8, '':::STRING)\"},\n\t\t{t: types.MakeTuple([]*types.T{types.OidVector, types.MakeTuple([]*types.T{types.Float})}), expected: \"(ARRAY[]:::OID[], (0.0:::FLOAT8,))\"},\n\t\t{t: types.VarBit, expected: \"B''\"},\n\t\t{t: types.MakeBit(5), expected: \"B''\"},\n\t}\n\n\tfor i, tc := range testCases {\n\t\tt.Run(fmt.Sprintf(\"#%d %s\", i, tc.t.SQLString()), func(t *testing.T) {\n\t\t\tdatum, err := ast.NewDefaultDatum(evalCtx, tc.t)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"unexpected error: %s\", err)\n\t\t\t}\n\n\t\t\tactual := ast.AsStringWithFlags(datum, ast.FmtCheckEquivalence)\n\t\t\tif actual != tc.expected {\n\t\t\t\tt.Errorf(\"expected %s, got %s\", tc.expected, actual)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "1c857ca6f99eb082eba9efd3609c680d", "score": "0.43961248", "text": "func AssertRegistryMissing(t *testing.T, registry *TypeRegistry, getter interface{}) {\n\tgetterType := reflect.TypeOf(getter)\n\targType := getterType.In(0)\n\treflectedValue := registry.get(argType)\n\n\tassert.False(t, reflectedValue.IsValid(), \"Expected type %T to not be registered\", argType)\n}", "title": "" }, { "docid": "fd1a3cfd0fc81768a8fad41d5dbc3687", "score": "0.4385282", "text": "func RequireTypeAssert[T any](t testing.TB, v any) (res T) {\n\tt.Helper()\n\n\trequire.IsType(t, res, v)\n\n\treturn v.(T)\n}", "title": "" }, { "docid": "e34fdc7079b6a3e022301eb3205bbb28", "score": "0.43818736", "text": "func AssertThatObservable(t *testing.T, observable Observable, assertions ...RxAssertion) {\n\tass := parseAssertions(assertions...)\n\tgot := make([]interface{}, 0)\n\tobservable.Subscribe(handlers.NextFunc(func(i interface{}) {\n\t\tgot = append(got, i)\n\t})).Block()\n\n\tcheckHasItems, items := ass.hasItemsFunc()\n\tif checkHasItems {\n\t\tassert.Equal(t, items, got)\n\t}\n\n\tcheckHasSize, size := ass.hasSizeFunc()\n\tif checkHasSize {\n\t\tassert.Equal(t, size, len(got))\n\t}\n\n\tcheckIsEmpty, empty := ass.isEmptyFunc()\n\tif checkIsEmpty {\n\t\tif empty {\n\t\t\tassert.Equal(t, 0, len(got))\n\t\t} else {\n\t\t\tassert.NotEqual(t, 0, len(got))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2dd830be27f674aec5d2f0fe4a9cef12", "score": "0.43795353", "text": "func Default() Requirements {\n\treturn New(xrdproto.NoneLevel, nil)\n}", "title": "" }, { "docid": "3e2e58e054248216b76f2b297b3accde", "score": "0.43747845", "text": "func TestPolicy_CreateDefaultConfig(t *testing.T) {\n\tnew(sbac.Policy).CreateDefaultConfig(\"\", make(map[string]interface{}))\n}", "title": "" }, { "docid": "098c63ba722afe5884f8c1ce94e45022", "score": "0.43747365", "text": "func (ei *EventInfoStore) AssertAtLeast(min int, f EventInfoMatcher) []EventInfo {\n\tevents, err := ei.WaitAtLeastNMatch(f, min)\n\tif err != nil {\n\t\tei.tb.Fatalf(\"Timeout waiting for at least %d matches. Error: %v\", min, err)\n\t}\n\treturn events\n}", "title": "" }, { "docid": "55a3eff06429ec3e0352567542480b73", "score": "0.4368633", "text": "func TestDefaultDimensions(t *testing.T) {\n\tvar tests = []struct {\n\t\tarn string\n\t\tfunctionVersion string\n\t\twant map[string]string\n\t}{\n\t\t{\"\",\n\t\t\t\"version\",\n\t\t\tmap[string]string{\n\t\t\t\tarKey: \"\",\n\t\t\t\tacKey: \"\",\n\t\t\t\tafKey: \"\",\n\t\t\t\tlaKey: \"\",\n\t\t\t\tesKey: \"\"},\n\t\t},\n\t\t{\"arn:aws:lambda:region:account-id:function:function-name\",\n\t\t\t\"version\",\n\t\t\tmap[string]string{\n\t\t\t\tarKey: \"region\",\n\t\t\t\tacKey: \"account-id\",\n\t\t\t\tafKey: \"\",\n\t\t\t\tlaKey: \"arn:aws:lambda:region:account-id:function:function-name:version\",\n\t\t\t\tesKey: \"\"},\n\t\t},\n\t\t{\"arn:aws:lambda:region:account-id:function:function-name:alias-name\",\n\t\t\t\"version\",\n\t\t\tmap[string]string{\n\t\t\t\tarKey: \"region\",\n\t\t\t\tacKey: \"account-id\",\n\t\t\t\tafKey: \"alias-name\",\n\t\t\t\tlaKey: \"arn:aws:lambda:region:account-id:function:function-name:version\",\n\t\t\t\tesKey: \"\"},\n\t\t},\n\t\t{\"arn:aws:lambda:region:account-id:function:function-name:version\",\n\t\t\t\"version\",\n\t\t\tmap[string]string{\n\t\t\t\tarKey: \"region\",\n\t\t\t\tacKey: \"account-id\",\n\t\t\t\tafKey: \"version\",\n\t\t\t\tlaKey: \"arn:aws:lambda:region:account-id:function:function-name:version\",\n\t\t\t\tesKey: \"\"},\n\t\t},\n\t\t{\"arn:aws:lambda:region:account-id:event-source-mappings:event-source-mapping-id\",\n\t\t\t\"version\",\n\t\t\tmap[string]string{\n\t\t\t\tarKey: \"region\",\n\t\t\t\tacKey: \"account-id\",\n\t\t\t\tafKey: \"\",\n\t\t\t\tlaKey: \"arn:aws:lambda:region:account-id:event-source-mappings:event-source-mapping-id\",\n\t\t\t\tesKey: \"event-source-mapping-id\"},\n\t\t},\n\t}\n\tsavedFunctionVersion := lambdacontext.FunctionVersion\n\tdefer func() {\n\t\tlambdacontext.FunctionVersion = savedFunctionVersion\n\t}()\n\tfor _, test := range tests {\n\t\tlambdacontext.FunctionVersion = test.functionVersion\n\t\tgot, _ := defaultDimensions(newCtx(test.arn))\n\t\tkeys := []string{arKey, acKey, afKey, laKey, esKey}\n\t\tfor _, k := range keys {\n\t\t\tif got[k] != test.want[k] {\n\t\t\t\tt.Errorf(\"want %s got %s\", test.want[k], got[k])\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e1359c4fceb830eebe344d8e08154dc5", "score": "0.43671313", "text": "func (r *Request) AssertCustom(assertor Assertor) *Request {\n\tr.assertions = append(r.assertions, assertor)\n\treturn r\n}", "title": "" }, { "docid": "a8d8cd27eb1e533461c4bfb3eca7bf64", "score": "0.43606976", "text": "func AssertExprEvalsToType(t *testing.T, expected interface{}, expr Expr) bool {\n\tt.Helper()\n\n\tvalue, err := expr.Eval(arraictx.InitRunCtx(context.Background()), EmptyScope)\n\tif !assert.NoError(t, err, \"evaluating expr: %s\", expr) {\n\t\treturn false\n\t}\n\tif reflect.TypeOf(expected) != reflect.TypeOf(value) {\n\t\tt.Logf(\"\\nexpected: %T\\nvalue: %v\\nexpr: %v\", expected, value, expr)\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "33f7896b65aa656e49fac742b09cf7c4", "score": "0.43602052", "text": "func Assert(status bool, fmtstring string, args ...interface{}) {\n\tif !status {\n\t\tPanicf(ErrAssert, fmtstring, args...)\n\t}\n}", "title": "" }, { "docid": "167774bba4946f976dacf6d5ed15bd20", "score": "0.43574312", "text": "func TestDefaultHMAC(t *testing.T) {\n\tkey := []byte{1, 2}\n\tdata := []byte{1, 2, 3, 4, 5}\n\thmac, err := DefaultHMAC(key, data)\n\trequire.NoError(t, err)\n\n\trequire.True(t, hmac.IsValid())\n\n\terr = hmac.Verify(key, data)\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "8e8346660af21072103c1a65d7870a16", "score": "0.43567812", "text": "func TestCheckBinaryNonConstExprMapGtrInterfaceY(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := mapT{}; env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := interfaceY(nil); env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a > b`, env,\n\t\t`invalid operation: a > b (mismatched types eval.mapT and eval.interfaceY)`,\n\t)\n\n}", "title": "" }, { "docid": "1334987ca8feaa549b7f038760500987", "score": "0.4356208", "text": "func getDefaultTestProbes(protocol, path string) map[bool][]network.Probe {\n\treturn getTestProbes(protocol, path, pointer.Int32(5), pointer.Int32(80), pointer.Int32(10080), pointer.Int32(2))\n}", "title": "" }, { "docid": "02f5773eb388678012195e14b3ea2915", "score": "0.43471652", "text": "func TestCheckBinaryNonConstExprXinterfaceXEqlMap(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := XinterfaceX(1); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := mapT{}; env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a == b`, env,\n\t\t`invalid operation: a == b (mismatched types eval.XinterfaceX and eval.mapT)`,\n\t)\n\n}", "title": "" }, { "docid": "ecacc62cb3c96a9915af00c9340f882f", "score": "0.43429285", "text": "func Assert(test bool) {\n\tif !test {\n\t\tpanic(\"Assertion failure\")\n\t}\n}", "title": "" }, { "docid": "23e3cdb68b160bc0938cd5cea0347003", "score": "0.4342202", "text": "func TestExtractDefaults(t *testing.T) {\n\tconst JSONSCHEMA_STUB = `{\n\t \"type\": \"object\",\n\t \"properties\": {\n\t \t\"foo\": {\n\t \t\t\"type\": \"object\",\n\t \t\t\"properties\": {\n\t \t\t\t\"bar\": {\n\t \"default\": 3,\n\t \"type\": \"number\"\n\t \t\t\t},\n\t \t\t\t\"baz\": {\n\t \"default\": \"bax\",\n\t \"type\": \"string\"\n\t \t\t\t}\n\t \t\t}\n\t \t}\n\t }\n\t}`\n\n\tvar config map[string]interface{}\n\terr := json.Unmarshal([]byte(JSONSCHEMA_STUB), &config)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to load stub config: %s\", err.Error())\n\t}\n\n\tvalues, err := DefaultJSONFromSchema(config)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to extract defaults from schema: %s\", err.Error())\n\t}\n\n\tbytes, err := json.Marshal(values)\n\tstr := string(bytes)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to stringify the result: %s\", err.Error())\n\t}\n\n\tif str != `{\"foo\":{\"bar\":3,\"baz\":\"bax\"}}` {\n\t\tt.Errorf(\"The result does not match\")\n\t}\n}", "title": "" }, { "docid": "8c3df54777fa679094bbff2e3f6ee960", "score": "0.4336106", "text": "func TestCheckBinaryNonConstExprMapEqlInterfaceY(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := mapT{}; env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := interfaceY(nil); env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a == b`, env,\n\t\t`invalid operation: a == b (mismatched types eval.mapT and eval.interfaceY)`,\n\t)\n\n}", "title": "" }, { "docid": "7f8073639f9345ed161e5e71e5cb6291", "score": "0.43359864", "text": "func DefaultTapArguments() TapArguments {\n\treturn TapArguments{\n\t\tBackfill: TapNoBackfill,\n\t}\n}", "title": "" }, { "docid": "72dc505ab81dcef18505b9a7c6cb8eac", "score": "0.43342042", "text": "func TestCheckBinaryNonConstExprMapAndInterfaceX(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := mapT{}; env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := interfaceX(nil); env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a & b`, env,\n\t\t`invalid operation: a & b (mismatched types eval.mapT and eval.interfaceX)`,\n\t)\n\n}", "title": "" }, { "docid": "29199371c97c52c08710eb63527359bd", "score": "0.4330976", "text": "func AssertExprPanics(t *testing.T, expr Expr) bool {\n\tt.Helper()\n\n\treturn assert.Panics(t, func() { expr.Eval(arraictx.InitRunCtx(context.Background()), EmptyScope) }) //nolint:errcheck\n}", "title": "" }, { "docid": "cfe12fb1864763618e1c320bef41c413", "score": "0.4326534", "text": "func Assert(typ Code) *Statement {\n\treturn newStatement().Assert(typ)\n}", "title": "" }, { "docid": "7b4b8e502b011137c374913b5e7a78a1", "score": "0.43260974", "text": "func TestCheckBinaryNonConstExprInterfaceXAndMap(t *testing.T) {\n\tenv := makeCheckBinaryNonConstExprEnv()\n\ta := interfaceX(nil); env.Vars[\"a\"] = reflect.ValueOf(&a)\n\tb := mapT{}; env.Vars[\"b\"] = reflect.ValueOf(&b)\n\texpectCheckError(t, `a & b`, env,\n\t\t`invalid operation: a & b (mismatched types eval.interfaceX and eval.mapT)`,\n\t)\n\n}", "title": "" }, { "docid": "4759fd44eec37415fdeaf0c3a9c842a1", "score": "0.43250498", "text": "func TestWithDefaultValues(t *testing.T) {\n\tt.Parallel()\n\taws_region := \"us-east-2\"\n\tvars := map[string]interface{}{\n\t\t\"create_collector\": true,\n\t\t\"sumologic_organization_id\": common.SumologicOrganizationId,\n\t\t\"create_trail\": true,\n\t}\n\n\toptions, count := SetUpTest(t, vars, aws_region)\n\n\t// Assert count of Expected resources.\n\ttest_structure.RunTestStage(t, \"AssertCount\", func() {\n\t\tcommon.AssertResourceCounts(t, count, 11, 0, 0)\n\t})\n\toutputs := common.FetchAllOutputs(t, options)\n\treplacementMap := map[string]interface{}{\n\t\t\"AccountId\": aws.GetAccountId(t),\n\t\t\"Region\": aws_region,\n\t\t\"SumoAccountId\": common.SumoAccountId,\n\t\t\"Deployment\": common.SumologicEnvironment,\n\t\t\"OrgId\": common.SumologicOrganizationId,\n\t\t\"RandomString\": outputs[\"random_string\"].(map[string]interface{})[\"id\"].(string),\n\t}\n\n\t// Assert if the outputs are actually created in AWS and Sumo Logic.\n\t// This also checks if your expectation are matched with the outputs, so provide an JSON with expected outputs.\n\texpectedOutputs := common.ReadJsonFile(\"TestWithDefaultValues.json\", replacementMap)\n\ttest_structure.RunTestStage(t, \"AssertOutputs\", func() {\n\t\tcommon.AssertOutputs(t, options, expectedOutputs)\n\t})\n\n\t// Assert if the logs are sent to Sumo Logic.\n\tcommon.GetAssertResource(t, options.EnvVars).CheckLogsForPastSixtyMinutes(\"_sourceid=\"+outputs[\"sumologic_source\"].(map[string]interface{})[\"id\"].(string), 5, 2*time.Minute)\n}", "title": "" }, { "docid": "e690c0d75b5939aa46d44dc11cb88733", "score": "0.43227285", "text": "func (mc MockCollector) DefaultTags() []string {\n\treturn mc.Field.DefaultTags\n}", "title": "" }, { "docid": "3a54d6de43f1af66ae62afd242cbb3d5", "score": "0.4321946", "text": "func (ei *EventInfoStore) AssertNot(f EventInfoMatcher) []EventInfo {\n\tres, recentEvents, err := ei.Find(f)\n\tif err != nil {\n\t\tei.tb.Fatalf(\"unexpected error during find on recordevents '%s': %v\", ei.podName, err)\n\t}\n\n\tif len(res) != 0 {\n\t\tei.tb.Fatalf(\"Unexpected matches on recordevents '%s', found: %v. %s\", ei.podName, res, &recentEvents)\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "fc2dec062aba184c4651d60edadb7e2d", "score": "0.43130875", "text": "func TestGeneratedStructs(t *testing.T) {\n\tt.Run(\"struct with map repr\", func(t *testing.T) {\n\t\tvar (\n\t\t\tv0, v1, v2, v3, v4 schema.TypedNode\n\t\t)\n\t\tt.Run(\"type-level build and read\", func(t *testing.T) {\n\t\t\tt.Run(\"all fields set\", func(t *testing.T) {\n\t\t\t\tmb, err := Stroct__NodeBuilder().CreateMap()\n\t\t\t\tRequire(t, err, ShouldEqual, nil)\n\t\t\t\tmb.Insert(ipldfree.String(\"f1\"), plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f2\"), plz(String__NodeBuilder().CreateString(\"b\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f3\"), plz(String__NodeBuilder().CreateString(\"c\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f4\"), plz(String__NodeBuilder().CreateString(\"d\")))\n\t\t\t\tn, err := mb.Build()\n\t\t\t\tv0 = n.(schema.TypedNode)\n\n\t\t\t\tWish(t, err, ShouldEqual, nil)\n\t\t\t\tWish(t, n.ReprKind(), ShouldEqual, ipld.ReprKind_Map)\n\t\t\t\tWish(t, plz(n.LookupString(\"f1\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f2\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"b\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f3\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"c\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f4\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"d\")))\n\t\t\t})\n\t\t\tt.Run(\"using null nullable\", func(t *testing.T) {\n\t\t\t\tmb, err := Stroct__NodeBuilder().CreateMap()\n\t\t\t\tRequire(t, err, ShouldEqual, nil)\n\t\t\t\tmb.Insert(ipldfree.String(\"f1\"), plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f2\"), plz(String__NodeBuilder().CreateString(\"b\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f3\"), plz(String__NodeBuilder().CreateString(\"c\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f4\"), ipld.Null)\n\t\t\t\tn, err := mb.Build()\n\t\t\t\tv1 = n.(schema.TypedNode)\n\n\t\t\t\tWish(t, err, ShouldEqual, nil)\n\t\t\t\tWish(t, n.ReprKind(), ShouldEqual, ipld.ReprKind_Map)\n\t\t\t\tWish(t, n.Length(), ShouldEqual, 4)\n\t\t\t\tWish(t, plz(n.LookupString(\"f1\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f2\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"b\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f3\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"c\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f4\")), ShouldEqual, ipld.Null)\n\t\t\t})\n\t\t\tt.Run(\"using null optional nullable\", func(t *testing.T) {\n\t\t\t\tmb, err := Stroct__NodeBuilder().CreateMap()\n\t\t\t\tRequire(t, err, ShouldEqual, nil)\n\t\t\t\tmb.Insert(ipldfree.String(\"f1\"), plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f2\"), plz(String__NodeBuilder().CreateString(\"b\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f3\"), ipld.Null)\n\t\t\t\tmb.Insert(ipldfree.String(\"f4\"), plz(String__NodeBuilder().CreateString(\"d\")))\n\t\t\t\tn, err := mb.Build()\n\t\t\t\tv2 = n.(schema.TypedNode)\n\n\t\t\t\tWish(t, err, ShouldEqual, nil)\n\t\t\t\tWish(t, n.ReprKind(), ShouldEqual, ipld.ReprKind_Map)\n\t\t\t\tWish(t, n.Length(), ShouldEqual, 4)\n\t\t\t\tWish(t, plz(n.LookupString(\"f1\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f2\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"b\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f3\")), ShouldEqual, ipld.Null)\n\t\t\t\tWish(t, plz(n.LookupString(\"f4\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"d\")))\n\t\t\t})\n\t\t\tt.Run(\"using skipped optional\", func(t *testing.T) {\n\t\t\t\tmb, err := Stroct__NodeBuilder().CreateMap()\n\t\t\t\tRequire(t, err, ShouldEqual, nil)\n\t\t\t\tmb.Insert(ipldfree.String(\"f1\"), plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f3\"), plz(String__NodeBuilder().CreateString(\"c\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f4\"), plz(String__NodeBuilder().CreateString(\"d\")))\n\t\t\t\tn, err := mb.Build()\n\t\t\t\tv3 = n.(schema.TypedNode)\n\n\t\t\t\tWish(t, err, ShouldEqual, nil)\n\t\t\t\tWish(t, n.ReprKind(), ShouldEqual, ipld.ReprKind_Map)\n\t\t\t\tWish(t, n.Length(), ShouldEqual, 4)\n\t\t\t\tWish(t, plz(n.LookupString(\"f1\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f2\")), ShouldEqual, ipld.Undef)\n\t\t\t\tWish(t, plz(n.LookupString(\"f3\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"c\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f4\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"d\")))\n\t\t\t})\n\t\t\tt.Run(\"using skipped optional nullable\", func(t *testing.T) {\n\t\t\t\tmb, err := Stroct__NodeBuilder().CreateMap()\n\t\t\t\tRequire(t, err, ShouldEqual, nil)\n\t\t\t\tmb.Insert(ipldfree.String(\"f1\"), plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f2\"), plz(String__NodeBuilder().CreateString(\"b\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f4\"), plz(String__NodeBuilder().CreateString(\"d\")))\n\t\t\t\tn, err := mb.Build()\n\t\t\t\tv4 = n.(schema.TypedNode)\n\n\t\t\t\tWish(t, err, ShouldEqual, nil)\n\t\t\t\tWish(t, n.ReprKind(), ShouldEqual, ipld.ReprKind_Map)\n\t\t\t\tWish(t, n.Length(), ShouldEqual, 4)\n\t\t\t\tWish(t, plz(n.LookupString(\"f1\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f2\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"b\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f3\")), ShouldEqual, ipld.Undef)\n\t\t\t\tWish(t, plz(n.LookupString(\"f4\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"d\")))\n\t\t\t})\n\t\t})\n\t\tt.Run(\"representation read\", func(t *testing.T) {\n\t\t\tt.Run(\"all fields set\", func(t *testing.T) {\n\t\t\t\tn := v0.Representation()\n\n\t\t\t\tWish(t, n.ReprKind(), ShouldEqual, ipld.ReprKind_Map)\n\t\t\t\tWish(t, n.Length(), ShouldEqual, 4)\n\t\t\t\tWish(t, plz(n.LookupString(\"f1\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f2\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"b\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f3\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"c\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f4\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"d\")))\n\t\t\t})\n\t\t\tt.Run(\"using null nullable\", func(t *testing.T) {\n\t\t\t\tn := v1.Representation()\n\n\t\t\t\tWish(t, n.ReprKind(), ShouldEqual, ipld.ReprKind_Map)\n\t\t\t\tWish(t, n.Length(), ShouldEqual, 4)\n\t\t\t\tWish(t, plz(n.LookupString(\"f1\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f2\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"b\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f3\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"c\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f4\")), ShouldEqual, ipld.Null)\n\t\t\t})\n\t\t\tt.Run(\"using null optional nullable\", func(t *testing.T) {\n\t\t\t\tn := v2.Representation()\n\n\t\t\t\tWish(t, n.ReprKind(), ShouldEqual, ipld.ReprKind_Map)\n\t\t\t\tWish(t, n.Length(), ShouldEqual, 4)\n\t\t\t\tWish(t, plz(n.LookupString(\"f1\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f2\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"b\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f3\")), ShouldEqual, ipld.Null)\n\t\t\t\tWish(t, plz(n.LookupString(\"f4\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"d\")))\n\t\t\t})\n\t\t\tt.Run(\"using skipped optional\", func(t *testing.T) {\n\t\t\t\tn := v3.Representation()\n\n\t\t\t\tWish(t, n.ReprKind(), ShouldEqual, ipld.ReprKind_Map)\n\t\t\t\tWish(t, n.Length(), ShouldEqual, 3) // note this is shorter, even though it's not at the type level!\n\t\t\t\tWish(t, plz(n.LookupString(\"f1\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tWish(t, erp(n.LookupString(\"f2\")), ShouldEqual, ipld.ErrNotExists{ipld.PathSegmentOfString(\"f2\")})\n\t\t\t\tWish(t, plz(n.LookupString(\"f3\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"c\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f4\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"d\")))\n\t\t\t})\n\t\t\tt.Run(\"using skipped optional nullable\", func(t *testing.T) {\n\t\t\t\tn := v4.Representation()\n\n\t\t\t\tWish(t, n.ReprKind(), ShouldEqual, ipld.ReprKind_Map)\n\t\t\t\tWish(t, n.Length(), ShouldEqual, 3) // note this is shorter, even though it's not at the type level!\n\t\t\t\tWish(t, plz(n.LookupString(\"f1\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tWish(t, plz(n.LookupString(\"f2\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"b\")))\n\t\t\t\tWish(t, erp(n.LookupString(\"f3\")), ShouldEqual, ipld.ErrNotExists{ipld.PathSegmentOfString(\"f3\")})\n\t\t\t\tWish(t, plz(n.LookupString(\"f4\")), ShouldEqual, plz(String__NodeBuilder().CreateString(\"d\")))\n\t\t\t})\n\t\t\t// TODO will need even more cases to probe implicits\n\t\t})\n\t\tt.Run(\"representation build\", func(t *testing.T) {\n\t\t\tt.Run(\"all fields set\", func(t *testing.T) {\n\t\t\t\tmb, err := Stroct__ReprBuilder().CreateMap()\n\t\t\t\tRequire(t, err, ShouldEqual, nil)\n\t\t\t\tmb.Insert(ipldfree.String(\"f1\"), plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f2\"), plz(String__NodeBuilder().CreateString(\"b\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f3\"), plz(String__NodeBuilder().CreateString(\"c\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f4\"), plz(String__NodeBuilder().CreateString(\"d\")))\n\t\t\t\tn, err := mb.Build()\n\n\t\t\t\tWish(t, err, ShouldEqual, nil)\n\t\t\t\tWish(t, n.ReprKind(), ShouldEqual, ipld.ReprKind_Map)\n\t\t\t\tWish(t, n, ShouldEqual, v0)\n\t\t\t})\n\t\t\tt.Run(\"using null nullable\", func(t *testing.T) {\n\t\t\t\tmb, err := Stroct__ReprBuilder().CreateMap()\n\t\t\t\tRequire(t, err, ShouldEqual, nil)\n\t\t\t\tmb.Insert(ipldfree.String(\"f1\"), plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f2\"), plz(String__NodeBuilder().CreateString(\"b\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f3\"), plz(String__NodeBuilder().CreateString(\"c\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f4\"), ipld.Null)\n\t\t\t\tn, err := mb.Build()\n\n\t\t\t\tWish(t, err, ShouldEqual, nil)\n\t\t\t\tWish(t, n.ReprKind(), ShouldEqual, ipld.ReprKind_Map)\n\t\t\t\tWish(t, n.Length(), ShouldEqual, 4)\n\t\t\t\tWish(t, n, ShouldEqual, v1)\n\t\t\t})\n\t\t\tt.Run(\"using null optional nullable\", func(t *testing.T) {\n\t\t\t\tmb, err := Stroct__ReprBuilder().CreateMap()\n\t\t\t\tRequire(t, err, ShouldEqual, nil)\n\t\t\t\tmb.Insert(ipldfree.String(\"f1\"), plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f2\"), plz(String__NodeBuilder().CreateString(\"b\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f3\"), ipld.Null)\n\t\t\t\tmb.Insert(ipldfree.String(\"f4\"), plz(String__NodeBuilder().CreateString(\"d\")))\n\t\t\t\tn, err := mb.Build()\n\n\t\t\t\tWish(t, err, ShouldEqual, nil)\n\t\t\t\tWish(t, n, ShouldEqual, v2)\n\t\t\t})\n\t\t\tt.Run(\"using skipped optional\", func(t *testing.T) {\n\t\t\t\tmb, err := Stroct__ReprBuilder().CreateMap()\n\t\t\t\tRequire(t, err, ShouldEqual, nil)\n\t\t\t\tmb.Insert(ipldfree.String(\"f1\"), plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f3\"), plz(String__NodeBuilder().CreateString(\"c\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f4\"), plz(String__NodeBuilder().CreateString(\"d\")))\n\t\t\t\tn, err := mb.Build()\n\n\t\t\t\tWish(t, err, ShouldEqual, nil)\n\t\t\t\tWish(t, n, ShouldEqual, v3)\n\t\t\t})\n\t\t\tt.Run(\"using skipped optional nullable\", func(t *testing.T) {\n\t\t\t\tmb, err := Stroct__ReprBuilder().CreateMap()\n\t\t\t\tRequire(t, err, ShouldEqual, nil)\n\t\t\t\tmb.Insert(ipldfree.String(\"f1\"), plz(String__NodeBuilder().CreateString(\"a\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f2\"), plz(String__NodeBuilder().CreateString(\"b\")))\n\t\t\t\tmb.Insert(ipldfree.String(\"f4\"), plz(String__NodeBuilder().CreateString(\"d\")))\n\t\t\t\tn, err := mb.Build()\n\n\t\t\t\tWish(t, err, ShouldEqual, nil)\n\t\t\t\tWish(t, n, ShouldEqual, v4)\n\n\t\t\t})\n\t\t\t// TODO will need even more cases to probe implicits\n\t\t})\n\t})\n}", "title": "" }, { "docid": "a3e5205835cb28f4c8f278f3728da562", "score": "0.43111676", "text": "func Assert(value bool) {\n\tif !value {\n\t\tpanic(&AssertionError{stack: debug.Stack()})\n\t}\n}", "title": "" }, { "docid": "177ffedad7d3c8e8413e613e9c56c84d", "score": "0.4307877", "text": "func (m *Map) assert(cond bool) {\n\tif m.debug {\n\t\tif !cond {\n\t\t\tpanic(\"assertion failure\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5746afd5e4ca619863b1512053f1df5b", "score": "0.42974737", "text": "func BaselineClusterAssertions(kubeConfigFile string, namespaceOutputAttribute string) func(t *testing.T, output infratests.TerraformOutput) {\n\treturn func(t *testing.T, output infratests.TerraformOutput) {\n\t\tt.Parallel()\n\n\t\tvalidateFluxNamespace(t, kubeConfigFile)\n\t\tvalidateAADIdentityControllers(t, kubeConfigFile, output[namespaceOutputAttribute].(string))\n\t\tvalidateAADIdentityCustomResources(t, kubeConfigFile, output[namespaceOutputAttribute].(string))\n\n\t}\n}", "title": "" } ]
ffe633af194d55b448cefc77112c79b1
Authorize wraps handler with authorization middleware
[ { "docid": "b606653869b380209c543a8c141dec74", "score": "0.70962876", "text": "func (auth *Authorization) Authorize(handler http.Handler) http.Handler {\n\treturn auth.middleware.Handler(handler)\n}", "title": "" } ]
[ { "docid": "d25d3f5bd9136d272cba1093c6af21ea", "score": "0.7387067", "text": "func Authorize(next http.Handler, jwtSigningKey, apiKey string) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\thttputil.Authorize(w, r, jwtSigningKey, apiKey, next)\n\t})\n}", "title": "" }, { "docid": "6efebc4f2cf6693de79f1b27849b1c0f", "score": "0.7233656", "text": "func WrapAuthorize(hfn http.Handler, routeName string) http.HandlerFunc {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\n\t\turlValues := r.URL.Query()\n\n\t\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\t\trefRoles := gorillaContext.Get(r, \"auth_roles\").([]string)\n\t\tserviceToken := gorillaContext.Get(r, \"auth_service_token\").(string)\n\n\t\t// Check first if service token is used\n\t\tif serviceToken != \"\" && serviceToken == urlValues.Get(\"key\") {\n\t\t\thfn.ServeHTTP(w, r)\n\t\t\treturn\n\t\t}\n\n\t\tif auth.Authorize(routeName, refRoles, refStr) {\n\t\t\thfn.ServeHTTP(w, r)\n\t\t} else {\n\t\t\terr := APIErrorForbidden()\n\t\t\trespondErr(w, err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "e570a7da62ac43abb26963abc2de2c35", "score": "0.71483773", "text": "func (st *Store) AuthorizeHandler(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif t, err := st.processAuthHeader(r); nil != err {\n\t\t\tw.Header().Set(\"Authorization\", r.Header.Get(\"Authorization\"))\n\t\t\th.ServeHTTP(w, st.setCtxErr(r, err))\n\t\t} else {\n\t\t\th.ServeHTTP(w, st.setCtxToken(r, t))\n\t\t}\n\n\t\treturn\n\t})\n}", "title": "" }, { "docid": "be34007a84a4018b39cdbb563905a00c", "score": "0.703181", "text": "func (s *Services) authorize(handler func(wr http.ResponseWriter, req *http.Request, uid uint64)) http.HandlerFunc {\n\treturn func(wr http.ResponseWriter, req *http.Request) {\n\t\t// TODO: Save the requested url in a cookie that can be redirected to after logging in successfully\n\t\tuid, err := s.auth.Authorize(wr, req)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\thttp.Redirect(wr, req, \"/login\", 302)\n\t\t\treturn\n\t\t}\n\n\t\thandler(wr, req, uid)\n\t}\n}", "title": "" }, { "docid": "fc11d2d0476aadd61045a581ae5147c2", "score": "0.68867546", "text": "func (m Middleware) Authorized(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// Retrieve secret environment variable\n\t\thmacSecret := []byte(os.Getenv(\"JWT_SECRET\"))\n\n\t\t// Check request header for a Token\n\t\t// Check if the length of the Authorization value is greater than 0\n\t\tif len(r.Header.Get(\"Authorization\")) > 0 {\n\n\t\t\t// Get JWT from the Authorization header. As it gives us\n\t\t\t// bearer JWT, we need to split the JWT.\n\t\t\tauthSlice := strings.Split(r.Header.Get(\"Authorization\"), \" \")\n\t\t\tjwtToken := authSlice[1]\n\n\t\t\t// Parse token in header\n\t\t\ttoken, err := jwt.Parse(jwtToken, func(token *jwt.Token) (interface{}, error) {\n\t\t\t\t// Check that the algorithm used in parsed token is the same as what was issued by the server\n\t\t\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Unexpected signing method: %v\", token.Header[\"alg\"])\n\t\t\t\t}\n\t\t\t\t// Return the secret and nil error\n\t\t\t\treturn hmacSecret, nil\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If token is valid, server the argument handler\n\t\t\tif token.Valid {\n\t\t\t\th.ServeHTTP(w, r)\n\t\t\t}\n\t\t} else {\n\t\t\t// No token in header\n\t\t\thttp.Error(w, \"Not Authorized\", http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\n\t})\n}", "title": "" }, { "docid": "a240836ca36b05c1293c49ea8a13b0df", "score": "0.6821344", "text": "func (o *oauth) authorizeHandler(w http.ResponseWriter, r *http.Request) {\n\t// We aren't using HandleAuthorizeRequest here because that assumes redirect_uri\n\t// exists on the request. We're just checking for a valid token.\n\tti, err := o.server.ValidationBearerToken(r)\n\tif err != nil {\n\t\tauthFailures.With(\"method\", \"oauth2\").Add(1)\n\t\tencodeError(w, err)\n\t\treturn\n\t}\n\tif ti.GetClientID() == \"\" {\n\t\tauthFailures.With(\"method\", \"oauth2\").Add(1)\n\t\tencodeError(w, fmt.Errorf(\"missing client_id\"))\n\t\treturn\n\t}\n\n\t// Passed token check, return \"200 OK\"\n\tauthSuccesses.With(\"method\", \"oauth2\").Add(1)\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "88cffa52e6060e7b52179b7fee1c1881", "score": "0.6769299", "text": "func (p DirectHandler) AuthHandler(http.ResponseWriter, *http.Request) {}", "title": "" }, { "docid": "9a43ae9396c5a04966b6e58a126b54fe", "score": "0.67654246", "text": "func AuthHandler(handler AuthorisedRequestHandler) httprouter.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\t\t// Measure time spent executing shit\n\t\tstart := time.Now()\n\n\t\t// Authorize request\n\t\terr := authorize(r)\n\t\tif err != nil {\n\t\t\t// Logs [source IP] [request method] [request URL] [HTTP status] [time spent serving request]\n\t\t\tlog.Printf(\"%v\\t \\\"%v - %v\\\"\\t%v\\t%v\", sourceIP(r), r.Method, r.RequestURI, http.StatusUnauthorized, time.Since(start))\n\t\t\thttp.Error(w, err.Error(), http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\n\t\t// Pass to the real handler\n\t\tresponse, statusCode, err := handler(r, params)\n\n\t\t// Logs [source IP] [request method] [request URL] [HTTP status] [time spent serving request]\n\t\tlog.Printf(\"%v\\t \\\"%v - %v\\\"\\t%v\\t%v\", sourceIP(r), r.Method, r.RequestURI, statusCode, time.Since(start))\n\n\t\tif err != nil {\n\t\t\t// If we run into an error, throw it back to the client (as plain text)\n\t\t\thttp.Error(w, err.Error(), statusCode)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(statusCode)\n\t\tfmt.Fprintln(w, response)\n\t}\n}", "title": "" }, { "docid": "1d38949744a6e2d44ae235cc549dacdf", "score": "0.6753119", "text": "func AuthorizationMiddleware() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tID := c.Param(\"id\")\n\t\tbearer := c.Request.Header.Get(\"Authorization\")\n\n\t\tAuthorID := routes.AllBlogs[ID].AuthorID\n\n\t\tif bearer == AuthorID {\n\t\t\tc.Next()\n\t\t} else {\n\t\t\tc.JSON(400, \"Not Authorized\")\n\t\t\tc.Abort()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "794695b585643cfbdccd77ce3a371048", "score": "0.66722125", "text": "func Authorizer(userService userService, jwtService jwtService) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\taccessToken := extractToken(c)\n\t\tif accessToken == EmptyToken {\n\t\t\tabort(c, http.StatusBadRequest, \"Authorization header is missing or empty\")\n\t\t} else {\n\t\t\tparseJwt, err := jwtService.ParseJwt(accessToken)\n\n\t\t\tif err != nil {\n\t\t\t\tabort(c, http.StatusBadRequest, err.Error())\n\t\t\t} else if err := userVerification(c, parseJwt, userService); err != nil {\n\t\t\t\tabort(c, http.StatusUnauthorized, \"Unauthorized\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "db3b66e15dab75a57db04fa49840910f", "score": "0.6622973", "text": "func AuthMiddlewareHandlerFunc(authenticator *Authenticator, handleFunc http.HandlerFunc) func(w http.ResponseWriter, r *http.Request) {\n\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\tuser := authenticator.AuthenticateHttpRequest(r)\n\t\tif user != nil {\n\t\t\thandleFunc(w, r.WithContext(context.WithValue(r.Context(), \"User\", user)))\n\t\t} else {\n\t\t\tw.Header().Add(\"WWW-Authenticate\", \"Basic realm=restricted\")\n\t\t\thttp.Error(w, http.StatusText(http.StatusUnauthorized),\n\t\t\t\thttp.StatusUnauthorized)\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "018b2a09b8b705bb3539090e94957bfb", "score": "0.66215557", "text": "func AuthorizeMiddleware(storeUser *models.UserStore) (mw func(http.Handler) http.Handler) {\n\tmw = func(h http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\n\t\t\tuserId := gorillaContext.Get(r, \"id\").(int)\n\t\t\trole, _ := storeUser.GetUserRole(userId)\n\t\t\tif role == \"\" {\n\t\t\t\thttp.Redirect(w, r, \"/role\", http.StatusSeeOther)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tgorillaContext.Set(r, \"role\", role)\n\t\t\th.ServeHTTP(w, r)\n\t\t})\n\t}\n\treturn\n}", "title": "" }, { "docid": "4e9db1d23f6bbaeb5dbc27aca20e9fda", "score": "0.66181016", "text": "func AuthorizationMiddleware(c *gin.Context) {\n\tauth := strings.SplitN(c.GetHeader(\"Authorization\"), \" \", 2)\n\n\tif len(auth) != 2 || auth[0] != \"Bearer\" {\n\t\tc.Header(\"WWW-Authenticate\", \"Bearer\")\n\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{\n\t\t\t\"error\": \"The required authorization heads were not present in the request.\",\n\t\t})\n\n\t\treturn\n\t}\n\n\t// Try to match the request against the global token for the Daemon, regardless\n\t// of the permission type. If nothing is matched we will fall through to the Panel\n\t// API to try and validate permissions for a server.\n\tif auth[1] == config.Get().AuthenticationToken {\n\t\tc.Next()\n\n\t\treturn\n\t}\n\n\tc.AbortWithStatusJSON(http.StatusForbidden, gin.H{\n\t\t\"error\": \"You are not authorized to access this endpoint.\",\n\t})\n}", "title": "" }, { "docid": "0741e98e0d07fc919acc98c60c866bb3", "score": "0.65942734", "text": "func CheckForAuthMiddleware(s *Setup) func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tif isAuthenticated(r) {\n\t\t\t\tnext.ServeHTTP(w, r)\n\t\t\t\treturn\n\t\t\t}\n\t\t\ts.Logger.Printf(\"unauthenticated access attempt\")\n\t\t\taddCors(w)\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "73ae2a8545462e14077c7bf859358670", "score": "0.6533455", "text": "func (e VerifyHandler) AuthHandler(http.ResponseWriter, *http.Request) {}", "title": "" }, { "docid": "3ff4c069011b7c6331d74d9e9264a097", "score": "0.65182763", "text": "func (r *Controller) authorized() gin.HandlerFunc {\n\n\treturn func(c *gin.Context) {\n\n\t\tbearToken := c.GetHeader(\"Authorization\")\n\n\t\tstrArr := strings.Split(bearToken, \" \")\n\t\tif len(strArr) != 2 {\n\t\t\tc.AbortWithStatus(http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\n\t\ttk, err := r.UserToken.VerifyToken(strArr[1])\n\t\tif err != nil {\n\t\t\tc.AbortWithStatus(http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\n\t\tif _, ok := tk.Claims.(jwt.Claims); !ok && !tk.Valid {\n\t\t\tc.AbortWithStatus(http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "cbdb1859221082bb3e443237be85b9fa", "score": "0.6513535", "text": "func AuthMiddlewareHandler(authenticator *Authenticator, h http.Handler) http.Handler {\n\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\n\t\tuser := authenticator.AuthenticateHttpRequest(r)\n\t\tif user != nil {\n\t\t\th.ServeHTTP(w, r.WithContext(context.WithValue(r.Context(), \"User\", user)))\n\t\t} else {\n\t\t\tw.Header().Add(\"WWW-Authenticate\", \"Basic realm=restricted\")\n\t\t\thttp.Error(w, http.StatusText(http.StatusUnauthorized),\n\t\t\t\thttp.StatusUnauthorized)\n\t\t}\n\n\t})\n\n}", "title": "" }, { "docid": "23d8fd8a48451d6b3b20918fe1eb193b", "score": "0.64139515", "text": "func (r *oauthProxy) oauthAuthorizationHandler(w http.ResponseWriter, req *http.Request) {\n\tctx, span, logger := r.traceSpan(req.Context(), \"authorization handler\")\n\tif span != nil {\n\t\tdefer span.End()\n\t}\n\n\tif r.config.SkipTokenVerification {\n\t\tr.errorResponse(w, req.WithContext(ctx), \"\", http.StatusNotAcceptable, nil)\n\t\treturn\n\t}\n\n\tclient, err := r.getOAuthClient(r.getRedirectionURL(w, req.WithContext(ctx)))\n\tif err != nil {\n\t\tr.errorResponse(w, req.WithContext(ctx), \"failed to retrieve the oauth client for authorization\", http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\t// step: set the access type of the session\n\tvar accessType string\n\tif containedIn(\"offline\", r.config.Scopes, false) {\n\t\taccessType = \"offline\"\n\t}\n\n\tauthURL := client.AuthCodeURL(req.URL.Query().Get(\"state\"), accessType, \"\")\n\tlogger.Debug(\"incoming authorization request from client address\",\n\t\tzap.String(\"access_type\", accessType),\n\t\tzap.String(\"auth_url\", authURL),\n\t\tzap.String(\"client_ip\", req.RemoteAddr))\n\n\t// step: if we have a custom sign in page, lets display that\n\tif r.config.hasCustomSignInPage() {\n\t\tmodel := make(map[string]string)\n\t\tmodel[\"redirect\"] = authURL\n\t\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\t\tw.WriteHeader(http.StatusOK)\n\t\t_ = r.Render(w, path.Base(r.config.SignInPage), mergeMaps(model, r.config.Tags))\n\n\t\treturn\n\t}\n\n\tr.redirectToURL(authURL, w, req.WithContext(ctx), http.StatusTemporaryRedirect)\n}", "title": "" }, { "docid": "1d439e18bb78827162afe7d46bf32155", "score": "0.6412269", "text": "func Handler(ctx context.Context, event Request) (Response, error) {\n\tsecretKeyAccessToken := os.Getenv(\"SECRET_ACCESS_TOKEN\")\n\n\ttokenString := event.AuthorizationToken\n\tsecretAccessToken := []byte(secretKeyAccessToken)\n\n\terr := verifyToken(tokenString, secretAccessToken)\n\n\tif err != nil {\n\t\treturn Response{}, errors.New(\"Unauthorized\")\n\t}\n\n\treturn generatePolicy(\"customer\", \"Allow\", event.MethodArn), nil\n}", "title": "" }, { "docid": "e3dc2a56b73827408c6d97af8470ec9d", "score": "0.64056057", "text": "func AuthorizationMiddleware(handler http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tcookie, _ := r.Cookie(\"sessionid\")\n\n\t\tif !helpers.ValidateSession(string(cookie.Value)) {\n\t\t\tw.WriteHeader(http.StatusFound)\n\t\t\treturn\n\t\t}\n\n\t\thandler.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "0eb28b3dc32137c76119044b95264d58", "score": "0.63653266", "text": "func Authorized() gin.HandlerFunc {\n // Build handler function\n return func(c *gin.Context) {\n // Get session field\n user := utils.SessionGet(c, \"user\")\n\n // Check value\n if user != \"\" {\n // Update status\n c.Set(\"user\", user)\n } else {\n // Set status\n c.Redirect(302, \"/login\")\n\n // End the request\n c.Abort()\n return\n }\n\n // Jump to next function\n c.Next()\n }\n}", "title": "" }, { "docid": "195ae24bfca44344a73a449e3fad255b", "score": "0.6364942", "text": "func (a Authentic) AuthorizeMW(h buffalo.Handler) buffalo.Handler {\n\treturn func(c buffalo.Context) error {\n\t\tif a.app.Env == \"test\" {\n\t\t\treturn h(c)\n\t\t}\n\n\t\tuserID := c.Session().Get(SessionField)\n\t\tif userID == nil {\n\t\t\tc.Flash().Set(\"warning\", []string{\"Need to login first.\"})\n\t\t\treturn c.Redirect(http.StatusSeeOther, a.Config.LoginPath)\n\t\t}\n\n\t\tuser, err := a.provider.FindByID(userID)\n\n\t\tif err != nil || user == nil {\n\t\t\tc.Flash().Set(\"warning\", []string{\"Need to login first.\"})\n\t\t\treturn c.Redirect(http.StatusSeeOther, a.Config.LoginPath)\n\t\t}\n\n\t\treturn h(c)\n\t}\n}", "title": "" }, { "docid": "b96a0df25e57eae31fe72985a867292f", "score": "0.6341654", "text": "func authMiddleware(handler func(*int, http.ResponseWriter, *http.Request)) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// given auth token, finds user info\n\t\tc, statusCode, err := fetchCookie(r)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(statusCode)\n\t\t\t_, _ = fmt.Fprintf(w, err.Error())\n\t\t\treturn\n\t\t}\n\t\tuserId, err := wardrobe.VerifyCookie(c.Value)\n\t\tif err != nil {\n\t\t\tif err == redis.Nil {\n\t\t\t\t// This means there wasn't a valid user id mapped by the cookie\n\t\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t\t_, _ = fmt.Fprintf(w, \"Invalid session_token cookie: %s\", c.Value)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// If there is an error fetching from cache, return an internal server error status\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t_, _ = fmt.Fprintf(w, err.Error())\n\t\t\treturn\n\t\t}\n\t\tif userId == nil {\n\t\t\t// If the session token is not present in cache, return an unauthorized error\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\t\thandler(userId, w, r)\n\t}\n}", "title": "" }, { "docid": "44796d814897f793612619a3d98b7485", "score": "0.63360596", "text": "func (a *auth) middleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// Ensure there is a token\n\t\ttoken, err := getToken(&r.Header)\n\t\tif err != nil {\n\t\t\tserver.SetError(w, err, http.StatusInternalServerError)\n\t\t}\n\t\t// Check that the token is valid\n\t\ttokenAccountID, err := a.tokens.Validate(token)\n\t\tswitch err {\n\t\tcase tokens.ErrBadToken:\n\t\t\tserver.SetError(w, err, http.StatusForbidden)\n\t\t\treturn\n\t\tcase tokens.ErrInternalError:\n\t\t\tserver.SetError(w, err, http.StatusInternalServerError)\n\t\t\treturn\n\t\tdefault:\n\t\t\tbreak\n\t\t}\n\t\t// Fetch the account associated with the resource request\n\t\taccountID, err := a.getAccount(r)\n\t\t// Ensure we were able to get the account\n\t\tswitch err {\n\t\tcase nil:\n\t\t\tbreak\n\t\tcase errPathParameterMissing:\n\t\t\t// We shouldn't ever get this, gorilla should handle it\n\t\t\tserver.SetError(w, err, http.StatusInternalServerError)\n\t\t\treturn\n\t\tdefault:\n\t\t\t// Something else went wrong, e.g. accessing database\n\t\t\tserver.SetError(w, err, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\t// Ensure we are authorised to access the account's resources\n\t\tif accountID != tokenAccountID {\n\t\t\t// Don't reveal that the account exists by returning 403\n\t\t\tserver.SetError(w, errors.New(\"Not found\"), http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\t\t// Record the account ID in the context, in case people want it\n\t\tctx := context.WithValue(r.Context(), server.AccountIdKey{}, accountID)\n\t\t// Call the next handler, which can be another middleware in the chain, or the final handler.\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "title": "" }, { "docid": "18da38f4b67bc8f1993784aca354e966", "score": "0.6335647", "text": "func (s Server) AuthMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// Log request\n\t\tglog.Infof(\"%s %v: %+v\", r.RemoteAddr, r.Method, r.URL)\n\n\t\t// Check for none API calls\n\t\thttpPath := r.URL.Path\n\t\tif len(httpPath) <= len(s.APIPath) || httpPath[:len(s.APIPath)] != s.APIPath ||\n\t\t\thttpPath[len(s.APIPath):] == \".well-known/oauth-authorization-server\" {\n\t\t\tnext.ServeHTTP(w, r)\n\n\t\t\treturn\n\t\t}\n\n\t\t// If we are using OAuth2 server, try to use the bearer code cookie\n\t\tif s.OAuthServer != nil {\n\t\t\ts.AddCodeAuthentication(next, w, r)\n\t\t\treturn\n\t\t}\n\n\t\t// If we are using OAuth2 server, try to use the bearer code cookie\n\t\tif s.JWTTokenRSAKey != nil {\n\t\t\ts.AddJWTAuthentication(next, w, r)\n\t\t\treturn\n\t\t}\n\n\t\thandleError(w, fmt.Errorf(\"missing JWT public key and/or OAuth2, can't access k8s API server\"))\n\t})\n}", "title": "" }, { "docid": "1f104a21ae89e0d2b151743f05d774b5", "score": "0.6313932", "text": "func (a *Auth) Handler(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// if next handler is nil then raise an error\n\t\ta.pkgLog(\"Auth JWT middleware\")\n\t\tif h == nil {\n\t\t\ta.errorHandler.ServeHTTP(w, r)\n\t\t\treturn\n\t\t}\n\n\t\t// Process the request. If it returns an error,\n\t\t// that indicates the request should not continue.\n\t\tauth_token, err := a.Process(w, r)\n\n\t\t// If there was an error, do not continue.\n\t\tif err != nil {\n\t\t\tif auth_token != nil {\n\t\t\t\ta.NullifyTokens(auth_token.ID, w)\n\t\t\t}\n\t\t\tif err == UnauthorizedRequest {\n\t\t\t\ta.pkgLog(\"Unauthorized processing\\n\")\n\t\t\t\ta.unauthorizedHandler.ServeHTTP(w, r)\n\t\t\t\treturn\n\t\t\t}\n\t\t\ta.pkgLog(\"Error processing\\n\")\n\t\t\ta.pkgLog(\"%#v\\n\", err)\n\t\t\ta.errorHandler.ServeHTTP(w, r)\n\t\t\treturn\n\t\t}\n\t\tif auth_token != nil {\n\t\t\tr = contextSave(r, authTokenKey, auth_token)\n\t\t}\n\t\th.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "e8da9e38f55b93fbb58599d396f003f4", "score": "0.6298391", "text": "func (srv *targetServiceHandler) auth(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tctx := httpbakery.ContextWithRequest(context.TODO(), req)\n\t\tops, err := opsForRequest(req)\n\t\tif err != nil {\n\t\t\tfail(w, http.StatusInternalServerError, \"%v\", err)\n\t\t\treturn\n\t\t}\n\t\tauthChecker := srv.checker.Auth(httpbakery.RequestMacaroons(req)...)\n\t\tif _, err = authChecker.Allow(ctx, ops...); err != nil {\n\t\t\thttpbakery.WriteError(ctx, w, srv.oven.Error(ctx, req, err))\n\t\t\treturn\n\t\t}\n\t\th.ServeHTTP(w, req)\n\t})\n}", "title": "" }, { "docid": "d2cd617ededab31a7d30c6d67d23c646", "score": "0.62916565", "text": "func headerAuthHandler(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// if requestVerifyAuthHeader(r) {\n\t\tif claims := requestAuthHeaderClaims(r); claims != nil {\n\t\t\tif shouldRefreshJWT(claims) {\n\t\t\t\t// log.Println(\"Updating token for\", claims[\"email\"])\n\t\t\t\tlog.Println(\"Updating token for JWT with claims:\", claims)\n\t\t\t\ttokenString := generateJWTWithClaims(claims)\n\t\t\t\tw.Header()[\"Authorization\"] = []string{\"Bearer \" + tokenString}\n\t\t\t}\n\t\t\t// https://gocodecloud.com/blog/2016/11/15/simple-golang-http-request-context-example/\n\t\t\t// http://go-talks.appspot.com/github.com/dkondratovych/golang-ua-meetup/go-context/ctx.slide\n\t\t\t// create context with user id and JWT claims\n\t\t\tauth := AuthInfo{ID: claims[\"id\"].(string), Admin: claims[\"admin\"].(bool), Claims: claims}\n\t\t\tctx := context.WithValue(r.Context(), \"auth\", auth)\n\t\t\tr = r.WithContext(ctx)\n\t\t\tnext.ServeHTTP(w, r)\n\t\t} else {\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "63ee00fced2fdd32d80b3b99baa8befb", "score": "0.6286825", "text": "func Authenticate(next buffalo.Handler) buffalo.Handler {\n\treturn func(c buffalo.Context) error {\n\t\t// do some work before calling the next handler\n\t\terr := checkJwt(c.Response(), c.Request())\n\t\tif err == nil {\n\t\t\terr := next(c)\n\t\t\t// do some work after calling the next handler\n\t\t\treturn err\n\t\t}\n\n\t\treturn err\n\t}\n}", "title": "" }, { "docid": "e5bf0d0a328ad0d870cdbda50fbe89ba", "score": "0.62865055", "text": "func Authorize(w http.ResponseWriter, r *http.Request, authorizer Authorizer) {\n\tauthReq, err := ParseAuthorizeRequest(r, authorizer.Decoder())\n\tif err != nil {\n\t\tAuthRequestError(w, r, authReq, err, authorizer.Encoder())\n\t\treturn\n\t}\n\tif authReq.RequestParam != \"\" && authorizer.RequestObjectSupported() {\n\t\tauthReq, err = ParseRequestObject(r.Context(), authReq, authorizer.Storage(), authorizer.Issuer())\n\t\tif err != nil {\n\t\t\tAuthRequestError(w, r, authReq, err, authorizer.Encoder())\n\t\t\treturn\n\t\t}\n\t}\n\tvalidation := ValidateAuthRequest\n\tif validater, ok := authorizer.(AuthorizeValidator); ok {\n\t\tvalidation = validater.ValidateAuthRequest\n\t}\n\tuserID, err := validation(r.Context(), authReq, authorizer.Storage(), authorizer.IDTokenHintVerifier())\n\tif err != nil {\n\t\tAuthRequestError(w, r, authReq, err, authorizer.Encoder())\n\t\treturn\n\t}\n\tif authReq.RequestParam != \"\" {\n\t\tAuthRequestError(w, r, authReq, oidc.ErrRequestNotSupported(), authorizer.Encoder())\n\t\treturn\n\t}\n\treq, err := authorizer.Storage().CreateAuthRequest(r.Context(), authReq, userID)\n\tif err != nil {\n\t\tAuthRequestError(w, r, authReq, oidc.DefaultToServerError(err, \"unable to save auth request\"), authorizer.Encoder())\n\t\treturn\n\t}\n\tclient, err := authorizer.Storage().GetClientByClientID(r.Context(), req.GetClientID())\n\tif err != nil {\n\t\tAuthRequestError(w, r, req, oidc.DefaultToServerError(err, \"unable to retrieve client by id\"), authorizer.Encoder())\n\t\treturn\n\t}\n\tRedirectToLogin(req.GetID(), client, w, r)\n}", "title": "" }, { "docid": "a337a2310e5124fa30180711310c0e37", "score": "0.62841064", "text": "func IsAuthorized(endpoint func(w http.ResponseWriter, r *http.Request)) http.Handler {\n\t//return http.Handler type\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tswitch r.Method {\n\t\t//handle GET requests\n\t\tcase \"GET\":\n\t\t\t//check if cookie exists\n\t\t\tif r.Header[\"Cookie\"] != nil {\n\t\t\t\t//get cookie from request header, 6: takes out \"Token=\" string which causes int64 error\n\t\t\t\tcookieBody := r.Header.Get(\"Cookie\")[6:]\n\t\t\t\t//parse cookie body and check token, 2nd param is a function which returns the signingKey\n\t\t\t\ttoken, parseErr := jwt.Parse(cookieBody, func(token *jwt.Token) (interface{}, error) {\n\t\t\t\t\t//handle err\n\t\t\t\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\t\t\t\treturn nil, errors.New(\"Unauthorized\")\n\t\t\t\t\t}\n\n\t\t\t\t\t//return signing key to parse\n\t\t\t\t\treturn mySigningKey, nil\n\t\t\t\t})\n\n\t\t\t\t//handle err\n\t\t\t\tif parseErr != nil || !token.Valid {\n\t\t\t\t\tw.WriteHeader(403)\n\t\t\t\t\tw.Write([]byte(\"Unauthorized\"))\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t//Authorized, 200 response and serve endpoint\n\t\t\t\tw.WriteHeader(200)\n\t\t\t\tw.Write([]byte(\"Access granted\\n\"))\n\t\t\t\tendpoint(w, r)\n\t\t\t\treturn\n\n\t\t\t}\n\t\t\t//if no cookie, user does not have access\n\t\t\tw.WriteHeader(403)\n\t\t\tw.Write([]byte(\"Unauthorized\"))\n\t\t\treturn\n\n\t\t//ignore all other request methods\n\t\tdefault:\n\t\t\tw.WriteHeader(401)\n\t\t\tw.Write([]byte(\"Bad request\"))\n\t\t\treturn\n\t\t}\n\t})\n}", "title": "" }, { "docid": "9ff47d27aaca83f35b300aa839c7e1ee", "score": "0.62800866", "text": "func Handler(s Server, authorizePath, tokenPath string) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tswitch r.URL.Path {\n\t\tcase authorizePath:\n\t\t\tAuthorize(s).ServeHTTP(w, r)\n\t\tdefault:\n\t\t\thttp.Error(w, \"Not found\", http.StatusNotFound)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "db0e0005fe747db313928f949336aab7", "score": "0.6266533", "text": "func Authorize(next buffalo.Handler) buffalo.Handler {\n\treturn func(c buffalo.Context) error {\n\t\tif uid := c.Session().Get(\"current_user_id\"); uid == nil {\n\t\t\tc.Flash().Add(\"danger\", \"You must be authorized to see that page\")\n\t\t\treturn c.Redirect(302, \"/\")\n\t\t}\n\t\treturn next(c)\n\t}\n}", "title": "" }, { "docid": "70ebbf61ba952c57ad297f9308138521", "score": "0.62649", "text": "func Auth() Middleware {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\t// Parse takes the token string and a function for looking up the key. The latter is especially\n\t\t\t// useful if you use multiple keys for your application. The standard is to use 'kid' in the\n\t\t\t// head of the token to identify which key to use, but the parsed token (head and claims) is provided\n\t\t\t// to the callback, providing flexibility.\n\t\t\ttoken, err := jwt.Parse(r.Header.Get(\"Token\"), func(token *jwt.Token) (interface{}, error) {\n\t\t\t\t// Don't forget to validate the alg is what you expect:\n\t\t\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Unexpected signing method: %v\", token.Header[\"alg\"])\n\t\t\t\t}\n\n\t\t\t\t// hmacSampleSecret is a []byte containing your secret, e.g. []byte(\"my_secret_key\")\n\t\t\t\treturn []byte(\"asndbu1vh23b12v31298yxcmnbas\"), nil\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// ctx := context.WithValue(r.Context(), domain.ContextKeyUser, <user>)\n\n\t\t\t// if claims, ok := token.Claims.(jwt.MapClaims); ok && token.Valid {\n\t\t\t// return\n\t\t\t// } else {\n\t\t\t// return\n\t\t\t// }\n\n\t\t\t// h.ServeHTTP(w, r.WithContext(merchant.NewContext(r.Context())))\n\t\t})\n\t}\n}", "title": "" }, { "docid": "001c70e66b8aade601b38f8f052d0515", "score": "0.6263264", "text": "func (t *Controller) AuthMiddleware() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\n\t\t// Set access token and start the auth process\n\t\tvar access_token = \"\"\n\n\t\t// Make sure we have a Bearer token.\n\t\tauth := strings.SplitN(c.Request.Header.Get(\"Authorization\"), \" \", 2)\n\n\t\tif len(auth) != 2 || auth[0] != \"Bearer\" {\n\n\t\t\t// We allow access token from the command line\n\t\t\tif os.Getenv(\"APP_ENV\") == \"local\" {\n\n\t\t\t\taccess_token = c.Query(\"access_token\")\n\n\t\t\t\tif len(access_token) <= 0 {\n\t\t\t\t\tc.JSON(http.StatusUnauthorized, gin.H{\"error\": \"Authorization Failed (#101)\"})\n\t\t\t\t\tc.AbortWithStatus(401)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tc.JSON(http.StatusUnauthorized, gin.H{\"error\": \"Authorization Failed (#001)\"})\n\t\t\t\tc.AbortWithStatus(401)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t} else {\n\t\t\taccess_token = auth[1]\n\t\t}\n\n\t\t// See if this session is in our db.\n\t\tsession, err := t.DB.GetByAccessToken(access_token)\n\n\t\tif err != nil {\n\t\t\tservices.Critical(\"Access Token Not Found - Unable to Authenticate via HTTP (#002)\")\n\t\t\tc.JSON(http.StatusUnauthorized, gin.H{\"error\": \"Authorization Failed (#002)\"})\n\t\t\tc.AbortWithStatus(401)\n\t\t\treturn\n\t\t}\n\n\t\t// Get this user is in our db.\n\t\tuser, err := t.DB.GetUserById(session.UserId)\n\n\t\tif err != nil {\n\t\t\tservices.Critical(\"User Not Found - Unable to Authenticate - UserId (HTTP) : \" + fmt.Sprint(session.UserId) + \" - Session Id : \" + fmt.Sprint(session.Id))\n\t\t\tc.JSON(http.StatusUnauthorized, gin.H{\"error\": \"Authorization Failed (#003)\"})\n\t\t\tc.AbortWithStatus(401)\n\t\t\treturn\n\t\t}\n\n\t\t// Log this request into the last_activity col.\n\t\tsession.LastActivity = time.Now()\n\t\tsession.LastIpAddress = realip.RealIP(c.Request)\n\t\tt.DB.UpdateSession(&session)\n\n\t\t// Add this user to the context\n\t\tc.Set(\"userId\", user.Id)\n\n\t\t// CORS for local development.\n\t\tif os.Getenv(\"APP_ENV\") == \"local\" {\n\t\t\tc.Writer.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\t}\n\n\t\t// On to next request in the Middleware chain.\n\t\tc.Next()\n\t}\n}", "title": "" }, { "docid": "253793308b7c5b20a4030d4dc078d8d8", "score": "0.6255189", "text": "func (h *Handler) oAuthMiddleware(c *gin.Context) {\n\tauthError := func() error {\n\t\twt := c.GetHeader(\"Authorization\")\n\t\tif wt == \"\" {\n\t\t\treturn errors.New(\"Authorization header not set\")\n\t\t}\n\t\tclaims, err := h.parseJWT(wt)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"could not parse JWT\")\n\t\t}\n\t\tc.Set(\"user\", claims)\n\t\treturn nil\n\t}()\n\tif authError != nil {\n\t\tc.AbortWithStatusJSON(http.StatusForbidden, gin.H{\n\t\t\t\"error\": \"authentication failed\",\n\t\t})\n\t\tlogrus.Debugf(\"Authentication middleware check failed: %v\\n\", authError)\n\t\treturn\n\t}\n\tc.Next()\n}", "title": "" }, { "docid": "250f265167e66192e7bfd29dd45ee693", "score": "0.62531143", "text": "func (m JWTAuthMiddleware) Handler() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tauthHeader := c.Request.Header.Get(\"Authorization\")\n\t\tt := strings.Split(authHeader, \" \")\n\t\tif len(t) == 2 {\n\t\t\tauthToken := t[1]\n\t\t\tauthorized, err := m.service.Authorize(authToken)\n\t\t\tif authorized {\n\t\t\t\tc.Next()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tc.JSON(http.StatusInternalServerError, gin.H{\n\t\t\t\t\"error\": err.Error(),\n\t\t\t})\n\t\t\tm.logger.Error(err)\n\t\t\tc.Abort()\n\t\t\treturn\n\t\t}\n\t\tc.JSON(http.StatusUnauthorized, gin.H{\n\t\t\t\"error\": \"you are not authorized\",\n\t\t})\n\t\tc.Abort()\n\t}\n}", "title": "" }, { "docid": "fea9ecfbfe34c8bee3bd7f4cf1188ccf", "score": "0.62500906", "text": "func isAuthorized(endpoint func(http.ResponseWriter, *http.Request)) http.Handler {\n\treturn http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {\n\t\tif request.Header[\"Token\"] != nil {\n\t\t\ttoken, err := jwt.Parse(request.Header[\"Token\"][0], func(token *jwt.Token) (interface{}, error) {\n\t\t\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Theer an error\")\n\t\t\t\t}\n\t\t\t\treturn mySecretKey, nil\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(\"error while parsing token : \", err)\n\t\t\t}\n\t\t\tif token.Valid {\n\t\t\t\tendpoint(writer, request)\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Fprintf(writer, \"Not Authorized\")\n\t\t}\n\t})\n}", "title": "" }, { "docid": "ae9754e8381cb0be049eee032e105bdd", "score": "0.6237809", "text": "func authMiddleware() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\t// Get the client secret key\n\t\terr := jwtMiddleWare.CheckJWT(c.Writer, c.Request)\n\t\tif err != nil {\n\t\t\t// Token not found\n\t\t\tfmt.Println(err)\n\t\t\tc.Abort()\n\t\t\tc.Writer.WriteHeader(http.StatusUnauthorized)\n\t\t\tc.Writer.Write([]byte(\"Unauthorized\"))\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2a6ed86f2f65138a74b4f98d377d9e28", "score": "0.6228621", "text": "func AuthMiddlware() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tclaim, ok := auth.TokenValid(c)\n\t\tif ok != nil {\n\t\t\t// c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{\"error\": \"User needs to be signed in to access this service\"})\n\t\t\treturn\n\t\t}\n\n\t\tctx := context.WithValue(\n\t\t\tc.Request.Context(),\n\t\t\ttypes.UserKey(\"user\"),\n\t\t\tclaim)\n\n\t\tc.Request = c.Request.WithContext(ctx)\n\t\tc.Next()\n\t}\n}", "title": "" }, { "docid": "c0e4f5019cce918eebbd1c2cf2b4377f", "score": "0.6210772", "text": "func authMiddleware(authService auth.Service, userService user.Service) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tauthHeader := c.GetHeader(\"Authorization\")\n\n\t\tif !strings.Contains(authHeader, \"Bearer\") {\n\t\t\tresponse := helper.APIResponse(\"Unauthorized\", http.StatusUnauthorized, \"error\", nil)\n\t\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, response)\n\t\t\treturn\n\t\t}\n\n\t\t// Bearer tokentokentoken\n\t\ttokenString := \"\"\n\t\tarrayToken := strings.Split(authHeader, \" \")\n\t\tif len(arrayToken) == 2 {\n\t\t\ttokenString = arrayToken[1]\n\t\t}\n\n\t\ttoken, err := authService.ValidateToken(tokenString)\n\t\tif err != nil {\n\t\t\tresponse := helper.APIResponse(\"Unauthorized\", http.StatusUnauthorized, \"error\", nil)\n\t\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, response)\n\t\t\treturn\n\t\t}\n\n\t\tclaim, ok := token.Claims.(jwt.MapClaims)\n\t\tif !ok || !token.Valid {\n\t\t\tresponse := helper.APIResponse(\"Unauthorized\", http.StatusUnauthorized, \"error\", nil)\n\t\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, response)\n\t\t\treturn\n\t\t}\n\n\t\tuserID := int(claim[\"user_id\"].(float64))\n\n\t\tuser, err := userService.GetUserById(userID)\n\t\tif err != nil {\n\t\t\tresponse := helper.APIResponse(\"Unauthorized\", http.StatusUnauthorized, \"error\", nil)\n\t\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, response)\n\t\t\treturn\n\t\t}\n\n\t\tc.Set(\"currentUser\", user)\n\t}\n}", "title": "" }, { "docid": "9edb935900afc3153cfe5e6c3402feee", "score": "0.62058926", "text": "func (route routerConfig) authMiddleware(deviceDB *devices.Database) func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {\n\t\t\tif route.routeAuth[request.URL.Path] {\n\t\t\t\tnext.ServeHTTP(writer, request)\n\t\t\t} else {\n\t\t\t\tdev, err := auth.VerifyAccessToken(request, deviceDB)\n\t\t\t\tif err != nil {\n\t\t\t\t\terr.Encode(&writer)\n\t\t\t\t\treturn\n\t\t\t\t} else {\n\t\t\t\t\tcontext.Set(request, \"localpart\", dev.UserID)\n\t\t\t\t\tnext.ServeHTTP(writer, request)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "325066ffb2e79a0a97bbd2b6de54f072", "score": "0.6201291", "text": "func Authorize(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\t// Get token from request\n\t// El extractor podría ser: request.AuthorizationHeaderExtractor o tal vez el personalizado TokenFromAuthHeader\n\ttoken, err := request.ParseFromRequestWithClaims(r, request.OAuth2Extractor, &models.AppClaims{}, func(token *jwt.Token) (interface{}, error) {\n\t\t// Como solo tenemos una llave pública, la devolvemos\n\t\treturn verifyKey, nil\n\t})\n\tif err != nil {\n\t\tswitch err.(type) {\n\t\tcase *jwt.ValidationError:\n\t\t\tvErr := err.(*jwt.ValidationError)\n\t\t\tswitch vErr.Errors {\n\t\t\tcase jwt.ValidationErrorExpired:\n\t\t\t\tDisplayError(w, err, \"Su token ha expirado, por favor vuelva a ingresar\", 401)\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tDisplayError(w, err, \"Error en el token de acceso.\", 500)\n\t\t\t\treturn\n\t\t\t}\n\t\tdefault:\n\t\t\tDisplayError(w, err, \"Error al procesar el token.\", 500)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif token.Valid {\n\t\tcontext.Set(r, \"user\", token.Claims.(*models.AppClaims).User)\n\t\tcontext.Set(r, \"scopes\", token.Claims.(*models.AppClaims).Scopes)\n\t\tnext(w, r)\n\t} else {\n\t\tDisplayError(w, err, \"Token de acceso inválido.\", 401)\n\t}\n}", "title": "" }, { "docid": "5cc6b7847b109006d05b3f5b8d3d52b3", "score": "0.61918765", "text": "func BuildAuthorizeHandler(srv *server.Server) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) error {\n\t\t// Implementation example\n\t\t// https://github.com/go-oauth2/oauth2/blob/b46cf9f1db6551beb549ad1afe69826b3b2f1abf/example/server/server.go#L62-L82\n\t\tif err := srv.HandleAuthorizeRequest(w, r); err != nil {\n\t\t\treturn apperrors.Wrap(fmt.Errorf(\"%w: %v\", apperrors.ErrInvalid, err))\n\t\t}\n\n\t\treturn nil\n\t}\n\n\treturn httpjson.HandlerFunc(fn)\n}", "title": "" }, { "docid": "c3860dce9cf93fad0ce10937837d3658", "score": "0.61863035", "text": "func AuthenticationMiddleware(next http.HandlerFunc) http.HandlerFunc {\n return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n authorizationHeader := req.Header.Get(\"authorization\")\n if authorizationHeader != \"\" {\n bearerToken := strings.Split(authorizationHeader, \" \")\n if len(bearerToken) == 2 {\n token, error := jwt.Parse(bearerToken[1], func(token *jwt.Token) (interface{}, error) {\n if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n return nil, fmt.Errorf(\"There was an error\")\n }\n return []byte(\"secret\"), nil\n })\n if error != nil {\n json.NewEncoder(w).Encode(Exception{Message: error.Error()})\n return\n }\n if token.Valid {\n log.Println(\"TOKEN WAS VALID\")\n context.Set(req, \"decoded\", token.Claims)\n next(w, req)\n } else {\n json.NewEncoder(w).Encode(Exception{Message: \"Invalid authorization token\"})\n }\n }\n } else {\n json.NewEncoder(w).Encode(Exception{Message: \"An authorization header is required\"})\n }\n })\n}", "title": "" }, { "docid": "1725d35fcb9fc1d7f1716012cb5cc9bf", "score": "0.6184443", "text": "func (v Verifier) Middleware(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Make sure that the incoming request has our token header\n\t\t// Could also look in the cookies for CF_AUTHORIZATION\n\t\taccessJWT := r.Header.Get(\"Cf-Access-Jwt-Assertion\")\n\n\t\tif len(accessJWT) < 1 {\n\t\t\tc, err := r.Cookie(\"CF_Authorization\")\n\t\t\tif err == nil {\n\t\t\t\taccessJWT = c.Value\n\t\t\t}\n\t\t}\n\n\t\tif len(accessJWT) < 1 {\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\tw.Write([]byte(\"No token on the request\"))\n\t\t\treturn\n\t\t}\n\n\t\t// Verify the access token\n\t\tctx = r.Context()\n\t\tif ok := v.Verify(accessJWT); !ok {\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\tw.Write([]byte(fmt.Sprintf(\"Invalid token\")))\n\t\t\treturn\n\t\t}\n\t\tnext.ServeHTTP(w, r)\n\t}\n\treturn http.HandlerFunc(fn)\n}", "title": "" }, { "docid": "20659e587760fa52632752b2311193a7", "score": "0.61790776", "text": "func Authorize(obj string, act string, enforcer *casbin.Enforcer) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\t// Get current user/subject\n\t\tsub, existed := c.Get(\"userID\")\n\t\tif !existed {\n\t\t\tc.AbortWithStatusJSON(401, gin.H{\"msg\": \"User hasn't logged in yet\"})\n\t\t\treturn\n\t\t}\n\n\t\t// Load policy from Database\n\t\terr := enforcer.LoadPolicy()\n\t\tif err != nil {\n\t\t\tc.AbortWithStatusJSON(500, gin.H{\"msg\": \"Failed to load policy from DB\"})\n\t\t\treturn\n\t\t}\n\n\t\t// Casbin enforces policy\n\t\tok, err := enforcer.Enforce(fmt.Sprint(sub), obj, act)\n\n\t\tif err != nil {\n\t\t\tc.AbortWithStatusJSON(500, gin.H{\"msg\": \"Error occurred when authorizing user\"})\n\t\t\treturn\n\t\t}\n\n\t\tif !ok {\n\t\t\tc.AbortWithStatusJSON(403, gin.H{\"msg\": \"You are not authorized\"})\n\t\t\treturn\n\t\t}\n\t\tc.Next()\n\t}\n}", "title": "" }, { "docid": "3197a1eb708bd55fc9c5532fc36b8e6a", "score": "0.61774045", "text": "func (c Client) HandleAuthorization(handleAccess func(access Access, err error)) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tquery := r.URL.Query()\n\n\t\thandleAccess(c.getAccessToken(query.Get(\"code\")))\n\t}\n}", "title": "" }, { "docid": "9b0c08fc027830a6eb1081ff4f0666b7", "score": "0.6176833", "text": "func Auth() func(http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tc := TokenFromHeader(r)\n\t\t\tlog.Printf(\"%v %v\", r.URL, r.Header)\n\t\t\t// Allow unauthenticated users in\n\t\t\tif c == \"\" {\n\t\t\t\tnext.ServeHTTP(w, r)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\toUser := &models.User{}\n\t\t\tclaims, status := oUser.AuthCheck(c)\n\n\t\t\tif status != 200 {\n\t\t\t\tnext.ServeHTTP(w, r)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tmodels.GetRow(oUser, &models.User{\n\t\t\t\tNo: claims.No,\n\t\t\t})\n\t\t\tctxValue := map[string]interface{}{\n\t\t\t\t\"user\": oUser,\n\t\t\t\t\"status\": status,\n\t\t\t}\n\n\t\t\t// put it in context\n\t\t\tctx := context.WithValue(r.Context(), ctxKey, ctxValue)\n\t\t\t//ctxStatus := context.WithValue(r.Context(), authStatusKey, status)\n\n\n\t\t\t// and call the next with our new context\n\t\t\tr = r.WithContext(ctx)\n\t\t\t//r = r.WithContext(ctxStatus)\n\n\n\t\t\tnext.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "e684e358dd56365210f321a4ab40e6ed", "score": "0.61765176", "text": "func (a Authorizer) Authorize(rw http.ResponseWriter, req *http.Request) error {\n\treturn nil\n}", "title": "" }, { "docid": "e684e358dd56365210f321a4ab40e6ed", "score": "0.61765176", "text": "func (a Authorizer) Authorize(rw http.ResponseWriter, req *http.Request) error {\n\treturn nil\n}", "title": "" }, { "docid": "1a44a40099d69bf4ff7b8b809a601fd2", "score": "0.6153391", "text": "func MustAuth(handler http.Handler) http.Handler {\n return &authHandler{next: handler}\n}", "title": "" }, { "docid": "fbe2d293102e0060d2c9309d4c6c79f1", "score": "0.61526895", "text": "func AuthMiddleware() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tauthHeader := c.GetHeader(\"authorization\")\n\t\tif authHeader == \"\" || len(authHeader) < len(\"Token\")+1 {\n\t\t\trestErr := resterror.NewUnAuthorizedError()\n\t\t\tc.JSON(restErr.StatusCode, restErr)\n\t\t\tc.Abort()\n\t\t\treturn\n\t\t}\n\n\t\ttoken := authHeader[len(\"Token \"):]\n\n\t\tauthService := services.JWTAuthService()\n\t\tresult, err := authService.ValidateToken(token)\n\t\tif err != nil || !result.Valid {\n\t\t\trestErr := resterror.NewUnAuthorizedError()\n\t\t\tc.JSON(restErr.StatusCode, restErr)\n\t\t\tc.Abort()\n\t\t\treturn\n\t\t}\n\n\t\tclaims := result.Claims.(jwt.MapClaims)\n\t\tc.Set(\"user_id\", claims[\"user_id\"])\n\t\tc.Set(\"is_admin\", claims[\"is_admin\"])\n\n\t\tc.Next()\n\t}\n}", "title": "" }, { "docid": "6868d26df15e8e18a523227f0d043ecc", "score": "0.6150347", "text": "func Middleware(next httprouter.Handle) httprouter.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\ttoken := r.Header.Get(\"Authorization\")\n\n\t\tsessionID := getSessionByToken(token)\n\t\tuserID, status := checkSession(sessionID)\n\t\tif !status {\n\t\t\tresponse := Response{\n\t\t\t\tStatus: statusFail,\n\t\t\t\tData: ResponseError{\n\t\t\t\t\tError: \"Authorization failed\",\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\tjson.NewEncoder(w).Encode(response)\n\n\t\t\treturn\n\t\t}\n\t\tr.ParseForm()\n\t\tr.Form.Set(\"user_id\", userID)\n\n\t\tnext(w, r, ps)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "bcc457d49ae69e825c7a7081f1b9b8b0", "score": "0.6150162", "text": "func Authenticate(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := r.Context()\n\n\t\t// Expecting: bearer <token>\n\t\tbearer := r.Header.Get(\"Authorization\")\n\t\tif len(bearer) == 0 {\n\t\t\thttp.Error(w, errAuthHeaderMissing.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tif len(bearer) < 6 || strings.ToLower(bearer[0:6]) != \"bearer\" {\n\t\t\thttp.Error(w, errAuthWrongHeaderFormat.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\taccessToken := bearer[7:]\n\t\taccessTokenClaims, err := entity.ParseAccessTokenClaims(accessToken)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\n\t\t// Add claims to the context so we can retrieve them later\n\t\tctx = context.WithValue(ctx, ClaimsKey, accessTokenClaims)\n\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "title": "" }, { "docid": "70b2357193737c1af3bff8a033597e52", "score": "0.6141156", "text": "func (mid *Middleware) AccessControl(next http.HandlerFunc) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tauth := strings.Fields(r.Header.Get(\"Authorization\"))\n\t\tif len(auth) > 1 && auth[0] == \"Bearer\" {\n\t\t\t// Found token\n\n\t\t\t// Check that token is not in redis\n\t\t\tloggedOut, _ := mid.RedisClient.ExistsKey(\"blacklist:\" + auth[1])\n\n\t\t\tif loggedOut {\n\t\t\t\tw.WriteHeader(401)\n\t\t\t\t// TODO: Change this to return a JSON object\n\t\t\t\tfmt.Fprintf(w, \"Invalid token\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tclaims, err := VerifyJWT(auth[1])\n\n\t\t\tif err != nil {\n\t\t\t\tw.WriteHeader(401)\n\t\t\t\t// TODO: Change this to return a JSON object\n\t\t\t\tfmt.Fprintf(w, \"Invalid token\")\n\t\t\t} else {\n\t\t\t\tuserID := claims[\"userId\"].(string)\n\t\t\t\texp := claims[\"exp\"].(float64)\n\t\t\t\texpS := strconv.FormatFloat(exp, 'E', -1, 64)\n\t\t\t\tr.Header.Add(\"uid\", userID)\n\t\t\t\tr.Header.Add(\"exp\", expS)\n\t\t\t\tr.Header.Add(\"token\", auth[1])\n\t\t\t\tnext.ServeHTTP(w, r)\n\t\t\t}\n\t\t} else {\n\t\t\tw.WriteHeader(401)\n\t\t\t// TODO: Change this to return a JSON object\n\t\t\tfmt.Fprintf(w, \"Invalid token\")\n\t\t}\n\t})\n}", "title": "" }, { "docid": "de11fbb0d3a63f77afb347069e4bf1d7", "score": "0.61368936", "text": "func handleAuthorize(rw http.ResponseWriter, req *http.Request) {\n\n\t// Get the Google URL which shows the Authentication page to the user.\n\turl := oauthCfg.AuthCodeURL(\"\")\n\n\t// Redirect user to that page.\n\thttp.Redirect(rw, req, url, http.StatusFound)\n}", "title": "" }, { "docid": "1c1bcd9c91f260e1744667b19c632927", "score": "0.6135337", "text": "func AuthenticationMiddleware() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tbearer := c.Request.Header.Get(\"Authorization\")\n\n\t\tif len(bearer) != 0 {\n\t\t\tc.Next()\n\t\t} else {\n\t\t\tc.JSON(400, \"Not Authenticated\")\n\t\t\tc.Abort()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a7ab4259731d735a505fb859083f1779", "score": "0.61295176", "text": "func AuthMiddleware(c *fiber.Ctx) error {\n\ttoken := c.Get(\"Authorization\")\n\tuser, err := auth.GetUserFromToken(token)\n\tif err != nil {\n\t\tc.Status(401)\n\t\tc.JSON(types.Error{\n\t\t\tMessage: \"Not Authorized\",\n\t\t})\n\t\treturn err\n\t}\n\tc.Locals(\"user\", user)\n\treturn c.Next()\n}", "title": "" }, { "docid": "e24685ae3232f95c971a9b191611c2c0", "score": "0.6122631", "text": "func AuthMiddleware(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer r.Body.Close()\n\n\tvar UserCred Credentials\n\tjson.Unmarshal(body, &UserCred)\n\n\ttoken, err := jwt.Parse(UserCred.Token, func(token *jwt.Token) (interface{}, error) {\n\t\treturn Secret, nil\n\t})\n\tif err == nil && token.Valid {\n\t\t// Create context to send username to other handlers after authentictaion\n\t\tcontext.Set(r, \"username\", UserCred.Username)\n\t\tnext(w, r)\n\t} else {\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tfmt.Fprint(w, \"Unauthorized, You should sign in First\")\n\t}\n}", "title": "" }, { "docid": "feabecdc6f6560c2d43462524f125f8e", "score": "0.61165154", "text": "func (p *OIDCProvider) Middleware() Middleware {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tvar token string\n\n\t\t\tauthorizationHeader := r.Header.Get(\"Authorization\")\n\t\t\tif authorizationHeader != \"\" {\n\t\t\t\tauthorization := strings.Split(authorizationHeader, \" \")\n\t\t\t\tif len(authorization) != 2 {\n\t\t\t\t\tconst msg = \"invalid Authorization header\"\n\t\t\t\t\tlevel.Debug(p.logger).Log(\"msg\", msg)\n\t\t\t\t\thttp.Error(w, msg, http.StatusUnauthorized)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\ttoken = authorization[1]\n\t\t\t} else {\n\t\t\t\tcookie, err := r.Cookie(p.cookieName)\n\t\t\t\tif err != nil {\n\t\t\t\t\ttenant, ok := GetTenant(r.Context())\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\tconst msg = \"error finding tenant\"\n\t\t\t\t\t\tlevel.Warn(p.logger).Log(\"msg\", msg)\n\t\t\t\t\t\thttp.Error(w, msg, http.StatusInternalServerError)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\t// Redirect users to the OIDC login\n\t\t\t\t\tw.Header().Set(\"Location\", path.Join(\"/oidc\", tenant, \"/login\"))\n\t\t\t\t\thttp.Error(w, \"failed to find token\", http.StatusFound)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\ttoken = cookie.Value\n\t\t\t}\n\n\t\t\tidToken, err := p.verifier.Verify(oidc.ClientContext(r.Context(), p.client), token)\n\t\t\tif err != nil {\n\t\t\t\tconst msg = \"failed to authenticate\"\n\t\t\t\tlevel.Debug(p.logger).Log(\"msg\", msg, \"err\", err)\n\t\t\t\thttp.Error(w, msg, http.StatusBadRequest)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tsub := idToken.Subject\n\t\t\tif p.config.UsernameClaim != \"\" {\n\t\t\t\tclaims := map[string]interface{}{}\n\t\t\t\tif err := idToken.Claims(&claims); err != nil {\n\t\t\t\t\tconst msg = \"failed to read claims\"\n\t\t\t\t\tlevel.Warn(p.logger).Log(\"msg\", msg, \"err\", err)\n\t\t\t\t\thttp.Error(w, msg, http.StatusInternalServerError)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\trawUsername, ok := claims[p.config.UsernameClaim]\n\t\t\t\tif !ok {\n\t\t\t\t\tconst msg = \"username cannot be empty\"\n\t\t\t\t\tlevel.Debug(p.logger).Log(\"msg\", msg)\n\t\t\t\t\thttp.Error(w, msg, http.StatusBadRequest)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tusername, ok := rawUsername.(string)\n\t\t\t\tif !ok || username == \"\" {\n\t\t\t\t\tconst msg = \"invalid username claim value\"\n\t\t\t\t\tlevel.Debug(p.logger).Log(\"msg\", msg)\n\t\t\t\t\thttp.Error(w, msg, http.StatusBadRequest)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tsub = username\n\t\t\t}\n\t\t\tctx := context.WithValue(r.Context(), subjectKey, sub)\n\n\t\t\tif p.config.GroupClaim != \"\" {\n\t\t\t\tvar groups []string\n\t\t\t\tclaims := map[string]interface{}{}\n\t\t\t\tif err := idToken.Claims(&claims); err != nil {\n\t\t\t\t\tconst msg = \"failed to read claims\"\n\t\t\t\t\tlevel.Warn(p.logger).Log(\"msg\", msg, \"err\", err)\n\t\t\t\t\thttp.Error(w, msg, http.StatusInternalServerError)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\trawGroup, ok := claims[p.config.GroupClaim]\n\t\t\t\tif !ok {\n\t\t\t\t\tconst msg = \"group cannot be empty\"\n\t\t\t\t\tlevel.Debug(p.logger).Log(\"msg\", msg)\n\t\t\t\t\thttp.Error(w, msg, http.StatusBadRequest)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tswitch v := rawGroup.(type) {\n\t\t\t\tcase string:\n\t\t\t\t\tgroups = append(groups, v)\n\t\t\t\tcase []string:\n\t\t\t\t\tgroups = v\n\t\t\t\tcase []interface{}:\n\t\t\t\t\tgroups = make([]string, 0, len(v))\n\t\t\t\t\tfor i := range v {\n\t\t\t\t\t\tgroups = append(groups, fmt.Sprintf(\"%v\", v[i]))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tctx = context.WithValue(ctx, groupsKey, groups)\n\t\t\t}\n\n\t\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t\t})\n\t}\n}", "title": "" }, { "docid": "10daacd53f8d8eb0002e8bc8d8a7c7e2", "score": "0.61158824", "text": "func authorize(ctx context.Context) error {\n\t// Fetch Bearer token\n\t// In case it is provided and is correct, consider auth completed\n\t_, err := fetchJWTToken(ctx)\n\n\treturn err\n}", "title": "" }, { "docid": "2332c1a988e1f2397ce7bef052344a8d", "score": "0.6112876", "text": "func AuthMiddleware(handler http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tusername, password, _ := r.BasicAuth()\n\t\tfmt.Println(r.BasicAuth())\n\t\tif username==\"\" || !checkUsernameAndPassword(username, password) {\n\t\t\t//w.Header().Set(\"WWW-Authenticate\", `Basic realm=\"Please enter your username and password for this site\"`)\n\t\t\t//w.WriteHeader(401)\n\t\t\t//w.Write([]byte(\"Unauthorised.\\n\"))\n\t\t\t//w.Write([]byte(\"checking session instead.\\n\"))\n\t\t\tsession, err := store.Get(r, \"cookie-name\")\n\t\t\tif err != nil {\n\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tuser := getUser(session)\n\t\t\tfmt.Println(user)\n\t\t\tif auth := user.Authenticated; !auth {\n\t\t\t\tsession.AddFlash(\"You don't have access!\")\n\t\t\t\terr = session.Save(r, w)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Printf(\"You don't have access!\")\n\t\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tfmt.Printf(\"You don't have access!\")\n\t\t\t\thttp.Redirect(w, r, \"/forbidden\", http.StatusFound)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfmt.Println(\"authenticated via user session\")\n\t\t\thandler(w, r)\n\t\t\treturn\n\t\t}\n\t\tfmt.Println(\"authenticated via basic auth\")\n\t\thandler(w, r)\n\t}\n}", "title": "" }, { "docid": "9f8cdf81fca860947b2538344768fd8d", "score": "0.6104607", "text": "func IsAuthorized(handler http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Header[\"Token\"] == nil {\n\t\t\tvar err Error\n\t\t\terr = SetError(err, \"No Token Found\")\n\t\t\tjson.NewEncoder(w).Encode(err)\n\t\t\treturn\n\t\t}\n\t\tvar mySigninKey = []byte(secretkey)\n\n\t\ttoken, err := jwt.Parse(r.Header[\"Token\"][0], func(token *jwt.Token) (interface{}, error) {\n\t\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"There was an error in parsing\")\n\t\t\t}\n\t\t\treturn mySigninKey, nil\n\t\t})\n\n\t\tif err != nil {\n\t\t\tvar err Error\n\t\t\terr = SetError(err, \"Your Token has been expired\")\n\t\t\tjson.NewEncoder(w).Encode(err)\n\t\t\treturn\n\t\t}\n\n\t\tif claims, ok := token.Claims.(jwt.MapClaims); ok && token.Valid {\n\t\t\tif claims[\"role\"] == \"admin\" {\n\t\t\t\tr.Header.Set(\"Role\", \"admin\")\n\t\t\t\thandler.ServeHTTP(w, r)\n\t\t\t\treturn\n\t\t\t} else if claims[\"role\"] == \"user\" {\n\t\t\t\tr.Header.Set(\"Role\", \"user\")\n\t\t\t\thandler.ServeHTTP(w, r)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tvar reserr Error\n\t\treserr = SetError(reserr, \"Not Authrorized\")\n\t\tjson.NewEncoder(w).Encode(err)\n\t}\n}", "title": "" }, { "docid": "bc9f3faf52f44e670fa97cca248b1cb4", "score": "0.60890925", "text": "func (a *AuthMock) Authenticate(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif ic, ok := w.(injectContext); ok {\n\t\t\tnext.ServeHTTP(auth.ResponseContext{ResponseWriter: w, Auth: auth.Context(ic.claims)}, r)\n\t\t\treturn\n\t\t}\n\t\tnext.ServeHTTP(auth.ResponseContext{ResponseWriter: w, Auth: auth.Context{}}, r)\n\t})\n}", "title": "" }, { "docid": "ba819f3770852cf5f55ec84ac89d1db9", "score": "0.60839236", "text": "func (a Auth) Auth() func(http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\tif a.UnauthHandler == nil {\n\t\t\ta.UnauthHandler = DefaultUnauthHandler\n\t\t}\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tclaims, ok := jwtauth.GetClaimsFromContext(r.Context())\n\t\t\tif !ok {\n\t\t\t\tvar err error\n\t\t\t\tclaims, err = a.AuthenticateRequest(r)\n\t\t\t\tif err != nil {\n\t\t\t\t\ta.UnauthHandler(w, r, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tr = r.WithContext(jwtauth.AddClaimsToContext(r.Context(), claims))\n\t\t\t}\n\t\t\tif err := a.Authorise(claims); err != nil {\n\t\t\t\ta.UnauthHandler(w, r, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tnext.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "cece2a596ba30db5368c19303266f05c", "score": "0.6070463", "text": "func Authorize(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\n\t// Get token from request\n\ttoken, err := request.ParseFromRequestWithClaims(r, request.OAuth2Extractor, &AppClaims{}, func(token *jwt.Token) (interface{}, error) {\n\t\t// since we only use the one private key to sign the tokens,\n\t\t// we also only use its public counter part to verify\n\t\treturn verifyKey, nil\n\t})\n\n\tif err != nil {\n\t\tswitch err.(type) {\n\n\t\tcase *jwt.ValidationError: // JWT validation error\n\t\t\tvErr := err.(*jwt.ValidationError)\n\n\t\t\tswitch vErr.Errors {\n\t\t\tcase jwt.ValidationErrorExpired: //JWT expired\n\t\t\t\tutils.DisplayAppError(\n\t\t\t\t\tw,\n\t\t\t\t\terr,\n\t\t\t\t\t\"Access Token is expired, get a new Token\",\n\t\t\t\t\t401,\n\t\t\t\t)\n\t\t\t\treturn\n\n\t\t\tdefault:\n\t\t\t\tutils.DisplayAppError(w,\n\t\t\t\t\terr,\n\t\t\t\t\t\"Error while parsing the Access Token!\",\n\t\t\t\t\t500,\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\n\t\tdefault:\n\t\t\tutils.DisplayAppError(w,\n\t\t\t\terr,\n\t\t\t\t\"Error while parsing Access Token!\",\n\t\t\t\t500)\n\t\t\treturn\n\t\t}\n\n\t}\n\tif token.Valid {\n\t\t// Using context: https://joeshaw.org/revisiting-context-and-http-handler-for-go-17/\n\t\tcontextWithUserEmail := context.WithValue(r.Context(), ContextUserEmailKey, token.Claims.(*AppClaims).CurrentUserEmail)\n\t\tnext.ServeHTTP(w, r.WithContext(contextWithUserEmail))\n\t} else {\n\t\tutils.DisplayAppError(\n\t\t\tw,\n\t\t\terr,\n\t\t\t\"Invalid Access Token\",\n\t\t\t401,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "22e025317e746bb8179499a5489ca710", "score": "0.60620844", "text": "func authenticationHandler(v *viper.Viper, logger log.Logger, registry xmetrics.Registry) (preHandler *alice.Chain, err error) {\n\tm := secure.NewJWTValidationMeasures(registry)\n\tvar validator secure.Validator\n\tif validator, err = getValidator(v, m); err == nil {\n\n\t\tauthHandler := handler.AuthorizationHandler{\n\t\t\tHeaderName: \"Authorization\",\n\t\t\tForbiddenStatusCode: 403,\n\t\t\tValidator: validator,\n\t\t\tLogger: logger,\n\t\t}\n\n\t\tauthHandler.DefineMeasures(m)\n\n\t\tnewPreHandler := alice.New(authHandler.Decorate)\n\t\tpreHandler = &newPreHandler\n\t}\n\treturn\n}", "title": "" }, { "docid": "b6062743886aa414e3f220d661035783", "score": "0.6060036", "text": "func (v Verifier) HandlerMiddleware(w http.ResponseWriter, r *http.Request) bool {\n\t// Make sure that the incoming request has our token header\n\t// Could also look in the cookies for CF_AUTHORIZATION\n\taccessJWT := r.Header.Get(\"Cf-Access-Jwt-Assertion\")\n\n\tif len(accessJWT) < 1 {\n\t\tc, err := r.Cookie(\"CF_Authorization\")\n\t\tif err == nil {\n\t\t\taccessJWT = c.Value\n\t\t}\n\t}\n\n\tif len(accessJWT) < 1 {\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tw.Write([]byte(\"No token on the request\"))\n\t\treturn true\n\t}\n\n\t// Verify the access token\n\tctx = r.Context()\n\tif ok := v.Verify(accessJWT); !ok {\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tw.Write([]byte(fmt.Sprintf(\"Invalid token\")))\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f7578ada847302a74aa17857e35f5aec", "score": "0.6043317", "text": "func Authorizer(ctx workflow.Context, evt events.APIGatewayCustomAuthorizerRequest) (err error) {\n\tauthService := new(services.AuthService)\n\tres, err := authService.GetAuthorizerResponse(evt)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx.SetRawResponse(res)\n\treturn nil\n}", "title": "" }, { "docid": "f84168cf9d108073d896def4064aa75f", "score": "0.60391146", "text": "func (f AuthorizeHandlerFunc) Handle(input driver.AuthorizeInput) (bool, error) {\n\treturn f(input)\n}", "title": "" }, { "docid": "907e82a87c86a050518cf1cac95c9ed7", "score": "0.6028773", "text": "func Auth() gin.HandlerFunc {\r\n\tif gin.Mode() == \"debug\" {\r\n\t\treturn func(c *gin.Context) { c.Next() }\r\n\t}\r\n\treturn func(c *gin.Context) {\r\n\t\tAccessKey := c.GetHeader(\"AccessKey\")\r\n\t\tif c.GetHeader(\"AccessKey\") == \"\" {\r\n\t\t\tAccessKey = c.GetHeader(\"Token\")\r\n\t\t}\r\n\r\n\t\tsession := sessions.Default(c)\r\n\t\tLoginUserID := session.Get(\"UserID\")\r\n\t\tIsLeader := session.Get(\"IsLeader\")\r\n\r\n\t\tfmt.Println(\"AccessKey: \", AccessKey)\r\n\t\tswitch AccessKey {\r\n\t\tcase \"\":\r\n\t\t\tif LoginUserID != nil {\r\n\t\t\t\tc.Set(\"UserID\", LoginUserID)\r\n\t\t\t\tc.Set(\"IsLeader\", IsLeader)\r\n\t\t\t\tc.Next()\r\n\t\t\t} else {\r\n\t\t\t\tsession := sessions.Default(c)\r\n\t\t\t\tUserID := session.Get(\"UserID\")\r\n\t\t\t\tIsLeader := session.Get(\"IsLeader\")\r\n\r\n\t\t\t\tfmt.Println(\"UserID, IsLeader\", UserID, IsLeader)\r\n\t\t\t\tif UserID == nil {\r\n\t\t\t\t\tc.JSON(http.StatusUnauthorized, gin.H{\"message\": \"Empty AccessKey Please authorize before requesting\"})\r\n\t\t\t\t\tc.Abort()\r\n\t\t\t\t}\r\n\t\t\t\tc.Set(\"UserID\", UserID)\r\n\t\t\t\tc.Set(\"IsLeader\", IsLeader)\r\n\t\t\t\tc.Next()\r\n\r\n\t\t\t}\r\n\r\n\t\tdefault:\r\n\t\t\tUserID, IsLeader, err := utils.LoadAccessKey(AccessKey)\r\n\r\n\t\t\tif LoginUserID != nil {\r\n\t\t\t\tc.Set(\"UserID\", UserID)\r\n\t\t\t\tc.Set(\"IsLeader\", IsLeader)\r\n\t\t\t\tc.Next()\r\n\t\t\t} else {\r\n\t\t\t\tif err != nil {\r\n\t\t\t\t\tc.JSON(http.StatusUnauthorized, gin.H{\"message\": \"Please authorize before requesting\"})\r\n\t\t\t\t\tc.Abort()\r\n\t\t\t\t}\r\n\r\n\t\t\t\tc.Set(\"UserID\", UserID)\r\n\t\t\t\tc.Set(\"IsLeader\", IsLeader)\r\n\r\n\t\t\t\tc.Next()\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "bbbb7ae38dfc14262cebc764a01b02eb", "score": "0.5991491", "text": "func handlerAuthCheck(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tswitch adminConfig.Auth {\n\t\tcase settings.AuthDB:\n\t\t\t// Check if user is already authenticated\n\t\t\tauthenticated, session := sessionsmgr.CheckAuth(r)\n\t\t\tif !authenticated {\n\t\t\t\thttp.Redirect(w, r, \"/login\", http.StatusFound)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Set middleware values\n\t\t\ts := make(sessions.ContextValue)\n\t\t\ts[ctxUser] = session.Username\n\t\t\ts[ctxCSRF] = session.Values[ctxCSRF].(string)\n\t\t\tctx := context.WithValue(r.Context(), sessions.ContextKey(\"session\"), s)\n\t\t\t// Update metadata for the user\n\t\t\tif err := adminUsers.UpdateMetadata(session.IPAddress, session.UserAgent, session.Username, s[\"csrftoken\"]); err != nil {\n\t\t\t\tlog.Printf(\"error updating metadata for user %s: %v\", session.Username, err)\n\t\t\t}\n\t\t\t// Access granted\n\t\t\th.ServeHTTP(w, r.WithContext(ctx))\n\t\tcase settings.AuthSAML:\n\t\t\t_, err := samlMiddleware.Session.GetSession(r)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"GetSession %v\", err)\n\t\t\t}\n\t\t\tcookiev, err := r.Cookie(samlConfig.TokenName)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"error extracting JWT data: %v\", err)\n\t\t\t\thttp.Redirect(w, r, samlConfig.LoginURL, http.StatusFound)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tjwtdata, err := parseJWTFromCookie(samlData.KeyPair, cookiev.Value)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"error parsing JWT: %v\", err)\n\t\t\t\thttp.Redirect(w, r, samlConfig.LoginURL, http.StatusFound)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Check if user is already authenticated\n\t\t\tauthenticated, session := sessionsmgr.CheckAuth(r)\n\t\t\tif !authenticated {\n\t\t\t\t// Create user if it does not exist\n\t\t\t\tif !adminUsers.Exists(jwtdata.Username) {\n\t\t\t\t\tlog.Printf(\"user not found: %s\", jwtdata.Username)\n\t\t\t\t\thttp.Redirect(w, r, forbiddenPath, http.StatusFound)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tu, err := adminUsers.Get(jwtdata.Username)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"error getting user %s: %v\", jwtdata.Username, err)\n\t\t\t\t\thttp.Redirect(w, r, forbiddenPath, http.StatusFound)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\taccess, err := adminUsers.GetEnvAccess(u.Username, u.DefaultEnv)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"error getting access for %s: %v\", jwtdata.Username, err)\n\t\t\t\t\thttp.Redirect(w, r, forbiddenPath, http.StatusFound)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// Create new session\n\t\t\t\tsession, err = sessionsmgr.Save(r, w, u, access)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"session error: %v\", err)\n\t\t\t\t\thttp.Redirect(w, r, samlConfig.LoginURL, http.StatusFound)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Set middleware values\n\t\t\ts := make(sessions.ContextValue)\n\t\t\ts[ctxUser] = session.Username\n\t\t\ts[ctxCSRF] = session.Values[ctxCSRF].(string)\n\t\t\tctx := context.WithValue(r.Context(), sessions.ContextKey(\"session\"), s)\n\t\t\t// Update metadata for the user\n\t\t\terr = adminUsers.UpdateMetadata(session.IPAddress, session.UserAgent, session.Username, s[\"csrftoken\"])\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"error updating metadata for user %s: %v\", session.Username, err)\n\t\t\t}\n\t\t\t// Access granted\n\t\t\tsamlMiddleware.RequireAccount(h).ServeHTTP(w, r.WithContext(ctx))\n\t\t}\n\t})\n}", "title": "" }, { "docid": "dff0d2b37dc6c3540b6100c267742e6d", "score": "0.599055", "text": "func authWrapper(handler http.HandlerFunc, secrets auth.SecretProvider, host string) http.HandlerFunc {\n\tauthenticator := &auth.BasicAuth{Realm: host, Secrets: secrets}\n\treturn auth.JustCheck(authenticator, handler)\n}", "title": "" }, { "docid": "bda557657426691c526301e7b3a6830f", "score": "0.5971057", "text": "func (a *Auth) Authenticate(handler http.Handler) http.Handler {\n\tif handler == nil {\n\t\tpanic(\"auth: nil handler\")\n\t}\n\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif a.cfg.Disable {\n\t\t\thandler.ServeHTTP(w, r)\n\t\t\treturn\n\t\t}\n\n\t\ttoken, err := a.getCookie(r)\n\t\tif token == nil && err == nil {\n\t\t\t// Cookie is missing, invalid. Fetch new token from OAuth2 provider.\n\t\t\t// Redirect user to the OAuth2 consent page to ask for permission for the scopes specified\n\t\t\t// above.\n\t\t\t// Set the scope to the current request URL, it will be used by the redirect handler to\n\t\t\t// redirect back to the url that requested the authentication.\n\t\t\turl := a.cfg.AuthCodeURL(r.RequestURI)\n\t\t\thttp.Redirect(w, r, url, http.StatusTemporaryRedirect)\n\t\t\treturn\n\t\t}\n\t\tif err != nil {\n\t\t\ta.clearCookie(w)\n\t\t\thttp.Error(w, \"Unauthorized\", http.StatusUnauthorized)\n\t\t\ta.logf(\"Get cookie error: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\t// Source token, in case the token needs a renewal.\n\t\tnewOauth2Token, err := a.cfg.TokenSource(r.Context(), token.toOauth2()).Token()\n\t\tif err != nil {\n\t\t\ta.clearCookie(w)\n\t\t\thttp.Error(w, \"Internal error\", http.StatusInternalServerError)\n\t\t\ta.logf(\"Failed token source: %s\", err)\n\t\t\treturn\n\t\t}\n\t\tnewToken := fromOauth2(newOauth2Token)\n\n\t\tif newToken.IDToken != token.IDToken {\n\t\t\ta.logf(\"Refreshed token\")\n\t\t\ttoken = newToken\n\t\t\ta.setCookie(w, token)\n\t\t}\n\n\t\t// Validate the id_token.\n\t\tpayload, err := a.validator.Validate(r.Context(), token.IDToken, a.cfg.ClientID)\n\t\tif err != nil {\n\t\t\ta.clearCookie(w)\n\t\t\thttp.Error(w, \"Invalid auth.\", http.StatusUnauthorized)\n\t\t\ta.logf(\"Invalid token, reset cookie: %s\", err)\n\t\t\treturn\n\t\t}\n\t\t// User is authenticated.\n\t\t// Store email and name in context, and call the inner handler.\n\t\tcreds := &Creds{\n\t\t\tEmail: payload.Claims[\"email\"].(string),\n\t\t\tName: payload.Claims[\"name\"].(string),\n\t\t}\n\t\tr = r.WithContext(context.WithValue(r.Context(), credsKey, creds))\n\t\thandler.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "21c00367a1ab3c7b62f02307c81d9c2f", "score": "0.59674406", "text": "func AuthMiddleware(auto401 bool) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tusers.UpdateContextUserModel(c, 0)\n\t\tbytes, _ := ioutil.ReadFile(\"./sample_key.pub\")\n\t\trsaPublic, _ := crypto.ParseRSAPublicKeyFromPEM(bytes)\n\n\t\tauth := c.Request.Header.Get(\"Authorization\")\n\t\tif len(auth) == 0 {\n\t\t\tc.AbortWithError(http.StatusUnauthorized, errors.New(\"Authorization not found\"))\n\t\t}\n\t\taccessToken := auth[7:len(auth)]\n\t\tjwt, err := jws.ParseJWT([]byte(accessToken))\n\t\tif err != nil {\n\t\t\tif auto401 {\n\t\t\t\tc.AbortWithError(http.StatusUnauthorized, err)\n\t\t\t}\n\t\t}\n\t\t// Validate token\n\t\tif err = jwt.Validate(rsaPublic, crypto.SigningMethodRS256); err != nil {\n\t\t\tc.AbortWithError(http.StatusUnauthorized, err)\n\t\t}\n\t\t//j, erro := jws.ParseFromHeader(c.Request, jws.General)\n\t\tj, erro := jws.ParseFromRequest(c.Request, jws.General)\n\t\tif erro != nil {\n\t\t\tif auto401 {\n\t\t\t\tc.AbortWithError(http.StatusUnauthorized, erro)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tfmt.Println(j)\n\t\t//fmt.Println(auth)\n\t\t//fmt.Println(token)\n\t\t/*\n\t\t\t\ttoken, err := request.ParseFromRequest(c.Request, request.OAuth2Extractor, func(token *jwt.Token) (interface{}, error) {\n\t\t\t\t\tb := ([]byte(common.NBSecretPassword))\n\t\t\t\t\treturn b, nil\n\t\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tif auto401 {\n\t\t\t\t\tc.AbortWithError(http.StatusUnauthorized, err)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t*/\n\t\t//_, err := session.FindSession(&session.SessionModel{Token: token.Raw})\n\t\t/*\n\t\t\tif claims, ok := token.Claims.(jwt.MapClaims); ok && token.Valid {\n\t\t\t\tmyUserID := uint(claims[\"id\"].(float64))\n\t\t\t\tusers.UpdateContextUserModel(c, myUserID)\n\t\t\t}*/\n\t}\n}", "title": "" }, { "docid": "5674b37e9f0dddd948028477d5af26b8", "score": "0.5967138", "text": "func (c Client) Authorize(scope ...string) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tauthURI := c.getAuthorizeURI(scope)\n\n\t\thttp.Redirect(w, r, authURI.String(), 302)\n\t}\n}", "title": "" }, { "docid": "6f26ea610c8775859d57a1e82587df9b", "score": "0.5959704", "text": "func handleAuth(h http.Handler) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t_, pass, ok := r.BasicAuth()\n\t\tif !ok || pass != RequiredPassword {\n\t\t\thandlers.Error(w, http.StatusInternalServerError, ErrUnauthorized.Error())\n\t\t\treturn\n\t\t}\n\n\t\th.ServeHTTP(w, r)\n\t}\n}", "title": "" }, { "docid": "50260f66c27ebe79b00410b0706e103b", "score": "0.5957911", "text": "func (a *Authenticator) AuthMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {\n\t\tmuxVars := parseVars(req)\n\t\tctx := context.WithValue(req.Context(), varsKey, muxVars)\n\t\treq = req.WithContext(ctx)\n\t\tclusterName := muxVars[\"clusterName\"]\n\t\ttyp := muxVars[\"type\"]\n\n\t\tuserID := req.Header.Get(\"User-ID\")\n\t\torgID := req.Header.Get(\"Org-ID\")\n\n\t\tlogrus.Infof(\"Steve server receive request. User-ID: %s, Org-ID: %s, Path: %s.\", userID, orgID, req.URL.String())\n\n\t\tscopeID, err := strconv.ParseUint(orgID, 10, 64)\n\t\tif err != nil {\n\t\t\tresp.WriteHeader(http.StatusBadRequest)\n\t\t\tresp.Write(apistructs.NewSteveError(apistructs.BadRequest, \"invalid org id\").JSON())\n\t\t\treturn\n\t\t}\n\n\t\tclusters, err := a.listClusterByType(req.Context(), scopeID, \"k8s\", \"edas\")\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"failed to list cluster %s in steve authenticate, %v\", clusterName, err)\n\t\t\tresp.WriteHeader(http.StatusInternalServerError)\n\t\t\tresp.Write(apistructs.NewSteveError(apistructs.ServerError, \"check permission internal error\").JSON())\n\t\t\treturn\n\t\t}\n\n\t\tfound := false\n\t\tfor _, cluster := range clusters {\n\t\t\tif cluster.Name == clusterName {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tresp.WriteHeader(http.StatusNotFound)\n\t\t\tresp.Write(apistructs.NewSteveError(apistructs.NotFound,\n\t\t\t\tfmt.Sprintf(\"cluster %s not found in target org\", clusterName)).JSON())\n\t\t\treturn\n\t\t}\n\n\t\tr := &apistructs.ScopeRoleAccessRequest{\n\t\t\tScope: apistructs.Scope{\n\t\t\t\tType: apistructs.OrgScope,\n\t\t\t\tID: orgID,\n\t\t\t},\n\t\t}\n\t\trsp, err := a.bdl.ScopeRoleAccess(userID, r)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"failed to get scope role access in steve authentication, %v\", err)\n\t\t\tresp.WriteHeader(http.StatusInternalServerError)\n\t\t\tresp.Write(apistructs.NewSteveError(apistructs.ServerError, \"check permission internal error\").JSON())\n\t\t\treturn\n\t\t}\n\t\tif !rsp.Access {\n\t\t\tresp.WriteHeader(http.StatusForbidden)\n\t\t\tresp.Write(apistructs.NewSteveError(apistructs.PermissionDenied, \"access denied\").JSON())\n\t\t\treturn\n\t\t}\n\n\t\tname := fmt.Sprintf(\"erda-user-%s\", userID)\n\t\tuser := &apiuser.DefaultInfo{\n\t\t\tName: name,\n\t\t\tUID: name,\n\t\t}\n\t\tfor _, role := range rsp.Roles {\n\t\t\tgroup, ok := predefined.RoleToGroup[role]\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tuser.Groups = append(user.Groups, group)\n\t\t}\n\n\t\tif len(user.Groups) == 0 {\n\t\t\tresp.WriteHeader(http.StatusForbidden)\n\t\t\tresp.Write(apistructs.NewSteveError(apistructs.PermissionDenied, \"access denied\").JSON())\n\t\t\treturn\n\t\t}\n\n\t\tif req.Method == http.MethodGet && typ == \"nodes\" {\n\t\t\tuser = &apiuser.DefaultInfo{\n\t\t\t\tName: \"admin\",\n\t\t\t\tUID: \"admin\",\n\t\t\t\tGroups: []string{\n\t\t\t\t\t\"system:masters\",\n\t\t\t\t\t\"system:authenticated\",\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\n\t\tctx = request.WithUser(ctx, user)\n\t\treq = req.WithContext(ctx)\n\t\tnext.ServeHTTP(resp, req)\n\t})\n}", "title": "" }, { "docid": "68d0a3f5f541444d53290c1ecda32b38", "score": "0.5955918", "text": "func Auth(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tlog.Infof(\"Authenticating request: \")\n\t\tif r.Header.Get(\"user\") != \"foo\" {\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\t\tlog.Infof(\"Auth: Pass\")\n\t\tnext.ServeHTTP(w, r)\n\n\t})\n}", "title": "" }, { "docid": "dea80fc1be8121a6a0de815c905dc2f1", "score": "0.5952911", "text": "func authorize(w http.ResponseWriter, r *http.Request, session sessions.Session, c martini.Context) {\n\tusername := session.Get(\"username\")\n\tif username == nil {\n\t\thttp.Redirect(w, r, \"/login\", http.StatusFound)\n\t}\n\t//if we found the user, let's create a new user struct and map it into the request context\n\tuser := &User{}\n\tuser.Username = username.(string)\n\tc.Map(user)\n}", "title": "" }, { "docid": "5496f5f696f394f9e50be11fca09099a", "score": "0.595128", "text": "func (a Auth) AuthAllowAnon() func(http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\tif a.UnauthHandler == nil {\n\t\t\ta.UnauthHandler = DefaultUnauthHandler\n\t\t}\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tclaims, ok := jwtauth.GetClaimsFromContext(r.Context())\n\t\t\tif !ok {\n\t\t\t\traw := a.getBearer(r.Header)\n\t\t\t\tif raw == \"\" {\n\t\t\t\t\tnext.ServeHTTP(w, r)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tvar err error\n\t\t\t\tclaims, err := a.Authenticate(r.Context(), raw)\n\t\t\t\tif err != nil {\n\t\t\t\t\ta.UnauthHandler(w, r, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tr = r.WithContext(jwtauth.AddClaimsToContext(r.Context(), claims))\n\t\t\t}\n\t\t\tif err := a.Authorise(claims); err != nil {\n\t\t\t\ta.UnauthHandler(w, r, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tnext.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "071282b60eb6efa0958beebf543ffb35", "score": "0.5950891", "text": "func (s *Setup) AuthMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// Capturing Authorizathion header.\n\t\ttokenHeader := r.Header.Get(\"Authorization\")\n\n\t\t// Checking if the value is empty.\n\t\tif tokenHeader == \"\" {\n\t\t\terrhandler.DecodeError(w, r, s.logger, errEmptyToken, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Checking if the header contains Bearer string and if the token exists.\n\t\tif !strings.Contains(tokenHeader, \"Bearer\") || len(strings.Split(tokenHeader, \"Bearer \")) == 1 {\n\t\t\terrhandler.DecodeError(w, r, s.logger, errMalformedToken, http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\n\t\t// Capturing the token.\n\t\tjwtString := strings.Split(tokenHeader, \"Bearer \")[1]\n\n\t\t// Parsing the token to verify its authenticity.\n\t\ttoken, err := jwt.Parse(jwtString, func(token *jwt.Token) (interface{}, error) {\n\t\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"Unexpected signing method: %v\", token.Header[\"alg\"])\n\t\t\t}\n\t\t\tcfg, err := config.Load()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn []byte(cfg.JWTSecret), nil\n\t\t})\n\n\t\t// Returning parsing errors.\n\t\tif err != nil {\n\t\t\terrhandler.DecodeError(w, r, s.logger, err.Error(), http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\n\t\t// If the token is valid.\n\t\tif token.Valid {\n\t\t\tnext.ServeHTTP(w, r)\n\t\t} else {\n\t\t\terrhandler.DecodeError(w, r, s.logger, errInvalidJWTToken, http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\t})\n}", "title": "" }, { "docid": "af6977838e4c54f3bb8c6c811d2dc105", "score": "0.59501886", "text": "func Authorization(f func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\ttoken := r.Header.Get(\"Authorization\")\n\t\t_, err := authorization.ValidateToken(token)\n\t\tif err != nil {\n\t\t\tforbbiden(w, r)\n\t\t\treturn\n\t\t}\n\t\tf(w, r)\n\t}\n}", "title": "" }, { "docid": "430f18ee019f7b841f88e54ed8177745", "score": "0.59423447", "text": "func Auth() func(http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tgivenAPIKey := r.Header.Get(\"API-KEY\")\n\n\t\t\t// Pass through unauthenticated requests.\n\t\t\tif givenAPIKey == \"\" {\n\t\t\t\tnext.ServeHTTP(w, r)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Inject admin user.\n\t\t\tif givenAPIKey == adminAPIKey {\n\t\t\t\tuser := &User{Name: \"Eric\", IsAdmin: true}\n\t\t\t\tctx := context.WithValue(r.Context(), userKey, user)\n\t\t\t\tr = r.WithContext(ctx)\n\t\t\t\tnext.ServeHTTP(w, r)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Inject non admin user.\n\t\t\tuser := &User{Name: \"Greg\", IsAdmin: false}\n\t\t\tctx := context.WithValue(r.Context(), userKey, user)\n\t\t\tr = r.WithContext(ctx)\n\t\t\tnext.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "f334ebda0a5a2037c2328727c91a2d11", "score": "0.5935487", "text": "func authMiddleware(next echo.HandlerFunc) echo.HandlerFunc {\n\treturn func(c echo.Context) error {\n\t\tcookie, err := c.Cookie(model.CookieName)\n\t\tif err == nil {\n\t\t\tlogin := authcookie.Login(cookie.Value, []byte(model.SECRET))\n\t\t\tif login == \"\" {\n\t\t\t\treturn c.Redirect(http.StatusTemporaryRedirect, \"/login\")\n\t\t\t}\n\t\t\tc.Request().Header.Set(model.HEADER_AUTH_USER_ID, login)\n\t\t\tusername := strings.Split(login, \"@\")[0]\n\t\t\tdbName := username\n\t\t\terr := db.ConnectDB(dbName)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"cannot initialize db: %v\", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn next(c)\n\t\t}\n\t\tlog.Println(err)\n\t\treturn c.Redirect(http.StatusTemporaryRedirect, \"/login\")\n\t}\n}", "title": "" }, { "docid": "331ec561226a8ca16a104345d82c2492", "score": "0.59349614", "text": "func SecureMiddleware(next http.Handler, userTypes ...byte) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tauthorized := false\n\t\tkey, ok := GetAuthorizarion(r.Header.Get(\"Authorization\"))\n\t\tif ok {\n\t\t\tuserType, ok := CurrentConfig.AccessKeys[key]\n\t\t\tif ok {\n\t\t\t\tfor _, ut := range userTypes {\n\t\t\t\t\tif userType == ut {\n\t\t\t\t\t\tauthorized = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif !authorized {\n\t\t\tw.Header().Set(\"WWW-Authenticate\", \"Basic realm=\\\"user\\\"\")\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\tw.Write([]byte(\"User not authorized\"))\n\t\t\treturn\n\t\t}\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "2193e9c57a88949ddec28010211339eb", "score": "0.59296924", "text": "func AuthMiddleware(next http.HandlerFunc) http.HandlerFunc {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tauthHeader := r.Header.Get(\"Authorization\")\n\t\tif authHeader != \"\" {\n\t\t\tbearer := strings.Split(authHeader, \" \")\n\t\t\tif len(bearer) == 2 {\n\t\t\t\ttoken, err := jwt.Parse(bearer[1], func(token *jwt.Token) (interface{}, error) {\n\t\t\t\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"Error\")\n\t\t\t\t\t}\n\t\t\t\t\treturn []byte(\"secret\"), nil\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\tjson.NewEncoder(w).Encode(err.Error())\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif token.Valid {\n\t\t\t\t\tnext(w, r)\n\t\t\t\t} else {\n\t\t\t\t\tresMap := make(map[string]string)\n\t\t\t\t\tresMap[\"message\"] = \"Failed\"\n\n\t\t\t\t\tres, err := json.Marshal(resMap)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\t\t\t}\n\t\t\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\t\t\tw.Write(res)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thttp.Error(w, \"Invalid authorization header\", http.StatusBadRequest)\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\tresMap := make(map[string]string)\n\t\t\tresMap[\"message\"] = \"Failed\"\n\n\t\t\tres, err := json.Marshal(resMap)\n\t\t\tif err != nil {\n\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\t}\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\tw.Write(res)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "bbf93259d3b956aa50624fc72f2f5e09", "score": "0.59240526", "text": "func authorizationFilter(host service.Host) FilterFunc {\n\treturn func(ctx context.Context, w http.ResponseWriter, r *http.Request, next Handler) {\n\t\tfxctx := &fxcontext.Context{\n\t\t\tContext: ctx,\n\t\t}\n\n\t\tif err := host.AuthClient().Authorize(fxctx); err != nil {\n\t\t\thost.Metrics().SubScope(\"http\").SubScope(\"auth\").Counter(\"fail\").Inc(1)\n\t\t\tfxctx.Logger().Error(auth.ErrAuthorization, \"error\", err)\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\tfmt.Fprintf(w, \"Unauthorized access: %+v\", err)\n\t\t\treturn\n\t\t}\n\t\tnext.ServeHTTP(fxctx, w, r)\n\t}\n}", "title": "" }, { "docid": "7f59cce82b42b9c551bc652057dd1f95", "score": "0.59227043", "text": "func (m *BasicAuthMiddleware) Handle(ctx dotweb.Context) error {\n\tname, pwd := basicAuth(ctx)\n\tif name == \"\" || pwd == \"\" {\n\t\treturn unAuthorized(ctx)\n\t}\n\tif m.option.Auth(name, pwd) {\n\t\treturn m.Next(ctx)\n\t} else {\n\t\treturn unAuthorized(ctx)\n\t}\n}", "title": "" }, { "docid": "de2c992d510676b868fc6307b7fa8157", "score": "0.5912328", "text": "func WithAuthorizationCheck(handler http.Handler, getAttribs RequestAttributeGetter, a authorizer.Authorizer) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\terr := a.Authorize(getAttribs.GetAttribs(req))\n\t\tif err == nil {\n\t\t\thandler.ServeHTTP(w, req)\n\t\t\treturn\n\t\t}\n\t\tforbidden(w, req)\n\t})\n}", "title": "" }, { "docid": "b4f84e7e9ec862a15b7457421968f832", "score": "0.5901114", "text": "func (s *Server) WithAuth(next http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\taccessToken := r.Header.Get(\"Authorization\")\n\t\tif accessToken == \"\" {\n\t\t\tlogrus.Warnf(\"[%v][handler.WithAuth] %s is not authenticated\", ctx_value.GetString(r.Context(), \"tracingID\"), r.Host)\n\t\t\ts.onErr(w, http.StatusForbidden, \"missing accesss token\")\n\t\t\treturn\n\t\t}\n\t\tauthedUser, err := s.userauthService.Authenticate(r.Context(), accessToken)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"[%v][Server.WithAuth] could not authenticate user: %v\", ctx_value.GetString(r.Context(), \"tracingID\"), err)\n\t\t\ts.onErr(w, err.Code(), err.Info())\n\t\t\treturn\n\t\t}\n\t\t// add JWT claims of user in r.Context()\n\t\tctxAuthedUser := ctx_value.AddValue(r.Context(), \"user\", authedUser)\n\t\tctxJwtToken := ctx_value.AddValue(ctxAuthedUser, \"authorization\", accessToken)\n\t\t// serve request with user claims in context\n\t\tnext(w, r.WithContext(ctxJwtToken))\n\t}\n}", "title": "" }, { "docid": "6abab447ebc787b35b93d97d61f6d281", "score": "0.5883713", "text": "func AuthMiddleware(handler http.HandlerFunc, session *r.Session) http.HandlerFunc {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tvar token string\n\t\tvar username string\n\t\tfmt.Println(r.Header.Get(\"Content-Type\"))\n\t\tif r.Header.Get(\"Content-Type\") == \"application/x-www-form-urlencoded\" {\n\t\t\t// fmt.Println(\"Multipart\")\n\t\t\tr.ParseForm()\n\t\t\ttoken = r.Form.Get(\"token\")\n\t\t\tusername = r.Form.Get(\"username\")\n\t\t} else if strings.Contains(r.Header.Get(\"Content-Type\"), \"multipart/form-data\") {\n\t\t\t// fmt.Println(\"Multipart\")\n\t\t\tr.ParseMultipartForm(10 << 20)\n\t\t\ttoken = r.FormValue(\"token\")\n\t\t\tusername = r.FormValue(\"username\")\n\t\t\tfmt.Println(token + \":\" + username)\n\t\t}\n\t\tif token != \"\" && username != \"\" && ValidateJWT(token, session) == username {\n\t\t\t// fmt.Println(\"Authorized\")\n\t\t\thandler.ServeHTTP(w, r)\n\t\t} else {\n\t\t\tfmt.Fprint(w, `{ \"error\" : \"Not Authorized\"}`)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "9bf4f0b5c95aad909d5e9f573878e62f", "score": "0.5875109", "text": "func AuthMiddleware(repo mongodb.UserRepo) func(http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\ttoken, err := parseToken(r)\n\t\t\tif err != nil {\n\t\t\t\tnext.ServeHTTP(w, r)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tclaims, ok := token.Claims.(jwt.MapClaims)\n\n\t\t\tif !ok || !token.Valid {\n\t\t\t\tnext.ServeHTTP(w, r)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tuser, err := repo.GetUser(claims[\"jti\"].(string))\n\t\t\tif err != nil {\n\t\t\t\tnext.ServeHTTP(w, r)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tctx := context.WithValue(r.Context(), CurrentUserKey, user)\n\n\t\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t\t})\n\t}\n}", "title": "" }, { "docid": "a92cfce6f33f917e042e06605038514b", "score": "0.5870846", "text": "func Authenticate(next http.HandlerFunc) http.HandlerFunc {\n\treturn func(responseWriter http.ResponseWriter, request *http.Request) {\n\t\ttoken := strings.TrimPrefix(request.Header.Get(\"Authorization\"), \"Bearer \")\n\t\terr := crypto.ValidateToken([]byte(token))\n\n\t\tif err == nil {\n\t\t\tnext(responseWriter, request)\n\t\t} else {\n\t\t\thelpers.Response(responseWriter, http.StatusUnauthorized, constants.ERR_INVALID_TOKEN, err, nil)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3c9ffd281d1f0b92c766ecf78b6bfdba", "score": "0.58639383", "text": "func Auth() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tfmt.Println(\"Auth middleware\")\n\t}\n}", "title": "" }, { "docid": "f522e6fe6e1420b559814d3dff91a332", "score": "0.5863615", "text": "func WrapHandlerInBasicAuth(h http.Handler, b BasicAuth) http.HandlerFunc {\n\tif b.Username == \"\" || b.Password == \"\" {\n\t\tlogrus.Warn(\"Metrics are exposed without protection. Make sure you set up protection at proxy level.\")\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Serve without authorization if either Username or Password is unset\n\t\tif b.Username == \"\" || b.Password == \"\" {\n\t\t\th.ServeHTTP(w, r)\n\t\t\treturn\n\t\t}\n\t\tuser, pass, ok := r.BasicAuth()\n\n\t\tif !ok || user != b.Username || pass != b.Password {\n\t\t\thttp.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\t\th.ServeHTTP(w, r)\n\t}\n}", "title": "" }, { "docid": "a60f7135127c067bca91c134e47ebba9", "score": "0.5848693", "text": "func Authorize(s Server) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tswitch rtype := r.FormValue(\"response_type\"); rtype {\n\t\tcase \"code\":\n\t\t\turi, params := authorizeCode(s, w, r)\n\t\t\tif uri != \"\" || params != nil {\n\t\t\t\tRedirect(w, uri, params)\n\t\t\t}\n\t\tdefault:\n\t\t\tclient, uri := clientRedirectURI(s, w, r)\n\t\t\tif client != nil && uri != \"\" {\n\t\t\t\tRedirect(w, uri, Params{\n\t\t\t\t\t\"state\": r.FormValue(\"state\"),\n\t\t\t\t\t\"error\": \"unsupported_response_type\",\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t})\n}", "title": "" }, { "docid": "d539e5e1bda1db4ad827c88c021f5aa1", "score": "0.58462125", "text": "func AuthorizeCallback(w http.ResponseWriter, r *http.Request, authorizer Authorizer) {\n\tparams := mux.Vars(r)\n\tid := params[\"id\"]\n\n\tauthReq, err := authorizer.Storage().AuthRequestByID(r.Context(), id)\n\tif err != nil {\n\t\tAuthRequestError(w, r, nil, err, authorizer.Encoder())\n\t\treturn\n\t}\n\tif !authReq.Done() {\n\t\tAuthRequestError(w, r, authReq,\n\t\t\toidc.ErrInteractionRequired().WithDescription(\"Unfortunately, the user may be not logged in and/or additional interaction is required.\"),\n\t\t\tauthorizer.Encoder())\n\t\treturn\n\t}\n\tAuthResponse(authReq, authorizer, w, r)\n}", "title": "" }, { "docid": "c83e0955b4e6da9bcb7aff3fc7943413", "score": "0.5845491", "text": "func isAuthorized(endpoint func(http.ResponseWriter, *http.Request)) http.Handler {\r\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\r\n\t\r\n\t\r\n\tvar N = len(idlist) //Size of the users list\r\n\t\r\n\tif r.Header[\"Clientid\"] != nil { //Let's first check the user filled the 'Clientid' header key\r\n\t\t//We verify whether or not the ID submitted is valid\r\n\t\tvar verif string = \"not ok\"\r\n\t\tfor i:=0;i<N;i++{\r\n\t\t\tif r.Header[\"Clientid\"][0]==idlist[i]{\r\n\t\t\t\tverif=\"ok\" \r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//Verification of the encrypted password submitted by the user\r\n\t\tif verif==\"ok\"{ //The Client ID is valid, let's verify the password is correct and matches the client ID\r\n\t\t\tif r.Header[\"Clientid\"][0]==\"1\" { //First case: the user signed in as user 1\r\n\t\t\t\tif r.Header[\"Token\"] != nil { //Once again, a token is required to continue the authentication process\r\n\t\t\t\t\r\n\t\t\t\t\t\ttoken, err := jwt.Parse(r.Header[\"Token\"][0], func(token *jwt.Token) (interface{}, error) {\r\n\t\t\t\t\t\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\r\n\t\t\t\t\t\t\t\treturn nil, fmt.Errorf(\"There was an error\")\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\treturn mySigningKeyone, nil\t\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif err != nil {\r\n\t\t\t\t\t\t\tfmt.Fprintf(w, err.Error())\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//if the 'token' is valid, user 1 has now signed in\r\n\t\t\t\t\t\tif token.Valid {\r\n\t\t\t\t\t\t\tclientnum=r.Header[\"Clientid\"][0] \r\n\t\t\t\t\t\t\tendpoint(w, r)\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\telse {\r\n\t\t\t\t\t\t\tfmt.Fprintf(w, \"Not Authorized\")\r\n\t\t\t\t\t}\r\n\t\t\t}\telse { //Second case: the user signed in as user 2\r\n\t\t\t\tif r.Header[\"Token\"] != nil { //Once again, a token is required to continue the authentication process\r\n\t\t\t\t\r\n\t\t\t\t\t\ttoken, err := jwt.Parse(r.Header[\"Token\"][0], func(token *jwt.Token) (interface{}, error) {\r\n\t\t\t\t\t\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\r\n\t\t\t\t\t\t\t\treturn nil, fmt.Errorf(\"There was an error\")\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\treturn mySigningKeytwo, nil\t\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif err != nil {\r\n\t\t\t\t\t\t\tfmt.Fprintf(w, err.Error())\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t//if the 'token' is valid, user 2 has now signed in\r\n\t\t\t\t\t\tif token.Valid {\r\n\t\t\t\t\t\t\tclientnum=r.Header[\"Clientid\"][0] \r\n\t\t\t\t\t\t\tendpoint(w, r)\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\telse {\r\n\t\t\t\t\r\n\t\t\t\t\t\t\tfmt.Fprintf(w, \"Not Authorized\")\r\n\t\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\telse { \r\n\t\t\t\tfmt.Fprintf(w, \"This ID does not exist\")\r\n\t\t}\r\n\t\t\t\t\t\r\n\t\t} else {\r\n\t\t\tfmt.Fprintf(w, \"Insert ID\")\r\n\t\t}\r\n\t})\r\n}", "title": "" } ]
a31ef91a2f429cd056f827ec173f3a82
BuildHelloYARPCProcedures prepares an implementation of the Hello service for YARPC registration.
[ { "docid": "0411053ba1d5fa287150344365ad2b7b", "score": "0.77331954", "text": "func BuildHelloYARPCProcedures(server HelloYARPCServer) []transport.Procedure {\n\treturn buildHelloYARPCProcedures(buildHelloYARPCProceduresParams{Server: server})\n}", "title": "" } ]
[ { "docid": "150f0e7948dd8b49ff47d53cd70cb0d9", "score": "0.7736326", "text": "func BuildHelloServiceYARPCProcedures(server HelloServiceYARPCServer) []transport.Procedure {\n\thandler := &_HelloServiceYARPCHandler{server}\n\treturn protobuf.BuildProcedures(\n\t\tprotobuf.BuildProceduresParams{\n\t\t\tServiceName: \"foo.HelloService\",\n\t\t\tUnaryHandlerParams: []protobuf.BuildProceduresUnaryHandlerParams{\n\t\t\t\t{\n\t\t\t\t\tMethodName: \"Foo\",\n\t\t\t\t\tHandler: protobuf.NewUnaryHandler(\n\t\t\t\t\t\tprotobuf.UnaryHandlerParams{\n\t\t\t\t\t\t\tHandle: handler.Foo,\n\t\t\t\t\t\t\tNewRequest: newHelloServiceServiceFooYARPCRequest,\n\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tMethodName: \"Bar\",\n\t\t\t\t\tHandler: protobuf.NewUnaryHandler(\n\t\t\t\t\t\tprotobuf.UnaryHandlerParams{\n\t\t\t\t\t\t\tHandle: handler.Bar,\n\t\t\t\t\t\t\tNewRequest: newHelloServiceServiceBarYARPCRequest,\n\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t},\n\t\t\tOnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{},\n\t\t\tStreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{},\n\t\t},\n\t)\n}", "title": "" }, { "docid": "f176989ba9957fede7bb6f1bfd9db54f", "score": "0.6684817", "text": "func NewFxHelloServiceYARPCProcedures() interface{} {\n\treturn func(params FxHelloServiceYARPCProceduresParams) FxHelloServiceYARPCProceduresResult {\n\t\treturn FxHelloServiceYARPCProceduresResult{\n\t\t\tProcedures: BuildHelloServiceYARPCProcedures(params.Server),\n\t\t}\n\t}\n}", "title": "" }, { "docid": "15d5503f7152ea0a28c972238ff63c39", "score": "0.6578168", "text": "func NewFxHelloYARPCProcedures() interface{} {\n\treturn func(params FxHelloYARPCProceduresParams) FxHelloYARPCProceduresResult {\n\t\treturn FxHelloYARPCProceduresResult{\n\t\t\tProcedures: buildHelloYARPCProcedures(buildHelloYARPCProceduresParams{\n\t\t\t\tServer: params.Server,\n\t\t\t\tAnyResolver: params.AnyResolver,\n\t\t\t}),\n\t\t\tReflectionMeta: HelloReflectionMeta,\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0edbb2fe099cadb691c1b91cc9b5ce98", "score": "0.60170853", "text": "func BuildExcitedServiceYARPCProcedures(server ExcitedServiceYARPCServer) []transport.Procedure {\n\thandler := &_ExcitedServiceYARPCHandler{server}\n\treturn protobuf.BuildProcedures(\n\t\tprotobuf.BuildProceduresParams{\n\t\t\tServiceName: \"foo.ExcitedService\",\n\t\t\tUnaryHandlerParams: []protobuf.BuildProceduresUnaryHandlerParams{\n\t\t\t\t{\n\t\t\t\t\tMethodName: \"Exclamation\",\n\t\t\t\t\tHandler: protobuf.NewUnaryHandler(\n\t\t\t\t\t\tprotobuf.UnaryHandlerParams{\n\t\t\t\t\t\t\tHandle: handler.Exclamation,\n\t\t\t\t\t\t\tNewRequest: newExcitedServiceServiceExclamationYARPCRequest,\n\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t},\n\t\t\tOnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{},\n\t\t\tStreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{\n\t\t\t\t{\n\t\t\t\t\tMethodName: \"ExclamationBidiStream\",\n\t\t\t\t\tHandler: protobuf.NewStreamHandler(\n\t\t\t\t\t\tprotobuf.StreamHandlerParams{\n\t\t\t\t\t\t\tHandle: handler.ExclamationBidiStream,\n\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t\t},\n\n\t\t\t\t{\n\t\t\t\t\tMethodName: \"ExclamationServerStream\",\n\t\t\t\t\tHandler: protobuf.NewStreamHandler(\n\t\t\t\t\t\tprotobuf.StreamHandlerParams{\n\t\t\t\t\t\t\tHandle: handler.ExclamationServerStream,\n\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t\t},\n\n\t\t\t\t{\n\t\t\t\t\tMethodName: \"ExclamationClientStream\",\n\t\t\t\t\tHandler: protobuf.NewStreamHandler(\n\t\t\t\t\t\tprotobuf.StreamHandlerParams{\n\t\t\t\t\t\t\tHandle: handler.ExclamationClientStream,\n\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n}", "title": "" }, { "docid": "21e233a742854ce7432a8ec92359b58e", "score": "0.563595", "text": "func BuildMetaAPIYARPCProcedures(server MetaAPIYARPCServer) []transport.Procedure {\n\treturn buildMetaAPIYARPCProcedures(buildMetaAPIYARPCProceduresParams{Server: server})\n}", "title": "" }, { "docid": "15948b373e9caacfb5293c0c0246e6e9", "score": "0.5483517", "text": "func EncodeGRPCSayHelloResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tresp := response.(*pb.SayHelloResponse)\n\treturn resp, nil\n}", "title": "" }, { "docid": "55c83df1215b5fa9819385aa2b08d1ca", "score": "0.5445613", "text": "func DecodeGRPCSayHelloRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.SayHelloRequest)\n\treturn req, nil\n}", "title": "" }, { "docid": "5829ee88cac08d63aa493bfdc90e3348", "score": "0.54312444", "text": "func EncodeGRPCSayHelloResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tresp := response.(*pb.HelloResponse)\n\treturn resp, nil\n}", "title": "" }, { "docid": "25da4e820883c34c45a9a2c5d707ab14", "score": "0.5363648", "text": "func (s *Service) HelloWorld(ctx context.Context, in *pb.HelloRequest) (*pb.HelloWorld, error) {\n\treturn &pb.HelloWorld{Message: \"Hello From Golang.HR Micro Platform!\"}, nil\n}", "title": "" }, { "docid": "e662a162f319a608db7ce38a8d3ac1af", "score": "0.5349851", "text": "func BuildHistoryAPIYARPCProcedures(server HistoryAPIYARPCServer) []transport.Procedure {\n\treturn buildHistoryAPIYARPCProcedures(buildHistoryAPIYARPCProceduresParams{Server: server})\n}", "title": "" }, { "docid": "d8e28264632f3c387fd87a5f0a635684", "score": "0.5329558", "text": "func makeHelloHandler(endpoints endpoint.Endpoints, options []grpc.ServerOption) grpc.Handler {\n\treturn grpc.NewServer(endpoints.HelloEndpoint, decodeHelloRequest, encodeHelloResponse, options...)\n}", "title": "" }, { "docid": "0b75433a02b8d6be28a858be91982a14", "score": "0.5318086", "text": "func DecodeGRPCSayHelloRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.HelloRequest)\n\treturn req, nil\n}", "title": "" }, { "docid": "194644f9d43137af544769ddb7abd700", "score": "0.52468544", "text": "func NewSvc(conn *grpc.ClientConn, svc string) (service.HelloService, io.Closer, error) {\n\t/*\n\t\tCreate some security measures\n\t*/\n\tcloser, err := gokit_foundation.InitTracer(svc)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\totTracer := stdopentracing.GlobalTracer()\n\n\tlimiter := ratelimit.NewErroringLimiter(rate.NewLimiter(rate.Every(time.Second), 100))\n\tbreaker := func(method string) endpoint.Middleware {\n\t\treturn circuitbreaker.Gobreaker(gobreaker.NewCircuitBreaker(gobreaker.Settings{\n\t\t\tName: method,\n\t\t\tTimeout: 30 * time.Second,\n\t\t}))\n\t}\n\n\tvar svcPBName = \"pb.Hello\"\n\t// Create go-kit grpc hooks, e.g.\n\t// - grpctransport.ClientAfter(),\n\t// - grpctransport.ClientFinalizer()\n\t// Injecting tracing ctx to grpc metadata, optionally.\n\tgrpcBefore := grpc1.ClientBefore(opentracing.ContextToGRPC(otTracer, log.NewNopLogger()))\n\t/*\n\t\tInstall into endpoints with above measures\n\t*/\n\tvar SayHiEndpoint endpoint.Endpoint\n\t{\n\t\tSayHiEndpoint = grpc1.NewClient(conn, svcPBName, \"SayHi\",\n\t\t\tencodeSayHiRequest, decodeSayHiResponse, pb.SayHiResponse{}, grpcBefore).Endpoint()\n\t\tSayHiEndpoint = opentracing.TraceClient(otTracer, \"SayHi\")(SayHiEndpoint)\n\t\tSayHiEndpoint = limiter(SayHiEndpoint)\n\t\tSayHiEndpoint = breaker(\"SayHi\")(SayHiEndpoint)\n\t}\n\n\tvar MakeADateEndpoint endpoint.Endpoint\n\t{\n\t\tMakeADateEndpoint = grpc1.NewClient(conn, svcPBName, \"MakeADate\",\n\t\t\tencodeMakeADateRequest, decodeMakeADateResponse, pb.MakeADateResponse{}, grpcBefore).Endpoint()\n\t\tMakeADateEndpoint = opentracing.TraceClient(otTracer, \"MakeADate\")(MakeADateEndpoint)\n\t\tMakeADateEndpoint = limiter(MakeADateEndpoint)\n\t\tMakeADateEndpoint = breaker(\"MakeADate\")(MakeADateEndpoint)\n\t}\n\n\tvar UpdateUserInfoEndpoint endpoint.Endpoint\n\t{\n\t\tUpdateUserInfoEndpoint = grpc1.NewClient(conn, svcPBName, \"UpdateUserInfo\",\n\t\t\tencodeUpdateUserInfoRequest, decodeUpdateUserInfoResponse, pb.UpdateUserInfoResponse{}, grpcBefore).Endpoint()\n\t\tUpdateUserInfoEndpoint = opentracing.TraceClient(otTracer, \"UpdateUserInfo\")(UpdateUserInfoEndpoint)\n\t\tUpdateUserInfoEndpoint = limiter(UpdateUserInfoEndpoint)\n\t\tUpdateUserInfoEndpoint = breaker(\"UpdateUserInfo\")(UpdateUserInfoEndpoint)\n\t}\n\n\treturn endpoint1.Endpoints{\n\t\tSayHiEndpoint: SayHiEndpoint,\n\t\tMakeADateEndpoint: MakeADateEndpoint,\n\t\tUpdateUserInfoEndpoint: UpdateUserInfoEndpoint,\n\t}, closer, nil\n}", "title": "" }, { "docid": "20a1b8e2e56ceb669c70df97c30120a2", "score": "0.52024233", "text": "func BuildMirrorYARPCProcedures(server MirrorYARPCServer) []transport.Procedure {\n\treturn buildMirrorYARPCProcedures(buildMirrorYARPCProceduresParams{Server: server})\n}", "title": "" }, { "docid": "c84185a944d370ef7d13d669a0f86958", "score": "0.5163076", "text": "func RegisterHello(getCtx func() context.Context, cl replay.Client, cstore reflex.CursorStore,\n\thello func(helloFlow, *String), opts ...replay.Option) {\n\n\thelloFunc := func(ctx replay.RunContext, message *String) {\n\t\thello(helloFlowImpl{ctx}, message)\n\t}\n\n\tcopied := append([]replay.Option{replay.WithName(_wHello)}, opts...)\n\n\treplay.RegisterWorkflow(getCtx, cl, cstore, _ns, helloFunc, copied...)\n}", "title": "" }, { "docid": "d69c91a68a92b3b3d28ae58a338c7036", "score": "0.51618546", "text": "func NewHelloService(l *logrus.Entry) pb.HelloServer {\n\treturn helloService{Logger: l}\n}", "title": "" }, { "docid": "a8df15fe6735df6297888b642fa1394c", "score": "0.5158257", "text": "func NewHelloServiceYARPCClient(clientConfig transport.ClientConfig, options ...protobuf.ClientOption) HelloServiceYARPCClient {\n\treturn &_HelloServiceYARPCCaller{protobuf.NewStreamClient(\n\t\tprotobuf.ClientParams{\n\t\t\tServiceName: \"foo.HelloService\",\n\t\t\tClientConfig: clientConfig,\n\t\t\tOptions: options,\n\t\t},\n\t)}\n}", "title": "" }, { "docid": "bbb6590a4c65a76123c47d7fdf8de884", "score": "0.5138219", "text": "func (s *Service) Hello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloResponse, error) {\n\t// create greeting\n\tgreeting := \"Hello!\"\n\tif in.Name != \"\" {\n\t\tgreeting = fmt.Sprintf(\"Hello %v!\", in.Name)\n\t}\n\n\tlog.Printf(\"Received request from: %v\", in.Name)\n\n\t// return response\n\treturn &pb.HelloResponse{\n\t\tGreeting: greeting,\n\t}, nil\n}", "title": "" }, { "docid": "ac2a06088accb2ffc1ec9f6199d57bfb", "score": "0.50282353", "text": "func (g *Greeter) Hello(ctx context.Context, req *proto.HelloRequest, rsp *proto.HelloResponse) error {\n\trsp.Greeting = \"Hello \" + req.Name\n\treturn nil\n}", "title": "" }, { "docid": "f331c4f6c7b26bc0be149bf98a09cf98", "score": "0.49778268", "text": "func (e *Helloworld) Hello(ctx context.Context, req *helloworld.HelloRequest, rsp *helloworld.HelloResponse) error {\n\tlogger.Info(\"Received Helloworld.Call request\")\n\treturn nil\n}", "title": "" }, { "docid": "e27358d966fac46a2d59dae9072ce8bd", "score": "0.49658638", "text": "func newHelloDeployment(hello *demov1alpha1.Hello) *appsv1.Deployment {\n\tpodTemplateAnnotations := map[string]string{}\n\t// Uncomment following line if you have istio installed\n\tpodTemplateAnnotations[\"sidecar.istio.io/inject\"] = \"false\"\n\tone := int32(1)\n\treturn &appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: deploymentName(hello),\n\t\t\tNamespace: hello.Namespace,\n\t\t\t//Annotations: map[string]string{\n\t\t\t//\t\"subject\": hello.Spec.Subject,\n\t\t\t//},\n\t\t\tOwnerReferences: []metav1.OwnerReference{\n\t\t\t\t*metav1.NewControllerRef(hello, schema.GroupVersionKind{\n\t\t\t\t\tGroup: demov1alpha1.SchemeGroupVersion.Group,\n\t\t\t\t\tVersion: demov1alpha1.SchemeGroupVersion.Version,\n\t\t\t\t\tKind: \"Hello\",\n\t\t\t\t}),\n\t\t\t},\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tReplicas: &one,\n\t\t\t//Replicas: hello.Spec.Replicas,\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: helloLabels(hello),\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: helloLabels(hello),\n\t\t\t\t\tAnnotations: podTemplateAnnotations,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"hello-service\",\n\t\t\t\t\t\t\tImage: \"mirage20/k8s-hello-service:latest\",\n\t\t\t\t\t\t\tCommand: []string{\n\t\t\t\t\t\t\t\t\"/k8s-hello-service\",\n\t\t\t\t\t\t\t\t//\"--subject\",\n\t\t\t\t\t\t\t\t//hello.Spec.Subject,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "5527fac4b60a8ee4ef1814921cc88e00", "score": "0.49547005", "text": "func (s *Service) SayHello(ctx context.Context, req *pb.HelloReq) (reply *empty.Empty, err error) {\n\treply = new(empty.Empty)\n\tfmt.Printf(\"hello %s\", req.Name)\n\treturn\n}", "title": "" }, { "docid": "f308ea00937449cf15a355571b48e518", "score": "0.4949021", "text": "func New(conn *grpc.ClientConn, options map[string][]kitgrpc.ClientOption) (service.HelloService, error) {\n\tvar helloEndpoint endpoint.Endpoint\n\t{\n\t\thelloEndpoint = kitgrpc.NewClient(conn, \"pb.Hello\", \"Hello\", encodeHelloRequest, decodeHelloResponse, pb.HelloReply{}, options[\"Hello\"]...).Endpoint()\n\t}\n\n\treturn pkgendpoint.Endpoints{HelloEndpoint: helloEndpoint}, nil\n}", "title": "" }, { "docid": "197a8f5bc461a571d35df2bf71902091", "score": "0.49414802", "text": "func newHelloService(hello *demov1alpha1.Hello) *corev1.Service {\n\treturn &corev1.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: serviceName(hello),\n\t\t\tNamespace: hello.Namespace,\n\t\t\tOwnerReferences: []metav1.OwnerReference{\n\t\t\t\t*metav1.NewControllerRef(hello, schema.GroupVersionKind{\n\t\t\t\t\tGroup: demov1alpha1.SchemeGroupVersion.Group,\n\t\t\t\t\tVersion: demov1alpha1.SchemeGroupVersion.Version,\n\t\t\t\t\tKind: \"Hello\",\n\t\t\t\t}),\n\t\t\t},\n\t\t},\n\t\tSpec: corev1.ServiceSpec{\n\t\t\tSelector: helloLabels(hello),\n\t\t\tPorts: []corev1.ServicePort{\n\t\t\t\t{\n\t\t\t\t\tProtocol: corev1.ProtocolTCP,\n\t\t\t\t\tPort: 80,\n\t\t\t\t\tTargetPort: intstr.IntOrString{Type: intstr.Int, IntVal: 8080},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "681a7c2ab33f4d8ed04279e57519edd3", "score": "0.48925182", "text": "func newHello(service *slackService) plugin.Hello {\n\treturn &hello{\n\t\tbot: &bot{\n\t\t\tservice: service,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "4ce1fabca135b01fdd2e1dbaaa3d7f20", "score": "0.48894814", "text": "func MakeGRPCServer(endpoints Endpoints) pb.HelloServiceServer {\n\tserverOptions := []grpctransport.ServerOption{\n\t\tgrpctransport.ServerBefore(metadataToContext),\n\t}\n\treturn &grpcServer{\n\t\t// helloservice\n\n\t\tsayhello: grpctransport.NewServer(\n\t\t\tendpoints.SayHelloEndpoint,\n\t\t\tDecodeGRPCSayHelloRequest,\n\t\t\tEncodeGRPCSayHelloResponse,\n\t\t\tserverOptions...,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "f08cbed0a34d2a433fc690dc79673fb6", "score": "0.48866856", "text": "func New(middleware []Middleware) HelloService {\n\tvar svc HelloService = NewBasicHelloService()\n\tfor _, m := range middleware {\n\t\tsvc = m(svc)\n\t}\n\treturn svc\n}", "title": "" }, { "docid": "966ba9ebb7256a2cdb2e1c61af51cee4", "score": "0.4883523", "text": "func NewHello() error {\n\treturn nil\n}", "title": "" }, { "docid": "219e587938e847b89395da562bcfc30c", "score": "0.48747548", "text": "func (handler *HelloHandler)Hello(ctx context.Context, req *desc.PigRequest)(*desc.PigResponse, error) {\n\t// todo impl handler method\n\treturn nil, nil\n}", "title": "" }, { "docid": "eb9bfd878ba9c52a53236ea10e8c6f07", "score": "0.48657286", "text": "func main() {\n\tlib.HelloService()\n}", "title": "" }, { "docid": "e7b03aef1e5df88b70afc5c2fd914a32", "score": "0.48454824", "text": "func (h *HelloResourceImpl) SayHello(ctx context.Context, hr *pb.SayHelloRequest) (*pb.SayHelloResponse, error) {\n\tmessage := hr.GetSendMessage()\n\treturn &pb.SayHelloResponse{ReceivedMessage: message}, nil\n}", "title": "" }, { "docid": "bf671cd2e0f63ceb5865bd48584d89d9", "score": "0.48304594", "text": "func (s *GreeterImpl) SayHello(ctx context.Context, args *HelloRequest, reply *HelloReply) (err error) {\n\t// TODO: add business logics\n\n\t// TODO: setting return values\n\t*reply = HelloReply{}\n\n\treturn nil\n}", "title": "" }, { "docid": "999670cea211fe53efbfc9f9f456687f", "score": "0.48148474", "text": "func NewFxExcitedServiceYARPCProcedures() interface{} {\n\treturn func(params FxExcitedServiceYARPCProceduresParams) FxExcitedServiceYARPCProceduresResult {\n\t\treturn FxExcitedServiceYARPCProceduresResult{\n\t\t\tProcedures: BuildExcitedServiceYARPCProcedures(params.Server),\n\t\t}\n\t}\n}", "title": "" }, { "docid": "50b72ab688c06ba525095f8e25eb5967", "score": "0.48049173", "text": "func (svc *HelloGRPCService) SayHello(ctx context.Context, in *pb.PingMessage) (*pb.PingMessage, error) {\n\tlog.Printf(\"Received msg : %s in request \\n\", in.Greeting)\n\tres := pb.PingMessage{\n\t\tGreeting: \"Milgya greeting...bas rehn de....\",\n\t}\n\treturn &res, nil\n}", "title": "" }, { "docid": "34a6e18a9bd529ec1fc184fab68dff96", "score": "0.47958803", "text": "func NewFxMetaAPIYARPCProcedures() interface{} {\n\treturn func(params FxMetaAPIYARPCProceduresParams) FxMetaAPIYARPCProceduresResult {\n\t\treturn FxMetaAPIYARPCProceduresResult{\n\t\t\tProcedures: buildMetaAPIYARPCProcedures(buildMetaAPIYARPCProceduresParams{\n\t\t\t\tServer: params.Server,\n\t\t\t\tAnyResolver: params.AnyResolver,\n\t\t\t}),\n\t\t\tReflectionMeta: reflection.ServerMeta{\n\t\t\t\tServiceName: \"uber.cadence.api.v1.MetaAPI\",\n\t\t\t\tFileDescriptors: yarpcFileDescriptorClosuref45a67f89288e7f3,\n\t\t\t},\n\t\t}\n\t}\n}", "title": "" }, { "docid": "00bd115737320ee14950aa34cdaa0605", "score": "0.47949874", "text": "func encodeHelloResponse(_ context.Context, r interface{}) (interface{}, error) {\n\t// return nil, errors.New(\"'pkg Hello' Encoder is not impelemented\")\n\tresp := r.(endpoint.HelloResponse)\n\tif resp.Err != nil {\n\t\treturn &pb.HelloReply{Rs: \"\", Err: resp.Err.Error()}, nil\n\t}\n\treturn &pb.HelloReply{Rs: resp.Rs, Err: \"null\"}, nil\n\n}", "title": "" }, { "docid": "276a399f2c157839deed14319af86479", "score": "0.47823843", "text": "func NewHelloProtocolHandler(h host.Host,\n\tpeerMgr peermgr.IPeerMgr,\n\texchange exchange.Client,\n\tchainStore *chain.Store,\n\tmessageStore *chain.MessageStore,\n\tgen cid.Cid,\n\thelloTimeOut time.Duration,\n) *HelloProtocolHandler {\n\treturn &HelloProtocolHandler{\n\t\thost: h,\n\t\tgenesis: gen,\n\t\tpeerMgr: peerMgr,\n\t\texchange: exchange,\n\t\tchainStore: chainStore,\n\t\tmessageStore: messageStore,\n\t\thelloTimeOut: helloTimeOut,\n\t}\n}", "title": "" }, { "docid": "7d558db730cd0cc3cb4f2cbbfce04ede", "score": "0.4747239", "text": "func Generate(ctx context.Context, outDir, protoPath string, includePaths, protocOuts []string, options ...Option) error {\n\tc := &configs{}\n\tfor _, o := range options {\n\t\to(c)\n\t}\n\n\t// setup protoc and global protos.\n\tprotocPath, cleanup, err := localfs.SaveBytesTemp(binary, \"protoc\", 0755)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer cleanup()\n\n\tfsInInclude, err := fs.Sub(include, \"data/include\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tglobalIncludePath, cleanup, err := localfs.SaveTemp(fsInInclude)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer cleanup()\n\n\tincludePaths = append(includePaths, globalIncludePath)\n\n\t// start preparing the protoc command for execution.\n\tcommand := []string{protocPath}\n\n\t// add plugin if set.\n\tif c.pluginPath != \"\" {\n\t\tcommand = append(command, \"--plugin\", c.pluginPath)\n\t}\n\n\t// append third party proto locations to the command.\n\tfor _, importPath := range includePaths {\n\t\t// skip if a third party proto source actually doesn't exist on the filesystem.\n\t\tif _, err := os.Stat(importPath); os.IsNotExist(err) {\n\t\t\tcontinue\n\t\t}\n\t\tcommand = append(command, \"-I\", importPath)\n\t}\n\n\t// find out the list of proto files under the app and generate code for them.\n\tfiles, err := protoanalysis.SearchRecursive(protoPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// run command for each protocOuts.\n\tfor _, out := range protocOuts {\n\t\tcommand := append(command, out)\n\t\tcommand = append(command, files...)\n\n\t\tif err := exec.Exec(ctx, command,\n\t\t\texec.StepOption(step.Workdir(outDir)),\n\t\t\texec.IncludeStdLogsToError(),\n\t\t); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fae38649a7abd43d718b9f7aa28d9f73", "score": "0.47458217", "text": "func (_Api *ApiSession) Hello() (string, error) {\n\treturn _Api.Contract.Hello(&_Api.CallOpts)\n}", "title": "" }, { "docid": "0f275eb14c5f71037a00845b3aca868a", "score": "0.47282845", "text": "func (c *helloWorldProtobufferClient) Hello(ctx context.Context, in *HelloReq) (*HelloResp, error) {\n\tctx = xcontext.WithPackageName(ctx, \"example.helloworld\")\n\tctx = xcontext.WithServiceName(ctx, \"HelloWorld\")\n\tctx = xcontext.WithMethodName(ctx, \"Hello\")\n\tout := new(HelloResp)\n\terr := transport.DoProtobufferRequest(ctx, c.client, c.urls[0], in, out)\n\treturn out, err\n}", "title": "" }, { "docid": "b480b2d1fabd559c58cb176886b47a11", "score": "0.47247407", "text": "func NewHelloEndpoint(s Service) goa.Endpoint {\n\treturn func(ctx context.Context, req interface{}) (interface{}, error) {\n\t\tp := req.(*HelloPayload)\n\t\treturn s.Hello(ctx, p)\n\t}\n}", "title": "" }, { "docid": "da6020e3fc44471865f194e800a94299", "score": "0.47209015", "text": "func (w *grpcWorker) Hello(ctx context.Context, in *Payload) (*Payload, error) {\n\tout := new(Payload)\n\tif string(in.Data) == \"hello\" {\n\t\tout.Data = []byte(\"Oh hello there!\")\n\t} else {\n\t\tout.Data = []byte(\"Hey stranger!\")\n\t}\n\n\treturn out, nil\n}", "title": "" }, { "docid": "b94612703db9847b2570699daa6d0da6", "score": "0.47151116", "text": "func (c *customBarClient) Hello(\n\tctx context.Context,\n\theaders map[string]string,\n) (context.Context, string, map[string]string, error) {\n\treqUUID := zanzibar.RequestUUIDFromCtx(ctx)\n\tif headers == nil {\n\t\theaders = make(map[string]string)\n\t}\n\tif reqUUID != \"\" {\n\t\theaders[c.requestUUIDHeaderKey] = reqUUID\n\t}\n\tif c.requestProcedureHeaderKey != \"\" {\n\t\theaders[c.requestProcedureHeaderKey] = \"Bar::helloWorld\"\n\t}\n\n\tvar defaultRes string\n\treq := zanzibar.NewClientHTTPRequest(ctx, c.clientID, \"Hello\", \"Bar::helloWorld\", c.httpClient)\n\n\t// Generate full URL.\n\tfullURL := c.httpClient.BaseURL + \"/bar\" + \"/hello\"\n\n\terr := req.WriteJSON(\"GET\", fullURL, headers, nil)\n\tif err != nil {\n\t\treturn ctx, defaultRes, nil, err\n\t}\n\n\tvar res *zanzibar.ClientHTTPResponse\n\tif c.circuitBreakerDisabled {\n\t\tres, err = req.Do()\n\t} else {\n\t\t// We want hystrix ckt-breaker to count errors only for system issues\n\t\tvar clientErr error\n\t\tcircuitBreakerName := \"custom-bar\" + \"-\" + \"Hello\"\n\t\terr = hystrix.DoC(ctx, circuitBreakerName, func(ctx context.Context) error {\n\t\t\tres, clientErr = req.Do()\n\t\t\tif res != nil {\n\t\t\t\t// This is not a system error/issue. Downstream responded\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn clientErr\n\t\t}, nil)\n\t\tif err == nil {\n\t\t\t// ckt-breaker was ok, bubble up client error if set\n\t\t\terr = clientErr\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn ctx, defaultRes, nil, err\n\t}\n\n\trespHeaders := make(map[string]string)\n\tfor k := range res.Header {\n\t\trespHeaders[k] = res.Header.Get(k)\n\t}\n\n\tdefer func() {\n\t\trespHeaders[zanzibar.ClientResponseDurationKey] = res.Duration.String()\n\t}()\n\n\tres.CheckOKResponse([]int{200, 303, 403})\n\n\tswitch res.StatusCode {\n\tcase 200:\n\t\tvar responseBody string\n\t\trawBody, err := res.ReadAll()\n\t\tif err != nil {\n\t\t\treturn ctx, defaultRes, respHeaders, err\n\t\t}\n\t\terr = res.UnmarshalBody(&responseBody, rawBody)\n\t\tif err != nil {\n\t\t\treturn ctx, defaultRes, respHeaders, err\n\t\t}\n\n\t\treturn ctx, responseBody, respHeaders, nil\n\n\tcase 303:\n\t\treturn ctx, defaultRes, respHeaders, &clientsIDlClientsBarBar.SeeOthersRedirection{}\n\tcase 403:\n\t\tallOptions := []interface{}{\n\t\t\t&clientsIDlClientsBarBar.BarException{},\n\t\t}\n\t\tv, err := res.ReadAndUnmarshalBodyMultipleOptions(allOptions)\n\t\tif err != nil {\n\t\t\treturn ctx, defaultRes, respHeaders, err\n\t\t}\n\t\treturn ctx, defaultRes, respHeaders, v.(error)\n\n\tdefault:\n\t\t_, err = res.ReadAll()\n\t\tif err != nil {\n\t\t\treturn ctx, defaultRes, respHeaders, err\n\t\t}\n\t}\n\n\treturn ctx, defaultRes, respHeaders, &zanzibar.UnexpectedHTTPError{\n\t\tStatusCode: res.StatusCode,\n\t\tRawBody: res.GetRawBody(),\n\t}\n}", "title": "" }, { "docid": "2b7e2f3d8e33d5c47ffd28ff4a8b436f", "score": "0.4714287", "text": "func (s *HelloService) SayHello(ctx context.Context, req *hellopb.HelloRequest) (*hellopb.HelloResponse, error) {\n\tvar span opentracing.Span\n\tif span = opentracing.SpanFromContext(ctx); span != nil {\n\t\tspan := s.tracer.StartSpan(s.Service+\":SayHello\", opentracing.ChildOf(span.Context()))\n\t\tdefer span.Finish()\n\t\tctx = opentracing.ContextWithSpan(ctx, span)\n\t}\n\n\tif req.ServiceID.String() != s.Service && span != nil && s.nextService != nil {\n\t\tlog.Println(\"proceeding to next service\")\n\t\tnextServiceTag := hellopb.ServiceID_TWO.String()\n\t\ttime.Sleep(time.Millisecond * 100)\n\t\tif s.Service == hellopb.ServiceID_TWO.String() {\n\t\t\ttime.Sleep(time.Millisecond * 200)\n\t\t\tnextServiceTag = hellopb.ServiceID_THREE.String()\n\t\t}\n\t\ttags.SpanKindRPCClient.Set(span)\n\t\ttags.PeerService.Set(span, nextServiceTag)\n\t\tspan.SetTag(\"next-service\", nextServiceTag)\n\t\treturn s.nextService.SayHello(ctx, req)\n\t}\n\n\treturn &hellopb.HelloResponse{\n\t\tMsg: fmt.Sprintf(\"Hello from service %s\", s.Service),\n\t}, nil\n}", "title": "" }, { "docid": "ef730e222a912f6e4aa62ef7334ddbde", "score": "0.47019082", "text": "func NewFxHelloServiceYARPCClient(name string, options ...protobuf.ClientOption) interface{} {\n\treturn func(params FxHelloServiceYARPCClientParams) FxHelloServiceYARPCClientResult {\n\t\treturn FxHelloServiceYARPCClientResult{\n\t\t\tClient: NewHelloServiceYARPCClient(params.Provider.ClientConfig(name), options...),\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2609c6f9d41e70df1ac5d3f14a802078", "score": "0.46764445", "text": "func NewHelloService(db *DB) template.HelloService {\n\treturn &HelloService{db: db}\n}", "title": "" }, { "docid": "e78cab7d61ba561278ba48bbb941eefa", "score": "0.46684173", "text": "func NewService() Service {\n\treturn helloService{}\n}", "title": "" }, { "docid": "7703cf752af45c7ad7bedd59373ba3f3", "score": "0.46660203", "text": "func main() {\n\tflag.Parse()\n\t// Extract the set of modules that code is to be generated for,\n\t// throwing an error if the set is empty.\n\tgenerateModules := flag.Args()\n\tif len(generateModules) == 0 {\n\t\tlog.Exitln(\"Error: no input modules specified\")\n\t}\n\n\tif *schemaStructPath == \"\" {\n\t\tlog.Exitln(\"Error: schemaStructPath unspecified\")\n\t}\n\n\t// Determine the set of paths that should be searched for included\n\t// modules. This is supplied by the user as a set of comma-separated\n\t// paths, so we split the string. Additionally, for each path\n\t// specified, we append \"...\" to ensure that the directory is\n\t// recursively searched.\n\tincludePaths := []string{}\n\tif len(*yangPaths) > 0 {\n\t\tpathParts := strings.Split(*yangPaths, \",\")\n\t\tfor _, path := range pathParts {\n\t\t\tincludePaths = append(includePaths, filepath.Join(path, \"...\"))\n\t\t}\n\t}\n\n\t// Determine which modules the user has requested to be excluded from\n\t// code generation.\n\tmodsExcluded := []string{}\n\tif len(*excludeModules) > 0 {\n\t\tmodParts := strings.Split(*excludeModules, \",\")\n\t\tfor _, mod := range modParts {\n\t\t\tmodsExcluded = append(modsExcluded, mod)\n\t\t}\n\t}\n\n\tif *outputFile == \"\" {\n\t\tlog.Exitln(\"Error: outputFile unspecified\")\n\t}\n\n\t// Perform the code generation.\n\tcg := &ypathgen.GenConfig{\n\t\tPackageName: *packageName,\n\t\tGoImports: ypathgen.GoImports{\n\t\t\tSchemaStructPkgPath: *schemaStructPath,\n\t\t\tGNMIProtoPath: *gnmiProtoPath,\n\t\t\tYgotImportPath: *ygotImportPath,\n\t\t},\n\t\tPreferOperationalState: *preferOperationalState,\n\t\tFakeRootName: *fakeRootName,\n\t\tExcludeModules: modsExcluded,\n\t\tSchemaStructPkgAlias: \"oc\",\n\t\tYANGParseOptions: yang.Options{\n\t\t\tIgnoreSubmoduleCircularDependencies: *ignoreCircDeps,\n\t\t},\n\t\tGeneratingBinary: genutil.CallerName(),\n\t\tListBuilderKeyThreshold: *listBuilderKeyThreshold,\n\t}\n\n\tpathCode, _, errs := cg.GeneratePathCode(generateModules, includePaths)\n\tif errs != nil {\n\t\tlog.Exitf(\"ERROR Generating Code: %s\\n\", errs)\n\t}\n\n\t// If no output file is specified, we output to os.Stdout, otherwise\n\t// we write to the specified file.\n\tvar outfh *os.File\n\tswitch *outputFile {\n\tcase \"\":\n\t\toutfh = os.Stdout\n\tdefault:\n\t\t// Assign the newly created filehandle to the outfh, and ensure\n\t\t// that it is synced and closed before exit of main.\n\t\toutfh = openFile(*outputFile)\n\t\tdefer syncFile(outfh)\n\t}\n\n\twriteGoCodeSingleFile(outfh, pathCode)\n}", "title": "" }, { "docid": "6e821554052efb4fc874548ab614fcd4", "score": "0.46612722", "text": "func (_Api *ApiCallerSession) Hello() (string, error) {\n\treturn _Api.Contract.Hello(&_Api.CallOpts)\n}", "title": "" }, { "docid": "7b84e4a938a9c1cebf6a115f1da5260c", "score": "0.4657721", "text": "func NewHelloYARPCClient(clientConfig transport.ClientConfig, options ...protobuf.ClientOption) HelloYARPCClient {\n\treturn newHelloYARPCClient(clientConfig, nil, options...)\n}", "title": "" }, { "docid": "bc918c43b40cb3f25a5c23832aba6994", "score": "0.46402368", "text": "func (s *_echo_GreeterService) _handler_SayHello_0(ctx v4.Context) error {\n\tvar in SayHelloRequest\n\tif err := ctx.Bind(&in); err != nil {\n\t\tctx.Error(err)\n\t\treturn nil\n\t}\n\tmd := metadata.New(nil)\n\tfor k, v := range ctx.Request().Header {\n\t\tmd.Set(k, v...)\n\t}\n\tnewCtx := metadata.NewIncomingContext(ctx.Request().Context(), md)\n\tout, err := s.server.(GreeterServiceEchoServer).SayHello(newCtx, &in)\n\tif err != nil {\n\t\tctx.Error(err)\n\t\treturn nil\n\t}\n\n\treturn ctx.JSON(http.StatusOK, out)\n}", "title": "" }, { "docid": "6c4fb4192655a1f4059160d98e3f80f2", "score": "0.46247506", "text": "func NewHello(xid uint32) openflow.Echo {\n\treturn &echo{\n\t\tMessage: openflow.NewMessage(openflow.OF10_VERSION, OFPT_HELLO, xid),\n\t}\n}", "title": "" }, { "docid": "1f720f47278f5fbf20122dc4a617b34c", "score": "0.46230188", "text": "func main() {\n\tfmt.Println(helloworld.Hello(\"Aayush\"))\n}", "title": "" }, { "docid": "3551fd45f5ab0da467071b7891483113", "score": "0.4622854", "text": "func (s *greeterService) SayHello(ctx context.Context, req *helloworld.HelloRequest) (*helloworld.HelloReply, error) {\n\tresp := new(helloworld.HelloReply)\n\tresp.Message = \"Hello \" + req.Name\n\treturn resp, nil\n}", "title": "" }, { "docid": "fdae3607857b5ee9e18630e29d41147d", "score": "0.46152243", "text": "func (s *grpcServer) SayHello(ctx context.Context, req *pb.HelloRequest) (*pb.HelloResponse, error) {\n\t_, rep, err := s.sayhello.ServeGRPC(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn rep.(*pb.HelloResponse), nil\n}", "title": "" }, { "docid": "e4d9230f99757ea1a9b4e8946cba7d26", "score": "0.4597225", "text": "func (s service) Generate() error {\n\tvar functions, err = s.CreateFunctionList()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor key, value := range functions {\n\t\tf := jen.NewFile(packageName)\n\t\tfTest := jen.NewFile(packageName)\n\t\ts.serviceURLProtoPath = filepath.Join(s.url, \"pb\", createSimpleNameFromProtoPath(s.protoPath))\n\n\t\tf.ImportAlias(s.serviceURLProtoPath, \"pb\")\n\n\t\tfunctions := strings.Split(value, \"\\n\")\n\n\t\tfor _, fun := range functions {\n\t\t\tif len(fun) < 5 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif fun != \"\" {\n\t\t\t\tf.Comment(s.CreateFunctionName(fun) + \" :nodoc:\")\n\t\t\t\tf.Func().Params(\n\t\t\t\t\tjen.Id(\"s\").Id(\"Service\"),\n\t\t\t\t).Id(s.CreateFunctionName(fun)).Params(s.CreateFunctionParameters(fun)...).\n\t\t\t\t\tParens(jen.List(jen.Id(\"res\").Op(\"*\").Qual(s.serviceURLProtoPath, s.CreateFunctionReturns(fun)[1]),\n\t\t\t\t\t\tjen.Id(\"err\").Error())).\n\t\t\t\t\tBlock(jen.Return())\n\n\t\t\t\t//testfunction\n\t\t\t\tfTest.Func().Id(s.CreateTestFunctionName(fun)).Params(jen.Id(\"t\").Op(\"*\").Qual(\"testing\", \"T\")).Block()\n\t\t\t}\n\t\t}\n\n\t\tbuf := &bytes.Buffer{}\n\t\tbufTest := &bytes.Buffer{}\n\t\terr := f.Render(buf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = fTest.Render(bufTest)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = ioutil.WriteFile(filepath.Join(s.name, \"service\", key+\"_impl.go\"), buf.Bytes(), 0644)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = ioutil.WriteFile(filepath.Join(s.name, \"service\", key+\"_impl_test.go\"), bufTest.Bytes(), 0644)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d472067e8d2ee2fa34145231fd1edc78", "score": "0.45918137", "text": "func NewFxHistoryAPIYARPCProcedures() interface{} {\n\treturn func(params FxHistoryAPIYARPCProceduresParams) FxHistoryAPIYARPCProceduresResult {\n\t\treturn FxHistoryAPIYARPCProceduresResult{\n\t\t\tProcedures: buildHistoryAPIYARPCProcedures(buildHistoryAPIYARPCProceduresParams{\n\t\t\t\tServer: params.Server,\n\t\t\t\tAnyResolver: params.AnyResolver,\n\t\t\t}),\n\t\t\tReflectionMeta: reflection.ServerMeta{\n\t\t\t\tServiceName: \"uber.cadence.history.v1.HistoryAPI\",\n\t\t\t\tFileDescriptors: yarpcFileDescriptorClosurefee8ff76963a38ed,\n\t\t\t},\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5cc38e51b9a366d613e5fa22c3b59aa3", "score": "0.4590104", "text": "func New(s service.HelloService, mdw map[string][]endpoint.Middleware) Endpoints {\n\teps := Endpoints{\n\t\tMakeADateEndpoint: MakeMakeADateEndpoint(s),\n\t\tSayHiEndpoint: MakeSayHiEndpoint(s),\n\t\tUpdateUserInfoEndpoint: MakeUpdateUserInfoEndpoint(s),\n\t}\n\tfor _, m := range mdw[\"SayHi\"] {\n\t\teps.SayHiEndpoint = m(eps.SayHiEndpoint)\n\t}\n\tfor _, m := range mdw[\"MakeADate\"] {\n\t\teps.MakeADateEndpoint = m(eps.MakeADateEndpoint)\n\t}\n\tfor _, m := range mdw[\"UpdateUserInfo\"] {\n\t\teps.UpdateUserInfoEndpoint = m(eps.UpdateUserInfoEndpoint)\n\t}\n\treturn eps\n}", "title": "" }, { "docid": "e6c6f102fb53b3cfbb5b9f43b19dfa98", "score": "0.4586072", "text": "func (s *_echo_GreeterService) _handler_SayHello_1(ctx v4.Context) error {\n\tvar in SayHelloRequest\n\tif err := ctx.Bind(&in); err != nil {\n\t\tctx.Error(err)\n\t\treturn nil\n\t}\n\tmd := metadata.New(nil)\n\tfor k, v := range ctx.Request().Header {\n\t\tmd.Set(k, v...)\n\t}\n\tnewCtx := metadata.NewIncomingContext(ctx.Request().Context(), md)\n\tout, err := s.server.(GreeterServiceEchoServer).SayHello(newCtx, &in)\n\tif err != nil {\n\t\tctx.Error(err)\n\t\treturn nil\n\t}\n\n\treturn ctx.JSON(http.StatusOK, out)\n}", "title": "" }, { "docid": "b196cf4f90821a34f4adea5d70536a82", "score": "0.45682922", "text": "func (h *HelloServer) Hello(ctx context.Context, request *pb.HelloRequest) (*pb.HelloResponse, error) {\n\tpr, _ := peer.FromContext(ctx)\n\tname := request.GetName()\n\n\tif name == \"\" {\n\t\tfmt.Printf(\"Received a hello from %v but it contained no name; responding with an error\\n\", pr.Addr)\n\t\treturn nil, errors.New(\"Didn't receive a name\")\n\t}\n\n\tfmt.Printf(\"Received a hello from %v at %v. Sending a kind reply :)\\n\", name, pr.Addr)\n\tresponse := &pb.HelloResponse{\n\t\tReply: fmt.Sprintf(\"Hello %v! Nice to meet you :)\", name),\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "748c2dbfc1042c1f8b03bf731ec8ae88", "score": "0.45629582", "text": "func SayHello(name string) {\n\tfmt.Println(\"hello\")\n\tintroduce(name)\n}", "title": "" }, { "docid": "a50859829dbf34128071f1f67a274f57", "score": "0.45538682", "text": "func createCommands(major, minor, domain string, commands []*Command, events []*Event) error {\n codeTemplateData := NewCodeTemplateData(major, minor, domain)\n for _, c := range commands {\n if len(c.Parameters) == 0 && len(c.Returns) == 0 {\n //fmt.Println(\"Name: \" + c.Name + \" Description: \" + c.Description)\n codeTemplateData.NoParamReturnCalls = append(codeTemplateData.NoParamReturnCalls, &GeneratedNoParamReturnCommand{Description: c.Description,\n Method: c.Name})\n } else if len(c.Parameters) != 0 && len(c.Returns) == 0 {\n codeTemplateData.ParamCalls = append(codeTemplateData.ParamCalls, &GeneratedParamCommand{Description: c.Description,\n Method: c.Name,\n Params: getParameters(codeTemplateData, domain, c.Parameters)})\n } else if len(c.Parameters) == 0 && len(c.Returns) != 0 {\n codeTemplateData.ReturnCalls = append(codeTemplateData.ReturnCalls, &GeneratedReturnCommand{Description: c.Description,\n Method: c.Name,\n Returns: getReturnTypes(codeTemplateData, domain, c.Returns)})\n } else if len(c.Parameters) != 0 && len(c.Returns) != 0 {\n codeTemplateData.ParamReturnCalls = append(codeTemplateData.ParamReturnCalls, &GeneratedReturnParamCommand{Description: c.Description,\n Method: c.Name,\n Params: getParameters(codeTemplateData, domain, c.Parameters),\n Returns: getReturnTypes(codeTemplateData, domain, c.Returns) })\n }\n }\n\n if events != nil && len(events) > 0 {\n for _, ev := range events {\n description := ev.Description\n if ev.Deprecated { description = \"DEPRECATED \" + description }\n if ev.Hidden { description = \"HIDDEN \" + description }\n codeTemplateData.Events = append(codeTemplateData.Events, &GeneratedEvent{Name: ev.Name,\n Description: ev.Description,\n NoParams: len(ev.Parameters) == 0,\n Params: getParameters(codeTemplateData, domain, ev.Parameters)})\n if len(ev.Parameters) > 0 {\n codeTemplateData.JsonRequired = true\n }\n }\n }\n\n writeCommands(codeTemplateData)\n return nil\n}", "title": "" }, { "docid": "d2896b78e08d222f7a5adc0a920bb2f5", "score": "0.4536754", "text": "func (e *HelloSvc) SayHello(ctx context.Context, req *hello.Request, rsp *hello.Response) error {\n\tlog.Log(\"Received HelloSvc.SayHello request\")\n\n\trsp.Msg = fmt.Sprintf(\"\\\"{\\\"res\\\":\\\"hello %s\\\"}\\\"\", req.Name)\n\n\treturn nil\n}", "title": "" }, { "docid": "e97a2c294df966e5b9a31c734ce26b1b", "score": "0.4521002", "text": "func (s *grpcServer) SayHello(ctx context.Context, req *pb.SayHelloRequest) (*pb.SayHelloResponse, error) {\n\t_, rep, err := s.sayhello.ServeGRPC(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn rep.(*pb.SayHelloResponse), nil\n}", "title": "" }, { "docid": "66a32f6cfdf762e8a9fa1ccfd8848a9c", "score": "0.4516086", "text": "func MakeDependencyInjection() map[string]interface{} {\n\tlog.Logger.Debug().Msg(\"Start bootstrap app objects\")\n\tinstances := make(map[string]interface{})\n\n\tinstances[\"authService\"] = serviceauth.New()\n\n\tlog.Logger.Debug().Msg(\"End bootstrap app objects\")\n\treturn instances\n}", "title": "" }, { "docid": "fc1c1e17aaf52a8003d6829de5b62973", "score": "0.45129704", "text": "func (s *Greeter) SayHello(\n\tctx context.Context,\n\treq *proto.HelloRequest,\n) (*proto.HelloResponse, error) {\n\treturn &proto.HelloResponse{\n\t\tMessage: \"Hello \" + req.Name + \", this is greetings from tls micro server\",\n\t}, nil\n}", "title": "" }, { "docid": "e4e761182070a3940f488bb4fa58240e", "score": "0.45111293", "text": "func GenerateGRPC() error {\n\n\ttoDir := \"./internal/pub\"\n\tdcDir := getDataflowContractsDir()\n\n\tfromDir := filepath.Join(dcDir, \"plugins\")\n\n\terr := sh.RunV(\"protoc\",\n\t\t\"-I\",\n\t\tfromDir,\n\t\t\"--go_out=plugins=grpc:\"+toDir,\n\t\t\"publisher.proto\")\n\n\treturn err\n}", "title": "" }, { "docid": "dd7f0d4e8fc0e9cb64fb7235f2da203c", "score": "0.450996", "text": "func (app *helloApp) SetupOwnExtraFiles(cmd *exec.Cmd, newConfig configuration.IConfig) error {\n\t/*\n\t\tplace here something like that:\n\t\tcmd.ExtraFiles =\n\t\t\tfiles = append(cmd.ExtraFiles, <file from you listener>)\n\t\t\tcmd.Env = append(cmd.Env, fmt.Sprintf(\"GRACEFUL_YOUR_SERVICE_FD=%d\", 2+len(cmd.ExtraFiles)))\n\t*/\n\tif app.listener == nil {\n\t\tgoservicetools.GetSystemLogger().Fatal().Msg(\"No listener in helloApp was perepared\")\n\t}\n\t_env, err := goservicetools.GetEnvironment()\n\tif err != nil {\n\t\tgoservicetools.GetSystemLogger().Fatal().Msgf(\"SetupOwnExtraFiles: error while getting current environment: %v\", err)\n\t}\n\tnewPort, err := newConfig.GetIntValue(_env, \"hello\", \"port\")\n\tif err != nil {\n\t\tgoservicetools.GetSystemLogger().Fatal().Msgf(\"SetupOwnExtraFiles: error while new port value from new config: %v\", err)\n\t}\n\t// we assume work with lower ports here\n\tif newPort != app.helloPort {\n\t\tapp.listener.Close()\n\t\treturn nil\n\t}\n\t// Warning: here we assume config not changes port values for this feature\n\tvar f *os.File\n\tswitch v := app.listener.(type) {\n\tcase *net.TCPListener:\n\t\tf, err = v.File()\n\tcase *net.UnixListener:\n\t\tf, err = v.File()\n\tdefault:\n\t\tgoservicetools.GetSystemLogger().Fatal().Msg(\"Wrong tcp or unix listener\")\n\t}\n\tif err != nil {\n\t\tgoservicetools.GetSystemLogger().Fatal().Msgf(\"SetupOwnExtraFiles: error while preparing file handler: %v\", err)\n\t}\n\tapp.rMutex.Lock()\n\tapp.listener = nil\n\tapp.rMutex.Unlock()\n\tcmd.ExtraFiles = append(cmd.ExtraFiles, f)\n\tcmd.Env = append(cmd.Env, fmt.Sprintf(\"GRACEFUL_HELLO_FD=%d\", 2+len(cmd.ExtraFiles)))\n\treturn nil\n}", "title": "" }, { "docid": "078726c08b3a9be1b0bc02f46a4d92bf", "score": "0.45096692", "text": "func decodeHelloResponse(_ context.Context, reply interface{}) (interface{}, error) {\n\t// return nil, errors.New(\"'client Hello' Decoder is not impelemented\")\n\threp := reply.(*pb.HelloReply)\n\n\tif hrep.Err != \"null\" {\n\t\treturn pkgendpoint.HelloResponse{Rs: \"null\", Err: errors.New(hrep.Err)}, nil\n\t}\n\t// return endpoint1.HelloResponse{Rs: hrep.Err, Err: nil}, nil\n\treturn pkgendpoint.HelloResponse{Rs: hrep.Rs, Err: nil}, nil\n}", "title": "" }, { "docid": "c865b5177bbb6a07ef84b52510ce1b77", "score": "0.4505702", "text": "func NewHelloGoaService(logger *log.Logger) hellogoaservice.Service {\n\treturn &helloGoaServiceSvc{logger}\n}", "title": "" }, { "docid": "d667b4126cf351c04bdf02e4a15f1c82", "score": "0.45029598", "text": "func (_obj *DoUser) EchoHello(Name string, Greeting *string, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(Name, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\tctx := context.Background()\n\terr = _obj.s.Tars_invoke(ctx, 0, \"echoHello\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _is.Read_string(&(*Greeting), 2, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_obj.setMap(len(_opt), _resp, _context, _status)\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "title": "" }, { "docid": "893d47215a6634c2bd4b68e7acd35d4a", "score": "0.44815695", "text": "func HelloPubSub(ctx context.Context, m PubSubMessage) error {\n\tvar config Config\n\tif err := envconfig.Process(\"\", &config); err != nil {\n\t\treturn fmt.Errorf(\"failed to process env vars: %w\", err)\n\t}\n\n\trate, err := getExchangeRate(config.TransferwiseAPIKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := sendToSlack(config.SlackWebhookURL, rate); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b8373c51b0e83d9060b7236a479ab3bb", "score": "0.44777286", "text": "func (h *HelloWorld) Hello(name string) (*hw.HelloRs, error) {\n\tif err := h.validateRq(name); err != nil {\n\t\treturn nil, err\n\t}\n\trs := &hw.HelloRs{}\n\trs.Greetings = strings.Join([]string{\"Hello\", name, \"!\"}, \" \")\n\treturn rs, nil\n}", "title": "" }, { "docid": "82ae52feaed98f16ef5c393fa0704407", "score": "0.44579104", "text": "func BuildTdxReaderYARPCProcedures(server TdxReaderYARPCServer) []transport.Procedure {\n\treturn buildTdxReaderYARPCProcedures(buildTdxReaderYARPCProceduresParams{Server: server})\n}", "title": "" }, { "docid": "87d34ab7ff143776452ed242120dd303", "score": "0.44491652", "text": "func RegisterServices(cc *context.ChainContext) error {\n\tcfgFile := cc.ConfigFile()\n\tcfg, err := cc.Config()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogService := NewLogService(cfgFile)\n\t_ = cc.Register(context.LogService, logService)\n\t_ = logService.Init()\n\tledgerService := NewLedgerService(cfgFile)\n\t_ = cc.Register(context.LedgerService, ledgerService)\n\n\tif !cc.HasService(context.WalletService) {\n\t\twalletService := NewWalletService(cfgFile)\n\t\t_ = cc.Register(context.WalletService, walletService)\n\t}\n\n\tif cfg.P2P.IsBootNode {\n\t\thttpService := NewHttpService(cfgFile)\n\t\t_ = cc.Register(context.BootNodeHttpService, httpService)\n\t}\n\n\tif len(cfg.P2P.BootNodes) > 0 {\n\t\tnetService, err := NewP2PService(cfgFile)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_ = cc.Register(context.P2PService, netService)\n\t}\n\tconsensusService := NewConsensusService(cfgFile)\n\t_ = cc.Register(context.ConsensusService, consensusService)\n\tif rpcService, err := NewRPCService(cfgFile); err != nil {\n\t\treturn err\n\t} else {\n\t\t_ = cc.Register(context.RPCService, rpcService)\n\t}\n\n\tif cfg.PoV.PovEnabled {\n\t\tpovService := NewPoVService(cfgFile)\n\t\t_ = cc.Register(context.PovService, povService)\n\t\tminerService := NewMinerService(cfgFile, povService.GetPoVEngine())\n\t\t_ = cc.Register(context.MinerService, minerService)\n\t}\n\n\taccounts := cc.Accounts()\n\tif len(accounts) > 0 && cfg.AutoGenerateReceive {\n\t\tautoReceiveService := NewAutoReceiveService(cfgFile)\n\t\t_ = cc.Register(context.AutoReceiveService, autoReceiveService)\n\t}\n\n\tif cfg.Metrics.Enable {\n\t\tmetricsService := NewMetricsService(cfgFile)\n\t\t_ = cc.Register(context.MetricsService, metricsService)\n\t}\n\n\tchainManageService := NewChainManageService(cfgFile)\n\t_ = cc.Register(context.ChainManageService, chainManageService)\n\n\tresendBlockService := NewResendBlockService(cfgFile)\n\t_ = cc.Register(context.ResendBlockService, resendBlockService)\n\n\tif cfg.Privacy.Enable {\n\t\tprivacyService := NewPrivacyService(cfgFile)\n\t\t_ = cc.Register(context.PrivacyService, privacyService)\n\t}\n\n\tif cfg.WhiteList.Enable {\n\t\tpermService := NewPermissionService(cfgFile)\n\t\t_ = cc.Register(context.PermissionService, permService)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fca59d4e61f85f2304fc93fd24dd0363", "score": "0.44464728", "text": "func BuildMirrorInternalYARPCProcedures(server MirrorInternalYARPCServer) []transport.Procedure {\n\treturn buildMirrorInternalYARPCProcedures(buildMirrorInternalYARPCProceduresParams{Server: server})\n}", "title": "" }, { "docid": "fcdca180c0d3fee42e32f908230c2e5a", "score": "0.4442762", "text": "func (_Api *ApiCaller) Hello(opts *bind.CallOpts) (string, error) {\n\tvar out []interface{}\n\terr := _Api.contract.Call(opts, &out, \"Hello\")\n\n\tif err != nil {\n\t\treturn *new(string), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(string)).(*string)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "e4408fba4a6e65cf2bf304e8a1f95200", "score": "0.44411698", "text": "func (c *command) Hello(protover int64, auth *UsernamePassword, setname *string) Result {\n\tr := newResult()\n\tr.request.cmd = append(r.request.cmd, \"HELLO\", protover)\n\tif auth != nil {\n\t\tr.request.cmd = append(r.request.cmd, \"AUTH\", auth.Username, auth.Password)\n\t}\n\tif setname != nil {\n\t\tr.request.cmd = append(r.request.cmd, \"SETNAME\", setname)\n\t}\n\tc.send(CmdHello, r)\n\treturn r\n}", "title": "" }, { "docid": "f2fc1c6655044b272452b0ab19b50fdd", "score": "0.44292483", "text": "func BuildK8sProcessor() (K8sProcessor, error) {\n\tclient, err := apiserverCreateClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &k8sProcessorImpl{\n\t\tk8sClient: client,\n\t}, nil\n}", "title": "" }, { "docid": "5a1821d05f1c35af828311f8d12d5a33", "score": "0.44272715", "text": "func Build() (*Manager, func(), error) {\n\tcontext, cleanup, err := entrypoint.ContextProvider()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tviper, cleanup2, err := config.Provider()\n\tif err != nil {\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tloggerConfig, cleanup3, err := logger.ProviderCfg(viper)\n\tif err != nil {\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tzap, cleanup4, err := logger.Provider(context, loggerConfig)\n\tif err != nil {\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tconfiguration, cleanup5, err := tracing.Cfg(viper)\n\tif err != nil {\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\ttracerProvider, cleanup6, err := tracing.Provider(context, configuration, zap)\n\tif err != nil {\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tgrpcConfig, cleanup7, err := grpc.Cfg(viper)\n\tif err != nil {\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tpoolManager, cleanup8, err := grpc.Provider(context, tracerProvider, zap, grpcConfig)\n\tif err != nil {\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tserviceManagers := ServiceManagers{\n\t\tPoolManager: poolManager,\n\t}\n\tproducts_routerConfig, cleanup9, err := Cfg(viper)\n\tif err != nil {\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tmanager, cleanup10, err := Provider(context, zap, serviceManagers, products_routerConfig)\n\tif err != nil {\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\treturn manager, func() {\n\t\tcleanup10()\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t}, nil\n}", "title": "" }, { "docid": "26f8de7ca6a83d05494891ac099c91ad", "score": "0.44260576", "text": "func encodeHelloRequest(_ context.Context, request interface{}) (interface{}, error) {\n\t// return nil, errors.New(\"'client Hello' Encoder is not impelemented\")\n\treq := request.(pkgendpoint.HelloRequest)\n\treturn &pb.HelloRequest{S: req.S}, nil\n}", "title": "" }, { "docid": "6acf0dd5fb9ca2f4e65edd91b2170fac", "score": "0.44146597", "text": "func (s OldGuy) SayHello() {\n\tfmt.Println(\"Hello from outside the package! I'm good for stubbing!\")\n}", "title": "" }, { "docid": "407d7b6d373509fd3d114be8ec04697d", "score": "0.44059536", "text": "func HelloHelloGoaServicePath(name string) string {\n\treturn fmt.Sprintf(\"/hello/%v\", name)\n}", "title": "" }, { "docid": "00ca0c07565d1b099e4e4a0b56d9ba58", "score": "0.44015247", "text": "func (p *gorpc) Generate(file *generator.FileDescriptor) {\n\n\tif len(file.FileDescriptorProto.Service) == 0 {\n\t\treturn\n\t}\n\t_ = p.gen.AddImport(gorpcServerPkgPath)\n\t_ = p.gen.AddImport(gorpcClientPkgPath)\n\t_ = p.gen.AddImport(gorpcInterceptorPkgPath)\n\t_ = p.gen.AddImport(\"context\")\n\n\t// generate all services\n\tfor i, service := range file.FileDescriptorProto.Service {\n\t\tp.generateService(file, service, i)\n\t}\n}", "title": "" }, { "docid": "12af6a15ce53fb7622e7ce3a442f3b4a", "score": "0.43966094", "text": "func decodeHelloRequest(_ context.Context, r interface{}) (interface{}, error) {\n\t// return nil, errors.New(\"'pkg Hello' Decoder is not impelemented\")\n\treq := r.(*pb.HelloRequest)\n\treturn endpoint.HelloRequest{S: req.S}, nil\n}", "title": "" }, { "docid": "3772e12f32e4e0c1dcbbdaa7e282005c", "score": "0.43953833", "text": "func (h helloServer) SayHello(ctx context.Context, req *proto.SayHelloRequest) (res *proto.SayHelloResponse, err error) {\n\t// Let's just calculate req.Start number of primes in N^2.\n\tprimeList := []int{}\n\tn := 2\n\tfor len(primeList) < int(req.Start) {\n\t\tdivisable := false\n\t\tfor i := 2; i < n; i++ {\n\t\t\tif n%i == 0 {\n\t\t\t\tdivisable = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !divisable {\n\t\t\tprimeList = append(primeList, n)\n\t\t}\n\t}\n\tres = &proto.SayHelloResponse{End: int64(len(primeList))}\n\treturn\n}", "title": "" }, { "docid": "193074916a420a2859b5bf2fd7b38b68", "score": "0.43888706", "text": "func (s *Service) SayHello(ctx context.Context, req *holingo.HelloReq, reply *holingo.HelloResp) (err error) {\n\terr = s.dao.SayHello(ctx, req, reply)\n\tlogger.Infof(\"service.SayHello reply %s \\n\", (*reply).Content)\n\treturn\n}", "title": "" }, { "docid": "4ff7e9651ab246b25259091fc3ceef4b", "score": "0.43887156", "text": "func (s server) SayHello(ctx context.Context, req *pb.HelloRequest) (*pb.HelloReply, error) {\n\treturn &pb.HelloReply{Message:\"Server is saying hello to client \" + req.Name}, nil\n}", "title": "" }, { "docid": "30d4802b005096954247bfd85f3e3ea6", "score": "0.43868423", "text": "func CmdGwInit(){\n\n log.Println(\"Command Gateway Init\")\n \n CmdGwHdl = make(map[string]interface{} )\n srvlist = make([]string,1)\n\n srvlist = append(srvlist, \"SERVICE-1\")\n\n //Get the context for each service\n for _, s := range srvlist {\n CmdGwHdl[s] = apds.NewServiceCmds(s)\n }\n log.Println(\"Command Gateway Init ..... Complete\")\n}", "title": "" }, { "docid": "7307275bd9c716c053c93c7cd48a87ce", "score": "0.43751284", "text": "func GenRPC() *app.Command {\n\tcmd := app.NewCommand(\"rpc\", \"Generate RPC service contract files for rpc contract project.\", func(ctx *app.Context) error {\n\t\tfilenames := ctx.Args()\n\t\tif len(filenames) == 0 {\n\t\t\treturn fmt.Errorf(\"service definition files is missing\")\n\t\t}\n\n\t\tdefs := make(map[string]rsd.Definition)\n\t\tfor _, filename := range filenames {\n\t\t\tif !strings.EqualFold(filepath.Ext(filename), \".xml\") {\n\t\t\t\treturn fmt.Errorf(\"not a valid definition file: %s\", filename)\n\t\t\t}\n\n\t\t\td, err := rsd.Load(filename)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefs[filename] = d\n\t\t}\n\n\t\tfor filename, d := range defs {\n\t\t\tdir := filepath.Dir(filepath.Dir(filename))\n\t\t\tdir = filepath.Join(dir, \"java\", strings.Replace(d.GetPackage(), \".\", string(filepath.Separator), -1))\n\n\t\t\t// service\n\t\t\tif sm := d.GetServiceModel(); sm != nil {\n\t\t\t\tfiles := make(map[string]string)\n\t\t\t\tfiles[filepath.Join(dir, \"iface\", sm.Name+\"Service.java\")] = \"rpc/Service.java\"\n\t\t\t\terr := tpl.Execute(files, sm)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// enum\n\t\t\tenums := d.GetEnumModels()\n\t\t\tfor _, em := range enums {\n\t\t\t\tfiles := make(map[string]string)\n\t\t\t\tfiles[filepath.Join(dir, \"constant\", em.Name+\".java\")] = \"rpc/Enum.java\"\n\n\t\t\t\t// err = tpl.ExecuteWriter(os.Stdout, files, e)\n\t\t\t\terr := tpl.Execute(files, em)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// dto\n\t\t\tif dm := d.GetDtoModel(); dm != nil {\n\t\t\t\tfiles := make(map[string]string)\n\t\t\t\tfiles[filepath.Join(dir, \"dto\", dm.Name+\"Dto.java\")] = \"rpc/Dto.java\"\n\t\t\t\terr := tpl.Execute(files, dm)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tcmd.Flags.Register(flag.Help)\n\treturn cmd\n}", "title": "" }, { "docid": "c89f92c70ba269a792d746f141dd34e3", "score": "0.43724868", "text": "func Generate(module *pb.Module, pkg string) (CodeResult, error) {\n\tapp, err := getApp(module)\n\tif err != nil {\n\t\treturn CodeResult{}, err\n\t}\n\tepNames := sortEpNames(app.Endpoints)\n\tinterf, err := genInterfaceFile(app, epNames, pkg)\n\tif err != nil {\n\t\treturn CodeResult{}, err\n\t}\n\tmiddleware, err := genMiddlewareFile(app, epNames, pkg)\n\tif err != nil {\n\t\treturn CodeResult{}, err\n\t}\n\trest, err := genRestFile(app, epNames, pkg)\n\tif err != nil {\n\t\treturn CodeResult{}, err\n\t}\n\tresult := CodeResult{\n\t\tRest: rest,\n\t\tStorer: interf,\n\t\tMiddleware: middleware,\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "eba1e60cd9deff6d8d41e7d3348479a5", "score": "0.4367739", "text": "func (g *Application) Generate(source resource.Source, config interface{}) (resource.Operations, error) {\n\tvar err error\n\n\tapp, ok := source.(*nais_io_v1alpha1.Application)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"BUG: CreateApplication only accepts nais_io_v1alpha1.Application objects; fix your code\")\n\t}\n\n\tcfg, ok := config.(*Options)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"BUG: Application generator called without correct configuration object; fix your code\")\n\t}\n\n\tif len(cfg.GetTeam()) == 0 {\n\t\treturn nil, fmt.Errorf(\"the 'team' label needs to be set in the application metadata\")\n\t}\n\n\tast := resource.NewAst()\n\n\tservice.Create(app, ast, cfg)\n\tserviceaccount.Create(app, ast, cfg)\n\thorizontalpodautoscaler.Create(app, ast)\n\tnetworkpolicy.Create(app, ast, cfg)\n\tfqdnpolicy.Create(app, ast, cfg)\n\n\terr = frontend.Create(app, ast, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = observability.Create(app, ast, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = ingress.Create(app, ast, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = leaderelection.Create(app, ast, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = azure.Create(app, ast, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = idporten.Create(app, ast, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = gcp.Create(app, ast, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = proxyopts.Create(app, ast, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcertificateauthority.Create(app, ast, cfg)\n\tsecurelogs.Create(app, ast, cfg)\n\terr = maskinporten.Create(app, ast, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpoddisruptionbudget.Create(app, ast)\n\n\tjwker.Create(app, ast, cfg)\n\n\terr = aiven.Create(app, ast, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = vault.Create(app, ast, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = pod.CreateAppContainer(app, ast, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = deployment.Create(app, ast, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpodmonitor.Create(app, ast, cfg)\n\n\treturn ast.Operations, nil\n}", "title": "" }, { "docid": "350c93627e671e8b6f93f1c5a35ab756", "score": "0.43608147", "text": "func GenerateStack(resp *models.V1StackConfig) (cr *v1alpha1.Stack) { // nolint:gocyclo\n\tcr = &v1alpha1.Stack{}\n\n\t// if resp.DecisionMappings != nil {\n\t// \tcr.Spec.ForProvider.DecisionMappings = make(map[string]v1alpha1.V1RuleDecisionMappings, len(resp.DecisionMappings))\n\t// \tfor k, v := range resp.DecisionMappings {\n\t// \t\tn := &v1alpha1.V1RuleDecisionMappings{}\n\t// \t}\n\t// }\n\n\t// DeploymentParameters\n\n\tcr.Spec.ForProvider.Description = styraclient.StringValue(resp.Description)\n\n\t// Errors\n\n\t// Install\n\n\tif resp.Metadata != nil {\n\t\tcr.Status.AtProvider.Metadata = &v1alpha1.V1ObjectMeta{}\n\t\tcr.Status.AtProvider.Metadata.CreatedBy = resp.Metadata.CreatedBy\n\t\tcr.Status.AtProvider.Metadata.CreatedThrough = resp.Metadata.CreatedThrough\n\t\tcr.Status.AtProvider.Metadata.LastModifiedBy = resp.Metadata.LastModifiedBy\n\t\tcr.Status.AtProvider.Metadata.LastModifiedThrough = resp.Metadata.LastModifiedThrough\n\t}\n\n\tif resp.Policies != nil {\n\t\tcr.Status.AtProvider.Policies = make([]*v1alpha1.V1PolicyConfig, len(resp.Policies))\n\t\tfor i, v := range resp.Policies {\n\t\t\tn := &v1alpha1.V1PolicyConfig{}\n\t\t\tn.Created = v.Created\n\t\t\tif v.Enforcement != nil {\n\t\t\t\tn.Enforcement = &v1alpha1.V1EnforcementConfig{}\n\t\t\t\tn.Enforcement.Enforced = v.Enforcement.Enforced\n\t\t\t\tn.Enforcement.Type = v.Enforcement.Type\n\t\t\t}\n\t\t\tif v.ID != nil {\n\t\t\t\tn.ID = v.ID\n\t\t\t}\n\n\t\t\tif v.Modules != nil {\n\t\t\t\tn.Modules = make([]*v1alpha1.V1Module, len(v.Modules))\n\t\t\t\tfor im, vm := range v.Modules {\n\t\t\t\t\tnm := &v1alpha1.V1Module{}\n\t\t\t\t\tnm.Name = vm.Name\n\t\t\t\t\tnm.Placeholder = vm.Placeholder\n\t\t\t\t\tnm.ReadOnly = vm.ReadOnly\n\t\t\t\t\tif vm.Rules != nil {\n\t\t\t\t\t\tnm.Rules = &v1alpha1.V1RuleCounts{}\n\t\t\t\t\t\tnm.Rules.Allow = vm.Rules.Allow\n\t\t\t\t\t\tnm.Rules.Deny = vm.Rules.Deny\n\t\t\t\t\t\tnm.Rules.Enforce = vm.Rules.Enforce\n\t\t\t\t\t\tnm.Rules.Ignore = vm.Rules.Ignore\n\t\t\t\t\t\tnm.Rules.Monitor = vm.Rules.Monitor\n\t\t\t\t\t\tnm.Rules.Notify = vm.Rules.Notify\n\t\t\t\t\t\tnm.Rules.Other = vm.Rules.Other\n\t\t\t\t\t\tnm.Rules.Test = vm.Rules.Test\n\t\t\t\t\t\tnm.Rules.Total = vm.Rules.Total\n\t\t\t\t\t}\n\t\t\t\t\tn.Modules[im] = nm\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Rules\n\n\t\t\tif v.Type != nil {\n\t\t\t\tn.Type = v.Type\n\t\t\t}\n\n\t\t\tcr.Status.AtProvider.Policies[i] = n\n\t\t}\n\t}\n\n\tcr.Spec.ForProvider.ReadOnly = styraclient.BoolValue(resp.ReadOnly)\n\n\t// SourceControl\n\n\tcr.Spec.ForProvider.Type = styraclient.StringValue(resp.Type)\n\n\t// Uninstall\n\n\t// Warnings\n\n\treturn cr\n}", "title": "" }, { "docid": "793c6d1a75c13d82af9ceb96ca847269", "score": "0.43577665", "text": "func SayHello(w http.ResponseWriter, req *http.Request) {\n\tw.Write([]byte(\"Welcome to iHome MicroServices Center\"))\n}", "title": "" }, { "docid": "58f0b9428beaa5e2265fb575b8fa399a", "score": "0.43498763", "text": "func (c *Conn) SayHello(newSigAls []SignatureAndHash) (cipherID, curveType uint16, curveID CurveID, version uint16, certs [][]byte, err error) {\n\t// Set the supported signatures and hashes to the set `newSigAls`\n\tsupportedSignatureAlgorithms := make([]signatureAndHash, len(newSigAls))\n\tfor i := range newSigAls {\n\t\tsupportedSignatureAlgorithms[i] = newSigAls[i].internal()\n\t}\n\n\thello := &clientHelloMsg{\n\t\tvers: c.config.maxVersion(),\n\t\tcompressionMethods: []uint8{compressionNone},\n\t\trandom: make([]byte, 32),\n\t\tocspStapling: true,\n\t\tserverName: c.config.ServerName,\n\t\tsupportedCurves: c.config.curvePreferences(),\n\t\tsupportedPoints: []uint8{pointFormatUncompressed},\n\t\tnextProtoNeg: len(c.config.NextProtos) > 0,\n\t\tsecureRenegotiation: true,\n\t\tcipherSuites: c.config.cipherSuites(),\n\t\tsignatureAndHashes: supportedSignatureAlgorithms,\n\t}\n\tserverHello, err := c.sayHello(hello)\n\tif err != nil {\n\t\treturn\n\t}\n\t// Prime the connection, if necessary, for key\n\t// exchange messages by reading off the certificate\n\t// message and, if necessary, the OCSP stapling\n\t// message\n\tvar msg interface{}\n\tmsg, err = c.readHandshake()\n\tif err != nil {\n\t\treturn\n\t}\n\tcertMsg, ok := msg.(*certificateMsg)\n\tif !ok || len(certMsg.certificates) == 0 {\n\t\terr = unexpectedMessageError(certMsg, msg)\n\t\treturn\n\t}\n\tcerts = certMsg.certificates\n\n\tif serverHello.ocspStapling {\n\t\tmsg, err = c.readHandshake()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tcertStatusMsg, ok := msg.(*certificateStatusMsg)\n\t\tif !ok {\n\t\t\terr = unexpectedMessageError(certStatusMsg, msg)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif CipherSuites[serverHello.cipherSuite].EllipticCurve {\n\n\t\tvar skx *serverKeyExchangeMsg\n\t\tskx, err = c.exchangeKeys()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tif skx.raw[0] != typeServerKeyExchange {\n\t\t\terr = unexpectedMessageError(skx, msg)\n\t\t\treturn\n\t\t}\n\t\tif len(skx.key) < 4 {\n\t\t\terr = unexpectedMessageError(skx, msg)\n\t\t\treturn\n\t\t}\n\t\tcurveType = uint16(skx.key[0])\n\t\t// If we have a named curve, report which one it is.\n\t\tif curveType == 3 {\n\t\t\tcurveID = CurveID(skx.key[1])<<8 | CurveID(skx.key[2])\n\t\t}\n\t}\n\tcipherID, version = serverHello.cipherSuite, serverHello.vers\n\n\treturn\n}", "title": "" }, { "docid": "d4f281a6b92488fdb34cb821b48c1d68", "score": "0.4348943", "text": "func Generate(input []byte) *plugin.CodeGeneratorResponse {\n\trequest := new(plugin.CodeGeneratorRequest)\n\n\terr := proto.Unmarshal(input, request)\n\tif err != nil {\n\t\tutil.Die(fmt.Errorf(\"invalid CodeGeneratorRequest: %v\", err))\n\t}\n\n\tif len(request.FileToGenerate) != 1 {\n\t\tutil.Die(fmt.Errorf(\"Multiple input files given: %v\\nprotoapi only support one proto file\", request.FileToGenerate))\n\t}\n\n\tvar outputLang = \"ts\"\n\tvar params = make(map[string]string)\n\tparameter := request.GetParameter()\n\n\tif parameter != \"\" {\n\t\tparameters := strings.Split(*(request.Parameter), \",\")\n\t\tfor _, parameter := range parameters {\n\t\t\tkv := strings.Split(parameter, \"=\")\n\t\t\tif len(kv) == 2 {\n\t\t\t\tif strings.Compare(kv[0], \"lang\") == 0 {\n\t\t\t\t\toutputLang = kv[1]\n\t\t\t\t}\n\t\t\t\tparams[kv[0]] = kv[1]\n\t\t\t} else {\n\t\t\t\tparams[kv[0]] = \"\"\n\t\t\t}\n\t\t}\n\t}\n\n\tapplicationFile := filepath.Base(request.FileToGenerate[0])\n\tapplicationName := applicationFile[0 : len(applicationFile)-len(filepath.Ext(applicationFile))]\n\n\tpackageName := getPackageName(request)\n\n\toptions := getFileOptions(request)\n\n\tmessages, enums := getMessages(request.ProtoFile)\n\t// Fix same message name issue\n\tfixMessageName(messages, enums)\n\n\tservices := getServices(request.ProtoFile)\n\n\tdata.Setup(request)\n\n\t// temporary hack to ignore namespace for current package\n\t// should have more strict handling later\n\tif services != nil {\n\t\tfor _, s := range services {\n\t\t\tfor _, m := range s.Methods {\n\t\t\t\tmsg, file := data.GetMessageProtoAndFile(m.InputType)\n\t\t\t\tif file.IsFileToGenerate {\n\t\t\t\t\tm.InputType = msg.Proto.GetName()\n\t\t\t\t}\n\n\t\t\t\tmsg, file = data.GetMessageProtoAndFile(m.OutputType)\n\t\t\t\tif file.IsFileToGenerate {\n\t\t\t\t\tm.OutputType = msg.Proto.GetName()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif gen, ok := data.OutputMap[outputLang]; ok {\n\t\tresponse := new(plugin.CodeGeneratorResponse)\n\t\tgen.Init(request)\n\n\t\tresults, err := gen.Gen(applicationName, packageName, services, messages, enums, options)\n\t\tif err != nil {\n\t\t\tutil.Die(err)\n\t\t}\n\t\tfor file, content := range results {\n\t\t\tvar resultFile = new(plugin.CodeGeneratorResponse_File)\n\t\t\t// generate the file to the specified package\n\t\t\tfileName := file\n\t\t\tresultFile.Name = &fileName\n\t\t\tfileContent := content\n\t\t\tresultFile.Content = &fileContent\n\t\t\tresponse.File = append(response.File, resultFile)\n\t\t}\n\t\treturn response\n\t}\n\n\terr = fmt.Errorf(\"Output plugin not found for %s\\nsupported options: %v\", outputLang, reflect.ValueOf(data.OutputMap).MapKeys())\n\tutil.Die(err)\n\n\treturn nil\n}", "title": "" }, { "docid": "8d3b982e77284bcd5a17523237344096", "score": "0.43479764", "text": "func (app *helloApp) SystemSetup(graceful bool) error {\n\tconf, err := configuration.GetConfigInstance(\"main\")\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"getHelloPort() config error %v\", err))\n\t}\n\t_env, err := goservicetools.GetEnvironment()\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"getHelloPort() error on getting current working environment: %v\", err))\n\t}\n\tconfig, err := conf.GetSubconfig(_env)\n\tgoservicetools.GetSystemLogger().Info().Msg(\"Prepared working application config\")\n\tapp.config = config\n\tgoservicetools.GetSystemLogger().Info().Msg(\"Setting up hello app\")\n\thelloPort := app.getHelloPort()\n\tif helloPort < 0 {\n\t\treturn fmt.Errorf(\"There is negative hello port in app\")\n\t}\n\tgoservicetools.GetSystemLogger().Info().Msgf(\"Found configured port value %d\", helloPort)\n\tif graceful && (os.Getenv(\"GRACEFUL_HELLO_FD\") != \"\") {\n\t\tfd, err := strconv.ParseInt(os.Getenv(\"GRACEFUL_HELLO_FD\"), 10, 32)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"No variable GRACEFUL_HELLO_FD set for graceful start. Internal error: %v\", err)\n\t\t\tgoservicetools.GetSystemLogger().Panic().Msg(err.Error())\n\t\t}\n\t\tfile := os.NewFile(uintptr(fd), \"[hellosocket]\")\n\t\tif file == nil {\n\t\t\treturn fmt.Errorf(\"PrepareHTTPSocket: Not valid hello listener file descriptor while graceful restart\")\n\t\t}\n\t\tli, err := net.FileListener(file)\n\t\tif nil != err {\n\t\t\terr = fmt.Errorf(\"SystemSetup: cannot prepare filelistener for hello server. Error: %v\", err)\n\t\t\tgoservicetools.GetSystemLogger().Error().Msg(err.Error())\n\t\t\treturn err\n\t\t}\n\t\tapp.listener = li\n\t\treturn nil\n\t}\n\taddress := fmt.Sprintf(\":%d\", helloPort)\n\tfmt.Println(address)\n\tgoservicetools.GetSystemLogger().Info().Msgf(\"Try setup hello listener on address: %v\", address)\n\thttpListener, err := net.Listen(\"tcp\", address)\n\tif err != nil {\n\t\tgoservicetools.GetSystemLogger().Fatal().Msgf(\"Error while listen socket: %v\", err)\n\t}\n\t// in system start we would sy hello on each connect\n\tapp.listener = httpListener\n\treturn nil\n}", "title": "" }, { "docid": "b7ac91f4be8f996423e13fac0d6feeb3", "score": "0.43424407", "text": "func CreateApp(a ConfigAHello, b ConfigBHello) (*App, error) {\n\tformater := DefaultFormater()\n\tserviceAHello := NewServiceHelloA(a, formater)\n\tserviceA := NewServiceA(serviceAHello)\n\tserviceBHello := NewServiceHelloB(b, formater)\n\tserviceB := NewServiceB(serviceBHello)\n\tapp := New(serviceA, serviceB)\n\treturn app, nil\n}", "title": "" }, { "docid": "494e62b4ff972135bf64ec9cd114322a", "score": "0.43369156", "text": "func (*userService) GetHello(ctx context.Context, req *user.GreetingRequest) (*user.GreetingResponse, error) {\n\t//business logic\n\tsalutationMessage := fmt.Sprintf(\"Howdy, %s %s, nice to see you in the future!\",\n\t\treq.Salutaion, req.Name)\n\n\treturn &user.GreetingResponse{GreetingMessage: salutationMessage}, nil\n}", "title": "" }, { "docid": "269404e2b6e950a42a08927f625e4023", "score": "0.43306783", "text": "func (e *EchoService) SayHello(ctx context.Context, msg *messages.EchoMessage) (*messages.EchoMessage, error) {\n\treturn msg, nil\n}", "title": "" } ]
f70d63b62973703edc6c3c2c6d8176e4
Message returns the error message
[ { "docid": "9573756ed6d30a562cf1fc541808a735", "score": "0.719475", "text": "func (dpe *DeclinedPayoutError) Message() string {\n\treturn dpe.errorMessage\n}", "title": "" } ]
[ { "docid": "6c12f53ead6fd7a2503104e3fdea2548", "score": "0.825489", "text": "func (e *Error) Message() string { return e.message }", "title": "" }, { "docid": "a055e20b62f278447a02ac872d04aba3", "score": "0.7676938", "text": "func (e fieldsError) Message() string {\n\treturn e.message\n}", "title": "" }, { "docid": "692611080397c62c429455e108572dfb", "score": "0.76370174", "text": "func MessageErr() Look { return messageErr }", "title": "" }, { "docid": "01bd907a8bd5508434b5604e15f3df84", "score": "0.75382745", "text": "func (e *werror) Message() string {\n\treturn e.message\n}", "title": "" }, { "docid": "53d8f8d0165ab05aa9fb67aad66dcb05", "score": "0.7494874", "text": "func (e *errInvalidParam) Message() string {\n\treturn fmt.Sprintf(\"%s, %s.\", e.msg, e.Field())\n}", "title": "" }, { "docid": "041f8af44c10f68efbaf97e3fdced7fd", "score": "0.746258", "text": "func (e *Error) Message() string {\n\tmessage := strings.TrimRight(GetMessage(e.err), \"\\n \")\n\tif strings.Contains(message, \"\\n\") {\n\t\treturn fmt.Sprintf(\"%s:\\n %s\", e.class.String(),\n\t\t\tstrings.Replace(message, \"\\n\", \"\\n \", -1))\n\t}\n\treturn fmt.Sprintf(\"%s: %s\", e.class.String(), message)\n}", "title": "" }, { "docid": "c55aeeecb07a618c5cd7af7edb50d188", "score": "0.74452525", "text": "func (e *Err) Message() string {\n\treturn e.Message_\n}", "title": "" }, { "docid": "2f06e8cec3c79f0d331305c4dadd4ae1", "score": "0.74320424", "text": "func (e *ErrMsg) Error() string {\n\treturn e.Message\n}", "title": "" }, { "docid": "74cb7d2d1f82b8f00b1734c48386984b", "score": "0.7369101", "text": "func Message(err error) string {\n\tvar kve *KVError\n\tif !errors.As(err, &kve) {\n\t\treturn err.Error()\n\t}\n\tmsg := kve.kv[MessageKey]\n\treturn fmt.Sprint(msg)\n}", "title": "" }, { "docid": "c5d35dff8ee7f972d85ac62c19b437c0", "score": "0.7362866", "text": "func (e ErrInvalidParams) Message() string {\n\treturn fmt.Sprintf(\"%d validation error(s) found.\", len(e.errs))\n}", "title": "" }, { "docid": "9f5cd5a6aade678decbdbb06096832ee", "score": "0.7358791", "text": "func (e *ErrorMessage) Error() string{\n return e.s\n}", "title": "" }, { "docid": "786162081bcbef94deb48b76caddaddd", "score": "0.73505414", "text": "func Message(err error) string {\n\tif awserr, ok := err.(awserr.Error); ok {\n\t\treturn awserr.Message()\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "fc4e635b7a4da77f3d091ec0469ca507", "score": "0.7343474", "text": "func (e *ErrorX) Message() string {\n\treturn e.msg\n}", "title": "" }, { "docid": "8e0fc566b76011f0bc33a36c93a2eced", "score": "0.7332203", "text": "func (ce *CAQLError) Message() string {\n\tif ce.UserError == nil {\n\t\treturn \"\"\n\t}\n\n\tv, ok := ce.UserError[\"message\"]\n\tif !ok {\n\t\treturn \"\"\n\t}\n\n\tvs, ok := v.(string)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\n\treturn vs\n}", "title": "" }, { "docid": "1c4789f3bf006e0d287bc2922314aeef", "score": "0.72876596", "text": "func (e Code) Message() string {\n\tif msg, ok := _messages[e.Code()]; ok {\n\t\treturn msg\n\t}\n\treturn e.Error()\n}", "title": "" }, { "docid": "9da7d2a16c5304ba894c33365f27ecf1", "score": "0.7208269", "text": "func (se StatusErr) Error() string {\n\treturn se.Message\n}", "title": "" }, { "docid": "0f1faa6fa38e07178196a42e56638458", "score": "0.7198552", "text": "func (respErr *ResponseError) Message() string {\n\treturn respErr.Error.Message\n}", "title": "" }, { "docid": "2821c56e8a1a5ae7b99755daf617296c", "score": "0.71519125", "text": "func (ie *IdempotenceError) Message() string {\n\treturn ie.errorMessage\n}", "title": "" }, { "docid": "d03f31169332df39945e83090c000f19", "score": "0.7122922", "text": "func (e SharedConfigLoadError) Message() string {\n\treturn fmt.Sprintf(\"failed to load config file, %s\", e.Filename)\n}", "title": "" }, { "docid": "0fede010693f8dcbf2c3d809357589c6", "score": "0.7022568", "text": "func (c *customError) UserMessage() string { return c.userMessage }", "title": "" }, { "docid": "60a987d24e0173000d4b8e8e79b7c16c", "score": "0.7020795", "text": "func (s *InternalServerErrorException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "60a987d24e0173000d4b8e8e79b7c16c", "score": "0.7020242", "text": "func (s *InternalServerErrorException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "3064120f702798115fe79ec6fd0305d6", "score": "0.70051754", "text": "func (s OptInRequiredException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a9ae20721431d23aca43d1f1f5836eeb", "score": "0.69753194", "text": "func (s *WAFInternalErrorException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ea18f46834e3241a5ce4d9ee2f312ebd", "score": "0.69657123", "text": "func (s InvalidParameterValueException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "9c42f1df9a747ab6ae3bc73ddf41ea03", "score": "0.69517833", "text": "func (s *WAFInvalidResourceException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "32819aa8c0e81788a8553b2574436aa2", "score": "0.6950874", "text": "func (err Errno) Error() string {\n\treturn err.Message\n}", "title": "" }, { "docid": "06d712a2d5fcaea29c05aee640225a40", "score": "0.6950284", "text": "func ErrorMsg(code string) string {\n\treturn errorMsg[code]\n}", "title": "" }, { "docid": "c13d6ba0b40ee68e5b61911bb4271815", "score": "0.69452", "text": "func (e SharedConfigProfileNotExistsError) Message() string {\n\treturn fmt.Sprintf(\"failed to get profile, %s\", e.Profile)\n}", "title": "" }, { "docid": "8015ddd26a7df217cba38d5498eb1d36", "score": "0.69411623", "text": "func (s Status) Error() string {\n\tif s.Message != \"\" {\n\t\treturn s.Message\n\t}\n\treturn http.StatusText(s.Code)\n}", "title": "" }, { "docid": "0ef12cc0c02df032ce038313078fa20e", "score": "0.6929622", "text": "func (s *InternalServiceError) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e2b5bebf5da135c1a8cfb4cca3722a31", "score": "0.6918247", "text": "func (e Exception) Message() string {\n\treturn fmt.Sprintf(\"%s: %s\", e.Type, e.Value)\n}", "title": "" }, { "docid": "59a9ffda70c857917bf8dc613ac7ee53", "score": "0.6911003", "text": "func (e *Status) Error() string {\n\treturn fmt.Sprintf(\"%s (%s)\", e.Message, e.Code)\n}", "title": "" }, { "docid": "31337c8dd2900f7e48a0e28babffec32", "score": "0.6887827", "text": "func (s *InvalidParameterException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "f0086e2a72a366c02409190618e435b8", "score": "0.6885627", "text": "func (s *WAFInvalidParameterException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a72d7d494a9b7948eead243b43def90c", "score": "0.68832654", "text": "func (s *KMSInvalidKeyUsageException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "8397bcf8b4b8fdedc6ce92e54734c233", "score": "0.6881846", "text": "func (ve ValidationError) Error() string {\n\tvar str = \"The following errors occured during validation: \"\n\tfor _, e := range ve.Failures {\n\t\tstr += e + \". \"\n\t}\n\treturn str\n}", "title": "" }, { "docid": "35f11e08560829d3d663e90cadcab893", "score": "0.6879716", "text": "func (s *InvalidInputException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "35f11e08560829d3d663e90cadcab893", "score": "0.6879716", "text": "func (s *InvalidInputException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "382f3f64bbf974764b4b2357e0786881", "score": "0.68768096", "text": "func (s *WAFTagOperationInternalErrorException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a089fea6e9f8353c843ce486e59ca06f", "score": "0.6843253", "text": "func (o VolumeErrorOutput) Message() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v VolumeError) *string { return v.Message }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "107add5743a3ac47907c515fb9a84b52", "score": "0.6835758", "text": "func (ce CommonEdgeX) Message() string {\n\tif ce.message == \"\" && ce.err != nil {\n\t\tif w, ok := ce.err.(CommonEdgeX); ok {\n\t\t\treturn w.Message()\n\t\t} else {\n\t\t\treturn ce.err.Error()\n\t\t}\n\t}\n\n\treturn ce.message\n}", "title": "" }, { "docid": "9e7479c52c6cc523eaa08e7896cd9b42", "score": "0.68306917", "text": "func (e *Error) Error() string {\n\treturn e.Message\n}", "title": "" }, { "docid": "caea497c453fdcdebf3652774c12a2b9", "score": "0.6829337", "text": "func (e *pushError) Error() string {\n return fmt.Sprintf(\"\\nfatal: %s\", e.msg)\n}", "title": "" }, { "docid": "9ada51898c672e6b6b51e4e0b8ece46a", "score": "0.6827335", "text": "func GetMessage(err error) string {\n\tif err == nil {\n\t\treturn \"\"\n\t}\n\tcast, ok := err.(*Error)\n\tif !ok {\n\t\treturn err.Error()\n\t}\n\treturn cast.Message()\n}", "title": "" }, { "docid": "9d102a287cda38523b5b957efb3b0a92", "score": "0.679895", "text": "func (s *WAFServiceLinkedRoleErrorException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "6a00d901b8a748f3bcf7470800f1a3a7", "score": "0.67915237", "text": "func (s *TagsAlreadyExistException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "c79e6150fb5058965016ab6d18924ef9", "score": "0.6772931", "text": "func (ec ErrorCode) Message() string {\n\treturn ec.Descriptor().Message\n}", "title": "" }, { "docid": "65934d896931bcfd2441093dc1e3c366", "score": "0.67663544", "text": "func (e *myError) Error() string {\n\treturn fmt.Sprintf(\"Error %s\", e.errMsg)\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756629", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e087dfefb99d99c578e08dcb0256c202", "score": "0.6756336", "text": "func (s *ValidationException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "7e3d9f00cd1c35b4d28d0d26cebd4223", "score": "0.67098594", "text": "func (class ErrorClass) ToMessage() string {\n\tswitch class {\n\tcase RepositoryNotFound:\n\t\treturn \"The source repository does not exist, or you have insufficient permission to access it.\"\n\tcase AuthInvalidUserOrPass:\n\t\treturn \"Basic authentication has failed. Check your username or password. Note: GitHub requires a personal access token instead of your regular password.\"\n\tcase AuthPrompted:\n\t\treturn \"The source repository does not exist, or you have insufficient permission to access it.\"\n\tcase RevisionNotFound:\n\t\treturn \"The remote revision does not exist. Check your revision argument.\"\n\tcase AuthInvalidKey:\n\t\treturn \"The key is invalid for the specified target. Please make sure that the Git repository exists, you have sufficient permissions, and the key is in the right format.\"\n\tcase AuthUnexpectedSSH:\n\t\treturn \"Credential/URL inconsistency: SSH credentials provided, but URL is not a SSH Git URL.\"\n\tcase AuthExpectedSSH:\n\t\treturn \"Credential/URL inconsistency: No SSH credentials provided, but URL is a SSH Git URL.\"\n\tcase AuthBasicIncomplete:\n\t\treturn \"Basic Auth incomplete: Both username and password need to be configured.\"\n\tcase AuthUnexpectedHTTP:\n\t\treturn \"Refusing to continue with basic authentication (username and password) over insecure HTTP connection\"\n\t}\n\n\treturn \"Git encountered an unknown error.\"\n}", "title": "" }, { "docid": "5a93294f6c39e694a485fda05a3fa263", "score": "0.66890675", "text": "func (s ResourceNotFoundException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "5a93294f6c39e694a485fda05a3fa263", "score": "0.66890675", "text": "func (s ResourceNotFoundException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ab4e9dcd58dde57b2dc147c6f7d549ed", "score": "0.66750866", "text": "func (e ErrorMessage) String() string {\n\tvar message string\n\tif e.Error != nil {\n\t\tswitch e.Error.(type) {\n\t\tcase iodine.Error:\n\t\t\treason := iodine.ToError(e.Error).Error()\n\t\t\tmessage = reason\n\t\tdefault:\n\t\t\treason := e.Error.Error()\n\t\t\tmessage = reason\n\t\t}\n\t}\n\treturn message\n}", "title": "" }, { "docid": "a748e3970db997cb466137bbe75adb1b", "score": "0.6674067", "text": "func (b *BadMessage) String() string {\n\treturn fmt.Sprintf(\"m:%q e:%q\", b.msg, b.err)\n}", "title": "" }, { "docid": "4efba985b566667c0aeb3ef2a331d89f", "score": "0.6673892", "text": "func (s InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "cf942cb583ff7b7be66ef3d39c812a42", "score": "0.66693753", "text": "func (s LimitExceededException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a54a63bba2bd7605b106e5b7aa388c35", "score": "0.6663477", "text": "func (s *InternalServerException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "231b1a01ed082e2cb7257b1e34034bfd", "score": "0.66601974", "text": "func GetMsg(e error) string {\n\treturn e.Error()\n}", "title": "" }, { "docid": "40ce93f2a1d6f5b49e3b2405d7cff7bb", "score": "0.6651065", "text": "func (s *InvalidTagException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "21159b2305a834e17af76bf864aa92d4", "score": "0.6643655", "text": "func (s *ServiceFailureException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "5c205894ad7073b431fc4cf643822f23", "score": "0.6639084", "text": "func (s *ResourceNotFoundException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "5c205894ad7073b431fc4cf643822f23", "score": "0.6639084", "text": "func (s *ResourceNotFoundException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "5c205894ad7073b431fc4cf643822f23", "score": "0.6639084", "text": "func (s *ResourceNotFoundException) Message() string {\n\tif s.Message_ != nil {\n\t\treturn *s.Message_\n\t}\n\treturn \"\"\n}", "title": "" } ]
b1b40c08f1312cdabbd7b620d7091387
PossibleOrderByValues returns an array of possible values for the OrderBy const type.
[ { "docid": "3804fffe1e10f8169b9908ed2f8e3677", "score": "0.81277114", "text": "func PossibleOrderByValues() []OrderBy {\n\treturn []OrderBy{Newest, Oldest, Suggested}\n}", "title": "" } ]
[ { "docid": "b9fe02c1a8224251609e3571bd363833", "score": "0.7685913", "text": "func PossibleSortingOrderValues() []SortingOrder {\n\treturn []SortingOrder{ASC, DESC}\n}", "title": "" }, { "docid": "4513441a2b8d77f7bfdc89696e1c247b", "score": "0.76657516", "text": "func OrderBy_Values() []string {\n\treturn []string{\n\t\tOrderByAsc,\n\t\tOrderByDesc,\n\t}\n}", "title": "" }, { "docid": "703f6486b44383c9ef6883e7d1721df9", "score": "0.7340045", "text": "func (OrderBy) Values() []OrderBy {\n\treturn []OrderBy{\n\t\t\"ASC\",\n\t\t\"DESC\",\n\t}\n}", "title": "" }, { "docid": "e4b2c50bc134279a90c939fb91ba92f5", "score": "0.7277074", "text": "func (SortByOrder) Values() []SortByOrder {\n\treturn []SortByOrder{\n\t\t\"ASC\",\n\t\t\"DESC\",\n\t}\n}", "title": "" }, { "docid": "dccb19c27af84d5ef26f4dd8b1c220ce", "score": "0.7157654", "text": "func (SortOrder) Values() []SortOrder {\n\treturn []SortOrder{\n\t\t\"ASCENDING\",\n\t\t\"DESCENDING\",\n\t}\n}", "title": "" }, { "docid": "dccb19c27af84d5ef26f4dd8b1c220ce", "score": "0.7157654", "text": "func (SortOrder) Values() []SortOrder {\n\treturn []SortOrder{\n\t\t\"ASCENDING\",\n\t\t\"DESCENDING\",\n\t}\n}", "title": "" }, { "docid": "dccb19c27af84d5ef26f4dd8b1c220ce", "score": "0.7157654", "text": "func (SortOrder) Values() []SortOrder {\n\treturn []SortOrder{\n\t\t\"ASCENDING\",\n\t\t\"DESCENDING\",\n\t}\n}", "title": "" }, { "docid": "8792f1dccb49e9b4c1a75722689f86d4", "score": "0.7120175", "text": "func (OrderType) Values() []OrderType {\n\treturn []OrderType{\n\t\t\"ASCENDING\",\n\t\t\"DESCENDING\",\n\t}\n}", "title": "" }, { "docid": "8792f1dccb49e9b4c1a75722689f86d4", "score": "0.7120175", "text": "func (OrderType) Values() []OrderType {\n\treturn []OrderType{\n\t\t\"ASCENDING\",\n\t\t\"DESCENDING\",\n\t}\n}", "title": "" }, { "docid": "4617fbceb01a5846c43bc29b5e22eccc", "score": "0.7036416", "text": "func (SortOrder) Values() []SortOrder {\n\treturn []SortOrder{\n\t\t\"ASC\",\n\t\t\"DESC\",\n\t}\n}", "title": "" }, { "docid": "29f420b06d79c9a8379f5098f14a3ca5", "score": "0.6898151", "text": "func PossibleFacetSortOrderValues() []FacetSortOrder {\n\treturn []FacetSortOrder{Asc, Desc}\n}", "title": "" }, { "docid": "dfbdd7bc68c8a0af534bfbea578768ab", "score": "0.68699557", "text": "func (OrderByFieldType) Values() []OrderByFieldType {\n\treturn []OrderByFieldType{\n\t\t\"RELEVANCE\",\n\t\t\"NAME\",\n\t\t\"SIZE\",\n\t\t\"CREATED_TIMESTAMP\",\n\t\t\"MODIFIED_TIMESTAMP\",\n\t}\n}", "title": "" }, { "docid": "b6258bb009fd063538a298c511a8a7dc", "score": "0.68134564", "text": "func SortOrder_Values() []string {\n\treturn []string{\n\t\tSortOrderAscending,\n\t\tSortOrderDescending,\n\t}\n}", "title": "" }, { "docid": "b6258bb009fd063538a298c511a8a7dc", "score": "0.68134564", "text": "func SortOrder_Values() []string {\n\treturn []string{\n\t\tSortOrderAscending,\n\t\tSortOrderDescending,\n\t}\n}", "title": "" }, { "docid": "cc7fa7f5269e15c8a496b92073ed4f73", "score": "0.68121064", "text": "func SortOrder_Values() []string {\n\treturn []string{\n\t\tSortOrderAsc,\n\t\tSortOrderDesc,\n\t}\n}", "title": "" }, { "docid": "cc7fa7f5269e15c8a496b92073ed4f73", "score": "0.68121064", "text": "func SortOrder_Values() []string {\n\treturn []string{\n\t\tSortOrderAsc,\n\t\tSortOrderDesc,\n\t}\n}", "title": "" }, { "docid": "f09b2d258b7e396bcf5987449aff5fd2", "score": "0.67709374", "text": "func SortBy_Values() []string {\n\treturn []string{\n\t\tSortByCreatedAt,\n\t}\n}", "title": "" }, { "docid": "72ae10e7c10eabfab35a30fac01dea39", "score": "0.6742059", "text": "func (SortDirection) Values() []SortDirection {\n\treturn []SortDirection{\n\t\t\"ASC\",\n\t\t\"DESC\",\n\t}\n}", "title": "" }, { "docid": "be1459ac405d9880207c2980a8c9bfdf", "score": "0.6579605", "text": "func (SortKey) Values() []SortKey {\n\treturn []SortKey{\n\t\t\"DESCENDING\",\n\t\t\"ASCENDING\",\n\t}\n}", "title": "" }, { "docid": "ac4f042c2d6fc2611d00561d1cf97c75", "score": "0.64866465", "text": "func (UserSortType) Values() []UserSortType {\n\treturn []UserSortType{\n\t\t\"USER_NAME\",\n\t\t\"FULL_NAME\",\n\t\t\"STORAGE_LIMIT\",\n\t\t\"USER_STATUS\",\n\t\t\"STORAGE_USED\",\n\t}\n}", "title": "" }, { "docid": "ac4f042c2d6fc2611d00561d1cf97c75", "score": "0.64866465", "text": "func (UserSortType) Values() []UserSortType {\n\treturn []UserSortType{\n\t\t\"USER_NAME\",\n\t\t\"FULL_NAME\",\n\t\t\"STORAGE_LIMIT\",\n\t\t\"USER_STATUS\",\n\t\t\"STORAGE_USED\",\n\t}\n}", "title": "" }, { "docid": "fa3f31bf499765981556e82fce659b27", "score": "0.6421004", "text": "func FindingTypeSortBy_Values() []string {\n\treturn []string{\n\t\tFindingTypeSortByCritical,\n\t\tFindingTypeSortByHigh,\n\t\tFindingTypeSortByAll,\n\t}\n}", "title": "" }, { "docid": "f952f6ce84dc164fdb2334a598da3c72", "score": "0.6301737", "text": "func PossibleCompositePathSortOrderValues() []CompositePathSortOrder {\n\treturn []CompositePathSortOrder{\n\t\tCompositePathSortOrderAscending,\n\t\tCompositePathSortOrderDescending,\n\t}\n}", "title": "" }, { "docid": "989e6a1e44f9f2bd8884766dc7e43adc", "score": "0.62411904", "text": "func AccountSortBy_Values() []string {\n\treturn []string{\n\t\tAccountSortByCritical,\n\t\tAccountSortByHigh,\n\t\tAccountSortByAll,\n\t}\n}", "title": "" }, { "docid": "0c905a379f4d622ba869a9524651452a", "score": "0.62381995", "text": "func PackageSortBy_Values() []string {\n\treturn []string{\n\t\tPackageSortByCritical,\n\t\tPackageSortByHigh,\n\t\tPackageSortByAll,\n\t}\n}", "title": "" }, { "docid": "a0fb906c834f60a038d5ab639298d033", "score": "0.6065662", "text": "func PossibleOrderStateValues() []OrderState {\n\treturn []OrderState{\n\t\tOrderStateArriving,\n\t\tOrderStateAwaitingDrop,\n\t\tOrderStateAwaitingFulfillment,\n\t\tOrderStateAwaitingPickup,\n\t\tOrderStateAwaitingPreparation,\n\t\tOrderStateAwaitingReturnShipment,\n\t\tOrderStateAwaitingShipment,\n\t\tOrderStateCollectedAtMicrosoft,\n\t\tOrderStateDeclined,\n\t\tOrderStateDelivered,\n\t\tOrderStateLostDevice,\n\t\tOrderStatePickupCompleted,\n\t\tOrderStateReplacementRequested,\n\t\tOrderStateReturnInitiated,\n\t\tOrderStateShipped,\n\t\tOrderStateShippedBack,\n\t\tOrderStateUntracked,\n\t}\n}", "title": "" }, { "docid": "a4713675a49ac55872e2fe5848f673fc", "score": "0.6039593", "text": "func PossibleOperatorTypeValues() []OperatorType {\n\treturn []OperatorType{Contains, In}\n}", "title": "" }, { "docid": "35898561c2ed27b73f0a5e8a1bdbebb9", "score": "0.60238343", "text": "func RepositorySortBy_Values() []string {\n\treturn []string{\n\t\tRepositorySortByCritical,\n\t\tRepositorySortByHigh,\n\t\tRepositorySortByAll,\n\t\tRepositorySortByAffectedImages,\n\t}\n}", "title": "" }, { "docid": "23b41e818223a6945ed0ce0a321c0dd7", "score": "0.60058904", "text": "func TimeOrdering_Values() []string {\n\treturn []string{\n\t\tTimeOrderingAscending,\n\t\tTimeOrderingDescending,\n\t}\n}", "title": "" }, { "docid": "60192ecbf257238d21502fcef3a26ce9", "score": "0.6005569", "text": "func PossibleOperatorValues() []Operator {\n\treturn []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual, OperatorNotEquals}\n}", "title": "" }, { "docid": "d6301141c182b836ea9999c69a187e84", "score": "0.5996643", "text": "func (SortBy) Values() []SortBy {\n\treturn []SortBy{\n\t\t\"SCORE\",\n\t}\n}", "title": "" }, { "docid": "9cc7c7c8bc1f74c149afff875f7f54b6", "score": "0.5996021", "text": "func (ResourceSortType) Values() []ResourceSortType {\n\treturn []ResourceSortType{\n\t\t\"DATE\",\n\t\t\"NAME\",\n\t}\n}", "title": "" }, { "docid": "9cc7c7c8bc1f74c149afff875f7f54b6", "score": "0.5996021", "text": "func (ResourceSortType) Values() []ResourceSortType {\n\treturn []ResourceSortType{\n\t\t\"DATE\",\n\t\t\"NAME\",\n\t}\n}", "title": "" }, { "docid": "893bcfc0173e0b16ff06dff1bab2f784", "score": "0.59935087", "text": "func (ChronologicalOrder) Values() []ChronologicalOrder {\n\treturn []ChronologicalOrder{\n\t\t\"Reverse\",\n\t\t\"Forward\",\n\t}\n}", "title": "" }, { "docid": "5e40a00352397be7d3b6a76853d417ac", "score": "0.5970596", "text": "func PossibleUpgradeSortOrderValues() []UpgradeSortOrder {\n\treturn []UpgradeSortOrder{UpgradeSortOrderDefault, UpgradeSortOrderInvalid, UpgradeSortOrderLexicographical, UpgradeSortOrderNumeric, UpgradeSortOrderReverseLexicographical, UpgradeSortOrderReverseNumeric}\n}", "title": "" }, { "docid": "ad09905b92ce927a1d824874f8f8a8bf", "score": "0.59695673", "text": "func GetSortKamChartsByEnumValues() []SortKamChartsByEnum {\n\tvalues := make([]SortKamChartsByEnum, 0)\n\tfor _, v := range mappingSortKamChartsBy {\n\t\tvalues = append(values, v)\n\t}\n\treturn values\n}", "title": "" }, { "docid": "6a7834b6f03c5768a83ae667ad468328", "score": "0.59608114", "text": "func AmiSortBy_Values() []string {\n\treturn []string{\n\t\tAmiSortByCritical,\n\t\tAmiSortByHigh,\n\t\tAmiSortByAll,\n\t\tAmiSortByAffectedInstances,\n\t}\n}", "title": "" }, { "docid": "12496dd53d3e621b1bc92242880b41e9", "score": "0.59266055", "text": "func RuleOrder_Values() []string {\n\treturn []string{\n\t\tRuleOrderStrictOrder,\n\t\tRuleOrderDefaultActionOrder,\n\t}\n}", "title": "" }, { "docid": "f5c21b5b4df32b24ade3d05073e22208", "score": "0.59248906", "text": "func (StreamOrder) Values() []StreamOrder {\n\treturn []StreamOrder{\n\t\t\"ORIGINAL\",\n\t\t\"VIDEO_BITRATE_ASCENDING\",\n\t\t\"VIDEO_BITRATE_DESCENDING\",\n\t}\n}", "title": "" }, { "docid": "85c5f4f3de8df5f9c3d5fe63bf65a0d4", "score": "0.5918345", "text": "func (RuleOrder) Values() []RuleOrder {\n\treturn []RuleOrder{\n\t\t\"DEFAULT_ACTION_ORDER\",\n\t\t\"STRICT_ORDER\",\n\t}\n}", "title": "" }, { "docid": "617fec4cfadceaef88002d65ae3e9876", "score": "0.5870464", "text": "func (SnapshotAttributeToSortBy) Values() []SnapshotAttributeToSortBy {\n\treturn []SnapshotAttributeToSortBy{\n\t\t\"SOURCE_TYPE\",\n\t\t\"TOTAL_SIZE\",\n\t\t\"CREATE_TIME\",\n\t}\n}", "title": "" }, { "docid": "dbdc4bcfb3ff476fcd6ed3cef5e0e2ef", "score": "0.586747", "text": "func PossibleFilterOperatorTypeValues() []FilterOperatorType {\n return []FilterOperatorType{And,Between,BitwiseAnd,BitwiseOr,Cast,Equals,GreaterThan,GreaterThanOrEqual,InList,InView,IsNull,LessThan,LessThanOrEqual,Like,Not,OfType,Or,RelatedTo}\n }", "title": "" }, { "docid": "2d3945c8971a4b76439da4a5bd60cc06", "score": "0.5849052", "text": "func SortField_Values() []string {\n\treturn []string{\n\t\tSortFieldAwsAccountId,\n\t\tSortFieldFindingType,\n\t\tSortFieldSeverity,\n\t\tSortFieldFirstObservedAt,\n\t\tSortFieldLastObservedAt,\n\t\tSortFieldFindingStatus,\n\t\tSortFieldResourceType,\n\t\tSortFieldEcrImagePushedAt,\n\t\tSortFieldEcrImageRepositoryName,\n\t\tSortFieldEcrImageRegistry,\n\t\tSortFieldNetworkProtocol,\n\t\tSortFieldComponentType,\n\t\tSortFieldVulnerabilityId,\n\t\tSortFieldVulnerabilitySource,\n\t\tSortFieldInspectorScore,\n\t\tSortFieldVendorSeverity,\n\t\tSortFieldEpssScore,\n\t}\n}", "title": "" }, { "docid": "a5a90fea61279bb06d665e4c9a16ab91", "score": "0.58319634", "text": "func PossibleDirectionValues() []Direction {\n\treturn []Direction{Ascending, Descending}\n}", "title": "" }, { "docid": "25d328a2948edc2830f2846651e70992", "score": "0.58105385", "text": "func (OperatorType) Values() []OperatorType {\n\treturn []OperatorType{\n\t\t\"eq\",\n\t\t\"lt\",\n\t\t\"gt\",\n\t\t\"le\",\n\t\t\"ge\",\n\t\t\"in\",\n\t\t\"between\",\n\t}\n}", "title": "" }, { "docid": "db405ca44d15da1f90ef3b8dad830cf6", "score": "0.5792733", "text": "func (ComparisonOperator) Values() []ComparisonOperator {\n\treturn []ComparisonOperator{\n\t\t\"EQ\",\n\t\t\"GT\",\n\t\t\"GE\",\n\t\t\"LT\",\n\t\t\"LE\",\n\t}\n}", "title": "" }, { "docid": "41bbdaf6fc14dfcfc0539a4599ee12fa", "score": "0.5783725", "text": "func UsageStatisticsFilterComparator_Values() []string {\n\treturn []string{\n\t\tUsageStatisticsFilterComparatorGt,\n\t\tUsageStatisticsFilterComparatorGte,\n\t\tUsageStatisticsFilterComparatorLt,\n\t\tUsageStatisticsFilterComparatorLte,\n\t\tUsageStatisticsFilterComparatorEq,\n\t\tUsageStatisticsFilterComparatorNe,\n\t\tUsageStatisticsFilterComparatorContains,\n\t}\n}", "title": "" }, { "docid": "040a89bae771a9be3b3598890b7d87da", "score": "0.5772221", "text": "func (InitiatedBy) Values() []InitiatedBy {\n\treturn []InitiatedBy{\n\t\t\"START_TEST\",\n\t\t\"START_CUTOVER\",\n\t\t\"DIAGNOSTIC\",\n\t\t\"TERMINATE\",\n\t}\n}", "title": "" }, { "docid": "87d1dc626e6ceb4e8295d111f5976102", "score": "0.5767184", "text": "func UsageStatisticsSortKey_Values() []string {\n\treturn []string{\n\t\tUsageStatisticsSortKeyAccountId,\n\t\tUsageStatisticsSortKeyTotal,\n\t\tUsageStatisticsSortKeyServiceLimitValue,\n\t\tUsageStatisticsSortKeyFreeTrialStartDate,\n\t}\n}", "title": "" }, { "docid": "7aadb3700e4728c62b398122e71a5ec8", "score": "0.5760333", "text": "func PossibleOsTypeValues() []OsType {\n\treturn []OsType{\n\t\tOsTypeWindows,\n\t\tOsTypeLinux,\n\t}\n}", "title": "" }, { "docid": "60aa3fb9e02c3d2bd0771ad14539f8be", "score": "0.5748925", "text": "func PossibleComparisonOperationTypeValues() []ComparisonOperationType {\n\treturn []ComparisonOperationType{ComparisonOperationTypeEquals, ComparisonOperationTypeGreaterThan, ComparisonOperationTypeGreaterThanOrEqual, ComparisonOperationTypeLessThan, ComparisonOperationTypeLessThanOrEqual, ComparisonOperationTypeNotEquals}\n}", "title": "" }, { "docid": "8fa026e094c6d04a07531db92c00430a", "score": "0.57447785", "text": "func PossibleConditionOperatorValues() []ConditionOperator {\n\treturn []ConditionOperator{ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual}\n}", "title": "" }, { "docid": "8fa026e094c6d04a07531db92c00430a", "score": "0.57447785", "text": "func PossibleConditionOperatorValues() []ConditionOperator {\n\treturn []ConditionOperator{ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual}\n}", "title": "" }, { "docid": "77240b21801b7fd12435e9fa002ff23a", "score": "0.57336867", "text": "func LambdaFunctionSortBy_Values() []string {\n\treturn []string{\n\t\tLambdaFunctionSortByCritical,\n\t\tLambdaFunctionSortByHigh,\n\t\tLambdaFunctionSortByAll,\n\t}\n}", "title": "" }, { "docid": "4b3649583ea64d8826e53098b89f8164", "score": "0.571275", "text": "func PackageVersionSortType_Values() []string {\n\treturn []string{\n\t\tPackageVersionSortTypePublishedTime,\n\t}\n}", "title": "" }, { "docid": "cffc4e45530d8c66e345abb11a7352a7", "score": "0.5685163", "text": "func LambdaLayerSortBy_Values() []string {\n\treturn []string{\n\t\tLambdaLayerSortByCritical,\n\t\tLambdaLayerSortByHigh,\n\t\tLambdaLayerSortByAll,\n\t}\n}", "title": "" }, { "docid": "a252c1b0219e498c30273dfbd3406855", "score": "0.5680691", "text": "func (AutocommitPeriodType) Values() []AutocommitPeriodType {\n\treturn []AutocommitPeriodType{\n\t\t\"MINUTES\",\n\t\t\"HOURS\",\n\t\t\"DAYS\",\n\t\t\"MONTHS\",\n\t\t\"YEARS\",\n\t\t\"NONE\",\n\t}\n}", "title": "" }, { "docid": "b1c58c4b94b3e3fea4f168c3e68183aa", "score": "0.5666791", "text": "func PossibleOperatorTypeValues() []OperatorType {\n\treturn []OperatorType{\n\t\tOperatorTypeFlux,\n\t}\n}", "title": "" }, { "docid": "e02888e6951f6080f8465c4807507ac5", "score": "0.5658338", "text": "func (CoverageSortKey) Values() []CoverageSortKey {\n\treturn []CoverageSortKey{\n\t\t\"ACCOUNT_ID\",\n\t\t\"CLUSTER_NAME\",\n\t\t\"COVERAGE_STATUS\",\n\t\t\"ISSUE\",\n\t\t\"ADDON_VERSION\",\n\t\t\"UPDATED_AT\",\n\t}\n}", "title": "" }, { "docid": "46ee96e42d3e1c808df92758828e4357", "score": "0.5646768", "text": "func PossibleOsTypeValues() []OsType {\n\treturn []OsType{OsTypeLinux, OsTypeWindows}\n}", "title": "" }, { "docid": "556f16a0f31379908729a2d847981403", "score": "0.5633982", "text": "func (ComparisonOperator) Values() []ComparisonOperator {\n\treturn []ComparisonOperator{\n\t\t\"GreaterThanOrEqualToThreshold\",\n\t\t\"GreaterThanThreshold\",\n\t\t\"LessThanThreshold\",\n\t\t\"LessThanOrEqualToThreshold\",\n\t}\n}", "title": "" }, { "docid": "46f63e5b51259c209ddfbf00369b571a", "score": "0.5616572", "text": "func PossibleOperatorTypeValues() []OperatorType {\n\treturn []OperatorType{Flux}\n}", "title": "" }, { "docid": "8f2eaf3329376dfec16827cdfb18e12d", "score": "0.558483", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser}\n}", "title": "" }, { "docid": "8f2eaf3329376dfec16827cdfb18e12d", "score": "0.558483", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser}\n}", "title": "" }, { "docid": "8f2eaf3329376dfec16827cdfb18e12d", "score": "0.558483", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser}\n}", "title": "" }, { "docid": "8f2eaf3329376dfec16827cdfb18e12d", "score": "0.558483", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser}\n}", "title": "" }, { "docid": "8f2eaf3329376dfec16827cdfb18e12d", "score": "0.558483", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser}\n}", "title": "" }, { "docid": "20e82a8a3f4635f41f6138ab5e30f3b7", "score": "0.5583603", "text": "func PossibleSmartGroupsSortByFieldsValues() []SmartGroupsSortByFields {\n\treturn []SmartGroupsSortByFields{SmartGroupsSortByFieldsAlertsCount, SmartGroupsSortByFieldsLastModifiedDateTime, SmartGroupsSortByFieldsSeverity, SmartGroupsSortByFieldsStartDateTime, SmartGroupsSortByFieldsState}\n}", "title": "" }, { "docid": "8b2e754e8493f696ca9cddefe46173b8", "score": "0.5563481", "text": "func PossibleOperatingSystemTypeValues() []OperatingSystemType {\n\treturn []OperatingSystemType{Linux, Windows}\n}", "title": "" }, { "docid": "fca3bf4ea51861979bba04d5f83ebd9a", "score": "0.5551977", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{\n\t\tCreatedByTypeApplication,\n\t\tCreatedByTypeKey,\n\t\tCreatedByTypeManagedIdentity,\n\t\tCreatedByTypeUser,\n\t}\n}", "title": "" }, { "docid": "fca3bf4ea51861979bba04d5f83ebd9a", "score": "0.5551977", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{\n\t\tCreatedByTypeApplication,\n\t\tCreatedByTypeKey,\n\t\tCreatedByTypeManagedIdentity,\n\t\tCreatedByTypeUser,\n\t}\n}", "title": "" }, { "docid": "fca3bf4ea51861979bba04d5f83ebd9a", "score": "0.5551977", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{\n\t\tCreatedByTypeApplication,\n\t\tCreatedByTypeKey,\n\t\tCreatedByTypeManagedIdentity,\n\t\tCreatedByTypeUser,\n\t}\n}", "title": "" }, { "docid": "fca3bf4ea51861979bba04d5f83ebd9a", "score": "0.5551977", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{\n\t\tCreatedByTypeApplication,\n\t\tCreatedByTypeKey,\n\t\tCreatedByTypeManagedIdentity,\n\t\tCreatedByTypeUser,\n\t}\n}", "title": "" }, { "docid": "fca3bf4ea51861979bba04d5f83ebd9a", "score": "0.5551977", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{\n\t\tCreatedByTypeApplication,\n\t\tCreatedByTypeKey,\n\t\tCreatedByTypeManagedIdentity,\n\t\tCreatedByTypeUser,\n\t}\n}", "title": "" }, { "docid": "fca3bf4ea51861979bba04d5f83ebd9a", "score": "0.5551977", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{\n\t\tCreatedByTypeApplication,\n\t\tCreatedByTypeKey,\n\t\tCreatedByTypeManagedIdentity,\n\t\tCreatedByTypeUser,\n\t}\n}", "title": "" }, { "docid": "fca3bf4ea51861979bba04d5f83ebd9a", "score": "0.5551977", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{\n\t\tCreatedByTypeApplication,\n\t\tCreatedByTypeKey,\n\t\tCreatedByTypeManagedIdentity,\n\t\tCreatedByTypeUser,\n\t}\n}", "title": "" }, { "docid": "fca3bf4ea51861979bba04d5f83ebd9a", "score": "0.5551977", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{\n\t\tCreatedByTypeApplication,\n\t\tCreatedByTypeKey,\n\t\tCreatedByTypeManagedIdentity,\n\t\tCreatedByTypeUser,\n\t}\n}", "title": "" }, { "docid": "fca3bf4ea51861979bba04d5f83ebd9a", "score": "0.5551977", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{\n\t\tCreatedByTypeApplication,\n\t\tCreatedByTypeKey,\n\t\tCreatedByTypeManagedIdentity,\n\t\tCreatedByTypeUser,\n\t}\n}", "title": "" }, { "docid": "fca3bf4ea51861979bba04d5f83ebd9a", "score": "0.5551977", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{\n\t\tCreatedByTypeApplication,\n\t\tCreatedByTypeKey,\n\t\tCreatedByTypeManagedIdentity,\n\t\tCreatedByTypeUser,\n\t}\n}", "title": "" }, { "docid": "fca3bf4ea51861979bba04d5f83ebd9a", "score": "0.5551977", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{\n\t\tCreatedByTypeApplication,\n\t\tCreatedByTypeKey,\n\t\tCreatedByTypeManagedIdentity,\n\t\tCreatedByTypeUser,\n\t}\n}", "title": "" }, { "docid": "fca3bf4ea51861979bba04d5f83ebd9a", "score": "0.5551977", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{\n\t\tCreatedByTypeApplication,\n\t\tCreatedByTypeKey,\n\t\tCreatedByTypeManagedIdentity,\n\t\tCreatedByTypeUser,\n\t}\n}", "title": "" }, { "docid": "fca3bf4ea51861979bba04d5f83ebd9a", "score": "0.5551977", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{\n\t\tCreatedByTypeApplication,\n\t\tCreatedByTypeKey,\n\t\tCreatedByTypeManagedIdentity,\n\t\tCreatedByTypeUser,\n\t}\n}", "title": "" }, { "docid": "3869efa2fc78ce8d2f4f9a70e3853581", "score": "0.5550612", "text": "func PossibleAlertsSortByFieldsValues() []AlertsSortByFields {\n\treturn []AlertsSortByFields{AlertsSortByFieldsAlertState, AlertsSortByFieldsLastModifiedDateTime, AlertsSortByFieldsMonitorCondition, AlertsSortByFieldsName, AlertsSortByFieldsSeverity, AlertsSortByFieldsStartDateTime, AlertsSortByFieldsTargetResource, AlertsSortByFieldsTargetResourceGroup, AlertsSortByFieldsTargetResourceName, AlertsSortByFieldsTargetResourceType}\n}", "title": "" }, { "docid": "7cf1b0568ee7e7ec8b6aa9cc2dde4e0a", "score": "0.554954", "text": "func PossibleOsStateValues() []OsState {\n\treturn []OsState{\n\t\tOsStateGeneralized,\n\t\tOsStateSpecialized,\n\t}\n}", "title": "" }, { "docid": "8bd221f9a2c61bc724b0238f741fde9a", "score": "0.5541007", "text": "func PossibleFooEnumValues() []FooEnum {\n\treturn []FooEnum{\n\t\tFooEnumFoo1,\n\t\tFooEnumFoo2,\n\t\tFooEnumFoo3,\n\t}\n}", "title": "" }, { "docid": "12ea0e59d557981d1b339feed08082ef", "score": "0.55400014", "text": "func (PermissionType) Values() []PermissionType {\n\treturn []PermissionType{\n\t\t\"FULL_ACCESS\",\n\t\t\"SEND_AS\",\n\t\t\"SEND_ON_BEHALF\",\n\t}\n}", "title": "" }, { "docid": "af603fd5f59195de21d7a39f73c17af2", "score": "0.5531183", "text": "func PossibleCertificateOrderActionTypeValues() []CertificateOrderActionType {\n\treturn []CertificateOrderActionType{CertificateIssued, CertificateOrderCanceled, CertificateOrderCreated, CertificateRevoked, DomainValidationComplete, FraudDetected, OrgNameChange, OrgValidationComplete, SanDrop}\n}", "title": "" }, { "docid": "f6ebbb7ed33cdbd5ee4f5c29e4ae5884", "score": "0.5529004", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{Application, Key, ManagedIdentity, User}\n}", "title": "" }, { "docid": "f6ebbb7ed33cdbd5ee4f5c29e4ae5884", "score": "0.5529004", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{Application, Key, ManagedIdentity, User}\n}", "title": "" }, { "docid": "f6ebbb7ed33cdbd5ee4f5c29e4ae5884", "score": "0.5529004", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{Application, Key, ManagedIdentity, User}\n}", "title": "" }, { "docid": "f6ebbb7ed33cdbd5ee4f5c29e4ae5884", "score": "0.5529004", "text": "func PossibleCreatedByTypeValues() []CreatedByType {\n\treturn []CreatedByType{Application, Key, ManagedIdentity, User}\n}", "title": "" }, { "docid": "d2d52b480c10ee781fdb510daeec3b3f", "score": "0.5524474", "text": "func ComparisonOperator_Values() []string {\n\treturn []string{\n\t\tComparisonOperatorBeginsWith,\n\t}\n}", "title": "" }, { "docid": "fd34b7dd5b192908060c67e2ee3f5552", "score": "0.5523775", "text": "func JobComparator_Values() []string {\n\treturn []string{\n\t\tJobComparatorEq,\n\t\tJobComparatorGt,\n\t\tJobComparatorGte,\n\t\tJobComparatorLt,\n\t\tJobComparatorLte,\n\t\tJobComparatorNe,\n\t\tJobComparatorContains,\n\t\tJobComparatorStartsWith,\n\t}\n}", "title": "" }, { "docid": "10dae2c760ca8fc5734691907396005c", "score": "0.5523193", "text": "func PossibleOsStateValues() []OsState {\n\treturn []OsState{OsStateGeneralized, OsStateSpecialized}\n}", "title": "" }, { "docid": "ab08e8d6e251ed8ef0804faffb2458e7", "score": "0.5523175", "text": "func PossibleAdvancedFilterOperatorTypeValues() []AdvancedFilterOperatorType {\n\treturn []AdvancedFilterOperatorType{\n\t\tAdvancedFilterOperatorTypeBoolEquals,\n\t\tAdvancedFilterOperatorTypeIsNotNull,\n\t\tAdvancedFilterOperatorTypeIsNullOrUndefined,\n\t\tAdvancedFilterOperatorTypeNumberGreaterThan,\n\t\tAdvancedFilterOperatorTypeNumberGreaterThanOrEquals,\n\t\tAdvancedFilterOperatorTypeNumberIn,\n\t\tAdvancedFilterOperatorTypeNumberInRange,\n\t\tAdvancedFilterOperatorTypeNumberLessThan,\n\t\tAdvancedFilterOperatorTypeNumberLessThanOrEquals,\n\t\tAdvancedFilterOperatorTypeNumberNotIn,\n\t\tAdvancedFilterOperatorTypeNumberNotInRange,\n\t\tAdvancedFilterOperatorTypeStringBeginsWith,\n\t\tAdvancedFilterOperatorTypeStringContains,\n\t\tAdvancedFilterOperatorTypeStringEndsWith,\n\t\tAdvancedFilterOperatorTypeStringIn,\n\t\tAdvancedFilterOperatorTypeStringNotBeginsWith,\n\t\tAdvancedFilterOperatorTypeStringNotContains,\n\t\tAdvancedFilterOperatorTypeStringNotEndsWith,\n\t\tAdvancedFilterOperatorTypeStringNotIn,\n\t}\n}", "title": "" }, { "docid": "fbf77a441f1f902747d5748fe933d786", "score": "0.55228955", "text": "func PossibleDynamicThresholdOperatorValues() []DynamicThresholdOperator {\n\treturn []DynamicThresholdOperator{DynamicThresholdOperatorGreaterOrLessThan, DynamicThresholdOperatorGreaterThan, DynamicThresholdOperatorLessThan}\n}", "title": "" }, { "docid": "3a8bc23fcb22d337fc02be5220f45a9a", "score": "0.5517323", "text": "func (AutoImportPolicyType) Values() []AutoImportPolicyType {\n\treturn []AutoImportPolicyType{\n\t\t\"NONE\",\n\t\t\"NEW\",\n\t\t\"NEW_CHANGED\",\n\t\t\"NEW_CHANGED_DELETED\",\n\t}\n}", "title": "" }, { "docid": "851515682946c1753302a356fbda5c2d", "score": "0.5510871", "text": "func (AuthType) Values() []AuthType {\n\treturn []AuthType{\n\t\t\"NONE\",\n\t\t\"AWS_IAM\",\n\t}\n}", "title": "" }, { "docid": "3ef07afc6712306e5742a47802e4fb69", "score": "0.5506047", "text": "func (OfferingType) Values() []OfferingType {\n\treturn []OfferingType{\n\t\t\"RECURRING\",\n\t}\n}", "title": "" }, { "docid": "82005688a775c2789367dd24e909438a", "score": "0.550339", "text": "func (LocaleType) Values() []LocaleType {\n\treturn []LocaleType{\n\t\t\"en\",\n\t\t\"fr\",\n\t\t\"ko\",\n\t\t\"de\",\n\t\t\"es\",\n\t\t\"ja\",\n\t\t\"ru\",\n\t\t\"zh_CN\",\n\t\t\"zh_TW\",\n\t\t\"pt_BR\",\n\t\t\"default\",\n\t}\n}", "title": "" } ]
abf4cf1eba117ad49eb23ff472fb2eb3
augmented methods on protoc/std generated struct
[ { "docid": "926fd74cc13d85f93c5cab2156b8a1c7", "score": "0.0", "text": "func (m *EnumInfo) ToJSON() (string, error) {\n\treturn codec.ToJSON(m)\n}", "title": "" } ]
[ { "docid": "dee30664c11a22fe879cf0892fb6d3b1", "score": "0.611371", "text": "func protoBufMessageDef(att *expr.AttributeExpr, sd *ServiceData) string {\n\tswitch actual := att.Type.(type) {\n\tcase expr.Primitive:\n\t\treturn protoNativeType(att.Type)\n\tcase *expr.Array:\n\t\treturn \"repeated \" + protoType(actual.ElemType, sd)\n\tcase *expr.Map:\n\t\treturn fmt.Sprintf(\"map<%s, %s>\", protoType(actual.KeyType, sd), protoType(actual.ElemType, sd))\n\tcase *expr.Union:\n\t\tdef := \"\\toneof \" + codegen.SnakeCase(protoBufify(actual.Name(), false, false)) + \" {\"\n\t\tfor _, nat := range actual.Values {\n\t\t\tfn := codegen.SnakeCase(protoBufify(nat.Name, false, false))\n\t\t\tfnum := rpcTag(nat.Attribute)\n\t\t\tvar typ string\n\t\t\tif prim := getPrimitive(nat.Attribute); prim != nil {\n\t\t\t\ttyp = protoType(prim, sd)\n\t\t\t} else {\n\t\t\t\ttyp = protoType(nat.Attribute, sd)\n\t\t\t}\n\t\t\tvar desc string\n\t\t\tif d := nat.Attribute.Description; d != \"\" {\n\t\t\t\tdesc = codegen.Comment(d) + \"\\n\\t\"\n\t\t\t}\n\t\t\tdef += fmt.Sprintf(\"\\n\\t\\t%s%s %s = %d;\", desc, typ, fn, fnum)\n\t\t}\n\t\tdef += \"\\n\\t}\"\n\t\treturn def\n\tcase expr.UserType:\n\t\tif actual == expr.Empty {\n\t\t\treturn \" {}\"\n\t\t}\n\t\tif prim := getPrimitive(att); prim != nil {\n\t\t\treturn protoBufMessageDef(prim, sd)\n\t\t}\n\t\treturn protoBufMessageName(att, sd.Scope)\n\tcase *expr.Object:\n\t\tvar ss []string\n\t\tss = append(ss, \" {\")\n\t\tfor _, nat := range *actual {\n\t\t\tif expr.IsUnion(nat.Attribute.Type) {\n\t\t\t\tss = append(ss, protoBufMessageDef(nat.Attribute, sd))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvar (\n\t\t\t\tfn string\n\t\t\t\tfnum uint64\n\t\t\t\ttyp string\n\t\t\t\topt string\n\t\t\t\tdesc string\n\t\t\t)\n\t\t\t{\n\t\t\t\tfn = codegen.SnakeCase(protoBufify(nat.Name, false, false))\n\t\t\t\tfnum = rpcTag(nat.Attribute)\n\t\t\t\tif prim := getPrimitive(nat.Attribute); prim != nil {\n\t\t\t\t\ttyp = protoType(prim, sd)\n\t\t\t\t} else {\n\t\t\t\t\ttyp = protoType(nat.Attribute, sd)\n\t\t\t\t}\n\t\t\t\tif !att.IsRequired(nat.Name) && expr.IsPrimitive(nat.Attribute.Type) {\n\t\t\t\t\topt = \"optional \"\n\t\t\t\t}\n\t\t\t\tif nat.Attribute.Description != \"\" {\n\t\t\t\t\tdesc = codegen.Comment(nat.Attribute.Description) + \"\\n\\t\"\n\t\t\t\t}\n\t\t\t}\n\t\t\tss = append(ss, fmt.Sprintf(\"\\t%s%s%s %s = %d;\", desc, opt, typ, fn, fnum))\n\t\t}\n\t\tss = append(ss, \"}\")\n\t\treturn strings.Join(ss, \"\\n\")\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unknown data type %T\", actual)) // bug\n\t}\n}", "title": "" }, { "docid": "969069f01b048ee62533c9b666fd81af", "score": "0.57069874", "text": "func makeProtoBufMessageR(att *expr.AttributeExpr, tname *string, sd *ServiceData, seen map[string]struct{}) {\n\tut, isut := att.Type.(expr.UserType)\n\n\t// handle infinite recursions\n\tif isut {\n\t\tif _, ok := seen[ut.ID()]; ok {\n\t\t\treturn\n\t\t}\n\t\tseen[ut.ID()] = struct{}{}\n\t}\n\n\twrap := func(att *expr.AttributeExpr, tname string) {\n\t\tswitch {\n\t\tcase expr.IsArray(att.Type):\n\t\t\twrapAttr(att, \"ArrayOf\"+tname+\n\t\t\t\tprotoBufify(protoBufMessageDef(expr.AsArray(att.Type).ElemType, sd), true, true), true, sd)\n\t\tcase expr.IsMap(att.Type):\n\t\t\tm := expr.AsMap(att.Type)\n\t\t\twrapAttr(att, tname+\"MapOf\"+\n\t\t\t\tprotoBufify(protoBufMessageDef(m.KeyType, sd), true, true)+\n\t\t\t\tprotoBufify(protoBufMessageDef(m.ElemType, sd), true, true), true, sd)\n\t\t}\n\t}\n\n\tswitch {\n\tcase expr.IsPrimitive(att.Type):\n\t\treturn\n\tcase isut:\n\t\tif expr.IsArray(ut) {\n\t\t\twrapAttr(ut.Attribute(), ut.Name(), false, sd)\n\t\t}\n\t\tmakeProtoBufMessageR(ut.Attribute(), tname, sd, seen)\n\tcase expr.IsArray(att.Type):\n\t\tar := expr.AsArray(att.Type)\n\t\tmakeProtoBufMessageR(ar.ElemType, tname, sd, seen)\n\t\twrap(ar.ElemType, *tname)\n\tcase expr.IsMap(att.Type):\n\t\tm := expr.AsMap(att.Type)\n\t\tmakeProtoBufMessageR(m.ElemType, tname, sd, seen)\n\t\twrap(m.ElemType, *tname)\n\tcase expr.IsUnion(att.Type):\n\t\tfor _, nat := range expr.AsUnion(att.Type).Values {\n\t\t\tmakeProtoBufMessageR(nat.Attribute, tname, sd, seen)\n\t\t}\n\tcase expr.IsObject(att.Type):\n\t\tfor _, nat := range *(expr.AsObject(att.Type)) {\n\t\t\tmakeProtoBufMessageR(nat.Attribute, tname, sd, seen)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "529ca720c6fee86cd6e444732538a2c1", "score": "0.56382287", "text": "func (m *Message) ProtoMessage() {\n}", "title": "" }, { "docid": "961fa3efbc58e8fb9ce8a5a553906f37", "score": "0.56123793", "text": "func (*Struct) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "84c75f58a4d468497590fda4461bcf02", "score": "0.5580664", "text": "func (*ChaincodeData) ProtoMessage() {}", "title": "" }, { "docid": "3c5753325ec113134f6d8e4d068975a1", "score": "0.5528134", "text": "func init() {\n\t// TODO: This should be eventually deleted once the v1 repository is fully\n\t// switched over to wrap the v2 repository.\n\trawDesc, _ := (*descriptorpb.DescriptorProto)(nil).Descriptor()\n\tRegisterFile(\"google/protobuf/descriptor.proto\", rawDesc)\n\tRegisterEnum(\"google.protobuf.FieldDescriptorProto_Type\", descriptorpb.FieldDescriptorProto_Type_name, descriptorpb.FieldDescriptorProto_Type_value)\n\tRegisterEnum(\"google.protobuf.FieldDescriptorProto_Label\", descriptorpb.FieldDescriptorProto_Label_name, descriptorpb.FieldDescriptorProto_Label_value)\n\tRegisterEnum(\"google.protobuf.FileOptions_OptimizeMode\", descriptorpb.FileOptions_OptimizeMode_name, descriptorpb.FileOptions_OptimizeMode_value)\n\tRegisterEnum(\"google.protobuf.FieldOptions_CType\", descriptorpb.FieldOptions_CType_name, descriptorpb.FieldOptions_CType_value)\n\tRegisterEnum(\"google.protobuf.FieldOptions_JSType\", descriptorpb.FieldOptions_JSType_name, descriptorpb.FieldOptions_JSType_value)\n\tRegisterEnum(\"google.protobuf.MethodOptions_IdempotencyLevel\", descriptorpb.MethodOptions_IdempotencyLevel_name, descriptorpb.MethodOptions_IdempotencyLevel_value)\n\tRegisterType((*descriptorpb.FileDescriptorSet)(nil), \"google.protobuf.FileDescriptorSet\")\n\tRegisterType((*descriptorpb.FileDescriptorProto)(nil), \"google.protobuf.FileDescriptorProto\")\n\tRegisterType((*descriptorpb.DescriptorProto)(nil), \"google.protobuf.DescriptorProto\")\n\tRegisterType((*descriptorpb.ExtensionRangeOptions)(nil), \"google.protobuf.ExtensionRangeOptions\")\n\tRegisterType((*descriptorpb.FieldDescriptorProto)(nil), \"google.protobuf.FieldDescriptorProto\")\n\tRegisterType((*descriptorpb.OneofDescriptorProto)(nil), \"google.protobuf.OneofDescriptorProto\")\n\tRegisterType((*descriptorpb.EnumDescriptorProto)(nil), \"google.protobuf.EnumDescriptorProto\")\n\tRegisterType((*descriptorpb.EnumValueDescriptorProto)(nil), \"google.protobuf.EnumValueDescriptorProto\")\n\tRegisterType((*descriptorpb.ServiceDescriptorProto)(nil), \"google.protobuf.ServiceDescriptorProto\")\n\tRegisterType((*descriptorpb.MethodDescriptorProto)(nil), \"google.protobuf.MethodDescriptorProto\")\n\tRegisterType((*descriptorpb.FileOptions)(nil), \"google.protobuf.FileOptions\")\n\tRegisterType((*descriptorpb.MessageOptions)(nil), \"google.protobuf.MessageOptions\")\n\tRegisterType((*descriptorpb.FieldOptions)(nil), \"google.protobuf.FieldOptions\")\n\tRegisterType((*descriptorpb.OneofOptions)(nil), \"google.protobuf.OneofOptions\")\n\tRegisterType((*descriptorpb.EnumOptions)(nil), \"google.protobuf.EnumOptions\")\n\tRegisterType((*descriptorpb.EnumValueOptions)(nil), \"google.protobuf.EnumValueOptions\")\n\tRegisterType((*descriptorpb.ServiceOptions)(nil), \"google.protobuf.ServiceOptions\")\n\tRegisterType((*descriptorpb.MethodOptions)(nil), \"google.protobuf.MethodOptions\")\n\tRegisterType((*descriptorpb.UninterpretedOption)(nil), \"google.protobuf.UninterpretedOption\")\n\tRegisterType((*descriptorpb.SourceCodeInfo)(nil), \"google.protobuf.SourceCodeInfo\")\n\tRegisterType((*descriptorpb.GeneratedCodeInfo)(nil), \"google.protobuf.GeneratedCodeInfo\")\n\tRegisterType((*descriptorpb.DescriptorProto_ExtensionRange)(nil), \"google.protobuf.DescriptorProto.ExtensionRange\")\n\tRegisterType((*descriptorpb.DescriptorProto_ReservedRange)(nil), \"google.protobuf.DescriptorProto.ReservedRange\")\n\tRegisterType((*descriptorpb.EnumDescriptorProto_EnumReservedRange)(nil), \"google.protobuf.EnumDescriptorProto.EnumReservedRange\")\n\tRegisterType((*descriptorpb.UninterpretedOption_NamePart)(nil), \"google.protobuf.UninterpretedOption.NamePart\")\n\tRegisterType((*descriptorpb.SourceCodeInfo_Location)(nil), \"google.protobuf.SourceCodeInfo.Location\")\n\tRegisterType((*descriptorpb.GeneratedCodeInfo_Annotation)(nil), \"google.protobuf.GeneratedCodeInfo.Annotation\")\n\n\t// any.proto\n\tRegisterType((*anypb.Any)(nil), \"google.protobuf.Any\")\n\n\t// api.proto\n\tRegisterType((*apipb.Api)(nil), \"google.protobuf.Api\")\n\tRegisterType((*apipb.Method)(nil), \"google.protobuf.Method\")\n\tRegisterType((*apipb.Mixin)(nil), \"google.protobuf.Mixin\")\n\n\t// duration.proto\n\tRegisterType((*durationpb.Duration)(nil), \"google.protobuf.Duration\")\n\n\t// empty.proto\n\tRegisterType((*emptypb.Empty)(nil), \"google.protobuf.Empty\")\n\n\t// field_mask.proto\n\tRegisterType((*fieldmaskpb.FieldMask)(nil), \"google.protobuf.FieldMask\")\n\n\t// source_context.proto\n\tRegisterType((*sourcecontextpb.SourceContext)(nil), \"google.protobuf.SourceContext\")\n\n\t// struct.proto\n\tRegisterEnum(\"google.protobuf.NullValue\", structpb.NullValue_name, structpb.NullValue_value)\n\tRegisterType((*structpb.Struct)(nil), \"google.protobuf.Struct\")\n\tRegisterType((*structpb.Value)(nil), \"google.protobuf.Value\")\n\tRegisterType((*structpb.ListValue)(nil), \"google.protobuf.ListValue\")\n\n\t// timestamp.proto\n\tRegisterType((*timestamppb.Timestamp)(nil), \"google.protobuf.Timestamp\")\n\n\t// type.proto\n\tRegisterEnum(\"google.protobuf.Syntax\", typepb.Syntax_name, typepb.Syntax_value)\n\tRegisterEnum(\"google.protobuf.Field_Kind\", typepb.Field_Kind_name, typepb.Field_Kind_value)\n\tRegisterEnum(\"google.protobuf.Field_Cardinality\", typepb.Field_Cardinality_name, typepb.Field_Cardinality_value)\n\tRegisterType((*typepb.Type)(nil), \"google.protobuf.Type\")\n\tRegisterType((*typepb.Field)(nil), \"google.protobuf.Field\")\n\tRegisterType((*typepb.Enum)(nil), \"google.protobuf.Enum\")\n\tRegisterType((*typepb.EnumValue)(nil), \"google.protobuf.EnumValue\")\n\tRegisterType((*typepb.Option)(nil), \"google.protobuf.Option\")\n\n\t// wrapper.proto\n\tRegisterType((*wrapperspb.DoubleValue)(nil), \"google.protobuf.DoubleValue\")\n\tRegisterType((*wrapperspb.FloatValue)(nil), \"google.protobuf.FloatValue\")\n\tRegisterType((*wrapperspb.Int64Value)(nil), \"google.protobuf.Int64Value\")\n\tRegisterType((*wrapperspb.UInt64Value)(nil), \"google.protobuf.UInt64Value\")\n\tRegisterType((*wrapperspb.Int32Value)(nil), \"google.protobuf.Int32Value\")\n\tRegisterType((*wrapperspb.UInt32Value)(nil), \"google.protobuf.UInt32Value\")\n\tRegisterType((*wrapperspb.BoolValue)(nil), \"google.protobuf.BoolValue\")\n\tRegisterType((*wrapperspb.StringValue)(nil), \"google.protobuf.StringValue\")\n\tRegisterType((*wrapperspb.BytesValue)(nil), \"google.protobuf.BytesValue\")\n}", "title": "" }, { "docid": "2d379fd816ec017c4494ce009cd541bd", "score": "0.55270314", "text": "func (s *Struct) StructMethod() {}", "title": "" }, { "docid": "22244b8eda0e179fcf620936b19885ec", "score": "0.55046433", "text": "func (*Component_Backplane) IsYANGGoStruct() {}", "title": "" }, { "docid": "4964306ff4663291f027ad462ba2637f", "score": "0.5492324", "text": "func (x *fastReflection_NestedRepeatedSigner) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*NestedRepeatedSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tif x.Inner != nil {\n\t\t\tl = options.Size(x.Inner)\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*NestedRepeatedSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif x.Inner != nil {\n\t\t\tencoded, err := options.Marshal(x.Inner)\n\t\t\tif err != nil {\n\t\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\t\tBuf: input.Buf,\n\t\t\t\t}, err\n\t\t\t}\n\t\t\ti -= len(encoded)\n\t\t\tcopy(dAtA[i:], encoded)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*NestedRepeatedSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: NestedRepeatedSigner: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: NestedRepeatedSigner: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Inner\", wireType)\n\t\t\t\t}\n\t\t\t\tvar msglen int\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif msglen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + msglen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif x.Inner == nil {\n\t\t\t\t\tx.Inner = &NestedRepeatedSigner_Inner{}\n\t\t\t\t}\n\t\t\t\tif err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Inner); err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "d33de7f1a8a334a825a43065c202e03e", "score": "0.5477592", "text": "func (x *fastReflection_NodeInfoOther) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*NodeInfoOther)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tl = len(x.TxIndex)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tl = len(x.RpcAddress)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*NodeInfoOther)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif len(x.RpcAddress) > 0 {\n\t\t\ti -= len(x.RpcAddress)\n\t\t\tcopy(dAtA[i:], x.RpcAddress)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.RpcAddress)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x12\n\t\t}\n\t\tif len(x.TxIndex) > 0 {\n\t\t\ti -= len(x.TxIndex)\n\t\t\tcopy(dAtA[i:], x.TxIndex)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.TxIndex)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*NodeInfoOther)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: NodeInfoOther: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: NodeInfoOther: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field TxIndex\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.TxIndex = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tcase 2:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field RpcAddress\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.RpcAddress = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "29e75a6f5a9534fa7c3e9f665bc256f3", "score": "0.54701185", "text": "func (*ToBeExtended) Descriptor() ([]byte, []int) {\n\treturn file_reflection_grpc_testing_proto2_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "0afc0cab3cbcc2ec0174efe9d3b7cf97", "score": "0.54536986", "text": "func (x *fastReflection_RepeatedNestedRepeatedSigner) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*RepeatedNestedRepeatedSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tif len(x.Inner) > 0 {\n\t\t\tfor _, e := range x.Inner {\n\t\t\t\tl = options.Size(e)\n\t\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t\t}\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*RepeatedNestedRepeatedSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif len(x.Inner) > 0 {\n\t\t\tfor iNdEx := len(x.Inner) - 1; iNdEx >= 0; iNdEx-- {\n\t\t\t\tencoded, err := options.Marshal(x.Inner[iNdEx])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\t\t\tBuf: input.Buf,\n\t\t\t\t\t}, err\n\t\t\t\t}\n\t\t\t\ti -= len(encoded)\n\t\t\t\tcopy(dAtA[i:], encoded)\n\t\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))\n\t\t\t\ti--\n\t\t\t\tdAtA[i] = 0xa\n\t\t\t}\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*RepeatedNestedRepeatedSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: RepeatedNestedRepeatedSigner: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: RepeatedNestedRepeatedSigner: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Inner\", wireType)\n\t\t\t\t}\n\t\t\t\tvar msglen int\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif msglen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + msglen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Inner = append(x.Inner, &RepeatedNestedRepeatedSigner_Inner{})\n\t\t\t\tif err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Inner[len(x.Inner)-1]); err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "1fd67e45f504f40398bef2aca636aa6d", "score": "0.5438378", "text": "func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*MsgUpdateParamsResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*MsgUpdateParamsResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*MsgUpdateParamsResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: MsgUpdateParamsResponse: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "958e4c303b5a3083d376235af320c395", "score": "0.5432539", "text": "func (x *fastReflection_MsgUpdateParams) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*MsgUpdateParams)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tl = len(x.Authority)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.Params != nil {\n\t\t\tl = options.Size(x.Params)\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*MsgUpdateParams)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif x.Params != nil {\n\t\t\tencoded, err := options.Marshal(x.Params)\n\t\t\tif err != nil {\n\t\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\t\tBuf: input.Buf,\n\t\t\t\t}, err\n\t\t\t}\n\t\t\ti -= len(encoded)\n\t\t\tcopy(dAtA[i:], encoded)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x12\n\t\t}\n\t\tif len(x.Authority) > 0 {\n\t\t\ti -= len(x.Authority)\n\t\t\tcopy(dAtA[i:], x.Authority)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*MsgUpdateParams)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: MsgUpdateParams: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: MsgUpdateParams: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Authority\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Authority = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tcase 2:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Params\", wireType)\n\t\t\t\t}\n\t\t\t\tvar msglen int\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif msglen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + msglen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif x.Params == nil {\n\t\t\t\t\tx.Params = &Params{}\n\t\t\t\t}\n\t\t\t\tif err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "d30419d64cff5c3b99e2a09cc994b649", "score": "0.5422845", "text": "func (*UnaryProto) Descriptor() ([]byte, []int) {\n\treturn file_examples_internal_proto_examplepb_flow_combination_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "70e1a883882774ed4025751204247493", "score": "0.54135615", "text": "func (x *fastReflection_EchoResponse) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*EchoResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tl = len(x.Message)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*EchoResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif len(x.Message) > 0 {\n\t\t\ti -= len(x.Message)\n\t\t\tcopy(dAtA[i:], x.Message)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.Message)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*EchoResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: EchoResponse: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: EchoResponse: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Message\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Message = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "0ef22d97117460dd9453bc44af50dca9", "score": "0.540811", "text": "func enc_struct_messages(o *Buffer, p *Properties, base unsafe.Pointer, n uint) {\n\tsz := p.stype.Size() // size of one struct\n\tnb := uintptr(n) * sz // # of bytes used by the array of structs\n\n\t// Can the object marshal itself?\n\tif p.isMarshaler {\n\t\tfor i := uintptr(0); i < nb; i += sz {\n\t\t\tstructp := unsafe.Pointer(uintptr(base) + i)\n\n\t\t\tm := reflect.NewAt(p.stype, structp).Interface().(Marshaler)\n\t\t\tdata, err := m.MarshalProtobuf3()\n\t\t\tif err != nil {\n\t\t\t\to.noteError(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// note in a slice we always encode the data, even if it is nil, in order to preserve indexing of the slice\n\t\t\to.buf = append(o.buf, p.tagcode...)\n\t\t\tif p.WireType == WireBytes {\n\t\t\t\to.EncodeVarint(uint64(len(data)))\n\t\t\t}\n\t\t\to.buf = append(o.buf, data...)\n\t\t}\n\t\treturn\n\t}\n\n\tfor i := uintptr(0); i < nb; i += sz {\n\t\tstructp := unsafe.Pointer(uintptr(base) + i)\n\n\t\t// note: since this is an element of a slice we don't elide empty values, since they still serve to occupy a position in the slice\n\t\to.buf = append(o.buf, p.tagcode...)\n\t\to.enc_len_struct(p.sprop, structp)\n\t}\n}", "title": "" }, { "docid": "cc326913c44b5720019e8f98bc7d12e5", "score": "0.54052943", "text": "func (x *fastReflection_MsgCreateValidatorResponse) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*MsgCreateValidatorResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*MsgCreateValidatorResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*MsgCreateValidatorResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: MsgCreateValidatorResponse: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: MsgCreateValidatorResponse: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "87c62b3901b7a38583ce14e492eb002e", "score": "0.5404711", "text": "func reflectEndpoint(typ reflect.Type, schema *jsonschema.JsonSchema) error {\n\tif typ.Kind() == reflect.Ptr {\n\t\ttyp = typ.Elem()\n\t}\n\t// Iterate over not built-in types\n\tif typ.PkgPath() != \"\" && typ.Kind() == reflect.Struct {\n\t\tfor i := 0; i < typ.NumField(); i++ {\n\t\t\tf := typ.Field(i)\n\t\t\ttag := f.Tag.Get(\"protobuf\")\n\n\t\t\t// If there are no proto tags, we assume the field is unused\n\t\t\tif tag == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Parse the proto tags\n\t\t\tpriority, propertyName, _, enum := parseProtoTag(tag)\n\n\t\t\t// Create a property wrapper\n\t\t\tprop := jsonschema.New()\n\t\t\tprop.Property = propertyName\n\t\t\tprop.Parent = schema\n\n\t\t\tvar (\n\t\t\t\titems *jsonschema.JsonSchema\n\t\t\t\tisSlice bool\n\t\t\t)\n\n\t\t\ttyp := f.Type\n\t\t\t// Check if we have a slice\n\t\t\tif typ.Kind() == reflect.Slice {\n\t\t\t\ttyp = typ.Elem()\n\t\t\t\tisSlice = true\n\t\t\t\titems = jsonschema.New()\n\t\t\t\titems.Parent = prop\n\t\t\t}\n\n\t\t\t// Check if we have a ptr and get the underlying type\n\t\t\tif typ.Kind() == reflect.Ptr {\n\t\t\t\ttyp = typ.Elem()\n\t\t\t}\n\n\t\t\t// Add this to the required fields on this level if necessary\n\t\t\tif priority == \"req\" {\n\t\t\t\tif err := schema.AddRequired(propertyName); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Deal with enums\n\t\t\tif enum != \"\" {\n\t\t\t\tenumVals := getProtoEnumValues(typ)\n\n\t\t\t\tif isSlice {\n\t\t\t\t\titems.Type = jsonschema.TYPE_STRING\n\t\t\t\t\titems.Enum = enumVals\n\t\t\t\t\tprop.Items = items\n\t\t\t\t\tprop.Type = jsonschema.TYPE_ARRAY\n\t\t\t\t} else {\n\t\t\t\t\tprop.Type = jsonschema.TYPE_STRING\n\t\t\t\t\tprop.Enum = enumVals\n\t\t\t\t}\n\t\t\t\tif err := schema.AddProperty(prop); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Deal with custom types\n\t\t\tif typ.PkgPath() != \"\" {\n\t\t\t\t// If this was a slice, create a new property and add the ref as a child\n\t\t\t\t// Otherwise, add the reference as a normal property\n\t\t\t\tif isSlice {\n\t\t\t\t\titems.Ref = fmt.Sprintf(\"#/definitions/%s\", typ.String())\n\t\t\t\t\tprop.Items = items\n\t\t\t\t\tprop.Type = jsonschema.TYPE_ARRAY\n\t\t\t\t\tif err := schema.AddProperty(prop); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\tref := jsonschema.New()\n\t\t\t\t\tref.Ref = fmt.Sprintf(\"#/definitions/%s\", typ.String())\n\t\t\t\t\tref.Parent = schema\n\t\t\t\t\tref.Property = propertyName\n\t\t\t\t\tif err := schema.AddProperty(ref); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Create a new definition for this object and iterate it\n\t\t\t\t// NOTE: We always put definitions at root level\n\t\t\t\troot := findRoot(schema)\n\t\t\t\tif root == nil {\n\t\t\t\t\troot = schema\n\t\t\t\t}\n\n\t\t\t\tdef := jsonschema.New()\n\t\t\t\tdef.Property = typ.String()\n\n\t\t\t\tdef.Parent = root\n\t\t\t\tdef.Type = jsonschema.TYPE_OBJECT\n\t\t\t\troot.AddDefinitionChild(def)\n\t\t\t\treflectEndpoint(typ, def)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// We are dealing with a builtin type\n\t\t\tswitch typ.Kind() {\n\t\t\tcase reflect.String:\n\t\t\t\tprop.Type = jsonschema.TYPE_STRING\n\n\t\t\tcase reflect.Bool:\n\t\t\t\tprop.Type = jsonschema.TYPE_BOOLEAN\n\n\t\t\tcase reflect.Int, reflect.Int16, reflect.Int8, reflect.Int32, reflect.Int64,\n\t\t\t\treflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint8:\n\t\t\t\tprop.Type = jsonschema.TYPE_INTEGER\n\n\t\t\tcase reflect.Float32, reflect.Float64, reflect.Complex128, reflect.Complex64:\n\t\t\t\tprop.Type = jsonschema.TYPE_NUMBER\n\t\t\tdefault:\n\t\t\t\t// We should never get here\n\t\t\t\tlog.Errorf(\"Unhandled type: %v\", typ.Kind())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// If we had a slice on this iteration, use the prop type for the nested items scheme\n\t\t\tif isSlice {\n\t\t\t\titems.Type = prop.Type\n\t\t\t\tprop.Type = jsonschema.TYPE_ARRAY\n\t\t\t\tprop.Items = items\n\t\t\t}\n\t\t\tif err := schema.AddProperty(prop); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "325ae7ce4a90f4f6cf643387622c998e", "score": "0.53946745", "text": "func (x *fastReflection_DefaultNodeInfoOther) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*DefaultNodeInfoOther)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tl = len(x.TxIndex)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tl = len(x.RpcAddress)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*DefaultNodeInfoOther)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif len(x.RpcAddress) > 0 {\n\t\t\ti -= len(x.RpcAddress)\n\t\t\tcopy(dAtA[i:], x.RpcAddress)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.RpcAddress)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x12\n\t\t}\n\t\tif len(x.TxIndex) > 0 {\n\t\t\ti -= len(x.TxIndex)\n\t\t\tcopy(dAtA[i:], x.TxIndex)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.TxIndex)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*DefaultNodeInfoOther)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: DefaultNodeInfoOther: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: DefaultNodeInfoOther: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field TxIndex\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.TxIndex = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tcase 2:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field RpcAddress\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.RpcAddress = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "16f44c73e389fcfa5920442252e6f46e", "score": "0.5389918", "text": "func makeProtoBufMessage(att *expr.AttributeExpr, tname string, sd *ServiceData) *expr.AttributeExpr {\n\tatt = expr.DupAtt(att)\n\texpr.RemovePkgPath(att)\n\tut, isut := att.Type.(expr.UserType)\n\tswitch {\n\tcase att.Type == expr.Empty:\n\t\tatt.Type = &expr.UserTypeExpr{\n\t\t\tTypeName: tname,\n\t\t\tAttributeExpr: &expr.AttributeExpr{Type: &expr.Object{}},\n\t\t\tUID: sd.Name + \"#\" + tname,\n\t\t}\n\t\treturn att\n\tcase expr.IsPrimitive(att.Type):\n\t\twrapAttr(att, tname, true, sd)\n\t\treturn att\n\tcase isut:\n\t\tif expr.IsArray(ut) {\n\t\t\twrapAttr(att, tname, false, sd)\n\t\t}\n\tcase expr.IsArray(att.Type) || expr.IsMap(att.Type):\n\t\twrapAttr(att, tname, false, sd)\n\tcase expr.IsObject(att.Type) || expr.IsUnion(att.Type):\n\t\tatt.Type = &expr.UserTypeExpr{\n\t\t\tTypeName: tname,\n\t\t\tAttributeExpr: expr.DupAtt(att),\n\t\t\tUID: sd.Name + \"#\" + tname,\n\t\t}\n\t}\n\tn := \"\"\n\tmakeProtoBufMessageR(att, &n, sd, make(map[string]struct{}))\n\treturn att\n}", "title": "" }, { "docid": "497a09fdcdb7d2bb7d55525321132bff", "score": "0.5388831", "text": "func (x *fastReflection_Batch) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1.Batch.start_date\":\n\t\tif x.StartDate == nil {\n\t\t\tx.StartDate = new(timestamppb.Timestamp)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.StartDate.ProtoReflect())\n\tcase \"regen.ecocredit.v1.Batch.end_date\":\n\t\tif x.EndDate == nil {\n\t\t\tx.EndDate = new(timestamppb.Timestamp)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.EndDate.ProtoReflect())\n\tcase \"regen.ecocredit.v1.Batch.issuance_date\":\n\t\tif x.IssuanceDate == nil {\n\t\t\tx.IssuanceDate = new(timestamppb.Timestamp)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.IssuanceDate.ProtoReflect())\n\tcase \"regen.ecocredit.v1.Batch.key\":\n\t\tpanic(fmt.Errorf(\"field key of message regen.ecocredit.v1.Batch is not mutable\"))\n\tcase \"regen.ecocredit.v1.Batch.issuer\":\n\t\tpanic(fmt.Errorf(\"field issuer of message regen.ecocredit.v1.Batch is not mutable\"))\n\tcase \"regen.ecocredit.v1.Batch.project_key\":\n\t\tpanic(fmt.Errorf(\"field project_key of message regen.ecocredit.v1.Batch is not mutable\"))\n\tcase \"regen.ecocredit.v1.Batch.denom\":\n\t\tpanic(fmt.Errorf(\"field denom of message regen.ecocredit.v1.Batch is not mutable\"))\n\tcase \"regen.ecocredit.v1.Batch.metadata\":\n\t\tpanic(fmt.Errorf(\"field metadata of message regen.ecocredit.v1.Batch is not mutable\"))\n\tcase \"regen.ecocredit.v1.Batch.open\":\n\t\tpanic(fmt.Errorf(\"field open of message regen.ecocredit.v1.Batch is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1.Batch\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1.Batch does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "2b86fade0543e5ee3cd963ab5f0e6de5", "score": "0.5388486", "text": "func StructExample() {\n\tfmt.Println(Vertex{1, 2})\n}", "title": "" }, { "docid": "9e067a61c69fee46317bed74320b1777", "score": "0.5388237", "text": "func (x *fastReflection_EchoRequest) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*EchoRequest)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tl = len(x.Message)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*EchoRequest)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif len(x.Message) > 0 {\n\t\t\ti -= len(x.Message)\n\t\t\tcopy(dAtA[i:], x.Message)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.Message)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*EchoRequest)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: EchoRequest: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: EchoRequest: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Message\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Message = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "c0f7ae7be75719e78373516051d41795", "score": "0.53862816", "text": "func (x *fastReflection_RepeatedNestedSigner) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*RepeatedNestedSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tif len(x.Inner) > 0 {\n\t\t\tfor _, e := range x.Inner {\n\t\t\t\tl = options.Size(e)\n\t\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t\t}\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*RepeatedNestedSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif len(x.Inner) > 0 {\n\t\t\tfor iNdEx := len(x.Inner) - 1; iNdEx >= 0; iNdEx-- {\n\t\t\t\tencoded, err := options.Marshal(x.Inner[iNdEx])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\t\t\tBuf: input.Buf,\n\t\t\t\t\t}, err\n\t\t\t\t}\n\t\t\t\ti -= len(encoded)\n\t\t\t\tcopy(dAtA[i:], encoded)\n\t\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))\n\t\t\t\ti--\n\t\t\t\tdAtA[i] = 0xa\n\t\t\t}\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*RepeatedNestedSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: RepeatedNestedSigner: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: RepeatedNestedSigner: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Inner\", wireType)\n\t\t\t\t}\n\t\t\t\tvar msglen int\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif msglen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + msglen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Inner = append(x.Inner, &RepeatedNestedSigner_Inner{})\n\t\t\t\tif err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Inner[len(x.Inner)-1]); err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "4dab7f3b25052d9b83655cecdea453a6", "score": "0.5382853", "text": "func (*TestProtoStruct) Descriptor() ([]byte, []int) {\n\treturn file_testprotos_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "f28b237aba3c5ec86bfad3bcd639caf5", "score": "0.5378117", "text": "func (*Component_Subcomponent) IsYANGGoStruct() {}", "title": "" }, { "docid": "5a0146a9c5e7d71cc3ca8b998cab67a8", "score": "0.5369457", "text": "func (t *ClockTimestamp) ProtoMessage() {}", "title": "" }, { "docid": "481c87ce9943a3628ab93cb094791bb8", "score": "0.5364345", "text": "func (*OldMessage_Nested) Descriptor() ([]byte, []int) {\n\treturn file_proto2_proto_test_proto_rawDescGZIP(), []int{8, 0}\n}", "title": "" }, { "docid": "7f2bdc18ee9ab2644f799e4f67ac84e7", "score": "0.534784", "text": "func (o *Buffer) enc_struct_message(p *Properties, base unsafe.Pointer) {\n\tstructp := unsafe.Pointer(uintptr(base) + p.offset)\n\t// note struct is embedded in base, so pointer cannot be nil\n\n\tiTag := len(o.buf)\n\to.buf = append(o.buf, p.tagcode...)\n\tiLen := len(o.buf)\n\to.enc_len_struct(p.sprop, structp)\n\n\t// if the contents encoded to nothing (length = 0) then we can skip this field entirely\n\tif len(o.buf) == iLen+1 && o.buf[iLen] == 0 {\n\t\to.buf = o.buf[:iTag]\n\t}\n}", "title": "" }, { "docid": "dc0c7718608bf03202622b174e719b1f", "score": "0.53449553", "text": "func (*GenerateUnboundMethodsSimpleMessage) Descriptor() ([]byte, []int) {\n\treturn file_examples_internal_proto_examplepb_generate_unbound_methods_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "b0272178eba3161f31ce49081683a844", "score": "0.53449535", "text": "func (x *fastReflection_RepeatedSigner) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*RepeatedSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tif len(x.Signer) > 0 {\n\t\t\tfor _, s := range x.Signer {\n\t\t\t\tl = len(s)\n\t\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t\t}\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*RepeatedSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif len(x.Signer) > 0 {\n\t\t\tfor iNdEx := len(x.Signer) - 1; iNdEx >= 0; iNdEx-- {\n\t\t\t\ti -= len(x.Signer[iNdEx])\n\t\t\t\tcopy(dAtA[i:], x.Signer[iNdEx])\n\t\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.Signer[iNdEx])))\n\t\t\t\ti--\n\t\t\t\tdAtA[i] = 0xa\n\t\t\t}\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*RepeatedSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: RepeatedSigner: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: RepeatedSigner: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Signer\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Signer = append(x.Signer, string(dAtA[iNdEx:postIndex]))\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "8c71ac41859a5cbf2000a41cb899df94", "score": "0.533959", "text": "func (*MemberAddResponse) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{30}\n}", "title": "" }, { "docid": "590062718290ca260002282aa7427bdd", "score": "0.53358024", "text": "func (*MyMessage_SomeGroup) Descriptor() ([]byte, []int) {\n\treturn file_proto2_proto_test_proto_rawDescGZIP(), []int{13, 0}\n}", "title": "" }, { "docid": "f11147b8f892c790cd9787e9ba91b226", "score": "0.5335665", "text": "func (*MutateOperationResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_google_ads_service_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "dca16c49ff6b1e58c34241c4ef9be220", "score": "0.5332757", "text": "func protobufEncode(payload interface{}) (data []byte, err error) {\n\tpl := protobuf.Payload{\n\t\tVersion: proto.Uint32(uint32(ProtobufVersion())),\n\t}\n\n\tswitch val := payload.(type) {\n\tcase []*c.VbKeyVersions:\n\t\tpl.Vbkeys = make([]*protobuf.VbKeyVersions, 0, len(val))\n\t\tfor _, vb := range val { // for each VbKeyVersions\n\t\t\tpvb := &protobuf.VbKeyVersions{\n\t\t\t\tKeyspaceId: proto.String(vb.KeyspaceId),\n\t\t\t\tVbucket: proto.Uint32(uint32(vb.Vbucket)),\n\t\t\t\tVbuuid: proto.Uint64(vb.Vbuuid),\n\t\t\t\tProjVer: protobuf.ProjectorVersion(int32(vb.ProjVer)).Enum(),\n\t\t\t\tOpaque2: proto.Uint64(vb.Opaque2),\n\t\t\t}\n\t\t\tpvb.Kvs = make([]*protobuf.KeyVersions, 0, len(vb.Kvs))\n\t\t\tfor _, kv := range vb.Kvs { // for each mutation\n\t\t\t\tpkv := &protobuf.KeyVersions{\n\t\t\t\t\tSeqno: proto.Uint64(kv.Seqno),\n\t\t\t\t}\n\t\t\t\tif kv.Docid != nil && len(kv.Docid) > 0 {\n\t\t\t\t\tpkv.Docid = kv.Docid\n\t\t\t\t}\n\t\t\t\tif kv.Ctime > 0 {\n\t\t\t\t\t// Send moving average value of mutation processing latency in projector\n\t\t\t\t\tpkv.PrjMovingAvg = proto.Int64(kv.Ctime)\n\t\t\t\t}\n\t\t\t\tif len(kv.Uuids) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tl := len(kv.Uuids)\n\t\t\t\tpkv.Uuids = make([]uint64, 0, l)\n\t\t\t\tpkv.Commands = make([]uint32, 0, l)\n\t\t\t\tpkv.Keys = make([][]byte, 0, l)\n\t\t\t\tpkv.Oldkeys = make([][]byte, 0, l)\n\t\t\t\tpkv.Partnkeys = make([][]byte, 0, l)\n\t\t\t\tfor i, uuid := range kv.Uuids { // for each key-version\n\t\t\t\t\tpkv.Uuids = append(pkv.Uuids, uuid)\n\t\t\t\t\tpkv.Commands = append(pkv.Commands, uint32(kv.Commands[i]))\n\t\t\t\t\tpkv.Keys = append(pkv.Keys, kv.Keys[i])\n\t\t\t\t\tpkv.Oldkeys = append(pkv.Oldkeys, kv.Oldkeys[i])\n\t\t\t\t\tpkv.Partnkeys = append(pkv.Partnkeys, kv.Partnkeys[i])\n\t\t\t\t}\n\t\t\t\tpvb.Kvs = append(pvb.Kvs, pkv)\n\t\t\t}\n\t\t\tpl.Vbkeys = append(pl.Vbkeys, pvb)\n\t\t}\n\n\tcase *c.VbConnectionMap:\n\t\tpl.Vbmap = &protobuf.VbConnectionMap{\n\t\t\tKeyspaceId: proto.String(val.KeyspaceId),\n\t\t\tVbuuids: val.Vbuuids,\n\t\t\tVbuckets: c.Vbno16to32(val.Vbuckets),\n\t\t}\n\t}\n\n\tif err == nil {\n\t\tdata, err = proto.Marshal(&pl)\n\t}\n\treturn\n}", "title": "" }, { "docid": "cb50de8b8871a5981cfe27373c9cb04a", "score": "0.53310096", "text": "func (x *fastReflection_ProtocolVersion) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*ProtocolVersion)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tif x.P2P != 0 {\n\t\t\tn += 1 + runtime.Sov(uint64(x.P2P))\n\t\t}\n\t\tif x.Block != 0 {\n\t\t\tn += 1 + runtime.Sov(uint64(x.Block))\n\t\t}\n\t\tif x.App != 0 {\n\t\t\tn += 1 + runtime.Sov(uint64(x.App))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*ProtocolVersion)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif x.App != 0 {\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(x.App))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x18\n\t\t}\n\t\tif x.Block != 0 {\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(x.Block))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x10\n\t\t}\n\t\tif x.P2P != 0 {\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(x.P2P))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x8\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*ProtocolVersion)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: ProtocolVersion: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: ProtocolVersion: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field P2P\", wireType)\n\t\t\t\t}\n\t\t\t\tx.P2P = 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tx.P2P |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase 2:\n\t\t\t\tif wireType != 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Block\", wireType)\n\t\t\t\t}\n\t\t\t\tx.Block = 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tx.Block |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase 3:\n\t\t\t\tif wireType != 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field App\", wireType)\n\t\t\t\t}\n\t\t\t\tx.App = 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tx.App |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "cb50de8b8871a5981cfe27373c9cb04a", "score": "0.53310096", "text": "func (x *fastReflection_ProtocolVersion) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*ProtocolVersion)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tif x.P2P != 0 {\n\t\t\tn += 1 + runtime.Sov(uint64(x.P2P))\n\t\t}\n\t\tif x.Block != 0 {\n\t\t\tn += 1 + runtime.Sov(uint64(x.Block))\n\t\t}\n\t\tif x.App != 0 {\n\t\t\tn += 1 + runtime.Sov(uint64(x.App))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*ProtocolVersion)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif x.App != 0 {\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(x.App))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x18\n\t\t}\n\t\tif x.Block != 0 {\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(x.Block))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x10\n\t\t}\n\t\tif x.P2P != 0 {\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(x.P2P))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x8\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*ProtocolVersion)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: ProtocolVersion: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: ProtocolVersion: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field P2P\", wireType)\n\t\t\t\t}\n\t\t\t\tx.P2P = 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tx.P2P |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase 2:\n\t\t\t\tif wireType != 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Block\", wireType)\n\t\t\t\t}\n\t\t\t\tx.Block = 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tx.Block |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase 3:\n\t\t\t\tif wireType != 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field App\", wireType)\n\t\t\t\t}\n\t\t\t\tx.App = 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tx.App |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "e5ec9a7133b4f38b62a7d8dcf7cdb49c", "score": "0.53272986", "text": "func (x *fastReflection_MsgCreateValidator) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.staking.v1beta1.MsgCreateValidator.description\":\n\t\tif x.Description == nil {\n\t\t\tx.Description = new(Description)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Description.ProtoReflect())\n\tcase \"cosmos.staking.v1beta1.MsgCreateValidator.commission\":\n\t\tif x.Commission == nil {\n\t\t\tx.Commission = new(CommissionRates)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Commission.ProtoReflect())\n\tcase \"cosmos.staking.v1beta1.MsgCreateValidator.pubkey\":\n\t\tif x.Pubkey == nil {\n\t\t\tx.Pubkey = new(anypb.Any)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Pubkey.ProtoReflect())\n\tcase \"cosmos.staking.v1beta1.MsgCreateValidator.value\":\n\t\tif x.Value == nil {\n\t\t\tx.Value = new(v1beta1.Coin)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Value.ProtoReflect())\n\tcase \"cosmos.staking.v1beta1.MsgCreateValidator.min_self_delegation\":\n\t\tpanic(fmt.Errorf(\"field min_self_delegation of message cosmos.staking.v1beta1.MsgCreateValidator is not mutable\"))\n\tcase \"cosmos.staking.v1beta1.MsgCreateValidator.delegator_address\":\n\t\tpanic(fmt.Errorf(\"field delegator_address of message cosmos.staking.v1beta1.MsgCreateValidator is not mutable\"))\n\tcase \"cosmos.staking.v1beta1.MsgCreateValidator.validator_address\":\n\t\tpanic(fmt.Errorf(\"field validator_address of message cosmos.staking.v1beta1.MsgCreateValidator is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.staking.v1beta1.MsgCreateValidator\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.staking.v1beta1.MsgCreateValidator does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "02cb60e1f792fbcfbfeab2791c66dc92", "score": "0.5315554", "text": "func (x *fastReflection_SayHelloResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.SayHelloResponse.greeting\":\n\t\tpanic(fmt.Errorf(\"field greeting of message testpb.SayHelloResponse is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.SayHelloResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.SayHelloResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "b96953a45c7677112c1111be2f264963", "score": "0.53152436", "text": "func (*MutateOperation) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_google_ads_service_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "dd8885b5e66c2ba7eea43caf860c56cc", "score": "0.53120977", "text": "func (*NetworkInstance_Protocol) IsYANGGoStruct() {}", "title": "" }, { "docid": "dd8885b5e66c2ba7eea43caf860c56cc", "score": "0.53120977", "text": "func (*NetworkInstance_Protocol) IsYANGGoStruct() {}", "title": "" }, { "docid": "202b6fd39399ea67f4049115d7dc6d2a", "score": "0.530283", "text": "func (x *fastReflection_MsgEditValidatorResponse) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*MsgEditValidatorResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*MsgEditValidatorResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*MsgEditValidatorResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: MsgEditValidatorResponse: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: MsgEditValidatorResponse: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "0c882384a9b70ccebf63790d919dc122", "score": "0.5297404", "text": "func (x *fastReflection_SayHelloResponse) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*SayHelloResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tl = len(x.Greeting)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*SayHelloResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif len(x.Greeting) > 0 {\n\t\t\ti -= len(x.Greeting)\n\t\t\tcopy(dAtA[i:], x.Greeting)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.Greeting)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*SayHelloResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: SayHelloResponse: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: SayHelloResponse: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Greeting\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Greeting = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "435a6e3de06b32e8e875d25a3f6dabfe", "score": "0.5295811", "text": "func (x *fastReflection_AllowedClassCreator) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*AllowedClassCreator)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tl = len(x.Address)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*AllowedClassCreator)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif len(x.Address) > 0 {\n\t\t\ti -= len(x.Address)\n\t\t\tcopy(dAtA[i:], x.Address)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*AllowedClassCreator)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: AllowedClassCreator: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: AllowedClassCreator: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Address\", wireType)\n\t\t\t\t}\n\t\t\t\tvar byteLen int\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tbyteLen |= int(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif byteLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + byteLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Address = append(x.Address[:0], dAtA[iNdEx:postIndex]...)\n\t\t\t\tif x.Address == nil {\n\t\t\t\t\tx.Address = []byte{}\n\t\t\t\t}\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "55c7332dd9a3dd54e75560a283370086", "score": "0.52919215", "text": "func (x *fastReflection_RepeatedNestedSigner_Inner) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*RepeatedNestedSigner_Inner)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tl = len(x.Signer)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*RepeatedNestedSigner_Inner)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif len(x.Signer) > 0 {\n\t\t\ti -= len(x.Signer)\n\t\t\tcopy(dAtA[i:], x.Signer)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.Signer)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*RepeatedNestedSigner_Inner)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: RepeatedNestedSigner_Inner: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: RepeatedNestedSigner_Inner: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Signer\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Signer = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "eaddd4733239c394ec1001a4eca4ef1d", "score": "0.52897376", "text": "func (*NetworkInstance_Protocol_Pim) IsYANGGoStruct() {}", "title": "" }, { "docid": "1f310b015912ad2f37bec57a7de13cdc", "score": "0.5287689", "text": "func (*NetworkInstance_Encapsulation) IsYANGGoStruct() {}", "title": "" }, { "docid": "81eb6d78cfcddc62f81e74b21979d358", "score": "0.52875715", "text": "func (x *fastReflection_BatchSequence) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*BatchSequence)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tif x.ProjectKey != 0 {\n\t\t\tn += 1 + runtime.Sov(uint64(x.ProjectKey))\n\t\t}\n\t\tif x.NextSequence != 0 {\n\t\t\tn += 1 + runtime.Sov(uint64(x.NextSequence))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*BatchSequence)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif x.NextSequence != 0 {\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(x.NextSequence))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x10\n\t\t}\n\t\tif x.ProjectKey != 0 {\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(x.ProjectKey))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x8\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*BatchSequence)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: BatchSequence: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: BatchSequence: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field ProjectKey\", wireType)\n\t\t\t\t}\n\t\t\t\tx.ProjectKey = 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tx.ProjectKey |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase 2:\n\t\t\t\tif wireType != 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field NextSequence\", wireType)\n\t\t\t\t}\n\t\t\t\tx.NextSequence = 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tx.NextSequence |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "1f310b015912ad2f37bec57a7de13cdc", "score": "0.5286911", "text": "func (*NetworkInstance_Encapsulation) IsYANGGoStruct() {}", "title": "" }, { "docid": "06af5316324cd1414fa52d9687c56afa", "score": "0.52856153", "text": "func encodeStruct(v interface{}) (*proto3.Value, *sppb.Type, error) {\n\ttyp := reflect.TypeOf(v)\n\tval := reflect.ValueOf(v)\n\n\t// Pointer to struct.\n\tif typ.Kind() == reflect.Ptr && typ.Elem().Kind() == reflect.Struct {\n\t\ttyp = typ.Elem()\n\t\tif val.IsNil() {\n\t\t\t// nil pointer to struct, representing a NULL STRUCT value. Use a\n\t\t\t// dummy value to get the type.\n\t\t\t_, st, err := encodeStruct(reflect.Zero(typ).Interface())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\treturn nullProto(), st, nil\n\t\t}\n\t\tval = val.Elem()\n\t}\n\n\tif typ.Kind() != reflect.Struct {\n\t\treturn nil, nil, errEncoderUnsupportedType(v)\n\t}\n\n\tstf := make([]*sppb.StructType_Field, 0, typ.NumField())\n\tstv := make([]*proto3.Value, 0, typ.NumField())\n\n\tfor i := 0; i < typ.NumField(); i++ {\n\t\t// If the field has a 'spanner' tag, use the value of that tag as the field name.\n\t\t// This is used to build STRUCT types with unnamed/duplicate fields.\n\t\tsf := typ.Field(i)\n\t\tfval := val.Field(i)\n\n\t\t// Embedded fields are not allowed.\n\t\tif sf.Anonymous {\n\t\t\treturn nil, nil, errUnsupportedEmbeddedStructFields(sf.Name)\n\t\t}\n\n\t\t// Unexported fields are ignored.\n\t\tif !fval.CanInterface() {\n\t\t\tcontinue\n\t\t}\n\n\t\tfname, ok := sf.Tag.Lookup(\"spanner\")\n\t\tif !ok {\n\t\t\tfname = sf.Name\n\t\t}\n\n\t\teval, etype, err := encodeValue(fval.Interface())\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\tstf = append(stf, mkField(fname, etype))\n\t\tstv = append(stv, eval)\n\t}\n\n\treturn listProto(stv...), structType(stf...), nil\n}", "title": "" }, { "docid": "02a45de0067480263888059adb02bc3e", "score": "0.52817607", "text": "func (x *fastReflection_BatchSupply) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*BatchSupply)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tif x.BatchKey != 0 {\n\t\t\tn += 1 + runtime.Sov(uint64(x.BatchKey))\n\t\t}\n\t\tl = len(x.TradableAmount)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tl = len(x.RetiredAmount)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tl = len(x.CancelledAmount)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*BatchSupply)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif len(x.CancelledAmount) > 0 {\n\t\t\ti -= len(x.CancelledAmount)\n\t\t\tcopy(dAtA[i:], x.CancelledAmount)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.CancelledAmount)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x22\n\t\t}\n\t\tif len(x.RetiredAmount) > 0 {\n\t\t\ti -= len(x.RetiredAmount)\n\t\t\tcopy(dAtA[i:], x.RetiredAmount)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.RetiredAmount)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x1a\n\t\t}\n\t\tif len(x.TradableAmount) > 0 {\n\t\t\ti -= len(x.TradableAmount)\n\t\t\tcopy(dAtA[i:], x.TradableAmount)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.TradableAmount)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x12\n\t\t}\n\t\tif x.BatchKey != 0 {\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(x.BatchKey))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x8\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*BatchSupply)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: BatchSupply: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: BatchSupply: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field BatchKey\", wireType)\n\t\t\t\t}\n\t\t\t\tx.BatchKey = 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tx.BatchKey |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase 2:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field TradableAmount\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.TradableAmount = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tcase 3:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field RetiredAmount\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.RetiredAmount = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tcase 4:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field CancelledAmount\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.CancelledAmount = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "de8701f55dbd446526058af628bc00a3", "score": "0.52804154", "text": "func (x *fastReflection_CreditType) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*CreditType)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tl = len(x.Abbreviation)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tl = len(x.Name)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tl = len(x.Unit)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.Precision != 0 {\n\t\t\tn += 1 + runtime.Sov(uint64(x.Precision))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*CreditType)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif x.Precision != 0 {\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(x.Precision))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x20\n\t\t}\n\t\tif len(x.Unit) > 0 {\n\t\t\ti -= len(x.Unit)\n\t\t\tcopy(dAtA[i:], x.Unit)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.Unit)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x1a\n\t\t}\n\t\tif len(x.Name) > 0 {\n\t\t\ti -= len(x.Name)\n\t\t\tcopy(dAtA[i:], x.Name)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x12\n\t\t}\n\t\tif len(x.Abbreviation) > 0 {\n\t\t\ti -= len(x.Abbreviation)\n\t\t\tcopy(dAtA[i:], x.Abbreviation)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.Abbreviation)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*CreditType)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: CreditType: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: CreditType: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Abbreviation\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Abbreviation = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tcase 2:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Name\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Name = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tcase 3:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Unit\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Unit = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tcase 4:\n\t\t\t\tif wireType != 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Precision\", wireType)\n\t\t\t\t}\n\t\t\t\tx.Precision = 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tx.Precision |= uint32(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "8ff1268a94069c723874adb00cd366ce", "score": "0.5275683", "text": "func (*Component_Port) IsYANGGoStruct() {}", "title": "" }, { "docid": "a83818098b467a086fe996e7ba924723", "score": "0.52691424", "text": "func (x *fastReflection_RepeatedNestedRepeatedSigner_Inner) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*RepeatedNestedRepeatedSigner_Inner)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tif len(x.Signer) > 0 {\n\t\t\tfor _, s := range x.Signer {\n\t\t\t\tl = len(s)\n\t\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t\t}\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*RepeatedNestedRepeatedSigner_Inner)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif len(x.Signer) > 0 {\n\t\t\tfor iNdEx := len(x.Signer) - 1; iNdEx >= 0; iNdEx-- {\n\t\t\t\ti -= len(x.Signer[iNdEx])\n\t\t\t\tcopy(dAtA[i:], x.Signer[iNdEx])\n\t\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.Signer[iNdEx])))\n\t\t\t\ti--\n\t\t\t\tdAtA[i] = 0xa\n\t\t\t}\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*RepeatedNestedRepeatedSigner_Inner)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: RepeatedNestedRepeatedSigner_Inner: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: RepeatedNestedRepeatedSigner_Inner: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Signer\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Signer = append(x.Signer, string(dAtA[iNdEx:postIndex]))\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "ed0ba8a0e7c1b8c2ba86114c4aeb22bf", "score": "0.52673787", "text": "func AsProtobufMessage(source interface{}, state data.Map, target proto.Message) (interface{}, error) {\n\tvar requestMap map[string]interface{}\n\tif toolbox.IsString(source) {\n\t\trequestMap = make(map[string]interface{})\n\t\terr := toolbox.NewJSONDecoderFactory().Create(strings.NewReader(toolbox.AsString(source))).Decode(&requestMap)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"failed to run udf: %v %v\\n\", source, err)\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\trequestMap = toolbox.AsMap(source)\n\t}\n\n\terr := toolbox.DefaultConverter.AssignConverted(target, requestMap)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to run udf: unable convert: %v %v\\n\", source, err)\n\t\treturn nil, err\n\t}\n\n\tprotodata, err := proto.Marshal(target)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to run udf: unable Marshal %v %v\\n\", source, err)\n\t\treturn nil, fmt.Errorf(\"failed to encode: %v, %v\", requestMap, err)\n\t}\n\tbuf := new(bytes.Buffer)\n\tencoder := base64.NewEncoder(base64.StdEncoding, buf)\n\t_, _ = encoder.Write(protodata)\n\terr = encoder.Close()\n\treturn fmt.Sprintf(\"base64:%v\", string(buf.Bytes())), err\n}", "title": "" }, { "docid": "8325ff076b5e0e612130c4fb6c117192", "score": "0.5262298", "text": "func (*CustomTypeDef) Descriptor() ([]byte, []int) {\n\treturn file_CommonDTO_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "1c37dda619de015b723728bc14e65146", "score": "0.5258918", "text": "func (x *fastReflection_Block) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*Block)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tif x.Header != nil {\n\t\t\tl = options.Size(x.Header)\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.Data != nil {\n\t\t\tl = options.Size(x.Data)\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.Evidence != nil {\n\t\t\tl = options.Size(x.Evidence)\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.LastCommit != nil {\n\t\t\tl = options.Size(x.LastCommit)\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*Block)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif x.LastCommit != nil {\n\t\t\tencoded, err := options.Marshal(x.LastCommit)\n\t\t\tif err != nil {\n\t\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\t\tBuf: input.Buf,\n\t\t\t\t}, err\n\t\t\t}\n\t\t\ti -= len(encoded)\n\t\t\tcopy(dAtA[i:], encoded)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x22\n\t\t}\n\t\tif x.Evidence != nil {\n\t\t\tencoded, err := options.Marshal(x.Evidence)\n\t\t\tif err != nil {\n\t\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\t\tBuf: input.Buf,\n\t\t\t\t}, err\n\t\t\t}\n\t\t\ti -= len(encoded)\n\t\t\tcopy(dAtA[i:], encoded)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x1a\n\t\t}\n\t\tif x.Data != nil {\n\t\t\tencoded, err := options.Marshal(x.Data)\n\t\t\tif err != nil {\n\t\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\t\tBuf: input.Buf,\n\t\t\t\t}, err\n\t\t\t}\n\t\t\ti -= len(encoded)\n\t\t\tcopy(dAtA[i:], encoded)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x12\n\t\t}\n\t\tif x.Header != nil {\n\t\t\tencoded, err := options.Marshal(x.Header)\n\t\t\tif err != nil {\n\t\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\t\tBuf: input.Buf,\n\t\t\t\t}, err\n\t\t\t}\n\t\t\ti -= len(encoded)\n\t\t\tcopy(dAtA[i:], encoded)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*Block)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: Block: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: Block: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Header\", wireType)\n\t\t\t\t}\n\t\t\t\tvar msglen int\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif msglen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + msglen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif x.Header == nil {\n\t\t\t\t\tx.Header = &Header{}\n\t\t\t\t}\n\t\t\t\tif err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Header); err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tiNdEx = postIndex\n\t\t\tcase 2:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Data\", wireType)\n\t\t\t\t}\n\t\t\t\tvar msglen int\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif msglen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + msglen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif x.Data == nil {\n\t\t\t\t\tx.Data = &Data{}\n\t\t\t\t}\n\t\t\t\tif err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Data); err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tiNdEx = postIndex\n\t\t\tcase 3:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Evidence\", wireType)\n\t\t\t\t}\n\t\t\t\tvar msglen int\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif msglen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + msglen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif x.Evidence == nil {\n\t\t\t\t\tx.Evidence = &EvidenceList{}\n\t\t\t\t}\n\t\t\t\tif err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Evidence); err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tiNdEx = postIndex\n\t\t\tcase 4:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field LastCommit\", wireType)\n\t\t\t\t}\n\t\t\t\tvar msglen int\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif msglen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + msglen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif x.LastCommit == nil {\n\t\t\t\t\tx.LastCommit = &Commit{}\n\t\t\t\t}\n\t\t\t\tif err := options.Unmarshal(dAtA[iNdEx:postIndex], x.LastCommit); err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "b763dae1cdb6a474a4ba9fc2d81600d4", "score": "0.52566797", "text": "func (x *fastReflection_NestedRepeatedSigner_Inner) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*NestedRepeatedSigner_Inner)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tif len(x.Signer) > 0 {\n\t\t\tfor _, s := range x.Signer {\n\t\t\t\tl = len(s)\n\t\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t\t}\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*NestedRepeatedSigner_Inner)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif len(x.Signer) > 0 {\n\t\t\tfor iNdEx := len(x.Signer) - 1; iNdEx >= 0; iNdEx-- {\n\t\t\t\ti -= len(x.Signer[iNdEx])\n\t\t\t\tcopy(dAtA[i:], x.Signer[iNdEx])\n\t\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.Signer[iNdEx])))\n\t\t\t\ti--\n\t\t\t\tdAtA[i] = 0xa\n\t\t\t}\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*NestedRepeatedSigner_Inner)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: NestedRepeatedSigner_Inner: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: NestedRepeatedSigner_Inner: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Signer\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Signer = append(x.Signer, string(dAtA[iNdEx:postIndex]))\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "967ae9deaf86b015cc3309c86143892d", "score": "0.52530736", "text": "func (x *fastReflection_SimpleSigner) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*SimpleSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tl = len(x.Signer)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*SimpleSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif len(x.Signer) > 0 {\n\t\t\ti -= len(x.Signer)\n\t\t\tcopy(dAtA[i:], x.Signer)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.Signer)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*SimpleSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: SimpleSigner: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: SimpleSigner: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Signer\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Signer = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "b73f58f61f1689d4a73e441103024e3b", "score": "0.5249975", "text": "func (x *fastReflection_NestedSigner) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*NestedSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tif x.Inner != nil {\n\t\t\tl = options.Size(x.Inner)\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*NestedSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif x.Inner != nil {\n\t\t\tencoded, err := options.Marshal(x.Inner)\n\t\t\tif err != nil {\n\t\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\t\tBuf: input.Buf,\n\t\t\t\t}, err\n\t\t\t}\n\t\t\ti -= len(encoded)\n\t\t\tcopy(dAtA[i:], encoded)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*NestedSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: NestedSigner: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: NestedSigner: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Inner\", wireType)\n\t\t\t\t}\n\t\t\t\tvar msglen int\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif msglen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + msglen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif x.Inner == nil {\n\t\t\t\t\tx.Inner = &NestedSigner_Inner{}\n\t\t\t\t}\n\t\t\t\tif err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Inner); err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "1ce546d665915497dd5df1dff8f1e31f", "score": "0.5249269", "text": "func newProtoJSONMarshaler(prettyPrint bool) jsonMarshaler {\n\tmarshaler := new(jsonpb.Marshaler)\n\tif prettyPrint {\n\t\tmarshaler.Indent = prettyPrintIndent\n\t}\n\treturn func(w io.Writer, response interface{}) error {\n\t\treturn marshaler.Marshal(w, response.(proto.Message))\n\t}\n}", "title": "" }, { "docid": "124bdf30af2ee3e4a4a3263706c427a7", "score": "0.52483636", "text": "func (*ProxyProtocol_Grpc) Descriptor() ([]byte, []int) {\n\treturn file_inbound_proto_rawDescGZIP(), []int{2, 3}\n}", "title": "" }, { "docid": "8870aad12266dd4a48f68076cf604a96", "score": "0.5248209", "text": "func (*Member) Descriptor() ([]byte, []int) {\n\treturn file_proto_model_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "3f2a99820359b27ba678a9175a340daf", "score": "0.524643", "text": "func (*HelloStructResponse) Descriptor() ([]byte, []int) {\n\treturn file_greeter_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "7e6790f52a2fde0e5adec56342def24d", "score": "0.5244779", "text": "func (*HighlyStructuredMessage) Descriptor() ([]byte, []int) {\n\treturn file_binary_proto_def_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "17d2d245b760bf733a5577757f6e9446", "score": "0.5234139", "text": "func (x *fastReflection_SayHelloRequest) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*SayHelloRequest)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tl = len(x.Name)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*SayHelloRequest)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif len(x.Name) > 0 {\n\t\t\ti -= len(x.Name)\n\t\t\tcopy(dAtA[i:], x.Name)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*SayHelloRequest)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: SayHelloRequest: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: SayHelloRequest: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Name\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Name = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "6ebdb33bff513de1bd8c745924d24320", "score": "0.52334815", "text": "func (x *fastReflection_MsgUndelegateResponse) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*MsgUndelegateResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tif x.CompletionTime != nil {\n\t\t\tl = options.Size(x.CompletionTime)\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.Amount != nil {\n\t\t\tl = options.Size(x.Amount)\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*MsgUndelegateResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif x.Amount != nil {\n\t\t\tencoded, err := options.Marshal(x.Amount)\n\t\t\tif err != nil {\n\t\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\t\tBuf: input.Buf,\n\t\t\t\t}, err\n\t\t\t}\n\t\t\ti -= len(encoded)\n\t\t\tcopy(dAtA[i:], encoded)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0x12\n\t\t}\n\t\tif x.CompletionTime != nil {\n\t\t\tencoded, err := options.Marshal(x.CompletionTime)\n\t\t\tif err != nil {\n\t\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\t\tBuf: input.Buf,\n\t\t\t\t}, err\n\t\t\t}\n\t\t\ti -= len(encoded)\n\t\t\tcopy(dAtA[i:], encoded)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*MsgUndelegateResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: MsgUndelegateResponse: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: MsgUndelegateResponse: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field CompletionTime\", wireType)\n\t\t\t\t}\n\t\t\t\tvar msglen int\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif msglen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + msglen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif x.CompletionTime == nil {\n\t\t\t\t\tx.CompletionTime = &timestamppb.Timestamp{}\n\t\t\t\t}\n\t\t\t\tif err := options.Unmarshal(dAtA[iNdEx:postIndex], x.CompletionTime); err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tiNdEx = postIndex\n\t\t\tcase 2:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Amount\", wireType)\n\t\t\t\t}\n\t\t\t\tvar msglen int\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif msglen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + msglen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif x.Amount == nil {\n\t\t\t\t\tx.Amount = &v1beta1.Coin{}\n\t\t\t\t}\n\t\t\t\tif err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount); err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "771bcb8fd1955a3dd37c2d0dbe56dbd5", "score": "0.52232397", "text": "func (*AddMemberResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_groups_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "fd8c339fc40226fd760728ae6cdd4a28", "score": "0.5221931", "text": "func (rrs *rollupRuleSnapshot) proto() (*rulepb.RollupRuleSnapshot, error) {\n\ttags := make([]*metricpb.Tag, 0, len(rrs.tags))\n\tfor _, tag := range rrs.tags {\n\t\ttags = append(tags, tag.ToProto())\n\t}\n\tres := &rulepb.RollupRuleSnapshot{\n\t\tName: rrs.name,\n\t\tTombstoned: rrs.tombstoned,\n\t\tCutoverNanos: rrs.cutoverNanos,\n\t\tFilter: rrs.rawFilter,\n\t\tLastUpdatedAtNanos: rrs.lastUpdatedAtNanos,\n\t\tLastUpdatedBy: rrs.lastUpdatedBy,\n\t\tKeepOriginal: rrs.keepOriginal,\n\t\tTags: tags,\n\t}\n\n\ttargets := make([]*rulepb.RollupTargetV2, len(rrs.targets))\n\tfor i, t := range rrs.targets {\n\t\ttarget, err := t.proto()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttargets[i] = target\n\t}\n\tres.TargetsV2 = targets\n\n\treturn res, nil\n}", "title": "" }, { "docid": "5b6e97e3bcafde295dbcac1a2adaea8f", "score": "0.52168304", "text": "func (gs *GenStruct) add(s *Struct) (err error) {\n\tif t, ok := gs.Structs[s.Name]; ok {\n\t\tvar setOE bool\n\t\tfor name, f := range s.Fields {\n\t\t\tif g, ok := t.Fields[name]; !ok {\n\t\t\t\tt.Fields[name] = s.Fields[name]\n\t\t\t} else {\n\t\t\t\tif !reflect.DeepEqual(f, g) {\n\t\t\t\t\treturn fmt.Errorf(\"Fields differ: %#v != %#v\", f, g)\n\t\t\t\t}\n\t\t\t\tsetOE = true\n\t\t\t}\n\t\t}\n\n\t\tif setOE {\n\t\t\tfor _, f := range t.Fields {\n\t\t\t\tf.OmitEmpty = true\n\t\t\t}\n\t\t}\n\t} else {\n\t\tgs.Structs[s.Name] = s\n\t\tgs.Order = append(gs.Order, s.Name)\n\t}\n\treturn\n}", "title": "" }, { "docid": "d4c7168d8e075e0684ee642650a5bca2", "score": "0.52159226", "text": "func (*NestedProto) Descriptor() ([]byte, []int) {\n\treturn file_examples_internal_proto_examplepb_flow_combination_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "2714c75ed34cd9cf5cae069d3ac0187b", "score": "0.5215136", "text": "func (*StructDomain) Descriptor() ([]byte, []int) {\n\treturn file_tensorflow_metadata_proto_v0_schema_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "ec12b388f96145b05f0eda2e0f0a8664", "score": "0.5211204", "text": "func Struct(rt reflect.Type, gens map[string]gopter.Gen) gopter.Gen {\n\tif rt.Kind() == reflect.Ptr {\n\t\trt = rt.Elem()\n\t}\n\tif rt.Kind() != reflect.Struct {\n\t\treturn Fail(rt)\n\t}\n\treturn func(genParams *gopter.GenParameters) *gopter.GenResult {\n\t\tresult := reflect.New(rt)\n\n\t\tnames := make([]string, len(gens))\n\t\ti := 0\n\t\tfor name := range gens {\n\t\t\tnames[i] = name\n\t\t\ti++\n\t\t}\n\t\tsort.Strings(names)\n\t\tfor _, name := range names {\n\t\t\tgen := gens[name]\n\t\t\tfield, ok := rt.FieldByName(name)\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvalue, ok := gen(genParams).Retrieve()\n\t\t\tif !ok {\n\t\t\t\treturn gopter.NewEmptyResult(rt)\n\t\t\t}\n\t\t\tif value == nil {\n\t\t\t\tresult.Elem().FieldByIndex(field.Index).Set(reflect.Zero(field.Type))\n\t\t\t} else {\n\t\t\t\tresult.Elem().FieldByIndex(field.Index).Set(reflect.ValueOf(value))\n\t\t\t}\n\t\t}\n\n\t\treturn gopter.NewGenResult(reflect.Indirect(result).Interface(), gopter.NoShrinker)\n\t}\n}", "title": "" }, { "docid": "9550790f8a9a450396030f14380e184e", "score": "0.5204214", "text": "func (*Layer1) Descriptor() ([]byte, []int) {\n\treturn file_cmd_protoc_gen_go_peptide_testdata_proto2_nested_messages_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "1d355055ec99680d41ecdf5c501b6520", "score": "0.52035254", "text": "func (*Component) IsYANGGoStruct() {}", "title": "" }, { "docid": "e242cf60afccc9ae2307163b71b4d783", "score": "0.52024055", "text": "func (*NewMessage_Nested) Descriptor() ([]byte, []int) {\n\treturn file_proto2_proto_test_proto_rawDescGZIP(), []int{9, 0}\n}", "title": "" }, { "docid": "3d9787da7a75917e80a086c3fb55033b", "score": "0.5199784", "text": "func (*GroupNew_G) Descriptor() ([]byte, []int) {\n\treturn file_proto2_proto_test_proto_rawDescGZIP(), []int{25, 0}\n}", "title": "" }, { "docid": "a69d53c7d75e9a67cce50df240fb364a", "score": "0.51859474", "text": "func (*GroupOld) Descriptor() ([]byte, []int) {\n\treturn file_proto2_proto_test_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "82317b34881597f7bb959407f6fe576b", "score": "0.5185104", "text": "func (*NetworkInstance_Protocol_Aggregate) IsYANGGoStruct() {}", "title": "" }, { "docid": "82317b34881597f7bb959407f6fe576b", "score": "0.5185104", "text": "func (*NetworkInstance_Protocol_Aggregate) IsYANGGoStruct() {}", "title": "" }, { "docid": "228507117730fa849b9222322f03f246", "score": "0.5179362", "text": "func (*Containment) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_swarming_proto_api_v2_swarming_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "db7edb895bf0abb91f77909f4d9cc1f5", "score": "0.51781905", "text": "func (*Typing) Descriptor() ([]byte, []int) {\n\treturn file_contract_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "fbadc5bde6c982d8503b71b132389a64", "score": "0.51709485", "text": "func Сonvert(from interface{}, kind string, to interface{}) {\n\tif nil == from {\n\t\tlog.Print(\"nil value is not supported\")\n\n\t\treturn\n\t}\n\n\tv := reflect.ValueOf(from)\n\tvt := reflect.ValueOf(to)\n\tt := v.Type()\n\n\tif t.Kind() != reflect.Struct {\n\t\tlog.Printf(\"type %s is not supported\", t.Kind())\n\n\t\treturn\n\t}\n\n\tif vt.Kind() == reflect.Ptr {\n\t\tvt = reflect.ValueOf(to).Elem()\n\t}\n\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tf := t.Field(i)\n\t\t// skip unexported fields. from godoc:\n\t\t// PkgPath is the package path that qualifies a lower case (unexported)\n\t\t// field name. It is empty for upper case (exported) field names.\n\t\tif f.PkgPath != \"\" && f.Name == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tfv := v.Field(i)\n\t\tfound, omit, omitempty := readTag(f, kind)\n\t\t// skip if tag \"omit\" set.\n\t\tif omit {\n\t\t\tcontinue\n\t\t}\n\t\t// skip empty values when \"omitempty\" set.\n\t\tif omitempty && fv.String() == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tif found {\n\t\t\tft := vt.FieldByName(f.Name)\n\t\t\tif f.Name == strings.ToUpper(f.Name) && !ft.IsValid() {\n\t\t\t\t// was uppercase and not valid => to Capitalize first letter\n\t\t\t\tft = vt.FieldByName(strings.Title(strings.ToLower(f.Name)))\n\t\t\t}\n\n\t\t\tif !ft.IsValid() && fv.Kind() == reflect.Struct {\n\t\t\t\tСonvert(fv.Interface(), kind, to)\n\t\t\t} else {\n\t\t\t\tif ft.IsValid() {\n\t\t\t\t\tswitch f.Type.String() {\n\t\t\t\t\tcase \"uuid.UUID\":\n\t\t\t\t\t\tmv := fv.Interface().(uuid.UUID)\n\t\t\t\t\t\tif ft.Type().String() == \"uuid.UUID\" {\n\t\t\t\t\t\t\tft.Set(fv)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tft.SetString(mv.String())\n\t\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tft.Set(fv)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0571b7723676dae3a0219818ae841f9d", "score": "0.51694274", "text": "func ToProtoStruct(v interface{}) (*structpb.Struct, error) {\n\tif v == nil {\n\t\treturn &structpb.Struct{}, nil\n\t}\n\n\t// Fast path: if v is already a *structpb.Struct, nothing to do.\n\tif s, ok := v.(*structpb.Struct); ok {\n\t\treturn s, nil\n\t}\n\n\tvar jb []byte\n\tswitch v.(type) {\n\tcase []byte:\n\t\tjb = v.([]byte)\n\tcase *[]byte:\n\t\tjb = *(v.(*[]byte))\n\tcase string:\n\t\tjb = []byte(v.(string))\n\tcase *string:\n\t\tjb = []byte(*(v.(*string)))\n\tcase proto.Message:\n\t\t// v is a Go struct that supports JSON marshalling. We want a Struct\n\t\t// protobuf. Some day we may have a more direct way to get there, but right\n\t\t// now the only way is to marshal the Go struct to JSON, unmarshal into a\n\t\t// map, and then build the Struct proto from the map.\n\t\tm := jsonpb.Marshaler{EmitDefaults: true}\n\t\tdataStr, err := m.MarshalToString(v.(proto.Message))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"jsonpb.Marshal: %v\", err)\n\t\t}\n\t\tjb = []byte(dataStr)\n\tdefault:\n\t\tvar err error\n\t\tjb, err = json.Marshal(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"jsonpb.Marshal: %v\", err)\n\t\t}\n\t}\n\n\tvar dataStructpb structpb.Struct\n\n\tif err := jsonpb.Unmarshal(bytes.NewReader(jb), &dataStructpb); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &dataStructpb, nil\n}", "title": "" }, { "docid": "b703f4bc02aed0eb58c842cb7b5ac679", "score": "0.516717", "text": "func (*Member) Descriptor() ([]byte, []int) {\n\treturn file_protos_skeen_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "1a62fd45207ff5283e8f07abfd805d20", "score": "0.51670575", "text": "func (x *fastReflection_NestedSigner_Inner) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*NestedSigner_Inner)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tl = len(x.Signer)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*NestedSigner_Inner)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif len(x.Signer) > 0 {\n\t\t\ti -= len(x.Signer)\n\t\t\tcopy(dAtA[i:], x.Signer)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.Signer)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*NestedSigner_Inner)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: NestedSigner_Inner: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: NestedSigner_Inner: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Signer\", wireType)\n\t\t\t\t}\n\t\t\t\tvar stringLen uint64\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tintStringLen := int(stringLen)\n\t\t\t\tif intStringLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Signer = string(dAtA[iNdEx:postIndex])\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "1df20a833a9422888c9f14a07186d701", "score": "0.51655936", "text": "func (*ComplexExtension) Descriptor() ([]byte, []int) {\n\treturn file_proto2_proto_test_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "0ba20641b42ad573c09ae8e6df84a71f", "score": "0.5161495", "text": "func (x *fastReflection_EchoResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"testpb.EchoResponse.message\":\n\t\tpanic(fmt.Errorf(\"field message of message testpb.EchoResponse is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: testpb.EchoResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message testpb.EchoResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "6e141f729fd2140e7aa8299df5472ded", "score": "0.515712", "text": "func (x *fastReflection_TestAnyResponse) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*TestAnyResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tif x.HasAnimal != nil {\n\t\t\tl = options.Size(x.HasAnimal)\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*TestAnyResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif x.HasAnimal != nil {\n\t\t\tencoded, err := options.Marshal(x.HasAnimal)\n\t\t\tif err != nil {\n\t\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\t\tBuf: input.Buf,\n\t\t\t\t}, err\n\t\t\t}\n\t\t\ti -= len(encoded)\n\t\t\tcopy(dAtA[i:], encoded)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*TestAnyResponse)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: TestAnyResponse: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: TestAnyResponse: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field HasAnimal\", wireType)\n\t\t\t\t}\n\t\t\t\tvar msglen int\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif msglen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + msglen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif x.HasAnimal == nil {\n\t\t\t\t\tx.HasAnimal = &HasAnimal{}\n\t\t\t\t}\n\t\t\t\tif err := options.Unmarshal(dAtA[iNdEx:postIndex], x.HasAnimal); err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "f08f67f525c9ad5ecb2685593fe6e247", "score": "0.51569384", "text": "func (*MyMessage) Descriptor() ([]byte, []int) {\n\treturn file_proto2_proto_test_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "d4e4cc61dc15fa4b0828995ba27ee18a", "score": "0.51568294", "text": "func (*Testschema_Target_Entity) IsYANGGoStruct() {}", "title": "" }, { "docid": "c1e2e3bf6ffad4a7b6af5f031202007f", "score": "0.5156059", "text": "func (*Component_Property) IsYANGGoStruct() {}", "title": "" }, { "docid": "99ae87f93017e5b0987e771359c82ace", "score": "0.51536953", "text": "func (*OldMessage) Descriptor() ([]byte, []int) {\n\treturn file_proto2_proto_test_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "3d27e7ec33d9949b4d78dac72ec4f4b5", "score": "0.5147501", "text": "func Rewrite(in proto.Message) proto.Message {\n\tswitch msg := in.(type) {\n\tcase *envoy_api_v2.ClusterLoadAssignment:\n\t\treturn msg\n\tcase *envoy_api_auth_v2.Secret:\n\t\treturn msg\n\n\tcase *envoy_api_v2.Cluster:\n\t\tif e := msg.GetEdsClusterConfig(); e != nil {\n\t\t\trewriteConfigSource(e.GetEdsConfig())\n\t\t}\n\n\t\tif t := msg.GetTransportSocket(); t != nil {\n\t\t\trewriteAnyMessage(t.GetTypedConfig())\n\t\t}\n\n\t\treturn msg\n\n\tcase *envoy_api_v2.RouteConfiguration:\n\t\tfor _, v := range msg.GetVirtualHosts() {\n\t\t\tfor _, r := range v.GetRoutes() {\n\t\t\t\tfor _, conf := range r.GetTypedPerFilterConfig() {\n\t\t\t\t\trewriteAnyMessage(conf)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn msg\n\n\tcase *envoy_api_v2.Listener:\n\t\tfor _, filter := range msg.ListenerFilters {\n\t\t\trewriteAnyMessage(filter.GetTypedConfig())\n\t\t}\n\n\t\tfor _, chain := range msg.FilterChains {\n\t\t\tfor _, filter := range chain.Filters {\n\t\t\t\trewriteAnyMessage(filter.GetTypedConfig())\n\t\t\t}\n\n\t\t\tif t := chain.GetTransportSocket(); t != nil {\n\t\t\t\trewriteAnyMessage(t.GetTypedConfig())\n\t\t\t}\n\t\t}\n\n\t\tfor _, a := range msg.AccessLog {\n\t\t\trewriteAnyMessage(a.GetTypedConfig())\n\t\t}\n\n\t\treturn msg\n\n\tcase *envoy_config_filter_network_http_connection_manager_v2.HttpConnectionManager:\n\t\tif r := msg.GetRds(); r != nil {\n\t\t\trewriteConfigSource(r.GetConfigSource())\n\t\t}\n\n\t\tfor _, f := range msg.HttpFilters {\n\t\t\trewriteAnyMessage(f.GetTypedConfig())\n\t\t}\n\n\t\tfor _, l := range msg.AccessLog {\n\t\t\trewriteAnyMessage(l.GetTypedConfig())\n\t\t}\n\n\t\treturn msg\n\n\tcase *envoy_api_auth_v2.DownstreamTlsContext:\n\t\tfor _, s := range msg.GetCommonTlsContext().TlsCertificateSdsSecretConfigs {\n\t\t\trewriteConfigSource(s.GetSdsConfig())\n\t\t}\n\n\t\treturn msg\n\n\tcase *envoy_api_auth_v2.UpstreamTlsContext:\n\t\tfor _, s := range msg.GetCommonTlsContext().TlsCertificateSdsSecretConfigs {\n\t\t\trewriteConfigSource(s.GetSdsConfig())\n\t\t}\n\n\t\treturn msg\n\n\tdefault:\n\t\t// Any messages that don't have any embedded version information\n\t\t// that needs conversion can just be returned unchanged.\n\t\treturn msg\n\t}\n}", "title": "" }, { "docid": "e1253c1e0e5246f379e9fcfe1e7f1811", "score": "0.51424116", "text": "func (*TransitionToObserverRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_HAServiceProtocol_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "3d7b059b47e922b21a95d25500ca7d91", "score": "0.51421094", "text": "func (*Component_Fan) IsYANGGoStruct() {}", "title": "" }, { "docid": "e51c8b8e13b47a6cac6a982063f2c5ff", "score": "0.513924", "text": "func (*Component_Transceiver) IsYANGGoStruct() {}", "title": "" }, { "docid": "eba589365d212d98a4298012beb5d11f", "score": "0.512854", "text": "func (x *fastReflection_BadSigner) ProtoMethods() *protoiface.Methods {\n\tsize := func(input protoiface.SizeInput) protoiface.SizeOutput {\n\t\tx := input.Message.Interface().(*BadSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.SizeOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tSize: 0,\n\t\t\t}\n\t\t}\n\t\toptions := runtime.SizeInputToOptions(input)\n\t\t_ = options\n\t\tvar n int\n\t\tvar l int\n\t\t_ = l\n\t\tl = len(x.Signer)\n\t\tif l > 0 {\n\t\t\tn += 1 + l + runtime.Sov(uint64(l))\n\t\t}\n\t\tif x.unknownFields != nil {\n\t\t\tn += len(x.unknownFields)\n\t\t}\n\t\treturn protoiface.SizeOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tSize: n,\n\t\t}\n\t}\n\n\tmarshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\t\tx := input.Message.Interface().(*BadSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.MarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tBuf: input.Buf,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.MarshalInputToOptions(input)\n\t\t_ = options\n\t\tsize := options.Size(x)\n\t\tdAtA := make([]byte, size)\n\t\ti := len(dAtA)\n\t\t_ = i\n\t\tvar l int\n\t\t_ = l\n\t\tif x.unknownFields != nil {\n\t\t\ti -= len(x.unknownFields)\n\t\t\tcopy(dAtA[i:], x.unknownFields)\n\t\t}\n\t\tif len(x.Signer) > 0 {\n\t\t\ti -= len(x.Signer)\n\t\t\tcopy(dAtA[i:], x.Signer)\n\t\t\ti = runtime.EncodeVarint(dAtA, i, uint64(len(x.Signer)))\n\t\t\ti--\n\t\t\tdAtA[i] = 0xa\n\t\t}\n\t\tif input.Buf != nil {\n\t\t\tinput.Buf = append(input.Buf, dAtA...)\n\t\t} else {\n\t\t\tinput.Buf = dAtA\n\t\t}\n\t\treturn protoiface.MarshalOutput{\n\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\tBuf: input.Buf,\n\t\t}, nil\n\t}\n\tunmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\t\tx := input.Message.Interface().(*BadSigner)\n\t\tif x == nil {\n\t\t\treturn protoiface.UnmarshalOutput{\n\t\t\t\tNoUnkeyedLiterals: input.NoUnkeyedLiterals,\n\t\t\t\tFlags: input.Flags,\n\t\t\t}, nil\n\t\t}\n\t\toptions := runtime.UnmarshalInputToOptions(input)\n\t\t_ = options\n\t\tdAtA := input.Buf\n\t\tl := len(dAtA)\n\t\tiNdEx := 0\n\t\tfor iNdEx < l {\n\t\t\tpreIndex := iNdEx\n\t\t\tvar wire uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tfieldNum := int32(wire >> 3)\n\t\t\twireType := int(wire & 0x7)\n\t\t\tif wireType == 4 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: BadSigner: wiretype end group for non-group\")\n\t\t\t}\n\t\t\tif fieldNum <= 0 {\n\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: BadSigner: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t\t}\n\t\t\tswitch fieldNum {\n\t\t\tcase 1:\n\t\t\t\tif wireType != 2 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf(\"proto: wrong wireType = %d for field Signer\", wireType)\n\t\t\t\t}\n\t\t\t\tvar byteLen int\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tbyteLen |= int(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif byteLen < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + byteLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tx.Signer = append(x.Signer[:0], dAtA[iNdEx:postIndex]...)\n\t\t\t\tif x.Signer == nil {\n\t\t\t\t\tx.Signer = []byte{}\n\t\t\t\t}\n\t\t\t\tiNdEx = postIndex\n\t\t\tdefault:\n\t\t\t\tiNdEx = preIndex\n\t\t\t\tskippy, err := runtime.Skip(dAtA[iNdEx:])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err\n\t\t\t\t}\n\t\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength\n\t\t\t\t}\n\t\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tif !options.DiscardUnknown {\n\t\t\t\t\tx.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\t\t}\n\t\t\t\tiNdEx += skippy\n\t\t\t}\n\t\t}\n\n\t\tif iNdEx > l {\n\t\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF\n\t\t}\n\t\treturn protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil\n\t}\n\treturn &protoiface.Methods{\n\t\tNoUnkeyedLiterals: struct{}{},\n\t\tFlags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,\n\t\tSize: size,\n\t\tMarshal: marshal,\n\t\tUnmarshal: unmarshal,\n\t\tMerge: nil,\n\t\tCheckInitialized: nil,\n\t}\n}", "title": "" }, { "docid": "cd14dc00c0c43711a058e6ea84f4ea7b", "score": "0.5118545", "text": "func (*UsedStruct) UsedInPackageMethod() {}", "title": "" } ]
645fdc992329c329133848ef0c8a01ab
SetFolderId sets the FolderId field's value.
[ { "docid": "05da9282a70f997c6571f9533e5bfbf9", "score": "0.8180919", "text": "func (s *DeleteFolderOutput) SetFolderId(v string) *DeleteFolderOutput {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" } ]
[ { "docid": "ce5dada788b8b029dc8d9d66b4410d12", "score": "0.8537978", "text": "func (s *UpdateFolderOutput) SetFolderId(v string) *UpdateFolderOutput {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" }, { "docid": "66daa6b6ee97ea5445f0935c458b958d", "score": "0.8503225", "text": "func (s *UpdateFolderInput) SetFolderId(v string) *UpdateFolderInput {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" }, { "docid": "e59adf69dbe305784c8703a2d3ec8415", "score": "0.84997606", "text": "func (s *UpdateFolderPermissionsOutput) SetFolderId(v string) *UpdateFolderPermissionsOutput {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" }, { "docid": "fb218a6bb34ee18144b47f0da00ebe54", "score": "0.844406", "text": "func (s *UpdateFolderPermissionsInput) SetFolderId(v string) *UpdateFolderPermissionsInput {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" }, { "docid": "6151b017509813b5fba1021b5147a15e", "score": "0.8429701", "text": "func (s *CreateFolderMembershipInput) SetFolderId(v string) *CreateFolderMembershipInput {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" }, { "docid": "6d4becf21fa248d18ea4663e61302cc8", "score": "0.8382168", "text": "func (s *DescribeFolderPermissionsOutput) SetFolderId(v string) *DescribeFolderPermissionsOutput {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" }, { "docid": "464c9a24f59276a27032312057d61de8", "score": "0.836157", "text": "func (s *ListFolderMembersInput) SetFolderId(v string) *ListFolderMembersInput {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" }, { "docid": "46bba71dfb1d0b20c81743e1df6dffa3", "score": "0.83299196", "text": "func (s *DescribeFolderResolvedPermissionsOutput) SetFolderId(v string) *DescribeFolderResolvedPermissionsOutput {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" }, { "docid": "4f366ba1a08767beadab97d33d2fb717", "score": "0.8329539", "text": "func (s *DescribeFolderPermissionsInput) SetFolderId(v string) *DescribeFolderPermissionsInput {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" }, { "docid": "86c0ed37eb1f64b3e89711d476cf3412", "score": "0.83212656", "text": "func (s *DescribeFolderInput) SetFolderId(v string) *DescribeFolderInput {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" }, { "docid": "86ad578545af6ebf6b24bb6c513ffe59", "score": "0.8308209", "text": "func (s *FolderSummary) SetFolderId(v string) *FolderSummary {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" }, { "docid": "b15008e82933281fa6f7c264b920d10a", "score": "0.830469", "text": "func (s *DescribeFolderResolvedPermissionsInput) SetFolderId(v string) *DescribeFolderResolvedPermissionsInput {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" }, { "docid": "8d96d9fa7b49d695e21e535f5632fd12", "score": "0.8284604", "text": "func (s *CreateFolderOutput) SetFolderId(v string) *CreateFolderOutput {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" }, { "docid": "6f140401579665625ae9027289ff2b8e", "score": "0.8272194", "text": "func (s *DeleteFolderMembershipInput) SetFolderId(v string) *DeleteFolderMembershipInput {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" }, { "docid": "c008131212edf8f4a663ff5864d39946", "score": "0.8265389", "text": "func (s *Folder) SetFolderId(v string) *Folder {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" }, { "docid": "8748c05072c4860efd9d240456d11450", "score": "0.82616806", "text": "func (s *CreateFolderInput) SetFolderId(v string) *CreateFolderInput {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" }, { "docid": "ceb62f7702cbaf9335b203d67aae1736", "score": "0.8076982", "text": "func (s *DeleteFolderInput) SetFolderId(v string) *DeleteFolderInput {\n\ts.FolderId = &v\n\treturn s\n}", "title": "" }, { "docid": "96bed102319753f99d610fe097b6c715", "score": "0.80431545", "text": "func (s *MessagesSearchGlobalRequest) SetFolderID(value int) {\n\ts.Flags.Set(0)\n\ts.FolderID = value\n}", "title": "" }, { "docid": "96bed102319753f99d610fe097b6c715", "score": "0.80431545", "text": "func (s *MessagesSearchGlobalRequest) SetFolderID(value int) {\n\ts.Flags.Set(0)\n\ts.FolderID = value\n}", "title": "" }, { "docid": "a1cf1de1fd85449bc56549f3a4ba9cdc", "score": "0.7922855", "text": "func (u *UpdateReadChannelInbox) SetFolderID(value int) {\n\tu.Flags.Set(0)\n\tu.FolderID = value\n}", "title": "" }, { "docid": "77cb626abf4b1c57727edcd4e0e7c26f", "score": "0.79083484", "text": "func (u *UpdateDialogPinned) SetFolderID(value int) {\n\tu.Flags.Set(1)\n\tu.FolderID = value\n}", "title": "" }, { "docid": "6a11693dd1edc4a1fd96c9a1b0840ecf", "score": "0.7874619", "text": "func (u *UpdateReadHistoryInbox) SetFolderID(value int) {\n\tu.Flags.Set(0)\n\tu.FolderID = value\n}", "title": "" }, { "docid": "21de3b3a12f37269c33d3fb341e29fe1", "score": "0.78699774", "text": "func (u *UpdatePinnedDialogs) SetFolderID(value int) {\n\tu.Flags.Set(1)\n\tu.FolderID = value\n}", "title": "" }, { "docid": "d54d613f5c2f7cc8773015f643b28d95", "score": "0.7701493", "text": "func (g *MessagesGetDialogsRequest) SetFolderID(value int) {\n\tg.Flags.Set(1)\n\tg.FolderID = value\n}", "title": "" }, { "docid": "3079d6b3d8b53e69073ca868ec1c48c3", "score": "0.6746096", "text": "func (a *Client) PutUserFolderFolderID(params *PutUserFolderFolderIDParams) (*PutUserFolderFolderIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPutUserFolderFolderIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PutUserFolderFolderID\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/user/folder/{folder_id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PutUserFolderFolderIDReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PutUserFolderFolderIDOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for PutUserFolderFolderID: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "d86277e72c0d91a7432973916325265b", "score": "0.6346646", "text": "func (u *UpdateReadHistoryInbox) GetFolderID() (value int, ok bool) {\n\tif u == nil {\n\t\treturn\n\t}\n\tif !u.Flags.Has(0) {\n\t\treturn value, false\n\t}\n\treturn u.FolderID, true\n}", "title": "" }, { "docid": "a52957519275891f66e4e61573c605da", "score": "0.6335996", "text": "func (u *UpdateReadChannelInbox) GetFolderID() (value int, ok bool) {\n\tif u == nil {\n\t\treturn\n\t}\n\tif !u.Flags.Has(0) {\n\t\treturn value, false\n\t}\n\treturn u.FolderID, true\n}", "title": "" }, { "docid": "679d12d9dea244f124454ed3b934b055", "score": "0.63035107", "text": "func (m *AndroidDeviceOwnerKioskModeManagedFolderReference) SetFolderIdentifier(value *string)() {\n err := m.GetBackingStore().Set(\"folderIdentifier\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "efbb72d9b9645d27ea7856ce4e0fa917", "score": "0.62126446", "text": "func (o DataSetFieldFolderOutput) FieldFoldersId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DataSetFieldFolder) string { return v.FieldFoldersId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "479b4fca2534c0dca3e15302c4e71dbf", "score": "0.61959463", "text": "func (s *MessagesSearchGlobalRequest) GetFolderID() (value int, ok bool) {\n\tif !s.Flags.Has(0) {\n\t\treturn value, false\n\t}\n\treturn s.FolderID, true\n}", "title": "" }, { "docid": "f5fa8ef0d43bef8cb6ced4ef0c45f42e", "score": "0.6193957", "text": "func (c *Client) Folder(id int64) (*Folder, error) {\n\tfolder := &Folder{}\n\terr := c.request(\"GET\", fmt.Sprintf(\"/api/folders/id/%d\", id), nil, nil, folder)\n\tif err != nil {\n\t\treturn folder, err\n\t}\n\n\treturn folder, err\n}", "title": "" }, { "docid": "f5fa8ef0d43bef8cb6ced4ef0c45f42e", "score": "0.6193957", "text": "func (c *Client) Folder(id int64) (*Folder, error) {\n\tfolder := &Folder{}\n\terr := c.request(\"GET\", fmt.Sprintf(\"/api/folders/id/%d\", id), nil, nil, folder)\n\tif err != nil {\n\t\treturn folder, err\n\t}\n\n\treturn folder, err\n}", "title": "" }, { "docid": "7662208cb879f4aece3e1b1811d7fc9d", "score": "0.61351526", "text": "func (o *GeneratedUploadURLParams) SetFolder(folder string) {\n\to.Folder = folder\n}", "title": "" }, { "docid": "7de04024fe5ab28badd6854f09441b51", "score": "0.61301756", "text": "func (r *Client) SetFolder(folder GrafanaFolder, overwrite bool) (GrafanaFolder, error) {\n\tvar (\n\t\tfo GrafanaFolder\n\t\terr error\n\t)\n\t// search for the folder by UID\n\tif fo, err = r.GetFolder(folder.UID); err != nil {\n\t\treturn GrafanaFolder{}, fmt.Errorf(\"Could not check if folder %s exists: %w\", folder.UID, err)\n\t}\n\n\tif fo.UID == \"\" {\n\t\t// folder doesn't exist\n\t\tfmt.Printf(\"Creating new folder %s (%s)\", folder.Title, folder.UID)\n\t\treturn r.createFolder(folder.UID, folder.Title)\n\t}\n\n\t// check that we actually need to update something\n\tif fo.Title != folder.Title {\n\t\treturn r.updateFolder(folder.UID, folder.Title, folder.Version, overwrite)\n\t}\n\n\t// return the upstream folder, it has the correct folderId\n\treturn fo, nil\n}", "title": "" }, { "docid": "947d3f1e3f7ab6978bc4a90ff91bee09", "score": "0.6115271", "text": "func (s *MessagesSearchGlobalRequest) GetFolderID() (value int, ok bool) {\n\tif s == nil {\n\t\treturn\n\t}\n\tif !s.Flags.Has(0) {\n\t\treturn value, false\n\t}\n\treturn s.FolderID, true\n}", "title": "" }, { "docid": "d1b7259d8fa034b09823252855d39a25", "score": "0.60659593", "text": "func (u *UpdatePinnedDialogs) GetFolderID() (value int, ok bool) {\n\tif u == nil {\n\t\treturn\n\t}\n\tif !u.Flags.Has(1) {\n\t\treturn value, false\n\t}\n\treturn u.FolderID, true\n}", "title": "" }, { "docid": "434bd352e2941bf4e06d2135fea85878", "score": "0.60532254", "text": "func (u *UpdateDialogPinned) GetFolderID() (value int, ok bool) {\n\tif u == nil {\n\t\treturn\n\t}\n\tif !u.Flags.Has(1) {\n\t\treturn value, false\n\t}\n\treturn u.FolderID, true\n}", "title": "" }, { "docid": "9bae286ccd2725f410f5fb8ebb478eef", "score": "0.5877063", "text": "func (g *MessagesGetDialogsRequest) GetFolderID() (value int, ok bool) {\n\tif g == nil {\n\t\treturn\n\t}\n\tif !g.Flags.Has(1) {\n\t\treturn value, false\n\t}\n\treturn g.FolderID, true\n}", "title": "" }, { "docid": "a2942328ca8bf0b3a5c68642b4e908ca", "score": "0.57898206", "text": "func (s *DescribeFolderOutput) SetFolder(v *Folder) *DescribeFolderOutput {\n\ts.Folder = v\n\treturn s\n}", "title": "" }, { "docid": "bd3baf0fe5fd930aa765527978baa3c0", "score": "0.57673067", "text": "func NewFolder(Id string, Name string) *Folder {\n\ts := new(Folder)\n\ts.Id = Id\n\ts.Name = Name\n\treturn s\n}", "title": "" }, { "docid": "ce474706a5879e8d29c0b8d41c0acd72", "score": "0.57385224", "text": "func (bw *BW) SetFoldersIDs(foldersNames []string) error {\n\tfor _, name := range foldersNames {\n\t\tvar results []FolderSearch\n\t\terr := common.ExecCLI(bwBinary, []string{\n\t\t\t\"list\", \"folders\", \"--search\", name,\n\t\t}, &results)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"env-secrets error: an error occured while setting folderIDs: %v\", err)\n\t\t}\n\t\tif len(results) == 0 {\n\t\t\treturn fmt.Errorf(\"env-secrets error: unable to match folder with name %s\", name)\n\t\t}\n\t\tbw.foldersIDs = append(bw.foldersIDs, results[0].ID)\n\t\tlog.Debugf(\"Folder ID found: %s\\n\", results[0].ID)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "10613dc4f1a27fc8d3624324118eba24", "score": "0.5734746", "text": "func (r *UpdateIndividualFirewallRuleRequest) SetId(id string) {\n r.Id = id\n}", "title": "" }, { "docid": "2e135c0a4f6d767c3dc373813f16c6ac", "score": "0.5726053", "text": "func (o *ViewUserDashboardPanelSetting) SetId(v int32) {\n\to.Id = &v\n}", "title": "" }, { "docid": "7d68343e4774efbdd52d8e933c660bea", "score": "0.5710554", "text": "func (o *SearchResultGroupDTO) SetId(v string) {\n\to.Id = v\n}", "title": "" }, { "docid": "4abfafe46f4a11879d1f88593e7a4014", "score": "0.56723833", "text": "func (o *RuleRead) SetId(v string) {\n\to.Id = v\n}", "title": "" }, { "docid": "f7fc4a44f9d443c9e69ace8fd97a71f6", "score": "0.56713897", "text": "func (o *ListWorkspaceUsersWithMemberData) SetId(v int32) {\n\to.Id = v\n}", "title": "" }, { "docid": "509f1762e0723af111c42fc4c21aa68b", "score": "0.5661921", "text": "func (c *Client) UpdateFolder(id string, name string) error {\n\tdataMap := map[string]string{\n\t\t\"name\": name,\n\t}\n\tdata, err := json.Marshal(dataMap)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.request(\"PUT\", fmt.Sprintf(\"/api/folders/%s\", id), nil, bytes.NewBuffer(data), nil)\n}", "title": "" }, { "docid": "5d53ea95400d9057108071d851604293", "score": "0.5632578", "text": "func (a *Client) DeleteUserFolderFolderID(params *DeleteUserFolderFolderIDParams) (*DeleteUserFolderFolderIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteUserFolderFolderIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"DeleteUserFolderFolderID\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/user/folder/{folder_id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteUserFolderFolderIDReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*DeleteUserFolderFolderIDOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for DeleteUserFolderFolderID: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "c6c6c88f70d96bc7f6cdfe1ae448e17c", "score": "0.5593827", "text": "func (s *OpenZFSUserOrGroupQuota) SetId(v int64) *OpenZFSUserOrGroupQuota {\n\ts.Id = &v\n\treturn s\n}", "title": "" }, { "docid": "65f3f6dcf49b064181d99c35735242c5", "score": "0.5589176", "text": "func (c *Client) SetRecordingFolder(\n\tparams *SetRecordingFolderParams,\n) (*SetRecordingFolderResponse, error) {\n\tdata := &SetRecordingFolderResponse{}\n\tif err := c.SendRequest(params, data); err != nil {\n\t\treturn nil, err\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "22f271c2bec4c29e01e7e86917c18cda", "score": "0.55879897", "text": "func (c *Config) SetFolderName() (err error) {\n\tcolor.Cyan(`Set folders' name`)\n\tcolor.Cyan(`Enter empty line if you don't want to change the value`)\n\tcolor.Green(`Root path (current: %v)`, c.FolderName[\"root\"])\n\tif value := util.ScanlineTrim(); value != \"\" {\n\t\tc.FolderName[\"root\"] = value\n\t}\n\tfor _, problemType := range client.ProblemTypes {\n\t\tcolor.Green(`%v path (current: %v)`, problemType, c.FolderName[problemType])\n\t\tif value := util.ScanlineTrim(); value != \"\" {\n\t\t\tc.FolderName[problemType] = value\n\t\t}\n\t}\n\treturn c.save()\n}", "title": "" }, { "docid": "8ec93558c24c7ae65f77840aee3fee90", "score": "0.5577308", "text": "func (f *Field) SetId(id string) FieldInterface {\n\tf.id = id\n\treturn f\n}", "title": "" }, { "docid": "195cdfce94443195affe0f2803d489d2", "score": "0.5552019", "text": "func (c *Client) UpdateFolder(ctx context.Context, folderID string, folder Folder) (*Folder, error) {\n\tmsg, err := c.DoCustomRequest(ctx, \"PUT\", \"/folders/\"+folderID+\".json\", \"v2\", folder, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = json.Unmarshal(msg.Body, &folder)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &folder, nil\n}", "title": "" }, { "docid": "9ff6a0b1691668da8a89256f99dc63d7", "score": "0.55371946", "text": "func (e *EditChatFolderInviteLinkRequest) GetChatFolderID() (value int32) {\n\tif e == nil {\n\t\treturn\n\t}\n\treturn e.ChatFolderID\n}", "title": "" }, { "docid": "fdadcc5a7a58747578dc30b82a3cac8f", "score": "0.5504608", "text": "func (o *ViewUserDashboardPanel) SetId(v int32) {\n\to.Id = &v\n}", "title": "" }, { "docid": "34bd468794f69224dd9612e1ed37af91", "score": "0.5492096", "text": "func (c *FilesEmptyTrashCall) DriveId(driveId string) *FilesEmptyTrashCall {\n\tc.urlParams_.Set(\"driveId\", driveId)\n\treturn c\n}", "title": "" }, { "docid": "699a6562dda63a6450a2dac708c180cd", "score": "0.54887", "text": "func (o *SearchAllFood200ResponseSearchResultsInnerResultsInner) SetId(v string) {\n\to.Id = v\n}", "title": "" }, { "docid": "99dfbb3517c6058ada80f569160d481f", "score": "0.54756343", "text": "func (m *AndroidDeviceOwnerKioskModeManagedFolderReference) SetFolderName(value *string)() {\n err := m.GetBackingStore().Set(\"folderName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "36621ec6741e606c816795a2dede4121", "score": "0.5473072", "text": "func (o *JsonMDNSetting) SetId(v string) {\n\to.Id = &v\n}", "title": "" }, { "docid": "5169749bcea56446a16b433068985e60", "score": "0.54691416", "text": "func (n *node) SetId(i int) {\n\tn.id = i\n}", "title": "" }, { "docid": "5a304cbe6e8d99545d416aabd9360769", "score": "0.5461539", "text": "func (o *DashboardList) SetId(v int64) {\n\to.Id = &v\n}", "title": "" }, { "docid": "928e0b19901170755a13b17f36a9b900", "score": "0.54580456", "text": "func (o *BaseNotificationWebhook) SetId(v int32) {\n\to.Id = v\n}", "title": "" }, { "docid": "648dcd81ea6b477a3395d5b343762968", "score": "0.5440874", "text": "func (o *LedDTO) SetId(v int64) {\n\to.Id = &v\n}", "title": "" }, { "docid": "ef260cad8911d7a51b26f32d3f6b2523", "score": "0.54321873", "text": "func (m *Monitor) SetId(v int) {\n\tm.Id = &v\n}", "title": "" }, { "docid": "5e9ed081bfd9597d6c510aff83137aa3", "score": "0.54305404", "text": "func (o *RealmPlayground) SetId(v int32) {\n\to.Id = &v\n}", "title": "" }, { "docid": "4543d86a8d12a8a8f6cbfa30e14b80f0", "score": "0.541421", "text": "func (o *DashboardUser) SetId(v string) {\n\to.Id = v\n}", "title": "" }, { "docid": "32faf5e038d9bd36731c7e9f67be0e3d", "score": "0.5404476", "text": "func (r *QuerywafBlackRulesRequest) SetId(id string) {\n r.Id = &id\n}", "title": "" }, { "docid": "9ae8de05c6efb8f030ef014c303cdf87", "score": "0.5401361", "text": "func (o *UserDTO) SetId(v string) {\n\to.Id = &v\n}", "title": "" }, { "docid": "f9b92bd139075d05d5c49852bb7bf66a", "score": "0.5391595", "text": "func (o *WatchlistScreeningReview) SetId(v string) {\n\to.Id = v\n}", "title": "" }, { "docid": "73f62ded207fde3ff5ddc61825dbd142", "score": "0.53833663", "text": "func (o *Token) SetId(v int32) {\n\to.Id = v\n}", "title": "" }, { "docid": "1260f3234b5dcf779baade16574cbac4", "score": "0.53711134", "text": "func (o *Monitor) SetId(v string) {\n\to.Id = v\n}", "title": "" }, { "docid": "c5667b48f0377984607f73a87cfdb3ad", "score": "0.53468174", "text": "func (d *Dashboard) SetId(v int) {\n\td.Id = &v\n}", "title": "" }, { "docid": "7d7831c28286ffb569cdb88412244b4e", "score": "0.53319114", "text": "func (o *MetricsInstantQueryListAllOf) SetId(v string) {\n\to.Id = &v\n}", "title": "" }, { "docid": "0dd4dcac0a86df82bf5422edbb1c6de6", "score": "0.5331239", "text": "func (o *FechaduraDTO) SetId(v int64) {\n\to.Id = &v\n}", "title": "" }, { "docid": "865dc894276f6cc1de01d40c2dfdce6b", "score": "0.53257304", "text": "func (s *FileSystem) SetFileSystemId(v string) *FileSystem {\n\ts.FileSystemId = &v\n\treturn s\n}", "title": "" }, { "docid": "fe4d5c37391d5e0eb5fe3831988f8b1f", "score": "0.53199273", "text": "func (o *ViewCustomField) SetId(v int32) {\n\to.Id = &v\n}", "title": "" }, { "docid": "bf9552ade23fcb30ded9a10a98e87b0d", "score": "0.530685", "text": "func (o *SkuRules) SetQuotaId(v string) {\n\to.QuotaId = &v\n}", "title": "" }, { "docid": "915db825efb1b00827de3c1eae24b6f7", "score": "0.53065735", "text": "func (o *EnvironmentDeploymentRuleResponse) SetId(v string) {\n\to.Id = v\n}", "title": "" }, { "docid": "a20e8318c2ca26001d65698f270a2375", "score": "0.5297506", "text": "func (o *ActivityRule) SetId(v string) {\n\to.Id = &v\n}", "title": "" }, { "docid": "9c871c93b8186a42f10c3963b9134ff5", "score": "0.5289717", "text": "func (o *FindingRule) SetId(v string) {\n\to.Id = &v\n}", "title": "" }, { "docid": "0e820684a4b358275282947176ab1c0b", "score": "0.52883077", "text": "func (s *Service) Folder(c context.Context, typ int8, mid, uid, fid int64) (folder *model.Folder, err error) {\n\tif uid > 0 && mid != uid {\n\t\tmid = uid\n\t}\n\tif folder, err = s.folder(c, typ, mid, fid); err != nil {\n\t\treturn\n\t}\n\tfolder.Cover = model.CompleteURL(folder.Cover)\n\treturn\n}", "title": "" }, { "docid": "9c5e7e8902b4755af8445a1bd988ec35", "score": "0.5288037", "text": "func (s *CreateFolderInput) SetFolderType(v string) *CreateFolderInput {\n\ts.FolderType = &v\n\treturn s\n}", "title": "" }, { "docid": "4f4f5c0feaf80584486a3e5fe1917946", "score": "0.52843314", "text": "func (o *Error) SetId(v string) {\n\to.Id = &v\n}", "title": "" }, { "docid": "ccf826dccd068f982121ae802884db69", "score": "0.52794075", "text": "func (o *RemoteProcessGroupStatusDTO) SetId(v string) {\n\to.Id = &v\n}", "title": "" }, { "docid": "a80d2aef7ca6c6c0fb8e9426432fbdae", "score": "0.527503", "text": "func (o *AccessFeature) SetId(v string) {\n\to.Id = v\n}", "title": "" }, { "docid": "c347f551fcf791931acfec16f2efe804", "score": "0.52659947", "text": "func (m *ItemContactFoldersContactFolderItemRequestBuilder) ChildFoldersById(id string)(*ItemContactFoldersItemChildFoldersContactFolderItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"contactFolder%2Did1\"] = id\n }\n return NewItemContactFoldersItemChildFoldersContactFolderItemRequestBuilderInternal(urlTplParams, m.requestAdapter)\n}", "title": "" }, { "docid": "27c5590469f1369cdd17dad4937976d8", "score": "0.5232251", "text": "func (o *LabelDTO) SetId(v string) {\n\to.Id = &v\n}", "title": "" }, { "docid": "30fd9efae6a0bd632d5235545e4e9506", "score": "0.5228464", "text": "func (d *DashboardLite) SetId(v int) {\n\td.Id = &v\n}", "title": "" }, { "docid": "ae94dcf2b6234ffd3a1dc7cb4d4a82d4", "score": "0.5228124", "text": "func (o *OfferUnitGroupModel) SetId(v string) {\n\to.Id = v\n}", "title": "" }, { "docid": "40a4e33b14906b4b245fa28d5126ae6e", "score": "0.52241725", "text": "func (c *FilesListCall) DriveId(driveId string) *FilesListCall {\n\tc.urlParams_.Set(\"driveId\", driveId)\n\treturn c\n}", "title": "" }, { "docid": "69ed53defbced7579a54896c4e4fe2a7", "score": "0.522323", "text": "func (o *MessagesBase) SetId(v int32) {\n\to.Id = &v\n}", "title": "" }, { "docid": "5ae96b41a32745915e3ca801459175f6", "score": "0.5222568", "text": "func (o *BotUser) SetId(v string) {\n\to.Id = v\n}", "title": "" }, { "docid": "82fa1494502bb945c8d03a58fb808ade", "score": "0.522148", "text": "func (o *WebForm) SetId(v int64) {\n\to.Id = v\n}", "title": "" }, { "docid": "22e93317504a84477ce1fd6b16dcd909", "score": "0.5219189", "text": "func (self *Flow) SetTunnelId(tunnelId uint64) error {\n\taction := new(FlowAction)\n\taction.ActionType = ActTypeSetTunnelID\n\taction.tunnelId = tunnelId\n\n\tself.lock.Lock()\n\tdefer self.lock.Unlock()\n\n\t// Add to the action db\n\tself.flowActions = append(self.flowActions, action)\n\n\t// If the flow entry was already installed, re-install it\n\tif self.isInstalled {\n\t\treturn self.install()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d34f5d6be8c9ae9fb395059f1871fe2f", "score": "0.5216697", "text": "func (e *Event) SetId(id string) {\n\te.id = id\n}", "title": "" }, { "docid": "78d503ceadc360b9eddb9db34bcec8bc", "score": "0.52074873", "text": "func (s *Folder) SetFolderType(v string) *Folder {\n\ts.FolderType = &v\n\treturn s\n}", "title": "" }, { "docid": "57aedc66be1f555e47d1b09c7d0a4420", "score": "0.5198983", "text": "func (o *Route) SetId(v string) {\n\to.Id = &v\n}", "title": "" }, { "docid": "d1ed1300577f43e9794a3c6dea8616c8", "score": "0.51987356", "text": "func (op *ListOp) Folder(val string) *ListOp {\n\tif op != nil {\n\t\top.QueryOpts.Set(\"folder\", val)\n\t}\n\treturn op\n}", "title": "" }, { "docid": "d0ba71bff4f19c2ce5f73a9aee2540db", "score": "0.51982087", "text": "func (o *ReservationNoShowFeeModel) SetId(v string) {\n\to.Id = v\n}", "title": "" }, { "docid": "e037105c1541d3ab1cdc62dee8950bdb", "score": "0.51955724", "text": "func (o *EnvironmentVariableResponse) SetId(v string) {\n\to.Id = v\n}", "title": "" } ]
516779b0daee9833201caf4050e57415
A transaction on the same leader connection is in progress, the Begin hook succeeds, but SQLite fails to start the write transaction returing ErrBusy.
[ { "docid": "04a041478e5982f211b54613a36ca7eb", "score": "0.52508795", "text": "func TestIntegration_Begin_BusyRetrySameConn(t *testing.T) {\n\tconns, control, cleanup := newCluster(t)\n\tdefer cleanup()\n\n\tr1 := control.LeadershipAcquired(time.Second)\n\tconn := conns[r1][0]\n\n\t_, err := conn.Exec(\"CREATE TABLE test (n INT)\", nil)\n\trequire.NoError(t, err)\n\n\t_, err = conn.Exec(\"BEGIN; INSERT INTO test(n) VALUES(1)\", nil)\n\trequire.NoError(t, err)\n\terrors := make(chan error)\n\tgo func() {\n\t\ttime.Sleep(rafttest.Duration(25 * time.Millisecond))\n\t\t_, err = conn.Exec(\"COMMIT\", nil)\n\t\terrors <- err\n\t}()\n\n\t_, err = conn.Exec(\"BEGIN; INSERT INTO test(n) VALUES(2)\", nil)\n\trequire.EqualError(t, err, \"cannot start a transaction within a transaction\")\n\trequire.NoError(t, <-errors)\n\n\t// The change is visible from other nodes\n\tr2 := control.Other(r1)\n\tcontrol.WaitIndex(r2, r1.AppliedIndex(), time.Second)\n\tconn = conns[r2][0]\n\trows, err := conn.Query(\"SELECT n FROM test ORDER BY n\", nil)\n\trequire.NoError(t, err)\n\tvalues := make([]driver.Value, 1)\n\trequire.NoError(t, rows.Next(values))\n\tassert.Equal(t, int64(1), values[0])\n\trequire.NoError(t, rows.Close())\n}", "title": "" } ]
[ { "docid": "bf75bdc0ccc23b4bd61490f6072f4ea4", "score": "0.6804842", "text": "func (db DB) Begin(writable bool) (database.Transaction, error) {\n\t// If the database was opened with DB.readonly flag true, we cannot create\n\t// a writable transaction\n\tif db.readOnly && writable {\n\t\treturn nil, errors.New(\"database is read-only\")\n\t}\n\n\t// In case of writable transaction, it's now the time to obtain writer lock.\n\t// This is not necessary in case of LevelDB store due its concurrency\n\t// Control as describe below\n\n\t// A database may only be opened by one process at a time. The leveldb\n\t// implementation acquires a lock from the operating system to prevent\n\t// misuse. Within a single process, the same leveldb::DB object may be\n\t// safely shared by multiple concurrent threads. I.e., different threads may\n\t// write into or fetch iterators or call Get on the same database without\n\t// any external synchronization\n\n\t// Exit if the database is not open yet.\n\tif !db.isOpen() {\n\t\treturn nil, errors.New(\"database is not open\")\n\t}\n\n\t// Snapshot is a DB snapshot. It must be released on Transaction.Close()\n\tsnapshot, err := db.storage.GetSnapshot()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Batch to be used by a writable Transaction.\n\tvar batch *leveldb.Batch\n\tif writable {\n\t\tbatch = new(leveldb.Batch)\n\t}\n\n\t// Create a transaction instance. Mind Transaction.Close() must be called\n\t// when Transaction is done\n\tt := &transaction{\n\t\twritable: writable,\n\t\tdb: &db,\n\t\tsnapshot: snapshot,\n\t\tbatch: batch,\n\t\tclosed: false,\n\t}\n\n\treturn t, nil\n}", "title": "" }, { "docid": "60005d6d79ab85e2549b96f0cc55560c", "score": "0.6629554", "text": "func (db *DB) Begin() (*Tx, error) {}", "title": "" }, { "docid": "b85b349045407161e83f20f989b57530", "score": "0.6161414", "text": "func (db *FlashDB) Begin(writable bool) (*Tx, error) {\n\ttx := &Tx{\n\t\tdb: db,\n\t\twritable: writable,\n\t}\n\ttx.lock()\n\tif db.closed {\n\t\ttx.unlock()\n\t\treturn nil, ErrDatabaseClosed\n\t}\n\tif writable {\n\t\ttx.wc = &txWriteContext{}\n\t\tif db.persist {\n\t\t\ttx.wc.commitItems = make([]*record, 0, 1)\n\t\t}\n\t}\n\treturn tx, nil\n}", "title": "" }, { "docid": "2d813fa762b3c0afa9dc384cfb0be893", "score": "0.6138517", "text": "func (tx *LevelDBTransaction) Commit() error {\n\tif tx.isClosed {\n\t\treturn errors.New(\"cannot commit a closed transaction\")\n\t}\n\n\ttx.isClosed = true\n\ttx.snapshot.Release()\n\treturn errors.WithStack(tx.db.ldb.Write(tx.batch, nil))\n}", "title": "" }, { "docid": "20937836b16d397621d959c44960c6d1", "score": "0.6092958", "text": "func (db *DB) Begin() (*Tx, error) { return db.BeginTx(context.Background(), nil) }", "title": "" }, { "docid": "fab0700bfb8a4d62b2c6168523538124", "score": "0.60156137", "text": "func TestTransactionsBusy(t *testing.T) {\n\tvar err error\n\tctx, cancelF := context.WithTimeout(context.Background(), 3*time.Second)\n\tdefer cancelF()\n\n\tdb, removeF := newDBNotTemporary(t)\n\tdefer func() {\n\t\terr := db.Close()\n\t\trequire.NoError(t, err)\n\t\tremoveF()\n\t}()\n\n\tID := coltest.MustParseID(\"ff00:0:111\", \"00000001\")\n\t// create a segment reservation\n\trsv := segment.NewReservation(ID.ASID)\n\trsv.ID = *ID\n\t_, err = rsv.NewIndex(1, util.SecsToTime(1), 1, 1, 1, 1, reservation.CorePath)\n\trequire.NoError(t, err)\n\t// save the reservation to DB\n\trsv.Steps = test.NewSteps(\"1-ff00:0:1\", 1, 1, \"1-ff00:0:2\")\n\trsv.TransportPath = test.NewColPathMin(rsv.Steps)\n\terr = db.PersistSegmentRsv(ctx, rsv)\n\trequire.NoError(t, err)\n\n\tdb.SetMaxOpenConns(2)\n\n\t// we need to ensure that we can read from many transactions, and that once we upgrade one\n\t// transaction to write-transaction, the other transactions cannot write and automatically\n\t// will retry for a period of time to obtain a write transaction.\n\n\tafterTxCreation := sync.WaitGroup{}\n\tafterTxCreation.Add(2)\n\n\tafterTx1Modifies := sync.WaitGroup{}\n\tafterTx1Modifies.Add(1)\n\n\tallDone := sync.WaitGroup{}\n\tallDone.Add(2)\n\n\tgo func() { // TX1\n\t\tdefer allDone.Done()\n\n\t\ttx1, err := db.BeginTransaction(ctx, nil)\n\t\trequire.NoError(t, err)\n\t\tafterTxCreation.Done()\n\t\tafterTxCreation.Wait()\n\t\tt.Logf(\"TX1: got transaction at %s\", time.Now().Format(time.StampMicro))\n\n\t\t// at this point, we have two concurrent read-transactions\n\t\trsv1, err := tx1.GetSegmentRsvFromID(ctx, &rsv.ID)\n\t\trequire.NoError(t, err)\n\t\trsv1.ID.Suffix[0]++\n\n\t\tt.Logf(\"TX1: attempting to get a write-transaction at %s\",\n\t\t\ttime.Now().Format(time.StampMicro))\n\t\terr = tx1.PersistSegmentRsv(ctx, rsv1)\n\t\trequire.NoError(t, err)\n\t\tafterTx1Modifies.Done()\n\n\t\tt.Logf(\"TX1: about to commit at %s\",\n\t\t\ttime.Now().Format(time.StampMicro))\n\t\terr = tx1.Commit()\n\t\trequire.NoError(t, err)\n\t\tt.Logf(\"TX1: finished at %s\",\n\t\t\ttime.Now().Format(time.StampMicro))\n\t}()\n\n\tgo func() { // TX2\n\t\tdefer allDone.Done()\n\n\t\ttx2, err := db.BeginTransaction(ctx, nil)\n\t\trequire.NoError(t, err)\n\t\tafterTxCreation.Done()\n\t\tafterTxCreation.Wait()\n\t\tt.Logf(\"TX2: got transaction at %s\", time.Now().Format(time.StampMicro))\n\n\t\t// at this point, we have two concurrent read-transactions\n\t\trsv2, err := tx2.GetSegmentRsvFromID(ctx, &rsv.ID)\n\t\trequire.NoError(t, err)\n\t\trequire.Equal(t, rsv.ID.Suffix[0], rsv2.ID.Suffix[0])\n\t\tafterTx1Modifies.Wait()\n\n\t\trsv2, err = tx2.GetSegmentRsvFromID(ctx, &rsv.ID)\n\t\trequire.NoError(t, err)\n\t\trequire.Equal(t, rsv.ID.Suffix[0], rsv2.ID.Suffix[0])\n\t\trsv2.ID.Suffix[0] += 2\n\t\tt.Logf(\"TX2: attempting to get a write-transaction at %s\",\n\t\t\ttime.Now().Format(time.StampMicro))\n\t\terr = tx2.PersistSegmentRsv(ctx, rsv2)\n\t\trequire.NoError(t, err)\n\n\t\tt.Logf(\"TX2: about to commit at %s\",\n\t\t\ttime.Now().Format(time.StampMicro))\n\t\terr = tx2.Commit()\n\t\tt.Logf(\"TX2: finished at %s\",\n\t\t\ttime.Now().Format(time.StampMicro))\n\t\trequire.NoError(t, err)\n\t}()\n\n\t// wait for test to finish\n\tallDone.Wait()\n}", "title": "" }, { "docid": "0f120ad527e18915b831575c9c12127e", "score": "0.6014161", "text": "func txWrap(db *sql.DB, txFunc func(*sql.Tx)) (err error) {\n\tpanicked := true\n\n\ttx, txErr := db.Begin()\n\tif txErr != nil {\n\t\treturn txErr\n\t\t//TODO: return errors.Wrap(err, \"Begin transaction failed in wrapper\")\n\t\t// but it's not available in go1.6\n\t}\n\n\tdefer func() {\n\t\t// DO NOT call recover(), check the flag ('panicked') instead\n\t\t// because after recover() neither rethrowing\n\t\t// nor accessing the stack trace (of received panic) is possible.\n\t\t// A new panic() would be unrelated to the old one.\n\t\tif panicked {\n\t\t\ttx.Rollback()\n\t\t\treturn\n\t\t}\n\n\t\tif rollbackAlways { // unusual handling introduced for testing purpose\n\t\t\ttx.Rollback()\n\t\t} else { // the reasonable thing to do: commit if all went OK\n\t\t\terr = tx.Commit()\n\t\t}\n\t}()\n\n\ttxFunc(tx)\n\n\tpanicked = false // we know for sure, since we reached the end\n\n\treturn nil // no error returned does *not* necessarily mean success\n\t// in *this* case: remember that txFunc reports problems with panic()\n}", "title": "" }, { "docid": "30d208b3183aaf101c8e396b10a56ac5", "score": "0.60048825", "text": "func (*txDriver) Commit() error { return nil }", "title": "" }, { "docid": "7b8b3156bd866da0ca42c185f3394b5e", "score": "0.5981943", "text": "func TestIntegration_Begin_BusyTimeout(t *testing.T) {\n\tconns, control, cleanup := newCluster(t)\n\tdefer cleanup()\n\n\traft := control.LeadershipAcquired(time.Second)\n\tconn1 := conns[raft][0]\n\tconn2 := conns[raft][1]\n\n\t_, err := conn1.Exec(\"BEGIN; CREATE TABLE test (n INT)\", nil)\n\trequire.NoError(t, err)\n\n\t_, err = conn2.Exec(\"BEGIN; CREATE TABLE test (n INT)\", nil)\n\trequire.Error(t, err)\n\tif err, ok := err.(sqlite3.Error); ok {\n\t\tassert.Equal(t, sqlite3.ErrBusy, err.Code)\n\t} else {\n\t\tt.Fatal(\"expected a sqlite3.Error instance\")\n\t}\n}", "title": "" }, { "docid": "98d7071c4ea9cbcea6905a02bcf41281", "score": "0.59679693", "text": "func (c *Conn) Begin() (driver.Tx, error) {\n\tpanic(\"Begin is not supported by the mysqldb driver\")\n}", "title": "" }, { "docid": "e6625956bfd61efe12075b567cccec52", "score": "0.5967609", "text": "func (c *Combine) Begin() {\n\tif tx, err := c.db.Begin(); err != nil {\n\t\tpanic(err.Error())\n\t} else {\n\t\tc.tx = tx\n\t}\n}", "title": "" }, { "docid": "a6fb39c43391902223c9badcee08bd66", "score": "0.5957155", "text": "func (cn *connDb) begin() (btx *sql.Tx, err error) {\n\tbtx, err = cn.coreDb.Begin()\n\treturn\n}", "title": "" }, { "docid": "d27a332949052dac51c5ca13e1274a64", "score": "0.59057957", "text": "func (db *LevelDB) Begin() (*LevelDBTransaction, error) {\n\tsnapshot, err := db.ldb.GetSnapshot()\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tbatch := new(leveldb.Batch)\n\n\ttransaction := &LevelDBTransaction{\n\t\tdb: db,\n\t\tsnapshot: snapshot,\n\t\tbatch: batch,\n\t\tisClosed: false,\n\t}\n\treturn transaction, nil\n}", "title": "" }, { "docid": "f6b9abd8489b6888738aab975262a768", "score": "0.58973753", "text": "func TestIntegration_Begin_BusyTimeout(t *testing.T) {\n\tconns, control, cleanup := newCluster(t)\n\tdefer cleanup()\n\n\tcontrol.Elect(\"0\")\n\tconn1 := conns[\"0\"][0]\n\tconn2 := conns[\"0\"][1]\n\n\tbegin(t, conn1)\n\tinsertOne(t, conn1, 0)\n\n\tbegin(t, conn2)\n\tinsertTwo(t, conn2, sqlite3.ErrNoExtended(sqlite3.ErrBusy))\n\n\tcommit(t, conn1, 0)\n\tselectOne(t, conn1)\n}", "title": "" }, { "docid": "8c4b2757acfb9fb04acf26a1c23ff7e7", "score": "0.58909285", "text": "func (this *BasicHandler) Commit() error {\n\terr := this.tx.Commit()\n\tif err != nil {\n\t\treturn err\n\t}\n\tthis.tx, err = this.db.Beginx()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "be91d76e235bcf41f2ca3b3424926895", "score": "0.5865329", "text": "func (c *Connection) Begin() (driver.Tx, error) {\n\terr := errors.New(\"sfdb does not support transactions\")\n\treturn nil, err\n}", "title": "" }, { "docid": "90b76f33d6079986fb8a95424022fd88", "score": "0.58467925", "text": "func (e *DevEngine) Begin(writable bool) (tsdb.Tx, error) {\n\tpanic(\"not implemented\")\n}", "title": "" }, { "docid": "9159c5eab55a5e62ed93ff8b62181275", "score": "0.58424705", "text": "func (e *Engine) Begin(writable bool) (tsdb.Tx, error) {\n\ttx, err := e.db.Begin(writable)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Tx{Tx: tx, engine: e, wal: e.WAL}, nil\n}", "title": "" }, { "docid": "8301822ab77b33d2004c6cb5aaa1bfe9", "score": "0.5767935", "text": "func (driver) Begin(ctx context.Context, db *sql.DB) (*sql.Tx, error) {\n\treturn db.BeginTx(ctx, nil)\n}", "title": "" }, { "docid": "f252d979e87942a912dfa04d726e07c6", "score": "0.5766038", "text": "func (tx *dbTx) Begin(ctx context.Context) (Tx, error) {\n\tif tx.closed {\n\t\treturn nil, ErrTxClosed\n\t}\n\n\ttx.savepointNum++\n\t_, err := tx.conn.Exec(ctx, \"savepoint sp_\"+strconv.FormatInt(tx.savepointNum, 10))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &dbSimulatedNestedTx{tx: tx, savepointNum: tx.savepointNum}, nil\n}", "title": "" }, { "docid": "70cafb5fd7d0bad953f0cabe542b9fa3", "score": "0.5756955", "text": "func (dbc *Connection) Begin() (*sql.Tx, error) {\n\tif dbc.connection != nil {\n\t\ttx, txErr := dbc.connection.Begin()\n\t\treturn tx, exception.New(txErr)\n\t}\n\n\tconnection, err := dbc.Open()\n\tif err != nil {\n\t\treturn nil, exception.New(err)\n\t}\n\ttx, err := connection.Begin()\n\treturn tx, exception.New(err)\n}", "title": "" }, { "docid": "0f7a07e0f40c951370fe2dcc3a2fb858", "score": "0.572019", "text": "func (m *Manager) Begin() error {\n\tvar err error\n\tif m.transaction {\n\t\tlogrus.Panic(\"already in transaction\")\n\t}\n\tm.tx, err = dbmap.Begin()\n\tif err == nil {\n\t\tm.transaction = true\n\t}\n\treturn err\n}", "title": "" }, { "docid": "973f58dcd2d940617101849bc307d9f8", "score": "0.5698117", "text": "func (db *DB) Begin() (*sql.Tx, error) {\n\treturn db.connection.Begin()\n}", "title": "" }, { "docid": "a07573344b02893acd9b61993d167e32", "score": "0.56933", "text": "func (c *Conn) BeginTx(ctx context.Context, opts *TxOptions) (*Tx, error) {}", "title": "" }, { "docid": "25cbc9a9cb89174b0331fac562b3b53e", "score": "0.5691906", "text": "func (wrap *Wrapper) BeginTx() *pg.Tx {\n\ttx, err := wrap.db.Begin()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn tx\n}", "title": "" }, { "docid": "1725dc65cfbdd8c54b8c41122a1a1449", "score": "0.5681336", "text": "func (s *Store) StartCommit(_ consumer.Shard, cp pc.Checkpoint, waitFor client.OpFutures) client.OpFuture {\n\t_ = s.recorder.Barrier(waitFor)\n\n\t// Marshal checkpoint, add it to the transaction, and locally commit the transaction.\n\tvar txn *sql.Tx\n\tvar b, err = cp.Marshal()\n\n\tif err == nil {\n\t\ttxn, err = s.Transaction(context.Background(), nil)\n\t\ts.txn = nil\n\t}\n\tif err == nil {\n\t\t_, err = txn.Exec(`UPDATE gazette_checkpoint SET checkpoint = ?;`, b)\n\t}\n\tif err == nil {\n\t\terr = txn.Commit()\n\t}\n\tif err == nil {\n\t\t// The local commit we just did drove a bunch of local SQLite writes which\n\t\t// are queued behind |waitFor| and not yet written to the recovery log.\n\t\t// The Store commit has only occurred after all of these queued writes\n\t\t// commit to Gazette.\n\t\treturn s.recorder.Barrier(nil)\n\t}\n\treturn client.FinishedOperation(err)\n}", "title": "" }, { "docid": "508dbb4ef6bdd138ba9985449d977f2e", "score": "0.56783444", "text": "func (*Conn) Begin() (driver.Tx, error) {\n\tpanic(\"not supported\")\n}", "title": "" }, { "docid": "112ad55a418f68a052f5c4a417571419", "score": "0.5666313", "text": "func TestIntegration_Begin_NoWrite(t *testing.T) {\n\tconns, control, cleanup := newCluster(t)\n\tdefer cleanup()\n\n\tr1 := control.LeadershipAcquired(time.Second)\n\tconn := conns[r1][0]\n\n\t_, err := conn.Exec(\"CREATE TABLE test (n INT)\", nil)\n\trequire.NoError(t, err)\n\n\t_, err = conn.Exec(\"BEGIN; UPDATE test SET n=1; COMMIT\", nil)\n\trequire.NoError(t, err)\n\t_, err = conn.Exec(\"BEGIN; INSERT INTO test(n) VALUES(1); COMMIT\", nil)\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "ebd6a9764ec55c88e2bdbd7712d6e8ca", "score": "0.5663383", "text": "func (db *DB) Begin(update bool) *TX {\n\tif err := db.init(); err != nil {\n\t\treturn nil\n\t}\n\treturn &TX{\n\t\tdb: db,\n\t\ttxn: db.badger.NewTransaction(update),\n\t}\n}", "title": "" }, { "docid": "1284bd636e17e642ae0d90421aa52ca6", "score": "0.56459296", "text": "func TestCommitTransactionOnce(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\tdefer log.Scope(t).Close(t)\n\tctx := context.Background()\n\tstopper := stop.NewStopper()\n\tdefer stopper.Stop(ctx)\n\tclock := hlc.NewClock(hlc.UnixNano, time.Nanosecond)\n\tcount := 0\n\tdb := NewDB(testutils.MakeAmbientCtx(), newTestTxnFactory(func(ba roachpb.BatchRequest) (*roachpb.BatchResponse, *roachpb.Error) {\n\t\tcount++\n\t\treturn ba.CreateReply(), nil\n\t}), clock, stopper)\n\tif err := db.Txn(context.Background(), func(ctx context.Context, txn *Txn) error {\n\t\tb := txn.NewBatch()\n\t\tb.Put(\"z\", \"adding a write exposed a bug in #1882\")\n\t\treturn txn.CommitInBatch(ctx, b)\n\t}); err != nil {\n\t\tt.Errorf(\"unexpected error on commit: %s\", err)\n\t}\n\tif count != 1 {\n\t\tt.Errorf(\"expected single Batch, got %d sent calls\", count)\n\t}\n}", "title": "" }, { "docid": "b4c5e9976e707a2df93cea775c694ca7", "score": "0.56335074", "text": "func TestTransactionStatus(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\tdefer log.Scope(t).Close(t)\n\tctx := context.Background()\n\tstopper := stop.NewStopper()\n\tdefer stopper.Stop(ctx)\n\n\tclock := hlc.NewClock(hlc.UnixNano, time.Nanosecond)\n\tdb := NewDB(testutils.MakeAmbientCtx(), newTestTxnFactory(nil), clock, stopper)\n\tfor _, write := range []bool{true, false} {\n\t\tfor _, commit := range []bool{true, false} {\n\t\t\ttxn := NewTxn(ctx, db, 0 /* gatewayNodeID */)\n\n\t\t\tif _, pErr := txn.Get(ctx, \"a\"); pErr != nil {\n\t\t\t\tt.Fatal(pErr)\n\t\t\t}\n\t\t\tif write {\n\t\t\t\tif pErr := txn.Put(ctx, \"a\", \"b\"); pErr != nil {\n\t\t\t\t\tt.Fatal(pErr)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif commit {\n\t\t\t\tif pErr := txn.CommitOrCleanup(ctx); pErr != nil {\n\t\t\t\t\tt.Fatal(pErr)\n\t\t\t\t}\n\t\t\t\tif a, e := txn.TestingCloneTxn().Status, roachpb.COMMITTED; a != e {\n\t\t\t\t\tt.Errorf(\"write: %t, commit: %t transaction expected to have status %q but had %q\", write, commit, e, a)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif pErr := txn.Rollback(ctx); pErr != nil {\n\t\t\t\t\tt.Fatal(pErr)\n\t\t\t\t}\n\t\t\t\tif a, e := txn.TestingCloneTxn().Status, roachpb.ABORTED; a != e {\n\t\t\t\t\tt.Errorf(\"write: %t, commit: %t transaction expected to have status %q but had %q\", write, commit, e, a)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "31d29d9a3a7ddcafb33fc14338b57215", "score": "0.5629653", "text": "func (tx *Tx) Commit() error {}", "title": "" }, { "docid": "313dba9e9e7a771000d04fbc6a1d8413", "score": "0.5627275", "text": "func main() {\n\n\tsql3Conn := []*sqlite.SQLiteConn{}\n\tsql.Register(\"sqlite3ConnectionCatchingDriver\",\n\t\t&sqlite.SQLiteDriver{\n\t\t\tConnectHook: func(newConn *sqlite.SQLiteConn) error {\n\t\t\t\tsql3Conn = append(sql3Conn, newConn)\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t)\n\n\tdb, err := sqlx.Connect(\"sqlite3ConnectionCatchingDriver\", \"myDb.sqlite?cache=shared\")\n\tif err != nil {\n\t\tlog.Fatal(\"Connect: \", err)\n\t}\n\n\t_, err = db.Exec(`\n CREATE TABLE IF NOT EXISTS main.person (\n id INTEGER PRIMARY KEY,\n name TEXT\n );\n\n ATTACH DATABASE 'file::memory:?cache=shared' AS mem;\n\n CREATE TABLE IF NOT EXISTS mem.sessionActivity (\n id INTEGER PRIMARY KEY,\n personId INTEGER NOT NULL,\n dateTime DATETIME DEFAULT CURRENT_TIMESTAMP\n );\n `)\n\n\tif err != nil {\n\t\tlog.Fatal(\"Schema Build: \", err)\n\t}\n\n\tinsertPerson, err := db.PrepareNamed(`\n INSERT OR IGNORE INTO main.person (id, name)\n VALUES(:id, :name);\n `)\n\n\tif err != nil {\n\t\tlog.Fatal(\"Prepare Statement 1: \", err)\n\t}\n\n\tinsertSessionActivity, err := db.PrepareNamed(`\n\t INSERT OR IGNORE INTO mem.sessionActivity (personId)\n\t VALUES(:personId);\n\t `)\n\n\tif err != nil {\n\t\tlog.Fatal(\"Prepare Statement 2: \", err)\n\t}\n\n\t_, err = insertPerson.Exec(map[string]interface{}{\n\t\t\"id\": 1,\n\t\t\"name\": \"Jim\",\n\t})\n\n\tif err != nil {\n\t\tlog.Fatal(\"insert person: \", err)\n\t}\n\n\t_, err = insertSessionActivity.Exec(map[string]interface{}{\n\t\t\"personId\": 1,\n\t})\n\n\tif err != nil {\n\t\tlog.Fatal(\"insert session activity 1: \", err)\n\t}\n\n\ttime.Sleep(time.Second)\n\n\t_, err = insertSessionActivity.Exec(map[string]interface{}{\n\t\t\"personId\": 1,\n\t})\n\n\tif err != nil {\n\t\tlog.Fatal(\"insert session activity 2: \", err)\n\t}\n\n\t// This query is a join between a memory-db table and a disk-db table. It works!\n\trows, err := db.Query(`\n SELECT\n main.person.name as personName,\n main.person.id as personId,\n mem.sessionActivity.dateTime as dateTime\n FROM mem.sessionActivity\n LEFT OUTER JOIN main.person\n ON mem.sessionActivity.personId = main.person.id\n ORDER BY\n mem.sessionActivity.dateTime ASC\n `)\n\tif err != nil {\n\t\tlog.Fatal(\"Select : \", err)\n\t}\n\n\t// iterate over each row\n\tfor rows.Next() {\n\t\tvar personName string\n\t\tvar personID int64\n\t\tvar dateTime time.Time\n\t\terr = rows.Scan(&personName, &personID, &dateTime)\n\t\tfmt.Println(\"Result:\", personID, personName, dateTime)\n\t}\n\n\tfmt.Println(\"Finished\")\n}", "title": "" }, { "docid": "313839907748182217f1454602931fda", "score": "0.56242913", "text": "func (db *DB) Begin() (*Tx, error) {\n\treturn &Tx{db.Conn}, nil\n}", "title": "" }, { "docid": "6e0192c80473956312190cebe1370c7f", "score": "0.56222266", "text": "func (db *DB) BeginTx(ctx context.Context, opts *TxOptions) (*Tx, error) {}", "title": "" }, { "docid": "2d94d69d0fe35461b9ba3b0c99a61e83", "score": "0.56205696", "text": "func TestTxnDBBasics(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\tdefer log.Scope(t).Close(t)\n\ts := createTestDB(t)\n\tdefer s.Stop()\n\tvalue := []byte(\"value\")\n\n\tfor _, commit := range []bool{true, false} {\n\t\tkey := []byte(fmt.Sprintf(\"key-%t\", commit))\n\n\t\terr := s.DB.Txn(context.Background(), func(ctx context.Context, txn *kv.Txn) error {\n\t\t\t// Put transactional value.\n\t\t\tif err := txn.Put(ctx, key, value); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Attempt to read in another txn.\n\t\t\tconflictTxn := kv.NewTxn(ctx, s.DB, 0 /* gatewayNodeID */)\n\t\t\tconflictTxn.TestingSetPriority(enginepb.MaxTxnPriority)\n\t\t\tif gr, err := conflictTxn.Get(ctx, key); err != nil {\n\t\t\t\treturn err\n\t\t\t} else if gr.Exists() {\n\t\t\t\treturn errors.Errorf(\"expected nil value; got %v\", gr.Value)\n\t\t\t}\n\n\t\t\t// Read within the transaction.\n\t\t\tif gr, err := txn.Get(ctx, key); err != nil {\n\t\t\t\treturn err\n\t\t\t} else if !gr.Exists() || !bytes.Equal(gr.ValueBytes(), value) {\n\t\t\t\treturn errors.Errorf(\"expected value %q; got %q\", value, gr.Value)\n\t\t\t}\n\n\t\t\tif !commit {\n\t\t\t\treturn errors.Errorf(\"purposefully failing transaction\")\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\n\t\tif commit != (err == nil) {\n\t\t\tt.Errorf(\"expected success? %t; got %s\", commit, err)\n\t\t} else if !commit && !testutils.IsError(err, \"purposefully failing transaction\") {\n\t\t\tt.Errorf(\"unexpected failure with !commit: %v\", err)\n\t\t}\n\n\t\t// Verify the value is now visible on commit == true, and not visible otherwise.\n\t\tgr, err := s.DB.Get(context.Background(), key)\n\t\tif commit {\n\t\t\tif err != nil || !gr.Exists() || !bytes.Equal(gr.ValueBytes(), value) {\n\t\t\t\tt.Errorf(\"expected success reading value: %+v, %s\", gr.ValueBytes(), err)\n\t\t\t}\n\t\t} else {\n\t\t\tif err != nil || gr.Exists() {\n\t\t\t\tt.Errorf(\"expected success and nil value: %s, %s\", gr, err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9b865657bfb22f490bbf849332411595", "score": "0.5582709", "text": "func (e *Engine) Begin(ctx context.Context, opts engine.TxOptions) (engine.Transaction, error) {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil, errors.Wrap(ctx.Err())\n\tdefault:\n\t}\n\n\ttx, err := e.DB.Begin(opts.Writable)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err)\n\t}\n\n\treturn &Transaction{\n\t\tctx: ctx,\n\t\ttx: tx,\n\t\twritable: opts.Writable,\n\t}, nil\n}", "title": "" }, { "docid": "52afe63561bc62fe45d635cf470eb76a", "score": "0.55808115", "text": "func (t *Transaction) Commit() {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\t// ignore error here\n\t\t\t_ = err\n\t\t}\n\t}()\n\tt.abortOnce.Do(func() {\n\t\tt.val.Call(\"commit\")\n\t})\n}", "title": "" }, { "docid": "ed872014ec10040ef9dd89a54cfd5526", "score": "0.55772203", "text": "func (db *SQLiteDatabase) TransactionBlock(f func(Statements) error) error {\n\tif tx, err := db.conn.Begin(); err != nil {\n\t\treturn err\n\t} else {\n\t\tif err2 := f(&Commands{tx}); err2 != nil {\n\t\t\tif err3 := tx.Rollback(); err != nil {\n\t\t\t\treturn err3\n\t\t\t} else {\n\t\t\t\treturn err2\n\t\t\t}\n\n\t\t} else {\n\t\t\tif err3 := tx.Commit(); err3 != nil {\n\t\t\t\treturn err3\n\t\t\t} else {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "817d68f381860a9c101db25a37820169", "score": "0.55514634", "text": "func (m *DBMock) Begin(ctx context.Context) (pgx.Tx, error) {\n\targs := m.Called(ctx)\n\ttx, _ := args.Get(0).(pgx.Tx)\n\treturn tx, args.Error(1)\n}", "title": "" }, { "docid": "fbb0f786670537289ac7bf82c5229796", "score": "0.55472124", "text": "func (bc *Blockchain) Commit(db *db.TinyDB) error {\n\n}", "title": "" }, { "docid": "b82836d020c9aad0deb16701f8d1566a", "score": "0.5543613", "text": "func (c *Conn) Begin() (driver.Tx, error) {\n\tpanic(\"not implemented\")\n}", "title": "" }, { "docid": "21d48c60918764deab4475882e41cc88", "score": "0.5536237", "text": "func (e *DevEngine) Begin(writable bool) (tsdb.Tx, error) {\n\treturn &devTx{engine: e}, nil\n}", "title": "" }, { "docid": "a6c8ba6afd84ae64df2f058da8846fcb", "score": "0.5532031", "text": "func transactionWrap(db *sqlx.DB, f HandlerFuncWithError) rest.HandlerFunc {\n\treturn func(w rest.ResponseWriter, r *rest.Request) {\n\t\tvar err error\n\n\t\ttx, err := db.Beginx()\n\n\t\tdefer func() {\n\t\t\tif err != nil && tx != nil {\n\t\t\t\ttx.Rollback()\n\t\t\t\tlog.Println(\"Transaction rolled back\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\terr = tx.Commit()\n\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t} else {\n\t\t\t\tlog.Println(\"Transaction commited\")\n\t\t\t}\n\t\t}()\n\n\t\tif err != nil {\n\t\t\trest.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\terr = f(w, r, tx)\n\n\t\tif err != nil {\n\t\t\trest.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8d704bae8f7e57e0831ab8d19f2703e0", "score": "0.5511449", "text": "func (conn *HiveConn) Begin() (driver.Tx, error) {\n\treturn nil, ERROR_NOT_SUPPORTED\n}", "title": "" }, { "docid": "8ec8c2d5779d1db8530a1be1aeb5fd95", "score": "0.5500936", "text": "func (tx *Tx) lock() {\n\tif tx.writable {\n\t\ttx.db.mu.Lock()\n\t} else {\n\t\ttx.db.mu.RLock()\n\t}\n}", "title": "" }, { "docid": "d83085302b997279445aed74f88b7e12", "score": "0.5497328", "text": "func (tx *LevelDBExecutionTransaction) Commit() error {\n\treturn tx.tx.Commit()\n}", "title": "" }, { "docid": "bb2bcfff0712352d8203dc995ee5dea7", "score": "0.54867595", "text": "func testDBWriteParallel() {\n\tstart := time.Now()\n\tfor i := 0; i < interation; i++ {\n\t\twg.Add(1)\n\t\tgo dbClient.Set(fmt.Sprintf(\"KeyDB%d\", i), fmt.Sprintf(\"Amit%d\", i), &wg)\n\t}\n\twg.Wait()\n\tfmt.Println(\"SET(parallel):\", time.Since(start))\n}", "title": "" }, { "docid": "697c72c4277927a31dac45c05a0c2d03", "score": "0.54783845", "text": "func (w *DB) Begin() (*DB, error) {\n\ttx, err := w.database.Beginx()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &DB{tx: tx}, nil\n}", "title": "" }, { "docid": "5422a139e169c4312160db4b98418303", "score": "0.5474978", "text": "func TestReadOnlyTransaction_UseAfterClose(t *testing.T) {\n\tt.Parallel()\n\tctx := context.Background()\n\tclient, _, _, cleanup := serverClientMock(t, SessionPoolConfig{})\n\tdefer cleanup()\n\n\ttxn := client.ReadOnlyTransaction()\n\ttxn.Close()\n\n\t_, _, e := txn.acquire(ctx)\n\tif wantErr := errTxClosed(); !testEqual(e, wantErr) {\n\t\tt.Fatalf(\"Second acquire for multi use, got %v, want %v.\", e, wantErr)\n\t}\n}", "title": "" }, { "docid": "020fd4706177aab77a5adb71a5d05348", "score": "0.54737186", "text": "func TestIntegration_Undo_NotLeader(t *testing.T) {\n\tconns, control, cleanup := newCluster(t, noLeaderCheck(5))\n\tdefer cleanup()\n\n\tcontrol.Elect(\"0\").When().Command(3).Committed().Depose()\n\n\tconn := conns[\"0\"][0]\n\n\t// Lower SQLite's page cache size to force it to write uncommitted\n\t// dirty pages to the WAL.\n\tlowerCacheSize(t, conn)\n\n\t// Start a write transaction and insert enough data to cause page cache\n\t// stress and flush to the WAL and trigger exactly one Frames\n\t// command. After the Frames command gets committed the leader gets\n\t// deposed.\n\tbegin(t, conn)\n\tinsertN(t, conn, 500)\n\trollback(t, conn)\n\n\tcontrol.Elect(\"1\")\n\tcontrol.Barrier()\n\n\t// No node sees the commit\n\tselectZero(t, conns[\"0\"][0])\n\tselectZero(t, conns[\"1\"][0])\n\tselectZero(t, conns[\"2\"][0])\n}", "title": "" }, { "docid": "22113990dddc8da4ef636b2ea6de3784", "score": "0.54502505", "text": "func TestIntegration_Begin_BusyRetrySameConn(t *testing.T) {\n\tconns, control, cleanup := newCluster(t)\n\tdefer cleanup()\n\n\tcontrol.Elect(\"0\")\n\tconn := conns[\"0\"][0]\n\n\tbegin(t, conn)\n\tinsertOne(t, conn, 0)\n\tdone := make(chan struct{})\n\tgo func() {\n\t\ttime.Sleep(rafttest.Duration(25 * time.Millisecond))\n\t\tcommit(t, conn, 0)\n\t\tclose(done)\n\t}()\n\n\t_, err := conn.Exec(\"BEGIN\", nil)\n\trequire.EqualError(t, err, \"cannot start a transaction within a transaction\")\n\t<-done\n\n\t// The change is visible from other nodes\n\tcontrol.Barrier()\n\tselectOne(t, conns[\"1\"][0])\n\tselectOne(t, conns[\"2\"][0])\n}", "title": "" }, { "docid": "72927633830ab6074377415845f8b154", "score": "0.54478246", "text": "func TestIntegration_Frames_LeadershipLost_Commit(t *testing.T) {\n\tconns, control, cleanup := newCluster(t)\n\tdefer cleanup()\n\n\tcontrol.Elect(\"0\").When().Command(1).Enqueued().Depose()\n\n\tconn := conns[\"0\"][0]\n\tbegin(t, conn)\n\tinsertOne(t, conn, 0)\n\tcommit(t, conn, sqlite3.ErrIoErrLeadershipLost)\n\n\t// Take a connection against the new leader node and insert the same\n\t// value.\n\tcontrol.Elect(\"1\")\n\tcontrol.Barrier()\n\tbegin(t, conn)\n\tinsertOne(t, conns[\"1\"][0], 0)\n\tcommit(t, conn, 0)\n\n\t// The followers have it too.\n\tcontrol.Barrier()\n\tselectOne(t, conns[\"0\"][0])\n\tselectOne(t, conns[\"2\"][0])\n}", "title": "" }, { "docid": "2a084a23f41292515b01a0859420b3d5", "score": "0.5445375", "text": "func dbMain(filename string) int {\n\tdb, err := sql.Open(\"sqlite3_tracing\", filename)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to open database '%s': %#+v\\n\",\n\t\t\tfilename, err)\n\t\treturn 1\n\t}\n\tdefer db.Close()\n\n\terr = db.Ping()\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tdbSetup(db)\n\n\tdbDoInsert(db)\n\n\terr = txWrap(db, txDoInsert)\n\tif err != nil {\n\t\tlog.Panicf(\"Transaction Wrapper error: %v\\n\", err)\n\t}\n\n\tdbDoInsertPrepared(db)\n\n\terr = txWrap(db, txDoInsertPrepared)\n\tif err != nil {\n\t\tlog.Panicf(\"Transaction Wrapper error: %v\\n\", err)\n\t}\n\n\tdbDoSelect(db)\n\n\terr = txWrap(db, txDoSelect)\n\tif err != nil {\n\t\tlog.Panicf(\"Transaction Wrapper error: %v\\n\", err)\n\t}\n\n\tdbDoSelectPrepared(db)\n\n\terr = txWrap(db, txDoSelectPrepared)\n\tif err != nil {\n\t\tlog.Panicf(\"Transaction Wrapper error: %v\\n\", err)\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "861b09bede287e8587f5894dc2e718fa", "score": "0.54369307", "text": "func (c *Conn) Transaction(fn func(*Conn) error) error {\n\tconn := c.Begin()\n\tif err := fn(&Conn{DB: conn, log: c.log}); err != nil {\n\t\tconn.Rollback()\n\t\treturn err\n\t}\n\tconn.Commit()\n\treturn nil\n}", "title": "" }, { "docid": "256bcd4ed67b291cbfdee2bdc140b6f4", "score": "0.5429971", "text": "func (blp *BinlogPlayer) handleTxn() (bool, error) {\n\tvar err error\n\n\tdmlMatch := 0\n\ttxnCount := 0\n\tvar queryCount int64\n\tvar txnStartTime, queryStartTime time.Time\n\n\tfor _, dmlEvent := range blp.txnBuffer {\n\t\tswitch dmlEvent.Data.SqlType {\n\t\tcase cproto.BEGIN:\n\t\t\tcontinue\n\t\tcase cproto.COMMIT:\n\t\t\ttxnCount += 1\n\t\t\tif txnCount < blp.txnIndex {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err = blp.writeRecoveryPosition(&dmlEvent.Position.Position); err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tif err = blp.dbClient.Commit(); err != nil {\n\t\t\t\treturn false, fmt.Errorf(\"Failed query 'COMMIT', err: %s\", err)\n\t\t\t}\n\t\t\t// added 1 for recovery dml\n\t\t\tqueryCount += 2\n\t\t\tblp.blplStats.queryCount.Add(\"QueryCount\", queryCount)\n\t\t\tblp.blplStats.txnCount.Add(\"TxnCount\", int64(blp.txnIndex))\n\t\t\tblp.blplStats.txnTime.Record(\"TxnTime\", txnStartTime)\n\t\tcase cproto.DML:\n\t\t\tif blp.dmlTableMatch(dmlEvent.Data.Sql) {\n\t\t\t\tdmlMatch += 1\n\t\t\t\tif dmlMatch == 1 {\n\t\t\t\t\tif err = blp.dbClient.Begin(); err != nil {\n\t\t\t\t\t\treturn false, fmt.Errorf(\"Failed query 'BEGIN', err: %s\", err)\n\t\t\t\t\t}\n\t\t\t\t\tqueryCount += 1\n\t\t\t\t\ttxnStartTime = time.Now()\n\t\t\t\t}\n\n\t\t\t\tfor _, sql := range dmlEvent.Data.Sql {\n\t\t\t\t\tqueryStartTime = time.Now()\n\t\t\t\t\tif _, err = blp.dbClient.ExecuteFetch(sql, 0, false); err != nil {\n\t\t\t\t\t\tif sqlErr, ok := err.(*mysql.SqlError); ok {\n\t\t\t\t\t\t\t// Deadlock found when trying to get lock\n\t\t\t\t\t\t\t// Rollback this transaction and exit.\n\t\t\t\t\t\t\tif sqlErr.Number() == 1213 {\n\t\t\t\t\t\t\t\tlog.Infof(\"Detected deadlock, returning\")\n\t\t\t\t\t\t\t\t_ = blp.dbClient.Rollback()\n\t\t\t\t\t\t\t\treturn false, nil\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn false, err\n\t\t\t\t\t}\n\t\t\t\t\tblp.blplStats.txnTime.Record(\"QueryTime\", queryStartTime)\n\t\t\t\t}\n\t\t\t\tqueryCount += int64(len(dmlEvent.Data.Sql))\n\t\t\t}\n\t\tdefault:\n\t\t\treturn false, fmt.Errorf(\"Invalid SqlType %v\", dmlEvent.Data.SqlType)\n\t\t}\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "d7db486ff3589de8ebffcd9e4afc9fe7", "score": "0.5416393", "text": "func (tx *Tx) Commit() error { return tx.Tx.Commit() }", "title": "" }, { "docid": "57fbf2423fce549dd1a95abc0d026a62", "score": "0.5409256", "text": "func (d *Database) Commit(ctx context.Context, conn *database.TxConnection) error {\n\tspan := opentracing.SpanFromContext(ctx)\n\tif span != nil {\n\t\tdefer span.Finish()\n\t}\n\n\terr := conn.Tx.Commit()\n\tif err != nil {\n\t\tspan.LogFields(log.String(\"error\", err.Error()))\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "abe0b6134e498d997a658e014370bc64", "score": "0.5404626", "text": "func (m *DbMap) Begin(timeout time.Duration) (*Transaction, error) {\n\tt, err := m.DbMap.Begin()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// if acquiring a lock takes more than timeout duration, kill it\n\tif timeout != 0 {\n\t\t_, err = t.Exec(fmt.Sprintf(\"SET LOCAL lock_timeout=%d;\", int64(timeout/time.Millisecond)))\n\t\tif err != nil {\n\t\t\tt.Rollback()\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn &Transaction{Transaction: *t, dbmap: m}, nil\n}", "title": "" }, { "docid": "2d01b165ef64c5f4865eac38dce7a888", "score": "0.5397736", "text": "func (dbc *Connection) Begin(opts ...*sql.TxOptions) (*sql.Tx, error) {\n\treturn dbc.BeginContext(context.Background(), opts...)\n}", "title": "" }, { "docid": "345aba21bb436ab18b153c9b6eec010a", "score": "0.5391717", "text": "func (sdc *ShardConn) Commit() (err error) {\n\tif sdc.TransactionId() == 0 {\n\t\treturn sdc.WrapError(fmt.Errorf(\"cannot commit: not in transaction\"))\n\t}\n\treturn sdc.WrapError(sdc.conn.Commit())\n}", "title": "" }, { "docid": "0e01f0d8dd8f1709c3fb7ac89da31aaa", "score": "0.5387876", "text": "func (r *rbfDBQueryContexts) writeTx(rq *rbfQueryContext) (*rbfTxWrappers, error) {\n\tr.mu.Lock()\n\tdefer r.mu.Unlock()\n\tok := r.lockCheck.TryLock()\n\tif !ok {\n\t\treturn nil, errors.New(\"locking error: tried for write Tx when it was already held\")\n\t}\n\ttx, err := r.db.Begin(true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tq := &rbfTxWrappers{db: r, tx: tx, key: r.key, queries: make(map[fragKey]QueryRead), writeTx: true}\n\tr.queryContexts[q] = rq\n\treturn q, nil\n}", "title": "" }, { "docid": "5166cf8dfd00c241abf9a89d060872e9", "score": "0.53853714", "text": "func (dbs *DBs) Beginx() (res *Txx, err error) {\n\tvar (\n\t\tw *wrapper\n\t\tr interface{}\n\t)\n\n\tfor {\n\t\tif w, err = getDBFromBalancer(dbs.masters); err != nil {\n\t\t\treportError(\"Beginx\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// executing\n\t\tr, err = retryFunc(\"START TRANSACTION\", func() (interface{}, error) {\n\t\t\treturn w.db.Beginx()\n\t\t})\n\t\tif r != nil {\n\t\t\tres = &Txx{\n\t\t\t\tTx: r.(*sqlx.Tx),\n\t\t\t}\n\t\t}\n\n\t\t// check networking/wsrep error\n\t\tvar should bool\n\t\tif should, err = shouldFailure(w, dbs.masters.isWsrep, err); should {\n\t\t\tdbs.masters.failure(w, err)\n\t\t\tcontinue\n\t\t}\n\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "394ca45c4af761d8ad75beb605350979", "score": "0.537328", "text": "func (db *Connection) Begin() (*Tx, error) {\n\ttx, err := db.DB.Begin()\n\tif err != nil {\n\t\treturn nil, db.EventErr(\"dbr.begin.error\", err)\n\t}\n\tdb.Event(\"dbr.begin\")\n\n\treturn &Tx{Connection: db, Tx: tx}, nil\n}", "title": "" }, { "docid": "527eeaa90ce129e4ded24eb542e034b1", "score": "0.5360615", "text": "func TestErrorInTransaction(t *testing.T) {\n\tdb := setupDB(t)\n\tdefer teardown(t, db)\n\tif db.Dialect == postgresql.Dialect {\n\t\tt.Skipf(\"%s works differently, see TestAbortedTransaction\", db.Dialect)\n\t}\n\n\tperson1 := &Person{ID: 42, Email: pointer.ToString(gofakeit.Email())}\n\tperson2 := &Person{ID: 43, Email: pointer.ToString(gofakeit.Email())}\n\n\t// commit works\n\ttx, err := db.Begin()\n\trequire.NoError(t, err)\n\tassert.NoError(t, insertPersonWithID(t, tx.Querier, person1))\n\tassert.Error(t, insertPersonWithID(t, tx.Querier, person1)) // duplicate PK\n\tassert.NoError(t, insertPersonWithID(t, tx.Querier, person2)) // INSERT works\n\tassert.NoError(t, tx.Commit())\n\tassert.Equal(t, tx.Commit(), reform.ErrTxDone)\n\tassert.Equal(t, tx.Rollback(), reform.ErrTxDone)\n\tassert.NoError(t, db.Reload(person1))\n\tassert.NoError(t, db.Reload(person2))\n\tassert.NoError(t, db.Delete(person1))\n\tassert.NoError(t, db.Delete(person2))\n\n\t// rollback works\n\ttx, err = db.Begin()\n\trequire.NoError(t, err)\n\tassert.NoError(t, insertPersonWithID(t, tx.Querier, person1))\n\tassert.Error(t, insertPersonWithID(t, tx.Querier, person1)) // duplicate PK\n\tassert.NoError(t, insertPersonWithID(t, tx.Querier, person2)) // INSERT works\n\tassert.NoError(t, tx.Rollback())\n\tassert.Equal(t, tx.Commit(), reform.ErrTxDone)\n\tassert.Equal(t, tx.Rollback(), reform.ErrTxDone)\n\tassert.EqualError(t, db.Reload(person1), reform.ErrNoRows.Error())\n\tassert.EqualError(t, db.Reload(person2), reform.ErrNoRows.Error())\n}", "title": "" }, { "docid": "527808bfc2f57ef77e9f1f5f3a9eaf9b", "score": "0.5354802", "text": "func (r *Repository) ExecInTransaction(eh EventHandler) error {\n\t//if r.Conn == nil {\n\tr.Conn = open()\n\t//}\n\t//defer r.Conn.Close()\n\tr.Tx, _ = r.Conn.Beginx()\n\terr := eh()\n\tif err != nil {\n\t\tr.Tx.Rollback()\n\t\treturn err\n\t}\n\terr = r.Tx.Commit()\n\tr.Tx = nil\n\treturn err\n}", "title": "" }, { "docid": "b98e9370fa016aa16f3e57230b08b175", "score": "0.53546244", "text": "func inTransaction(_func sqlFunctionTx) (error) {\n\n\tdb, err := Connect()\n\n\tif(err != nil) {\n\n\t\tlog.Printf(\"Error opening DB connection: %s\", err)\n\t\treturn err;\n\t}\n\n\ttx, err := db.Begin()\n\n\tif(err != nil) {\n\n\t\tlog.Printf(\"Error starting DB transaction: %s\", err)\n\t\treturn err;\n\t}\n\n\terr = _func(tx)\n\n\tif(err != nil) {\n\n\t\tlog.Printf(\"Rollback transaction: %s\", err)\n\t\ttx.Rollback()\n\t} else {\n\n\t\tlog.Print(\"Commit transaction\")\n\t\ttx.Commit()\n\t}\n\n\treturn err;\n}", "title": "" }, { "docid": "924c1e1cf0da104ec4bcf3202d30e817", "score": "0.5343522", "text": "func (s *Tasks) BeginTransaction() (*sql.Tx, error) {\n\treturn s.Conn.Begin()\n}", "title": "" }, { "docid": "20beb26180d4efab2fb8bab3fc1d8a54", "score": "0.5327305", "text": "func (db *FlashDB) managed(writable bool, fn func(tx *Tx) error) (err error) {\n\tvar tx *Tx\n\ttx, err = db.Begin(writable)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\t// The caller returned an error. We must rollback.\n\t\t\t_ = tx.Rollback()\n\t\t\treturn\n\t\t}\n\t\tif writable {\n\t\t\t// Everything went well. Lets Commit()\n\t\t\terr = tx.Commit()\n\t\t} else {\n\t\t\t// read-only transaction can only roll back.\n\t\t\terr = tx.Rollback()\n\t\t}\n\t}()\n\terr = fn(tx)\n\treturn\n}", "title": "" }, { "docid": "9eba099b99200fff44183f5c69d0f47c", "score": "0.5324532", "text": "func (m *Transaction) Commit() error {\n\tif m.closed {\n\t\treturn nil\n\t}\n\tif m.err != nil {\n\t\tfmt.Println(\"db: rolling back\")\n\t\tif err := m.tx.Rollback(); err != nil {\n\t\t\tfmt.Printf(\"db: error doing rollback: %s\", err.Error())\n\t\t}\n\t\tm.closed = true\n\t\treturn m.err\n\t}\n\terr := m.tx.Commit()\n\tm.closed = true\n\tif err != nil {\n\t\tfmt.Printf(\"db: error doing commit: %s\", err.Error())\n\t}\n\treturn err\n}", "title": "" }, { "docid": "394b939006879684583d019f11d30622", "score": "0.53227484", "text": "func (db *db) BeginReadWriteTx() (walletdb.ReadWriteTx, error) {\n\treturn newReadWriteTx(db, false)\n}", "title": "" }, { "docid": "d2d598761b100d6ecdffd3027ac37ceb", "score": "0.53221565", "text": "func (tx *Tx) Commit() error {\n\tif tx.db == nil {\n\t\treturn ErrTxClosed\n\t} else if !tx.writable {\n\t\treturn ErrTxNotWritable\n\t}\n\tvar err error\n\tif tx.db.persist && (len(tx.wc.commitItems) > 0) && tx.writable {\n\t\tbatch := new(aol.Batch)\n\t\t// Each committed record is written to disk\n\t\tfor _, r := range tx.wc.commitItems {\n\t\t\trec, err := r.encode()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbatch.Write(rec)\n\t\t}\n\t\t// If this operation fails then the write did failed and we must\n\t\t// rollback.\n\t\terr = tx.db.log.WriteBatch(batch)\n\t\tif err != nil {\n\t\t\ttx.rollback()\n\t\t}\n\t}\n\n\t// apply all commands\n\terr = tx.buildRecords(tx.wc.commitItems)\n\t// Unlock the database and allow for another writable transaction.\n\ttx.unlock()\n\t// Clear the db field to disable this transaction from future use.\n\ttx.db = nil\n\treturn err\n}", "title": "" }, { "docid": "693a8def61fad1a14c12e38cca6c75bf", "score": "0.53187114", "text": "func (c *MssqlConn) Begin() (driver.Tx, error) {\n\tt := &MssqlConnTx{conn: c.conn}\n\treturn t, t.begin()\n}", "title": "" }, { "docid": "96e955035a5b522b9e768d0f336e3511", "score": "0.5311445", "text": "func (c *Conn) Begin() (driver.Tx, error) {\n\treturn fakeTransaction{}, nil\n}", "title": "" }, { "docid": "9da17067bb5d0f56cb232643cffece10", "score": "0.53093606", "text": "func (conn *IRODSConnection) Commit() error {\n\treturn conn.endTransaction(true)\n}", "title": "" }, { "docid": "b3686d0f133174f3dc15139113e714e8", "score": "0.53087187", "text": "func (w *WrapType) TransactionBegin() {\n\tif w.sharePtr.errVal == nil {\n\t\tif w.sharePtr.tx == nil {\n\t\t\tw.sharePtr.tx, w.sharePtr.errVal = w.sharePtr.hnd.Begin()\n\t\t} else {\n\t\t\tw.sharePtr.errVal = errors.New(\"nested transactions not supported\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6864e4a3b4ae634db668611a9ae872bb", "score": "0.5308049", "text": "func (dbs *DBs) BeginTx(ctx context.Context, opts *sql.TxOptions) (res *Tx, err error) {\n\tvar (\n\t\tw *wrapper\n\t\tr interface{}\n\t)\n\n\tfor {\n\t\tif w, err = getDBFromBalancer(dbs.masters); err != nil {\n\t\t\treportError(\"BeginTx\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// executing\n\t\tr, err = retryFunc(\"START TRANSACTION\", func() (interface{}, error) {\n\t\t\treturn w.db.BeginTx(ctx, opts)\n\t\t})\n\t\tif r != nil {\n\t\t\tres = &Tx{\n\t\t\t\tTx: r.(*sql.Tx),\n\t\t\t}\n\t\t}\n\n\t\t// check networking/wsrep error\n\t\tvar should bool\n\t\tif should, err = shouldFailure(w, dbs.masters.isWsrep, err); should {\n\t\t\tdbs.masters.failure(w, err)\n\t\t\tcontinue\n\t\t}\n\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "5672fc061409a1f3aecc54aa5b01b6de", "score": "0.5300746", "text": "func (sdc *ShardConn) Begin() (err error) {\n\tif sdc.TransactionId() != 0 {\n\t\treturn sdc.WrapError(fmt.Errorf(\"cannot begin: already in transaction\"))\n\t}\n\tfor i := 0; i < sdc.retryCount; i++ {\n\t\tif sdc.conn == nil {\n\t\t\tvar addr string\n\t\t\taddr, err = sdc.balancer.Get()\n\t\t\tif err != nil {\n\t\t\t\treturn sdc.WrapError(err)\n\t\t\t}\n\t\t\tvar conn TabletConn\n\t\t\tconn, err = GetDialer(sdc.tabletProtocol)(addr, sdc.keyspace, sdc.shard, \"\", \"\", false)\n\t\t\tif err != nil {\n\t\t\t\tsdc.balancer.MarkDown(addr)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tsdc.address = addr\n\t\t\tsdc.conn = conn\n\t\t}\n\t\terr = sdc.conn.Begin()\n\t\tif sdc.canRetry(err) {\n\t\t\tcontinue\n\t\t}\n\t\treturn sdc.WrapError(err)\n\t}\n\treturn sdc.WrapError(err)\n}", "title": "" }, { "docid": "fc6dcfb6195c7bef9058fbd4434572de", "score": "0.5297112", "text": "func (c *Conn) Begin(ctx context.Context) (Tx, error) {\n\treturn c.BeginTx(ctx, TxOptions{})\n}", "title": "" }, { "docid": "2a9b30e5498944b1faad84764d7c5383", "score": "0.5291901", "text": "func TestIntegration_Undo_HookCheck_NotLeader(t *testing.T) {\n\tconns, control, cleanup := newCluster(t)\n\tdefer cleanup()\n\n\tcontrol.Elect(\"0\").When().Command(3).Committed().Depose()\n\n\tconn := conns[\"0\"][0]\n\n\t// Lower SQLite's page cache size to force it to write uncommitted\n\t// dirty pages to the WAL.\n\tlowerCacheSize(t, conn)\n\n\t// Start a write transaction and insert enough data to cause page cache\n\t// stress and flush to the WAL and trigger exactly one Frames\n\t// command. After the Frames command gets committed the leader gets\n\t// deposed.\n\tbegin(t, conn)\n\tinsertN(t, conn, 500)\n\trollback(t, conn)\n\n\tcontrol.Elect(\"1\")\n\tcontrol.Barrier()\n\n\t// No node sees the commit\n\tselectZero(t, conns[\"0\"][0])\n\tselectZero(t, conns[\"1\"][0])\n\tselectZero(t, conns[\"2\"][0])\n}", "title": "" }, { "docid": "ea8f62c7f831601753e3d39c6cbf2c58", "score": "0.52903235", "text": "func (t *transactioner) beginTx(_ context.Context) error {\n\ttx, err := t.Config.DB.BeginTxx(t.ctx, txOptionsReadUncommitted)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"(*transactioner).beginTx: begin transaction\")\n\t}\n\n\tt.tx, t.txQueryCount = tx, 0\n\n\ttombCtx, cancel := context.WithCancel(t.ctx)\n\tt.cancel = cancel\n\tt.tomb, _ = tomb.WithContext(tombCtx)\n\tt.tomb.Go(t.transactionCommitter)\n\n\treturn nil\n}", "title": "" }, { "docid": "411d1b7fcd3d0fa767e47c5fcaf748de", "score": "0.52801263", "text": "func (w *DB) Commit() error {\n\treturn w.tx.Commit()\n}", "title": "" }, { "docid": "bfdbbc19ecafbd86ca2404d9f7d41840", "score": "0.52789485", "text": "func (d *Db) Begin(opts ...*sql.TxOptions) ITx {\n\topts = append(opts, nil)\n\tctx, _ := context.WithTimeout(context.Background(), DefaultDbTimeout)\n\treturn d.BeginContext(ctx, opts[0])\n}", "title": "" }, { "docid": "6ef5800b3b877035c5d1305af4fc39d6", "score": "0.5278617", "text": "func (dia *Dialect) Begin() (tx *sql.Tx, err error) {\n\ttx, err = dia.db.Begin()\n\treturn\n}", "title": "" }, { "docid": "461541f2f14843a29cd86abf6b750b48", "score": "0.5277887", "text": "func (p *ConnPool) DoInTransaction(handler func(*Conn) error) error {\n\treturn p.Do(func(conn *Conn) error {\n\t\tconn.Begin()\n\t\terr := handler(conn)\n\t\tif err != nil {\n\t\t\tconn.Rollback()\n\t\t} else {\n\t\t\tconn.Commit()\n\t\t}\n\t\treturn err\n\t})\n}", "title": "" }, { "docid": "d7913a5954e2a47daff2253f04ef6ac0", "score": "0.5274496", "text": "func (s *testSessionSuite) TestTxnLazyInitialize(c *C) {\n\ttk := testkit.NewTestKitWithInit(c, s.store)\n\ttk.MustExec(\"drop table if exists t\")\n\ttk.MustExec(\"create table t (id int)\")\n\n\ttk.MustExec(\"set @@autocommit = 0\")\n\ttxn, err := tk.Se.Txn(false)\n\tc.Assert(err, IsNil)\n\tc.Assert(txn.Valid(), IsFalse)\n\ttk.MustQuery(\"select @@tidb_current_ts\").Check(testkit.Rows(\"0\"))\n\ttk.MustQuery(\"select @@tidb_current_ts\").Check(testkit.Rows(\"0\"))\n\n\t// Those statement should not start a new transaction automacally.\n\ttk.MustQuery(\"select 1\")\n\ttk.MustQuery(\"select @@tidb_current_ts\").Check(testkit.Rows(\"0\"))\n\n\ttk.MustExec(\"set @@tidb_general_log = 0\")\n\ttk.MustQuery(\"select @@tidb_current_ts\").Check(testkit.Rows(\"0\"))\n\n\ttk.MustQuery(\"explain select * from t\")\n\ttk.MustQuery(\"select @@tidb_current_ts\").Check(testkit.Rows(\"0\"))\n\n\t// Begin statement should start a new transaction.\n\ttk.MustExec(\"begin\")\n\ttxn, err = tk.Se.Txn(false)\n\tc.Assert(err, IsNil)\n\tc.Assert(txn.Valid(), IsTrue)\n\ttk.MustExec(\"rollback\")\n\n\ttk.MustExec(\"select * from t\")\n\ttxn, err = tk.Se.Txn(false)\n\tc.Assert(err, IsNil)\n\tc.Assert(txn.Valid(), IsTrue)\n\ttk.MustExec(\"rollback\")\n\n\ttk.MustExec(\"insert into t values (1)\")\n\ttxn, err = tk.Se.Txn(false)\n\tc.Assert(err, IsNil)\n\tc.Assert(txn.Valid(), IsTrue)\n\ttk.MustExec(\"rollback\")\n}", "title": "" }, { "docid": "b6d152604e5e9776f275866cc8b54848", "score": "0.52720636", "text": "func (t *mockTxn) Commit(ctx context.Context) error {\n\ttrace_util_0.Count(_mock_00000, 0)\n\treturn ErrTxnRetryable\n}", "title": "" }, { "docid": "08f69853c9e5b2ade6458b538ccc7aed", "score": "0.5270383", "text": "func (mvcc *MVCCLevelDB) Cleanup(key []byte, startTS, currentTS uint64) error {\n\tmvcc.mu.Lock()\n\tdefer func() {\n\t\tmvcc.mu.Unlock()\n\t\tmvcc.deadlockDetector.CleanUp(startTS)\n\t}()\n\n\tbatch := &leveldb.Batch{}\n\tstartKey := mvccEncode(key, lockVer)\n\titer := newIterator(mvcc.getDB(\"\"), &util.Range{\n\t\tStart: startKey,\n\t})\n\tdefer iter.Release()\n\n\tif iter.Valid() {\n\t\tdec := lockDecoder{\n\t\t\texpectKey: key,\n\t\t}\n\t\tok, err := dec.Decode(iter)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// If current transaction's lock exists.\n\t\tif ok && dec.lock.startTS == startTS {\n\t\t\t// If the lock has already outdated, clean up it.\n\t\t\tif currentTS == 0 || uint64(oracle.ExtractPhysical(dec.lock.startTS))+dec.lock.ttl < uint64(oracle.ExtractPhysical(currentTS)) {\n\t\t\t\tif err = rollbackLock(batch, key, startTS); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\treturn mvcc.getDB(\"\").Write(batch, nil)\n\t\t\t}\n\n\t\t\t// Otherwise, return a locked error with the TTL information.\n\t\t\treturn dec.lock.lockErr(key)\n\t\t}\n\n\t\t// If current transaction's lock does not exist.\n\t\t// If the commit information of the current transaction exist.\n\t\tc, ok, err := getTxnCommitInfo(iter, key, startTS)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif ok {\n\t\t\t// If the current transaction has already committed.\n\t\t\tif c.valueType != typeRollback {\n\t\t\t\treturn ErrAlreadyCommitted(c.commitTS)\n\t\t\t}\n\t\t\t// If the current transaction has already rollbacked.\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// If current transaction is not prewritted before.\n\tvalue := mvccValue{\n\t\tvalueType: typeRollback,\n\t\tstartTS: startTS,\n\t\tcommitTS: startTS,\n\t}\n\twriteKey := mvccEncode(key, startTS)\n\twriteValue, err := value.MarshalBinary()\n\tif err != nil {\n\t\treturn err\n\t}\n\tbatch.Put(writeKey, writeValue)\n\treturn nil\n}", "title": "" }, { "docid": "3cbe665b39bf97d7670a27ffef48bbbd", "score": "0.52621454", "text": "func (table *Table) Commit() error {\n\tif table.Count > 0 {\n\t\ttable.CurrentInsertStmt = table.CurrentInsertStmt[0 : len(table.CurrentInsertStmt)-2]\n\t\t_, err := table.Tx.Exec(table.CurrentInsertStmt, table.CurrentInterfaceList...)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t\ttable.Count = 0\n\t\ttable.CurrentInsertStmt = table.InsertStmt\n\t\ttable.CurrentInterfaceList = []interface{}{}\n\t}\n\terr := table.Tx.Commit()\n\tif err != nil {\n\t\treturn err\n\t}\n\ttx, err := table.Conn.Begin()\n\ttable.Tx = tx\n\treturn err\n}", "title": "" }, { "docid": "235faa9a178ae74c757809dfed218993", "score": "0.52458775", "text": "func (c *Connection) Transaction(fn func(tx *Connection) error) error {\n\treturn c.Dialect.Lock(func() (err error) {\n\t\tvar dberr error\n\n\t\tcn, err := c.NewTransaction()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttxlog(logging.SQL, cn, \"BEGIN Transaction ---\")\n\n\t\tdefer func() {\n\t\t\tif ex := recover(); ex != nil {\n\t\t\t\ttxlog(logging.SQL, cn, \"ROLLBACK Transaction (inner function panic) ---\")\n\t\t\t\tdberr = cn.TX.Rollback()\n\t\t\t\tif dberr != nil {\n\t\t\t\t\ttxlog(logging.Error, cn, \"database error while inner panic rollback: %w\", dberr)\n\t\t\t\t}\n\t\t\t\tpanic(ex)\n\t\t\t}\n\t\t}()\n\n\t\terr = fn(cn)\n\t\tif err != nil {\n\t\t\ttxlog(logging.SQL, cn, \"ROLLBACK Transaction ---\")\n\t\t\tdberr = cn.TX.Rollback()\n\t\t} else {\n\t\t\ttxlog(logging.SQL, cn, \"END Transaction ---\")\n\t\t\tdberr = cn.TX.Commit()\n\t\t}\n\n\t\tif dberr != nil {\n\t\t\treturn fmt.Errorf(\"database error on committing or rolling back transaction: %w\", dberr)\n\t\t}\n\n\t\treturn err\n\t})\n\n}", "title": "" }, { "docid": "53f0f0ad78123dc704e1d20b5efaad3a", "score": "0.5243016", "text": "func (t *Transaction) Commit(ctx context.Context) error {\n\tt.mu.Lock()\n\tdefer t.mu.Unlock()\n\n\tif t.current == nil || reflect.ValueOf(t.current.CommonDB()).IsNil() {\n\t\treturn nil\n\t}\n\tt.current.Commit()\n\terr := t.current.Error\n\tif err == nil {\n\t\tfor i := range t.afterCommitHook {\n\t\t\tt.afterCommitHook[i](ctx)\n\t\t}\n\t}\n\tt.current = nil\n\treturn err\n}", "title": "" }, { "docid": "81da0a0cb9a0d76cda8512b9e4ccd191", "score": "0.52410316", "text": "func (d *Dao) BeginTran(ctx context.Context) (tx *xsql.Tx, err error) {\n\treturn d.db.Begin(ctx)\n}", "title": "" }, { "docid": "03694e1815c96d27f2628c54519a94b0", "score": "0.5240628", "text": "func DBLock() { lock.Lock() }", "title": "" }, { "docid": "d461b1a7a035483e4a6b3d8bee0bf2b9", "score": "0.52387375", "text": "func startTransaction(ctx *sql.Context) error {\n\tif ctx.GetTransaction() == nil {\n\t\tts, ok := ctx.Session.(sql.TransactionSession)\n\t\tif ok {\n\t\t\ttx, err := ts.StartTransaction(ctx, sql.ReadWrite)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tctx.SetTransaction(tx)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "39506c4a60764139e987fd468b9fd550", "score": "0.52370644", "text": "func transaction(db *sql.DB, f func(*sql.Tx) error) (err error) {\n\tif db == nil {\n\t\tpanic(\"darwin: sql.DB is nil\")\n\t}\n\n\ttx, err := db.Begin()\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdefer func() {\n\t\tif p := recover(); p != nil {\n\t\t\tswitch p := p.(type) {\n\t\t\tcase error:\n\t\t\t\terr = p\n\t\t\tdefault:\n\t\t\t\terr = fmt.Errorf(\"%s\", p)\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\ttx.Rollback()\n\t\t\treturn\n\t\t}\n\t\terr = tx.Commit()\n\t}()\n\n\treturn f(tx)\n}", "title": "" }, { "docid": "17edc9bf4f2491159a9cfeb8cdf0ac5e", "score": "0.523473", "text": "func (db *TransactionDB) Write(opts *WriteOptions, batch *WriteBatch) (err error) {\n\tvar cErr *C.char\n\n\tC.rocksdb_transactiondb_write(db.c, opts.c, batch.c, &cErr)\n\terr = fromCError(cErr)\n\n\treturn\n}", "title": "" }, { "docid": "849d1fb1b6f322966179ef47d3f8cf08", "score": "0.5233749", "text": "func (d *Dao) BeginTran(c context.Context) (*xsql.Tx, error) {\n\treturn d.db.Begin(c)\n}", "title": "" }, { "docid": "c4db66179c3bcb6498502854202fc1a6", "score": "0.5233242", "text": "func (cn *connDb) commit(btx *sql.Tx) error {\n\treturn btx.Commit()\n}", "title": "" }, { "docid": "fb713e56b8ec39a5da0a3ce7511589a7", "score": "0.5230894", "text": "func internalRunInTransaction(ctx context.Context, tx PgxTxLoader, fn func(ctx context.Context, tx PgxTxLoader) error) error {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\t_ = tx.Rollback(ctx)\n\t\t\tpanic(err)\n\t\t}\n\t}()\n\n\tif err := fn(ctx, tx); err != nil {\n\t\t_ = tx.Rollback(ctx)\n\t\treturn err\n\t}\n\n\treturn tx.Commit(ctx)\n}", "title": "" }, { "docid": "3d2366a20bd64f3a91e00cc8a754867b", "score": "0.52301586", "text": "func (db *Database) OpenTransaction() (*Database, error) {\n\n\tif db.transaction != nil {\n\t\tlog.Errorf(\"there is an active transaction already\")\n\t\treturn db, fmt.Errorf(\"there is an active transaction already\")\n\t}\n\tvar err error\n\tdb.transaction, err = db.connection.Begin()\n\treturn db, err\n}", "title": "" } ]
372f51b03665b62664e6e3280535466f
TypeIDs returns the type ids in the mutation. Note that ids always returns len(ids) <= 1 for unique edges, and you should use TypeID instead. It exists only for internal usage by the builders.
[ { "docid": "21cd07c54f60f07ab77ce2ac75f1649d", "score": "0.76457727", "text": "func (m *MenuMutation) TypeIDs() (ids []int) {\n\tif id := m._type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "2b8fff70cc93bb7a3b597f22bf581d18", "score": "0.8026092", "text": "func (m *ServiceMutation) TypeIDs() (ids []int) {\n\tif id := m._type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "66fab8555cda88e9dd811aa5414af43d", "score": "0.7952374", "text": "func (m *EquipmentMutation) TypeIDs() (ids []int) {\n\tif id := m._type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "00c891cd2ee6776c5879d78d3227af1a", "score": "0.7828299", "text": "func (m *ProjectMutation) TypeIDs() (ids []int) {\n\tif id := m._type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "cb147ba2eea04c68ec96ca8f07b6e41e", "score": "0.7827752", "text": "func (m *WorkOrderMutation) TypeIDs() (ids []int) {\n\tif id := m._type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "5798d6fde44f95d42ee14a23ffac3198", "score": "0.78070325", "text": "func (m *PropertyMutation) TypeIDs() (ids []int) {\n\tif id := m._type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "5798d6fde44f95d42ee14a23ffac3198", "score": "0.78070325", "text": "func (m *PropertyMutation) TypeIDs() (ids []int) {\n\tif id := m._type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "2a75d303fc08c49b77e49e1cb0423d0c", "score": "0.7781531", "text": "func (m *WorkOrderDefinitionMutation) TypeIDs() (ids []int) {\n\tif id := m._type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "8c7183338dde1e93a07ab467f66b2b00", "score": "0.77255344", "text": "func (m *LocationMutation) TypeIDs() (ids []int) {\n\tif id := m._type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "081e4f6cdc3725cf92d067ddfde41cf4", "score": "0.77198815", "text": "func (m *WorkOrderTemplateMutation) TypeIDs() (ids []int) {\n\tif id := m._type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "7c531116d2f891c80b6cbcd3e6afc1e2", "score": "0.76343936", "text": "func (m *ProjectTemplateMutation) TypeIDs() (ids []int) {\n\tif id := m._type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "45e3ce023eaa8564dd9ce3d1f110f280", "score": "0.7595682", "text": "func (m *EquipmentCategoryMutation) TypesIDs() (ids []int) {\n\tfor id := range m.types {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "ec711496c2a647b6ed8f0fd99e0c80f6", "score": "0.6567977", "text": "func (m *EquipmentPortDefinitionMutation) EquipmentTypeIDs() (ids []int) {\n\tif id := m.equipment_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "228cc8ac27419727fb394eb44c92dd7d", "score": "0.656112", "text": "func (m *ServiceEndpointDefinitionMutation) EquipmentTypeIDs() (ids []int) {\n\tif id := m.equipment_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "46509d0839802e257810ec5551e8cbdb", "score": "0.65566915", "text": "func (m *UserMutation) UsertypeIDs() (ids []int) {\n\tif id := m.usertype; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "621fa5a765acf58f8ddb0d42c0ccec6d", "score": "0.6555837", "text": "func (m *EquipmentPositionDefinitionMutation) EquipmentTypeIDs() (ids []int) {\n\tif id := m.equipment_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "49328cd6af6321828eba5f1878a61e28", "score": "0.6529547", "text": "func (m *PropertyTypeMutation) EquipmentTypeIDs() (ids []int) {\n\tif id := m.equipment_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "5284d8424b19af937af5ce9f9b87d760", "score": "0.6528308", "text": "func (m *ActivitiesMutation) ActivitytypeIDs() (ids []int) {\n\tif id := m.activitytype; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "38f87f0709112e303b5c26e17f755a42", "score": "0.6509282", "text": "func (m *RuleMutation) RuletypeIDs() (ids []int) {\n\tif id := m.ruletype; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "27f4ff65368fcd4dda67c18c3e89e6fc", "score": "0.6500088", "text": "func (m *ServiceEndpointDefinitionMutation) ServiceTypeIDs() (ids []int) {\n\tif id := m.service_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "4fa998b5fed187ece812c34ad0ce4888", "score": "0.64364856", "text": "func (m *EquipmentCategoryMutation) AddTypeIDs(ids ...int) {\n\tif m.types == nil {\n\t\tm.types = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.types[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "f5e7a0f62d9875733c86a21af497b61e", "score": "0.6423662", "text": "func (m *WorkOrderDefinitionMutation) ProjectTypeIDs() (ids []int) {\n\tif id := m.project_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "fb1d0ad850b6e567fe418ae000e57f54", "score": "0.6406941", "text": "func (m *PropertyTypeMutation) WorkerTypeIDs() (ids []int) {\n\tif id := m.worker_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "ad8a1abffb26424f0f5d8f2492962171", "score": "0.6399765", "text": "func (m *PropertyTypeMutation) LocationTypeIDs() (ids []int) {\n\tif id := m.location_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "0cea69d6e60d4fffea976f16ce81cd02", "score": "0.63976556", "text": "func (m *PropertyTypeMutation) ProjectTypeIDs() (ids []int) {\n\tif id := m.project_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "696e8d91793884837d5f650a3d1d62fe", "score": "0.6349847", "text": "func (m *ClubMutation) ClubtypeIDs() (ids []int) {\n\tif id := m.clubtype; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "df37c6eaf036d7f7927cfa46778fff8b", "score": "0.6347923", "text": "func (m *FileCategoryTypeMutation) LocationTypeIDs() (ids []int) {\n\tif id := m.location_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "4476a8c667a9357fbee7a4ae750babfd", "score": "0.63069475", "text": "func (m *PaymentMutation) RoomtypeIDs() (ids []int) {\n\tif id := m.roomtype; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f8877ec97039b0d90427647486c857f9", "score": "0.6297331", "text": "func (m *PropertyTypeMutation) ServiceTypeIDs() (ids []int) {\n\tif id := m.service_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "8830a0a425a159ff0e00abc56a5afe7d", "score": "0.6293577", "text": "func (m *SurveyTemplateCategoryMutation) LocationTypeIDs() (ids []int) {\n\tif id := m.location_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "564c1cc77d23791aef73d4be01bbacd5", "score": "0.6216693", "text": "func (id ID) Types() (Types, error) {\n\treturn NewIDDecompressor().Decompress(id)\n}", "title": "" }, { "docid": "4800f85ef272cacb69254b7a294ae3c3", "score": "0.61721116", "text": "func (m *PaymentMutation) PaymenttypeIDs() (ids []int) {\n\tif id := m.paymenttype; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "c9076d847abb15165a061209ed661b61", "score": "0.6159079", "text": "func (m *LocationTypeMutation) FileCategoryTypeIDs() (ids []int) {\n\tfor id := range m.file_category_type {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "22df1fabb99590b521496e49ea5e5f34", "score": "0.6157117", "text": "func (m *EquipmentCategoryMutation) RemoveTypeIDs(ids ...int) {\n\tif m.removedtypes == nil {\n\t\tm.removedtypes = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.removedtypes[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "446efb233a49171bdc77e20052bb61de", "score": "0.61494714", "text": "func (m *ResourcePoolMutation) ResourceTypeIDs() (ids []int) {\n\tif id := m.resource_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "681e8831dc0a5dad09418f221d01c424", "score": "0.6136887", "text": "func getTypeIDs() ([]int32, error) {\n\tpage := int32(1)\n\tvar typeIDs []int32\n\tparams := esi.GetUniverseTypesOpts{\n\t\tPage: optional.NewInt32(page),\n\t}\n\n\ttypeResult, _, err := esiClient.ESI.UniverseApi.GetUniverseTypes(nil, &params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttypeIDs = append(typeIDs, typeResult...)\n\n\tfor len(typeResult) > 0 {\n\t\tpage++\n\t\tparams := esi.GetUniverseTypesOpts{\n\t\t\tPage: optional.NewInt32(page),\n\t\t}\n\t\ttypeResult, _, err = esiClient.ESI.UniverseApi.GetUniverseTypes(nil, &params)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttypeIDs = append(typeIDs, typeResult...)\n\t}\n\n\treturn typeIDs, nil\n}", "title": "" }, { "docid": "8389526c9b960de29dec3e15b8102bb1", "score": "0.6120274", "text": "func (m *EquipmentCategoryMutation) RemovedTypesIDs() (ids []int) {\n\tfor id := range m.removedtypes {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "18e6d4805755cb350f24479f52144ff4", "score": "0.6100292", "text": "func (m *ServiceTypeMutation) PropertyTypesIDs() (ids []int) {\n\tfor id := range m.property_types {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "e855cd8f925fdfa618d65815ba5a59c1", "score": "0.6070666", "text": "func (m *WorkOrderTemplateMutation) PropertyTypesIDs() (ids []int) {\n\tfor id := range m.property_types {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "ffb1b2a2ad39abc3e5a6ae9a9f143459", "score": "0.60361654", "text": "func (m *WorkerTypeMutation) PropertyTypesIDs() (ids []int) {\n\tfor id := range m.property_types {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "bdaca542349a356408af8b986eb6def5", "score": "0.6016734", "text": "func (m *PropertyTypeMutation) WorkOrderTypeIDs() (ids []int) {\n\tif id := m.work_order_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "63e3bb4a91386614015d9242016321b5", "score": "0.60162395", "text": "func (m *RoomMutation) RoomRoomtypeIDs() (ids []int) {\n\tif id := m._RoomRoomtype; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "0bfa0cf541275e5835de7178c44ac088", "score": "0.5994249", "text": "func (m *ResourceTypeMutation) PropertyTypesIDs() (ids []int) {\n\tfor id := range m.property_types {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "43c7177b56839dcd20e950f61c8426ce", "score": "0.5986684", "text": "func (m *EquipmentPortDefinitionMutation) EquipmentPortTypeIDs() (ids []int) {\n\tif id := m.equipment_port_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "c08bd9ca7ee3f267ddef55f229271185", "score": "0.5963477", "text": "func (m *UserMutation) IDs(ctx context.Context) ([]int64, error) {\n\tswitch {\n\tcase m.op.Is(OpUpdateOne | OpDeleteOne):\n\t\tid, exists := m.ID()\n\t\tif exists {\n\t\t\treturn []int64{id}, nil\n\t\t}\n\t\tfallthrough\n\tcase m.op.Is(OpUpdate | OpDelete):\n\t\treturn m.Client().User.Query().Where(m.predicates...).IDs(ctx)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"IDs is not allowed on %s operations\", m.op)\n\t}\n}", "title": "" }, { "docid": "98e1f96e7d214b508cb4f28a1c72cb3d", "score": "0.59399176", "text": "func (m *DeviceMutation) IDs(ctx context.Context) ([]int32, error) {\n\tswitch {\n\tcase m.op.Is(OpUpdateOne | OpDeleteOne):\n\t\tid, exists := m.ID()\n\t\tif exists {\n\t\t\treturn []int32{id}, nil\n\t\t}\n\t\tfallthrough\n\tcase m.op.Is(OpUpdate | OpDelete):\n\t\treturn m.Client().Device.Query().Where(m.predicates...).IDs(ctx)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"IDs is not allowed on %s operations\", m.op)\n\t}\n}", "title": "" }, { "docid": "cd4a640c454cc7d45147ef508ee15c9a", "score": "0.59168917", "text": "func (m *ComplaintMutation) ComplaintToComplaintTypeIDs() (ids []int) {\n\tif id := m._ComplaintToComplaintType; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "0836d29b7d34604fafb909104ea20aa3", "score": "0.5915769", "text": "func (m *PropertyTypeMutation) ResourceTypeIDs() (ids []int) {\n\tif id := m.resource_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "bd089bef1bacfcddcfed5c9f966131bf", "score": "0.5886886", "text": "func (m *ScholarshiptypeMutation) ScholarshiptypeIDIDs() (ids []int) {\n\tfor id := range m._ScholarshiptypeID {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f421e780c9654891fcabc186ef992c40", "score": "0.5883962", "text": "func (m *RoomTypeMutation) RoomtypeRoomIDs() (ids []int) {\n\tfor id := range m._RoomtypeRoom {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "ec11fb8f6e58a8d636bd4a22de3b2682", "score": "0.5846782", "text": "func (m *CheckListCategoryDefinitionMutation) WorkOrderTypeIDs() (ids []int) {\n\tif id := m.work_order_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "a361c52a7475e1cf9b37945beda775b9", "score": "0.5845226", "text": "func (m *LocationTypeMutation) PropertyTypesIDs() (ids []int) {\n\tfor id := range m.property_types {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "24b0f15b35027ddf690e6c234cce06ea", "score": "0.583021", "text": "func (m *WorkOrderTypeMutation) PropertyTypesIDs() (ids []int) {\n\tfor id := range m.property_types {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f34cd01503de4221f9d0d36e87bb6dec", "score": "0.5815922", "text": "func (m *EquipmentTypeMutation) PropertyTypesIDs() (ids []int) {\n\tfor id := range m.property_types {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "ab425a4ef405b63db26ab7010d405d8f", "score": "0.5794547", "text": "func (m *PropertyTypeMutation) EquipmentPortTypeIDs() (ids []int) {\n\tif id := m.equipment_port_type; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f65948f9f5bee3c8f3b137f0a46e7a96", "score": "0.57797515", "text": "func (m *LocationTypeMutation) RemovedFileCategoryTypeIDs() (ids []int) {\n\tfor id := range m.removedfile_category_type {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "67bf431d5da791cb021a6484bc453f2c", "score": "0.5774189", "text": "func (b Bids) Types() []string {\n\tres := make([]string, len(b))\n\tfor i, v := range b {\n\t\tres[i] = string(v.Type[0]) + strconv.Itoa(i+1)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "eeb3e99e3a0d2705f94a8e83985dd2b4", "score": "0.574466", "text": "func (m *FileMutation) IDs(ctx context.Context) ([]int, error) {\n\tswitch {\n\tcase m.op.Is(OpUpdateOne | OpDeleteOne):\n\t\tid, exists := m.ID()\n\t\tif exists {\n\t\t\treturn []int{id}, nil\n\t\t}\n\t\tfallthrough\n\tcase m.op.Is(OpUpdate | OpDelete):\n\t\treturn m.Client().File.Query().Where(m.predicates...).IDs(ctx)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"IDs is not allowed on %s operations\", m.op)\n\t}\n}", "title": "" }, { "docid": "a6e398a4864f7d0c233c83bcca83b8cc", "score": "0.57233506", "text": "func (m *ScholarshipMutation) ScholarshiptypeIDIDs() (ids []int) {\n\tif id := m._ScholarshiptypeID; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "13a1ebe6dff925deb646487fbc598a7d", "score": "0.56956816", "text": "func (m *ActivitiesMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "9c69ec6ae5171d3b54956a279eb4ee7d", "score": "0.5668703", "text": "func (m *CustomerMutation) CustomertypeIDs() (ids []int) {\n\tif id := m.customertype; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "79d62501879ff0eb3b71fb09056cd09d", "score": "0.5654682", "text": "func (m *EquipmentTypeMutation) CategoryIDs() (ids []int) {\n\tif id := m.category; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "671b280eb93eeef67c6facc7ac5550bf", "score": "0.56489813", "text": "func (m *EquipmentPortTypeMutation) PropertyTypesIDs() (ids []int) {\n\tfor id := range m.property_types {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "95cf148b9995ff518e6a0e400aef3745", "score": "0.5618632", "text": "func (m *MessageWithIDMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "86d72b636743b7796ca581c2ab20b9cb", "score": "0.55909383", "text": "func (m *ComplaintTypeMutation) ComplaintTypeToComplaintIDs() (ids []int) {\n\tfor id := range m._ComplaintTypeToComplaint {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "c62a2e95418f8c7221c348deaf117c3c", "score": "0.5588946", "text": "func (m *EquipmentTypeMutation) AddedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase equipmenttype.EdgePortDefinitions:\n\t\tids := make([]ent.Value, 0, len(m.port_definitions))\n\t\tfor id := range m.port_definitions {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase equipmenttype.EdgePositionDefinitions:\n\t\tids := make([]ent.Value, 0, len(m.position_definitions))\n\t\tfor id := range m.position_definitions {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase equipmenttype.EdgePropertyTypes:\n\t\tids := make([]ent.Value, 0, len(m.property_types))\n\t\tfor id := range m.property_types {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase equipmenttype.EdgeEquipment:\n\t\tids := make([]ent.Value, 0, len(m.equipment))\n\t\tfor id := range m.equipment {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase equipmenttype.EdgeCategory:\n\t\tif id := m.category; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase equipmenttype.EdgeServiceEndpointDefinitions:\n\t\tids := make([]ent.Value, 0, len(m.service_endpoint_definitions))\n\t\tfor id := range m.service_endpoint_definitions {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b309c81477ecd31e01f1526c4cd78c5d", "score": "0.55547714", "text": "func (m *LocationTypeMutation) AddedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase locationtype.EdgeLocations:\n\t\tids := make([]ent.Value, 0, len(m.locations))\n\t\tfor id := range m.locations {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase locationtype.EdgePropertyTypes:\n\t\tids := make([]ent.Value, 0, len(m.property_types))\n\t\tfor id := range m.property_types {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase locationtype.EdgeFileCategoryType:\n\t\tids := make([]ent.Value, 0, len(m.file_category_type))\n\t\tfor id := range m.file_category_type {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase locationtype.EdgeSurveyTemplateCategories:\n\t\tids := make([]ent.Value, 0, len(m.survey_template_categories))\n\t\tfor id := range m.survey_template_categories {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e27b4667d1aca1d260bb5a55a72ffddf", "score": "0.554908", "text": "func (m *PropertyTypeMutation) AddedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase propertytype.EdgeProperties:\n\t\tids := make([]ent.Value, 0, len(m.properties))\n\t\tfor id := range m.properties {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase propertytype.EdgeLocationType:\n\t\tif id := m.location_type; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase propertytype.EdgeEquipmentPortType:\n\t\tif id := m.equipment_port_type; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase propertytype.EdgeLinkEquipmentPortType:\n\t\tif id := m.link_equipment_port_type; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase propertytype.EdgeEquipmentType:\n\t\tif id := m.equipment_type; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase propertytype.EdgeServiceType:\n\t\tif id := m.service_type; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase propertytype.EdgeWorkOrderType:\n\t\tif id := m.work_order_type; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase propertytype.EdgeWorkOrderTemplate:\n\t\tif id := m.work_order_template; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase propertytype.EdgeProjectType:\n\t\tif id := m.project_type; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase propertytype.EdgeProjectTemplate:\n\t\tif id := m.project_template; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\tcase propertytype.EdgeWorkerType:\n\t\tif id := m.worker_type; id != nil {\n\t\t\treturn []ent.Value{*id}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a47bf8acb19e365c4b8c944588ba9301", "score": "0.55483085", "text": "func (m *PoolPropertiesMutation) ResourceTypeIDs() (ids []int) {\n\tfor id := range m.resourceType {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "aa999d7b1776369192c2b85bfea460a7", "score": "0.5524891", "text": "func (m *ServiceTypeMutation) RemovedPropertyTypesIDs() (ids []int) {\n\tfor id := range m.removedproperty_types {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "dbbd9c5caf198180f1a7d39dabbf0ab2", "score": "0.55178803", "text": "func (m *WorkOrderTypeMutation) DefinitionsIDs() (ids []int) {\n\tfor id := range m.definitions {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "200e830aa492f9bdc4aba1ff63b94f9e", "score": "0.5517122", "text": "func (m *WorkOrderTemplateMutation) RemovedPropertyTypesIDs() (ids []int) {\n\tfor id := range m.removedproperty_types {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "5ab98907fc280752aaae798af64bc732", "score": "0.55069566", "text": "func (m *ProjectTypeMutation) AddedIDs(name string) []ent.Value {\n\tswitch name {\n\tcase projecttype.EdgeProperties:\n\t\tids := make([]ent.Value, 0, len(m.properties))\n\t\tfor id := range m.properties {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase projecttype.EdgeWorkOrders:\n\t\tids := make([]ent.Value, 0, len(m.work_orders))\n\t\tfor id := range m.work_orders {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\tcase projecttype.EdgeProjects:\n\t\tids := make([]ent.Value, 0, len(m.projects))\n\t\tfor id := range m.projects {\n\t\t\tids = append(ids, id)\n\t\t}\n\t\treturn ids\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4bd0fa3243bde1c1b81df4f42e1f4144", "score": "0.54900706", "text": "func (m *CategoryMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "4bd0fa3243bde1c1b81df4f42e1f4144", "score": "0.54900706", "text": "func (m *CategoryMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "edcf46ca0ffa17f3b5905f2395d15f46", "score": "0.5488899", "text": "func (m *RecommendationsSourcesMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "b315f81aecf26acbb84bac37cc8c219d", "score": "0.54819596", "text": "func (m *UserRoleMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "4217c3f045b70e4d52849f20bc630097", "score": "0.5476214", "text": "func (m *WorkerTypeMutation) RemovedPropertyTypesIDs() (ids []int) {\n\tfor id := range m.removedproperty_types {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "33af7c9122fbf87cdc0df042efd5c89b", "score": "0.54723084", "text": "func (m *FoodmenuMutation) Typeid() (r int, exists bool) {\n\tv := m.typeid\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "a1b61d1b15857a859103f0cfc8d12bb9", "score": "0.5470164", "text": "func (m *GameMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "2fc5850a72a22b5c2fb91593df54b79d", "score": "0.5464166", "text": "func (m *GuildMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "d349a9f74f5c401b9f38ecc3542d3542", "score": "0.5451407", "text": "func (dtuo *DeviceTypeUpdateOne) AddTypeIDs(ids ...int) *DeviceTypeUpdateOne {\n\tdtuo.mutation.AddTypeIDs(ids...)\n\treturn dtuo\n}", "title": "" }, { "docid": "a87404e7d871397ab8756ce89daa61cc", "score": "0.5443834", "text": "func (m *SexMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "ed9ed0588e2daccb395a30107c39f59d", "score": "0.54364425", "text": "func (m *TokenMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "c6918a71355c6956f49819a19c3d47cb", "score": "0.5435835", "text": "func (m *CourseMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "d2f8e91d409a03642e144cde0f027159", "score": "0.5431139", "text": "func (m *RecommendationsMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "3506387f402317b3e56081245c917126", "score": "0.5429572", "text": "func (m *UserStatusMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "3506387f402317b3e56081245c917126", "score": "0.54283637", "text": "func (m *UserStatusMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "3506387f402317b3e56081245c917126", "score": "0.54283637", "text": "func (m *UserStatusMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "129052a921ca14de49554fe1e886aa55", "score": "0.5425947", "text": "func (m *CounterMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "8760219183cd06d102be54063d603dc5", "score": "0.54184943", "text": "func (m *RecommendationsCategoryMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "12a03776d3a5920895f508e906e415d7", "score": "0.5414006", "text": "func (m *ServiceTypeMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "fc8f6a7ae1abd182c8084d44d3f8b7bf", "score": "0.54132694", "text": "func (m *LocationTypeMutation) LocationsIDs() (ids []int) {\n\tfor id := range m.locations {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "4961a3b9b9b4a7d4a0d7df6c99d70898", "score": "0.54108155", "text": "func (m *ClubappStatusMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "5daf942381580dc90c04839df5c0d813", "score": "0.54104954", "text": "func (m *EventSeverityMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "dfc70f8a3bd3a9883875496d3d7da9a8", "score": "0.5408701", "text": "func (m *TagMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "6044401b1093469c050754fd41f75504", "score": "0.5398582", "text": "func (m *EatinghistoryMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "18c38cc3ca6250cfb8d1ef7fab607b1f", "score": "0.53908944", "text": "func (dtu *DeviceTypeUpdate) AddTypeIDs(ids ...int) *DeviceTypeUpdate {\n\tdtu.mutation.AddTypeIDs(ids...)\n\treturn dtu\n}", "title": "" }, { "docid": "52c8b22d5e85779daa66385592c3383c", "score": "0.53904337", "text": "func (m *EquipmentCategoryMutation) Type() string {\n\treturn m.typ\n}", "title": "" }, { "docid": "a02d59680a7694556e05dd2e0dfa038f", "score": "0.5386013", "text": "func (m *ServiceMutation) TypeID() (id int, exists bool) {\n\tif m._type != nil {\n\t\treturn *m._type, true\n\t}\n\treturn\n}", "title": "" }, { "docid": "c5994a72fd3ff864eb69a63692f50195", "score": "0.53854346", "text": "func (m *FoodmenuMutation) Type() string {\n\treturn m.typ\n}", "title": "" } ]
6968b4b0ad41ad7843a3e4281925234f
EnterLabelMatcher is called when production labelMatcher is entered.
[ { "docid": "f3cc724f975b35402d70a6e76462f0b4", "score": "0.864204", "text": "func (s *BasePromQLParserListener) EnterLabelMatcher(ctx *LabelMatcherContext) {}", "title": "" } ]
[ { "docid": "5ffa5ec74de60a6e198e9127f00b4937", "score": "0.80133057", "text": "func (s *BasePromQLParserListener) EnterLabelMatcherOperator(ctx *LabelMatcherOperatorContext) {}", "title": "" }, { "docid": "e9fdec52e94317d35a5f74e50a7f48b7", "score": "0.76766884", "text": "func (s *BasePromQLParserListener) EnterLabelMatcherList(ctx *LabelMatcherListContext) {}", "title": "" }, { "docid": "29d63365f7e8884f60f20579163663c8", "score": "0.6526353", "text": "func (s *BaseSolidityListener) EnterLabelDefinition(ctx *LabelDefinitionContext) {}", "title": "" }, { "docid": "b44a1452372417789b12d6024973ff99", "score": "0.6405622", "text": "func (s *BasePromQLParserListener) ExitLabelMatcher(ctx *LabelMatcherContext) {}", "title": "" }, { "docid": "a1ab7ac5ac891f99ff4c0665b6d55b1e", "score": "0.63311094", "text": "func (s *BaseIDLListener) EnterCase_label(ctx *Case_labelContext) {}", "title": "" }, { "docid": "bfb7489b30a9b170041a4370e17de053", "score": "0.62393993", "text": "func (s *BasePromQLParserListener) EnterLabelName(ctx *LabelNameContext) {}", "title": "" }, { "docid": "61afd54160de2642b45530d7dc7a793d", "score": "0.61412585", "text": "func (s *BasePlSqlParserListener) EnterLabel_name(ctx *Label_nameContext) {}", "title": "" }, { "docid": "fa6bdb9b34d1ab0759b65ab5309ee427", "score": "0.60377693", "text": "func (s *BasebcplListener) EnterLabel_prefix(ctx *Label_prefixContext) {}", "title": "" }, { "docid": "1c8b09cf7fb44ebf5732ba27ac2a5c50", "score": "0.5922782", "text": "func (s *BasePlSqlParserListener) EnterLabel_declaration(ctx *Label_declarationContext) {}", "title": "" }, { "docid": "9277247cc4703a2fe99c21a53ae46353", "score": "0.5907327", "text": "func (s *BasePromQLParserListener) EnterLabelNameList(ctx *LabelNameListContext) {}", "title": "" }, { "docid": "469574556ac5b926ab04b75121bdd4a4", "score": "0.5698443", "text": "func (s *BaseSymbolanListener) EnterEq(ctx *EqContext) {}", "title": "" }, { "docid": "026a6b0345ad537b9f9b1dc0e555d675", "score": "0.56666887", "text": "func (s *BasePromQLParserListener) ExitLabelMatcherOperator(ctx *LabelMatcherOperatorContext) {}", "title": "" }, { "docid": "9535d2087b4c2bafea6d4fc910a9476e", "score": "0.55157423", "text": "func (s *BasePostgreSQLParserListener) EnterPredicate(ctx *PredicateContext) {}", "title": "" }, { "docid": "16ab4689ea4a0268d6ac7bcfba0e1e2e", "score": "0.5496092", "text": "func (s *BaseSymbolanListener) EnterRuleSet(ctx *RuleSetContext) {}", "title": "" }, { "docid": "1cfa3d27ea2a1cd6e35f7a5cdb06e214", "score": "0.54690254", "text": "func (s *BasebcplListener) EnterExpression(ctx *ExpressionContext) {}", "title": "" }, { "docid": "fc8c7c091f5b357fd2a8e10d5c6f5085", "score": "0.5460814", "text": "func (s *BaseCDLangListener) EnterInstruction(ctx *InstructionContext) {}", "title": "" }, { "docid": "baa534c49eeffd64ad1730f7540f1a7d", "score": "0.5446199", "text": "func (a AddLabel) Match(event *github.IssueEvent) bool {\n\tif event == nil || event.Event == nil {\n\t\treturn false\n\t}\n\treturn *event.Event == \"labeled\"\n}", "title": "" }, { "docid": "858bddc819c8e7ab5625fac9b083191e", "score": "0.54401284", "text": "func (s *BaseSymbolanListener) EnterExpressionRule(ctx *ExpressionRuleContext) {}", "title": "" }, { "docid": "e439fa9e33b1760eb64d323b15875921", "score": "0.5427301", "text": "func (s *Basegrulev3Listener) EnterRuleEntry(ctx *RuleEntryContext) {}", "title": "" }, { "docid": "dd44b7cc11a4244bb443dd07c542c186", "score": "0.5416278", "text": "func (s *BaseplucidListener) EnterExpression(ctx *ExpressionContext) {}", "title": "" }, { "docid": "18f9c815eb7c18363b63737d52f55ff9", "score": "0.5414043", "text": "func (s *BaseCDLangListener) EnterMapping(ctx *MappingContext) {}", "title": "" }, { "docid": "4c24ea477723910cbe069f0690e2c9ff", "score": "0.54131955", "text": "func (s *BasebcplListener) EnterUnlabelled_command(ctx *Unlabelled_commandContext) {}", "title": "" }, { "docid": "08af06bce178059b61fd5d7b778ff7a6", "score": "0.5407796", "text": "func (s *BasenewickListener) EnterBranch(ctx *BranchContext) {}", "title": "" }, { "docid": "73d87e4cacd48ed1cc4f5ba59a1f0c09", "score": "0.5382066", "text": "func (s *BaseScimFilterListener) EnterOperator(ctx *OperatorContext) {}", "title": "" }, { "docid": "20817b9b9c0e799dd2fd18d5766627cd", "score": "0.5379671", "text": "func (s *BasePathListener) EnterClassifierTagExpr(ctx *ClassifierTagExprContext) {}", "title": "" }, { "docid": "4858c974793301e7bc16703e5caf4343", "score": "0.5375396", "text": "func (s *BaseClickHouseParserListener) EnterKeyword(ctx *KeywordContext) {}", "title": "" }, { "docid": "d3b9d76ac4629d31942a8e3e556cf99a", "score": "0.5370781", "text": "func (s *BaseKlListener) EnterFun(ctx *FunContext) {}", "title": "" }, { "docid": "bac6d2c89bcb86bcf7deab13d0455074", "score": "0.5370639", "text": "func (s *BaseExprListener) EnterAdd(ctx *AddContext) {}", "title": "" }, { "docid": "f28cebbeb233254f8221d1b8efb5998e", "score": "0.5349578", "text": "func (s *BaseClickHouseParserListener) EnterLiteral(ctx *LiteralContext) {}", "title": "" }, { "docid": "43d9190c0141793694d1e3563d2b8d5b", "score": "0.53229713", "text": "func (s *BaseargusListener) EnterExpression(ctx *ExpressionContext) {}", "title": "" }, { "docid": "b9b064fe1ef58f38c9f135d5ba0af728", "score": "0.5313394", "text": "func (s *BasePromQLParserListener) ExitLabelMatcherList(ctx *LabelMatcherListContext) {}", "title": "" }, { "docid": "e054a894c2eadce974815dd5c098278c", "score": "0.5288634", "text": "func (s *BaseCOOLListener) EnterEqual(ctx *EqualContext) {}", "title": "" }, { "docid": "3792f3234bbc82f9a1b0b9e0841fabbf", "score": "0.5264309", "text": "func (s *BasePlSqlParserListener) EnterExpression(ctx *ExpressionContext) {}", "title": "" }, { "docid": "5daf068158cdcdbc81b2fc2cd8f0b212", "score": "0.52563024", "text": "func (s *BaseCoAsmListener) EnterInstruction(ctx *InstructionContext) {}", "title": "" }, { "docid": "792318e49e7ef5709bd629e3c625f572", "score": "0.52550536", "text": "func (s *BaseCommandsListener) EnterString(ctx *StringContext) {}", "title": "" }, { "docid": "e87f60062f9102ce49e8ccad977330b7", "score": "0.5245381", "text": "func (s *BasebcplListener) EnterCommand(ctx *CommandContext) {}", "title": "" }, { "docid": "f001bf73a6b352b77ee704799c27245a", "score": "0.52419", "text": "func (s *Basegrulev3Listener) EnterRuleName(ctx *RuleNameContext) {}", "title": "" }, { "docid": "c9fe08ed15ca5d68b5fab8bc8d095dcb", "score": "0.52368915", "text": "func (s *Basegrulev3Listener) EnterComparisonOperator(ctx *ComparisonOperatorContext) {}", "title": "" }, { "docid": "ea2622ddf05cc2334c488814951dd71a", "score": "0.5234906", "text": "func (s *Basegrulev3Listener) EnterExpression(ctx *ExpressionContext) {}", "title": "" }, { "docid": "c343cfacf30763f5fb2ce705bbeafd31", "score": "0.5204253", "text": "func (s *BaseangelscriptListener) EnterExprterm(ctx *ExprtermContext) {}", "title": "" }, { "docid": "340e8fd8eebd8682fd5229cfcb3f6862", "score": "0.52028733", "text": "func (s *BaseCOOLListener) EnterString(ctx *StringContext) {}", "title": "" }, { "docid": "e365f773677a891d0ad9412efecae2a8", "score": "0.5192905", "text": "func (s *BasesnowballListener) EnterProgram(ctx *ProgramContext) {}", "title": "" }, { "docid": "c70577791c5c4009beb4b13b85293b19", "score": "0.5185031", "text": "func (s *BasenewickListener) EnterLeaf(ctx *LeafContext) {}", "title": "" }, { "docid": "ae3722cdba4be9dc8cc99d9247b818be", "score": "0.5179072", "text": "func (s *BasempsListener) EnterStartmarker(ctx *StartmarkerContext) {}", "title": "" }, { "docid": "8cd9813f9527c78a15b7d073cf6000b2", "score": "0.51735985", "text": "func (s *BaseScssParserListener) EnterExpression(ctx *ExpressionContext) {}", "title": "" }, { "docid": "5a18bcddf5d9b5a77fba906e8006b3e7", "score": "0.51719725", "text": "func (s *BasenewickListener) EnterBranchSet(ctx *BranchSetContext) {}", "title": "" }, { "docid": "e70c96627f9c339cc3d7b5a29067d4e8", "score": "0.51300937", "text": "func (s *BasearithmeticListener) EnterTerm(ctx *TermContext) {}", "title": "" }, { "docid": "d7e71d35a7b345eb53c67ec9222dc431", "score": "0.51278085", "text": "func (s *Basegrulev3Listener) EnterRuleDescription(ctx *RuleDescriptionContext) {}", "title": "" }, { "docid": "8c01069b55006509d60279ea9d47923f", "score": "0.5124431", "text": "func (s *BaseBundListener) EnterExpressions(ctx *ExpressionsContext) {}", "title": "" }, { "docid": "10ca09acf97319a51b2e70005c7ca924", "score": "0.5121422", "text": "func (s *BaseBundListener) EnterCmd(ctx *CmdContext) {}", "title": "" }, { "docid": "26f1e37517a1907bff029e17c040abe2", "score": "0.50982755", "text": "func (s *BaseScimFilterListener) EnterStart(ctx *StartContext) {}", "title": "" }, { "docid": "fc5fd8083217825d3f3000d8e006b0e7", "score": "0.50923157", "text": "func (s *BaseSolidityListener) EnterMapping(ctx *MappingContext) {}", "title": "" }, { "docid": "5c0a9f904636cc408ede57342b31a1c4", "score": "0.5083842", "text": "func (s *BaseFusionTablesSqlListener) EnterKeyword(ctx *KeywordContext) {}", "title": "" }, { "docid": "a4e169d80726e58c789fe1cfc132b8ad", "score": "0.5077676", "text": "func (s *BaseemarkListener) EnterProgram(ctx *ProgramContext) {}", "title": "" }, { "docid": "f9269274f4b61683fad2d1c25e8347ac", "score": "0.5077394", "text": "func (s *BaseScssParserListener) EnterRuleset(ctx *RulesetContext) {}", "title": "" }, { "docid": "70a28212c44f1d167d1f6e2486670b10", "score": "0.5077015", "text": "func (s *BaseCommandsListener) EnterStart(ctx *StartContext) {}", "title": "" }, { "docid": "9db40fb089dd9615e8f758b9909388ea", "score": "0.50744253", "text": "func (s *BaseplucidListener) EnterPrefix_operator(ctx *Prefix_operatorContext) {}", "title": "" }, { "docid": "eae9e9d300c0a484b0a53d2e80ab1264", "score": "0.5072598", "text": "func (s *BasebcplListener) EnterGoto_command(ctx *Goto_commandContext) {}", "title": "" }, { "docid": "86ca4cb5abdbfc6d4a165437c79decf5", "score": "0.5067045", "text": "func (s *BaseSwaggableParserListener) EnterProgram(ctx *ProgramContext) {}", "title": "" }, { "docid": "fc5786ab43a405b64d765971fe58f51e", "score": "0.50639564", "text": "func (s *BaseSymbolanListener) EnterExpr(ctx *ExprContext) {}", "title": "" }, { "docid": "f78e594d1dac79a4e39a8da017e2b91d", "score": "0.50623375", "text": "func (s *BasePromQLParserListener) EnterExpression(ctx *ExpressionContext) {}", "title": "" }, { "docid": "0c8392dbd9b106387b1b2ecafa566902", "score": "0.50611454", "text": "func (s *BaseASNListener) EnterWithSyntaxSpec(ctx *asn.WithSyntaxSpecContext) {}", "title": "" }, { "docid": "b0de656f7b8fbfd6a474f1a5cd4b8c2a", "score": "0.5060864", "text": "func (s *BasePromQLParserListener) EnterLiteral(ctx *LiteralContext) {}", "title": "" }, { "docid": "c39eafe7c9dcbd15651d580652a7f8d9", "score": "0.50587225", "text": "func (s *BaseCDLangListener) EnterGroup(ctx *GroupContext) {}", "title": "" }, { "docid": "e3857c686377b8bc2e13f0f88979ca23", "score": "0.504881", "text": "func (s *BaseSymbolanListener) EnterRuleAtom(ctx *RuleAtomContext) {}", "title": "" }, { "docid": "d55ae0053a0e6690a84d04d3140117ac", "score": "0.5044218", "text": "func (s *BaseBundListener) EnterTerm(ctx *TermContext) {}", "title": "" }, { "docid": "adf22075f43c652e79c9319cea347c2d", "score": "0.50411344", "text": "func (s *BaseScimFilterListener) EnterCriteria(ctx *CriteriaContext) {}", "title": "" }, { "docid": "08d0fde5593aced08fab9cf4da2bc3bb", "score": "0.5039475", "text": "func (s *BaseangelscriptListener) EnterSwitch_(ctx *Switch_Context) {}", "title": "" }, { "docid": "a5062efc28ad78d481c8d2dcae1e6c2b", "score": "0.5034304", "text": "func (s *BasePromQLParserListener) EnterGrouping(ctx *GroupingContext) {}", "title": "" }, { "docid": "960d828e651d6f5c290c97206a582266", "score": "0.5032033", "text": "func (s *BasePostgreSQLParserListener) EnterSecurity_label_stmt(ctx *Security_label_stmtContext) {}", "title": "" }, { "docid": "7e8c00330bd6fbef8c990ea68033e827", "score": "0.5028911", "text": "func (s *BaseemarkListener) EnterTag(ctx *TagContext) {}", "title": "" }, { "docid": "0791cf745238e458513ff2c1e8f9110f", "score": "0.50238603", "text": "func (s *BaseCommandsListener) EnterLet(ctx *LetContext) {}", "title": "" }, { "docid": "0fac4e7678877748340e4a574e6695f1", "score": "0.50226897", "text": "func (s *BaseCommandsListener) EnterCommand(ctx *CommandContext) {}", "title": "" }, { "docid": "cc58ccb8eb8f6f204382f73d7d816091", "score": "0.5019455", "text": "func (s *BaseFusionTablesSqlListener) EnterLiteral(ctx *LiteralContext) {}", "title": "" }, { "docid": "f917284238272328c7e7646f57cf9809", "score": "0.5019096", "text": "func (s *BaseScssParserListener) EnterSelector(ctx *SelectorContext) {}", "title": "" }, { "docid": "2ae282d93b33c62004452edb139a3d58", "score": "0.5014085", "text": "func (s *BaseargusListener) EnterOpbinding(ctx *OpbindingContext) {}", "title": "" }, { "docid": "46f2db62860905bde8f43cf803d0b9fb", "score": "0.5013349", "text": "func (s *BaseNuggetListener) EnterSourceidentifier(ctx *SourceidentifierContext) {}", "title": "" }, { "docid": "5b34a1c00d82ba5b28b693c78b804480", "score": "0.50038445", "text": "func (s *BasecminusListener) EnterExpression(ctx *ExpressionContext) {}", "title": "" }, { "docid": "d4b30532fd8218eb9a59262264fbc1c4", "score": "0.50017065", "text": "func (s *BasebcplListener) EnterProgram(ctx *ProgramContext) {}", "title": "" }, { "docid": "25a44e5abdbbb24279d7eb4490537c57", "score": "0.5000353", "text": "func (s *BasePromQLParserListener) EnterMatrixSelector(ctx *MatrixSelectorContext) {}", "title": "" }, { "docid": "68272b2151870c781d1ef8612925cbef", "score": "0.49987924", "text": "func (s *BaseemarkListener) EnterBlop(ctx *BlopContext) {}", "title": "" }, { "docid": "c4c065206e5a154fa3862831fa97d129", "score": "0.49987277", "text": "func (s *BaseCOOLListener) EnterLessEqual(ctx *LessEqualContext) {}", "title": "" }, { "docid": "5f06dd8f5127dc6b1b2a973a2e66ef6f", "score": "0.49980822", "text": "func (s *BasePlSqlParserListener) EnterSearched_case_statement(ctx *Searched_case_statementContext) {}", "title": "" }, { "docid": "00c01ea90654f9634fe860705d12f2c7", "score": "0.4991469", "text": "func (s *BaseSymbolanListener) EnterVariable(ctx *VariableContext) {}", "title": "" }, { "docid": "f1cb24b2d01e29e8facdf4c6099651c1", "score": "0.4987872", "text": "func (s *BaseCommandsListener) EnterExpr(ctx *ExprContext) {}", "title": "" }, { "docid": "a213841404c5d3f77eea7fd4742a0fc4", "score": "0.49845713", "text": "func (s *BaseplucidListener) EnterCase_expression(ctx *Case_expressionContext) {}", "title": "" }, { "docid": "95d8d7b20bfd97dc07593b10dedc7591", "score": "0.4982522", "text": "func (s *BaseSOQLListener) EnterLiteral(ctx *LiteralContext) {}", "title": "" }, { "docid": "5f3ed46eefa7e148f08a6a6a994ed504", "score": "0.49740458", "text": "func (s *BaseargusListener) EnterHandler(ctx *HandlerContext) {}", "title": "" }, { "docid": "2fc193679489e37294236cfb5dda9e39", "score": "0.49715754", "text": "func (s *BasecminusListener) EnterJumpStatement(ctx *JumpStatementContext) {}", "title": "" }, { "docid": "93189f2f6955b25038a9b294787cbe5c", "score": "0.49551958", "text": "func (s *BaseClickHouseParserListener) EnterIdentifier(ctx *IdentifierContext) {}", "title": "" }, { "docid": "0551d39e22c3a826557c9a113f535cc4", "score": "0.495445", "text": "func (s *BasepluralListener) EnterStart(ctx *StartContext) {}", "title": "" }, { "docid": "f570a95bc68ff1871ec393192c9b82d2", "score": "0.49541515", "text": "func (s *BaseargusListener) EnterTagcase_stmt(ctx *Tagcase_stmtContext) {}", "title": "" }, { "docid": "202b5604c90e01e75513ac2f4f1c907a", "score": "0.49505442", "text": "func (s *BaseangelscriptListener) EnterExpr(ctx *ExprContext) {}", "title": "" }, { "docid": "e26cacb6bb66125a5d4560686314d22b", "score": "0.49505308", "text": "func (s *BaseCDLangListener) EnterScenario(ctx *ScenarioContext) {}", "title": "" }, { "docid": "386022b22a270534dfc1b2cb6d1a9eeb", "score": "0.49486887", "text": "func (s *BasePromQLParserListener) EnterKeyword(ctx *KeywordContext) {}", "title": "" }, { "docid": "4ff41cd0fc01fae6fe464520a212586e", "score": "0.49486643", "text": "func (s *BasePlSqlParserListener) EnterAtom(ctx *AtomContext) {}", "title": "" }, { "docid": "fcbf787a53debc8a3e51d82b807ef853", "score": "0.49470103", "text": "func (s *BaseASNListener) EnterLiteral(ctx *asn.LiteralContext) {}", "title": "" }, { "docid": "cac9dc891781ccd5599230d38b57b6f7", "score": "0.4945076", "text": "func (s *Basegrulev3Listener) EnterArrayMapSelector(ctx *ArrayMapSelectorContext) {}", "title": "" }, { "docid": "7bb12f2b36987258c8deddfef57cf843", "score": "0.49430162", "text": "func (s *BaseangelscriptListener) EnterBreak_(ctx *Break_Context) {}", "title": "" }, { "docid": "9761a20df6bbd9f075054a1c15b86d48", "score": "0.4940429", "text": "func (s *BasePlSqlParserListener) EnterStandard_prediction_function_keyword(ctx *Standard_prediction_function_keywordContext) {\n}", "title": "" } ]
6f91ff507074578980b5197a5b5ea7e6
Run registers a service to periodically call the osconfig enpoint to pull the latest applicaple configurations and apply them.
[ { "docid": "c63f2d2c779a705f69594562a21501a0", "score": "0.57367736", "text": "func Run(ctx context.Context, action string) error {\n\tif err := service.Register(ctx, \"google_osconfig_agent\", \"Google OSConfig Agent\", \"\", run, action); err != nil {\n\t\treturn fmt.Errorf(\"service.Register error: %v\", err)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "2eace3bb31ed0fa480f19215b4a5eda1", "score": "0.6124028", "text": "func configureService(c *service.Config) {\n\tc.Option = service.KeyValue{}\n\n\t// OS X\n\t// Redefines the launchd config file template\n\t// The purpose is to enable stdout/stderr redirect by default\n\tc.Option[\"LaunchdConfig\"] = launchdConfig\n\t// This key is used to start the job as soon as it has been loaded. For daemons this means execution at boot time, for agents execution at login.\n\tc.Option[\"RunAtLoad\"] = true\n\n\t// POSIX\n\t// Redirect StdErr & StdOut to files.\n\tc.Option[\"LogOutput\"] = true\n}", "title": "" }, { "docid": "a20a4862af68a2fcceaad78ac5e62cf4", "score": "0.6031076", "text": "func (c *ServiceConfig) Run(stopCh <-chan struct{}) {\n\tklog.InfoS(\"Starting service config controller\")\n\n\tif !cache.WaitForNamedCacheSync(\"service config\", stopCh, c.listerSynced) {\n\t\treturn\n\t}\n\n\tfor i := range c.eventHandlers {\n\t\tklog.V(3).InfoS(\"Calling handler.OnServiceSynced()\")\n\t\tc.eventHandlers[i].OnServiceSynced()\n\t}\n}", "title": "" }, { "docid": "2b81797827e864436659244a76bee481", "score": "0.5978999", "text": "func main() {\n\t// Setup seed for globalRand\n\trand.Seed(time.Now().Unix())\n\n\t//Setup default timezone for time.Now() calls\n\ttime.Local = time.UTC\n\n\tif err := readInViperConfig(); err != nil {\n\t\tlog.Fatal(\"Error while reading application config: \", err)\n\t}\n\n\tif err := appconfig.Init(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t//listen to shutdown signal to free up all resources\n\tctx, cancel := context.WithCancel(context.Background())\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL, syscall.SIGHUP)\n\tgo func() {\n\t\t<-c\n\t\tappstatus.Instance.Idle = true\n\t\tcancel()\n\t\tappconfig.Instance.Close()\n\t\tos.Exit(0)\n\t}()\n\n\tdestinationsViper := viper.Sub(\"destinations\")\n\n\t//override with config from os env\n\tjsonConfig := viper.GetString(\"destinations_json\")\n\tif jsonConfig != \"\" && jsonConfig != \"{}\" {\n\t\tenvJsonViper := viper.New()\n\t\tenvJsonViper.SetConfigType(\"json\")\n\t\tif err := envJsonViper.ReadConfig(bytes.NewBufferString(jsonConfig)); err != nil {\n\t\t\tlog.Println(\"Error reading/parsing json config from DESTINATIONS_JSON\", err)\n\t\t} else {\n\t\t\tdestinationsViper = envJsonViper.Sub(\"destinations\")\n\t\t}\n\t}\n\n\t//Create event storages per token\n\ttokenizedEventStorages := storages.CreateStorages(ctx, destinationsViper)\n\tfor _, eStorages := range tokenizedEventStorages {\n\t\tfor _, es := range eStorages {\n\t\t\tappconfig.Instance.ScheduleClosing(es)\n\t\t}\n\t}\n\n\t//Uploader must read event logger directory\n\tlogEventPath := viper.GetString(\"log.path\")\n\tif !strings.HasSuffix(logEventPath, \"/\") {\n\t\tlogEventPath += \"/\"\n\t}\n\tuploader := events.NewUploader(logEventPath+uploaderFileMask, uploaderBatchSize, uploaderLoadEveryS, tokenizedEventStorages)\n\tuploader.Start()\n\n\trouter := SetupRouter()\n\n\tlog.Println(\"Started listen and server: \" + appconfig.Instance.Authority)\n\tserver := &http.Server{\n\t\tAddr: appconfig.Instance.Authority,\n\t\tHandler: middleware.Cors(router),\n\t\tReadTimeout: time.Second * 60,\n\t\tReadHeaderTimeout: time.Second * 60,\n\t\tIdleTimeout: time.Second * 65,\n\t}\n\tlog.Fatal(server.ListenAndServe())\n}", "title": "" }, { "docid": "99a62647d2adbd72c317c1e88c9da903", "score": "0.59579134", "text": "func InitializeServicesConfig() {\n serviceConfigFile, err := os.OpenFile(`apoconf.json`, os.O_RDWR|os.O_CREATE, 0755) \n if err != nil {\n log.Fatal(err)\n }\n \n if err := serviceConfigFile.Close(); err != nil {\n log.Fatal(err)\n }\n}", "title": "" }, { "docid": "627127d1dfe4caa0ec1c53fa51700648", "score": "0.5791308", "text": "func (c *config) Run() error {\n\tservices := make(map[string]Service)\n\n\t// Calculate of the number of workers.\n\tcap := 0\n\tfor _, service := range c.services {\n\t\tcap += service.Worker\n\t}\n\n\torder := make([]string, 0, cap)\n\n\t// Assign services.\n\tif err := c.assign(&order, services); err != nil {\n\t\treturn err\n\t}\n\n\tchps := make(chan *os.Process, 1)\n\tsignals := make(chan os.Signal, 1)\n\tsignal.Notify(signals, syscall.SIGHUP, syscall.SIGTERM, syscall.SIGINT)\n\n\tgo c.waitSignals(signals, chps, len(order))\n\n\t// Invoke workers.\n\tfor _, sid := range order {\n\t\tservice := services[sid]\n\t\tif service.Code == nil && service.Exec != \"\" {\n\t\t\tcmd := service.prepare()\n\t\t\t// Notify you have executed the command\n\t\t\tif c.execNotice {\n\t\t\t\tfmt.Fprintf(service.pipe.writer, \"Exec command: %s\\n\", service.Exec)\n\t\t\t}\n\n\t\t\t// Execute the command with cron or goroutine\n\t\t\tif service.Every != \"\" {\n\t\t\t\tc.addCmd(service, chps)\n\t\t\t} else {\n\t\t\t\tc.g.Go(func() error {\n\t\t\t\t\tdefer service.pipe.writer.Close()\n\t\t\t\t\treturn run(cmd, chps)\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tif service.Code != nil {\n\t\t\t// Notify you have run the callback\n\t\t\tif c.execNotice {\n\t\t\t\tfmt.Fprintf(service.pipe.writer, \"Callback: %s\\n\", service.Tag)\n\t\t\t}\n\n\t\t\t// Run callback with cron or goroutine\n\t\t\tif service.Every != \"\" {\n\t\t\t\tc.addTask(service)\n\t\t\t} else {\n\t\t\t\tc.g.Go(func() error {\n\t\t\t\t\tdefer service.pipe.writer.Close()\n\t\t\t\t\tgo service.Code(service.pipe.writer, service.port)\n\t\t\t\t\t<-c.ctx.Done()\n\t\t\t\t\treturn nil\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// Enable log worker if logWorker is true.\n\t\tif c.logWorker && (service.Code != nil || service.Exec != \"\") {\n\t\t\trd := service.pipe.reader\n\t\t\tgo c.logging(bufio.NewScanner(rd), sid, service.color)\n\t\t}\n\n\t\t// When the task is cron, it does not cause wait time.\n\t\tif service.Every == \"\" {\n\t\t\ttime.Sleep(c.interval)\n\t\t}\n\t}\n\n\treturn c.wait(chps, signals)\n}", "title": "" }, { "docid": "f68caac5bbc158ddd102fcbe0c37891e", "score": "0.5724419", "text": "func Run(ctx context.Context) {\n\n\tctx, cancel := context.WithCancel(ctx)\n\n\t// Run secretserviced on a separate Goroutine\n\tgo App.Service.Start(ctx)\n\n\t/* ========== Signal handling ========== */\n\n\t// Register for specific OS signals we are interested in\n\tsignalChan := make(chan os.Signal, 1)\n\n\tsignal.Notify(signalChan,\n\t\tsyscall.SIGHUP,\n\t\tsyscall.SIGINT,\n\t\tsyscall.SIGTERM,\n\t\tsyscall.SIGQUIT,\n\t)\n\n\t// Channel for communicating exit signal\n\texitChan := make(chan int)\n\n\t// OS signal handling\n\tgo func(cancel func()) {\n\t\tfor {\n\t\t\tsignal := <-signalChan\n\t\t\tswitch signal {\n\t\t\tcase syscall.SIGHUP:\n\t\t\t\tlog.Info(\"Received 'SIGHUP' signal. Reloading configurations...\")\n\t\t\t\tApp.Load()\n\n\t\t\tcase syscall.SIGINT: // CTRL+C\n\t\t\t\tlog.Info(\"***** Received 'SIGINT' signal. Exiting... *****\")\n\t\t\t\tcancel()\n\t\t\t\t<-App.Service.ServiceShutdownChan\n\t\t\t\texitChan <- 1\n\n\t\t\tcase syscall.SIGTERM:\n\t\t\t\tlog.Info(\"***** Received 'SIGTERM' signal. Exiting... *****\")\n\t\t\t\tcancel()\n\t\t\t\t<-App.Service.ServiceShutdownChan\n\t\t\t\texitChan <- 2\n\n\t\t\tcase syscall.SIGQUIT:\n\t\t\t\tlog.Info(\"***** Received 'SIGQUIT' signal. Exiting... *****\")\n\t\t\t\tcancel()\n\t\t\t\t<-App.Service.ServiceShutdownChan\n\t\t\t\texitChan <- 3\n\n\t\t\tdefault:\n\t\t\t\tlog.Info(\"***** Received unknown signal. Exiting... *****\")\n\t\t\t\tcancel()\n\t\t\t\t<-App.Service.ServiceShutdownChan\n\t\t\t\texitChan <- 4\n\t\t\t}\n\t\t}\n\t}(cancel)\n\n\tos.Exit(<-exitChan) // exit secretserviced\n}", "title": "" }, { "docid": "f3f933a15d5767aa90544b6d314a916f", "score": "0.5660514", "text": "func (app *App) Start() (final error) {\n\tf := func() (err error) {\n\t\tselect {\n\t\tcase <-app.configWatcher.Events:\n\t\t\terr = app.reconfigure()\n\n\t\tcase event := <-app.targetsWatcher.Events:\n\t\t\te := app.handle(event)\n\t\t\tif e != nil {\n\t\t\t\tzap.L().Error(\"failed to handle event\",\n\t\t\t\t\tzap.String(\"url\", event.URL),\n\t\t\t\t\tzap.Error(e))\n\t\t\t}\n\n\t\tcase e := <-errorMultiplex(app.configWatcher.Errors, app.targetsWatcher.Errors):\n\t\t\tzap.L().Error(\"git error\",\n\t\t\t\tzap.Error(e))\n\t\t}\n\t\treturn\n\t}\n\n\tzap.L().Debug(\"starting service daemon\")\n\n\tfor {\n\t\tfinal = f()\n\t\tif final != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "90e75aefaf73561ce2d0488b84677c68", "score": "0.5659459", "text": "func handleAllServices(deferStartup bool) error {\n\tsecretStoreActive := true\n\n\t// grab and log the current service configuration\n\tfor _, s := range hooks.Services {\n\t\tvar serviceList []string\n\n\t\tstatus, err := cli.Config(s)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\thooks.Debug(fmt.Sprintf(\"edgexfoundry:configure: service: %s status: %s\", s, status))\n\n\t\terr = applyConfigOptions(s)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to apply config options for %s: %v\", s, err)\n\t\t}\n\n\t\t// if deferStartup is set, don't start/stop services\n\t\tif deferStartup {\n\t\t\tcontinue\n\t\t}\n\n\t\t// SecBootstrapper is a valid service for configuration\n\t\t// purposes, however it isn't individually controlable\n\t\t// using on|off, so once configuration has been handled\n\t\t// skip to the next service.\n\t\tif s == hooks.ServiceSecBootstrapper {\n\t\t\tcontinue\n\t\t}\n\n\t\tsType := serviceType(s)\n\n\t\tswitch sType {\n\t\tcase kuiperService:\n\t\t\thooks.Debug(\"edgexfoundry:configure: kuiper\")\n\n\t\t\tswitch status {\n\t\t\tcase ON, OFF:\n\t\t\t\tserviceList = getKuiperServices()\n\t\t\tcase UNSET:\n\t\t\t\t// this is the default status of all services if no\n\t\t\t\t// configuration has been specified; no-op\n\t\t\t\tcontinue\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"edgexfoundry:configure: invalid value for kuiper: %s\", status)\n\t\t\t}\n\n\t\tcase secProxyService:\n\t\t\thooks.Debug(\"edgexfoundry:configure: proxy\")\n\n\t\t\tswitch status {\n\t\t\tcase ON:\n\t\t\t\t// NOTE: the original bash based implementation would\n\t\t\t\t// additionally handle the secret-store dependency.\n\t\t\t\t// Due to the added complexity, this initial implementation\n\t\t\t\t// does not automatically handle enabling the secret-store\n\t\t\t\t// if/when the proxy is dynamically enabled.\n\t\t\t\tif !secretStoreActive {\n\t\t\t\t\terr = fmt.Errorf(\"edgexfoundry:configure security-proxy=on not allowed;\" +\n\t\t\t\t\t\t\"secret-store=off\")\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tfallthrough\n\t\t\tcase OFF:\n\t\t\t\tserviceList = getProxyServices()\n\t\t\tcase UNSET:\n\t\t\t\t// this is the default status of all services if no\n\t\t\t\t// configuration has been specified; no-op\n\t\t\t\tcontinue\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"edgexfoundry:configure: invalid value for security-proxy: %s\", status)\n\t\t\t}\n\n\t\tcase secStoreService:\n\t\t\thooks.Debug(\"edgexfoundry:configure: secretstore\")\n\n\t\t\tswitch status {\n\t\t\tcase ON:\n\t\t\t\treturn fmt.Errorf(\"edgexfoundry:configure security-secret-store=on not allowed\")\n\t\t\tcase OFF:\n\t\t\t\t// TODO - this var is used by the secProxyCase to ensure that the\n\t\t\t\t// secret store is active when the proxy is being enabled at runtime.\n\t\t\t\t// This relies on the fact that the secret store comes before the proxy\n\t\t\t\t// in hooks.Services. To make this less fragile, the proxy case should\n\t\t\t\t// check the status of the secret store directly.\n\t\t\t\tsecretStoreActive = false\n\n\t\t\t\tif err = disableSecretStoreAndRestart(); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\tcase UNSET:\n\t\t\t\t// this is the default status of all services if no\n\t\t\t\t// configuration has been specified; no-op\n\t\t\t\tcontinue\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"edgexfoundry:configure: invalid value for security-secret-store: %s\", status)\n\t\t\t}\n\n\t\tdefault:\n\t\t\thooks.Debug(\"edgexfoundry:configure: other service\")\n\t\t\t// default case for all other services\n\n\t\t\tswitch status {\n\t\t\tcase ON:\n\t\t\t\tserviceList = []string{s}\n\t\t\tcase OFF:\n\t\t\t\tif err := isDisableAllowed(s); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tserviceList = []string{s}\n\t\t\tcase UNSET:\n\t\t\t\t// this is the default status of all services if no\n\t\t\t\t// configuration has been specified; no-op\n\t\t\t\tcontinue\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"edgexfoundry:configure: invalid value for %s: %s\", s, status)\n\t\t\t}\n\t\t}\n\n\t\thooks.Debug(fmt.Sprintf(\"edgexfoundry:configure calling handleServices: %v\", serviceList))\n\t\tif err = handleServices(serviceList, status); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dc96a1bdf61101672a29ad2981e2b8e5", "score": "0.5571623", "text": "func parseConfig (fileName string, config *app_t) error {\n configFile, err := os.Open(fileName) //try the file\n \n if err == nil {\n defer configFile.Close()\n jsonParser := json.NewDecoder(configFile)\n err = jsonParser.Decode(config)\n\n if err != nil {\n return fmt.Errorf(\"%s file appears to have invalid json :: \" + err.Error(), fileName)\n } else if len(config.Services) < 1 {\n return fmt.Errorf(\"Please add at least one service to your config\")\n }\n\n //now validate all the service objects\n for idx, s := range(config.Services) {\n if len(s.Output) == 0 {\n return fmt.Errorf(\"Output file location for service number %d[%s] is missing\", idx, s.Term)\n } else {\n f := outputHandle(&s)\n f.WriteString(\"**** Printing Press started monitoring servce ****\\n\")\n f.Close()\n }\n }\n\n return nil //we're good\n } else {\n return fmt.Errorf(\"Unable to open '%s' file :: \" + err.Error(), fileName)\n }\n}", "title": "" }, { "docid": "e8012546909ad8a79a4eaf60e5ede0cc", "score": "0.55032593", "text": "func Initialize(filepath, cfgInline string) error {\n\n\tconf := configuration.NewServiceMap()\n\n\tparser := configuration.CreateParser(filepath, cfgInline)\n\terr := parser.Parse(conf)\n\tif err != nil {\n\t\tslog.Error(err)\n\t\treturn err\n\t}\n\n\t// log.Info(fmt.Sprintf(\"%s\", conf.List()))\n\tfor _, s := range conf.List() {\n\t\tserv, err := conf.Get(s)\n\t\tif err != nil {\n\t\t\tslog.Error(err)\n\t\t\tcontinue\n\t\t}\n\t\tnewExt, err := extractor.CreateExtractor(serv.ExtConfig.Class, serv.ExtConfig.Parameters)\n\t\tif err != nil {\n\t\t\tslog.Error(err)\n\t\t\tlog.Info(fmt.Sprintf(\"Extractor for service %q couldn't be created.\", s))\n\t\t\tcontinue\n\t\t}\n\n\t\tnewAuth, err := authenticator.CreateAuthenticator(serv.AuthConfig.Class, serv.AuthConfig.Parameters)\n\t\tif err != nil {\n\t\t\tslog.Error(err)\n\t\t\tlog.Info(fmt.Sprintf(\"Authenticator for service %q couldn't be created.\", s))\n\t\t\tcontinue\n\t\t}\n\n\t\tnewWriter, err := writer.CreateWriter(serv.WriConfig.Class, serv.WriConfig.Parameters)\n\t\tif err != nil {\n\t\t\tslog.Error(err)\n\t\t\tlog.Info(fmt.Sprintf(\"Writer for service %q couldn't be created.\", s))\n\t\t\tcontinue\n\t\t}\n\t\tSetService(s, newExt, newAuth, newWriter)\n\t}\n\n\t//log.Info(fmt.Sprintf(\"%+v\\n\", services))\n\treturn nil\n}", "title": "" }, { "docid": "23457ffb5ad0569ef4400a1d2b170bfb", "score": "0.54619557", "text": "func (cac *EnvironmentServiceConfigController) Configure(client Client, config *Configuration) error {\n\t//cloudapp deployment config should be in place at this point, but check\n\tdeploymentName := config.DeploymentName\n\tnamespace := config.NameSpace\n\tstatusKey := StatusKey(config.InstanceID, config.Action)\n\twaitGroup := &sync.WaitGroup{}\n\t// ensure we have the latest DeploymentConfig\n\tdeployment, err := client.GetDeploymentConfigByName(namespace, deploymentName)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unexpected error retrieving DeployConfig for deployment \"+deploymentName)\n\t}\n\tif deployment == nil {\n\t\treturn errors.New(\"could not find DeploymentConfig for \" + deploymentName)\n\t}\n\t//find the deployed services\n\tservices, err := client.FindDeploymentConfigsByLabel(namespace, map[string]string{\"rhmap/type\": \"environmentService\"})\n\tif err != nil {\n\t\tcac.StatusPublisher.Publish(statusKey, \"error\", \"failed to retrieve environment Service dcs during configuration of \"+deployment.Name+\" \"+err.Error())\n\t\treturn err\n\t}\n\tcac.StatusPublisher.Publish(statusKey, configInProgress, fmt.Sprintf(\"found %v services\", len(services)))\n\terrs := []string{}\n\t//configure for any environment services already deployed\n\t// ensure not to call configure multiple times for instance when mongo replica set present\n\tconfigured := map[string]bool{}\n\tfor _, s := range services {\n\t\tserviceName := s.Labels[\"rhmap/name\"]\n\t\tif _, ok := configured[serviceName]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tcac.StatusPublisher.Publish(statusKey, configInProgress, \"configuring \"+serviceName)\n\t\tconfigured[serviceName] = true\n\t\tc := cac.ConfigurationFactory.Factory(serviceName, config, waitGroup)\n\t\tgo c.Configure(client, deployment, namespace)\n\t}\n\tgo func() {\n\t\twaitGroup.Wait()\n\t\tif _, err := client.UpdateDeployConfigInNamespace(namespace, deployment); err != nil {\n\t\t\tcac.StatusPublisher.Publish(statusKey, configError, \"failed to update DeployConfig after configuring it \"+err.Error())\n\t\t}\n\t\tif len(errs) > 0 {\n\t\t\tcac.StatusPublisher.Publish(statusKey, configError, fmt.Sprintf(\" some configuration jobs failed %v\", errs))\n\t\t}\n\t\tcac.StatusPublisher.Publish(statusKey, configComplete, \"service configuration complete\")\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "86f03888c16d4bc4aac00db038de0178", "score": "0.5445863", "text": "func main() {\n\tif err := readConfig(); err != nil {\n\t\tif _, ok := err.(viper.ConfigFileNotFoundError); ok {\n\t\t\t// Config file not found; ignore error if desired\n\t\t\tclog.Output(1, \"Start using default setings\")\n\t\t} else {\n\t\t\tclog.Fatal(err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tsvcConfig := &service1.Config{\n\t\tName: \"Cycle\",\n\t\tDisplayName: \"Cycle Service\",\n\t\tDescription: \"Helper service for PhotoCycle\",\n\t}\n\tprg := &program{}\n\ts, err := service1.New(prg, svcConfig)\n\tif err != nil {\n\t\tclog.Fatal(err)\n\t}\n\tif len(os.Args) > 1 {\n\t\terr = service1.Control(s, os.Args[1])\n\t\tif err != nil {\n\t\t\tclog.Fatal(err)\n\t\t}\n\t\treturn\n\t}\n\tdLogger, err = s.Logger(nil)\n\tif err != nil {\n\t\tclog.Fatal(err)\n\t}\n\terr = s.Run()\n\tif err != nil {\n\t\tdLogger.Error(err)\n\t}\n}", "title": "" }, { "docid": "9361bc3318c53f16680202906a81b7d3", "score": "0.541575", "text": "func (self *Globule) initServices() {\n\tlog.Println(\"Initialyse services\")\n\n\t// Each service contain a file name config.json that describe service.\n\t// I will keep services info in services map and also it running process.\n\tbasePath, _ := filepath.Abs(filepath.Dir(os.Args[0]))\n\tfilepath.Walk(basePath, func(path string, info os.FileInfo, err error) error {\n\t\tif err == nil && info.Name() == \"config.json\" {\n\t\t\t// println(path, info.Name())\n\t\t\t// So here I will read the content of the file.\n\t\t\ts := make(map[string]interface{})\n\t\t\tconfig, err := ioutil.ReadFile(path)\n\t\t\tif err == nil {\n\t\t\t\t// Read the config file.\n\t\t\t\tjson.Unmarshal(config, &s)\n\t\t\t\tif s[\"Protocol\"].(string) == \"grpc\" {\n\n\t\t\t\t\tpath_ := path[:strings.LastIndex(path, string(os.PathSeparator))]\n\t\t\t\t\tservicePath := path_ + string(os.PathSeparator) + s[\"Name\"].(string)\n\t\t\t\t\tif string(os.PathSeparator) == \"\\\\\" {\n\t\t\t\t\t\tservicePath += \".exe\" // in case of windows.\n\t\t\t\t\t}\n\n\t\t\t\t\t// Start the process.\n\t\t\t\t\tlog.Println(\"try to start process \", s[\"Name\"].(string))\n\t\t\t\t\tif s[\"Name\"].(string) == \"file\" {\n\t\t\t\t\t\ts[\"Process\"] = exec.Command(servicePath, Utility.ToString(s[\"Port\"]), globule.webRoot)\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts[\"Process\"] = exec.Command(servicePath, Utility.ToString(s[\"Port\"]))\n\t\t\t\t\t}\n\n\t\t\t\t\terr = s[\"Process\"].(*exec.Cmd).Start()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Println(\"Fail to start service: \", s[\"Name\"].(string), \" at port \", s[\"Port\"], \" with error \", err)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Now I will start the proxy that will be use by javascript client.\n\t\t\t\t\tproxyPath := self.path + string(os.PathSeparator) + \"bin\" + string(os.PathSeparator) + \"grpcwebproxy\"\n\t\t\t\t\tif string(os.PathSeparator) == \"\\\\\" {\n\t\t\t\t\t\tproxyPath += \".exe\" // in case of windows.\n\t\t\t\t\t}\n\n\t\t\t\t\t// This is the grpc service to connect with the proxy\n\t\t\t\t\tproxyBackendAddress := \"localhost:\" + Utility.ToString(s[\"Port\"])\n\t\t\t\t\tproxyAllowAllOrgins := Utility.ToString(s[\"AllowAllOrigins\"])\n\n\t\t\t\t\t// start the proxy service.\n\t\t\t\t\ts[\"ProxyProcess\"] = exec.Command(proxyPath, \"--backend_addr=\"+proxyBackendAddress, \"--server_http_debug_port=\"+Utility.ToString(s[\"Proxy\"]), \"--run_tls_server=false\", \"--allow_all_origins=\"+proxyAllowAllOrgins)\n\t\t\t\t\terr = s[\"ProxyProcess\"].(*exec.Cmd).Start()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Println(\"Fail to start grpcwebproxy: \", s[\"Name\"].(string), \" at port \", s[\"Proxy\"], \" with error \", err)\n\t\t\t\t\t}\n\n\t\t\t\t\tself.services[s[\"Name\"].(string)] = s\n\n\t\t\t\t\ts_ := make(map[string]interface{})\n\n\t\t\t\t\t// export public service values.\n\t\t\t\t\ts_[\"Proxy\"] = s[\"Proxy\"]\n\t\t\t\t\ts_[\"Port\"] = s[\"Port\"]\n\n\t\t\t\t\tself.Services[s[\"Name\"].(string)] = s_\n\t\t\t\t\tself.saveConfig()\n\n\t\t\t\t\tlog.Println(\"Service \", s[\"Name\"].(string), \"is running at port\", s[\"Port\"], \"it's proxy port is\", s[\"Proxy\"])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "4f4f1fbbf2601bb6148b7fcaa2bca1e5", "score": "0.5398838", "text": "func (s *Service) Start(ctx context.Context) error {\n\tctx, cancel := context.WithCancel(ctx)\n\tgo func() {\n\t\tdefer cancel()\n\n\t\terr := s.refresh()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"could not refresh remote-config: %v\", err)\n\t\t}\n\n\t\tfor {\n\t\t\tvar err error\n\t\t\trefreshInterval := s.calculateRefreshInterval()\n\t\t\tselect {\n\t\t\tcase <-s.clock.After(refreshInterval):\n\t\t\t\terr = s.refresh()\n\t\t\t// New clients detected, request refresh\n\t\t\tcase response := <-s.newActiveClients.requests:\n\t\t\t\tif time.Now().UTC().After(s.newActiveClients.until) {\n\t\t\t\t\ts.newActiveClients.setRateLimit(refreshInterval)\n\t\t\t\t\terr = s.refresh()\n\t\t\t\t} else {\n\t\t\t\t\ttelemetry.CacheBypassRateLimit.Inc()\n\t\t\t\t}\n\t\t\t\tclose(response)\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"could not refresh remote-config: %v\", err)\n\t\t\t}\n\t\t}\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "beefeb6687042132db6b1cea9731a80e", "score": "0.5381187", "text": "func Observe(payload *cfg.ServicePayload) {\n\tfilePath := os.Getenv(\"REDISDB_CONFIG_FILE\")\n\tif filePath == \"\" {\n\t\tfilePath = \"/etc/dd-agent/conf.d/redisdb.yaml\"\n\t}\n\n\tcurrentHash, err := cfg.HashFileMd5(filePath)\n\tif err != nil {\n\t\tlogger.Warnf(\"[redisdb] Could not get initial hash for %s: %s\", filePath, err)\n\t\tcurrentHash = \"\"\n\t}\n\n\tlogger.Infof(\"[redisdb] Existing file hash %s: %s\", filePath, currentHash)\n\n\tstream := payload.Services.Observe()\n\n\tfor {\n\t\tselect {\n\t\tcase <-payload.QuitCh:\n\t\t\tlogger.Warn(\"[redisdb] stopping\")\n\t\t\treturn\n\n\t\tcase <-stream.Changes():\n\t\t\tstream.Next()\n\n\t\t\tt := &Config{}\n\n\t\t\tservices := stream.Value().(map[string]*consul.AgentService)\n\n\t\t\tfor _, service := range services {\n\t\t\t\tif !cfg.ServiceEnabled(\"redisdb\", service.Tags) {\n\t\t\t\t\tlogger.Debugf(\"[redisdb] Service %s does not contain 'dd-redisdb' tag\", service.Service)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tlogger.Infof(\"[redisdb] Service %s tags does contain 'dd-redisdb'\", service.Service)\n\n\t\t\t\tcheck := &ConfigItem{\n\t\t\t\t\tHost: service.Address,\n\t\t\t\t\tPort: service.Port,\n\t\t\t\t\tTags: []string{\n\t\t\t\t\t\tfmt.Sprintf(\"service:%s\", service.Service),\n\t\t\t\t\t},\n\t\t\t\t}\n\n\t\t\t\tt.Instances = append(t.Instances, check)\n\t\t\t}\n\n\t\t\t// Sort the services by name so we get consistent output across runs\n\t\t\tsort.Sort(serviceSorter(t.Instances))\n\n\t\t\tdata, err := yaml.Marshal(&t)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Fatalf(\"[redisdb] could not marshal yaml: %v\", err)\n\t\t\t}\n\n\t\t\treloadRequired, newHash := cfg.WriteIfChange(\"redisdb\", filePath, data, currentHash)\n\t\t\tif !reloadRequired {\n\t\t\t\tcurrentHash = newHash\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpayload.ReloadCh <- cfg.ReloadPayload{\n\t\t\t\tService: \"redisdb\",\n\t\t\t\tOldHash: currentHash,\n\t\t\t\tNewHash: newHash,\n\t\t\t}\n\n\t\t\tcurrentHash = newHash\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ba00c0b60f83f7c6f67198052d7ec434", "score": "0.53224224", "text": "func main() {\n\terr := readConfig()\n\tif err != nil {\n\t\tclog.Fatal(err)\n\t\treturn\n\t}\n\n\tsvcConfig := &service1.Config{\n\t\tName: \"Evropochta\",\n\t\tDisplayName: \"Evropochta Service\",\n\t\tDescription: \"Evropochta service for PhotoCycle\",\n\t}\n\tprg := &program{}\n\n\ts, err := service1.New(prg, svcConfig)\n\tif err != nil {\n\t\tclog.Fatal(err)\n\t\treturn\n\t}\n\tif len(os.Args) > 1 {\n\t\terr = service1.Control(s, os.Args[1])\n\t\tif err != nil {\n\t\t\tclog.Fatal(err)\n\t\t}\n\t\treturn\n\t}\n\tdLogger, err = s.Logger(nil)\n\tif err != nil {\n\t\tclog.Fatal(err)\n\t}\n\terr = s.Run()\n\tif err != nil {\n\t\tdLogger.Error(err)\n\t}\n\n}", "title": "" }, { "docid": "f9498b3f7de0c2fe834e24637923e549", "score": "0.5307717", "text": "func (c *installConfigCmd) Run(k *kong.Context, logger logging.Logger) error { //nolint:gocyclo // TODO(negz): Can anything be broken out here?\n\trap := v1.AutomaticActivation\n\tif c.ManualActivation {\n\t\trap = v1.ManualActivation\n\t}\n\tpkgName := c.Name\n\tif pkgName == \"\" {\n\t\tref, err := name.ParseReference(c.Package)\n\t\tif err != nil {\n\t\t\tlogger.Debug(errPkgIdentifier, \"error\", err)\n\t\t\treturn errors.Wrap(err, errPkgIdentifier)\n\t\t}\n\t\tpkgName = xpkg.ToDNSLabel(ref.Context().RepositoryStr())\n\t}\n\tlogger = logger.WithValues(\"configurationName\", pkgName)\n\tpackagePullSecrets := make([]corev1.LocalObjectReference, len(c.PackagePullSecrets))\n\tfor i, s := range c.PackagePullSecrets {\n\t\tpackagePullSecrets[i] = corev1.LocalObjectReference{\n\t\t\tName: s,\n\t\t}\n\t}\n\tcr := &v1.Configuration{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: pkgName,\n\t\t},\n\t\tSpec: v1.ConfigurationSpec{\n\t\t\tPackageSpec: v1.PackageSpec{\n\t\t\t\tPackage: c.Package,\n\t\t\t\tRevisionActivationPolicy: &rap,\n\t\t\t\tRevisionHistoryLimit: &c.RevisionHistoryLimit,\n\t\t\t\tPackagePullSecrets: packagePullSecrets,\n\t\t\t},\n\t\t},\n\t}\n\tkubeConfig, err := ctrl.GetConfig()\n\tif err != nil {\n\t\tlogger.Debug(errKubeConfig, \"error\", err)\n\t\treturn errors.Wrap(err, errKubeConfig)\n\t}\n\tlogger.Debug(\"Found kubeconfig\")\n\tkube, err := typedclient.NewForConfig(kubeConfig)\n\tif err != nil {\n\t\tlogger.Debug(errKubeConfig, \"error\", err)\n\t\treturn errors.Wrap(err, errKubeClient)\n\t}\n\tlogger.Debug(\"Created Kubernetes client\")\n\tres, err := kube.Configurations().Create(context.Background(), cr, metav1.CreateOptions{})\n\tif err != nil {\n\t\tlogger.Debug(\"Failed to create configuration\", \"error\", warnIfNotFound(err))\n\t\treturn errors.Wrap(warnIfNotFound(err), \"cannot create configuration\")\n\t}\n\tif c.Wait != 0 {\n\t\tlogger.Debug(msgConfigurationWaiting)\n\t\twatchList := cache.NewListWatchFromClient(kube.RESTClient(), \"configurations\", corev1.NamespaceAll, fields.Everything())\n\t\twaitSeconds := int64(c.Wait.Seconds())\n\t\twatcher, err := watchList.Watch(metav1.ListOptions{Watch: true, TimeoutSeconds: &waitSeconds})\n\t\tdefer watcher.Stop()\n\t\tif err != nil {\n\t\t\tlogger.Debug(fmt.Sprintf(errFmtWatchPkg, \"Configuration\"), \"error\", err)\n\t\t\treturn err\n\t\t}\n\t\tfor {\n\t\t\tevent, ok := <-watcher.ResultChan()\n\t\t\tif !ok {\n\t\t\t\tlogger.Debug(fmt.Sprintf(errFmtPkgNotReadyTimeout, \"Configuration\"))\n\t\t\t\treturn errors.Errorf(errFmtPkgNotReadyTimeout, \"Configuration\")\n\t\t\t}\n\t\t\tobj := (event.Object).(*v1.Configuration)\n\t\t\tcond := obj.GetCondition(v1.TypeHealthy)\n\t\t\tif obj.ObjectMeta.Name == pkgName && cond.Status == corev1.ConditionTrue {\n\t\t\t\tlogger.Debug(msgConfigurationReady)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tlogger.Debug(msgConfigurationNotReady)\n\t\t}\n\t}\n\t_, err = fmt.Fprintf(k.Stdout, \"%s/%s created\\n\", strings.ToLower(v1.ConfigurationGroupKind), res.GetName())\n\treturn err\n}", "title": "" }, { "docid": "277640b7571961d6514eeecb4911c5c4", "score": "0.5305741", "text": "func (s *Service) Open() error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tif s.open {\n\t\treturn nil\n\t}\n\n\ts.open = true\n\t// Roughly match the number of scraper services, so each config change doesn't have to wait.\n\ts.updating = make(chan *config.Config, 100)\n\ts.closing = make(chan struct{})\n\n\tpairs := s.pairs()\n\tconf := s.prom(pairs)\n\terr := s.scrapeManager.ApplyConfig(conf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc := make(map[string]discovery.Configs)\n\tfor _, v := range conf.ScrapeConfigs {\n\t\tc[v.JobName] = v.ServiceDiscoveryConfigs\n\t}\n\terr = s.discoveryManager.ApplyConfig(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.wg.Add(2)\n\tgo func() {\n\t\tdefer s.wg.Done()\n\t\ts.discoveryManager.Run()\n\t}()\n\tgo func() {\n\t\tdefer s.wg.Done()\n\t\ts.scrapeManager.Run(s.discoveryManager.SyncCh())\n\t}()\n\tgo s.scrape()\n\n\ts.open = true\n\treturn nil\n}", "title": "" }, { "docid": "2dd349c508c6974d20ff3c4081842b04", "score": "0.5297419", "text": "func (cp *ConsulClient) WatchService(srvName string, eventCh chan WatchServiceEvent, stopCh chan bool) error {\n\tkeyName := \"contiv.io/service/\" + srvName + \"/\"\n\n\t// Run in background\n\tgo func() {\n\t\tvar currSrvMap = make(map[string]ServiceInfo)\n\n\t\t// Get current list of services\n\t\tsrvList, lastIdx, err := cp.getServiceInstances(keyName, 0)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error getting service instances for (%s): Err: %v\", srvName, err)\n\t\t} else {\n\t\t\t// for each instance trigger an add event\n\t\t\tfor _, srvInfo := range srvList {\n\t\t\t\teventCh <- WatchServiceEvent{\n\t\t\t\t\tEventType: WatchServiceEventAdd,\n\t\t\t\t\tServiceInfo: srvInfo,\n\t\t\t\t}\n\n\t\t\t\t// Add the service to local cache\n\t\t\t\tsrvKey := srvInfo.HostAddr + \":\" + strconv.Itoa(srvInfo.Port)\n\t\t\t\tcurrSrvMap[srvKey] = srvInfo\n\t\t\t}\n\t\t}\n\n\t\t// Loop till asked to stop\n\t\tfor {\n\t\t\t// Check if we should quit\n\t\t\tselect {\n\t\t\tcase <-stopCh:\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\t// Read the service instances\n\t\t\t\tsrvList, lastIdx, err = cp.getServiceInstances(keyName, lastIdx)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif api.IsServerError(err) || strings.Contains(err.Error(), \"EOF\") || strings.Contains(err.Error(), \"connection refused\") {\n\t\t\t\t\t\tlog.Warnf(\"Consul service watch: server error: %v Retrying..\", err)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.Errorf(\"Error getting service instances for (%s): Err: %v. Exiting watch\", srvName, err)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Wait a little and continue\n\t\t\t\t\ttime.Sleep(5 * time.Second)\n\t\t\t\t\tcontinue\n\t\t\t\t} else {\n\t\t\t\t\tlog.Debugf(\"Got consul srv list: {%+v}. Curr: {%+v}\", srvList, currSrvMap)\n\t\t\t\t\tvar newSrvMap = make(map[string]ServiceInfo)\n\n\t\t\t\t\t// Check if there are any new services\n\t\t\t\t\tfor _, srvInfo := range srvList {\n\t\t\t\t\t\tsrvKey := srvInfo.HostAddr + \":\" + strconv.Itoa(srvInfo.Port)\n\n\t\t\t\t\t\t// If the entry didnt exists previously, trigger add event\n\t\t\t\t\t\tif _, ok := currSrvMap[srvKey]; !ok {\n\t\t\t\t\t\t\tlog.Debugf(\"Sending add event for srv: %v\", srvInfo)\n\t\t\t\t\t\t\teventCh <- WatchServiceEvent{\n\t\t\t\t\t\t\t\tEventType: WatchServiceEventAdd,\n\t\t\t\t\t\t\t\tServiceInfo: srvInfo,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// create new service map\n\t\t\t\t\t\tnewSrvMap[srvKey] = srvInfo\n\t\t\t\t\t}\n\n\t\t\t\t\t// for all entries in old service list, see if we need to delete any\n\t\t\t\t\tfor _, srvInfo := range currSrvMap {\n\t\t\t\t\t\tsrvKey := srvInfo.HostAddr + \":\" + strconv.Itoa(srvInfo.Port)\n\n\t\t\t\t\t\t// if the entry does not exists in new list, delete it\n\t\t\t\t\t\tif _, ok := newSrvMap[srvKey]; !ok {\n\t\t\t\t\t\t\tlog.Debugf(\"Sending delete event for srv: %v\", srvInfo)\n\t\t\t\t\t\t\teventCh <- WatchServiceEvent{\n\t\t\t\t\t\t\t\tEventType: WatchServiceEventDel,\n\t\t\t\t\t\t\t\tServiceInfo: srvInfo,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// set new srv map as the current\n\t\t\t\t\tcurrSrvMap = newSrvMap\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "ab7d80b42af0cb13fa186efef83eba57", "score": "0.5284789", "text": "func (s *Service) Run(ctx context.Context) error {\n\ts.conf.Logger.WithField(\"update interval\", s.conf.UpdateInterval.String()).Info(\"starting service\")\n\tdefer s.conf.Logger.Info(\"stopped service\")\n\tif err := s.updateWarehouse(ctx); err != nil {\n\t\treturn err\n\t}\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\tcase <-s.conf.Clock.After(s.conf.UpdateInterval):\n\t\t\tif err := s.updateWarehouse(ctx); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "86b2f68d4d574f25d5468f08f01ba620", "score": "0.5272577", "text": "func (s *Service) Run() error {\n\tvar (\n\t\tloggers = make([]interface{}, 0)\n\t\terr error\n\t)\n\n\t// Initialize logger\n\tif s.config.LogPath != \"\" {\n\t\tloggers = append(loggers, logger.FileConfig{\n\t\t\tLevel: s.config.LogLevel,\n\t\t\tPath: s.config.LogPath,\n\t\t})\n\t}\n\n\tif s.config.SyslogLevel != \"\" {\n\t\tloggers = append(loggers, logger.SyslogConfig{\n\t\t\tLevel: s.config.SyslogLevel,\n\t\t\tFacility: s.config.SyslogFacility,\n\t\t\tTag: s.config.SyslogTag,\n\t\t\tAddress: s.config.SyslogAddress,\n\t\t\tTransport: s.config.SyslogTransport,\n\t\t})\n\t}\n\n\ts.log, err = logger.NewLogger(loggers...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Catch panic and write its output to the logger\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\ts.log.Error(\"panic: %s\\n%s\", r, debug.Stack())\n\t\t\tos.Exit(1)\n\t\t}\n\t}()\n\n\ts.log.Info(\"service started\")\n\n\ts.backend, err = backend.NewBackend(s.config.Backend, s.log.Context(\"backend\"))\n\tif err != nil {\n\t\ts.log.Error(\"failed to initialize backend: %s\", err)\n\t\treturn nil\n\t}\n\n\t// Register and initialize workers\n\ts.poller = newPollerWorker(s)\n\n\ts.workers.Add(\n\t\tworker.NewWorker(newHTTPWorker(s)),\n\t\tworker.NewWorker(s.poller),\n\t)\n\n\tif err = s.workers.Init(); err != nil {\n\t\treturn fmt.Errorf(\"failed to initialize workers: %s\", err)\n\t}\n\n\t// Start workers and wait until they stop\n\ts.workers.Run()\n\ts.workers.Wait()\n\n\ts.log.Info(\"service stopped\")\n\n\treturn nil\n}", "title": "" }, { "docid": "83e94f10f9093f4844a4234b4c5a53a6", "score": "0.5272058", "text": "func (cw *ConfigWatcher) Start() {\n\tcw.updateAll()\n\n\tgo func() {\n\t\tdefer cw.watcher.Close()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event, ok := <-cw.watcher.Events:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tzap.L().Debug(\"Watcher event\", zap.Any(\"event\", event))\n\t\t\t\tif event.Op&fsnotify.Write == fsnotify.Write {\n\t\t\t\t\ttime.Sleep(time.Millisecond) // ???? EOF if we don't wait\n\t\t\t\t\tcw.updateFrontend(event.Name, false)\n\t\t\t\t} else if event.Op&fsnotify.Create == fsnotify.Create {\n\t\t\t\t\ttime.Sleep(time.Millisecond) // ???? EOF if we don't wait\n\t\t\t\t\tcw.updateFrontend(event.Name, false)\n\t\t\t\t} else if event.Op&fsnotify.Rename == fsnotify.Rename {\n\t\t\t\t\tcw.updateFrontend(event.Name, true)\n\t\t\t\t}\n\t\t\tcase err := <-cw.watcher.Errors:\n\t\t\t\tzap.L().Error(\"Config watcher\", zap.Error(err))\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "e633c0c013e3c76141e902183b7edce1", "score": "0.5271425", "text": "func main() {\n\n\t// Initialize Logger instance\n\tlog, err := logger.New(serviceName, logger.Options{\n\t\tFormat: logger.SyslogLogFormat,\n\t})\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\t// Initialize application specific configs and dependencies\n\t// App and request config\n\tcfg, err := config.New(configprovider.ViperKey)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\tos.Exit(1)\n\t}\n\n\tservice := &grpc.Service{}\n\terr = cfg.GetObject(adapter.ServerKey, service)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\tos.Exit(1)\n\t}\n\n\tkubeconfigHandler, err := config.NewKubeconfigBuilder(configprovider.ViperKey)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\tos.Exit(1)\n\t}\n\n\t// Initialize Handler intance\n\thandler := kuma.New(cfg, log, kubeconfigHandler)\n\thandler = adapter.AddLogger(log, handler)\n\n\tservice.Handler = handler\n\tservice.Channel = make(chan interface{}, 10)\n\tservice.StartedAt = time.Now()\n\tservice.Version = version\n\tservice.GitSHA = gitsha\n\n\tgo registerCapabilities(service.Port, log) //Registering static capabilities\n\tgo registerDynamicCapabilities(service.Port, log) //Registering latest capabilities periodically\n\n\t// Server Initialization\n\tlog.Info(\"Adaptor Listening at port: \", service.Port)\n\terr = grpc.Start(service, nil)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "46b58dffaa1533462c468e0ed9b7b13a", "score": "0.52658445", "text": "func configure() {\n\tconst app = \"edgex-ui\"\n\n\tlog.SetComponentName(\"configure\")\n\n\tif err := options.ProcessConfig(app); err != nil {\n\t\tlog.Fatalf(\"Error processing config options: %v\", err)\n\t}\n\n\tif err := options.ProcessAutostart(app); err != nil {\n\t\tlog.Fatalf(\"Error processing autostart options: %v\", err)\n\t}\n\n}", "title": "" }, { "docid": "69a39f3e8e31678d0903ec44bd08a8b6", "score": "0.52479035", "text": "func (cfg *Config) Service(ctx context.Context, l *logger.L) error {\n\tif cfg.flag != nil && !cfg.flag.Parsed() {\n\t\treturn errors.New(\"must parse flags before calling Service\")\n\t}\n\n\tDefaultStatsd = Statsd(cfg.appName)\n\n\tif cfg.loggingEnabled {\n\t\tmc := &MultiClient{}\n\t\tmc.Append(DefaultStatsd)\n\t\tmc.Append(NewLoggingClient(l, cfg.logLevel))\n\t\tDefaultStatsd = mc\n\t}\n\n\tif cfg.runtimeEnabled {\n\t\tgo func() {\n\t\t\tticker := time.NewTicker(cfg.runtimeInterval)\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn\n\t\t\t\tcase <-ticker.C:\n\t\t\t\t\tgo emitRuntimeStats()\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dd84eef323c815e4412a8a924003d422", "score": "0.5245054", "text": "func Run(httpProxyAddr string,\n\tsocksProxyAddr string,\n\tconfigDir string,\n\tstickyConfig bool,\n\tproxyAll func() bool,\n\tflagsAsMap map[string]interface{},\n\tbeforeStart func(cfg *config.Config) bool,\n\tafterStart func(cfg *config.Config),\n\tonConfigUpdate func(cfg *config.Config),\n\tuserConfig config.UserConfig,\n\tonError func(err error)) error {\n\tdisplayVersion()\n\n\tlog.Debug(\"Initializing configuration\")\n\tcfg, err := config.Init(userConfig, PackageVersion, configDir, stickyConfig, flagsAsMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to initialize configuration: %v\", err)\n\t}\n\n\tclient := client.NewClient()\n\n\tif beforeStart(cfg) {\n\t\tlog.Debug(\"Preparing to start client proxy\")\n\t\tgeolookup.Configure(client.Addr)\n\t\tcfgMutex.Lock()\n\t\tapplyClientConfig(client, cfg, proxyAll)\n\t\tcfgMutex.Unlock()\n\n\t\tgo func() {\n\t\t\terr := config.Run(func(updated *config.Config) {\n\t\t\t\tlog.Debug(\"Applying updated configuration\")\n\t\t\t\tcfgMutex.Lock()\n\t\t\t\tapplyClientConfig(client, updated, proxyAll)\n\t\t\t\tonConfigUpdate(updated)\n\t\t\t\tcfgMutex.Unlock()\n\t\t\t\tlog.Debug(\"Applied updated configuration\")\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tonError(err)\n\t\t\t}\n\t\t}()\n\n\t\tif socksProxyAddr != \"\" {\n\t\t\tgo func() {\n\t\t\t\tlog.Debug(\"Starting client SOCKS5 proxy\")\n\t\t\t\terr = client.ListenAndServeSOCKS5(socksProxyAddr)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(\"Unable to start SOCKS5 proxy: %v\", err)\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\n\t\tlog.Debug(\"Starting client HTTP proxy\")\n\t\terr = client.ListenAndServeHTTP(httpProxyAddr, func() {\n\t\t\tlog.Debug(\"Started client HTTP proxy\")\n\t\t\t// We finally tell the config package to start polling for new configurations.\n\t\t\t// This is the final step because the config polling itself uses the full\n\t\t\t// proxying capabilities of Lantern, so it needs everything to be properly\n\t\t\t// set up with at least an initial bootstrap config (on first run) to\n\t\t\t// complete successfully.\n\t\t\tconfig.StartPolling()\n\t\t\tafterStart(cfg)\n\t\t})\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error starting client proxy: %v\", err)\n\t\t\tonError(err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "aa6df9b415ed0239a23e9a1e0ade1476", "score": "0.5242322", "text": "func Monitor(cfg *config.Config) {\n\tfor _, service := range cfg.Services {\n\t\tgo monitor(service)\n\t\t// To prevent multiple requests from running at the same time\n\t\ttime.Sleep(1111 * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "2cea836786eded622df2cd46d5c49741", "score": "0.5233174", "text": "func Run(ctx context.Context, cfg *config.Config, serviceList *ExternalServiceList, buildTime, gitCommit, version string, svcErrors chan error) (*Service, error) {\n\tlog.Info(ctx, \"running service\")\n\n\tlog.Info(ctx, \"got service configuration\", log.Data{\"config\": cfg})\n\n\t// Get HTTP Server\n\tr := mux.NewRouter()\n\ts := serviceList.GetHTTPServer(cfg.BindAddr, cfg.HttpWriteTimeout, r)\n\n\t// Get graphDB connection for observation store\n\tgraphDB, graphErrorConsumer, err := serviceList.GetGraphDB(ctx)\n\tif err != nil {\n\t\tlog.Fatal(ctx, \"failed to initialise graph driver\", err)\n\t\treturn nil, err\n\t}\n\n\t// Get zebedee client\n\tzebedeeCli := zebedee.New(cfg.ZebedeeURL)\n\n\t// Get dataset API client\n\tdatasetAPICli := dataset.NewAPIClient(cfg.DatasetAPIURL)\n\n\tcantabularClient := serviceList.GetCantabularClient(ctx, cfg)\n\n\t// Get permissions for private endpoints\n\tpermissions := getAuthorisationHandler(ctx, *cfg)\n\n\t// Get HealthCheck\n\thc, err := serviceList.GetHealthCheck(cfg, buildTime, gitCommit, version)\n\tif err != nil {\n\t\tlog.Fatal(ctx, \"could not instantiate healthcheck\", err)\n\t\treturn nil, err\n\t}\n\tif err := registerCheckers(ctx, cfg, hc, graphDB, zebedeeCli, datasetAPICli, cantabularClient, cfg.EnablePrivateEndpoints); err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to register checkers\")\n\t}\n\n\tr.StrictSlash(true).Path(\"/health\").HandlerFunc(hc.Handler)\n\thc.Start(ctx)\n\n\t// Setup the API\n\ta := api.Setup(ctx, r, cfg, graphDB, datasetAPICli, cantabularClient, permissions)\n\n\t// Run the http server in a new go-routine\n\tgo func() {\n\t\tif err := s.ListenAndServe(); err != nil {\n\t\t\tsvcErrors <- errors.Wrap(err, \"failure in http listen and serve\")\n\t\t}\n\t}()\n\n\treturn &Service{\n\t\tconfig: cfg,\n\t\trouter: r,\n\t\tapi: a,\n\t\thealthCheck: hc,\n\t\tserver: s,\n\t\tserviceList: serviceList,\n\t\tgraphDB: graphDB,\n\t\tgraphErrorConsumer: graphErrorConsumer,\n\t\tcantabularClient: cantabularClient,\n\t}, nil\n}", "title": "" }, { "docid": "8a781d845fa47deeee669491b117b243", "score": "0.52222", "text": "func Run(conf config.Config) error {\n\tvar err error\n\n\tif err = conf.Validate(); err != nil {\n\t\tlogrus.WithError(err).Error(\"Validation of config failed\")\n\t\treturn err\n\t}\n\n\tlogrusLevel, err := logrus.ParseLevel(conf.LogLevel)\n\tif err != nil {\n\t\tlogrus.WithError(err).Errorf(\"Failure parsing requested log level (%v)\", conf.LogLevel)\n\t\tlogrusLevel = logrus.DebugLevel\n\t}\n\tlogrus.SetLevel(logrusLevel)\n\n\tvar kubeClient kubernetes.Interface\n\tif conf.DiscoveryAdapter == config.KubernetesAdapter ||\n\t\tconf.RulesAdapter == config.KubernetesAdapter {\n\t\tkubeClient, err = kubepkg.NewClient(kubepkg.Config{\n\t\t\tURL: conf.Kubernetes.URL,\n\t\t\tToken: conf.Kubernetes.Token,\n\t\t})\n\n\t\tif err != nil {\n\t\t\tlogrus.WithError(err).Error(\"Could not create Kubernetes client\")\n\t\t\treturn err\n\t\t}\n\t}\n\n\tidentity, err := identity.New(&conf, kubeClient)\n\tif err != nil {\n\t\tlogrus.WithError(err).Error(\"Could not create identity provider\")\n\t\treturn err\n\t}\n\n\tvar discovery api.ServiceDiscovery\n\tif conf.DNS || conf.Proxy {\n\t\tdiscovery, err = buildServiceDiscovery(&conf, kubeClient)\n\t\tif err != nil {\n\t\t\tlogrus.WithError(err).Error(\"Could not create service discovery backend adapter\")\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif conf.DNS {\n\t\tdnsConfig := dns.Config{\n\t\t\tDiscovery: discovery,\n\t\t\tPort: uint16(conf.Dnsconfig.Port),\n\t\t\tDomain: conf.Dnsconfig.Domain,\n\t\t}\n\t\tserver, err := dns.NewServer(dnsConfig)\n\t\tif err != nil {\n\t\t\tlogrus.WithError(err).Error(\"Could not start DNS server\")\n\t\t\treturn err\n\t\t}\n\t\tgo server.ListenAndServe()\n\t}\n\n\tif conf.Proxy {\n\t\terr := startProxy(&conf, identity, discovery)\n\t\tif err != nil {\n\t\t\tlogrus.WithError(err).Error(\"Could not start proxy\")\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvar lifecycle register.Lifecycle\n\tif conf.Register {\n\t\tregistry, err := buildServiceRegistry(&conf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tregistrationAgent, err := register.NewRegistrationAgent(register.RegistrationConfig{\n\t\t\tRegistry: registry,\n\t\t\tIdentity: identity,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogrus.WithError(err).Error(\"Could not create registry agent\")\n\t\t\treturn err\n\t\t}\n\n\t\thcAgents, err := healthcheck.BuildAgents(conf.HealthChecks)\n\t\tif err != nil {\n\t\t\tlogrus.WithError(err).Error(\"Could not build health checks\")\n\t\t\treturn err\n\t\t}\n\n\t\t// Control the registration agent via the health checker if any health checks were provided. If no\n\t\t// health checks are provided, just start the registration agent.\n\t\tif len(hcAgents) > 0 {\n\t\t\tlifecycle = register.NewHealthChecker(registrationAgent, hcAgents)\n\t\t} else {\n\t\t\tlifecycle = registrationAgent\n\t\t}\n\n\t\t// Delay slightly to give time for the application to start\n\t\t// TODO: make this delay configurable or implement a better solution.\n\t\ttime.AfterFunc(1*time.Second, lifecycle.Start)\n\t}\n\n\tappSupervisor := supervisor.NewAppSupervisor(&conf, lifecycle)\n\tappSupervisor.DoAppSupervision()\n\n\treturn nil\n}", "title": "" }, { "docid": "828fff9855b3f2a168830d4ff5307580", "score": "0.52163905", "text": "func main() {\n\tvar ripConfig AutoGeneratedRipConfigSchema\n\tif err := jsonutil.UnmarshalFile(ripConfigJsonFilePath, &ripConfig); err != nil {\n\t\tfmt.Printf(\"Error in opening/parsing RIP config file %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tfor _, serviceName := range serviceNames {\n\t\tgenerateEndpoints(serviceName, ripConfig)\n\t}\n}", "title": "" }, { "docid": "6232fbdf4696f6a5336314d58487a735", "score": "0.51956743", "text": "func (s *Service) Run() error {\n\tcErr := s.Configuration.Validate()\n\tif cErr != nil {\n\t\tlog.Fatal().Str(\"err\", cErr.DebugReport()).Msg(\"invalid configuration\")\n\t}\n\ts.Configuration.Print()\n\n\tclients, cErr := s.GetClients()\n\tif cErr != nil {\n\t\tlog.Fatal().Str(\"err\", cErr.DebugReport()).Msg(\"Cannot create clients\")\n\t}\n\n\tbusClients, bErr := s.GetBusClients()\n\tif bErr != nil {\n\t\tlog.Fatal().Str(\"err\", cErr.DebugReport()).Msg(\"Cannot create bus clients\")\n\t}\n\n\tlis, err := net.Listen(\"tcp\", fmt.Sprintf(\":%d\", s.Configuration.Port))\n\tif err != nil {\n\t\tlog.Fatal().Errs(\"failed to listen: %v\", []error{err})\n\t}\n\n\t// Create handlers\n\n\tagentManager := agent.NewManager(\n\t\tclients.edgeInvProxyControllerClient, clients.assetsClient, clients.controllersClient, s.Configuration.CACertRaw)\n\tagentHandler := agent.NewHandler(agentManager)\n\n\tecManager := edgecontroller.NewManager(\n\t\tclients.authxClient,\n\t\tclients.certClient,\n\t\tclients.controllersClient,\n\t\tclients.vpnClient,\n\t\tclients.netManagerClient,\n\t\tclients.assetsClient,\n\t\tclients.edgeInvProxyControllerClient,\n\t\ts.Configuration)\n\tecHandler := edgecontroller.NewHandler(ecManager)\n\n\tinvManager := inventory.NewManager(clients.deviceManagerClient, clients.assetsClient, clients.controllersClient, s.Configuration)\n\tinvHandler := inventory.NewHandler(invManager)\n\n\t// Consumers\n\n\tinventoryEventsConsumer := bus.NewInventoryEventsHandler(ecHandler, agentHandler, busClients.inventoryEventsConsumer)\n\tinventoryEventsConsumer.Run()\n\n\tinventoryOpsConsumer := bus.NewInventoryOpsHandler(agentHandler, ecHandler, busClients.inventoryOpsConsumer)\n\tinventoryOpsConsumer.Run()\n\n\n\tgrpcServer := grpc.NewServer()\n\tgrpc_inventory_manager_go.RegisterInventoryServer(grpcServer, invHandler)\n\tgrpc_inventory_manager_go.RegisterAgentServer(grpcServer, agentHandler)\n\tgrpc_inventory_manager_go.RegisterEICServer(grpcServer, ecHandler)\n\n\tif s.Configuration.Debug {\n\t\tlog.Info().Msg(\"Enabling gRPC server reflection\")\n\t\t// Register reflection service on gRPC server.\n\t\treflection.Register(grpcServer)\n\t}\n\tlog.Info().Int(\"port\", s.Configuration.Port).Msg(\"Launching gRPC server\")\n\tif err := grpcServer.Serve(lis); err != nil {\n\t\tlog.Fatal().Errs(\"failed to serve: %v\", []error{err})\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d3e1079f1da17968cd39d130494935b9", "score": "0.51751536", "text": "func initConfig() {\n\tp := os.Getenv(\"APP_CONF_PATH\")\n\n\t// load config from file\n\tif p != \"\" {\n\t\tc, err := ioutil.ReadFile(p)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tif err := yaml.Unmarshal(c, &conf); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tlog.Printf(\"\\nConfig read from %s\\n\", p)\n\t\treturn\n\t}\n\n\t// create config from env vars since a config file was not specified\n\n\t// ensure required keys are present\n\trequired := []string{\n\t\t\"COUNTER_SERVICE_URL\",\n\t}\n\tfor _, key := range required {\n\t\tif v := os.Getenv(key); v == \"\" {\n\t\t\tlog.Fatalf(\"\\n%s was not set\\n\", key)\n\t\t}\n\t}\n\n\t// create the config\n\tconf = &AppConfig{}\n\tif v := os.Getenv(\"COUNTER_SERVICE_URL\"); v != \"\" {\n\t\tconf.CounterServiceUrl = v\n\t}\n}", "title": "" }, { "docid": "8454d4f704cbe09f6f82fc6b54d34bad", "score": "0.51698714", "text": "func (sp *ServiceProcessor) configureService(svc *Service, oldContivSvc *configurator.ContivService, oldBackends []podmodel.ID) error {\n\tvar err error\n\tnewContivSvc := svc.GetContivService()\n\tnewBackends := svc.GetLocalBackends()\n\n\t// Configure service.\n\tif newContivSvc != nil {\n\t\tif oldContivSvc == nil {\n\t\t\terr = sp.Configurator.AddService(newContivSvc)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\terr = sp.Configurator.UpdateService(oldContivSvc, newContivSvc)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif oldContivSvc != nil {\n\t\t\terr = sp.Configurator.DeleteService(oldContivSvc)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Configure local Backends.\n\tnewBackendIfs := sp.backendIfs.Copy()\n\tupdateBackends := false\n\t// -> handle new backend interfaces\n\tfor _, newBackend := range newBackends {\n\t\tnew := true\n\t\tfor _, oldBackend := range oldBackends {\n\t\t\tif newBackend == oldBackend {\n\t\t\t\tnew = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif new {\n\t\t\tlocalEp := sp.getLocalEndpoint(newBackend)\n\t\t\tlocalEp.svcCount++\n\t\t\tif localEp.ifName != \"\" && localEp.svcCount == 1 {\n\t\t\t\tnewBackendIfs.Add(localEp.ifName)\n\t\t\t\tupdateBackends = true\n\t\t\t}\n\t\t}\n\t}\n\t// -> handle removed backend interfaces\n\tfor _, oldBackend := range oldBackends {\n\t\tremoved := true\n\t\tfor _, newBackend := range newBackends {\n\t\t\tif newBackend == oldBackend {\n\t\t\t\tremoved = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif removed {\n\t\t\tlocalEp := sp.getLocalEndpoint(oldBackend)\n\t\t\tlocalEp.svcCount--\n\t\t\tif localEp.ifName != \"\" && localEp.svcCount == 0 {\n\t\t\t\tnewBackendIfs.Del(localEp.ifName)\n\t\t\t\tupdateBackends = true\n\t\t\t}\n\t\t}\n\t}\n\t// -> update local backends\n\tif updateBackends {\n\t\terr = sp.Configurator.UpdateLocalBackendIfs(sp.backendIfs, newBackendIfs)\n\t\tsp.backendIfs = newBackendIfs\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "a2629843e1b20299f2c37049d526a8f0", "score": "0.51560086", "text": "func main() {\n\n\tw := establishWatch()\n\tresync := time.NewTicker(30 * time.Second).C\n\n\tfor {\n\t\tselect {\n\t\tcase event, ok := <-w.ResultChan():\n\t\t\tif !ok {\n\t\t\t\tw.Stop()\n\t\t\t\tw = establishWatch()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tpa := event.Object.(*v1alpha1.PodAutoscaler)\n\t\t\tswitch event.Type {\n\t\t\tcase watch.Added:\n\n\t\t\t\t// Take control of yolo-class PodAutoscalers only\n\t\t\t\tif pa.Annotations[\"autoscaling.knative.dev/class\"] == \"yolo\" {\n\n\t\t\t\t\t// Calculate a recommended scale\n\t\t\t\t\treplicas := recommendedScale(pa)\n\n\t\t\t\t\t// Update the Deployment\n\t\t\t\t\tscaleTo(pa, replicas)\n\n\t\t\t\t\t// Update status\n\t\t\t\t\tupdateStatus(pa, replicas)\n\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-resync:\n\t\t\tw.Stop()\n\t\t\tw = establishWatch()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9c3a6660672e43aa630544873fb6a7fc", "score": "0.51521325", "text": "func (broker *ServiceBroker) applyServiceConfig(svc *service.Service) {\n\tif bkrConfig, exists := broker.config.Services[svc.Name()]; exists {\n\t\tsvcConfig, ok := bkrConfig.(map[string]interface{})\n\t\tif ok {\n\t\t\t_, ok := svcConfig[\"settings\"]\n\t\t\tif ok {\n\t\t\t\tsettings, ok := svcConfig[\"settings\"].(map[string]interface{})\n\t\t\t\tif ok {\n\t\t\t\t\tsvc.AddSettings(settings)\n\t\t\t\t} else {\n\t\t\t\t\tbroker.logger.Error(\"Could not add service settings - Error converting the input settings to map[string]interface{} - Invalid format! Service Config : \", svcConfig)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t_, ok = svcConfig[\"metadata\"]\n\t\t\tif ok {\n\t\t\t\tmetadata, ok := svcConfig[\"metadata\"].(map[string]interface{})\n\t\t\t\tif ok {\n\t\t\t\t\tsvc.AddSettings(metadata)\n\t\t\t\t} else {\n\t\t\t\t\tbroker.logger.Error(\"Could not add service metadata - Error converting the input metadata to map[string]interface{} - Invalid format! Service Config : \", svcConfig)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tbroker.logger.Error(\"Could not apply service configuration - Error converting the service config to map[string]interface{} - Invalid format! Broker Config : \", bkrConfig)\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "d03351a625c88a7d834156e726ff2fed", "score": "0.5150076", "text": "func (m *Monitor) Configure(conf *Config) error {\n\tvar services []string\n\tfor _, service := range conf.Services {\n\t\tservices = append(services, strings.Trim(service, \" \"))\n\t}\n\tserviceStates := []string{subState}\n\tif conf.SendActiveState {\n\t\tserviceStates = append(serviceStates, activeState)\n\t}\n\tif conf.SendLoadState {\n\t\tserviceStates = append(serviceStates, loadState)\n\t}\n\tconf.pyConf = &python.Config{\n\t\tMonitorConfig: conf.MonitorConfig,\n\t\tModuleName: \"collectd_systemd\",\n\t\tModulePaths: []string{collectd.MakePythonPluginPath(\"systemd\")},\n\t\tTypesDBPaths: []string{collectd.DefaultTypesDBPath()},\n\t\tPluginConfig: map[string]interface{}{\n\t\t\t\"Service\": services,\n\t\t\t\"Interval\": conf.IntervalSeconds,\n\t\t\t\"Verbose\": false,\n\t\t\t\"ServiceStates\": serviceStates,\n\t\t},\n\t}\n\treturn m.PyMonitor.Configure(conf)\n}", "title": "" }, { "docid": "4823c245a162ec7170ab7d210745a499", "score": "0.51483685", "text": "func (s *Service) Run() error {\n\tcErr := s.Configuration.Validate()\n\tif cErr != nil {\n\t\tlog.Fatal().Str(\"err\", cErr.DebugReport()).Msg(\"invalid configuration\")\n\t}\n\ts.Configuration.Print()\n\tclients, cErr := s.GetClients()\n\tif cErr != nil {\n\t\tlog.Fatal().Str(\"err\", cErr.DebugReport()).Msg(\"Cannot create clients\")\n\t\treturn cErr\n\t}\n\n\tlis, err := net.Listen(\"tcp\", fmt.Sprintf(\":%d\", s.Configuration.Port))\n\tif err != nil {\n\t\tlog.Fatal().Errs(\"failed to listen: %v\", []error{err})\n\t\treturn err\n\t}\n\n\t// Create a bus manager\n\tlog.Info().Msg(\"instantiate bus manager...\")\n\tqueueClient := pulsar_comcast.NewClient(s.Configuration.QueueAddress, nil)\n\n\tbusManager, err := bus.NewBusManager(queueClient, \"InfrastructureManager\")\n\tif err != nil {\n\t\tlog.Panic().Err(err).Msg(\"impossible to create bus manager instance\")\n\t\treturn err\n\t}\n\tlog.Info().Msg(\"done\")\n\n\t// Create handlers\n\tmanager := infrastructure.NewManager(\n\t\ts.Configuration.TempDir,\n\t\tclients.ClusterClient, clients.NodesClient, clients.InstallerClient,\n\t\tclients.ProvisionerClient, clients.ScalerClient, clients.ManagementClient,\n\t\tclients.DecommissionClient, clients.AppClient, busManager)\n\thandler := infrastructure.NewHandler(manager)\n\n\tgrpc_infrastructure_manager_go.RegisterInfrastructureManagerServer(s.Server, handler)\n\n\tif s.Configuration.Debug {\n\t\tlog.Info().Msg(\"Enabling gRPC server reflection\")\n\t\t// Register reflection service on gRPC server.\n\t\treflection.Register(s.Server)\n\t}\n\n\tlog.Info().Int(\"port\", s.Configuration.Port).Msg(\"Launching gRPC server\")\n\tif err := s.Server.Serve(lis); err != nil {\n\t\tlog.Fatal().Errs(\"failed to serve: %v\", []error{err})\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b028c8a373228ccd9eeb31d3266c1d82", "score": "0.5140546", "text": "func (m *ControllerSystemd) WriteConfig(s *service.Service) (bool, error) {\n\tvar isChange = false\n\tfileName := fmt.Sprintf(\"%s/%s.service\", m.SysConfigDir, s.Name)\n\tcontent := ToConfig(s)\n\tcontent = m.manager.InjectConfig(content)\n\tif content == \"\" {\n\t\terr := fmt.Errorf(\"can not generate config for service %s\", s.Name)\n\t\tlogrus.Error(err)\n\t\treturn isChange, err\n\t}\n\tif old, err := ioutil.ReadFile(fileName); err == nil && old != nil {\n\t\tif string(old) != content {\n\t\t\tisChange = true\n\t\t} else {\n\t\t\treturn isChange, nil\n\t\t}\n\t}\n\tif err := ioutil.WriteFile(fileName, []byte(content), 0644); err != nil {\n\t\tlogrus.Errorf(\"Generate config file %s: %v\", fileName, err)\n\t\treturn isChange, err\n\t}\n\tlogrus.Info(\"Reload config for systemd by daemon-reload.\")\n\terr := m.run(\"daemon-reload\")\n\tif err != nil {\n\t\tlogrus.Errorf(\"Reload config by systemd daemon-reload for %s: %v \", s.Name, err)\n\t\treturn isChange, err\n\t}\n\treturn isChange, nil\n}", "title": "" }, { "docid": "7f1fb1d94ee94e2ea1b5bbef9ba7aed2", "score": "0.51372933", "text": "func loadConfig(file string) (*config.ServiceConfig, error) {\n\tcfg := &config.ServiceConfig{}\n\terr := toolscfg.LoadConfigAs(file, cfg)\n\n\treturn cfg, err\n}", "title": "" }, { "docid": "573886d6f9038e94891fcc7a66f4e918", "score": "0.5129907", "text": "func Run(s *options.CMServer) error {\n\tif c, err := configz.New(\"componentconfig\"); err == nil {\n\t\tc.Set(s.KubeControllerManagerConfiguration)\n\t} else {\n\t\tglog.Errorf(\"unable to register configz: %s\", err)\n\t}\n\tkubeconfig, err := clientcmd.BuildConfigFromFlags(s.Master, s.Kubeconfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Override kubeconfig qps/burst settings from flags\n\tkubeconfig.QPS = s.KubeAPIQPS\n\tkubeconfig.Burst = s.KubeAPIBurst\n\n\tkubeClient, err := client.New(kubeconfig)\n\tif err != nil {\n\t\tglog.Fatalf(\"Invalid API configuration: %v\", err)\n\t}\n\n\tgo func() {\n\t\tmux := http.NewServeMux()\n\t\thealthz.InstallHandler(mux)\n\t\tif s.EnableProfiling {\n\t\t\tmux.HandleFunc(\"/debug/pprof/\", pprof.Index)\n\t\t\tmux.HandleFunc(\"/debug/pprof/profile\", pprof.Profile)\n\t\t\tmux.HandleFunc(\"/debug/pprof/symbol\", pprof.Symbol)\n\t\t}\n\t\tmux.Handle(\"/metrics\", prometheus.Handler())\n\n\t\tserver := &http.Server{\n\t\t\tAddr: net.JoinHostPort(s.Address, strconv.Itoa(s.Port)),\n\t\t\tHandler: mux,\n\t\t}\n\t\tglog.Fatal(server.ListenAndServe())\n\t}()\n\n\trun := func(stop <-chan struct{}) {\n\t\terr := StartControllers(s, kubeClient, kubeconfig, stop)\n\t\tglog.Fatalf(\"error running controllers: %v\", err)\n\t\tpanic(\"unreachable\")\n\t}\n\n\tif !s.LeaderElection.LeaderElect {\n\t\trun(nil)\n\t\tpanic(\"unreachable\")\n\t}\n\n\teventBroadcaster := record.NewBroadcaster()\n\teventBroadcaster.StartLogging(glog.Infof)\n\teventBroadcaster.StartRecordingToSink(kubeClient.Events(\"\"))\n\trecorder := eventBroadcaster.NewRecorder(api.EventSource{Component: \"controller-manager\"})\n\n\tid, err := os.Hostname()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tleaderelection.RunOrDie(leaderelection.LeaderElectionConfig{\n\t\tEndpointsMeta: api.ObjectMeta{\n\t\t\tNamespace: \"kube-system\",\n\t\t\tName: \"kube-controller-manager\",\n\t\t},\n\t\tClient: kubeClient,\n\t\tIdentity: id,\n\t\tEventRecorder: recorder,\n\t\tLeaseDuration: s.LeaderElection.LeaseDuration.Duration,\n\t\tRenewDeadline: s.LeaderElection.RenewDeadline.Duration,\n\t\tRetryPeriod: s.LeaderElection.RetryPeriod.Duration,\n\t\tCallbacks: leaderelection.LeaderCallbacks{\n\t\t\tOnStartedLeading: run,\n\t\t\tOnStoppedLeading: func() {\n\t\t\t\tglog.Fatalf(\"leaderelection lost\")\n\t\t\t},\n\t\t},\n\t})\n\tpanic(\"unreachable\")\n}", "title": "" }, { "docid": "ad0c919e97ee362680152de7e6507aca", "score": "0.51273745", "text": "func (p *MerakiPoller) Run() {\n\tlogp.Info(\"%+v\", p.config)\n\t// Publish Network Connection Event\n\tif p.config.NwConnStat != 0 {\n\t\tfor _, netID := range p.config.MerakiNetworkIDs {\n\t\t\tmapStr, err := p.mc.GetNetworkConnectionStat(netID)\n\t\t\tif err == nil {\n\t\t\t\tevent := beat.Event{\n\t\t\t\t\tTimestamp: time.Now(),\n\t\t\t\t\tFields: mapStr,\n\t\t\t\t}\n\t\t\t\tp.merakibeat.client.Publish(event)\n\t\t\t\tlogp.Info(\"Network Connection Stat event sent\")\n\t\t\t}\n\t\t}\n\t}\n\n\t// Publish Network Latency Event\n\tif p.config.NwLatencyStat != 0 {\n\t\tfor _, netID := range p.config.MerakiNetworkIDs {\n\t\t\tmapStr, err := p.mc.GetNetworkLatencyStat(netID)\n\t\t\tif err == nil {\n\t\t\t\tevent := beat.Event{\n\t\t\t\t\tTimestamp: time.Now(),\n\t\t\t\t\tFields: mapStr,\n\t\t\t\t}\n\t\t\t\tp.merakibeat.client.Publish(event)\n\t\t\t\tlogp.Info(\"Network Connection Stat event sent\")\n\t\t\t}\n\t\t}\n\t}\n\n\t// Publish devices network stats for configured network\n\tif p.config.DeviceConnStat != 0 {\n\t\tfor _, netID := range p.config.MerakiNetworkIDs {\n\t\t\tmapStrArr, err := p.mc.GetDevicesConnectionStat(netID)\n\t\t\tif err == nil {\n\t\t\t\tfor j, mapStr := range mapStrArr {\n\t\t\t\t\tevent := beat.Event{\n\t\t\t\t\t\tTimestamp: time.Now(),\n\t\t\t\t\t\tFields: mapStr,\n\t\t\t\t\t}\n\t\t\t\t\tp.merakibeat.client.Publish(event)\n\t\t\t\t\tlogp.Info(\"Device network connection Stat event sent %d\", j)\n\t\t\t\t}\n\t\t\t\tlogp.Info(\"Device network connection Stat event sent\")\n\n\t\t\t}\n\t\t}\n\t}\n\n\t// Publish devices latency stats for configured network\n\tif p.config.DeviceLatencyStat != 0 {\n\t\tfor _, netID := range p.config.MerakiNetworkIDs {\n\t\t\tmapStrArr, err := p.mc.GetDevicesLatencyStat(netID)\n\t\t\tif err == nil {\n\t\t\t\tfor j, mapStr := range mapStrArr {\n\t\t\t\t\tevent := beat.Event{\n\t\t\t\t\t\tTimestamp: time.Now(),\n\t\t\t\t\t\tFields: mapStr,\n\t\t\t\t\t}\n\t\t\t\t\tp.merakibeat.client.Publish(event)\n\t\t\t\t\tlogp.Info(\"Device network latency Stat event sent %d\", j)\n\t\t\t\t}\n\t\t\t\tlogp.Info(\"Device network latency Stat event sent\")\n\t\t\t}\n\t\t}\n\t}\n\n\t// Publish client network stats for configured network\n\tif p.config.ClientConnStat != 0 {\n\t\tfor _, netID := range p.config.MerakiNetworkIDs {\n\t\t\tmapStrArr, err := p.mc.GetClientConnectionStat(netID)\n\t\t\tif err == nil {\n\t\t\t\tfor j, mapStr := range mapStrArr {\n\t\t\t\t\tevent := beat.Event{\n\t\t\t\t\t\tTimestamp: time.Now(),\n\t\t\t\t\t\tFields: mapStr,\n\t\t\t\t\t}\n\t\t\t\t\tp.merakibeat.client.Publish(event)\n\t\t\t\t\tlogp.Info(\"Client network connection Stat event sent %d\", j)\n\t\t\t\t}\n\t\t\t\tlogp.Info(\"Client network connection Stat event sent\")\n\n\t\t\t}\n\t\t}\n\t}\n\n\t// Publish client latency stats for configured network\n\tif p.config.ClientLatencyStat != 0 {\n\t\tfor _, netID := range p.config.MerakiNetworkIDs {\n\t\t\tmapStrArr, err := p.mc.GetClientLatencyStat(netID)\n\t\t\tif err == nil {\n\t\t\t\tfor j, mapStr := range mapStrArr {\n\t\t\t\t\tevent := beat.Event{\n\t\t\t\t\t\tTimestamp: time.Now(),\n\t\t\t\t\t\tFields: mapStr,\n\t\t\t\t\t}\n\t\t\t\t\tp.merakibeat.client.Publish(event)\n\t\t\t\t\tlogp.Info(\"Client network latency Stat event sent %d\", j)\n\t\t\t\t}\n\t\t\t\tlogp.Info(\"Client network latency Stat event sent\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c2313c633b4f0cf1cc251890bfbfa04f", "score": "0.5123407", "text": "func WatchService() {\n\tresultChan := make(chan *result, 1024)\n\tgo watchSender(resultChan)\n\n\tfor range time.Tick(30 * time.Second) {\n\t\tgo watchApple(resultChan)\n\t}\n}", "title": "" }, { "docid": "83b1c5e4a8b0b734e3b89b8d57f46089", "score": "0.5119765", "text": "func New(c *conf.Config) (s *Service) {\n\ts = &Service{\n\t\tc: c,\n\t\tdao: ugcdao.New(c),\n\t\tplayurlDao: playdao.New(c),\n\t\tlicDao: lic.New(c),\n\t\tftpDao: ftp.New(c),\n\t\tarcDao: arcdao.New(c),\n\t\tappDao: appDao.New(c),\n\t\tupDao: updao.New(c),\n\t\tcmsDao: cms.New(c),\n\t\twaiter: new(sync.WaitGroup),\n\t\tarchiveNotifySub: databus.New(c.ArchiveNotifySub),\n\t\tugcSub: databus.New(c.UgcSub),\n\t\tcron: cron.New(),\n\t\tarcTypes: make(map[int32]*arccli.Tp),\n\t\tugcTypesRel: make(map[int32]*conf.UgcType),\n\t\tpgcTypes: make(map[string]int),\n\t\tactiveUps: make(map[int64]int),\n\t\tconsumerLimit: make(chan struct{}, c.UgcSync.Cfg.ThreadLimit),\n\t\tmodArcCh: make(chan []int64, _chanSize),\n\t\taudAidCh: make(chan []int64, _chanSize),\n\t\treshelfAidCh: make(chan int64, _chanSize),\n\t\trepCidCh: make(chan int64, _chanSize),\n\t\tarcRPC: archive.New2(c.ArchiveRPC),\n\t}\n\t// transform cfg to map, in order to filter pgc types archive\n\tvar err error\n\tif s.arcClient, err = arccli.NewClient(c.ArcClient); err != nil {\n\t\tpanic(err)\n\t}\n\tfor _, v := range s.c.Cfg.PgcTypes {\n\t\ts.pgcTypes[v] = 1\n\t}\n\tfor k, v := range s.c.Cfg.UgcZones { // transform cfg map\n\t\ts.ugcTypesRel[atoi(k)] = v\n\t}\n\tif err := s.cron.AddFunc(s.c.Redis.CronUGC, s.ZoneIdx); err != nil { // load Zone Idx & types\n\t\tpanic(err)\n\t}\n\tif err := s.cron.AddFunc(s.c.UgcSync.Frequency.TypesCron, s.loadTypes); err != nil {\n\t\tpanic(err)\n\t}\n\ts.cron.Start()\n\ts.loadTypes() // load types\n\ts.loadTids() // load ugc idx relationship\n\ts.refreshUp(ctx, false) // init upper list\n\tgo s.ZoneIdx()\n\ts.waiter.Add(1)\n\tgo s.syncUpproc() // sync modified uppers' info to license owner\n\tgo s.refreshUpproc() // refresh upper info\n\ts.waiter.Add(1)\n\tgo s.manualproc() // manual import videos\n\ts.waiter.Add(1)\n\tgo s.upImportproc() // import upper history data\n\tgo s.fullRefreshproc() // full refrsh video data\n\ts.waiter.Add(1)\n\tgo s.modArcproc() // sync modified archive data\n\ts.waiter.Add(1)\n\tgo s.delArcproc() // sync deleted archive data\n\ts.waiter.Add(1)\n\tgo s.delVideoproc() // sync deleted video data\n\ts.waiter.Add(1)\n\tgo s.delUpproc() // treat deleted uppers\n\tgo s.seaUgcContproc() // uploads ugc search content to sug's FTP\n\ts.waiter.Add(1)\n\tgo s.arcConsumeproc() // archive Notify-T databus\n\ts.waiter.Add(1)\n\tgo s.consumeVideo() // consume video databus, report cid info\n\ts.waiter.Add(1)\n\tgo s.repCidproc() // consume channel and report cid to playurl\n\ts.waiter.Add(1)\n\tgo s.audCidproc() // consume audit aid data\n\ts.waiter.Add(1)\n\tgo s.reshelfArcproc() // reshelf the cms invalid arcs when they have at least one video that can play now\n\treturn\n}", "title": "" }, { "docid": "faff5d374521abc852199676f5a0e3ec", "score": "0.51097554", "text": "func initService(lookup environment.Environmenter) (func(context.Context) error, error) {\n\tvar backgroundTasks []func(context.Context, func(error))\n\tlistenAddr := \":\" + envICCServicePort.Value(lookup)\n\n\t// Redis as message bus for datastore and logout events.\n\tmessageBus := messageBusRedis.New(lookup)\n\n\t// Datastore Service.\n\tdatabase, err := applause.Flow(lookup, messageBus)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"init database: %w\", err)\n\t}\n\n\t// Auth Service.\n\tauthService, authBackground, err := auth.New(lookup, messageBus)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"init auth system: %w\", err)\n\t}\n\tbackgroundTasks = append(backgroundTasks, authBackground)\n\n\tbackend := redis.New(envICCRedisHost.Value(lookup) + \":\" + envICCRedisPort.Value(lookup))\n\n\tnotifyService, notifyBackground := notify.New(backend)\n\tbackgroundTasks = append(backgroundTasks, notifyBackground)\n\n\tapplauseService, applauseBackground := applause.New(backend, database)\n\tbackgroundTasks = append(backgroundTasks, applauseBackground)\n\n\tservice := func(ctx context.Context) error {\n\t\tgo database.Update(ctx, nil)\n\n\t\tfor _, bg := range backgroundTasks {\n\t\t\tgo bg(ctx, handleError)\n\t\t}\n\n\t\t// Start http server.\n\t\tfmt.Printf(\"Listen on %s\\n\", listenAddr)\n\t\treturn Run(ctx, listenAddr, notifyService, applauseService, authService)\n\t}\n\n\treturn service, nil\n}", "title": "" }, { "docid": "f6d3034968d9b6cce4c173e44fe0d49a", "score": "0.5109699", "text": "func (dtas *DocTransServer) RegisterAtRegistry(hostname, app, ipAddress, port, dtaType string, ttl uint, isSsl bool) {\n\n\t// Build Eureka Configuration\n\tdtas.registrar = eureka.NewClient([]string{\n\t\tdtas.RegistrarURL,\n\t\t// add others servers here\n\t})\n\tdtas.registrar.CheckRetry = eureka.ExpBackOffCheckRetry\n\t// Create the app instance\n\tdtas.instanceInfo = eureka.NewInstanceInfo(hostname, app, ipAddress, port, ttl, isSsl) //Create a new instance to register\n\t// Add some meta data. Currently no meaning\n\t// TODO: Remove this playground if not further required\n\tdtas.instanceInfo.Metadata = &eureka.MetaData{\n\t\tMap: make(map[string]string),\n\t}\n\tdtas.instanceInfo.Metadata.Map[\"DTA-Type\"] = dtaType //one of Gateway, Service\n\t// Register instance and heartbeat for Eureka\n\tdtas.registrar.RegisterInstance(app, dtas.instanceInfo) // Register new instance in your eureka(s)\n\tlog.WithFields(log.Fields{\"Service\": \"->Registrar\", \"Status\": \"Init\"}).Infof(\"Registering service %s\\n\", app)\n\n\tjob := func() {\n\t\tlog.WithFields(log.Fields{\"Service\": \"->Registrar\", \"Status\": \"Up\"}).Trace(\"sending heartbeat : %v\\n\", time.Now().UTC())\n\t\tdtas.registrar.SendHeartbeat(dtas.instanceInfo.App, dtas.instanceInfo.HostName) // say to eureka that your app is alive (here you must send heartbeat before 30 sec)\n\t}\n\n\t// Run every 25 seconds but not now.\n\t// FIXME:0 We have somehow be able to deregister the heartbeat\n\tdtas.heartBeatJob, _ = scheduler.Every(25).Seconds().NotImmediately().Run(job)\n}", "title": "" }, { "docid": "a046fd98da99f265bb2a4bb9af8d2b56", "score": "0.5108665", "text": "func main() {\n\tservice.Run()\n}", "title": "" }, { "docid": "7e6f25ebf3708b2cd083649061036a1c", "score": "0.5108226", "text": "func (service *Service) Manage() (string, error) {\n\tusage := fmt.Sprintf(\"Usage: %s install | remove | start | stop | status | version\", AppName)\n\n\tif len(os.Args) > 1 {\n\t\tcommand := os.Args[1]\n\t\tswitch command {\n\t\tcase \"install\":\n\t\t\t_, err := service.createConfigFile()\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\treturn service.Install()\n\t\tcase \"remove\":\n\t\t\t_, err := service.removeConfigFile()\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\treturn service.Remove()\n\t\tcase \"start\":\n\t\t\treturn service.Start()\n\t\tcase \"stop\":\n\t\t\treturn service.Stop()\n\t\tcase \"status\":\n\t\t\treturn service.Status()\n\t\tcase \"version\":\n\t\t\treturn fmt.Sprintf(\"%s v%s\", AppName, Version), nil\n\t\tdefault:\n\t\t\treturn usage, nil\n\t\t}\n\t}\n\n\t// Get environment variable in .env\n\terr := godotenv.Load(fmt.Sprintf(\"/etc/%s/%s.env\", AppName, AppName))\n\tif err != nil {\n\t\terrLogger.Fatalln(\"Error loading .env file\", err)\n\t}\n\n\tExpireIntervalStr := os.Getenv(\"SRMT_EXPIRATION_INTERVAL\")\n\tExpireInterval, err = strconv.Atoi(ExpireIntervalStr)\n\tif err != nil {\n\t\terrLogger.Fatalln(\"wrong expiration time value\")\n\t}\n\n\tpoolSizeStr := os.Getenv(\"SRMT_REDIS_POOL_SIZE\")\n\tpoolSize, err := strconv.Atoi(poolSizeStr)\n\tif err != nil {\n\t\terrLogger.Fatalln(\"wrong pool size value\")\n\t}\n\n\t// initialize redis pool to be used in worker\n\tpool = redisPool(os.Getenv(\"SRMT_REDIS_SERVER\"), os.Getenv(\"SRMT_REDIS_PASS\"), poolSize)\n\n\tinterrupt := make(chan os.Signal, 1)\n\tsignal.Notify(interrupt, os.Interrupt, os.Kill, syscall.SIGTERM)\n\n\t// make the job run forever until killed manually\n\tgo func() {\n\t\tfor t := range time.Tick(TheTicker) {\n\t\t\tstdLogger.Println(\"Cooking metrics started\")\n\t\t\tjobs := make([]Job, 6)\n\t\t\tjobs[0] = uptimeJob\n\t\t\tjobs[1] = memoryJob\n\t\t\tjobs[2] = swapJob\n\t\t\tjobs[3] = cpuJob\n\t\t\tjobs[4] = loadAvgJob\n\t\t\tjobs[5] = filesystemJob\n\n\t\t\t// round the time to the closest minute (round down)\n\t\t\troundedTs := roundTheTimestamp(t.Unix(), int64(TheTicker.Seconds()))\n\t\t\t// convert back to time.Time\n\t\t\troundedTime := time.Unix(roundedTs, 0)\n\n\t\t\tfor _, job := range jobs {\n\t\t\t\tgo job(roundedTime)\n\t\t\t}\n\t\t}\n\t}()\n\tstdLogger.Printf(\"%s is ready to cook...\\n\", AppName)\n\n\tkillSignal := <-interrupt\n\tstdLogger.Println(\"Got signal:\", killSignal)\n\tif killSignal == os.Interrupt {\n\t\tstdLogger.Printf(\"%s was interruped by system signal\\n\", AppName)\n\t}\n\n\treturn fmt.Sprintf(\"R.I.P %s\", AppName), nil\n}", "title": "" }, { "docid": "37072722b031e20269217669cdea1c7a", "score": "0.5100599", "text": "func (b *Boondoggle) configureServices(r RawBoondoggle, setStateAll string, serviceState []string) {\n\t// First get the service-state overrides provided by the user in a way that we can work with.\n\tserviceStates := getServiceStatesMap(serviceState)\n\t// For each of the services on RawBoondoggle...\n\tfor _, rawService := range r.Services {\n\t\tvar chosenStateKey int\n\t\tvar err error\n\n\t\t// If the set-state-all flag was not set, set service states with default logic.\n\t\toverrideServiceState := setStateAll\n\t\tif overrideServiceState == \"\" {\n\t\t\tif serviceStates[rawService.Name] != \"\" {\n\t\t\t\t// if we have a override in the serviceStates, get the state values based on that name.\n\t\t\t\tchosenStateKey, err = getRawStateKeyByName(rawService.Name, serviceStates[rawService.Name], r)\n\t\t\t} else {\n\t\t\t\t// if not, find the default\n\t\t\t\tchosenStateKey, err = getRawStateKeyByName(rawService.Name, \"default\", r)\n\t\t\t}\n\t\t} else {\n\t\t\tchosenStateKey, err = getRawStateKeyByName(rawService.Name, overrideServiceState, r)\n\t\t}\n\n\t\tif err != nil {\n\t\t\t// indicates there was not a match for the given service and state-name\n\t\t\tb.L.Print(err)\n\t\t} else {\n\t\t\t// build the service from the selected state\n\t\t\tvar completeService = Service{\n\t\t\t\tName: rawService.Name,\n\t\t\t\tPath: rawService.Path,\n\t\t\t\tGitrepo: rawService.Gitrepo,\n\t\t\t\tAlias: rawService.Alias,\n\t\t\t\tChart: rawService.Chart,\n\t\t\t\tContainerBuild: b.escapableEnvVarReplace(rawService.States[chosenStateKey].ContainerBuild),\n\t\t\t\tRepository: rawService.States[chosenStateKey].Repository,\n\t\t\t\tHelmValues: b.escapableEnvVarReplaceSlice(rawService.States[chosenStateKey].HelmValues),\n\t\t\t\tVersion: rawService.States[chosenStateKey].Version,\n\t\t\t\tCondition: rawService.States[chosenStateKey].Condition,\n\t\t\t\tTags: rawService.States[chosenStateKey].Tags,\n\t\t\t\tEnabled: rawService.States[chosenStateKey].Enabled,\n\t\t\t\tImportvalues: rawService.States[chosenStateKey].Importvalues,\n\t\t\t}\n\t\t\t// add the dep-values-all-states if the originals are empty\n\t\t\tif completeService.Condition == \"\" {\n\t\t\t\tcompleteService.Condition = rawService.DepValuesAllStates.Condition\n\t\t\t}\n\t\t\tif len(completeService.Tags) < 1 {\n\t\t\t\tcompleteService.Tags = rawService.DepValuesAllStates.Tags\n\t\t\t}\n\t\t\tif !completeService.Enabled {\n\t\t\t\tcompleteService.Enabled = rawService.DepValuesAllStates.Enabled\n\t\t\t}\n\t\t\tif completeService.Importvalues == nil {\n\t\t\t\tcompleteService.Importvalues = rawService.DepValuesAllStates.Importvalues\n\t\t\t}\n\n\t\t\t// Add the pre and post steps\n\t\t\tif len(rawService.States[chosenStateKey].PreDeploySteps) > 0 {\n\t\t\t\tfor _, val := range rawService.States[chosenStateKey].PreDeploySteps {\n\t\t\t\t\tcompleteService.PreDeploySteps = append(completeService.PreDeploySteps, Step{\n\t\t\t\t\t\tCmd: val.Cmd,\n\t\t\t\t\t\tArgs: b.escapableEnvVarReplaceSlice(val.Args),\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif len(rawService.States[chosenStateKey].PostDeploySteps) > 0 {\n\t\t\t\tfor _, val := range rawService.States[chosenStateKey].PostDeploySteps {\n\t\t\t\t\tcompleteService.PostDeploySteps = append(completeService.PostDeploySteps, Step{\n\t\t\t\t\t\tCmd: val.Cmd,\n\t\t\t\t\t\tArgs: b.escapableEnvVarReplaceSlice(val.Args),\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif len(rawService.States[chosenStateKey].PostDeployExec) > 0 {\n\t\t\t\tfor _, val := range rawService.States[chosenStateKey].PostDeployExec {\n\t\t\t\t\tcompleteService.PostDeployExec = append(completeService.PostDeployExec, Step{\n\t\t\t\t\t\tApp: val.App,\n\t\t\t\t\t\tContainer: val.Container,\n\t\t\t\t\t\tArgs: b.escapableEnvVarReplaceSlice(val.Args),\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Append to Boondoggle.Services\n\t\t\tb.Services = append(b.Services, completeService)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1b558cbb12e4830f2c3c8021d80416f1", "score": "0.50999033", "text": "func main() {\n\n\tif len(os.Args) > 2 {\n\t\tlog.Fatalf(\"Usage: %s [scanSeconds]\", os.Args[0])\n\t}\n\n\t// where to save the config\n\tconfigDir := f.GetEnvOrDefault(\"CONFIG_DIR\", \"/tmp\")\n\t// which product we want to config for\n\tconfigProduct := f.GetEnvOrDefault(\"CONFIG_PRODUCT\", \"am\")\n\t// The config server address:port\n\tserver := f.GetEnvOrDefault(\"CONFIG_SERVER\", \"localhost:50051\")\n\n\tlog.Printf(\"config_client starting. product: %s, configDir: %s\\n\", configProduct, configDir)\n\n\t// todo: Move to NewFileUtil\n\tif _, err := os.Stat(configDir); os.IsNotExist(err) {\n\t\terr := os.Mkdir(configDir, os.ModePerm)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error creating config directory %s: %v\", configDir, err)\n\t\t}\n\t}\n\n\tlog.Printf(\"Waiting for server connection %s\\n\", server)\n\t// Set up a connection to the server.\n\tconn, err := grpc.Dial(server, grpc.WithInsecure(), grpc.WithBlock(), grpc.WithKeepaliveParams(kacp))\n\tif err != nil {\n\t\tlog.Fatalf(\"could not connect: %v\", err)\n\t}\n\tdefer conn.Close()\n\tc := pb.NewConfigSaverClient(conn)\n\n\tclient := clientCtx{\n\t\tserver: server,\n\t\tconfigDirectory: configDir,\n\t\tfileUtil: f.NewFileUtil(configDir),\n\t\tconn: conn,\n\t\tgrpc: c,\n\t}\n\n\t// If there is only one arg, read the config from the server and exit\n\tif len(os.Args) == 1 {\n\t\tclient.getConfigFromServer(configProduct)\n\t\tos.Exit(0)\n\t}\n\n\t// There is more than org, so we want to iterate looking for changes to send to the server.\n\tscanSeconds, err := strconv.Atoi(os.Args[1])\n\tif err != nil || scanSeconds < 1 || scanSeconds > 120 {\n\t\tlog.Fatalf(\"Invalid scanSeconds: %s. Must be between 1 and 120\", os.Args[2])\n\t}\n\n\tscanDuration := time.Duration(scanSeconds) * time.Second\n\tclient.scanAndSaveToServer(scanDuration, configProduct)\n\n}", "title": "" }, { "docid": "591d9e63d40c2927109f0d413fc929e2", "score": "0.5083733", "text": "func (client *ConsulClient) registerService() {\n\tretry := 0\n\tfor {\n\t\tlogger.Debug(\"register service...\")\n\t\tfor client.currentApiClient == nil {\n\t\t\tclient.switchRegisterServer(false)\n\t\t}\n\t\terr := client.currentApiClient.Agent().ServiceRegister(client.Service)\n\t\tif err != nil {\n\t\t\tlogger.Error(\"error register service[ID:\", client.Service.ID, \", Name:\", client.Service.Name, \"]: \", err)\n\t\t\ttime.Sleep(time.Second * 15)\n\t\t\tretry++\n\t\t\tif retry%3 == 0 {\n\t\t\t\tclient.currentApiClient = nil\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tlogger.Info(\"register service success: \", client.Service.Name)\n\t\tbreak\n\t}\n\tclient.renewLock <- 0\n\tif err := client.loadServices(); err != nil {\n\t\tlogger.Error(\"error get services info: \", err)\n\t}\n}", "title": "" }, { "docid": "14313e8543be5d4bb1a616848f9e554f", "score": "0.5080134", "text": "func rateDistUpdateConfigWorker() {\n\tgo func() {\n\t\tfor {\n\t\t\ttime.Sleep(time.Minute)\n\t\t\trateDistUpdateConfig(\"custommw/rateSample.json\")\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "9ceacc36ca6db35a0810cafd604abf75", "score": "0.5066477", "text": "func main() {\n\tapp := Update()\n\n\tlog.SetPrefix(term.Yellow(\"[\" + app.AppletName + \"] \"))\n\tlog.Println(term.Green(\"Applet started\"))\n\tdefer log.Println(term.Yellow(\"Applet stopped\"))\n\n\t// Start main loop and wait for events. Until the End signal is received from the dock.\n\tticker, restart := app.poller.NewTicker()\n\tfor { // Main loop, waiting for events.\n\t\tselect {\n\t\tcase <-app.Close: // That's all folks.\n\t\t\treturn\n\n\t\t// not triggered yet.\n\t\tcase <-restart: // Want to recheck now ?\n\t\t\tlog.Println(term.Yellow(\"timer restart\"))\n\t\t\tticker, restart = app.poller.NewTicker()\n\n\t\tcase <-ticker.C: // It's time to work !\n\t\t\t//~ log.Println(term.Yellow(\"timer\"))\n\t\t\tapp.poller.Check()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ef09f608695e408a8ee3674dea1ab5a0", "score": "0.50573915", "text": "func (c *CoreV1Client) run() {\n\tgo func(c *CoreV1Client) {\n\t\tmember := c.configs.WatchUpdate()\n\t\twatcherForUpdateComplete := apiserverupdate.GetClientSetsWatcher()\n\t\twatcherForUpdateComplete.AddWatcher()\n\n\t\tfor range member.Read {\n\t\t\t// create new client\n\t\t\tclients := make([]rest.Interface, len(c.configs.GetAllConfigs()))\n\t\t\tfor i, config := range c.configs.GetAllConfigs() {\n\t\t\t\tclient, err := rest.RESTClientFor(config)\n\t\t\t\tif err != nil {\n\t\t\t\t\tklog.Fatalf(\"Cannot create rest client for [%+v], err %v\", config, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tclients[i] = client\n\t\t\t}\n\t\t\tc.mux.Lock()\n\t\t\tklog.Infof(\"Reset restClients. length %v -> %v\", len(c.restClients), len(clients))\n\t\t\tc.restClients = clients\n\t\t\tc.mux.Unlock()\n\t\t\twatcherForUpdateComplete.NotifyDone()\n\t\t}\n\t}(c)\n}", "title": "" }, { "docid": "f67f0298db972527ad650fbade089a17", "score": "0.5057342", "text": "func (s *Service) Run(args []string) int {\n\n\ts.loadConfig()\n\ts.startService()\n\n\treturn s.sigWait()\n}", "title": "" }, { "docid": "71562497c2628f52753e915ba3753d0b", "score": "0.50520414", "text": "func populateServiceRegistryAddress() {\n\t//Registry Address , higher priority for environment variable\n\tregistryAddrFromEnv := readCseAddress(common.EnvCSESCEndpoint, common.CseRegistryAddress)\n\topenlogging.Debug(\"detect env\", openlogging.WithTags(\n\t\topenlogging.Tags{\n\t\t\t\"ep\": registryAddrFromEnv,\n\t\t}))\n\tif registryAddrFromEnv != \"\" {\n\t\tGlobalDefinition.Cse.Service.Registry.Registrator.Address = registryAddrFromEnv\n\t\tGlobalDefinition.Cse.Service.Registry.ServiceDiscovery.Address = registryAddrFromEnv\n\t\tGlobalDefinition.Cse.Service.Registry.ContractDiscovery.Address = registryAddrFromEnv\n\t\tGlobalDefinition.Cse.Service.Registry.Address = registryAddrFromEnv\n\t}\n}", "title": "" }, { "docid": "1f5e524d5e6db3cd8a1ec6a0a1c62dfe", "score": "0.5048254", "text": "func (m *ControllerSystemd) InitStart(services []*service.Service) error {\n\tfor _, s := range services {\n\t\tif s.IsInitStart && !s.Disable && !s.OnlyHealthCheck {\n\t\t\tfileName := fmt.Sprintf(\"/etc/systemd/system/%s.service\", s.Name)\n\t\t\t//init start can not read cluster endpoint.\n\t\t\t//so do not change the configuration file as much as possible\n\t\t\t_, err := os.Open(fileName)\n\t\t\tif err != nil && os.IsNotExist(err) {\n\t\t\t\tcontent := ToConfig(s)\n\t\t\t\tif content == \"\" {\n\t\t\t\t\terr := fmt.Errorf(\"can not generate config for service %s\", s.Name)\n\t\t\t\t\tfmt.Println(err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\t//init service start before etcd ready. so it can not set\n\t\t\t\t//content = m.manager.InjectConfig(content)\n\t\t\t\tif err := ioutil.WriteFile(fileName, []byte(content), 0644); err != nil {\n\t\t\t\t\tfmt.Printf(\"Generate config file %s: %v\", fileName, err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := m.run(\"start\", s.Name); err != nil {\n\t\t\t\treturn fmt.Errorf(\"systemctl start %s error:%s\", s.Name, err.Error())\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "14ca2a51f6dddca9836cadc3a09f8aed", "score": "0.50444645", "text": "func (c *updateConfigCmd) Run(k *kong.Context) error { // nolint:gocyclo\n\tkube := typedclient.NewForConfigOrDie(ctrl.GetConfigOrDie())\n\tprevConf, err := kube.Configurations().Get(context.Background(), c.Name, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn errors.Wrap(warnIfNotFound(err), \"cannot update configuration\")\n\t}\n\tpkg := prevConf.Spec.Package\n\tpkgReference, err := name.ParseReference(pkg, name.WithDefaultRegistry(\"\"))\n\tif err != nil {\n\t\treturn errors.Wrap(warnIfNotFound(err), \"cannot update configuration\")\n\t}\n\tnewPkg := \"\"\n\tif strings.HasPrefix(c.Tag, \"sha256\") {\n\t\tnewPkg = pkgReference.Context().Digest(c.Tag).Name()\n\t} else {\n\t\tnewPkg = pkgReference.Context().Tag(c.Tag).Name()\n\t}\n\tprevConf.Spec.Package = newPkg\n\treq, err := json.Marshal(prevConf)\n\tif err != nil {\n\t\treturn errors.Wrap(warnIfNotFound(err), \"cannot update configuration\")\n\t}\n\tres, err := kube.Configurations().Patch(context.Background(), c.Name, types.MergePatchType, req, metav1.PatchOptions{})\n\tif err != nil {\n\t\treturn errors.Wrap(warnIfNotFound(err), \"cannot update configuration\")\n\t}\n\t_, err = fmt.Fprintf(k.Stdout, \"%s/%s updated\\n\", strings.ToLower(v1.ConfigurationGroupKind), res.GetName())\n\treturn err\n}", "title": "" }, { "docid": "edf5b0ce29d3fd76d00cadb8db23d197", "score": "0.50440866", "text": "func (app *App) configure() error {\n\tcfg, err := ReadConfig(app.ConfigFilename)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// carbon-cache prefix\n\tif hostname, err := os.Hostname(); err == nil {\n\t\thostname = strings.Replace(hostname, \".\", \"_\", -1)\n\t\tcfg.Common.MetricPrefix = strings.Replace(cfg.Common.MetricPrefix, \"{host}\", hostname, -1)\n\t} else {\n\t\tcfg.Common.MetricPrefix = strings.Replace(cfg.Common.MetricPrefix, \"{host}\", \"localhost\", -1)\n\t}\n\n\tif cfg.Common.MetricEndpoint == \"\" {\n\t\tcfg.Common.MetricEndpoint = MetricEndpointLocal\n\t}\n\n\tif cfg.Common.MetricEndpoint != MetricEndpointLocal {\n\t\tu, err := url.Parse(cfg.Common.MetricEndpoint)\n\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"common.metric-endpoint parse error: %s\", err.Error())\n\t\t}\n\n\t\tif u.Scheme != \"tcp\" && u.Scheme != \"udp\" {\n\t\t\treturn fmt.Errorf(\"common.metric-endpoint supports only tcp and udp protocols. %#v is unsupported\", u.Scheme)\n\t\t}\n\t}\n\n\tapp.Config = cfg\n\n\treturn nil\n}", "title": "" }, { "docid": "87a3a17769856ca195b8f6387dc4d054", "score": "0.5030959", "text": "func (h *ConfigHandler) syncConfigSetList() {\n\t// don't wait here at first time.\n\tisFirstTime := true\n\n\tticker := time.NewTicker(h.viper.GetDuration(\"sidecar.syncConfigsetListInterval\"))\n\tdefer ticker.Stop()\n\n\tfor {\n\t\tif h.viper.GetBool(fmt.Sprintf(\"appmod.%s.stop\", ModKey(h.businessName, h.appName, h.path))) {\n\t\t\tlogger.Info(\"ConfigHandler[%s %s %s]| stop syncing configset list now!\", h.businessName, h.appName, h.path)\n\t\t\treturn\n\t\t}\n\n\t\tif !isFirstTime {\n\t\t\t<-ticker.C\n\t\t} else {\n\t\t\tcommon.DelayRandomMS(1000)\n\t\t}\n\n\t\t// pull configset list from connserver.\n\t\tcfgsetids, err := h.pullConfigSetList()\n\t\tif err != nil {\n\t\t\tlogger.Error(\"ConfigHandler[%s %s %s]| syncConfigSetList, sync configset list, %+v\", h.businessName, h.appName, h.path, err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// update local pullers.\n\t\th.mu.Lock()\n\t\tnewCfgsetids := make(map[string]string)\n\t\tfor _, cfgsetid := range cfgsetids {\n\t\t\tif v, ok := h.pullers[cfgsetid]; !ok || v == nil {\n\t\t\t\tnewPuller := NewPuller(h.viper, h.businessName, h.appName, h.path, cfgsetid, h.effectCache, h.contentCache)\n\t\t\t\th.pullers[cfgsetid] = newPuller\n\t\t\t\tnewPuller.Run()\n\t\t\t}\n\t\t\tnewCfgsetids[cfgsetid] = cfgsetid\n\t\t}\n\n\t\tfor cfgsetid, puller := range h.pullers {\n\t\t\tif _, ok := newCfgsetids[cfgsetid]; !ok {\n\t\t\t\tpuller.Stop()\n\t\t\t}\n\t\t}\n\t\th.mu.Unlock()\n\t\tlogger.Warn(\"ConfigHandler[%s %s %s]| syncConfigSetList, sync configset list success, %+v\", h.businessName, h.appName, h.path, cfgsetids)\n\n\t\t// handle instance start first reload notification.\n\t\tif isFirstTime {\n\t\t\tgo h.handleFirstReload()\n\t\t}\n\t\tisFirstTime = false\n\t}\n}", "title": "" }, { "docid": "a52429c8d2bfb0a9d829067561cdc643", "score": "0.5028641", "text": "func (s *ksServer) autoConfigureApp(kfApp *kApp.App, appConfig *AppConfig, namespace string, config *rest.Config) error {\n\n\tkubeClient, err := clientset.NewForConfig(rest.AddUserAgent(config, \"kubeflow-bootstrapper\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclusterVersion, err := kubeClient.DiscoveryClient.ServerVersion()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Infof(\"Cluster version: %v\", clusterVersion.String())\n\terr = setupNamespace(kubeClient.CoreV1().Namespaces(), namespace)\n\n\tstorage := kubeClient.StorageV1()\n\tsClasses, err := storage.StorageClasses().List(meta_v1.ListOptions{})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thasDefault := hasDefaultStorage(sClasses)\n\n\t// Component customization\n\t// TODO(jlewi): We depend on the original appConfig in order to optimize it.\n\t// Could we avoid this dependency by looking at an existing app and seeing\n\t// which components correspond to which prototypes? Would we have to parse\n\t// the actual jsonnet files?\n\tfor _, component := range appConfig.Components {\t\t\n\t\tif component.Prototype == JUPYTER_PROTOTYPE {\n\t\t\tpvcMount := \"\"\n\t\t\tif hasDefault {\n\t\t\t\tpvcMount = \"/home/jovyan\"\n\t\t\t}\n\n\t\t\terr = actions.RunParamSet(map[string]interface{}{\n\t\t\t\tactions.OptionApp: *kfApp,\n\t\t\t\tactions.OptionName: component.Name,\n\t\t\t\tactions.OptionPath: \"jupyterNotebookPVCMount\",\n\t\t\t\tactions.OptionValue: pvcMount,\n\t\t\t})\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "01f91d99775dc2ba6c6244f988cf3594", "score": "0.50251824", "text": "func Generate_secret_config(clientset *kubernetes.Clientset) {\n\t\t// Loop through all the namespaces and get the list of services\n\t\n\tsecret, err := clientset.CoreV1().Secrets(\"default\").List(context.TODO(), metav1.ListOptions{})\n\tif err != nil {\n\t\tfmt.Printf(\"Could not read kubernetes SVC using cluster client: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n \n for _, item := range secret.Items {\n \tfmt.Println(item.ObjectMeta.Name)\t\n }\t\n \n // Remove default secret from each namespace\n for i, item := range secret.Items {\n \tif strings.Contains(item.ObjectMeta.Name, \"default-token-\") {\n \t\tsecret.Items = append(secret.Items[:i], secret.Items[i+1:]...)\n \t\tbreak\n \t}\n }\n \n fmt.Println()\n // append list of services in this namespace to glabal services list\n\tfor _, item := range secret.Items {\n \tfmt.Println(item.ObjectMeta.Name)\t\n }\n}", "title": "" }, { "docid": "f6657c90d06908885a05d57561d29f56", "score": "0.5022502", "text": "func TestConfigService_Update(t *testing.T) {\n\tt.Run(\"should update existing config\", func(t *testing.T) {\n\t\tts := createTestServices()\n\t\tcfg := testCfg\n\t\tch := make(<-chan scrape.Result)\n\n\t\tts.db.On(\"Update\", cfg).\n\t\t\tReturn(cfg, nil).\n\t\t\tOnce()\n\n\t\tts.scraperManager.\n\t\t\tOn(\"Update\", cfg.Name, cfg.URL, testScrapingInterval).\n\t\t\tReturn(ch, nil).\n\t\t\tOnce()\n\n\t\tts.metricService.On(\"Consume\", cfg.Name, ch).Return()\n\n\t\terr := ts.cfgService.Update(cfg)\n\n\t\tassert.NoError(t, err)\n\t\tts.scraperManager.AssertExpectations(t)\n\t\tts.db.AssertExpectations(t)\n\t\t// no assert for metric service since the Consume operation is async:\n\t\t// the test might end sooner than the goroutine is run.\n\t\t// ts.metricService.AssertExpectations(t)\n\t})\n}", "title": "" }, { "docid": "3a0b1d89e4f78a91fd714f219668c509", "score": "0.50114125", "text": "func NewService() (*Service, error) {\n\trefreshInterval := config.Datadog.GetDuration(\"remote_configuration.refresh_interval\")\n\tif refreshInterval < minimalRefreshInterval {\n\t\tlog.Warnf(\"remote_configuration.refresh_interval is set to %v which is bellow the minimum of %v\", refreshInterval, minimalRefreshInterval)\n\t\trefreshInterval = minimalRefreshInterval\n\t}\n\n\tmaxBackoffTime := config.Datadog.GetDuration(\"remote_configuration.max_backoff_interval\")\n\tif maxBackoffTime < minimalMaxBackoffTime {\n\t\tlog.Warnf(\"remote_configuration.max_backoff_time is set to %v which is below the minimum of %v - setting value to %v\", maxBackoffTime, minimalMaxBackoffTime, minimalMaxBackoffTime)\n\t\tmaxBackoffTime = minimalMaxBackoffTime\n\t} else if maxBackoffTime > maximalMaxBackoffTime {\n\t\tlog.Warnf(\"remote_configuration.max_backoff_time is set to %v which is above the maximum of %v - setting value to %v\", maxBackoffTime, maximalMaxBackoffTime, maximalMaxBackoffTime)\n\t\tmaxBackoffTime = maximalMaxBackoffTime\n\t}\n\n\t// A backoff is calculated as a range from which a random value will be selected. The formula is as follows.\n\t//\n\t// min = baseBackoffTime * 2^<NumErrors> / minBackoffFactor\n\t// max = min(maxBackoffTime, baseBackoffTime * 2 ^<NumErrors>)\n\t//\n\t// The following values mean each range will always be [30*2^<NumErrors-1>, min(maxBackoffTime, 30*2^<NumErrors>)].\n\t// Every success will cause numErrors to shrink by 2.\n\t// This is a sensible default backoff pattern, and there isn't really any need to\n\t// let clients configure this at this time.\n\tminBackoffFactor := 2.0\n\tbaseBackoffTime := 30.0\n\trecoveryInterval := 2\n\trecoveryReset := false\n\n\tbackoffPolicy := backoff.NewPolicy(minBackoffFactor, baseBackoffTime,\n\t\tmaxBackoffTime.Seconds(), recoveryInterval, recoveryReset)\n\n\trawRemoteConfigKey := config.Datadog.GetString(\"remote_configuration.key\")\n\tremoteConfigKey, err := parseRemoteConfigKey(rawRemoteConfigKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tapiKey := config.Datadog.GetString(\"api_key\")\n\tif config.Datadog.IsSet(\"remote_configuration.api_key\") {\n\t\tapiKey = config.Datadog.GetString(\"remote_configuration.api_key\")\n\t}\n\tapiKey = config.SanitizeAPIKey(apiKey)\n\thname, err := hostname.Get(context.Background())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thttp := api.NewHTTPClient(apiKey, remoteConfigKey.AppKey)\n\n\tdbPath := path.Join(config.Datadog.GetString(\"run_path\"), \"remote-config.db\")\n\tdb, err := openCacheDB(dbPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcacheKey := fmt.Sprintf(\"%s/%d/\", remoteConfigKey.Datacenter, remoteConfigKey.OrgID)\n\tuptaneClient, err := uptane.NewClient(db, cacheKey, remoteConfigKey.OrgID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclientsTTL := config.Datadog.GetDuration(\"remote_configuration.clients.ttl_seconds\")\n\tif clientsTTL < minimalRefreshInterval || clientsTTL > maxClientsTTL {\n\t\tlog.Warnf(\"Configured clients ttl is not within accepted range (%s - %s): %s. Defaulting to %s\", minimalRefreshInterval, maxClientsTTL, clientsTTL, defaultClientsTTL)\n\t\tclientsTTL = defaultClientsTTL\n\t}\n\tclock := clock.New()\n\treturn &Service{\n\t\tctx: context.Background(),\n\t\tfirstUpdate: true,\n\t\tdefaultRefreshInterval: refreshInterval,\n\t\tbackoffErrorCount: 0,\n\t\tbackoffPolicy: backoffPolicy,\n\t\tproducts: make(map[rdata.Product]struct{}),\n\t\tnewProducts: make(map[rdata.Product]struct{}),\n\t\thostname: hname,\n\t\tclock: clock,\n\t\tdb: db,\n\t\tapi: http,\n\t\tuptane: uptaneClient,\n\t\tclients: newClients(clock, clientsTTL),\n\t\tnewActiveClients: newActiveClients{\n\t\t\tclock: clock,\n\t\t\trequests: make(chan chan struct{}),\n\t\t\tuntil: time.Now().UTC(),\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "da6e896680eadeb1c287334e0d8e2af2", "score": "0.5006857", "text": "func main() {\n\texecutions = sync.WaitGroup{}\n\n\tcommand := os.Getenv(\"COMMAND\")\n\tinterval := os.Getenv(\"INTERVAL\")\n\tcron := os.Getenv(\"CRON\")\n\n\tflag.StringVar(&interval, \"interval\", interval, \"A time.Duration parseable interval. Examples: 5s, 2m or 4h\")\n\tflag.StringVar(&cron, \"cron\", cron, \"A six-field cron expression. Observe the added field for seconds. Example: 54 37 13 * * mon. This will run on every monday at 13:37:54.\")\n\tflag.Parse()\n\n\targs := flag.Args()\n\tif len(args) > 1 {\n\t\tcommand = strings.Join(args, \" \")\n\t}\n\n\tif command != \"\" && (interval != \"\" || cron != \"\") {\n\t\trun([]Job{Job{Command: command, Interval: interval, Cron: cron}})\n\t}\n\n\tviper.SetConfigName(\"run-occasionally\")\n\tviper.AddConfigPath(\".\")\n\terr := viper.ReadInConfig()\n\tif err == nil {\n\t\tvar config []Job\n\t\tif err = viper.UnmarshalKey(\"jobs\", &config); err == nil {\n\t\t\trun(config)\n\t\t}\n\t} else {\n\t\tlog.Fatalln(err)\n\t}\n\n\tfmt.Printf(\"usage: %s [-interval i] [-cron expr] command\\n\", os.Args[0])\n\tfmt.Println(\"Configuration can be loaded from a config file named run-occasionally.[yaml|json] in the current directory.\")\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "df175fa3f42dee64631146b3b9b969a5", "score": "0.5006483", "text": "func initConfig() {\n\t// basic\n\tviper.SetEnvPrefix(\"bping\")\n\tviper.SetDefault(\"command\", \"ss -atn4 state established | grep -v Address | awk '{print $4}'| awk -F':' '{print $1}'| sort -u\")\n\tviper.SetDefault(\"executor\", \"/bin/sh\")\n\tviper.SetDefault(\"executor_arg\", \"-ec\")\n\tviper.SetDefault(\"timeout\", 10)\n\tviper.SetDefault(\"interval\", 30)\n\tviper.SetDefault(\"metric_resp\", \"bping.resp\")\n\tviper.SetDefault(\"metric_loss\", \"bping.loss\")\n\n\tviper.AutomaticEnv() // read in environment variables that match\n\n}", "title": "" }, { "docid": "99e02b36e4a65b9d1f7790ecb90075dc", "score": "0.50061935", "text": "func (updater *Unattended) Run() error {\n\tupdater.log.WithField(\n\t\t\"check_interval\", updater.updateCheckInterval,\n\t).Info(\"Starting service with update checking enabled\")\n\ttime.AfterFunc(updater.updateCheckInterval, updater.handleUpdates)\n\treturn updater.RunWithoutUpdate()\n}", "title": "" }, { "docid": "057a1eb643fbd49e252c91fa308fe381", "score": "0.50027597", "text": "func main() {\n\tvar mWG = new(sync.WaitGroup)\n\n\tinitialization.InitializeServices(mWG)\n\n\tmWG.Wait()\n}", "title": "" }, { "docid": "31dc3568ce7546fa2532139619ee737e", "score": "0.4998825", "text": "func appConfig() {\n\tsetDefault()\n\t// todo\n\tif cfgFile != \"\" {\n\t\t// Use config file from the flag.\n\t\tviper.SetConfigFile(cfgFile)\n\t} else {\n\t\t// todo default settings\n\t\tviper.AddConfigPath(\".\")\n\t\tviper.AddConfigPath(\"./configs\")\n\t\tviper.SetConfigName(\"crawl\")\n\t}\n\n\tviper.AutomaticEnv() // read in environment variables that match\n\n\t// If a config file is found, read it in.\n\tif err := viper.ReadInConfig(); err == nil {\n\t\tfmt.Fprintln(os.Stderr, \"Using config file:\", viper.ConfigFileUsed())\n\t}\n\n\tif err := viper.Unmarshal(&c); err != nil {\n\t\tpanic(fmt.Sprintf(\"Unable to decode into Config struct , %v\", err))\n\t}\n\n\t// make the `outdir` directory if not exists, and check\n\t// c.OutDir will never nil , beacuase setDefault()\n\tif err := os.Mkdir(c.OutDir, 0755); !(err == nil || os.IsExist(err)) {\n\t\tfmt.Printf(\"Can't make directory %s, because %v\", c.OutDir, err)\n\t\t// fall back to current working directory \".\"\n\t\tc.OutDir = \".\"\n\t}\n}", "title": "" }, { "docid": "151356ae7de5febf773b76e092017718", "score": "0.49882358", "text": "func (dcm *DynamicConfigManager) refreshConfig() {\n\tlogger.Info(\"Refreshing the config. Time now : \" + time.Now().String())\n\tdata, _ := cacheImpl.Get(configKey, true, true)\n\tif data != nil && data.Value != nil {\n\t\tvar raw json.RawMessage\n\t\tnewAppConfig := dcm.applicationConfig\n\t\tif dataValue, ok := data.Value.(string); ok {\n\t\t\traw = json.RawMessage(dataValue)\n\t\t} else {\n\t\t\tlogger.Warning(fmt.Sprintf(\"Error - cannot convert to type string\"))\n\t\t\treturn\n\t\t}\n\t\tdataInBytes, err := json.Marshal(&raw)\n\t\tif err != nil {\n\t\t\tlogger.Warning(fmt.Sprintf(\"Incorrect Json. Error - %s\", err))\n\t\t\treturn\n\t\t}\n\t\terr = json.Unmarshal(dataInBytes, newAppConfig)\n\t\tif err != nil {\n\t\t\tlogger.Warning(fmt.Sprintf(\"Incorrect Json. Error - %s\", err))\n\t\t\treturn\n\t\t}\n\t\tconfigCopy := config.GlobalAppConfig.ApplicationConfig\n\t\t// Mergo : Library to merge structs and maps in Golang.\n\t\terr = mergo.MergeWithOverwrite(config.GlobalAppConfig.ApplicationConfig, newAppConfig)\n\t\tif err != nil {\n\t\t\tlogger.Warning(fmt.Sprintf(\"Failed to merge the application config. Error - %s\", err))\n\t\t\tconfig.GlobalAppConfig.ApplicationConfig = configCopy\n\t\t}\n\t} else {\n\t\tlogger.Warning(\"Could not find the dynamic config - key : \" + configKey + \" in central config cache\")\n\t}\n}", "title": "" }, { "docid": "680065a4a8949c82fc6127c73dbbb414", "score": "0.49874607", "text": "func InitService(conf *config.Config) (*Service, error) {\n\n\tpg, err := db.NewPostgres(&conf.Postgres)\n\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"Failed to connect to DB\")\n\n\t\treturn nil, err\n\t}\n\n\trc, err := db.NewRedis(&conf.Redis)\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"Failed to connect to redis\")\n\n\t\treturn nil, err\n\t}\n\n\tmID := &conf.Counter.MachineID\n\tr := &conf.Counter.Range\n\tc, _ := strconv.Atoi(strings.Split(*r, \"-\")[0])\n\n\ts := &Service{\n\t\trouter: gin.New(),\n\t\tshutdownChan: make(chan bool),\n\t\trc: rc,\n\t\tpg: pg,\n\t\tCounter: schema.Counter{\n\t\t\tMachineID: *mID,\n\t\t\tCount: c,\n\t\t},\n\t}\n\n\ts.router.Use(gin.Logger())\n\n\ts.router.Use(cors.New(cors.Config{\n\t\tAllowOrigins: []string{\"*\"},\n\t\tAllowMethods: []string{\"GET\", \"OPTIONS\", \"PUT\", \"POST\"},\n\t\tAllowHeaders: []string{\"origin\"},\n\t\tAllowCredentials: true,\n\t\tMaxAge: 12 * time.Hour,\n\t}))\n\n\ts.router.HTMLRender = gintemplate.New(gintemplate.TemplateConfig{\n\t\tRoot: \"templates\",\n\t\tExtension: \".html\",\n\t\tDisableCache: true,\n\t})\n\n\ts.router.GET(\"/\", s.index)\n\tv1 := s.router.Group(\"api/v1\")\n\t{\n\t\tv1.POST(\"/mini\", s.getMiniFromURL)\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "a99c750f77ffd1f81e7208d69032aa68", "score": "0.49864006", "text": "func cfgWatcherStart(ctx context.Context, cfgUpdater *Listeners,\n\tisReady func(ctx context.Context, cfg Config, logger *log.Logger) (readyForUse bool),\n\tlogger *log.Logger) (cfg Config, updatedCfgC chan Config) {\n\n\tupdatedCfgC = make(chan Config, 1)\n\t// Only close the configuration update channel when the server is terminating\n\tgo func() {\n\t\t<-ctx.Done()\n\t\tclose(updatedCfgC)\n\t}()\n\n\tif cfgUpdater != nil {\n\t\tupdaterHndl, err := cfgUpdater.Add(updatedCfgC)\n\t\tif err != nil {\n\t\t\tlogger.Warn(\"dynamic configuration changes not supported in the current deployment\")\n\t\t} else {\n\t\t\tdefer cfgUpdater.Delete(updaterHndl)\n\t\t}\n\t}\n\n\t// Even if the cfg does not change there might be an external state change that\n\t// brings the sydtem into a ready state so we should recheck everynow and again\n\trefresh := time.NewTicker(30 * time.Second)\n\tdefer refresh.Stop()\n\n\t// Before starting make sure we get at least the starting configuration\n\tcfg = Config{}\n\tfunc() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-refresh.C:\n\t\t\t\tif isReady(ctx, cfg, logger) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tcase cfg = <-updatedCfgC:\n\t\t\t\tif isReady(ctx, cfg, logger) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tcase <-ctx.Done():\n\t\t\t\tlogger.Warn(\"indexer could not be started using an initial configuration before the server was terminated\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\treturn cfg, updatedCfgC\n}", "title": "" }, { "docid": "1f60cc3eac327c640193ddec66e03fb2", "score": "0.4985868", "text": "func (s *scheduler) Run() {\n\tlog.Debugf(\"Scheduler started\")\n\tdefer close(s.done)\n\t// Load initial set of all configurations before polling for new ones.\n\ts.addNewConfigs(time.Now(), s.loadAllConfigs())\n\tticker := time.NewTicker(s.pollInterval)\n\tfor {\n\t\tselect {\n\t\tcase now := <-ticker.C:\n\t\t\terr := s.updateConfigs(now)\n\t\t\tif err != nil {\n\t\t\t\tlog.Warnf(\"Scheduler: error updating configs: %v\", err)\n\t\t\t}\n\t\tcase <-s.stop:\n\t\t\tticker.Stop()\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "96776e58a9394f5ba4d5be8b4ba31db2", "score": "0.498479", "text": "func (app *App) InitServices(config interfaces.Config, Logger interfaces.Logger) {\n\tapp.config = config\n\tif Logger == nil {\n\t\tapp.Logger = new(util.PlaceholderLogger)\n\t} else {\n\t\tapp.Logger = Logger\n\t}\n\terrors.SetDebug(app.config.GetStackTraceSetting())\n\n\tapp.Logger.Infof(\"Saving data to %s\", app.config.GetDatabasePath())\n\n\t// Start up the database\n\tif app.config.GetInMemoryDatabaseSetting() {\n\t\tapp.Storage = &inmemory.Storage{\n\t\t\tDb: make(map[string]string),\n\t\t}\n\t} else {\n\t\tapp.Storage = &leveldb.Storage{}\n\t}\n\tapp.Storage.SetDbPath(app.config.GetDatabasePath())\n\tapp.Storage.Run()\n\n\tprivateKey, publicKey, err := identity.GetIdentity(app.Storage)\n\n\tif !errors.IsEmpty(err) {\n\t\tapp.Logger.Error(errors.E(errors.Op(\"Get identity\"), err))\n\t}\n\n\tif app.config.GetWebsocketEnable() {\n\t\tapp.WebsocketService = &service.WebsocketService{Logger: Logger, Port: app.config.GetWebsocketPort()}\n\t\tgo app.WebsocketService.Start()\n\t}\n\n\t// Run the P2P process\n\tapp.P2p = p2p.NewP2p(config, privateKey, publicKey, p2p.Logger(app.Logger), p2p.Storage(app.Storage))\n\n\t// Construct the server struct\n\tapp.Server = service.NewServer(Logger, app.Storage, app.P2p, app.WebsocketService)\n\n\t// Connect the order service as a receiver for p2p\n\tapp.P2p.AddReceiver(app.Server.Orders)\n\n\t// Run the P2p service before running the gRPC server\n\tapp.P2p.Run()\n\n\tsystemSignals := make(chan os.Signal)\n\tsignal.Notify(systemSignals, syscall.SIGINT, syscall.SIGTERM)\n\n\tgo func() {\n\t\tselect {\n\t\tcase sig := <-systemSignals:\n\t\t\tapp.Logger.Infof(\"Received %s signal, shutting down.\\n\", sig)\n\t\t\tapp.Server.Close()\n\t\t\tapp.P2p.Close()\n\t\t\tapp.Storage.Close()\n\t\t\tos.Exit(0)\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "7000b32449dc402c5e26f2701377afcd", "score": "0.498477", "text": "func AppRun() {\n\n\tfmt.Println(\"App starting\")\n\thttp.HandleRequests()\n\t//fmt.Println(\"Get Ticker\")\n\t//tickers.NewTickerManagerService().GetTicker()\n}", "title": "" }, { "docid": "657df4135bd234e8c4bb0bbc8be91f31", "score": "0.49841994", "text": "func autoUpdate(cli *client.Client, config *settings.Settings) {\n\treference := fmt.Sprintf(\"%s:latest\", settings.AppImageName)\n\tlogger.Info(\"Auto update check\")\n\tctx := context.WithValue(context.Background(), contextKey(\"cli\"), cli)\n\tctx = context.WithValue(ctx, contextKey(\"reference\"), reference)\n\tctx = context.WithValue(ctx, contextKey(\"settings\"), config)\n\tcontainerID, err := getContainerID(ctx)\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprintf(\"%s\", err))\n\t}\n\tctx = context.WithValue(ctx, contextKey(\"contID\"), containerID)\n\tpullOptions := types.ImagePullOptions{}\n\toldImageID, err := getCurrentImageID(ctx)\n\tlogger.Debug(fmt.Sprintf(\"Current image %s\", oldImageID))\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprintf(\"%s\", err))\n\t\treturn\n\t}\n\t_, err = cli.ImagePull(ctx, reference, pullOptions)\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprintf(\"%s\", err))\n\t\treturn\n\t}\n\tnewImageID, err := checkRepoImageID(ctx)\n\tlogger.Debug(fmt.Sprintf(\"Repository latest image %s\", newImageID))\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprintf(\"%s\", err))\n\t\treturn\n\t}\n\tlogger.Debug(fmt.Sprintf(\"Image diff %s %s\", oldImageID, newImageID))\n\tif oldImageID == newImageID {\n\t\tlogger.Info(\"Latest image used\")\n\t\treturn\n\t}\n\tlogger.Info(\"Re-deploy application.\")\n\tctx = context.WithValue(ctx, contextKey(\"imageID\"), newImageID)\n\terr = redeploy(ctx)\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprintf(\"%s\", err))\n\t}\n}", "title": "" }, { "docid": "4efb65652c9ab33b7554b10e8c0e3c96", "score": "0.49840862", "text": "func Run(config *config.UpdaterConfig, datastore database.Datastore, st *utils.Stopper) {\n\tdefer st.End()\n\n\t// Do not run the updater if there is no config or if the interval is 0.\n\tif config == nil || config.Interval == 0 {\n\t\tlog.Infof(\"updater service is disabled.\")\n\t\treturn\n\t}\n\n\twhoAmI := uuid.New()\n\tlog.Infof(\"updater service started. lock identifier: %s\", whoAmI)\n\n\tfor {\n\t\tvar stop bool\n\n\t\t// Determine if this is the first update and define the next update time.\n\t\t// The next update time is (last update time + interval) or now if this is the first update.\n\t\tnextUpdate := time.Now().UTC()\n\t\tlastUpdate, firstUpdate, err := getLastUpdate(datastore)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"an error occured while getting the last update time\")\n\t\t\tnextUpdate = nextUpdate.Add(config.Interval)\n\t\t} else if firstUpdate == false {\n\t\t\tnextUpdate = lastUpdate.Add(config.Interval)\n\t\t}\n\n\t\t// If the next update timer is in the past, then try to update.\n\t\tif nextUpdate.Before(time.Now().UTC()) {\n\t\t\t// Attempt to get a lock on the the update.\n\t\t\tlog.Debug(\"attempting to obtain update lock\")\n\t\t\thasLock, hasLockUntil := datastore.Lock(lockName, whoAmI, lockDuration, false)\n\t\t\tif hasLock {\n\t\t\t\t// Launch update in a new go routine.\n\t\t\t\tdoneC := make(chan bool, 1)\n\t\t\t\tgo func() {\n\t\t\t\t\tUpdate(datastore, firstUpdate)\n\t\t\t\t\tdoneC <- true\n\t\t\t\t}()\n\n\t\t\t\tfor done := false; !done && !stop; {\n\t\t\t\t\tselect {\n\t\t\t\t\tcase <-doneC:\n\t\t\t\t\t\tdone = true\n\t\t\t\t\tcase <-time.After(refreshLockDuration):\n\t\t\t\t\t\t// Refresh the lock until the update is done.\n\t\t\t\t\t\tdatastore.Lock(lockName, whoAmI, lockDuration, true)\n\t\t\t\t\tcase <-st.Chan():\n\t\t\t\t\t\tstop = true\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Unlock the update.\n\t\t\t\tdatastore.Unlock(lockName, whoAmI)\n\n\t\t\t\tif stop {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tlockOwner, lockExpiration, err := datastore.FindLock(lockName)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Debug(\"update lock is already taken\")\n\t\t\t\t\tnextUpdate = hasLockUntil\n\t\t\t\t} else {\n\t\t\t\t\tlog.Debugf(\"update lock is already taken by %s until %v\", lockOwner, lockExpiration)\n\t\t\t\t\tnextUpdate = lockExpiration\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Sleep, but remain stoppable until approximately the next update time.\n\t\tnow := time.Now().UTC()\n\t\twaitUntil := nextUpdate.Add(time.Duration(rand.ExpFloat64()/0.5) * time.Second)\n\t\tlog.Debugf(\"next update attempt scheduled for %v.\", waitUntil)\n\t\tif !waitUntil.Before(now) {\n\t\t\tif !st.Sleep(waitUntil.Sub(time.Now())) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\t// Clean resources.\n\tfor _, metadataFetcher := range metadataFetchers {\n\t\tmetadataFetcher.Clean()\n\t}\n\tfor _, fetcher := range fetchers {\n\t\tfetcher.Clean()\n\t}\n\n\tlog.Info(\"updater service stopped\")\n}", "title": "" }, { "docid": "37b6bc14113856ccf217e2228f4586b0", "score": "0.49800533", "text": "func (c *pydioregistry) maintainRunningServicesList() {\n\n\trunning, _ := defaults.Registry().ListServices()\n\tfor _, r := range running {\n\t\t// Initially, nodes are not set on the service, so we fake it\n\t\tc.GetPeer(\"INITIAL\").Add(r, r.Name)\n\t}\n\n\tgo func() {\n\n\t\t// Once we've retrieved the list once, we watch the services\n\t\tw, err := defaults.Registry().Watch()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tfor {\n\t\t\tres, err := w.Next()\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif res == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ta := res.Action\n\t\t\ts := res.Service\n\n\t\t\tswitch a {\n\t\t\tcase \"create\":\n\t\t\t\tfor _, n := range s.Nodes {\n\t\t\t\t\tc.GetPeer(n.Address).Add(s, fmt.Sprintf(\"%d\", n.Port))\n\t\t\t\t\tc.GetPeer(\"INITIAL\").Delete(s, s.Name)\n\t\t\t\t}\n\t\t\tcase \"delete\":\n\t\t\t\tfor _, n := range s.Nodes {\n\t\t\t\t\tc.GetPeer(n.Address).Delete(s, fmt.Sprintf(\"%d\", n.Port))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "b2c9d62f0a27f394465fee5457cd79de", "score": "0.49734455", "text": "func (s *DiscoveryServer) periodicRefresh() {\n\tenvOverride := os.Getenv(\"V2_REFRESH\")\n\tif len(envOverride) > 0 {\n\t\tvar err error\n\t\tperiodicRefreshDuration, err = time.ParseDuration(envOverride)\n\t\tif err != nil {\n\t\t\tadsLog.Warn(\"Invalid value for V2_REFRESH\")\n\t\t}\n\t}\n\tif periodicRefreshDuration == 0 {\n\t\treturn\n\t}\n\tticker := time.NewTicker(periodicRefreshDuration)\n\tdefer ticker.Stop()\n\tfor range ticker.C {\n\t\tadsLog.Infof(\"ADS: periodic push of envoy configs %s\", versionInfo())\n\t\ts.AdsPushAll(versionInfo())\n\t}\n}", "title": "" }, { "docid": "64201b91fb2091941196e5b88ec69262", "score": "0.4960518", "text": "func (m *updator) run() {\n\n\tm.manager.done.Add(1)\n\tdefer m.manager.done.Done()\n\n\tticker := time.NewTicker(time.Second * 60)\n\tdefer ticker.Stop()\n\n\tlastUpdate := time.Now()\n\tm.checkServiceMap(false)\n\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tupdate := time.Now().Sub(lastUpdate) > (time.Minute * time.Duration(5))\n\t\t\tm.checkServiceMap(update)\n\t\t\tif update {\n\t\t\t\tlastUpdate = time.Now()\n\t\t\t}\n\n\t\tcase <-m.manager.killch:\n\t\t\tlogging.Infof(\"updator: go-routine terminates.\")\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "856c5f7bc780e1ff8e9004a9af8cfccb", "score": "0.4941908", "text": "func (dtas *GenDocTransServer) RegisterAtRegistry(registerURL string) {\n\t// Build Eureka Configuration\n\tdtas.registrar = eureka.NewClient([]string{\n\t\tregisterURL,\n\t})\n\tdtas.registrar.CheckRetry = eureka.ExpBackOffCheckRetry\n\t// Create the app instance\n\n\t// Register instance and heartbeat for Eureka\n\t_ = dtas.registrar.RegisterInstance(dtas.instanceInfo.App, dtas.instanceInfo) // Register new instance in your eureka(s)\n\tlog.WithFields(log.Fields{\"Service\": \"->Registrar\", \"Status\": \"Init\"}).Infof(\"Registering service %s\\n\", dtas.instanceInfo.App)\n\tlog.WithFields(log.Fields{\"Service\": \"->Registrar\", \"Status\": \"Init\"}).Tracef(\"InstanceInfo %v\\n\", dtas.instanceInfo)\n\n\tjob := func() {\n\t\tlog.WithFields(log.Fields{\"Service\": \"->Registrar\", \"Status\": \"Up\"}).Tracef(\"sending heartbeat : %v\\n\", time.Now().UTC())\n\t\tlog.WithFields(log.Fields{\"Service\": \"->Registrar\", \"Status\": \"Upt\"}).Tracef(\"InstanceInfo %v\\n\", dtas.instanceInfo)\n\t\t_ = dtas.registrar.SendHeartbeat(dtas.instanceInfo.App, dtas.instanceInfo.HostName) // say to eureka that your app is alive (here you must send heartbeat before 30 sec)\n\t}\n\n\t// Run every 25 seconds but not now.\n\t// FIXME:0 We have somehow be able to deregister the heartbeat\n\tdtas.heartBeatJob, _ = scheduler.Every(25).Seconds().NotImmediately().Run(job)\n}", "title": "" }, { "docid": "99bfba00142443caaf037f86a196eb15", "score": "0.4940552", "text": "func init() {\n\tapp.RegisterService(conf.ServiceAirdropKYC, setupFn)\n}", "title": "" }, { "docid": "1bde8648c9d452067c55b6b44d89ff7e", "score": "0.49381354", "text": "func (m *depsManager) run() {\n\tticker := time.NewTicker(time.Duration(checkInterval) * time.Second)\n\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tservices, err := dao.CachedServices(myClass)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"[deps] Error retrieving provisioned services list: %v\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor _, s := range services {\n\t\t\t\tm.load(s.ServiceName)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "68f75e11e6eca8ebba1cb0383a81bb17", "score": "0.49371353", "text": "func updateConfig() error {\n\t// get latest config\n\tconf, err := getGatewayConfig()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"get packet-forwarder config error\")\n\t}\n\n\tif lastUpdatedAt.Equal(conf.UpdatedAt) {\n\t\tlog.Info(\"no configuration update available\")\n\t\treturn nil\n\t}\n\n\t// load base config\n\tbaseConf, err := loadConfigFile(BaseConfigFile)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"load config file error\")\n\t}\n\n\t// merge the config\n\tif err = mergeConfig(baseConf, conf); err != nil {\n\t\treturn errors.Wrap(err, \"merge config error\")\n\t}\n\n\t// generate config json\n\tb, err := json.Marshal(baseConf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// write file to disk\n\tif err = ioutil.WriteFile(OutputConfigFile, b, 0644); err != nil {\n\t\treturn errors.Wrap(err, \"write file error\")\n\t}\n\tlog.WithField(\"path\", OutputConfigFile).Info(\"configuration written to disk\")\n\n\t// invoke restart command\n\tif err = invokePFRestart(); err != nil {\n\t\treturn errors.Wrap(err, \"invoke packet-forwarder restart error\")\n\t}\n\n\t// set last updated timestamp\n\tlastUpdatedAt = conf.UpdatedAt\n\n\treturn nil\n}", "title": "" }, { "docid": "03959589794711aebd23c9d033e578e7", "score": "0.4936274", "text": "func initConfig() {\n\n\tvar err error\n\n\tviper.SetConfigName(\".gcon\")\n\tviper.AddConfigPath(\"$HOME\")\n\tviper.AddConfigPath(\".\")\n\tviper.AutomaticEnv()\n\n\tif startCfgFile != \"\" {\n\t\tviper.SetConfigFile(startCfgFile)\n\t}\n\n\t// If a config file is found, read it in.\n\tif err := viper.ReadInConfig(); err == nil {\n\t\tstartCfgFile = viper.ConfigFileUsed()\n\t} else {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\tRootCmd.Usage()\n\t\tos.Exit(ExitNG)\n\t}\n\n\tstartGcon = NewGcon()\n\t// Store cfg info.\n\terr = startGcon.setCfg(viper.ConfigFileUsed())\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\tos.Exit(ExitNG)\n\t}\n\n\tci, err := startGcon.importCfg(viper.ConfigFileUsed())\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\tos.Exit(ExitNG)\n\t}\n\tz, err := ci.Log.Build()\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\tos.Exit(ExitNG)\n\t}\n\tstartGcon.Ci = *ci\n\tstartGcon.Logger.Sugar = z.Sugar()\n\n\tcmdPath, err := core.GetCmdPath(os.Args[0])\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\tos.Exit(ExitNG)\n\t}\n\n\t// Set cmd info.\n\terr = startGcon.setCmd(cmdPath)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\tos.Exit(ExitNG)\n\t}\n\n\t// Set pwd.\n\tpwd, err := os.Getwd()\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\tos.Exit(ExitNG)\n\t}\n\n\tstartGcon.Set(\"_PWD\", pwd, false)\n\n}", "title": "" }, { "docid": "f24b71b3d1f871d9676ba3268e105881", "score": "0.49338576", "text": "func buildConfig(hash, dir, port string) *Configuration {\n\tu, _ := strconv.ParseUint(port, 0, 64)\n\treturn &Configuration{\n\t\tServices: []*Service{\n\t\t\t&Service{\n\t\t\t\tName: \"db\",\n\t\t\t\tImage: \"mariadb\",\n\t\t\t\tVersion: \"latest\",\n\t\t\t\tVolumes: map[string]string{\n\t\t\t\t\t\"db\": \"/var/lib/mysql\",\n\t\t\t\t},\n\t\t\t\tEnvironment: map[string]string{\n\t\t\t\t\t\"MYSQL_ROOT_PASSWORD\": hash,\n\t\t\t\t},\n\t\t\t},\n\t\t\t&Service{\n\t\t\t\tName: \"wordpress\",\n\t\t\t\tImage: \"wordpress\",\n\t\t\t\tVersion: \"4.7.2\",\n\t\t\t\tDependsOn: []string{\n\t\t\t\t\t\"db\",\n\t\t\t\t},\n\t\t\t\tVolumes: map[string]string{\n\t\t\t\t\tdir + \"/plugins\": \"/var/www/html/wp-content/plugins\",\n\t\t\t\t\t\"theme\": \"/var/www/html/wp-content/themes/default\",\n\t\t\t\t},\n\t\t\t\tEnvironment: map[string]string{\n\t\t\t\t\t\"WORDPRESS_DB_HOST\": hash + \"_db_1:3306\",\n\t\t\t\t\t\"WORDPRESS_DB_PASSWORD\": hash,\n\t\t\t\t},\n\t\t\t},\n\t\t\t&Service{\n\t\t\t\tName: \"webpack\",\n\t\t\t\tImage: \"samuelngs/wordpress-sucks\",\n\t\t\t\tVersion: \"latest\",\n\t\t\t\tVolumes: map[string]string{\n\t\t\t\t\tdir + \"/theme\": \"/theme\",\n\t\t\t\t\t\"theme\": \"/wp-content/themes/default\",\n\t\t\t\t},\n\t\t\t\tEnvironment: map[string]string{\n\t\t\t\t\t\"WP_TARGET_HOST\": hash + \"_wordpress_1\",\n\t\t\t\t\t\"WP_TARGET_PORT\": \"80\",\n\t\t\t\t\t\"WP_PROXY_HOST\": \"localhost\",\n\t\t\t\t\t\"WP_PROXY_ADDR\": \"0.0.0.0\",\n\t\t\t\t\t\"WP_PROXY_PORT\": port,\n\t\t\t\t},\n\t\t\t\tPorts: map[uint]uint{\n\t\t\t\t\tuint(u): uint(u),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tVolumes: []string{\n\t\t\t\"db\",\n\t\t\t\"theme\",\n\t\t},\n\t}\n}", "title": "" }, { "docid": "866d5a54a639adf0bbb666eb158d76b4", "score": "0.49327162", "text": "func (c *Client) pollAppConfig(appName string) error {\n\ttimer := time.NewTimer(4 * time.Minute)\n\tt := time.NewTicker(5 * time.Second)\n\tdefer t.Stop()\n\tfor range t.C {\n\t\t_, err := c.GetApplication(appName)\n\t\tif err == nil {\n\t\t\treturn nil\n\t\t}\n\t\tselect {\n\t\tcase <-timer.C:\n\t\t\treturn fmt.Errorf(\"timed out waiting for app to appear - %v\", err)\n\t\tdefault:\n\t\t}\n\t}\n\treturn errors.New(\"exited poll loop before completion\")\n}", "title": "" }, { "docid": "6bf80a848bc1bd620e5b85f28376935d", "score": "0.49253032", "text": "func init() {\n\tfor group, values := range defaultConfigs {\n\t\tcore.RegisterConfig(group, values)\n\t}\n\tbase.RegisterService(\"mqtt:tcp\", mqtt.Configs, &mqtt.MqttFactory{})\n\tbase.RegisterService(\"mqtt:ssl\", mqtt.Configs, &mqtt.MqttFactory{})\n\tbase.RegisterService(\"mqtt:ws\", mqtt.Configs, &mqtt.MqttFactory{})\n\tbase.RegisterService(\"api\", api.Configs, &api.ApiServiceFactory{})\n\tbase.RegisterService(\"metric\", metric.Configs, &metric.MetricServiceFactory{})\n}", "title": "" }, { "docid": "04257cc0f0d470412815a77444afece3", "score": "0.49136588", "text": "func initConfig() {\n\tif cfgFile != \"\" {\n\t\t// Use config file from the flag.\n\t\tviper.SetConfigFile(cfgFile)\n\t} else {\n\n\t\t// Search config in home directory with name \".pwsync\" (without extension).\n\t\tviper.AddConfigPath(currentDir)\n\t\tviper.SetConfigName(\".pwsync\")\n\t}\n\n\tviper.AutomaticEnv() // read in environment variables that match\n\n\targs := os.Args[1:]\n\tif len(args) < 1 {\n\t\tfmt.Println(\"no command provided\")\n\t}\n\n\tif args[0] != runtime.InitCMDType {\n\t\tvar err error\n\t\tuserCfg, err = runtime.OpenConfig(cfgFile)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tfmt.Println(\"please check pwsync config, or run 'pwsync init'\")\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "bdf38ae1c6e8997f75ea7817195d7f6c", "score": "0.49108785", "text": "func (tg *podTGC) StartTGC() {\n\tfactory := informers.NewFilteredSharedInformerFactory(tg.clientSet, 0, tg.namespace, func(o *metav1.ListOptions) {\n\t})\n\tinformer := factory.Core().V1().ConfigMaps().Informer()\n\n\tinformer.AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) {\n\t\t\tcm := obj.(*v1.ConfigMap)\n\t\t\tswitch cm.Name {\n\t\t\tcase netBatPairing:\n\t\t\t\ttg.mutex.Lock()\n\t\t\t\tdefer tg.mutex.Unlock()\n\t\t\t\ttg.netPairResourceVersion = cm.GetResourceVersion()\n\t\t\t\ttg.handleNetBatPairingAddEvent(cm)\n\t\t\t\treturn\n\t\t\tcase netBatProfile:\n\t\t\t\ttg.mutex.Lock()\n\t\t\t\tdefer tg.mutex.Unlock()\n\n\t\t\t\tconfig, err := util.LoadConfig(cm)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Errorf(\"error processing configmap %v: error %v\", cm, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\ttg.config = config\n\t\t\t\tifNameAddressMap, err := util.GetNetInterfaces()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Errorf(\"error retrieving pod interfaces: error %v\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tfor protocol, sm := range protoServers {\n\t\t\t\t\tlogrus.Infof(\"available bat server: %s\", protocol)\n\t\t\t\t\terr = (*sm).LoadBatProfileConfig(tg.config.GetProfileMap())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlogrus.Errorf(\"error creating %s server profile config: error %v\", protocol, err)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tservers := make([]util.ServerImpl, 0)\n\t\t\t\t\tfor ifName, ip := range ifNameAddressMap {\n\t\t\t\t\t\tlogrus.Infof(\"creating %s server for %s:%s\", protocol, ifName, ip)\n\t\t\t\t\t\tserver, err := (*sm).CreateServer(tg.namespace, tg.podName, tg.nodeName, ip,\n\t\t\t\t\t\t\tifName, tg.socketReadBufferSize, tg.promRegistry)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlogrus.Errorf(\"error creating server on ip address %s: %v\", ip, err)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tservers = append(servers, server)\n\t\t\t\t\t}\n\t\t\t\t\ttg.serversMap[protocol] = servers\n\t\t\t\t}\n\t\t\t\tfor protocol, c := range protoClients {\n\t\t\t\t\tlogrus.Infof(\"available bat client: %s\", protocol)\n\t\t\t\t\terr = (*c).LoadBatProfileConfig(tg.config.GetProfileMap())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlogrus.Errorf(\"error creating %s client profile config: error %v\", protocol, err)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif tg.netBatPairs != nil {\n\t\t\t\t\tlogrus.Infof(\"net bat profile is set. starting tgen clients\")\n\t\t\t\t\tfor _, batPair := range tg.netBatPairs {\n\t\t\t\t\t\tlogrus.Infof(\"bat pair %v, %s, %s, %s\", *batPair.Source, batPair.Destination.Name,\n\t\t\t\t\t\t\tbatPair.TrafficProfile, batPair.TrafficScenario)\n\t\t\t\t\t}\n\t\t\t\t\ttg.createNetBatTgenClients()\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tUpdateFunc: func(oldObj, newObj interface{}) {\n\t\t\tcm := newObj.(*v1.ConfigMap)\n\t\t\tresourceVersion := cm.GetResourceVersion()\n\t\t\tswitch cm.Name {\n\t\t\tcase netBatPairing:\n\t\t\t\ttg.mutex.Lock()\n\t\t\t\tdefer tg.mutex.Unlock()\n\t\t\t\tif resourceVersion == tg.netPairResourceVersion {\n\t\t\t\t\tlogrus.Infof(\"no change in net-bat-pairing config map, returning\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\ttg.netPairResourceVersion = resourceVersion\n\t\t\t\t// reconfigure the clients with new pairing config\n\t\t\t\ttg.deleteNetBatTgenClients()\n\t\t\t\ttg.handleNetBatPairingAddEvent(cm)\n\t\t\t\treturn\n\t\t\tcase netBatProfile:\n\t\t\t\ttg.mutex.Lock()\n\t\t\t\tdefer tg.mutex.Unlock()\n\t\t\t\tif resourceVersion == tg.config.GetResourceVersion() {\n\t\t\t\t\tlogrus.Infof(\"no change in net-bat-profile config map, returning\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tsuspendOld := tg.config.SuspendTraffic()\n\t\t\t\t_, err := util.ReLoadConfig(cm, tg.config)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Errorf(\"error processing configmap %v: error %v\", cm, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tfor protocol, ps := range protoServers {\n\t\t\t\t\tlogrus.Infof(\"update config for bat server: %s\", protocol)\n\t\t\t\t\terr := (*ps).LoadBatProfileConfig(tg.config.GetProfileMap())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlogrus.Errorf(\"error updating %s profile config: error %v\", protocol, err)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor protocol, pc := range protoClients {\n\t\t\t\t\tlogrus.Infof(\"update config for bat client: %s\", protocol)\n\t\t\t\t\terr := (*pc).LoadBatProfileConfig(tg.config.GetProfileMap())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlogrus.Errorf(\"error updating %s profile config: error %v\", protocol, err)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// In case of only suspend or resume traffic cm update, don't\n\t\t\t\t// restart the traffic.\n\t\t\t\tif suspendOld != tg.config.SuspendTraffic() {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// restart the client with new config settings\n\t\t\t\ttg.restartNetBatTgenClients()\n\t\t\t}\n\t\t},\n\t\tDeleteFunc: func(obj interface{}) {\n\t\t\tcm := obj.(*v1.ConfigMap)\n\t\t\tswitch cm.Name {\n\t\t\tcase netBatPairing:\n\t\t\t\ttg.mutex.Lock()\n\t\t\t\tdefer tg.mutex.Unlock()\n\t\t\t\ttg.netPairResourceVersion = \"\"\n\t\t\t\ttg.deleteNetBatTgenClients()\n\t\t\t\treturn\n\t\t\tcase netBatProfile:\n\t\t\t\ttg.mutex.Lock()\n\t\t\t\tdefer tg.mutex.Unlock()\n\t\t\t\ttg.stopServers()\n\t\t\t\ttg.config = nil\n\t\t\t\treturn\n\t\t\t}\n\t\t},\n\t})\n\tgo func() {\n\t\tatomic.StoreInt32(&(tg.isRunning), int32(1))\n\t\t// informer Run blocks until informer is stopped\n\t\tlogrus.Infof(\"starting config map informer\")\n\t\tinformer.Run(tg.stopper)\n\t\tlogrus.Infof(\"config map informer is stopped\")\n\t\tatomic.StoreInt32(&(tg.isRunning), int32(0))\n\t}()\n}", "title": "" }, { "docid": "550fed4966ea73104084a5667ce5dcf3", "score": "0.49095875", "text": "func main() {\n log.SetFlags(log.LstdFlags | log.Lshortfile) //configure the logging for this application\n\t\n\t//handle any passed in flags\n\tconfigFile := flag.String(\"c\", \"printing_press.json\", \"Config file\")\n verboseFlag := flag.Bool(\"V\", false, \"Verbose logging for what this service is doing\")\n\tversionFlag := flag.Bool(\"v\", false, \"Returns the version\")\n \n\tflag.Parse()\n\t\n\tif *versionFlag {\n\t\tfmt.Printf(\"\\nPrinting Press Version: %s\\n\\n\", APP_VER)\n\t\tos.Exit(0)\n\t}\n\n app := app_t {} //init our application level object\n app.Verbose = *verboseFlag //copy over the verbose flag\n \n //parse the config file\n err := parseConfig(*configFile, &app)\n if err != nil {\n log.Printf(\"Unable to start. Issue with the config file\\n%s\\n\", err.Error())\n os.Exit(1) //bail\n }\n\n timeChan := make(chan time.Time, len(app.Services)) //this will be our exit flag\n\n jService := journal_c {Verbose: app.Verbose} //journal class\n //loop through our services and create a follower for each\n for idx, _ := range(app.Services) {\n go jService.Follow(app.Services[idx], timeChan) //pass the channel, this is how we'll exit these loops\n }\n \n\twg := new(sync.WaitGroup)\n\twg.Add(1)\n\t\n\t//this handles killing the service gracefully\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Interrupt)\n\tgo func(wg *sync.WaitGroup){\n\t\t<-c\n\t\t\tfmt.Println(\"Printing Press service exiting\")\n\t\t\twg.Done()\n\t}(wg)\n\t\n\twg.Wait()\t//wait till we hear an interrupt\n //if we're here it's cause we need to exit\n for _, _ = range(app.Services) {\n timeChan <- time.Now()\n }\n\n time.Sleep(time.Second * 1) //give it just a second to exit\n}", "title": "" }, { "docid": "a72747b627e68853d0fed35121d5b451", "score": "0.49094847", "text": "func (s *SystemService) Run() error {\n\treturn nil\n}", "title": "" }, { "docid": "863bcc055696450703c8711343d26858", "score": "0.49089587", "text": "func (c *config) addTask(s Service) {\n\tc.cron.AddFunc(s.Every, func() {\n\t\tgo s.Code(s.pipe.writer, s.port)\n\t\t<-c.ctx.Done()\n\t})\n}", "title": "" }, { "docid": "33f04ba21ebcfda527706301ed6813c4", "score": "0.4907015", "text": "func (sm *Statemgr) Run(rpcServer *rpckit.RPCServer, apisrvURL string, rslvr resolver.Interface, mserver *nimbus.MbusServer, logger log.Logger, options ...Option) error {\n\n\tsm.mbus = mserver\n\n\tsm.registerKindsWithMbus()\n\n\tsm.logger = logger\n\n\t// create controller instance\n\t// disable object resolution\n\n\tspec := ctkit.CtrlerSpec{\n\t\tApisrvURL: apisrvURL,\n\t\tLogger: logger,\n\t\tName: globals.Npm,\n\t\tResolver: rslvr,\n\t\t//Can be overriden by aggkind\n\t\tNumberofWorkersPerKind: numberofWorkersPerKind,\n\t\tRpcServer: rpcServer,\n\t\tResolveObjects: useResolver,\n\t}\n\tctrler, defReactor, err := ctkit.NewController(spec)\n\tif err != nil {\n\t\tlogger.Fatalf(\"Error creating controller. Err: %v\", err)\n\t}\n\tsm.ctrler = ctrler\n\n\tfor _, o := range options {\n\t\to(sm)\n\t}\n\n\tsm.dscObjUpdateQueue = newdscOpdateObjNotifier()\n\n\tsm.newPropagationTopoUpdater()\n\tsm.mbus.SetPropagationStatusChannel(sm.propogationTopoUpdate)\n\n\tsm.resyncDone = make(chan bool)\n\tsm.initialResyncDone = false\n\t// init the watch reactors\n\tsm.setDefaultReactors(defReactor)\n\n\t// Fetch feature flags if available before proceeding.\n\tfeatureflags.Initialize(globals.Npm, apisrvURL, rslvr)\n\n\tsm.setWatchFilterFlags()\n\n\tfor name, svc := range featuremgrs {\n\t\tlogger.Info(\"svc\", name, \" complete registration\")\n\t\tsvc.CompleteRegistration()\n\t}\n\n\t// newPeriodicUpdater creates a new go subroutines\n\t// Given that objects returned by `NewStatemgr` should live for the duration\n\t// of the process, we don't have to worry about leaked go subroutines\n\tsm.periodicUpdater = newPeriodicUpdater()\n\n\tsm.EnableSelectivePushForKind(\"Profile\")\n\n\terr = ctrler.AggWatch().Start(sm, sm.aggKinds)\n\tif err != nil {\n\t\tlog.Errorf(\"Error starting watch %v\", err)\n\t\treturn err\n\t}\n\n\t<-sm.resyncDone\n\n\t// Start garbage collection of unused network\n\tsm.StartGarbageCollection()\n\n\t//Wait for while to make sure garbage collection has started\n\ttime.Sleep(100 * time.Millisecond)\n\n\t// create all topics on the message bus after our state is built up\n\tsm.topics.EndpointTopic, err = nimbus.AddEndpointTopic(mserver, sm.EndpointStatusReactor)\n\tif err != nil {\n\t\tlogger.Errorf(\"Error starting endpoint RPC server\")\n\t\treturn err\n\t}\n\tsm.topics.AppTopic, err = nimbus.AddAppTopic(mserver, sm.AppStatusReactor)\n\tif err != nil {\n\t\tlogger.Errorf(\"Error starting App RPC server\")\n\t\treturn err\n\t}\n\tsm.topics.SecurityProfileTopic, err = nimbus.AddSecurityProfileTopic(mserver, sm.SecurityProfileStatusReactor)\n\tif err != nil {\n\t\tlogger.Errorf(\"Error starting SecurityProfile RPC server\")\n\t\treturn err\n\t}\n\tsm.topics.NetworkSecurityPolicyTopic, err = nimbus.AddNetworkSecurityPolicyTopic(mserver, sm.NetworkSecurityPolicyStatusReactor)\n\tif err != nil {\n\t\tlogger.Errorf(\"Error starting SG policy RPC server\")\n\t\treturn err\n\t}\n\tsm.topics.NetworkTopic, err = nimbus.AddNetworkTopic(mserver, sm.NetworkStatusReactor)\n\tif err != nil {\n\t\tlogger.Errorf(\"Error starting network RPC server\")\n\t\treturn err\n\t}\n\tsm.topics.VrfTopic, err = nimbus.AddVrfTopic(mserver, sm.VrfStatusReactor)\n\tif err != nil {\n\t\tlogger.Errorf(\"Error starting vrf RPC server\")\n\t\treturn err\n\t}\n\tlog.Infof(\"Interface status reactor: %v\", sm.NetworkInterfaceStatusReactor)\n\tsm.topics.NetworkInterfaceTopic, err = nimbus.AddInterfaceTopic(mserver, sm.NetworkInterfaceStatusReactor)\n\tif err != nil {\n\t\tlog.Errorf(\"Error starting network interface RPC server\")\n\t\treturn err\n\t}\n\n\tsm.topics.IPAMPolicyTopic, err = nimbus.AddIPAMPolicyTopic(mserver, sm.IPAMPolicyStatusReactor)\n\tif err != nil {\n\t\tlog.Errorf(\"Error starting ipam policy RPC server: %v\", err)\n\t\treturn err\n\t}\n\n\tsm.topics.RoutingConfigTopic, err = nimbus.AddRoutingConfigTopic(mserver, sm.RoutingConfigStatusReactor)\n\tif err != nil {\n\t\tlog.Errorf(\"Error starting routing config RPC server: %v\", err)\n\t\treturn err\n\t}\n\n\tsm.topics.AggregateTopic, err = nimbus.AddAggregateTopic(mserver, sm.AggregateStatusReactor)\n\tif err != nil {\n\t\tlog.Errorf(\"Error starting Aggregate RPC server\")\n\t\treturn err\n\t}\n\n\tsm.topics.PolicerProfileTopic, err = nimbus.AddPolicerProfileTopic(mserver, sm.PolicerProfileStatusReactor)\n\tif err != nil {\n\t\tlogger.Errorf(\"Error starting PolicerProfile RPC server\")\n\t\treturn err\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "372ddea9ce99cc4a3185a1fe0fb4c63f", "score": "0.49019974", "text": "func main() {\n\t// let's get a nil app structure for our service\n\ta := App{}\n\n\t// use dependency injection to fill it in\n\terr := a.Init(\"production\")\n\t// if Init fails with error ...\n\tif err != nil {\n\t\t// ... then, stop the train right here.\n\t\tpanic(err)\n\t}\n\n\t// ... otherwise, all aboard ... let's rock some tracks.\n\ta.Run()\n}", "title": "" }, { "docid": "93efbada754a513350e38143290affc3", "score": "0.48963502", "text": "func main() {\n\tvar image string\n\tvar timeout int\n\tvar showlogs bool\n\n\tflag.StringVar(&image, \"image\", \"\", \"Docker image name\")\n\tflag.BoolVar(&showlogs, \"showlogs\", true, \"show logs from stdout\")\n\tflag.IntVar(&timeout, \"timeout\", 0, \"ticks until we time out the service\")\n\tflag.Parse()\n\n\tif len(image) == 0 {\n\t\tfmt.Println(\"Provide an image name with -image\")\n\t\treturn\n\t}\n\n\tvar c *client.Client\n\tvar err error\n\tc, err = client.NewEnvClient()\n\tif err != nil {\n\t\tlog.Fatal(\"Error with Docker client.\")\n\t}\n\n\tspec := makeSpec(image)\n\tcreateOptions := types.ServiceCreateOptions{}\n\tcreateResponse, _ := c.ServiceCreate(context.Background(), spec, createOptions)\n\tfmt.Printf(\"Service created: %s\\n\", createResponse.ID)\n\n\tpollTask(c, createResponse.ID, timeout, showlogs)\n}", "title": "" }, { "docid": "bda1a75466c70bff73e5186d6ede59be", "score": "0.48937872", "text": "func doConfig() error {\n\twf.Var(\"CALENDAR_APP\", \"\") // Open links in default browser, not CALENDAR_APP\n\n\tif opts.Query == \"\" {\n\t\twf.Configure(aw.SuppressUIDs(true))\n\t}\n\n\tif len(accounts) > 0 {\n\t\twf.NewItem(\"Active Calendars…\").\n\t\t\tSubtitle(\"Turn calendars on/off\").\n\t\t\tUID(\"calendars\").\n\t\t\tIcon(iconCalendars).\n\t\t\tValid(true).\n\t\t\tVar(\"action\", \"calendars\")\n\n\t\twf.NewItem(\"Add Account…\").\n\t\t\tSubtitle(\"Action this item to add a Google account\").\n\t\t\tUID(\"add-account\").\n\t\t\tAutocomplete(\"workflow:login\").\n\t\t\tIcon(iconAccountAdd)\n\t} else {\n\t\twf.NewItem(\"No Accounts Configured\").\n\t\t\tSubtitle(\"Action this item to add a Google account\").\n\t\t\tUID(\"add-account\").\n\t\t\tAutocomplete(\"workflow:login\").\n\t\t\tIcon(aw.IconWarning)\n\t}\n\n\tfor _, acc := range accounts {\n\t\tit := wf.NewItem(acc.Name).\n\t\t\tSubtitle(\"⌥↩ to remove account / ⌘↩ to re-authenticate\").\n\t\t\tUID(acc.Name).\n\t\t\tArg(acc.Name).\n\t\t\tValid(false).\n\t\t\tIcon(acc.Icon())\n\n\t\tit.NewModifier(\"opt\").\n\t\t\tSubtitle(\"Remove account\").\n\t\t\tValid(true).\n\t\t\tVar(\"action\", \"logout\").\n\t\t\tVar(\"account\", acc.Name)\n\n\t\tit.NewModifier(\"cmd\").\n\t\t\tSubtitle(\"Re-authenticate account with read-write permission\").\n\t\t\tValid(true).\n\t\t\tVar(\"action\", \"reauth\").\n\t\t\tVar(\"account\", acc.Name)\n\t}\n\n\tvar (\n\t\tname = \"Google Maps\"\n\t\tother = \"Apple Maps\"\n\t\ticon = iconGoogleMaps\n\t\targ = \"apple\"\n\t)\n\n\tif opts.UseAppleMaps {\n\t\tname, other = other, name\n\t\ticon = iconAppleMaps\n\t\targ = \"google\"\n\t}\n\n\twf.NewItem(\"Open Locations in \"+name).\n\t\tSubtitle(\"Toggle this setting to use \"+other).\n\t\tUID(\"location\").\n\t\tArg(arg).\n\t\tValid(true).\n\t\tIcon(icon).\n\t\tVar(\"action\", \"set\").\n\t\tVar(\"key\", \"maps\").\n\t\tVar(\"value\", arg)\n\n\tif wf.UpdateAvailable() {\n\t\twf.NewItem(\"An Update is Available\").\n\t\t\tSubtitle(\"A newer version of the workflow is available\").\n\t\t\tUID(\"update\").\n\t\t\tAutocomplete(\"workflow:update\").\n\t\t\tIcon(iconUpdateAvailable).\n\t\t\tValid(false)\n\t} else {\n\t\twf.NewItem(\"Workflow is up to Date\").\n\t\t\tSubtitle(\"Action to force update check\").\n\t\t\tUID(\"update\").\n\t\t\tIcon(iconUpdateOK).\n\t\t\tValid(true).\n\t\t\tVar(\"action\", \"update\")\n\t}\n\n\twf.NewItem(\"Open Documentation\").\n\t\tSubtitle(\"Open workflow README in your browser\").\n\t\tUID(\"docs\").\n\t\tArg(readmeURL).\n\t\tValid(true).\n\t\tIcon(iconDocs).\n\t\tVar(\"action\", \"open\")\n\n\twf.NewItem(\"Get Help\").\n\t\tSubtitle(\"Open alfredforum.com thread in your browser\").\n\t\tUID(\"forum\").\n\t\tArg(forumURL).\n\t\tValid(true).\n\t\tIcon(iconHelp).\n\t\tVar(\"action\", \"open\")\n\n\twf.NewItem(\"Report Issue\").\n\t\tSubtitle(\"Open GitHub issues in your browser\").\n\t\tUID(\"issues\").\n\t\tArg(helpURL).\n\t\tValid(true).\n\t\tIcon(iconIssue).\n\t\tVar(\"action\", \"open\")\n\n\twf.NewItem(\"Clear Cached Calendars & Events\").\n\t\tSubtitle(\"Remove cached list of calendars and events\").\n\t\tUID(\"clear\").\n\t\tIcon(iconDelete).\n\t\tValid(true).\n\t\tVar(\"action\", \"clear\")\n\n\tif opts.Query != \"\" {\n\t\twf.Filter(opts.Query)\n\t}\n\n\twf.WarnEmpty(\"No Matches\", \"Try a different query\")\n\twf.SendFeedback()\n\treturn nil\n}", "title": "" }, { "docid": "9d39b1fd3ecaf7cc88fee5ab6314aa44", "score": "0.48922452", "text": "func (s *Service) Run() {\n\ttick := time.Tick(s.ReportInterval)\n\tlogrus.Debugln(\"run with interval\", s.ReportInterval)\n\tfor {\n\t\tselect {\n\t\tcase <-tick:\n\t\t\ts.reportStatus()\n\t\tcase task := <-s.tasks:\n\t\t\ts.addTask(task)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3bb815a71ae6423a57cbaad5faad2aa8", "score": "0.4887917", "text": "func (c *ConfigWatcher) Start() error {\n\tdefer c.wg.Done()\n\tglog.Infof(\"Quering server for node configuration.\")\n\tc.updateConfiguration()\n\tc.timer = time.NewTicker(c.interval * time.Second)\n\tfor {\n\t\tselect {\n\t\tcase time := <-c.timer.C:\n\t\t\tglog.Infof(\"Tick at %v. Quering server for node configuration.\", time)\n\t\t\tc.updateConfiguration()\n\t\tcase <-c.stop_chan:\n\t\t\tglog.Info(\"Received stop from sign\")\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "90287caddc09e45c5d4f1141f26fc157", "score": "0.4887465", "text": "func (m *Main) Run() error {\n\tif m.flags.version {\n\t\tfmt.Fprint(os.Stdout, Version)\n\t\treturn nil\n\t}\n\n\t// If debug mode then use a verbose logger.\n\tm.logger = log.Dummy\n\tif m.flags.debug {\n\t\tf, err := os.OpenFile(m.flags.logPath, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0660)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer f.Close()\n\n\t\tm.logger = log.New(log.Config{\n\t\t\tOutput: f,\n\t\t})\n\t}\n\n\t// Load configuration.\n\tcfg, err := m.loadConfiguration()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdss, err := cfg.Datasources()\n\tif err != nil {\n\t\treturn err\n\t}\n\tgatherer, err := metric.NewGatherer(metric.ConfigGatherer{\n\t\tDatasources: dss,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tgatherer = metricmiddleware.Logger(m.logger, gatherer)\n\n\t// Create controller.\n\tctrl := controller.NewController(gatherer)\n\n\t// Create renderer.\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\trenderer, err := termdash.NewTermDashboard(cancel, m.logger)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer renderer.Close()\n\n\t// Prepare app for running.\n\tvar g run.Group\n\n\t// Capture signals.\n\t{\n\t\tsigC := make(chan os.Signal, 1)\n\t\texitC := make(chan struct{})\n\t\tsignal.Notify(sigC, syscall.SIGTERM, syscall.SIGINT)\n\n\t\tg.Add(\n\t\t\tfunc() error {\n\t\t\t\tselect {\n\t\t\t\tcase <-sigC:\n\t\t\t\tcase <-exitC:\n\t\t\t\t}\n\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tfunc(e error) {\n\t\t\t\tclose(exitC)\n\t\t\t})\n\t}\n\n\t// Run application.\n\t{\n\t\tappcfg := view.AppConfig{\n\t\t\tRefreshInterval: m.flags.refreshInterval,\n\t\t\tRelativeTimeRange: m.flags.relativeDur,\n\t\t\tOverrideVariables: m.flags.variables,\n\t\t}\n\n\t\t// Only set fixed time if start set.\n\t\tif m.flags.start != \"\" {\n\t\t\tstart, err := timeFromFlag(m.flags.start)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error parsing start flag: %s\", err)\n\t\t\t}\n\t\t\tend, err := timeFromFlag(m.flags.end)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error parsing end flag: %s\", err)\n\t\t\t}\n\n\t\t\tappcfg.TimeRangeStart = start\n\t\t\tappcfg.TimeRangeEnd = end\n\n\t\t\t// Check times are correct.\n\t\t\tif !appcfg.TimeRangeEnd.IsZero() && appcfg.TimeRangeEnd.Before(appcfg.TimeRangeStart) {\n\t\t\t\treturn fmt.Errorf(\"end timestamp can't be before start timestamp\")\n\t\t\t}\n\t\t}\n\n\t\tapp := view.NewApp(appcfg, ctrl, renderer, m.logger)\n\t\tds, err := cfg.Dashboard()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tg.Add(\n\t\t\tfunc() error {\n\t\t\t\terr := app.Run(ctx, ds)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tdefer cancel()\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tfunc(e error) {\n\t\t\t\tcancel()\n\t\t\t})\n\t}\n\n\treturn g.Run()\n}", "title": "" }, { "docid": "790fac3c73cf0be1f81d832dccb0006c", "score": "0.48856473", "text": "func (p *ServiceManager) Run() error {\n\t// Run all service\n\tglog.Infof(\"there are %d services in '%s'\", len(p.services), p.name)\n\tfor _, service := range p.services {\n\t\tglog.Infof(\"Starting service '%s'...\", service.Name())\n\t\tif err := service.Start(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
96c4ee6843778d1748a658d0ae1adcd2
Deprecated: Use DumpRIBRequest.ProtoReflect.Descriptor instead.
[ { "docid": "c3206df24937af878b0f2606390b868c", "score": "0.6925523", "text": "func (*DumpRIBRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_bio_routing_bio_rd_protocols_bgp_api_bgp_proto_rawDescGZIP(), []int{3}\n}", "title": "" } ]
[ { "docid": "3ab7613230c6da0ee0c1f1e5794eb804", "score": "0.7101069", "text": "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "title": "" }, { "docid": "157cf2129c8bdb51bfaf750605340d04", "score": "0.70606786", "text": "func (*DiagnoseRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "69124f8da1b539755bd7444056c4b0d6", "score": "0.70597", "text": "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "b2736b99ecf2bc746fba853985135977", "score": "0.69761705", "text": "func (*DebugInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "0c5a96aa39a865cf5a625c6fada219b0", "score": "0.6925053", "text": "func (*GetCollectorRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{163}\n}", "title": "" }, { "docid": "3824532b46335e475efd3ec6f906037d", "score": "0.6919177", "text": "func (*ListenRequest) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "61fbe73f05aeb42fc3482d6716d31fc4", "score": "0.6903791", "text": "func (*ReportLoadRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "5e7ef8d653d708a834c8eb4c8c7eacb7", "score": "0.6901636", "text": "func (*DisconnectedRequest) Descriptor() ([]byte, []int) {\n\treturn file_vm_vm_proto_rawDescGZIP(), []int{29}\n}", "title": "" }, { "docid": "59ee3fb53156d0d425bbcbedb91c1a1d", "score": "0.68705875", "text": "func (*LogTraceRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "5b8938f9cf9e6c560982b578b4820977", "score": "0.6868442", "text": "func (*DescribeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "77a646e80e38e98ea19039df62d3373a", "score": "0.685981", "text": "func (*ModifyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "4fe8c6f3676ffeb9123b6f5b1f884641", "score": "0.6855211", "text": "func (*LogMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{59}\n}", "title": "" }, { "docid": "17cee1bb1a6994d189295dbada3f3306", "score": "0.6832381", "text": "func (*DownlinkQueueRequest) Descriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_messages_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "812b3a241e50c929b8d8e1cab55029c1", "score": "0.68178666", "text": "func (*DeregisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "e819f404b17889196de34618db318f71", "score": "0.68056256", "text": "func (*ReleaseIPRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "0b5ba55942ad0600b184b790739c15c9", "score": "0.6803497", "text": "func (*TelemetryRequest) Descriptor() ([]byte, []int) {\n\treturn file_automate_gateway_api_telemetry_telemetry_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "d58ff8c943f8ad8bafadee12aa7c1e27", "score": "0.67984676", "text": "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "f499c2110ce8d33a72928043c3f075bb", "score": "0.6797604", "text": "func (*DescribeRemindRequest) Descriptor() ([]byte, []int) {\n\treturn file_ocp_remind_api_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "ece6bf9c2aba0594273a9f55dc371556", "score": "0.6797363", "text": "func (*InvokeBindingRequest) Descriptor() ([]byte, []int) {\n\treturn file_runtime_proto_rawDescGZIP(), []int{41}\n}", "title": "" }, { "docid": "3e95f31146a194b0b273a1cc2be2b10f", "score": "0.6791214", "text": "func (*StaleReadRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "d2b16581c424935926bcf6bcbc5f9a69", "score": "0.6788378", "text": "func (*DecodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_videoservice_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "ab739360afff9e2938da26d0404811ee", "score": "0.67710656", "text": "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_recordwants_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "744814a735ae0b125749fd614552689d", "score": "0.67632747", "text": "func (*SendRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "6f26f50d4aecb0b4a608579a074eb6c6", "score": "0.6761438", "text": "func (*LoadBalancerStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_test_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "248211ed0f2e3ca7bde48171639c11d8", "score": "0.6760846", "text": "func (*RefreshTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_bulbasur_v1_bulbasur_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "6256f8896196b8dafb350b1af42b9f75", "score": "0.6760823", "text": "func (*PortRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_api_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "1571e1fa0b89de1e1b4ad7a71305762a", "score": "0.675892", "text": "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_msgs_msgs_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "c97d03713dbfef26ae50029e8c661e6b", "score": "0.6757204", "text": "func (*DeleteMicroRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_micro_pb_request_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "1944ea091ecbe16ea3b69ecb0456916a", "score": "0.67536026", "text": "func (*UnthrottleRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{27}\n}", "title": "" }, { "docid": "6c3d93c7dd3360da99a01a0505894480", "score": "0.6748786", "text": "func (*PublishDiagnosticsRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{100}\n}", "title": "" }, { "docid": "45051f42c89dd8d49661d75fd8b4b414", "score": "0.67469484", "text": "func (*GetRequest) Descriptor() ([]byte, []int) {\n\treturn file_index_faults_rpc_rpc_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "83971e0e3984637b0eb894e0b41dbdc3", "score": "0.6745717", "text": "func (*SetTraceRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "e3ee5e347839ae17fbe19089f3014beb", "score": "0.67414397", "text": "func (*AddRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_calculate_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "2a700ce61586aed3eee2d772a0a73e53", "score": "0.67410344", "text": "func (*SendFromMinerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "b91f2d902ea72aa8f237b2742f39777b", "score": "0.6735014", "text": "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "3665695f69444b2762cd436d54cfc85d", "score": "0.6734507", "text": "func (*GetRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_comments_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "94ffb2b3e278dc59cf862cccb680d7f4", "score": "0.67319465", "text": "func (*OutdatedRequest) Descriptor() ([]byte, []int) {\n\treturn file_cc_arduino_cli_commands_v1_commands_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "1873dc25996bd314e578edebd36e9404", "score": "0.67294884", "text": "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_Trd_ModifyOrder_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "93ab1bb1499b6eb35f60d4eea07b2246", "score": "0.67285454", "text": "func (*ProbeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_gateway_v1_control_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "6c2cb31078d3143144840838a3152606", "score": "0.67246497", "text": "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "89a67e0ca29409d2293201f0444df93d", "score": "0.67213684", "text": "func (*GetRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_collector_collector_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "26160cfcf2dca1a4392f6925540c2f5e", "score": "0.6720842", "text": "func (*DescribeMicroRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_micro_pb_request_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "bf4ec5cba1ddd37ed7d3436407c332c6", "score": "0.67163473", "text": "func (x *fastReflection_AddressBytesToStringRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AddressBytesToStringRequest\n}", "title": "" }, { "docid": "c056fb6cf09be6fe2541e470fa2854e3", "score": "0.671351", "text": "func (*GetVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "6b3458c6707a8cb092cd4455840c6ad2", "score": "0.67050505", "text": "func (*WatchRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{25}\n}", "title": "" }, { "docid": "e9a93fd82458839015c007b1b9837370", "score": "0.67023957", "text": "func (*ValidateRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "fc30c93464f188d19eddfdca6e382242", "score": "0.67002684", "text": "func (*DeleteWalletLedgerRequest) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "6a3988c66187a54697e53f685dec7acb", "score": "0.66998065", "text": "func (*PatchAnnotationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "c6f63f05eb6f0e9123e7c4c0d6d043c2", "score": "0.66990024", "text": "func (*RevokeJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "3953847f5e5eed9b6ffe2ba9ca507027", "score": "0.6697921", "text": "func (*DelRequest) Descriptor() ([]byte, []int) {\n\treturn file_patrol_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "9b7bc741dfd444f4892a2a0cd5af2ca6", "score": "0.66947997", "text": "func (*CollectRequest) Descriptor() ([]byte, []int) {\n\treturn file_orc8r_cloud_go_services_analytics_protos_collector_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "4d40dd2646186ad4da39f5962c1c326f", "score": "0.6692966", "text": "func (*DetailRequest) Descriptor() ([]byte, []int) {\n\treturn file_golang_pkg_proto_movies_movies_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "7efdbdc0a0809f03c394a921a2dfde81", "score": "0.66924715", "text": "func (*CMsgLoadedRequest) Descriptor() ([]byte, []int) {\n\treturn file_steam_htmlmessages_proto_rawDescGZIP(), []int{46}\n}", "title": "" }, { "docid": "20996cae13b37982bd657981e5da544f", "score": "0.66915727", "text": "func (*FeedbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "6bc17a10025cbecd2a6edc418180744c", "score": "0.6691498", "text": "func (x *fastReflection_AddressStringToBytesRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AddressStringToBytesRequest\n}", "title": "" }, { "docid": "5bd32e121cea3694db6f00b2885634a6", "score": "0.6689265", "text": "func (*MemberReceiveAddressUpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{86}\n}", "title": "" }, { "docid": "2b94006e4e45da658be0de5f02a89dd0", "score": "0.6688693", "text": "func (*GetBalanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "8b3d42621d347427d7dbb4b02e69c1b8", "score": "0.66885406", "text": "func (*ReferenceRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{141}\n}", "title": "" }, { "docid": "73353b1acdc87212b2e0477ab4b64d19", "score": "0.6683474", "text": "func (*UpdateNSRecordRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_record_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "40c1f9068ede3d27d6a6e058639973bd", "score": "0.6683009", "text": "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_newfindmaxpb_newfindmaxpb_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "cbc76f65dc234ce69cce1a0456f59b71", "score": "0.66828245", "text": "func (*ShowMessageRequestRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{58}\n}", "title": "" }, { "docid": "dff1f5e8b311ba51b8bb2fb5ddd43503", "score": "0.66826504", "text": "func (*GetMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_lte_protos_sms_orc8r_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "082aabf5adf0e1a9f6082ca8f5a3b68a", "score": "0.6680794", "text": "func (*LoadStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_envoy_service_load_stats_v3_lrs_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "6b575e8ccd5bd30f7383ef90b790998f", "score": "0.66778183", "text": "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_internal_services_profile_proto_profile_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "a5cc3201fc509d0333bbafdd9a9d78d8", "score": "0.6675301", "text": "func (*CodeLensRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{163}\n}", "title": "" }, { "docid": "3c052b6839711e7be172c9e448067009", "score": "0.667227", "text": "func (*QueryMicroRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_micro_pb_request_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "04dea997fe49fa6150fb7cc07a852e25", "score": "0.66657025", "text": "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "f76a27bc30b4ef1e61207c57f26387d8", "score": "0.6661653", "text": "func (*ConnectedRequest) Descriptor() ([]byte, []int) {\n\treturn file_vm_vm_proto_rawDescGZIP(), []int{28}\n}", "title": "" }, { "docid": "830395ecedd34622d90dd5f304524067", "score": "0.6651635", "text": "func (*RemoveFaultRequest) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "31f09a65094988b4e282587f355a8a17", "score": "0.6641938", "text": "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_api_protobuf_spec_example_example_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "be7f85f01003801f18baadba9ffe3d57", "score": "0.6641225", "text": "func (*NetworkRequest) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_iam_v1_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "f5be3320d2d74645aef0fc5ea13d4acb", "score": "0.663918", "text": "func (*MetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "7bdb59a766c1688f7f9bb391180998a2", "score": "0.6637279", "text": "func (*TelemetryRequest) Descriptor() ([]byte, []int) {\n\treturn file_interservice_license_control_license_control_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "8a8bbf0d4c7e139e65b0f84ec5d86ce6", "score": "0.6634928", "text": "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_helloworld_helloworld_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "5fae19f9e298633bc59be412598f1210", "score": "0.6633929", "text": "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_api_api_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "4a09ec061a8e157d0cef15db3a3ba845", "score": "0.6630063", "text": "func (*ContractQueryRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{22}\n}", "title": "" }, { "docid": "de1face20f4f86d711123fdca95144d9", "score": "0.66267455", "text": "func (*HeartbeatRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "fc57d29791606e481663eeba934a18f1", "score": "0.6626669", "text": "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_kv_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "b7d2c3791528ece9c432115b77fec03d", "score": "0.66237795", "text": "func (*AddProducerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "1fc9c4c7f6764e1bb2c9d342a55f0161", "score": "0.662326", "text": "func (*NewVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_versiontracker_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "350738144f2ab7ec71441c5ed2a50c9e", "score": "0.6622721", "text": "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_proto_inventory_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "7f9b198afb2b124e3f42a64326f3ef6e", "score": "0.66209435", "text": "func (*AddWantRequest) Descriptor() ([]byte, []int) {\n\treturn file_recordwants_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "24a86a93dad6a6bb75491f65eaeee92b", "score": "0.66207117", "text": "func (*CapabilityRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_gnmi_gnmi_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "36fe4f55c122910a324a9a715286b0d4", "score": "0.6619785", "text": "func (*UpgradeRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_pb_protobuf_api_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "13eedf470183c895698ad897bd1c53f9", "score": "0.66188437", "text": "func (*RemoveRemindRequest) Descriptor() ([]byte, []int) {\n\treturn file_ocp_remind_api_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "be5b046832ba0e8f4c34807a8d1b2bf5", "score": "0.6618566", "text": "func (*AgentIdRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_v1_squzy_application_monitoring_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "f9d21bdeed64c5532e4230760f95672b", "score": "0.6616371", "text": "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_toit_api_auth_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "c00f40caa2fcbed41e3490a7bc561716", "score": "0.66143155", "text": "func (*GeneratedRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_auth_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "24c4cf1976616e3e94e39c16212e5443", "score": "0.6612389", "text": "func (*RefreshCallQueueRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "90aed803dd8518ce47ea539e85d5a3dc", "score": "0.661006", "text": "func (*ReportRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicecontrol_v1_service_controller_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "38742011356b8c875b7bc160efdaf884", "score": "0.66097015", "text": "func (*GetSerialRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_pb_protobuf_api_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "69d2fb18816b2e5f28b56fea6643a572", "score": "0.6609523", "text": "func (*ReadRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "20a6a87a433d51c68ab184233d78acae", "score": "0.6609196", "text": "func (*MoneyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_swap_swap_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "eb8693b0d9cfcacedf05bdca1b101d98", "score": "0.6609059", "text": "func (*AddRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_calculator_proto_calc_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "917ae77558ef68b292b7c50375676271", "score": "0.66081864", "text": "func (*CBroadcast_WebRTCStopped_Request) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_broadcast_steamclient_proto_rawDescGZIP(), []int{47}\n}", "title": "" }, { "docid": "67a336e9931a1b1bc9971d1c6fee272a", "score": "0.660741", "text": "func (*UnpinMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "cd8c7a05f84132d62ef0a65844cc8478", "score": "0.660712", "text": "func (*PatchKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{74}\n}", "title": "" }, { "docid": "6ab81a10f420f302af54808ae537c5f0", "score": "0.6607053", "text": "func (*GetServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "681ea7a6f39a6089ddf5a34569550efe", "score": "0.6605789", "text": "func (*PostCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{160}\n}", "title": "" }, { "docid": "bfea9664d348bdb90151191ce48514f7", "score": "0.6604189", "text": "func (*ApplyRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{0}\n}", "title": "" } ]
54a7b93d70ebbc49f9ce292702c84cd5
SetXA The position of the Game Object on the x axis relative to the local coordinates of the parent.
[ { "docid": "c4c00c848cca54059317af81172b826b", "score": "0.7181239", "text": "func (self *TileSprite) SetXA(member int) {\n self.Object.Set(\"x\", member)\n}", "title": "" } ]
[ { "docid": "49c3fa989bfc11d3381770d58fa0bed4", "score": "0.7439735", "text": "func (self *Graphics) SetCenterXA(member int) {\n self.Object.Set(\"centerX\", member)\n}", "title": "" }, { "docid": "36103cb60d66b50bbd1505ab76e27c2c", "score": "0.7239161", "text": "func (self *TileSprite) SetCenterXA(member int) {\n self.Object.Set(\"centerX\", member)\n}", "title": "" }, { "docid": "2212b1bc864d56c24c4057f5a11798e9", "score": "0.72189426", "text": "func (self *Graphics) SetXA(member int) {\n self.Object.Set(\"x\", member)\n}", "title": "" }, { "docid": "df282d31e0c200ee329bad62ee5eaa99", "score": "0.71362495", "text": "func (self *Rectangle) SetCenterXA(member int) {\n self.Object.Set(\"centerX\", member)\n}", "title": "" }, { "docid": "eb6074d4c57025782c5d4203b1b9e6df", "score": "0.7067229", "text": "func (self *Graphics) SetOffsetXA(member int) {\n self.Object.Set(\"offsetX\", member)\n}", "title": "" }, { "docid": "94c44133d9854558a7f756f1a1c22685", "score": "0.698268", "text": "func (self *TileSprite) SetOffsetXA(member int) {\n self.Object.Set(\"offsetX\", member)\n}", "title": "" }, { "docid": "61429fd9dec583b1cf16138923ea34ba", "score": "0.6879616", "text": "func (self *Rectangle) SetXA(member int) {\n self.Object.Set(\"x\", member)\n}", "title": "" }, { "docid": "ec841443c296e55fff6d8b4e5c8277be", "score": "0.58421093", "text": "func (self *Rectangle) SetRandomXA(member int) {\n self.Object.Set(\"randomX\", member)\n}", "title": "" }, { "docid": "2f08c13338c1ac0696ae6a452b903e77", "score": "0.58170104", "text": "func (self *Events) SetParentA(member *Sprite) {\n self.Object.Set(\"parent\", member)\n}", "title": "" }, { "docid": "ae951c9b185981e4a118685b2aa2f57e", "score": "0.56703943", "text": "func (p *Player) SetXWindow(windowID uint32) error {\n\tif p.player == nil {\n\t\treturn errors.New(\"player must be initialized first\")\n\t}\n\n\tC.libvlc_media_player_set_xwindow(p.player, C.uint(windowID))\n\treturn getError()\n}", "title": "" }, { "docid": "9fbeeb4c355e2cea205c6663e5211b83", "score": "0.56491274", "text": "func (g *Grid) SetX(x int) { g.X = x }", "title": "" }, { "docid": "0feaedc7c28a81cd9d7850e0ac0c0c52", "score": "0.5584217", "text": "func (s *swimmer) setX(pos int) {\n\ts.xPos = pos\n}", "title": "" }, { "docid": "bc1b9aec72db9c390c6c39dd7d7a44c2", "score": "0.5393813", "text": "func (o *Dig) SetPosX(v int32) {\n\to.PosX = v\n}", "title": "" }, { "docid": "9de01d72d772be32ec1e0567bed80fb9", "score": "0.5329834", "text": "func (b *BaseElement) SetX(x int32) {\n\tb.ax += x - b.x\n\tb.x = x\n}", "title": "" }, { "docid": "115d3ee59867d8307c6e9b4390c8a206", "score": "0.5289373", "text": "func (self *Rectangle) SetTopLeftA(member *Point) {\n self.Object.Set(\"topLeft\", member)\n}", "title": "" }, { "docid": "0ab75dc93430ae383a73ca258a09d6d2", "score": "0.5286649", "text": "func (t *Text) SetX(x float32) *Text {\n\tt.X = x\n\tt.SpaceComponent.Position.X = x\n\n\treturn t\n}", "title": "" }, { "docid": "362678794e719704cfadcc097a5c638c", "score": "0.5201077", "text": "func setX(n int16) {\n\tswitch true {\n\tcase n < 0:\n\t\txDirection = left\n\tcase n > 0:\n\t\txDirection = right\n\tdefault:\n\t\tif xDirection == left {\n\t\t\txDirection = leftToCenter\n\t\t} else {\n\t\t\txDirection = rightToCenter\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9ff30a2a0bb82eff9c51973d937e3171", "score": "0.51967406", "text": "func (o *ViewBanner) SetX(v float32) {\n\to.X = &v\n}", "title": "" }, { "docid": "5d2a1cf77f2aa64007c40606405366c6", "score": "0.5185318", "text": "func (self *TileSprite) SetAnchorA(member *Point) {\n self.Object.Set(\"anchor\", member)\n}", "title": "" }, { "docid": "6a067b40ec5c2737fc3e84fb27825445", "score": "0.5167412", "text": "func (p *Point) SetX(x int) {\n\tp.x = x\n}", "title": "" }, { "docid": "9f606e70e88d04da69fbea19b6794d29", "score": "0.51395375", "text": "func (o *WObj) SetTopLeft(x, y float64) {\n\to.Hitbox.MoveTo(&Point{x, y})\n\tw, h := o.img.Size()\n\tW := float64(w) / float64(o.squareSize)\n\tH := float64(h) / float64(o.squareSize)\n\to.Drawbox = GetRectangle(o.Hitbox.Min().X-(W-o.Hitbox.Bounds().X)/2, o.Hitbox.Min().Y-(H-o.Hitbox.Bounds().Y), 0, 0)\n\to.Drawbox.SetBounds(&Point{W, H})\n}", "title": "" }, { "docid": "2f17556d7e5aed7b8069164a72df7fcc", "score": "0.5102339", "text": "func (enemy *Enemy) SetX(x float64) {\n\tenemy.X = x\n}", "title": "" }, { "docid": "0300dc91b5f56ee6ecdd3ce524804dd5", "score": "0.50892156", "text": "func (a *Actor) SetPosition(x float64, y float64) {\n\ta.x = x\n\ta.y = y\n}", "title": "" }, { "docid": "ffb15919879559a591c4232c193a79df", "score": "0.4972487", "text": "func (o *InlineObject885) SetXExplicitNull(b bool) {\n\to.X = nil\n\to.isExplicitNullX = b\n}", "title": "" }, { "docid": "6d7f1e207119212158c1744e014575c7", "score": "0.492035", "text": "func (xs *Sheet) SetTopLeftView(row int, col int) {\n\txs.xb.lib.NewProc(\"xlSheetSetTopLeftViewW\").\n\t\tCall(xs.self, I(row), I(col))\n}", "title": "" }, { "docid": "a0b9eaf015dd45d01f7866cdcaffd5bd", "score": "0.488935", "text": "func (o *InlineObject999) SetXExplicitNull(b bool) {\n\to.X = nil\n\to.isExplicitNullX = b\n}", "title": "" }, { "docid": "06566bdd70de1085db67cc129ad26224", "score": "0.48698097", "text": "func (t *Transform) SetParent(p Transformable) {\n\tt.access.Lock()\n\tif t.parent != p {\n\t\tt.built = nil\n\t\tt.parent = p\n\t}\n\tt.access.Unlock()\n}", "title": "" }, { "docid": "616f08c1c681352d4def9c7c4b6d82c8", "score": "0.48310688", "text": "func (self *TileSprite) SetTopA(member int) {\n self.Object.Set(\"top\", member)\n}", "title": "" }, { "docid": "c7d32b37f743508d0b4b4d4f67cd2e50", "score": "0.482304", "text": "func PositionOffsetX(x float64) MeshOption {\n\treturn func(t *Mesh) error {\n\t\tt.characterPositionOffsetX = x\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "e0064d7613107cbc0642580a4151efca", "score": "0.47929257", "text": "func CenterEntityInParent(entity, parent *Entity) {\n\tentity.X = (parent.W - entity.W) / 2\n}", "title": "" }, { "docid": "a64593d65e6aad610e477ff3e2b84fa7", "score": "0.47743475", "text": "func (self *Graphics) SetTopA(member int) {\n self.Object.Set(\"top\", member)\n}", "title": "" }, { "docid": "825c9c37f6ea7f58225c2d459ff764c5", "score": "0.47638386", "text": "func (cc *ConstructionCreate) SetX(i int) *ConstructionCreate {\n\tcc.mutation.SetX(i)\n\treturn cc\n}", "title": "" }, { "docid": "4cdf7e0890042b9f0f97eee6d1b68c89", "score": "0.4750731", "text": "func (self *TileSprite) SetTilePositionA(member *Point) {\n self.Object.Set(\"tilePosition\", member)\n}", "title": "" }, { "docid": "26a362908e44abbaba7b2dc8843bc685", "score": "0.47106534", "text": "func (p *Popup) SetAnchorPosition(x, y int) {\n\tp.anchorX = x\n\tp.anchorY = y\n}", "title": "" }, { "docid": "f7f93a6c2eb75ea0b2accd4eafea488e", "score": "0.47057945", "text": "func (self *Rectangle) SetBottomLeftA(member *Point) {\n self.Object.Set(\"bottomLeft\", member)\n}", "title": "" }, { "docid": "219e1083566174e9d9ed703aacb4dc48", "score": "0.47049356", "text": "func (self *TileSprite) SetPreviousPositionA(member *Point) {\n self.Object.Set(\"previousPosition\", member)\n}", "title": "" }, { "docid": "04ec1c21624c1966b1734d1014f8b2fb", "score": "0.46760115", "text": "func (cli *SetWrapper) SetParent(parentInstID int64) error {\n\treturn cli.set.SetValue(fieldParentID, parentInstID)\n}", "title": "" }, { "docid": "1a0162b22ec3fd5ceb44ad7ba4d04c05", "score": "0.46422634", "text": "func (self *TileSprite) SetLeftA(member int) {\n self.Object.Set(\"left\", member)\n}", "title": "" }, { "docid": "0300e9c3346e4e9d676eafc3b23fedbf", "score": "0.46374103", "text": "func (v *EventButton) XRoot() float64 {\n\tc := v.native().x_root\n\treturn float64(c)\n}", "title": "" }, { "docid": "76e1fd6aecb001dc8d0d849b5f0a4cb6", "score": "0.46359372", "text": "func (o *InlineObject869) SetXExplicitNull(b bool) {\n\to.X = nil\n\to.isExplicitNullX = b\n}", "title": "" }, { "docid": "46fd78d903969f5c81078cf8985b7a95", "score": "0.46128836", "text": "func (n *Node) SetParent(parent Ki) {\n\tn.Par = parent\n\tif parent != nil && !parent.OnlySelfUpdate() {\n\t\tparup := parent.IsUpdating()\n\t\tn.FuncDownMeFirst(0, nil, func(k Ki, level int, d interface{}) bool {\n\t\t\tbitflag.SetState(k.Flags(), parup, int(Updating))\n\t\t\treturn true\n\t\t})\n\t}\n}", "title": "" }, { "docid": "62acab3e3e6205aa81d9f7766a373821", "score": "0.46007925", "text": "func (this *Transformable) SetPosition(pos Vector2f) {\n\tC.sfTransformable_setPosition(this.cptr, pos.toC())\n}", "title": "" }, { "docid": "0a0b0e3e451054abba6b12f71d05c65f", "score": "0.4589713", "text": "func (obj Player) SetPos(xf, yf, zf float64) error {\n\ts := fmt.Sprintf(\"player.setPos(%s,%f,%f,%f)\",obj.name, xf, yf, zf)\n\treturn object(obj.obj).send(s)\n}", "title": "" }, { "docid": "6e85aace228e1bb8adaaed4acb672d9e", "score": "0.45887417", "text": "func (hc *HarborCreate) SetX(i int) *HarborCreate {\n\thc.mutation.SetX(i)\n\treturn hc\n}", "title": "" }, { "docid": "49ffdbf99d19de9d745e48bd7ff94938", "score": "0.45794755", "text": "func (b *BaseElement) SetParent(e ElementI) {\n\tif b.Parent != nil && e != nil {\n\t\tb.Parent.DisownChild(b.This)\n\t}\n\tb.Parent = e\n}", "title": "" }, { "docid": "305ade2234593d1b6746de0d2dc03a73", "score": "0.4578706", "text": "func (self *Rectangle) SetTopA(member int) {\n self.Object.Set(\"top\", member)\n}", "title": "" }, { "docid": "0f97b40d4b14ec458cc2ba12e4f34f22", "score": "0.45703894", "text": "func (obj *ObjectBase) VSetParent(vPtr IObject, parent IObject) {\n\tobj.parent = parent\n\tif len(obj.name) > 0 {\n\t\tobj.VSetName(vPtr, obj.name)\n\t}\n}", "title": "" }, { "docid": "aea9fbe94921bb8f31c718de2f7e4619", "score": "0.4556793", "text": "func (self *TileSprite) SetCenterYA(member int) {\n self.Object.Set(\"centerY\", member)\n}", "title": "" }, { "docid": "475c03bd91d68d48b88936a5d3e54fa2", "score": "0.45454445", "text": "func (b *Base) SetPosition(x, y, z float64) {\n\tb.messageChan <- &proto.Update{\n\t\tPosition: &proto.Position{\n\t\t\tX: x,\n\t\t\tY: y,\n\t\t\tZ: z,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "154328dc372cea14d2d95168fefad2c4", "score": "0.4541982", "text": "func (p *protoOutputNode) SetXID(xid string) { p.Node.Xid = xid }", "title": "" }, { "docid": "b6bcf0aed3c3912b984f7362d381bcd9", "score": "0.4533407", "text": "func (sprite *Sprite) SetPosition(x, y float64) {\n\n\tsprite.shape.SetPosition(x, y)\n}", "title": "" }, { "docid": "d2b887b4a7417c02fbc058e9b045b484", "score": "0.45296663", "text": "func (blk *Block) SetPos(x, y float64) {\n\tblk.positioning = positionAbsolute\n\tblk.xPos = x\n\tblk.yPos = y\n}", "title": "" }, { "docid": "6382bbd05e1eaeb1f8b73673f5b66cac", "score": "0.4529142", "text": "func (self *Rectangle) SetCenterYA(member int) {\n self.Object.Set(\"centerY\", member)\n}", "title": "" }, { "docid": "9b0ce37f926ce630b64983524bee0b82", "score": "0.4512107", "text": "func (o *Source) SetParentP(exec boil.Executor, insert bool, related *Source) {\n\tif err := o.SetParent(exec, insert, related); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "b0d474dcdf4a3da2fb0f4c751e0f09f5", "score": "0.45105037", "text": "func (self *TileSprite) SetChildrenA(member []DisplayObject) {\n self.Object.Set(\"children\", member)\n}", "title": "" }, { "docid": "7f634259613b5939ccdedcdae6380cbd", "score": "0.44959676", "text": "func (self *Graphics) SetPreviousPositionA(member *Point) {\n self.Object.Set(\"previousPosition\", member)\n}", "title": "" }, { "docid": "ead04104fd876d66f70c6fdee139ff27", "score": "0.44902918", "text": "func (o *InlineObject885) SetX(v AnyOfobject) {\n\to.X = &v\n}", "title": "" }, { "docid": "3d3abfbef4ec4965b4be837862a6f6ea", "score": "0.4488457", "text": "func setParent(node, parent *I3Node) {\n\n\tnode.Parent = parent\n\n\tfor i := range node.Nodes {\n\t\tsetParent(&node.Nodes[i], node)\n\t}\n\tfor i := range node.Floating_Nodes {\n\t\tsetParent(&node.Floating_Nodes[i], node)\n\t}\n}", "title": "" }, { "docid": "ac1fa5c5d77e74896de5a1552ee57341", "score": "0.44786805", "text": "func (o *PostDeviceRackParams) SetXPos(xPos *string) {\n\to.XPos = xPos\n}", "title": "" }, { "docid": "08393dda609f2214d5a574ffebf81a98", "score": "0.4478432", "text": "func Position(parent, child Rect, a AlignType) Rect {\n\tswitch {\n\tcase a.Is(Left):\n\t\tchild.X = parent.Left()\n\tcase a.Is(Right):\n\t\tchild.X = parent.Right() - child.W\n\tcase a.Is(Center):\n\t\tchild.X = parent.CenterX() - child.W/2\n\t}\n\tswitch {\n\tcase a.Is(Top):\n\t\tchild.Y = parent.Top()\n\tcase a.Is(Bottom):\n\t\tchild.Y = parent.Bottom() - child.H\n\tcase a.Is(Center):\n\t\tchild.Y = parent.CenterY() - child.H/2\n\t}\n\treturn child\n}", "title": "" }, { "docid": "eaa064a81d2233222dbd6d140aa7b739", "score": "0.44779614", "text": "func (self *TileSprite) SetCameraOffsetA(member *Point) {\n self.Object.Set(\"cameraOffset\", member)\n}", "title": "" }, { "docid": "6c7953b1fdbb63d6a7d8080705e9cc37", "score": "0.4476538", "text": "func (o *InlineObject999) SetX(v AnyOfobject) {\n\to.X = &v\n}", "title": "" }, { "docid": "80f23c9e11a442286762f590b56f8d07", "score": "0.44765073", "text": "func (self *ComponentScaleMinMax) SetScaleMinA(member *Point) {\n self.Object.Set(\"scaleMin\", member)\n}", "title": "" }, { "docid": "277d7a9cb1608d1e71fcdbaabd754d76", "score": "0.44698006", "text": "func (c RelativeConstraint) GetX() float32 {\n\tparentX := c.parent().GetX()\n\tparentWidth := c.parent().GetWidth()\n\twidth := c.self().GetWidth()\n\n\tx := parentX + c.op(parentWidth, c.constant)\n\n\treturn relativeOutOfBounds(x, width, parentX, parentWidth)\n}", "title": "" }, { "docid": "2dd69244b03473ec736bd0625e938b91", "score": "0.4465215", "text": "func (m *TransposableMatrix) SetCenter(x, y int) {\n\tm.cx = m.nx/2 + x\n\tm.cy = m.ny/2 + y\n}", "title": "" }, { "docid": "32e30e18f4b8f26f75dccd1982606ca4", "score": "0.44610944", "text": "func (w *WidgetBase) SetParent(p Widget) {\n\tw.parent = p\n}", "title": "" }, { "docid": "f6522ba7121776f43e51c2f627dbcd87", "score": "0.4449404", "text": "func (m *memNode) setParent(parent *memNode, i int) {\n\tparent.assertLoadedChildren()\n\tparent.loadedChildren[i] = m\n\tm.parent = parent\n\tm.parentIdx = i\n\tm.depth = parent.depth + 1\n}", "title": "" }, { "docid": "7d1c084ad47b8698d9b2c4ab5b0983dd", "score": "0.44468638", "text": "func (self *Graphics) SetCenterYA(member int) {\n self.Object.Set(\"centerY\", member)\n}", "title": "" }, { "docid": "91ac75903ecb777ae1058d643bbae336", "score": "0.44330016", "text": "func (sp *Space) SetXY(x, y float64) {\n\n\tif len(*sp) > 0 {\n\n\t\tdx, dy := (*sp)[0].GetXY()\n\t\tdx = x - dx\n\t\tdy = y - dy\n\n\t\tfor _, shape := range *sp {\n\t\t\tshape.Move(dx, dy)\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "34f39996e81229a4010910e5fbff5425", "score": "0.4428814", "text": "func (w *WidgetImplement) SetPosition(x, y int) {\n\tw.x = x\n\tw.y = y\n}", "title": "" }, { "docid": "7f43bc666a81fc594caf115a5228a8c1", "score": "0.43991324", "text": "func (self *Rectangle) SetLeftA(member int) {\n self.Object.Set(\"left\", member)\n}", "title": "" }, { "docid": "5cc539e40f591736b1dcc5c16ae130b5", "score": "0.43990564", "text": "func (self Sound) SetPosition(v Vector3f) { \n C.sfSound_setPosition(self.Cref, v.Cref)\n}", "title": "" }, { "docid": "4d8fe645bebeee5d512eaad2abc1c327", "score": "0.4388359", "text": "func (b *BaseElement) GetAbsoluteX() int32 {\n\treturn b.ax\n}", "title": "" }, { "docid": "167af81a383c46f1efb9e7523c6d2ce2", "score": "0.43883497", "text": "func (n *Node) SetOwner(owner *userpb.UserId) {\n\tn.SpaceRoot.owner = owner\n}", "title": "" }, { "docid": "267f3cf76208327c0f025a14f67ab081", "score": "0.43824184", "text": "func (self *Graphics) SetLeftA(member int) {\n self.Object.Set(\"left\", member)\n}", "title": "" }, { "docid": "e774ea8f66ea53f486a4addc435c1461", "score": "0.43818212", "text": "func (this *Window) SetPosition(pos Vector2i) {\n\tC.sfWindow_setPosition(this.cptr, pos.toC())\n}", "title": "" }, { "docid": "993fa110b651060b2f237b85a57897a3", "score": "0.43779853", "text": "func (node *Node) SetParent(newParent helpers.GraphNode) helpers.GraphNode {\n\tnode.lock.Lock()\n\tdefer node.lock.Unlock()\n\n\tnode.parent = newParent.(*Node)\n\n\treturn node\n}", "title": "" }, { "docid": "221d87923e35b83260f32301055c9b0a", "score": "0.43630534", "text": "func (self *Graphics) SetChildrenA(member []DisplayObject) {\n self.Object.Set(\"children\", member)\n}", "title": "" }, { "docid": "3ddf5de7801c1c3e30f476255680f351", "score": "0.43607613", "text": "func (self *TileSprite) SetFrameA(member int) {\n self.Object.Set(\"frame\", member)\n}", "title": "" }, { "docid": "a1255dc19c0027dcec6f1f10e6ff2091", "score": "0.43555468", "text": "func (transform *Transform) SetPosition(newPos mgl32.Vec3) {\n\ttransform.objMatrix.SetRow(3, mgl32.Vec4{newPos.X(), newPos.Y(), newPos.Z()})\n}", "title": "" }, { "docid": "13b2c7a812ba5fcf31df228cfdf3cdf5", "score": "0.43492416", "text": "func changeX(pt *Point) {\n\tpt.x = 100\n}", "title": "" }, { "docid": "ede9d7ffa24cb8c0113c90a720b63c6c", "score": "0.43411654", "text": "func Txa(c *CPU) {\n\tc.ApplyNZ(c.X)\n\tc.A = c.X\n}", "title": "" }, { "docid": "02792c37624848882efbe20518062869", "score": "0.4340673", "text": "func (t *Transform) SetPositionXY(x float64, y float64) ITransform {\n\treturn t.SetPosition(NewVector(x, y))\n}", "title": "" }, { "docid": "3704fd72b6f567363d698ab22c15f11a", "score": "0.4340267", "text": "func xHand(rad float64, scale float64) Point {\n\tp := unitCoordinates(rad)\n\tp = centerPoint(p, scale)\n\n\treturn p\n}", "title": "" }, { "docid": "00395723ec3e610e3d67637c951fe944", "score": "0.43391302", "text": "func (o *InlineObject869) SetX(v AnyOfobject) {\n\to.X = &v\n}", "title": "" }, { "docid": "7d3d75b45f50e0e775d29755623bfdd3", "score": "0.4338619", "text": "func (ns *Namespace) SetParent(p *Namespace) {\n\t// Remove old parent and cleans it up.\n\tif ns.parent != nil {\n\t\tdelete(ns.parent.children, ns.name)\n\t\tif len(ns.parent.children) == 0 {\n\t\t\tns.parent.clean()\n\t\t}\n\t}\n\n\t// Update new parent.\n\tns.parent = p\n\tif p != nil {\n\t\tp.children[ns.name] = ns\n\t}\n}", "title": "" }, { "docid": "f4a02d1644d327063d681f36e77bb29c", "score": "0.43345797", "text": "func (db *DB) Beginx() (*sqlx.Tx, error) {\n\treturn db.leader.Beginx()\n}", "title": "" }, { "docid": "ff845cc7271126c01e62f7565b36f0de", "score": "0.43296564", "text": "func (m *_CBusCommandPointToPointToMultiPointStatus) InitializeParent(parent CBusPointToPointToMultipointCommand, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte) {\n\tm.BridgeAddress = bridgeAddress\n\tm.NetworkRoute = networkRoute\n\tm.PeekedApplication = peekedApplication\n}", "title": "" }, { "docid": "5d3d13c671258ac53a8d153bae77b9f4", "score": "0.43226582", "text": "func (ps *ParticleSystem) SetPosition(x, y float64) {\n\tps.epiCenter.SetByComp(x, y)\n}", "title": "" }, { "docid": "9e6070f2ed0868aae61fd9fc94ca52bf", "score": "0.43223897", "text": "func (m *RoadMutation) SetX(i int) {\n\tm.x = &i\n\tm.addx = nil\n}", "title": "" }, { "docid": "14ed3663633eb3c2544b31baa82caf0c", "score": "0.43211284", "text": "func (m *SettlementMutation) SetX(i int) {\n\tm.x = &i\n\tm.addx = nil\n}", "title": "" }, { "docid": "01f794b7de8c71b3b7e56225c5223d1c", "score": "0.4316003", "text": "func (e *Tree) SetParent(replacement *Tree) { e.parent = replacement }", "title": "" }, { "docid": "07e410b7cd859c33fe3e56073b0268ed", "score": "0.42889208", "text": "func SetMousePosition(x, y int) {\n\tsetMousePosition(x, y)\n}", "title": "" }, { "docid": "6e063037a23f51e3f7c922daa2a849a8", "score": "0.42771125", "text": "func (w *Window) Center() {\n\tif err := driver.macRPC.Call(\"windows.Center\", nil, struct {\n\t\tID string\n\t}{\n\t\tID: w.ID().String(),\n\t}); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "3f34d366c41704928cc4cb5666ff262c", "score": "0.42740244", "text": "func (self *Graphics) SetCameraOffsetA(member *Point) {\n self.Object.Set(\"cameraOffset\", member)\n}", "title": "" }, { "docid": "e613cb1885ae531bdc9c8fb67adf281a", "score": "0.42717433", "text": "func (t *Transform) SetPos(p lmath.Vec3) {\n\tt.access.Lock()\n\tif t.pos != p {\n\t\tt.built = nil\n\t\tt.pos = p\n\t}\n\tt.access.Unlock()\n}", "title": "" }, { "docid": "09a59e2924752d95d775efe2023a4bce", "score": "0.4269193", "text": "func (m *M) SetAnchorCorner(c Corner) {\n\tm.Component().Call(\"setAnchorCorner\", c)\n}", "title": "" }, { "docid": "08a1b9050d51cd1b91765da808e99b5f", "score": "0.4268324", "text": "func (self *TileSprite) SetTileScaleOffsetA(member *Point) {\n self.Object.Set(\"tileScaleOffset\", member)\n}", "title": "" }, { "docid": "4f5b2cbd6348ce5c693a596b1f2b8a29", "score": "0.42677584", "text": "func (b *BBox) MinX() int64 {\n\treturn int64(b.handle.xMin)\n}", "title": "" }, { "docid": "10d6228a9f39b5a99fbd3bd2aef2237d", "score": "0.42673755", "text": "func (win *Window) SetPosition(pos WindowPosition) {\n\twin.Candy().Guify(\"gtk_window_set_position\", win, pos)\n}", "title": "" } ]
24973ea4f12307fefa02450032ddfef8
The number of availability domains instances will be spread across. If two instances are in different availability domain, they will not be put in the same low latency network
[ { "docid": "c13f0ccc1627b9b28dfbffa32256712d", "score": "0.5608554", "text": "func (o ResourcePolicyGroupPlacementPolicyOutput) AvailabilityDomainCount() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v ResourcePolicyGroupPlacementPolicy) *int { return v.AvailabilityDomainCount }).(pulumi.IntPtrOutput)\n}", "title": "" } ]
[ { "docid": "c9be083f79e901a45d878c6c82e13493", "score": "0.62672424", "text": "func (gc GroupConfig) InstanceCount() int {\n\tcount := 0\n\tfor _, t := range gc.Tiers {\n\t\tfor range t.Instances {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "ac56e42a0dcee5bdbc6688e238268be7", "score": "0.5925281", "text": "func determineNumberOfInstances(instanceCount int, numberOfVersions int, numberOfUnits int) int {\n\tif instanceCount != 0 {\n\t\treturn instanceCount\n\t}\n\n\tif numberOfVersions == 1 {\n\t\treturn numberOfUnits\n\t} else {\n\t\treturn 1\n\t}\n}", "title": "" }, { "docid": "5c442905c1729e3009beff2f59acea8b", "score": "0.5873687", "text": "func (ins instances) Size() int { return len(ins) }", "title": "" }, { "docid": "ce8df2739a2b0ac72519962a1b12dc08", "score": "0.56747156", "text": "func (o GetDomainClusterConfigOutput) InstanceCount() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetDomainClusterConfig) int { return v.InstanceCount }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "ef0080917f6ba49c5f15f8bda07f4c10", "score": "0.5487821", "text": "func (o DomainClusterConfigOutput) InstanceCount() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v DomainClusterConfig) *int { return v.InstanceCount }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "653453d81434b04df228d8f26c7f119b", "score": "0.5470787", "text": "func (p *multiResourcePool) NumActive() int32 {\n\ttotal := int32(0)\n\n\tp.rwMutex.RLock()\n\tdefer p.rwMutex.RUnlock()\n\n\tfor _, pool := range p.locationPools {\n\t\ttotal += pool.NumActive()\n\t}\n\treturn total\n}", "title": "" }, { "docid": "69f0df2583f17ceb5da45da08bdb8ae4", "score": "0.5377259", "text": "func GetNumaDomainHwthreads(domain int) []int {\n\tall := CpuData()\n\tcpulist := make([]int, 0)\n\tfor _, d := range all {\n\t\tif d.Numadomain == domain {\n\t\t\tcpulist = append(cpulist, d.Cpuid)\n\t\t}\n\t}\n\treturn cpulist\n}", "title": "" }, { "docid": "f8ec3e55e405bfa0068281e7f1dc43df", "score": "0.5367026", "text": "func (o ResourcePolicyGroupPlacementPolicyPtrOutput) AvailabilityDomainCount() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *ResourcePolicyGroupPlacementPolicy) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.AvailabilityDomainCount\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "2f82c693d2490845c896a9484f5db4fc", "score": "0.5312703", "text": "func (p *ResourcePool) Count() uint {\n\treturn p.inUse + p.AvailableNow()\n}", "title": "" }, { "docid": "d7960bafbfeaa9b7042d3a3662f1d180", "score": "0.5289018", "text": "func (mtr *IPv4FlowPerformanceMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.Instances.Size()\n\n\tsz += mtr.PeakPps.Size()\n\n\tsz += mtr.PeakPpsTimestamp.Size()\n\n\tsz += mtr.PeakBw.Size()\n\n\tsz += mtr.PeakBwTimestamp.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "68bf992d55ff591e3dcace3b4a75585f", "score": "0.52511173", "text": "func (mtr *IPv4FlowBehavioralMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.Instances.Size()\n\n\tsz += mtr.PpsThreshold.Size()\n\n\tsz += mtr.PpsThresholdExceedEvents.Size()\n\n\tsz += mtr.PpsThresholdExceedEventFirstTimestamp.Size()\n\n\tsz += mtr.PpsThresholdExceedEventLastTimestamp.Size()\n\n\tsz += mtr.BwThreshold.Size()\n\n\tsz += mtr.BwThresholdExceedEvents.Size()\n\n\tsz += mtr.BwThresholdExceedEventFirstTimestamp.Size()\n\n\tsz += mtr.BwThresholdExceedEventLastTimestamp.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "d1647b99b1d04bbc5e5759251075c675", "score": "0.52283406", "text": "func (mtr *IPv4FlowLatencyMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.Instances.Size()\n\n\tsz += mtr.MinSetupLatency.Size()\n\n\tsz += mtr.MinSetupLatencyTimestamp.Size()\n\n\tsz += mtr.MaxSetupLatency.Size()\n\n\tsz += mtr.MaxSetupLatencyTimestamp.Size()\n\n\tsz += mtr.MinRttLatency.Size()\n\n\tsz += mtr.MinRttLatencyTimestamp.Size()\n\n\tsz += mtr.MaxRttLatency.Size()\n\n\tsz += mtr.MaxRttLatencyTimestamp.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "133409493944c0bff231200f01da82fb", "score": "0.5222391", "text": "func (a Availability) Count() (count uint8) {\n\tcount = 0\n\tfor _, value := range a {\n\t\tcount += value\n\t}\n\treturn\n}", "title": "" }, { "docid": "fe7ba2fa85c0527383e8a3aadc04a7dd", "score": "0.5221614", "text": "func getOverlap(request OverlapReq) (numPages int) {\n\tworker1 := getOwner(request.URL1)\n\tworker2 := getOwner(request.URL2)\n\tnumPages = computeOverlap(worker1, request.URL1, worker2, request.URL2)\n\treturn\n}", "title": "" }, { "docid": "b670565e0e69c573dc92d3cd94de022b", "score": "0.51948386", "text": "func (d *Domain) AvailableRange() (int, int, []int) {\n\treturn d.min, d.max, d.available\n}", "title": "" }, { "docid": "5fa958b585cec54c00d2ec3e1245d6d6", "score": "0.5194102", "text": "func HostListSize(list []Host) int {\n\tsize := 0\n\tfor _, item := range list {\n\t\tsize += (4 + xgb.Pad((int(item.AddressLen) * 1)))\n\t}\n\treturn size\n}", "title": "" }, { "docid": "30d061b655a4cfde9c1a95e4ee4c4723", "score": "0.51819366", "text": "func (s *Server) numReservedAccounts() int {\n\treturn 1\n}", "title": "" }, { "docid": "873f1755616ef6d34d4d6eadd76af2ad", "score": "0.51596457", "text": "func TestNewIPv4Provider_getCapacity(t *testing.T) {\n\tcapacityLinux := getCapacity(instanceType, config.OSLinux)\n\tcapacityWindows := getCapacity(instanceType, config.OSWindows)\n\tcapacityUnknown := getCapacity(\"x.large\", \"linux\")\n\n\tassert.Zero(t, capacityUnknown)\n\t// IP(6) - 1(Primary) = 5\n\tassert.Equal(t, 5, capacityWindows)\n\t// (IP(6) - 1(Primary)) * 3(ENI) = 15\n\tassert.Equal(t, 15, capacityLinux)\n}", "title": "" }, { "docid": "2e6e23825809382d8568aefa58144d70", "score": "0.51569957", "text": "func (c *Client) NumAllocs() int {\n\tn := 0\n\tc.allocLock.RLock()\n\tfor _, a := range c.allocs {\n\t\tif !a.IsDestroyed() {\n\t\t\tn++\n\t\t}\n\t}\n\tc.allocLock.RUnlock()\n\treturn n\n}", "title": "" }, { "docid": "daf5e26a28fe300547fc9b2470efbedd", "score": "0.51416147", "text": "func (p *multiResourcePool) NumIdle() int {\n\ttotal := 0\n\n\tp.rwMutex.RLock()\n\tdefer p.rwMutex.RUnlock()\n\n\tfor _, pool := range p.locationPools {\n\t\ttotal += pool.NumIdle()\n\t}\n\treturn total\n}", "title": "" }, { "docid": "0dfc4230a3b0f2576303f23a1c548964", "score": "0.51375103", "text": "func (audit *RDSSnapshotAudit) NumRunningInstances() int {\n\treturn len(audit.Instances)\n}", "title": "" }, { "docid": "5c69daf66c850bcbcca16da46f1452ca", "score": "0.5133981", "text": "func (ins instances) Len() int { return len(ins) }", "title": "" }, { "docid": "e280b556929753f0809a7bffed3eb94f", "score": "0.51074904", "text": "func intervalSize(ri *model.ReachabilityInterval) uint64 {\n\treturn ri.End - ri.Start + 1\n}", "title": "" }, { "docid": "bd05aaf4c953ef5483591d7508c463ec", "score": "0.5107029", "text": "func AddressCount(network *net.IPNet) uint64 {\n\tprefixLen, bits := network.Mask.Size()\n\treturn 1 << (uint64(bits) - uint64(prefixLen))\n}", "title": "" }, { "docid": "f06eff48cbc3ef5cfacd6dc623f5040e", "score": "0.5100787", "text": "func (p *MeituResourcePool) NumActive() int32 {\n\treturn atomic.LoadInt32(p.numActive)\n}", "title": "" }, { "docid": "d3dabd54f9632189a2276add0829fa35", "score": "0.50780535", "text": "func (s *Server) NumActiveAccounts() int32 {\n\treturn atomic.LoadInt32(&s.activeAccounts)\n}", "title": "" }, { "docid": "62493abcca11d8859a10c504f3ddcdcc", "score": "0.5058635", "text": "func (s *MinLSSelector) Size() int {\n\treturn len(s.unknownSessions) + s.knownSessions.Len()\n}", "title": "" }, { "docid": "01ac846a35bba496118998297c182043", "score": "0.5054315", "text": "func (s *VitessShardSpec) MasterEligibleTabletCount() int32 {\n\tcount := int32(0)\n\tfor poolIndex := range s.TabletPools {\n\t\tpool := &s.TabletPools[poolIndex]\n\t\tif pool.Type == ReplicaPoolType || pool.Type == ExternalMasterPoolType {\n\t\t\tcount += pool.Replicas\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "29690bab6b7f764a5247343b531451c1", "score": "0.50441474", "text": "func (s *commonDevopsSimulator) adjustNumHostsForEpoch() {\n\ts.epoch++\n\tmissingScale := float64(uint64(len(s.hosts)) - s.initHosts)\n\ts.epochHosts = s.initHosts + uint64(missingScale*float64(s.epoch)/float64(s.epochs-1))\n}", "title": "" }, { "docid": "8c1e10f35f57bf145efa48f01ccfd7e4", "score": "0.50369155", "text": "func (mtr *L2FlowPerformanceMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.Instances.Size()\n\n\tsz += mtr.PeakPps.Size()\n\n\tsz += mtr.PeakPpsTimestamp.Size()\n\n\tsz += mtr.PeakBw.Size()\n\n\tsz += mtr.PeakBwTimestamp.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "2105a01360ec92ccbfab16f22cffc4ae", "score": "0.5030663", "text": "func computeOverlap(req ComputeOverlapReq) (numPages int) {\n\t// set global variables\n\tvisitedForOverlap = make(map[string]bool)\n\tnumOverlapPages = 0\n\tthisDomain := getDomain(req.URL1)\n\ttargetDomain := getDomain(req.URL2)\n\townerURL2Ip := req.OwnerURL2.Ip\n\tfindEntryPoint(req.URL1, thisDomain, targetDomain, req.URL2, ownerURL2Ip)\n\tnumPages = numOverlapPages\n\tif req.FullOverlap {\n\t\tnumPages += computePartialOverlap(req)\n\t}\n\treturn\n}", "title": "" }, { "docid": "4e3537981b9fb123c1471c22c76edad9", "score": "0.5027992", "text": "func (exec *Executor) HostCount() int {\n\tif exec.Parameter.HostInfoList != nil {\n\t\treturn len(exec.Parameter.HostInfoList)\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "e78a25f68ec3011c2293f9df7689f6bf", "score": "0.5026653", "text": "func NUMANodeCount() int {\n\t// this is the correct flag name (not defined in the unix package)\n\t//nolint:revive\n\tMPOL_F_MEMS_ALLOWED := (1 << 2)\n\tvar mask [1024 / 64]uintptr\n\t_, _, err := unix.RawSyscall6(unix.SYS_GET_MEMPOLICY, 0, uintptr(unsafe.Pointer(&mask[0])), uintptr(len(mask)*8), 0, uintptr(MPOL_F_MEMS_ALLOWED), 0)\n\tif err != 0 {\n\t\treturn 0\n\t}\n\n\t// For every available thread a bit is set in the mask.\n\tnmem := 0\n\tfor _, e := range mask {\n\t\tif e == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tnmem += int(popcnt(uint64(e)))\n\t}\n\treturn nmem\n}", "title": "" }, { "docid": "5c02bf35a32f089f1052b1b20c9c1c0b", "score": "0.5008962", "text": "func (c *Controller) DomainsCount(filters *DomainsCountFilters) (nbDomains int, err error) {\n\treturn c.DomainsCountCtx(context.Background(), filters)\n}", "title": "" }, { "docid": "0eba5ada3ed375328377349c650da8f1", "score": "0.50045246", "text": "func (mtr *IPv6FlowPerformanceMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.Instances.Size()\n\n\tsz += mtr.PeakPps.Size()\n\n\tsz += mtr.PeakPpsTimestamp.Size()\n\n\tsz += mtr.PeakBw.Size()\n\n\tsz += mtr.PeakBwTimestamp.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "003fbf600eb0c44efad7ae6372a660ca", "score": "0.49841717", "text": "func (mtr *IPv6FlowBehavioralMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.Instances.Size()\n\n\tsz += mtr.PpsThreshold.Size()\n\n\tsz += mtr.PpsThresholdExceedEvents.Size()\n\n\tsz += mtr.PpsThresholdExceedEventFirstTimestamp.Size()\n\n\tsz += mtr.PpsThresholdExceedEventLastTimestamp.Size()\n\n\tsz += mtr.BwThreshold.Size()\n\n\tsz += mtr.BwThresholdExceedEvents.Size()\n\n\tsz += mtr.BwThresholdExceedEventFirstTimestamp.Size()\n\n\tsz += mtr.BwThresholdExceedEventLastTimestamp.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "e87d1bd195bfaf4f09df04d62d39f810", "score": "0.49786893", "text": "func DynamicShardSize(value float64, numInstances int) int {\n\tvar shardSize = int(math.Ceil(value))\n\tif value < 1 {\n\t\tshardSize = int(math.Ceil(float64(numInstances) * value))\n\t}\n\treturn shardSize\n}", "title": "" }, { "docid": "68429ec77efa67876ea35061170a3510", "score": "0.4976817", "text": "func (p *Pool) Size() int {\n\treturn len(p.vms)\n}", "title": "" }, { "docid": "52d92bcbfd1d9b79c1c7681a1c582d48", "score": "0.49683547", "text": "func (pgb *ChainDB) NumAddressIntervals(addr string, grouping dbtypes.TimeBasedGrouping) (int64, error) {\n\tif grouping >= dbtypes.NumIntervals {\n\t\treturn 0, fmt.Errorf(\"invalid time grouping %d\", grouping)\n\t}\n\tctx, cancel := context.WithTimeout(pgb.ctx, pgb.queryTimeout)\n\tdefer cancel()\n\treturn retrieveAddressTxsCount(ctx, pgb.db, addr, grouping.String())\n}", "title": "" }, { "docid": "108d31aa48c84f759121aa18c14ade1b", "score": "0.49665344", "text": "func (o DomainClusterConfigPtrOutput) InstanceCount() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *DomainClusterConfig) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.InstanceCount\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "4753f182092a8fe6027f34fb28cabd92", "score": "0.49491635", "text": "func (p *BasePool) ReservesA() sdkmath.Int {\n\treturn p.reservesA\n}", "title": "" }, { "docid": "b87edce137cc204212964592a47fe33f", "score": "0.49465382", "text": "func (o GetDomainClusterConfigZoneAwarenessConfigOutput) AvailabilityZoneCount() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetDomainClusterConfigZoneAwarenessConfig) int { return v.AvailabilityZoneCount }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "f331da76cc3445f695fbc08c4183117d", "score": "0.49367854", "text": "func (o *ApplicationResponse) GetMaxRunningInstances() int32 {\n\tif o == nil || o.MaxRunningInstances == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.MaxRunningInstances\n}", "title": "" }, { "docid": "a73893e1ff607cf5493eca2ad9825495", "score": "0.49341074", "text": "func poolsize() int {\n\tswitch maxprocs := runtime.GOMAXPROCS(0); maxprocs {\n\tcase 1:\n\t\treturn 1\n\tcase 2:\n\t\treturn 1\n\tcase 3:\n\t\treturn 2\n\tdefault:\n\t\treturn maxprocs - 2\n\t}\n}", "title": "" }, { "docid": "9b1ab89c6b591e174263488bf0ac550a", "score": "0.49283317", "text": "func countReachableNodes(nfa *nFA) int {\n\treturn countReachableNodesHelper(nfa.Start, newEpoch())\n}", "title": "" }, { "docid": "552e7adf80a64a26dd00a2c03640f219", "score": "0.49263296", "text": "func (self *Domain) Count() (int64, error) {\n\tvar result int64\n\tparams := []interface{}{self.Key}\n\tif err := self.Call(\"domain.count\", params, &result); err != nil {\n\t\treturn -1, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "2ac9bf469bab92ca7a4b0f3d98a47a7d", "score": "0.49210757", "text": "func (mtr *L2FlowBehavioralMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.Instances.Size()\n\n\tsz += mtr.PpsThreshold.Size()\n\n\tsz += mtr.PpsThresholdExceedEvents.Size()\n\n\tsz += mtr.PpsThresholdExceedEventFirstTimestamp.Size()\n\n\tsz += mtr.PpsThresholdExceedEventLastTimestamp.Size()\n\n\tsz += mtr.BwThreshold.Size()\n\n\tsz += mtr.BwThresholdExceedEvents.Size()\n\n\tsz += mtr.BwThresholdExceedEventFirstTimestamp.Size()\n\n\tsz += mtr.BwThresholdExceedEventLastTimestamp.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "82443473deb35a82ada407a0b2b69879", "score": "0.49173564", "text": "func (hosts *Hosts) CountWorkers() int {\n\n\t// init the counter\n\tcounter := 0\n\n\t// loop over hosts\n\tfor _, host := range hosts.Hosts {\n\t\t// increment if the host is a worker as defined before.\n\t\tif host.IsWorker() {\n\t\t\tcounter++\n\t\t}\n\t}\n\n\t// return the counter\n\treturn counter\n}", "title": "" }, { "docid": "4e29466235bca7b206a38ae9c29552a2", "score": "0.49053168", "text": "func (px *Paxos) Max() int {\n max := -1\n for instanceNumber, _ := range px.instances {\n if max < instanceNumber {\n max = instanceNumber\n }\n }\n\n return max\n}", "title": "" }, { "docid": "b78cfa6cced2e44375cca1987e19c6d6", "score": "0.49009567", "text": "func (i *InstancesCrawler) Count() int {\n\treturn i.count\n}", "title": "" }, { "docid": "dcfcae69266d6fe9512dba5891272928", "score": "0.48993328", "text": "func ShuffleShardExpectedInstancesPerZone(shardSize, numZones int) int {\n\treturn int(math.Ceil(float64(shardSize) / float64(numZones)))\n}", "title": "" }, { "docid": "23799a699e6e173985831ca3589f0db6", "score": "0.4893853", "text": "func computeOverlap(ownerUrl1 Worker, url1 string, ownerUrl2 Worker, url2 string) (numPages int) {\n\twIpPort := getWorkerIpPort(ownerUrl1)\n\treq := ComputeOverlapReq{true, ownerUrl1, url1, ownerUrl2, url2}\n\tclient, err := rpc.Dial(\"tcp\", wIpPort)\n\tcheckError(\"rpc.Dial in computeOverlap()\", err, true)\n\terr = client.Call(\"WorkerRPC.ComputeOverlap\", req, &numPages)\n\tcheckError(\"client.Call(WorkerRPC.ComputeOverlap: \", err, true)\n\terr = client.Close()\n\tcheckError(\"client.Close() in computeOverlap(): \", err, true)\n\treturn\n}", "title": "" }, { "docid": "54ea9d5976b8dc4a346255df429a2793", "score": "0.4888921", "text": "func (a Address) DynamicCount() int {\n\treturn int(C.addr_cnt(a.wrap)) // dyncnt union\n}", "title": "" }, { "docid": "84f2f00e530665a0dd462fc4ca08d3eb", "score": "0.48862004", "text": "func (mtr *IPv6FlowLatencyMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.Instances.Size()\n\n\tsz += mtr.MinSetupLatency.Size()\n\n\tsz += mtr.MinSetupLatencyTimestamp.Size()\n\n\tsz += mtr.MaxSetupLatency.Size()\n\n\tsz += mtr.MaxSetupLatencyTimestamp.Size()\n\n\tsz += mtr.MinRttLatency.Size()\n\n\tsz += mtr.MinRttLatencyTimestamp.Size()\n\n\tsz += mtr.MaxRttLatency.Size()\n\n\tsz += mtr.MaxRttLatencyTimestamp.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "157fce357a99899445cecaa513e6ea2a", "score": "0.48735902", "text": "func (ng *ngStore) AutoInstances() (name, uuid string, n int) {\n\tif ng.instance != \"\" {\n\t\tname = ng.instance\n\t\tuuid = ng.uuid\n\t\tn = len(ng.vol.Scales)\n\t}\n\treturn\n}", "title": "" }, { "docid": "74fa6f42dd8e23cb697aed9b249e4740", "score": "0.486487", "text": "func (o DomainClusterConfigZoneAwarenessConfigOutput) AvailabilityZoneCount() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v DomainClusterConfigZoneAwarenessConfig) *int { return v.AvailabilityZoneCount }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "cf62518626dbc5bb2d94b036dfccee6a", "score": "0.4861669", "text": "func (self *Config) maximally_loaded() (gid int64, load int) {\n loads := self.get_loads()\n var max_load_gid int64 = 0 // repica gids are int64 (o is default non-valid gid)\n var max_load = 0 // non-valid RG 0 is not actually responsible for shards.\n\n for gid, shard_count := range loads {\n if shard_count > max_load {\n max_load = shard_count\n max_load_gid = gid\n }\n }\n return max_load_gid, max_load\n}", "title": "" }, { "docid": "18b5be29e27a1466302f61416e626850", "score": "0.48616558", "text": "func (s *Subnet) UsingIPCount() int {\n\treturn s.UsingIPs.Count() - s.ReservedIPCount\n}", "title": "" }, { "docid": "8207ea47611e510d53d1c148d86978cf", "score": "0.48554647", "text": "func (px *Paxos) Max() int {\n\tfor px.recovering && !px.dead {\n\t\ttime.Sleep(10 * time.Millisecond)\n\t}\n\treturn px.maxInstance\n}", "title": "" }, { "docid": "ee36068767601d03ce91f031d8a21b98", "score": "0.48533806", "text": "func ShuffleShardExpectedInstances(shardSize, numZones int) int {\n\treturn ShuffleShardExpectedInstancesPerZone(shardSize, numZones) * numZones\n}", "title": "" }, { "docid": "478b59dd099e0cc86713d47924b8339d", "score": "0.48529515", "text": "func CPUCount() int {\n\treturn nconfiguredcpu\n}", "title": "" }, { "docid": "2258c577c58a594800993087950393cb", "score": "0.4849502", "text": "func (rp *ResourcePool) NumResources() int {\n\trp.mutex.Lock()\n\tnr := rp.numResources\n\trp.mutex.Unlock()\n\treturn nr\n}", "title": "" }, { "docid": "0060336709c6ae779be840fa7a246f97", "score": "0.4845357", "text": "func tieredStreamAndReservationCount(asa map[string]*streamAssignment, tier string, cfg *StreamConfig) (int, int64) {\n\tnumStreams := len(asa)\n\treservation := int64(0)\n\tif tier == _EMPTY_ {\n\t\tfor _, sa := range asa {\n\t\t\tif sa.Config.MaxBytes > 0 && sa.Config.Name != cfg.Name {\n\t\t\t\tif sa.Config.Storage == cfg.Storage {\n\t\t\t\t\treservation += (int64(sa.Config.Replicas) * sa.Config.MaxBytes)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tnumStreams = 0\n\t\tfor _, sa := range asa {\n\t\t\tif isSameTier(sa.Config, cfg) {\n\t\t\t\tnumStreams++\n\t\t\t\tif sa.Config.MaxBytes > 0 {\n\t\t\t\t\tif sa.Config.Storage == cfg.Storage && sa.Config.Name != cfg.Name {\n\t\t\t\t\t\treservation += (int64(sa.Config.Replicas) * sa.Config.MaxBytes)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn numStreams, reservation\n}", "title": "" }, { "docid": "74582cde80742b5f07de51421deafe8d", "score": "0.48412588", "text": "func effectiveHostLimit(f *hostsvc.HostFilter) uint32 {\n\tlimit := f.GetQuantity().GetMaxHosts()\n\tif limit == 0 {\n\t\tlimit = math.MaxUint32\n\t}\n\treturn limit\n}", "title": "" }, { "docid": "97f8da63cf6cc3241796c522a9394983", "score": "0.48375174", "text": "func (s *Shoot) GetNodeCount() int {\n\tnodeCount := 0\n\tfor _, worker := range s.GetWorkers() {\n\t\tnodeCount += worker.AutoScalerMax\n\t}\n\treturn nodeCount\n}", "title": "" }, { "docid": "90cbcd422aa1c40e5a634ae3f39be5e0", "score": "0.4829814", "text": "func (a Available) AvailableRange(t *Torrent, offset int64, length int64) int {\n\tr := math.MaxInt32\n\tps := int64(t.Pieces.PieceSize())\n\tfor i := int(offset / ps); i <= int((offset+length-1)/ps); i++ {\n\t\tav := a.Available(i)\n\t\tif r > av {\n\t\t\tr = av\n\t\t}\n\t}\n\treturn r\n}", "title": "" }, { "docid": "d2321a9c3bef4481f4589be919937391", "score": "0.4826545", "text": "func (s *Server) numAccounts() int {\n\tcount := 0\n\ts.mu.RLock()\n\ts.accounts.Range(func(k, v interface{}) bool {\n\t\tcount++\n\t\treturn true\n\t})\n\ts.mu.RUnlock()\n\treturn count\n}", "title": "" }, { "docid": "72cf0bd1b15a15f9cefdcc083faa3733", "score": "0.48110002", "text": "func (p *Pool) ActiveCount() int {\n\tp.mu.Lock()\n\tactive := p.active\n\tp.mu.Unlock()\n\treturn active\n}", "title": "" }, { "docid": "a8d9f592e591eaa3c8b120fe1164ba12", "score": "0.48064974", "text": "func (o RegionBackendServiceBackendOutput) MaxConnectionsPerInstance() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v RegionBackendServiceBackend) *int { return v.MaxConnectionsPerInstance }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "57da13f0896ae3709cd9a25c9e95beb2", "score": "0.48012474", "text": "func (b IPPool) NumAddresses() int {\n\t_, cidr, _ := cnet.ParseCIDR(b.Spec.CIDR)\n\tones, size := cidr.Mask.Size()\n\tnumAddresses := 1 << uint(size-ones)\n\treturn numAddresses\n}", "title": "" }, { "docid": "2c7e2a235db23867f40348f28ca451fd", "score": "0.4799735", "text": "func getHPAMaxReplicas(scaledObject *kedav1alpha1.ScaledObject) int32 {\n\tif scaledObject.Spec.MaxReplicaCount != nil {\n\t\treturn *scaledObject.Spec.MaxReplicaCount\n\t}\n\treturn defaultHPAMaxReplicas\n}", "title": "" }, { "docid": "748cf7e5576f80a337d17a298cfb9257", "score": "0.47917923", "text": "func (ars AddrRangeSeq) NumRanges() int {\n\treturn ars.length\n}", "title": "" }, { "docid": "da8bad341a9959dd3eca49afa7bf321b", "score": "0.47883075", "text": "func (p *ResourcePool) AvailableMax() uint {\n\treturn p.Cap() - p.inUse\n}", "title": "" }, { "docid": "9ecdbb2ffb8c14cf85cbb993b2e47648", "score": "0.4783548", "text": "func (api *Instance) ProcessCount() uint32 {\n\treturn api.processCount\n}", "title": "" }, { "docid": "d45ecb41d5a2ebfa29a1ed775c3f7391", "score": "0.47817302", "text": "func (mux *Muxer) AvailableConns() (connCount int) {\n\tconnCount = len(mux.conns)\n\tlastID := atomic.LoadInt32(&mux.connLastID)\n\tif lastID < int32(MaxConnID) {\n\t\tconnCount += int(int32(MaxConnID) - lastID)\n\t}\n\treturn\n}", "title": "" }, { "docid": "bbdefa30e893f1e6114037cc9b294be9", "score": "0.47786286", "text": "func (c *Cloud) Instances() (cloudprovider.Instances, bool) { return c, true }", "title": "" }, { "docid": "2b4bfed6ef240ecdf6ad0153c6ad147e", "score": "0.4777368", "text": "func (o BackendServiceBackendOutput) MaxConnectionsPerInstance() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BackendServiceBackend) *int { return v.MaxConnectionsPerInstance }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "31024fba7a59f1baca35fef3aa1b60af", "score": "0.4777017", "text": "func getMinimumNodes(sc *ocsv1.StorageCluster) int {\n\t// Case 1: When replicasPerFailureDomain is 1.\n\t// A node is the smallest failure domain that is possible. We definitely\n\t// want the devices in the same device set to be in different failure\n\t// domains which also means different nodes. In this case, minimum number of\n\t// nodes is getMinDeviceSetReplica() * 1.\n\n\t// Case 2: When replicasPerFailureDomain is greater than 1\n\t// In certain scenarios, it may be valid to place one or more replicas\n\t// within the failure domain on the same node but it does not make much\n\t// sense. It provides protection only against disk failures and not node\n\t// failures.\n\t// For example:\n\t// a. FailureDomain=node, replicasPerFailureDomain>1\n\t// b. FailureDomain=rack, numNodesInTheRack=2, replicasPerFailureDomain>2\n\t// c. FailureDomain=zone, numNodesInTheZone=2, replicasPerFailureDomain>2\n\t// Therefore, we make an assumption that the replicas must be placed on\n\t// different nodes. This logic gets us to the equation below. If the user\n\t// needs to override this assumption, we can provide a flag (like\n\t// allowReplicasOnSameNode) in the future.\n\n\tmaxReplica := getMinDeviceSetReplica(sc) * getReplicasPerFailureDomain(sc)\n\n\tfor _, deviceSet := range sc.Spec.StorageDeviceSets {\n\t\tif deviceSet.Replica > maxReplica {\n\t\t\tmaxReplica = deviceSet.Replica\n\t\t}\n\t}\n\n\treturn maxReplica\n}", "title": "" }, { "docid": "3c45b421c012e7e07dfb8d2ce876671a", "score": "0.47761646", "text": "func (dp DynamicPool) AvailMilliCpus() int {\n\treturn dp.Cpus.Size() * 1000\n}", "title": "" }, { "docid": "d274f99922df003fc114b4e1fb64c58a", "score": "0.4768386", "text": "func (r ReplicationSet) GetNumOfZones() int {\n\tset := make(map[string]struct{})\n\tfor _, instance := range r.Instances {\n\t\tset[instance.GetZone()] = struct{}{}\n\t}\n\treturn len(set)\n}", "title": "" }, { "docid": "1b47bfb960916b16d11a2af5442e2a42", "score": "0.47531188", "text": "func (p *processor) MaxConcurent() int { return 1 }", "title": "" }, { "docid": "db90bd5b3121eac566580b0c62953491", "score": "0.47484568", "text": "func (s *registrationServiceImpl) GetRegisteredAgentsSize() uint16 {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\treturn uint16(s.externalAgents.Size()) + uint16(s.internalAgents.Size())\n}", "title": "" }, { "docid": "71b6486b323ac5fdf3aad15c159e7038", "score": "0.4744933", "text": "func (r *Reservation) Guests() int { return 1 + r.AccompanyingGuests }", "title": "" }, { "docid": "1e3e6e5baa20c7aa4babb948cd62c32b", "score": "0.47352386", "text": "func getCephPoolReplicatedSize(sc *ocsv1.StorageCluster) uint {\n\tif arbiterEnabled(sc) {\n\t\treturn uint(4)\n\t}\n\treturn uint(3)\n}", "title": "" }, { "docid": "26409ea3d2322d1712bdc013fb7dc050", "score": "0.47346607", "text": "func getNetworkStats() uint {\n\tret := uint(len(dhcpLeases))\n\tglobalStatus.Connected_Users = ret\n\treturn ret\n}", "title": "" }, { "docid": "061c35fc56a31b0ab8a33e543e3f6264", "score": "0.47342432", "text": "func (o FlexibleAppVersionManualScalingOutput) Instances() pulumi.IntOutput {\n\treturn o.ApplyT(func(v FlexibleAppVersionManualScaling) int { return v.Instances }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "dd0b8043a030692962fd32e6f7b1b0d7", "score": "0.47342283", "text": "func (mtr *IPv4FlowRawMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.Instances.Size()\n\n\tsz += mtr.Packets.Size()\n\n\tsz += mtr.Bytes.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "8de6a6231a657686b2b970386d95fbc4", "score": "0.4734142", "text": "func IncrementEgressFirewallCount() {\n\tmetricEgressFirewallCount.Inc()\n}", "title": "" }, { "docid": "66a7aa2fc1f1257a1e5df63cad7a36a8", "score": "0.47292915", "text": "func (px *Paxos) Max() int {\n // Your code here.\n px.mu.Lock()\n defer px.mu.Unlock()\n max := -1\n for i := range px.instances {\n if i > max {\n max = i\n }\n }\n return max\n}", "title": "" }, { "docid": "aea207608b829e3d1b3ea748da7f98ea", "score": "0.47264713", "text": "func (p *Pool) RunningWorkers() int {\n\treturn p.AtCapacity\n}", "title": "" }, { "docid": "0207ddba29493d3b27ff580dd121eb15", "score": "0.47188258", "text": "func (mtr *IPv4FlowDropMetrics) Size() int {\n\tsz := 0\n\n\tsz += mtr.Instances.Size()\n\n\tsz += mtr.DropPackets.Size()\n\n\tsz += mtr.DropBytes.Size()\n\n\tsz += mtr.DropFirstTimestamp.Size()\n\n\tsz += mtr.DropLastTimestamp.Size()\n\n\tsz += mtr.DropReason.Size()\n\n\treturn sz\n}", "title": "" }, { "docid": "c25e0a915c1c4ae336d200fd9521a060", "score": "0.47091863", "text": "func (cp *ConnectionPool) Available() int64 {\n\tp := cp.pool()\n\tif p == nil {\n\t\treturn 0\n\t}\n\treturn p.Available()\n}", "title": "" }, { "docid": "c25e0a915c1c4ae336d200fd9521a060", "score": "0.47091863", "text": "func (cp *ConnectionPool) Available() int64 {\n\tp := cp.pool()\n\tif p == nil {\n\t\treturn 0\n\t}\n\treturn p.Available()\n}", "title": "" }, { "docid": "f9c67c9b09d9e38889f8a35e6621402a", "score": "0.4704044", "text": "func (s *Server) NumLoadedAccounts() int {\n\treturn s.numAccounts()\n}", "title": "" }, { "docid": "64077fd40d6bd8c2d7241272ff9420b7", "score": "0.4704039", "text": "func TestMany(t *testing.T) {\n\truntime.GOMAXPROCS(4)\n\n\tfmt.Printf(\"Test: Many instances ...\\n\")\n\n\tconst npaxos = 3\n\tvar pxa []*Paxos = make([]*Paxos, npaxos)\n\tvar pxh []string = make([]string, npaxos)\n\tdefer cleanup(pxa)\n\n\tfor i := 0; i < npaxos; i++ {\n\t\tpxh[i] = port(i)\n\t}\n\tfor i := 0; i < npaxos; i++ {\n\t\tpxa[i] = NewPaxos(pxh, i, nil)\n\t\tpxa[i].Start(0, 0)\n\t}\n\n\tconst ninst = 50\n\tfor seq := 1; seq < ninst; seq++ {\n\t\t// only 5 active instances\n\t\tfor seq >= 5 && ndecided(t, pxa, seq-5) < npaxos {\n\t\t\ttime.Sleep(20 * time.Millisecond)\n\t\t}\n\t\tfor i := 0; i < npaxos; i++ {\n\t\t\tpxa[i].Start(seq, (seq*10)+i)\n\t\t}\n\t}\n\n\tfor {\n\t\tdone := true\n\t\tfor seq := 1; seq < ninst; seq++ {\n\t\t\tif ndecided(t, pxa, seq) < npaxos {\n\t\t\t\tdone = false\n\t\t\t}\n\t\t}\n\t\tif done {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(100 * time.Millisecond)\n\t}\n\n\tfmt.Printf(\" ... Passed\\n\")\n}", "title": "" }, { "docid": "b54b11e0f9d84330e29b9464c8118ab8", "score": "0.4700909", "text": "func GetNumNodes() int {\n\tfor i := 0; i < 2000; i++ {\n\t\tdir, err := IpfsDirN(i)\n\t\tif err != nil {\n\t\t\treturn i\n\t\t}\n\t\t_, err = os.Stat(dir)\n\t\tif os.IsNotExist(err) {\n\t\t\treturn i\n\t\t}\n\t}\n\tpanic(\"i dont know whats going on\")\n}", "title": "" }, { "docid": "be0c5229ff7df9c9013bb976071c93f7", "score": "0.46994588", "text": "func (px *Paxos) Max() int {\n\t// Your code here.\n px.mu.Lock()\n max := 0\n for k, _ := range px.instances {\n if k > max {\n max = k\n }\n }\n px.mu.Unlock()\n\treturn max\n}", "title": "" }, { "docid": "11bca802f44a05f3b75938fe12e095a8", "score": "0.4695969", "text": "func NoOfCores() {\n\tfmt.Println(runtime.NumCPU())\n}", "title": "" }, { "docid": "2a5b8c2f207bcbf95a07416ec81a794f", "score": "0.4683229", "text": "func (rs *Regions) AvailableAddrs() int {\n\treturn rs.region1.AvailableAddrs() + rs.region2.AvailableAddrs()\n}", "title": "" }, { "docid": "bc63a08870752a059ec624527384f8fe", "score": "0.46782058", "text": "func (p *ZDBPool) Reserved() (uint64, error) {\n\tns, err := p.Namespaces()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tvar total uint64\n\tfor _, n := range ns {\n\t\ttotal += uint64(n.Size)\n\t}\n\n\treturn total, nil\n}", "title": "" } ]
1cec8b1cc7c725bf8eadfec33da02a79
WriteToRequest writes these params to a swagger request
[ { "docid": "290338a591ca57fcdf413ecbbb2d7c7d", "score": "0.0", "text": "func (o *GetMsgVpnBridgeRemoteMsgVpnParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param bridgeName\n\tif err := r.SetPathParam(\"bridgeName\", o.BridgeName); err != nil {\n\t\treturn err\n\t}\n\n\t// path param bridgeVirtualRouter\n\tif err := r.SetPathParam(\"bridgeVirtualRouter\", o.BridgeVirtualRouter); err != nil {\n\t\treturn err\n\t}\n\n\t// path param msgVpnName\n\tif err := r.SetPathParam(\"msgVpnName\", o.MsgVpnName); err != nil {\n\t\treturn err\n\t}\n\n\t// path param remoteMsgVpnInterface\n\tif err := r.SetPathParam(\"remoteMsgVpnInterface\", o.RemoteMsgVpnInterface); err != nil {\n\t\treturn err\n\t}\n\n\t// path param remoteMsgVpnLocation\n\tif err := r.SetPathParam(\"remoteMsgVpnLocation\", o.RemoteMsgVpnLocation); err != nil {\n\t\treturn err\n\t}\n\n\t// path param remoteMsgVpnName\n\tif err := r.SetPathParam(\"remoteMsgVpnName\", o.RemoteMsgVpnName); err != nil {\n\t\treturn err\n\t}\n\n\tvaluesSelect := o.Select\n\n\tjoinedSelect := swag.JoinByFormat(valuesSelect, \"csv\")\n\t// query array param select\n\tif err := r.SetQueryParam(\"select\", joinedSelect...); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "bc757c2e0f9ad8aa5a73cbd1184bdc06", "score": "0.7469954", "text": "func (o *AddParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param containerDescriptor\n\tif err := r.SetPathParam(\"containerDescriptor\", o.ContainerDescriptor); err != nil {\n\t\treturn err\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param subjectDescriptor\n\tif err := r.SetPathParam(\"subjectDescriptor\", o.SubjectDescriptor); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "979e917ac27456c54553009826b153ff", "score": "0.7329633", "text": "func (o *WeaviateThingsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param thingId\n\tif err := r.SetPathParam(\"thingId\", o.ThingID.String()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a3bffede9447fa9af6d4bac5d0d1153c", "score": "0.72438365", "text": "func (o *UpdateDeviceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.End != nil {\n\n\t\t// query param end\n\t\tvar qrEnd int64\n\t\tif o.End != nil {\n\t\t\tqrEnd = *o.End\n\t\t}\n\t\tqEnd := swag.FormatInt64(qrEnd)\n\t\tif qEnd != \"\" {\n\t\t\tif err := r.SetQueryParam(\"end\", qEnd); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt32(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\tif o.NetflowFilter != nil {\n\n\t\t// query param netflowFilter\n\t\tvar qrNetflowFilter string\n\t\tif o.NetflowFilter != nil {\n\t\t\tqrNetflowFilter = *o.NetflowFilter\n\t\t}\n\t\tqNetflowFilter := qrNetflowFilter\n\t\tif qNetflowFilter != \"\" {\n\t\t\tif err := r.SetQueryParam(\"netflowFilter\", qNetflowFilter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.OpType != nil {\n\n\t\t// query param opType\n\t\tvar qrOpType string\n\t\tif o.OpType != nil {\n\t\t\tqrOpType = *o.OpType\n\t\t}\n\t\tqOpType := qrOpType\n\t\tif qOpType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"opType\", qOpType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Start != nil {\n\n\t\t// query param start\n\t\tvar qrStart int64\n\t\tif o.Start != nil {\n\t\t\tqrStart = *o.Start\n\t\t}\n\t\tqStart := swag.FormatInt64(qrStart)\n\t\tif qStart != \"\" {\n\t\t\tif err := r.SetQueryParam(\"start\", qStart); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "91cdafde29b5414b6d330acab5fb6ee0", "score": "0.7236036", "text": "func (o *SchemaGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Model != nil {\n\n\t\t// query param model\n\t\tvar qrModel string\n\t\tif o.Model != nil {\n\t\t\tqrModel = *o.Model\n\t\t}\n\t\tqModel := qrModel\n\t\tif qModel != \"\" {\n\t\t\tif err := r.SetQueryParam(\"model\", qModel); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d67a9be6500fd72f60dc3c2fe8ec6d10", "score": "0.72251445", "text": "func (o *UpdateAPIParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.APIBody != nil {\n\t\tif err := r.SetBodyParam(o.APIBody); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param api\n\tif err := r.SetPathParam(\"api\", o.APIID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param tid\n\tif err := r.SetPathParam(\"tid\", o.Tid); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "86c96026372c72f0e11231dd14605329", "score": "0.71882373", "text": "func (o *GetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.IncludeActionResults != nil {\n\n\t\t// query param includeActionResults\n\t\tvar qrIncludeActionResults bool\n\t\tif o.IncludeActionResults != nil {\n\t\t\tqrIncludeActionResults = *o.IncludeActionResults\n\t\t}\n\t\tqIncludeActionResults := swag.FormatBool(qrIncludeActionResults)\n\t\tif qIncludeActionResults != \"\" {\n\t\t\tif err := r.SetQueryParam(\"includeActionResults\", qIncludeActionResults); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param iterationId\n\tif err := r.SetPathParam(\"iterationId\", swag.FormatInt32(o.IterationID)); err != nil {\n\t\treturn err\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param project\n\tif err := r.SetPathParam(\"project\", o.Project); err != nil {\n\t\treturn err\n\t}\n\n\t// path param runId\n\tif err := r.SetPathParam(\"runId\", swag.FormatInt32(o.RunID)); err != nil {\n\t\treturn err\n\t}\n\n\t// path param testCaseResultId\n\tif err := r.SetPathParam(\"testCaseResultId\", swag.FormatInt32(o.TestCaseResultID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "195939a35575300dcf2f9e0a9ac9b6f0", "score": "0.7173018", "text": "func (o *InspectParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\tif o.OpID != nil {\n\n\t\t// header param Op-ID\n\t\tif err := r.SetHeaderParam(\"Op-ID\", *o.OpID); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.Config == nil {\n\t\to.Config = new(models.TaskInspectConfig)\n\t}\n\n\tif err := r.SetBodyParam(o.Config); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "49fede1d339812a525ea55184235339d", "score": "0.7166819", "text": "func (o *GetServerForDeveloperParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param aid\n\tif err := r.SetPathParam(\"aid\", o.Aid); err != nil {\n\t\treturn err\n\t}\n\n\t// path param rid\n\tif err := r.SetPathParam(\"rid\", o.Rid); err != nil {\n\t\treturn err\n\t}\n\n\t// path param tid\n\tif err := r.SetPathParam(\"tid\", o.Tid); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a87d346055d9642b2ded03ccfed33de8", "score": "0.71342725", "text": "func (o *GetServiceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tvaluesInclude := o.Include\n\n\tjoinedInclude := swag.JoinByFormat(valuesInclude, \"multi\")\n\t// query array param include[]\n\tif err := r.SetQueryParam(\"include[]\", joinedInclude...); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "316541c5640552b80bb8047fb27d81e8", "score": "0.7113042", "text": "func (o *PostIntrospectionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// form param token\n\tfrToken := o.Token\n\tfToken := frToken\n\tif fToken != \"\" {\n\t\tif err := r.SetFormParam(\"token\", fToken); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c1507ed98351d5a6fe1b89be7d4d3109", "score": "0.7103632", "text": "func (o *GetPracticesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param version\n\tif err := r.SetPathParam(\"version\", o.Version); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "efc6d405daf71fe313ca5d1497edd003", "score": "0.708244", "text": "func (o *GetLatestParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Base != nil {\n\n\t\t// query param base\n\t\tvar qrBase string\n\t\tif o.Base != nil {\n\t\t\tqrBase = *o.Base\n\t\t}\n\t\tqBase := qrBase\n\t\tif qBase != \"\" {\n\t\t\tif err := r.SetQueryParam(\"base\", qBase); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvaluesSymbols := o.Symbols\n\n\tjoinedSymbols := swag.JoinByFormat(valuesSymbols, \"\")\n\t// query array param symbols\n\tif err := r.SetQueryParam(\"symbols\", joinedSymbols...); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8d015453e48ca988e5ca369ed85d8d23", "score": "0.7078329", "text": "func (o *FindParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param X-Rate-Limit\n\tif err := r.SetHeaderParam(\"X-Rate-Limit\", swag.FormatInt32(o.XRateLimit)); err != nil {\n\t\treturn err\n\t}\n\n\t// form param limit\n\tfrLimit := o.Limit\n\tfLimit := swag.FormatInt32(frLimit)\n\tif err := r.SetFormParam(\"limit\", fLimit); err != nil {\n\t\treturn err\n\t}\n\n\tvar valuesTags []string\n\tfor _, v := range o.Tags {\n\t\tvaluesTags = append(valuesTags, swag.FormatInt32(v))\n\t}\n\n\tjoinedTags := swag.JoinByFormat(valuesTags, \"multi\")\n\t// form array param tags\n\tif err := r.SetFormParam(\"tags\", joinedTags...); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8e5ea81a252c4912c727f8515f801c6c", "score": "0.70770013", "text": "func (o *ConfigInspectParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "902abf6e3ab5235c299bc61c9f714947", "score": "0.7072267", "text": "func (o *GenerateAPIKeyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.APIKeyRequest != nil {\n\t\tif err := r.SetBodyParam(o.APIKeyRequest); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "85ac73bc7ef135314a106dc5a67cc26d", "score": "0.7071831", "text": "func (o *IndexAPIKeysParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Skip != nil {\n\n\t\t// query param skip\n\t\tvar qrSkip int32\n\t\tif o.Skip != nil {\n\t\t\tqrSkip = *o.Skip\n\t\t}\n\t\tqSkip := swag.FormatInt32(qrSkip)\n\t\tif qSkip != \"\" {\n\t\t\tif err := r.SetQueryParam(\"skip\", qSkip); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Take != nil {\n\n\t\t// query param take\n\t\tvar qrTake int32\n\t\tif o.Take != nil {\n\t\t\tqrTake = *o.Take\n\t\t}\n\t\tqTake := swag.FormatInt32(qrTake)\n\t\tif qTake != \"\" {\n\t\t\tif err := r.SetQueryParam(\"take\", qTake); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param userId\n\tif err := r.SetPathParam(\"userId\", o.UserID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "28c445eaa6be947253ae5cbb6da2b54b", "score": "0.7064659", "text": "func (o *StartBlockGeneratorParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\tif o.DynamicResults != nil {\n\t\tif err := r.SetBodyParam(o.DynamicResults); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "784ba0e46839a241570bc1791673ae37", "score": "0.7032438", "text": "func (o *UpdateServiceCustomServiceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID.String()); err != nil {\n\t\treturn err\n\t}\n\n\t// path param technology\n\tif err := r.SetPathParam(\"technology\", o.Technology); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "552887ea3306b86cd5e894342a32054f", "score": "0.7031141", "text": "func (o *CreateDocumentParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// form file param content\n\tif err := r.SetFileParam(\"content\", o.Content); err != nil {\n\t\treturn err\n\t}\n\n\t// path param id4n\n\tif err := r.SetPathParam(\"id4n\", o.ID4N); err != nil {\n\t\treturn err\n\t}\n\n\t// path param organizationId\n\tif err := r.SetPathParam(\"organizationId\", o.OrganizationID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5f964889830d8bcef0cb3ba7c1c7eb91", "score": "0.70240724", "text": "func (o *AnalyseParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param fileId\n\tif err := r.SetPathParam(\"fileId\", swag.FormatInt32(o.FileID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bc8146ea191c53481f92e765cb8a2f8e", "score": "0.7006709", "text": "func (o *SetFieldParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\treturn err\n\t}\n\n\t// path param field\n\tif err := r.SetPathParam(\"field\", o.Field); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vcsRootLocator\n\tif err := r.SetPathParam(\"vcsRootLocator\", o.VcsRootLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fe2cca55ef9e1da6f5a18cbb74501362", "score": "0.6977689", "text": "func (o *SearchByTagParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Cursor != nil {\n\n\t\t// query param cursor\n\t\tvar qrCursor string\n\t\tif o.Cursor != nil {\n\t\t\tqrCursor = *o.Cursor\n\t\t}\n\t\tqCursor := qrCursor\n\t\tif qCursor != \"\" {\n\t\t\tif err := r.SetQueryParam(\"cursor\", qCursor); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PageSize != nil {\n\n\t\t// query param page_size\n\t\tvar qrPageSize int64\n\t\tif o.PageSize != nil {\n\t\t\tqrPageSize = *o.PageSize\n\t\t}\n\t\tqPageSize := swag.FormatInt64(qrPageSize)\n\t\tif qPageSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page_size\", qPageSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param query\n\tqrQuery := o.Query\n\tqQuery := qrQuery\n\tif qQuery != \"\" {\n\t\tif err := r.SetQueryParam(\"query\", qQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "58e27f774a087309d6f85c0207712723", "score": "0.69688535", "text": "func (o *StartCPUGeneratorParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\tif o.DynamicResults != nil {\n\t\tif err := r.SetBodyParam(o.DynamicResults); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "85a5a13883ba12d5f2b6ddb8f2da1a94", "score": "0.6967086", "text": "func (o *UpdateRequiredParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Channel != nil {\n\n\t\t// query param Channel\n\t\tvar qrChannel string\n\t\tif o.Channel != nil {\n\t\t\tqrChannel = *o.Channel\n\t\t}\n\t\tqChannel := qrChannel\n\t\tif qChannel != \"\" {\n\t\t\tif err := r.SetQueryParam(\"Channel\", qChannel); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.CurrentVersion != nil {\n\n\t\t// query param CurrentVersion\n\t\tvar qrCurrentVersion string\n\t\tif o.CurrentVersion != nil {\n\t\t\tqrCurrentVersion = *o.CurrentVersion\n\t\t}\n\t\tqCurrentVersion := qrCurrentVersion\n\t\tif qCurrentVersion != \"\" {\n\t\t\tif err := r.SetQueryParam(\"CurrentVersion\", qCurrentVersion); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.GOARCH != nil {\n\n\t\t// query param GOARCH\n\t\tvar qrGOARCH string\n\t\tif o.GOARCH != nil {\n\t\t\tqrGOARCH = *o.GOARCH\n\t\t}\n\t\tqGOARCH := qrGOARCH\n\t\tif qGOARCH != \"\" {\n\t\t\tif err := r.SetQueryParam(\"GOARCH\", qGOARCH); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.GOOS != nil {\n\n\t\t// query param GOOS\n\t\tvar qrGOOS string\n\t\tif o.GOOS != nil {\n\t\t\tqrGOOS = *o.GOOS\n\t\t}\n\t\tqGOOS := qrGOOS\n\t\tif qGOOS != \"\" {\n\t\t\tif err := r.SetQueryParam(\"GOOS\", qGOOS); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PackageName != nil {\n\n\t\t// query param PackageName\n\t\tvar qrPackageName string\n\t\tif o.PackageName != nil {\n\t\t\tqrPackageName = *o.PackageName\n\t\t}\n\t\tqPackageName := qrPackageName\n\t\tif qPackageName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"PackageName\", qPackageName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ServiceName != nil {\n\n\t\t// query param ServiceName\n\t\tvar qrServiceName string\n\t\tif o.ServiceName != nil {\n\t\t\tqrServiceName = *o.ServiceName\n\t\t}\n\t\tqServiceName := qrServiceName\n\t\tif qServiceName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"ServiceName\", qServiceName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7b7cfbe49ebe334d9c535f20d26381fa", "score": "0.6947525", "text": "func (o *PluginInspectParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param name\n\tif err := r.SetPathParam(\"name\", o.Name); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "95031e33916c606c8b3428662be71b73", "score": "0.69473004", "text": "func (o *EchoParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "72bdf7d637ba5eaaba8ff362cc81ae78", "score": "0.6940592", "text": "func (o *CreateSearchParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param owner\n\tif err := r.SetPathParam(\"owner\", o.Owner); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5835d54b5ae0aab72069412173814b07", "score": "0.6935624", "text": "func (o *GetAppDetailsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\t// path param app_id\n\tif err := r.SetPathParam(\"app_id\", swag.FormatInt64(o.AppID)); err != nil {\n\t\treturn err\n\t}\n\n\t// path param team_id\n\tif err := r.SetPathParam(\"team_id\", swag.FormatInt64(o.TeamID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7df8e10d0a2f3c8080bd07cc35399b53", "score": "0.693545", "text": "func (o *UpdateSchemaParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Reload != nil {\n\n\t\t// query param reload\n\t\tvar qrReload bool\n\t\tif o.Reload != nil {\n\t\t\tqrReload = *o.Reload\n\t\t}\n\t\tqReload := swag.FormatBool(qrReload)\n\t\tif qReload != \"\" {\n\t\t\tif err := r.SetQueryParam(\"reload\", qReload); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param schemaName\n\tif err := r.SetPathParam(\"schemaName\", o.SchemaName); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9409fdf266bf3a4bbbdcc79c1ae708c9", "score": "0.6907263", "text": "func (o *GetAppTagsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param appNameOrId\n\tif err := r.SetPathParam(\"appNameOrId\", o.AppNameOrID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fd2c9c40b8dad9054d0e3ffdf9de44dd", "score": "0.6899664", "text": "func (o *GetClusterDefinitionCustomParametersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param name\n\tif err := r.SetPathParam(\"name\", o.Name); err != nil {\n\t\treturn err\n\t}\n\n\t// path param workspaceId\n\tif err := r.SetPathParam(\"workspaceId\", swag.FormatInt64(o.WorkspaceID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2208391a76b876bbe6bb9bbe928895a6", "score": "0.6899654", "text": "func (o *GenerateInvoiceSummaryParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Feature != nil {\n\n\t\t// query param feature\n\t\tvar qrFeature string\n\t\tif o.Feature != nil {\n\t\t\tqrFeature = *o.Feature\n\t\t}\n\t\tqFeature := qrFeature\n\t\tif qFeature != \"\" {\n\t\t\tif err := r.SetQueryParam(\"feature\", qFeature); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ItemID != nil {\n\n\t\t// query param itemId\n\t\tvar qrItemID string\n\t\tif o.ItemID != nil {\n\t\t\tqrItemID = *o.ItemID\n\t\t}\n\t\tqItemID := qrItemID\n\t\tif qItemID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"itemId\", qItemID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ItemType != nil {\n\n\t\t// query param itemType\n\t\tvar qrItemType string\n\t\tif o.ItemType != nil {\n\t\t\tqrItemType = *o.ItemType\n\t\t}\n\t\tqItemType := qrItemType\n\t\tif qItemType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"itemType\", qItemType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param endTime\n\tqrEndTime := o.EndTime\n\tqEndTime := qrEndTime\n\tif qEndTime != \"\" {\n\t\tif err := r.SetQueryParam(\"endTime\", qEndTime); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param startTime\n\tqrStartTime := o.StartTime\n\tqStartTime := qrStartTime\n\tif qStartTime != \"\" {\n\t\tif err := r.SetQueryParam(\"startTime\", qStartTime); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// setting the default header value\n\tif err := r.SetHeaderParam(\"User-Agent\", utils.UserAgentGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetHeaderParam(\"X-Amzn-Trace-Id\", utils.AmazonTraceIDGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3e48b174d67d89af76ab070b4f54e7b9", "score": "0.68978226", "text": "func (o *UnignoreParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param thingUID\n\tif err := r.SetPathParam(\"thingUID\", o.ThingUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ba468abd7a0f67f1643b81cd15eccbfc", "score": "0.6896794", "text": "func (o *GetIcecreamParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Name != nil {\n\n\t\t// query param name\n\t\tvar qrName string\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cccca927067b6568dba8c008e179776b", "score": "0.6893822", "text": "func (o *GetDevicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\tif o.AccessLevel != nil {\n\n\t\t// query param accessLevel\n\t\tvar qrAccessLevel int64\n\t\tif o.AccessLevel != nil {\n\t\t\tqrAccessLevel = *o.AccessLevel\n\t\t}\n\t\tqAccessLevel := swag.FormatInt64(qrAccessLevel)\n\t\tif qAccessLevel != \"\" {\n\t\t\tif err := r.SetQueryParam(\"accessLevel\", qAccessLevel); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.CapabilitiesMode != nil {\n\n\t\t// query param capabilitiesMode\n\t\tvar qrCapabilitiesMode string\n\t\tif o.CapabilitiesMode != nil {\n\t\t\tqrCapabilitiesMode = *o.CapabilitiesMode\n\t\t}\n\t\tqCapabilitiesMode := qrCapabilitiesMode\n\t\tif qCapabilitiesMode != \"\" {\n\t\t\tif err := r.SetQueryParam(\"capabilitiesMode\", qCapabilitiesMode); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvaluesCapability := o.Capability\n\n\tjoinedCapability := swag.JoinByFormat(valuesCapability, \"multi\")\n\t// query array param capability\n\tif err := r.SetQueryParam(\"capability\", joinedCapability...); err != nil {\n\t\treturn err\n\t}\n\n\tvaluesDeviceID := o.DeviceID\n\n\tjoinedDeviceID := swag.JoinByFormat(valuesDeviceID, \"multi\")\n\t// query array param deviceId\n\tif err := r.SetQueryParam(\"deviceId\", joinedDeviceID...); err != nil {\n\t\treturn err\n\t}\n\n\tif o.IncludeRestricted != nil {\n\n\t\t// query param includeRestricted\n\t\tvar qrIncludeRestricted bool\n\t\tif o.IncludeRestricted != nil {\n\t\t\tqrIncludeRestricted = *o.IncludeRestricted\n\t\t}\n\t\tqIncludeRestricted := swag.FormatBool(qrIncludeRestricted)\n\t\tif qIncludeRestricted != \"\" {\n\t\t\tif err := r.SetQueryParam(\"includeRestricted\", qIncludeRestricted); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvaluesLocationID := o.LocationID\n\n\tjoinedLocationID := swag.JoinByFormat(valuesLocationID, \"multi\")\n\t// query array param locationId\n\tif err := r.SetQueryParam(\"locationId\", joinedLocationID...); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "07d05934e1ee9721b4eff7efaac06cbf", "score": "0.68699676", "text": "func (o *CreateCustomTagParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Data != nil {\n\t\tif err := r.SetBodyParam(o.Data); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f68c68a7fd1022f038d83194abe29218", "score": "0.6861378", "text": "func (o *CustomerGatewayGetApplicationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param app_id\n\tif err := r.SetPathParam(\"app_id\", o.AppID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param app_type\n\tif err := r.SetPathParam(\"app_type\", o.AppType); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fb2ae04d0892a7b9bb5b11cdc46eb890", "score": "0.6860831", "text": "func (o *TenantsCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param className\n\tif err := r.SetPathParam(\"className\", o.ClassName); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "09c8e4cb8d063cde5836da8f2b43c238", "score": "0.6859097", "text": "func (o *GetTxsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.MessageAction != nil {\n\n\t\t// query param message.action\n\t\tvar qrMessageAction string\n\t\tif o.MessageAction != nil {\n\t\t\tqrMessageAction = *o.MessageAction\n\t\t}\n\t\tqMessageAction := qrMessageAction\n\t\tif qMessageAction != \"\" {\n\t\t\tif err := r.SetQueryParam(\"message.action\", qMessageAction); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.MessageSender != nil {\n\n\t\t// query param message.sender\n\t\tvar qrMessageSender string\n\t\tif o.MessageSender != nil {\n\t\t\tqrMessageSender = *o.MessageSender\n\t\t}\n\t\tqMessageSender := qrMessageSender\n\t\tif qMessageSender != \"\" {\n\t\t\tif err := r.SetQueryParam(\"message.sender\", qMessageSender); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int64\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt64(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param tx.height\n\tqrTxHeight := o.TxHeight\n\tqTxHeight := swag.FormatInt64(qrTxHeight)\n\tif qTxHeight != \"\" {\n\t\tif err := r.SetQueryParam(\"tx.height\", qTxHeight); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ca7037544a70e0e428ae3eef6e5564e2", "score": "0.68581337", "text": "func (o *GetV1ServicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\tif o.Project != nil {\n\n\t\t// query param project\n\t\tvar qrProject int64\n\t\tif o.Project != nil {\n\t\t\tqrProject = *o.Project\n\t\t}\n\t\tqProject := swag.FormatInt64(qrProject)\n\t\tif qProject != \"\" {\n\t\t\tif err := r.SetQueryParam(\"project\", qProject); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Sort != nil {\n\n\t\t// query param sort\n\t\tvar qrSort string\n\t\tif o.Sort != nil {\n\t\t\tqrSort = *o.Sort\n\t\t}\n\t\tqSort := qrSort\n\t\tif qSort != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sort\", qSort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Type != nil {\n\n\t\t// query param type\n\t\tvar qrType string\n\t\tif o.Type != nil {\n\t\t\tqrType = *o.Type\n\t\t}\n\t\tqType := qrType\n\t\tif qType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"type\", qType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5d7fa70362140cd3975b500dfbc3967c", "score": "0.68567425", "text": "func (o *VolumeInspectParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param name\n\tif err := r.SetPathParam(\"name\", o.Name); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "942ccaab2c54a6f9756ca5f5056fc8e2", "score": "0.6853312", "text": "func (o *GetAllParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Count != nil {\n\n\t\t// query param Count\n\t\tvar qrCount int32\n\t\tif o.Count != nil {\n\t\t\tqrCount = *o.Count\n\t\t}\n\t\tqCount := swag.FormatInt32(qrCount)\n\t\tif qCount != \"\" {\n\t\t\tif err := r.SetQueryParam(\"Count\", qCount); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param Page\n\t\tvar qrPage int32\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt32(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"Page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Search != nil {\n\n\t\t// query param Search\n\t\tvar qrSearch string\n\t\tif o.Search != nil {\n\t\t\tqrSearch = *o.Search\n\t\t}\n\t\tqSearch := qrSearch\n\t\tif qSearch != \"\" {\n\t\t\tif err := r.SetQueryParam(\"Search\", qSearch); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ec58d6673e094d4fefb5aafe5ffff134", "score": "0.68444836", "text": "func (o *DuplicateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif err := r.SetBodyParam(o.Parameters); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "356ca0a31e5765e318ce2704f336b4b5", "score": "0.6838167", "text": "func (o *GetFlowParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.UIOnly != nil {\n\n\t\t// query param uiOnly\n\t\tvar qrUIOnly bool\n\n\t\tif o.UIOnly != nil {\n\t\t\tqrUIOnly = *o.UIOnly\n\t\t}\n\t\tqUIOnly := swag.FormatBool(qrUIOnly)\n\t\tif qUIOnly != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"uiOnly\", qUIOnly); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e942c161061890bcb76aec18365c19aa", "score": "0.68368655", "text": "func (o *GetServerLogsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\t// path param podName\n\tif err := r.SetPathParam(\"podName\", o.PodName); err != nil {\n\t\treturn err\n\t}\n\n\tif o.LogType != nil {\n\n\t\t// query param logType\n\t\tvar qrLogType string\n\t\tif o.LogType != nil {\n\t\t\tqrLogType = *o.LogType\n\t\t}\n\t\tqLogType := qrLogType\n\t\tif qLogType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"logType\", qLogType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Origin != nil {\n\n\t\t// query param origin\n\t\tvar qrOrigin string\n\t\tif o.Origin != nil {\n\t\t\tqrOrigin = *o.Origin\n\t\t}\n\t\tqOrigin := qrOrigin\n\t\tif qOrigin != \"\" {\n\t\t\tif err := r.SetQueryParam(\"origin\", qOrigin); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// setting the default header value\n\tif err := r.SetHeaderParam(\"User-Agent\", utils.UserAgentGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetHeaderParam(\"X-Amzn-Trace-Id\", utils.AmazonTraceIDGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c10ee3ecfc72181fd3deb8a91e4fddd7", "score": "0.68359107", "text": "func (o *UserRequestFriendParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "32cad877c483781412abc8b569afed67", "score": "0.6833736", "text": "func (o *GetDeviceConfigurationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\tif o.ManufacturerName != nil {\n\n\t\t// query param manufacturerName\n\t\tvar qrManufacturerName string\n\t\tif o.ManufacturerName != nil {\n\t\t\tqrManufacturerName = *o.ManufacturerName\n\t\t}\n\t\tqManufacturerName := qrManufacturerName\n\t\tif qManufacturerName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"manufacturerName\", qManufacturerName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param presentationId\n\tqrPresentationID := o.PresentationID\n\tqPresentationID := qrPresentationID\n\tif qPresentationID != \"\" {\n\t\tif err := r.SetQueryParam(\"presentationId\", qPresentationID); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e39b565ae1cf63e632fabc18a8c932e5", "score": "0.68310416", "text": "func (o *EditTagParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param organizationName\n\tif err := r.SetPathParam(\"organizationName\", o.OrganizationName); err != nil {\n\t\treturn err\n\t}\n\n\t// path param projectName\n\tif err := r.SetPathParam(\"projectName\", o.ProjectName); err != nil {\n\t\treturn err\n\t}\n\tif o.Tag != nil {\n\t\tif err := r.SetBodyParam(o.Tag); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param tagLabel\n\tif err := r.SetPathParam(\"tagLabel\", o.TagLabel); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aef9e2ba109fa84957a87bde6eed731b", "score": "0.68305045", "text": "func (o *GetDeltaParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tvaluesAttributes := o.Attributes\n\n\tjoinedAttributes := swag.JoinByFormat(valuesAttributes, \"\")\n\t// query array param attributes\n\tif err := r.SetQueryParam(\"attributes\", joinedAttributes...); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Cursor != nil {\n\n\t\t// query param cursor\n\t\tvar qrCursor string\n\t\tif o.Cursor != nil {\n\t\t\tqrCursor = *o.Cursor\n\t\t}\n\t\tqCursor := qrCursor\n\t\tif qCursor != \"\" {\n\t\t\tif err := r.SetQueryParam(\"cursor\", qCursor); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "261c52f7de6dc2152dcdc0269e4dc489", "score": "0.68272734", "text": "func (o *SchemaObjectsUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param className\n\tif err := r.SetPathParam(\"className\", o.ClassName); err != nil {\n\t\treturn err\n\t}\n\tif o.ObjectClass != nil {\n\t\tif err := r.SetBodyParam(o.ObjectClass); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dbe1109ad5af6a86266b6b7dd1fce5ad", "score": "0.682723", "text": "func (o *RTRCreatePutFilesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.CommentsForAuditLog != nil {\n\n\t\t// form param comments_for_audit_log\n\t\tvar frCommentsForAuditLog string\n\t\tif o.CommentsForAuditLog != nil {\n\t\t\tfrCommentsForAuditLog = *o.CommentsForAuditLog\n\t\t}\n\t\tfCommentsForAuditLog := frCommentsForAuditLog\n\t\tif fCommentsForAuditLog != \"\" {\n\t\t\tif err := r.SetFormParam(\"comments_for_audit_log\", fCommentsForAuditLog); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// form param description\n\tfrDescription := o.Description\n\tfDescription := frDescription\n\tif fDescription != \"\" {\n\t\tif err := r.SetFormParam(\"description\", fDescription); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// form file param file\n\tif err := r.SetFileParam(\"file\", o.File); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Name != nil {\n\n\t\t// form param name\n\t\tvar frName string\n\t\tif o.Name != nil {\n\t\t\tfrName = *o.Name\n\t\t}\n\t\tfName := frName\n\t\tif fName != \"\" {\n\t\t\tif err := r.SetFormParam(\"name\", fName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a6784da059bac47fd7c0d40c8955305b", "score": "0.68268687", "text": "func (o *GetServiceConfigParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f7f475c9485f0914fe59cd1be0f57514", "score": "0.6825356", "text": "func (o *SearchParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.APIVersion != nil {\n\n\t\t// query param apiVersion\n\t\tvar qrAPIVersion string\n\n\t\tif o.APIVersion != nil {\n\t\t\tqrAPIVersion = *o.APIVersion\n\t\t}\n\t\tqAPIVersion := qrAPIVersion\n\t\tif qAPIVersion != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"apiVersion\", qAPIVersion); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Search != nil {\n\n\t\t// query param search\n\t\tvar qrSearch string\n\n\t\tif o.Search != nil {\n\t\t\tqrSearch = *o.Search\n\t\t}\n\t\tqSearch := qrSearch\n\t\tif qSearch != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"search\", qSearch); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param sourceId\n\tif err := r.SetPathParam(\"sourceId\", o.SourceID.String()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "085d85a100c503f7b6d1f5741d2842bf", "score": "0.6820018", "text": "func (o *QueryUnbondingParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param account\n\tqrAccount := o.Account\n\tqAccount := qrAccount\n\tif qAccount != \"\" {\n\t\tif err := r.SetQueryParam(\"account\", qAccount); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param count\n\tqrCount := o.Count\n\tqCount := swag.FormatInt32(qrCount)\n\tif qCount != \"\" {\n\t\tif err := r.SetQueryParam(\"count\", qCount); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param sid\n\tqrSid := o.Sid\n\tqSid := swag.FormatInt64(qrSid)\n\tif qSid != \"\" {\n\t\tif err := r.SetQueryParam(\"sid\", qSid); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param time\n\tqrTime := o.Time\n\tqTime := swag.FormatInt64(qrTime)\n\tif qTime != \"\" {\n\t\tif err := r.SetQueryParam(\"time\", qTime); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fcf5187ffabaa9a4d35a0af620bcd98a", "score": "0.6811307", "text": "func (o *GetValidationRequestParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param contextId\n\tif err := r.SetPathParam(\"contextId\", o.ContextID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1dfc99e3c55dea5c9ebc199698997adf", "score": "0.6806729", "text": "func (o *LogParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.ImpersonateGroup != nil {\n\n\t\t// binding items for Impersonate-Group\n\t\tjoinedImpersonateGroup := o.bindParamImpersonateGroup(reg)\n\n\t\t// header array param Impersonate-Group\n\t\tif len(joinedImpersonateGroup) > 0 {\n\t\t\tif err := r.SetHeaderParam(\"Impersonate-Group\", joinedImpersonateGroup[0]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ImpersonateUser != nil {\n\n\t\t// header param Impersonate-User\n\t\tif err := r.SetHeaderParam(\"Impersonate-User\", *o.ImpersonateUser); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param appName\n\tif err := r.SetPathParam(\"appName\", o.AppName); err != nil {\n\t\treturn err\n\t}\n\n\t// path param componentName\n\tif err := r.SetPathParam(\"componentName\", o.ComponentName); err != nil {\n\t\treturn err\n\t}\n\n\t// path param deploymentName\n\tif err := r.SetPathParam(\"deploymentName\", o.DeploymentName); err != nil {\n\t\treturn err\n\t}\n\n\tif o.File != nil {\n\n\t\t// query param file\n\t\tvar qrFile string\n\n\t\tif o.File != nil {\n\t\t\tqrFile = *o.File\n\t\t}\n\t\tqFile := qrFile\n\t\tif qFile != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"file\", qFile); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Lines != nil {\n\n\t\t// query param lines\n\t\tvar qrLines string\n\n\t\tif o.Lines != nil {\n\t\t\tqrLines = *o.Lines\n\t\t}\n\t\tqLines := qrLines\n\t\tif qLines != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"lines\", qLines); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param podName\n\tif err := r.SetPathParam(\"podName\", o.PodName); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Previous != nil {\n\n\t\t// query param previous\n\t\tvar qrPrevious string\n\n\t\tif o.Previous != nil {\n\t\t\tqrPrevious = *o.Previous\n\t\t}\n\t\tqPrevious := qrPrevious\n\t\tif qPrevious != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"previous\", qPrevious); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.SinceTime != nil {\n\n\t\t// query param sinceTime\n\t\tvar qrSinceTime strfmt.DateTime\n\n\t\tif o.SinceTime != nil {\n\t\t\tqrSinceTime = *o.SinceTime\n\t\t}\n\t\tqSinceTime := qrSinceTime.String()\n\t\tif qSinceTime != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"sinceTime\", qSinceTime); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7567e6bcd09b5d553a470c102c582cd5", "score": "0.6803849", "text": "func (o *UpdateClientParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1553b7812c3eb631843aacee76091079", "score": "0.68013525", "text": "func (o *AuthorizeForAutoscaleParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param crn\n\tif err := r.SetPathParam(\"crn\", o.Crn); err != nil {\n\t\treturn err\n\t}\n\n\t// path param permission\n\tif err := r.SetPathParam(\"permission\", o.Permission); err != nil {\n\t\treturn err\n\t}\n\n\t// path param tenant\n\tif err := r.SetPathParam(\"tenant\", o.Tenant); err != nil {\n\t\treturn err\n\t}\n\n\t// path param userId\n\tif err := r.SetPathParam(\"userId\", o.UserID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "787db8a19f732efd6e2280cadd46865b", "score": "0.6797898", "text": "func (o *CountryGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt32(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8e80486616e868dbce86405a3902b041", "score": "0.67951274", "text": "func (o *GetServiceAndDependenciesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Platform != nil {\n\n\t\t// query param platform\n\t\tvar qrPlatform string\n\t\tif o.Platform != nil {\n\t\t\tqrPlatform = *o.Platform\n\t\t}\n\t\tqPlatform := qrPlatform\n\t\tif qPlatform != \"\" {\n\t\t\tif err := r.SetQueryParam(\"platform\", qPlatform); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvaluesServices := o.Services\n\n\tjoinedServices := swag.JoinByFormat(valuesServices, \"multi\")\n\t// query array param services\n\tif err := r.SetQueryParam(\"services\", joinedServices...); err != nil {\n\t\treturn err\n\t}\n\n\t// path param workspaceId\n\tif err := r.SetPathParam(\"workspaceId\", swag.FormatInt64(o.WorkspaceID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "08a59333595170d0cadde551c5e897f5", "score": "0.67944825", "text": "func (o *GetDevicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Authorized != nil {\n\n\t\t// query param authorized\n\t\tvar qrAuthorized bool\n\n\t\tif o.Authorized != nil {\n\t\t\tqrAuthorized = *o.Authorized\n\t\t}\n\t\tqAuthorized := swag.FormatBool(qrAuthorized)\n\t\tif qAuthorized != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"authorized\", qAuthorized); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Role != nil {\n\n\t\t// binding items for role\n\t\tjoinedRole := o.bindParamRole(reg)\n\n\t\t// query array param role\n\t\tif err := r.SetQueryParam(\"role\", joinedRole...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.SiteID != nil {\n\n\t\t// query param siteId\n\t\tvar qrSiteID string\n\n\t\tif o.SiteID != nil {\n\t\t\tqrSiteID = *o.SiteID\n\t\t}\n\t\tqSiteID := qrSiteID\n\t\tif qSiteID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"siteId\", qSiteID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Type != nil {\n\n\t\t// binding items for type\n\t\tjoinedType := o.bindParamType(reg)\n\n\t\t// query array param type\n\t\tif err := r.SetQueryParam(\"type\", joinedType...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.WithInterfaces != nil {\n\n\t\t// query param withInterfaces\n\t\tvar qrWithInterfaces bool\n\n\t\tif o.WithInterfaces != nil {\n\t\t\tqrWithInterfaces = *o.WithInterfaces\n\t\t}\n\t\tqWithInterfaces := swag.FormatBool(qrWithInterfaces)\n\t\tif qWithInterfaces != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"withInterfaces\", qWithInterfaces); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "efd976e388beb538ee58e1ecc766845f", "score": "0.67925125", "text": "func (o *HostRsrcPrParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Params != nil {\n\n\t\t// form param params\n\t\tvar frParams string\n\t\tif o.Params != nil {\n\t\t\tfrParams = *o.Params\n\t\t}\n\t\tfParams := frParams\n\t\tif fParams != \"\" {\n\t\t\tif err := r.SetFormParam(\"params\", fParams); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// form param resource_id\n\tfrResourceID := o.ResourceID\n\tfResourceID := frResourceID\n\tif fResourceID != \"\" {\n\t\tif err := r.SetFormParam(\"resource_id\", fResourceID); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvaluesResourceScopes := o.ResourceScopes\n\n\tjoinedResourceScopes := swag.JoinByFormat(valuesResourceScopes, \"\")\n\t// form array param resource_scopes\n\tif err := r.SetFormParam(\"resource_scopes\", joinedResourceScopes...); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "86f14ad0fe4e84dde8a700fa035d7d28", "score": "0.6789323", "text": "func (o *AdminRetrieveEligibilitiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\t// path param userId\n\tif err := r.SetPathParam(\"userId\", o.UserID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.PublisherUserID != nil {\n\n\t\t// query param publisherUserId\n\t\tvar qrPublisherUserID string\n\t\tif o.PublisherUserID != nil {\n\t\t\tqrPublisherUserID = *o.PublisherUserID\n\t\t}\n\t\tqPublisherUserID := qrPublisherUserID\n\t\tif qPublisherUserID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"publisherUserId\", qPublisherUserID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param clientId\n\tqrClientID := o.ClientID\n\tqClientID := qrClientID\n\tif qClientID != \"\" {\n\t\tif err := r.SetQueryParam(\"clientId\", qClientID); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param countryCode\n\tqrCountryCode := o.CountryCode\n\tqCountryCode := qrCountryCode\n\tif qCountryCode != \"\" {\n\t\tif err := r.SetQueryParam(\"countryCode\", qCountryCode); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// setting the default header value\n\tif err := r.SetHeaderParam(\"User-Agent\", utils.UserAgentGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetHeaderParam(\"X-Amzn-Trace-Id\", utils.AmazonTraceIDGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "be3ace0be26cd53f27b2ee1af4d0fb62", "score": "0.6779907", "text": "func (o *DurationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Branches != nil {\n\n\t\t// query param branches\n\t\tvar qrBranches string\n\t\tif o.Branches != nil {\n\t\t\tqrBranches = *o.Branches\n\t\t}\n\t\tqBranches := qrBranches\n\t\tif qBranches != \"\" {\n\t\t\tif err := r.SetQueryParam(\"branches\", qBranches); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param date\n\tqrDate := o.Date\n\tqDate := qrDate.String()\n\tif qDate != \"\" {\n\t\tif err := r.SetQueryParam(\"date\", qDate); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Project != nil {\n\n\t\t// query param project\n\t\tvar qrProject string\n\t\tif o.Project != nil {\n\t\t\tqrProject = *o.Project\n\t\t}\n\t\tqProject := qrProject\n\t\tif qProject != \"\" {\n\t\t\tif err := r.SetQueryParam(\"project\", qProject); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param user\n\tif err := r.SetPathParam(\"user\", o.User); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2afe6a73fbf445765ca71dd06ff1242e", "score": "0.67783636", "text": "func (o *IssueGetIssueParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param index\n\tif err := r.SetPathParam(\"index\", swag.FormatInt64(o.Index)); err != nil {\n\t\treturn err\n\t}\n\n\t// path param owner\n\tif err := r.SetPathParam(\"owner\", o.Owner); err != nil {\n\t\treturn err\n\t}\n\n\t// path param repo\n\tif err := r.SetPathParam(\"repo\", o.Repo); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3ee3da0b13aa94578b3b9dbd6b261cec", "score": "0.6775518", "text": "func (o *ExecuteCommandParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param action\n\tif err := r.SetPathParam(\"action\", o.Action); err != nil {\n\t\treturn err\n\t}\n\n\t// path param source\n\tif err := r.SetPathParam(\"source\", o.Source); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f7ec57b18b49ee8e744bb32e6505705e", "score": "0.6773693", "text": "func (o *GetTestRunParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param testRunId\n\tif err := r.SetPathParam(\"testRunId\", o.TestRunID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "102de0ff9b66a38e9634d380b2105fec", "score": "0.67723656", "text": "func (o *UpdateDescriptionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.JSONBody != nil {\n\t\tif err := r.SetBodyParam(o.JSONBody); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param dashboardId\n\tif err := r.SetPathParam(\"dashboardId\", o.DashboardID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param widgetId\n\tif err := r.SetPathParam(\"widgetId\", o.WidgetID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4c2e95a9f2b8bee7a6a660c7e13c6191", "score": "0.6767438", "text": "func (o *InvokeActionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.requestTimeout)\n\tvar res []error\n\n\t// path param actionName\n\tif err := r.SetPathParam(\"actionName\", o.ActionName); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Blocking != nil {\n\n\t\t// query param blocking\n\t\tvar qrBlocking string\n\t\tif o.Blocking != nil {\n\t\t\tqrBlocking = *o.Blocking\n\t\t}\n\t\tqBlocking := qrBlocking\n\t\tif qBlocking != \"\" {\n\t\t\tif err := r.SetQueryParam(\"blocking\", qBlocking); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Payload == nil {\n\t\to.Payload = new(swagger_models.KeyValue)\n\t}\n\n\tif err := r.SetBodyParam(o.Payload); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Result != nil {\n\n\t\t// query param result\n\t\tvar qrResult string\n\t\tif o.Result != nil {\n\t\t\tqrResult = *o.Result\n\t\t}\n\t\tqResult := qrResult\n\t\tif qResult != \"\" {\n\t\t\tif err := r.SetQueryParam(\"result\", qResult); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Timeout != nil {\n\n\t\t// query param timeout\n\t\tvar qrTimeout int64\n\t\tif o.Timeout != nil {\n\t\t\tqrTimeout = *o.Timeout\n\t\t}\n\t\tqTimeout := swag.FormatInt64(qrTimeout)\n\t\tif qTimeout != \"\" {\n\t\t\tif err := r.SetQueryParam(\"timeout\", qTimeout); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f20c99d08e64eda88bdf8b722df1c7c6", "score": "0.6764022", "text": "func (o *GetPageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Count != nil {\n\n\t\t// query param count\n\t\tvar qrCount int32\n\t\tif o.Count != nil {\n\t\t\tqrCount = *o.Count\n\t\t}\n\t\tqCount := swag.FormatInt32(qrCount)\n\t\tif qCount != \"\" {\n\t\t\tif err := r.SetQueryParam(\"count\", qCount); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int32\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt32(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param userId\n\tif err := r.SetPathParam(\"userId\", o.UserID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6b878843a7d737deea9cefa9722616e7", "score": "0.6761032", "text": "func (o *BulkCreatePacketGeneratorsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\tif err := r.SetBodyParam(o.Create); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6de3e77274f9a722bd3cf9023fd45dcb", "score": "0.6758589", "text": "func (o *QueryDealParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param count\n\tqrCount := o.Count\n\tqCount := swag.FormatInt32(qrCount)\n\tif qCount != \"\" {\n\t\tif err := r.SetQueryParam(\"count\", qCount); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param market\n\tqrMarket := o.Market\n\tqMarket := qrMarket\n\tif qMarket != \"\" {\n\t\tif err := r.SetQueryParam(\"market\", qMarket); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param sid\n\tqrSid := o.Sid\n\tqSid := swag.FormatInt64(qrSid)\n\tif qSid != \"\" {\n\t\tif err := r.SetQueryParam(\"sid\", qSid); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param time\n\tqrTime := o.Time\n\tqTime := swag.FormatInt64(qrTime)\n\tif qTime != \"\" {\n\t\tif err := r.SetQueryParam(\"time\", qTime); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c540af80f9ca6f6e6468e5fbb6c5f42d", "score": "0.675823", "text": "func (o *TravelExpenseSettingsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1832e274572cef2feb89479648d65782", "score": "0.67543834", "text": "func (o *GetEventTypeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param eventTypeId\n\tif err := r.SetPathParam(\"eventTypeId\", o.EventTypeID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param publisherId\n\tif err := r.SetPathParam(\"publisherId\", o.PublisherID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2642eabf6b15b3463c56405d108488bf", "score": "0.6752846", "text": "func (o *APIV1WebhooksPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Model != nil {\n\t\tif err := r.SetBodyParam(o.Model); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aa2995cb779764dfcaa84f51cc049bb4", "score": "0.67519933", "text": "func (o *VscanModifyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\tif o.Info != nil {\n\t\tif err := r.SetBodyParam(o.Info); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param svm.uuid\n\tif err := r.SetPathParam(\"svm.uuid\", o.SvmUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f8403714eeb20d1545e77e8de8d06dac", "score": "0.6746698", "text": "func (o *ReportUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\t// setting the default header value\n\tif err := r.SetHeaderParam(\"User-Agent\", utils.UserAgentGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetHeaderParam(\"X-Amzn-Trace-Id\", utils.AmazonTraceIDGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fc2e1366c914d7719d205e159fcef22f", "score": "0.6744226", "text": "func (o *FilteredListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.FromDate != nil {\n\n\t\t// query param fromDate\n\t\tvar qrFromDate strfmt.DateTime\n\t\tif o.FromDate != nil {\n\t\t\tqrFromDate = *o.FromDate\n\t\t}\n\t\tqFromDate := qrFromDate.String()\n\t\tif qFromDate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fromDate\", qFromDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param id4n\n\tif err := r.SetPathParam(\"id4n\", o.ID4N); err != nil {\n\t\treturn err\n\t}\n\n\tif o.IncludePrivate != nil {\n\n\t\t// query param includePrivate\n\t\tvar qrIncludePrivate bool\n\t\tif o.IncludePrivate != nil {\n\t\t\tqrIncludePrivate = *o.IncludePrivate\n\t\t}\n\t\tqIncludePrivate := swag.FormatBool(qrIncludePrivate)\n\t\tif qIncludePrivate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"includePrivate\", qIncludePrivate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int32\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt32(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int32\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt32(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Organization != nil {\n\n\t\t// query param organization\n\t\tvar qrOrganization string\n\t\tif o.Organization != nil {\n\t\t\tqrOrganization = *o.Organization\n\t\t}\n\t\tqOrganization := qrOrganization\n\t\tif qOrganization != \"\" {\n\t\t\tif err := r.SetQueryParam(\"organization\", qOrganization); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvaluesQualifier := o.Qualifier\n\n\tjoinedQualifier := swag.JoinByFormat(valuesQualifier, \"multi\")\n\t// query array param qualifier\n\tif err := r.SetQueryParam(\"qualifier\", joinedQualifier...); err != nil {\n\t\treturn err\n\t}\n\n\tif o.ToDate != nil {\n\n\t\t// query param toDate\n\t\tvar qrToDate strfmt.DateTime\n\t\tif o.ToDate != nil {\n\t\t\tqrToDate = *o.ToDate\n\t\t}\n\t\tqToDate := qrToDate.String()\n\t\tif qToDate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"toDate\", qToDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvaluesType := o.Type\n\n\tjoinedType := swag.JoinByFormat(valuesType, \"multi\")\n\t// query array param type\n\tif err := r.SetQueryParam(\"type\", joinedType...); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "913701771b00dd7fe24e47ce747292bf", "score": "0.6742786", "text": "func (o *GetSepainstantParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tvar valuesFilterOrganisationID []string\n\tfor _, v := range o.FilterOrganisationID {\n\t\tvaluesFilterOrganisationID = append(valuesFilterOrganisationID, v.String())\n\t}\n\n\tjoinedFilterOrganisationID := swag.JoinByFormat(valuesFilterOrganisationID, \"\")\n\t// query array param filter[organisation_id]\n\tif err := r.SetQueryParam(\"filter[organisation_id]\", joinedFilterOrganisationID...); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fbe419cb1393b8e013272ca80abc0bfe", "score": "0.6740429", "text": "func (o *CheckWalletParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param currencyCode\n\tif err := r.SetPathParam(\"currencyCode\", o.CurrencyCode); err != nil {\n\t\treturn err\n\t}\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\t// path param userId\n\tif err := r.SetPathParam(\"userId\", o.UserID); err != nil {\n\t\treturn err\n\t}\n\n\t// query param origin\n\tqrOrigin := o.Origin\n\tqOrigin := qrOrigin\n\tif qOrigin != \"\" {\n\t\tif err := r.SetQueryParam(\"origin\", qOrigin); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// setting the default header value\n\tif err := r.SetHeaderParam(\"User-Agent\", utils.UserAgentGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetHeaderParam(\"X-Amzn-Trace-Id\", utils.AmazonTraceIDGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3e7f6f711a1ddbe66cd4667211a38a2c", "score": "0.6739896", "text": "func (o *GetMessageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.AccountUID != nil {\n\n\t\t// query param account_uid\n\t\tvar qrAccountUID string\n\t\tif o.AccountUID != nil {\n\t\t\tqrAccountUID = *o.AccountUID\n\t\t}\n\t\tqAccountUID := qrAccountUID\n\t\tif qAccountUID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"account_uid\", qAccountUID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.APIVersion != nil {\n\n\t\t// header param api-version\n\t\tif err := r.SetHeaderParam(\"api-version\", *o.APIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.Direction != nil {\n\n\t\t// query param direction\n\t\tvar qrDirection string\n\t\tif o.Direction != nil {\n\t\t\tqrDirection = *o.Direction\n\t\t}\n\t\tqDirection := qrDirection\n\t\tif qDirection != \"\" {\n\t\t\tif err := r.SetQueryParam(\"direction\", qDirection); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.State != nil {\n\n\t\t// query param state\n\t\tvar qrState string\n\t\tif o.State != nil {\n\t\t\tqrState = *o.State\n\t\t}\n\t\tqState := qrState\n\t\tif qState != \"\" {\n\t\t\tif err := r.SetQueryParam(\"state\", qState); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cbcbeb97f9cb29b7a0d260026d831b67", "score": "0.67394465", "text": "func (o *GetNodesByTagParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param tagName\n\tif err := r.SetPathParam(\"tagName\", o.TagName); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "70cd13cba82cee4372bd446af42aa148", "score": "0.67379594", "text": "func (o *TestCustomRuleInputParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// query param scan_id\n\tqrScanID := o.ScanID\n\tqScanID := qrScanID\n\tif qScanID != \"\" {\n\t\tif err := r.SetQueryParam(\"scan_id\", qScanID); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.ViaDownload != nil {\n\n\t\t// query param via_download\n\t\tvar qrViaDownload bool\n\t\tif o.ViaDownload != nil {\n\t\t\tqrViaDownload = *o.ViaDownload\n\t\t}\n\t\tqViaDownload := swag.FormatBool(qrViaDownload)\n\t\tif qViaDownload != \"\" {\n\t\t\tif err := r.SetQueryParam(\"via_download\", qViaDownload); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "40527787853e05e3755b46b5e33109e5", "score": "0.6733208", "text": "func (o *GetPassByIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatUint64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d503cabab21579c8a2d05cc073ae8a6d", "score": "0.6731302", "text": "func (o *WeaviateActionsPropertiesCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param actionId\n\tif err := r.SetPathParam(\"actionId\", o.ActionID.String()); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param propertyName\n\tif err := r.SetPathParam(\"propertyName\", o.PropertyName); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "54aa9eb827b0646bb85a753d512cd0d6", "score": "0.6730317", "text": "func (o *UpdateServiceCustomServicesOrderParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param technology\n\tif err := r.SetPathParam(\"technology\", o.Technology); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d675d6a7baa0c066720cfc619fa6fc6e", "score": "0.672957", "text": "func (o *ApplicationCollectionGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Fields != nil {\n\n\t\t// binding items for fields\n\t\tjoinedFields := o.bindParamFields(reg)\n\n\t\t// query array param fields\n\t\tif err := r.SetQueryParam(\"fields\", joinedFields...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Generation != nil {\n\n\t\t// query param generation\n\t\tvar qrGeneration string\n\n\t\tif o.Generation != nil {\n\t\t\tqrGeneration = *o.Generation\n\t\t}\n\t\tqGeneration := qrGeneration\n\t\tif qGeneration != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"generation\", qGeneration); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MaxRecords != nil {\n\n\t\t// query param max_records\n\t\tvar qrMaxRecords int64\n\n\t\tif o.MaxRecords != nil {\n\t\t\tqrMaxRecords = *o.MaxRecords\n\t\t}\n\t\tqMaxRecords := swag.FormatInt64(qrMaxRecords)\n\t\tif qMaxRecords != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"max_records\", qMaxRecords); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Name != nil {\n\n\t\t// query param name\n\t\tvar qrName string\n\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.OrderBy != nil {\n\n\t\t// binding items for order_by\n\t\tjoinedOrderBy := o.bindParamOrderBy(reg)\n\n\t\t// query array param order_by\n\t\tif err := r.SetQueryParam(\"order_by\", joinedOrderBy...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.ProtectionGranularity != nil {\n\n\t\t// query param protection_granularity\n\t\tvar qrProtectionGranularity string\n\n\t\tif o.ProtectionGranularity != nil {\n\t\t\tqrProtectionGranularity = *o.ProtectionGranularity\n\t\t}\n\t\tqProtectionGranularity := qrProtectionGranularity\n\t\tif qProtectionGranularity != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"protection_granularity\", qProtectionGranularity); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ReturnRecords != nil {\n\n\t\t// query param return_records\n\t\tvar qrReturnRecords bool\n\n\t\tif o.ReturnRecords != nil {\n\t\t\tqrReturnRecords = *o.ReturnRecords\n\t\t}\n\t\tqReturnRecords := swag.FormatBool(qrReturnRecords)\n\t\tif qReturnRecords != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_records\", qReturnRecords); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ReturnTimeout != nil {\n\n\t\t// query param return_timeout\n\t\tvar qrReturnTimeout int64\n\n\t\tif o.ReturnTimeout != nil {\n\t\t\tqrReturnTimeout = *o.ReturnTimeout\n\t\t}\n\t\tqReturnTimeout := swag.FormatInt64(qrReturnTimeout)\n\t\tif qReturnTimeout != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_timeout\", qReturnTimeout); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.RpoComponentsName != nil {\n\n\t\t// query param rpo.components.name\n\t\tvar qrRpoComponentsName string\n\n\t\tif o.RpoComponentsName != nil {\n\t\t\tqrRpoComponentsName = *o.RpoComponentsName\n\t\t}\n\t\tqRpoComponentsName := qrRpoComponentsName\n\t\tif qRpoComponentsName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"rpo.components.name\", qRpoComponentsName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.RpoComponentsRpoLocalDescription != nil {\n\n\t\t// query param rpo.components.rpo.local.description\n\t\tvar qrRpoComponentsRpoLocalDescription string\n\n\t\tif o.RpoComponentsRpoLocalDescription != nil {\n\t\t\tqrRpoComponentsRpoLocalDescription = *o.RpoComponentsRpoLocalDescription\n\t\t}\n\t\tqRpoComponentsRpoLocalDescription := qrRpoComponentsRpoLocalDescription\n\t\tif qRpoComponentsRpoLocalDescription != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"rpo.components.rpo.local.description\", qRpoComponentsRpoLocalDescription); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.RpoComponentsRpoLocalName != nil {\n\n\t\t// query param rpo.components.rpo.local.name\n\t\tvar qrRpoComponentsRpoLocalName string\n\n\t\tif o.RpoComponentsRpoLocalName != nil {\n\t\t\tqrRpoComponentsRpoLocalName = *o.RpoComponentsRpoLocalName\n\t\t}\n\t\tqRpoComponentsRpoLocalName := qrRpoComponentsRpoLocalName\n\t\tif qRpoComponentsRpoLocalName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"rpo.components.rpo.local.name\", qRpoComponentsRpoLocalName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.RpoComponentsRpoRemoteDescription != nil {\n\n\t\t// query param rpo.components.rpo.remote.description\n\t\tvar qrRpoComponentsRpoRemoteDescription string\n\n\t\tif o.RpoComponentsRpoRemoteDescription != nil {\n\t\t\tqrRpoComponentsRpoRemoteDescription = *o.RpoComponentsRpoRemoteDescription\n\t\t}\n\t\tqRpoComponentsRpoRemoteDescription := qrRpoComponentsRpoRemoteDescription\n\t\tif qRpoComponentsRpoRemoteDescription != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"rpo.components.rpo.remote.description\", qRpoComponentsRpoRemoteDescription); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.RpoComponentsRpoRemoteName != nil {\n\n\t\t// query param rpo.components.rpo.remote.name\n\t\tvar qrRpoComponentsRpoRemoteName string\n\n\t\tif o.RpoComponentsRpoRemoteName != nil {\n\t\t\tqrRpoComponentsRpoRemoteName = *o.RpoComponentsRpoRemoteName\n\t\t}\n\t\tqRpoComponentsRpoRemoteName := qrRpoComponentsRpoRemoteName\n\t\tif qRpoComponentsRpoRemoteName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"rpo.components.rpo.remote.name\", qRpoComponentsRpoRemoteName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.RpoComponentsUUID != nil {\n\n\t\t// query param rpo.components.uuid\n\t\tvar qrRpoComponentsUUID string\n\n\t\tif o.RpoComponentsUUID != nil {\n\t\t\tqrRpoComponentsUUID = *o.RpoComponentsUUID\n\t\t}\n\t\tqRpoComponentsUUID := qrRpoComponentsUUID\n\t\tif qRpoComponentsUUID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"rpo.components.uuid\", qRpoComponentsUUID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.RpoIsSupported != nil {\n\n\t\t// query param rpo.is_supported\n\t\tvar qrRpoIsSupported string\n\n\t\tif o.RpoIsSupported != nil {\n\t\t\tqrRpoIsSupported = *o.RpoIsSupported\n\t\t}\n\t\tqRpoIsSupported := qrRpoIsSupported\n\t\tif qRpoIsSupported != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"rpo.is_supported\", qRpoIsSupported); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.RpoLocalDescription != nil {\n\n\t\t// query param rpo.local.description\n\t\tvar qrRpoLocalDescription string\n\n\t\tif o.RpoLocalDescription != nil {\n\t\t\tqrRpoLocalDescription = *o.RpoLocalDescription\n\t\t}\n\t\tqRpoLocalDescription := qrRpoLocalDescription\n\t\tif qRpoLocalDescription != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"rpo.local.description\", qRpoLocalDescription); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.RpoLocalName != nil {\n\n\t\t// query param rpo.local.name\n\t\tvar qrRpoLocalName string\n\n\t\tif o.RpoLocalName != nil {\n\t\t\tqrRpoLocalName = *o.RpoLocalName\n\t\t}\n\t\tqRpoLocalName := qrRpoLocalName\n\t\tif qRpoLocalName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"rpo.local.name\", qRpoLocalName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.RpoRemoteDescription != nil {\n\n\t\t// query param rpo.remote.description\n\t\tvar qrRpoRemoteDescription string\n\n\t\tif o.RpoRemoteDescription != nil {\n\t\t\tqrRpoRemoteDescription = *o.RpoRemoteDescription\n\t\t}\n\t\tqRpoRemoteDescription := qrRpoRemoteDescription\n\t\tif qRpoRemoteDescription != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"rpo.remote.description\", qRpoRemoteDescription); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.RpoRemoteName != nil {\n\n\t\t// query param rpo.remote.name\n\t\tvar qrRpoRemoteName string\n\n\t\tif o.RpoRemoteName != nil {\n\t\t\tqrRpoRemoteName = *o.RpoRemoteName\n\t\t}\n\t\tqRpoRemoteName := qrRpoRemoteName\n\t\tif qRpoRemoteName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"rpo.remote.name\", qRpoRemoteName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.SmartContainer != nil {\n\n\t\t// query param smart_container\n\t\tvar qrSmartContainer string\n\n\t\tif o.SmartContainer != nil {\n\t\t\tqrSmartContainer = *o.SmartContainer\n\t\t}\n\t\tqSmartContainer := qrSmartContainer\n\t\tif qSmartContainer != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"smart_container\", qSmartContainer); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.State != nil {\n\n\t\t// query param state\n\t\tvar qrState string\n\n\t\tif o.State != nil {\n\t\t\tqrState = *o.State\n\t\t}\n\t\tqState := qrState\n\t\tif qState != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"state\", qState); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsIopsPerTb != nil {\n\n\t\t// query param statistics.components.iops.per_tb\n\t\tvar qrStatisticsComponentsIopsPerTb string\n\n\t\tif o.StatisticsComponentsIopsPerTb != nil {\n\t\t\tqrStatisticsComponentsIopsPerTb = *o.StatisticsComponentsIopsPerTb\n\t\t}\n\t\tqStatisticsComponentsIopsPerTb := qrStatisticsComponentsIopsPerTb\n\t\tif qStatisticsComponentsIopsPerTb != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.iops.per_tb\", qStatisticsComponentsIopsPerTb); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsIopsTotal != nil {\n\n\t\t// query param statistics.components.iops.total\n\t\tvar qrStatisticsComponentsIopsTotal string\n\n\t\tif o.StatisticsComponentsIopsTotal != nil {\n\t\t\tqrStatisticsComponentsIopsTotal = *o.StatisticsComponentsIopsTotal\n\t\t}\n\t\tqStatisticsComponentsIopsTotal := qrStatisticsComponentsIopsTotal\n\t\tif qStatisticsComponentsIopsTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.iops.total\", qStatisticsComponentsIopsTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsLatencyAverage != nil {\n\n\t\t// query param statistics.components.latency.average\n\t\tvar qrStatisticsComponentsLatencyAverage string\n\n\t\tif o.StatisticsComponentsLatencyAverage != nil {\n\t\t\tqrStatisticsComponentsLatencyAverage = *o.StatisticsComponentsLatencyAverage\n\t\t}\n\t\tqStatisticsComponentsLatencyAverage := qrStatisticsComponentsLatencyAverage\n\t\tif qStatisticsComponentsLatencyAverage != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.latency.average\", qStatisticsComponentsLatencyAverage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsLatencyRaw != nil {\n\n\t\t// query param statistics.components.latency.raw\n\t\tvar qrStatisticsComponentsLatencyRaw string\n\n\t\tif o.StatisticsComponentsLatencyRaw != nil {\n\t\t\tqrStatisticsComponentsLatencyRaw = *o.StatisticsComponentsLatencyRaw\n\t\t}\n\t\tqStatisticsComponentsLatencyRaw := qrStatisticsComponentsLatencyRaw\n\t\tif qStatisticsComponentsLatencyRaw != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.latency.raw\", qStatisticsComponentsLatencyRaw); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsName != nil {\n\n\t\t// query param statistics.components.name\n\t\tvar qrStatisticsComponentsName string\n\n\t\tif o.StatisticsComponentsName != nil {\n\t\t\tqrStatisticsComponentsName = *o.StatisticsComponentsName\n\t\t}\n\t\tqStatisticsComponentsName := qrStatisticsComponentsName\n\t\tif qStatisticsComponentsName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.name\", qStatisticsComponentsName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsSharedStoragePool != nil {\n\n\t\t// query param statistics.components.shared_storage_pool\n\t\tvar qrStatisticsComponentsSharedStoragePool string\n\n\t\tif o.StatisticsComponentsSharedStoragePool != nil {\n\t\t\tqrStatisticsComponentsSharedStoragePool = *o.StatisticsComponentsSharedStoragePool\n\t\t}\n\t\tqStatisticsComponentsSharedStoragePool := qrStatisticsComponentsSharedStoragePool\n\t\tif qStatisticsComponentsSharedStoragePool != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.shared_storage_pool\", qStatisticsComponentsSharedStoragePool); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsSnapshotReserve != nil {\n\n\t\t// query param statistics.components.snapshot.reserve\n\t\tvar qrStatisticsComponentsSnapshotReserve string\n\n\t\tif o.StatisticsComponentsSnapshotReserve != nil {\n\t\t\tqrStatisticsComponentsSnapshotReserve = *o.StatisticsComponentsSnapshotReserve\n\t\t}\n\t\tqStatisticsComponentsSnapshotReserve := qrStatisticsComponentsSnapshotReserve\n\t\tif qStatisticsComponentsSnapshotReserve != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.snapshot.reserve\", qStatisticsComponentsSnapshotReserve); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsSnapshotUsed != nil {\n\n\t\t// query param statistics.components.snapshot.used\n\t\tvar qrStatisticsComponentsSnapshotUsed string\n\n\t\tif o.StatisticsComponentsSnapshotUsed != nil {\n\t\t\tqrStatisticsComponentsSnapshotUsed = *o.StatisticsComponentsSnapshotUsed\n\t\t}\n\t\tqStatisticsComponentsSnapshotUsed := qrStatisticsComponentsSnapshotUsed\n\t\tif qStatisticsComponentsSnapshotUsed != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.snapshot.used\", qStatisticsComponentsSnapshotUsed); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsSpaceAvailable != nil {\n\n\t\t// query param statistics.components.space.available\n\t\tvar qrStatisticsComponentsSpaceAvailable string\n\n\t\tif o.StatisticsComponentsSpaceAvailable != nil {\n\t\t\tqrStatisticsComponentsSpaceAvailable = *o.StatisticsComponentsSpaceAvailable\n\t\t}\n\t\tqStatisticsComponentsSpaceAvailable := qrStatisticsComponentsSpaceAvailable\n\t\tif qStatisticsComponentsSpaceAvailable != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.space.available\", qStatisticsComponentsSpaceAvailable); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsSpaceLogicalUsed != nil {\n\n\t\t// query param statistics.components.space.logical_used\n\t\tvar qrStatisticsComponentsSpaceLogicalUsed string\n\n\t\tif o.StatisticsComponentsSpaceLogicalUsed != nil {\n\t\t\tqrStatisticsComponentsSpaceLogicalUsed = *o.StatisticsComponentsSpaceLogicalUsed\n\t\t}\n\t\tqStatisticsComponentsSpaceLogicalUsed := qrStatisticsComponentsSpaceLogicalUsed\n\t\tif qStatisticsComponentsSpaceLogicalUsed != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.space.logical_used\", qStatisticsComponentsSpaceLogicalUsed); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsSpaceProvisioned != nil {\n\n\t\t// query param statistics.components.space.provisioned\n\t\tvar qrStatisticsComponentsSpaceProvisioned string\n\n\t\tif o.StatisticsComponentsSpaceProvisioned != nil {\n\t\t\tqrStatisticsComponentsSpaceProvisioned = *o.StatisticsComponentsSpaceProvisioned\n\t\t}\n\t\tqStatisticsComponentsSpaceProvisioned := qrStatisticsComponentsSpaceProvisioned\n\t\tif qStatisticsComponentsSpaceProvisioned != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.space.provisioned\", qStatisticsComponentsSpaceProvisioned); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsSpaceReservedUnused != nil {\n\n\t\t// query param statistics.components.space.reserved_unused\n\t\tvar qrStatisticsComponentsSpaceReservedUnused string\n\n\t\tif o.StatisticsComponentsSpaceReservedUnused != nil {\n\t\t\tqrStatisticsComponentsSpaceReservedUnused = *o.StatisticsComponentsSpaceReservedUnused\n\t\t}\n\t\tqStatisticsComponentsSpaceReservedUnused := qrStatisticsComponentsSpaceReservedUnused\n\t\tif qStatisticsComponentsSpaceReservedUnused != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.space.reserved_unused\", qStatisticsComponentsSpaceReservedUnused); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsSpaceSavings != nil {\n\n\t\t// query param statistics.components.space.savings\n\t\tvar qrStatisticsComponentsSpaceSavings string\n\n\t\tif o.StatisticsComponentsSpaceSavings != nil {\n\t\t\tqrStatisticsComponentsSpaceSavings = *o.StatisticsComponentsSpaceSavings\n\t\t}\n\t\tqStatisticsComponentsSpaceSavings := qrStatisticsComponentsSpaceSavings\n\t\tif qStatisticsComponentsSpaceSavings != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.space.savings\", qStatisticsComponentsSpaceSavings); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsSpaceUsed != nil {\n\n\t\t// query param statistics.components.space.used\n\t\tvar qrStatisticsComponentsSpaceUsed string\n\n\t\tif o.StatisticsComponentsSpaceUsed != nil {\n\t\t\tqrStatisticsComponentsSpaceUsed = *o.StatisticsComponentsSpaceUsed\n\t\t}\n\t\tqStatisticsComponentsSpaceUsed := qrStatisticsComponentsSpaceUsed\n\t\tif qStatisticsComponentsSpaceUsed != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.space.used\", qStatisticsComponentsSpaceUsed); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsSpaceUsedExcludingReserves != nil {\n\n\t\t// query param statistics.components.space.used_excluding_reserves\n\t\tvar qrStatisticsComponentsSpaceUsedExcludingReserves string\n\n\t\tif o.StatisticsComponentsSpaceUsedExcludingReserves != nil {\n\t\t\tqrStatisticsComponentsSpaceUsedExcludingReserves = *o.StatisticsComponentsSpaceUsedExcludingReserves\n\t\t}\n\t\tqStatisticsComponentsSpaceUsedExcludingReserves := qrStatisticsComponentsSpaceUsedExcludingReserves\n\t\tif qStatisticsComponentsSpaceUsedExcludingReserves != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.space.used_excluding_reserves\", qStatisticsComponentsSpaceUsedExcludingReserves); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsSpaceUsedPercent != nil {\n\n\t\t// query param statistics.components.space.used_percent\n\t\tvar qrStatisticsComponentsSpaceUsedPercent string\n\n\t\tif o.StatisticsComponentsSpaceUsedPercent != nil {\n\t\t\tqrStatisticsComponentsSpaceUsedPercent = *o.StatisticsComponentsSpaceUsedPercent\n\t\t}\n\t\tqStatisticsComponentsSpaceUsedPercent := qrStatisticsComponentsSpaceUsedPercent\n\t\tif qStatisticsComponentsSpaceUsedPercent != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.space.used_percent\", qStatisticsComponentsSpaceUsedPercent); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsStatisticsIncomplete != nil {\n\n\t\t// query param statistics.components.statistics_incomplete\n\t\tvar qrStatisticsComponentsStatisticsIncomplete string\n\n\t\tif o.StatisticsComponentsStatisticsIncomplete != nil {\n\t\t\tqrStatisticsComponentsStatisticsIncomplete = *o.StatisticsComponentsStatisticsIncomplete\n\t\t}\n\t\tqStatisticsComponentsStatisticsIncomplete := qrStatisticsComponentsStatisticsIncomplete\n\t\tif qStatisticsComponentsStatisticsIncomplete != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.statistics_incomplete\", qStatisticsComponentsStatisticsIncomplete); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsStorageServiceName != nil {\n\n\t\t// query param statistics.components.storage_service.name\n\t\tvar qrStatisticsComponentsStorageServiceName string\n\n\t\tif o.StatisticsComponentsStorageServiceName != nil {\n\t\t\tqrStatisticsComponentsStorageServiceName = *o.StatisticsComponentsStorageServiceName\n\t\t}\n\t\tqStatisticsComponentsStorageServiceName := qrStatisticsComponentsStorageServiceName\n\t\tif qStatisticsComponentsStorageServiceName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.storage_service.name\", qStatisticsComponentsStorageServiceName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsComponentsUUID != nil {\n\n\t\t// query param statistics.components.uuid\n\t\tvar qrStatisticsComponentsUUID string\n\n\t\tif o.StatisticsComponentsUUID != nil {\n\t\t\tqrStatisticsComponentsUUID = *o.StatisticsComponentsUUID\n\t\t}\n\t\tqStatisticsComponentsUUID := qrStatisticsComponentsUUID\n\t\tif qStatisticsComponentsUUID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.components.uuid\", qStatisticsComponentsUUID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsIopsPerTb != nil {\n\n\t\t// query param statistics.iops.per_tb\n\t\tvar qrStatisticsIopsPerTb string\n\n\t\tif o.StatisticsIopsPerTb != nil {\n\t\t\tqrStatisticsIopsPerTb = *o.StatisticsIopsPerTb\n\t\t}\n\t\tqStatisticsIopsPerTb := qrStatisticsIopsPerTb\n\t\tif qStatisticsIopsPerTb != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.iops.per_tb\", qStatisticsIopsPerTb); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsIopsTotal != nil {\n\n\t\t// query param statistics.iops.total\n\t\tvar qrStatisticsIopsTotal string\n\n\t\tif o.StatisticsIopsTotal != nil {\n\t\t\tqrStatisticsIopsTotal = *o.StatisticsIopsTotal\n\t\t}\n\t\tqStatisticsIopsTotal := qrStatisticsIopsTotal\n\t\tif qStatisticsIopsTotal != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.iops.total\", qStatisticsIopsTotal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsLatencyAverage != nil {\n\n\t\t// query param statistics.latency.average\n\t\tvar qrStatisticsLatencyAverage string\n\n\t\tif o.StatisticsLatencyAverage != nil {\n\t\t\tqrStatisticsLatencyAverage = *o.StatisticsLatencyAverage\n\t\t}\n\t\tqStatisticsLatencyAverage := qrStatisticsLatencyAverage\n\t\tif qStatisticsLatencyAverage != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.latency.average\", qStatisticsLatencyAverage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsLatencyRaw != nil {\n\n\t\t// query param statistics.latency.raw\n\t\tvar qrStatisticsLatencyRaw string\n\n\t\tif o.StatisticsLatencyRaw != nil {\n\t\t\tqrStatisticsLatencyRaw = *o.StatisticsLatencyRaw\n\t\t}\n\t\tqStatisticsLatencyRaw := qrStatisticsLatencyRaw\n\t\tif qStatisticsLatencyRaw != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.latency.raw\", qStatisticsLatencyRaw); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsSharedStoragePool != nil {\n\n\t\t// query param statistics.shared_storage_pool\n\t\tvar qrStatisticsSharedStoragePool string\n\n\t\tif o.StatisticsSharedStoragePool != nil {\n\t\t\tqrStatisticsSharedStoragePool = *o.StatisticsSharedStoragePool\n\t\t}\n\t\tqStatisticsSharedStoragePool := qrStatisticsSharedStoragePool\n\t\tif qStatisticsSharedStoragePool != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.shared_storage_pool\", qStatisticsSharedStoragePool); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsSnapshotReserve != nil {\n\n\t\t// query param statistics.snapshot.reserve\n\t\tvar qrStatisticsSnapshotReserve string\n\n\t\tif o.StatisticsSnapshotReserve != nil {\n\t\t\tqrStatisticsSnapshotReserve = *o.StatisticsSnapshotReserve\n\t\t}\n\t\tqStatisticsSnapshotReserve := qrStatisticsSnapshotReserve\n\t\tif qStatisticsSnapshotReserve != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.snapshot.reserve\", qStatisticsSnapshotReserve); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsSnapshotUsed != nil {\n\n\t\t// query param statistics.snapshot.used\n\t\tvar qrStatisticsSnapshotUsed string\n\n\t\tif o.StatisticsSnapshotUsed != nil {\n\t\t\tqrStatisticsSnapshotUsed = *o.StatisticsSnapshotUsed\n\t\t}\n\t\tqStatisticsSnapshotUsed := qrStatisticsSnapshotUsed\n\t\tif qStatisticsSnapshotUsed != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.snapshot.used\", qStatisticsSnapshotUsed); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsSpaceAvailable != nil {\n\n\t\t// query param statistics.space.available\n\t\tvar qrStatisticsSpaceAvailable string\n\n\t\tif o.StatisticsSpaceAvailable != nil {\n\t\t\tqrStatisticsSpaceAvailable = *o.StatisticsSpaceAvailable\n\t\t}\n\t\tqStatisticsSpaceAvailable := qrStatisticsSpaceAvailable\n\t\tif qStatisticsSpaceAvailable != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.space.available\", qStatisticsSpaceAvailable); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsSpaceLogicalUsed != nil {\n\n\t\t// query param statistics.space.logical_used\n\t\tvar qrStatisticsSpaceLogicalUsed string\n\n\t\tif o.StatisticsSpaceLogicalUsed != nil {\n\t\t\tqrStatisticsSpaceLogicalUsed = *o.StatisticsSpaceLogicalUsed\n\t\t}\n\t\tqStatisticsSpaceLogicalUsed := qrStatisticsSpaceLogicalUsed\n\t\tif qStatisticsSpaceLogicalUsed != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.space.logical_used\", qStatisticsSpaceLogicalUsed); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsSpaceProvisioned != nil {\n\n\t\t// query param statistics.space.provisioned\n\t\tvar qrStatisticsSpaceProvisioned string\n\n\t\tif o.StatisticsSpaceProvisioned != nil {\n\t\t\tqrStatisticsSpaceProvisioned = *o.StatisticsSpaceProvisioned\n\t\t}\n\t\tqStatisticsSpaceProvisioned := qrStatisticsSpaceProvisioned\n\t\tif qStatisticsSpaceProvisioned != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.space.provisioned\", qStatisticsSpaceProvisioned); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsSpaceReservedUnused != nil {\n\n\t\t// query param statistics.space.reserved_unused\n\t\tvar qrStatisticsSpaceReservedUnused string\n\n\t\tif o.StatisticsSpaceReservedUnused != nil {\n\t\t\tqrStatisticsSpaceReservedUnused = *o.StatisticsSpaceReservedUnused\n\t\t}\n\t\tqStatisticsSpaceReservedUnused := qrStatisticsSpaceReservedUnused\n\t\tif qStatisticsSpaceReservedUnused != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.space.reserved_unused\", qStatisticsSpaceReservedUnused); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsSpaceSavings != nil {\n\n\t\t// query param statistics.space.savings\n\t\tvar qrStatisticsSpaceSavings string\n\n\t\tif o.StatisticsSpaceSavings != nil {\n\t\t\tqrStatisticsSpaceSavings = *o.StatisticsSpaceSavings\n\t\t}\n\t\tqStatisticsSpaceSavings := qrStatisticsSpaceSavings\n\t\tif qStatisticsSpaceSavings != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.space.savings\", qStatisticsSpaceSavings); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsSpaceUsed != nil {\n\n\t\t// query param statistics.space.used\n\t\tvar qrStatisticsSpaceUsed string\n\n\t\tif o.StatisticsSpaceUsed != nil {\n\t\t\tqrStatisticsSpaceUsed = *o.StatisticsSpaceUsed\n\t\t}\n\t\tqStatisticsSpaceUsed := qrStatisticsSpaceUsed\n\t\tif qStatisticsSpaceUsed != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.space.used\", qStatisticsSpaceUsed); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsSpaceUsedExcludingReserves != nil {\n\n\t\t// query param statistics.space.used_excluding_reserves\n\t\tvar qrStatisticsSpaceUsedExcludingReserves string\n\n\t\tif o.StatisticsSpaceUsedExcludingReserves != nil {\n\t\t\tqrStatisticsSpaceUsedExcludingReserves = *o.StatisticsSpaceUsedExcludingReserves\n\t\t}\n\t\tqStatisticsSpaceUsedExcludingReserves := qrStatisticsSpaceUsedExcludingReserves\n\t\tif qStatisticsSpaceUsedExcludingReserves != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.space.used_excluding_reserves\", qStatisticsSpaceUsedExcludingReserves); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsSpaceUsedPercent != nil {\n\n\t\t// query param statistics.space.used_percent\n\t\tvar qrStatisticsSpaceUsedPercent string\n\n\t\tif o.StatisticsSpaceUsedPercent != nil {\n\t\t\tqrStatisticsSpaceUsedPercent = *o.StatisticsSpaceUsedPercent\n\t\t}\n\t\tqStatisticsSpaceUsedPercent := qrStatisticsSpaceUsedPercent\n\t\tif qStatisticsSpaceUsedPercent != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.space.used_percent\", qStatisticsSpaceUsedPercent); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StatisticsStatisticsIncomplete != nil {\n\n\t\t// query param statistics.statistics_incomplete\n\t\tvar qrStatisticsStatisticsIncomplete string\n\n\t\tif o.StatisticsStatisticsIncomplete != nil {\n\t\t\tqrStatisticsStatisticsIncomplete = *o.StatisticsStatisticsIncomplete\n\t\t}\n\t\tqStatisticsStatisticsIncomplete := qrStatisticsStatisticsIncomplete\n\t\tif qStatisticsStatisticsIncomplete != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"statistics.statistics_incomplete\", qStatisticsStatisticsIncomplete); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.SvmName != nil {\n\n\t\t// query param svm.name\n\t\tvar qrSvmName string\n\n\t\tif o.SvmName != nil {\n\t\t\tqrSvmName = *o.SvmName\n\t\t}\n\t\tqSvmName := qrSvmName\n\t\tif qSvmName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"svm.name\", qSvmName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.SvmUUID != nil {\n\n\t\t// query param svm.uuid\n\t\tvar qrSvmUUID string\n\n\t\tif o.SvmUUID != nil {\n\t\t\tqrSvmUUID = *o.SvmUUID\n\t\t}\n\t\tqSvmUUID := qrSvmUUID\n\t\tif qSvmUUID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"svm.uuid\", qSvmUUID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.TemplateName != nil {\n\n\t\t// query param template.name\n\t\tvar qrTemplateName string\n\n\t\tif o.TemplateName != nil {\n\t\t\tqrTemplateName = *o.TemplateName\n\t\t}\n\t\tqTemplateName := qrTemplateName\n\t\tif qTemplateName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"template.name\", qTemplateName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.TemplateProtocol != nil {\n\n\t\t// query param template.protocol\n\t\tvar qrTemplateProtocol string\n\n\t\tif o.TemplateProtocol != nil {\n\t\t\tqrTemplateProtocol = *o.TemplateProtocol\n\t\t}\n\t\tqTemplateProtocol := qrTemplateProtocol\n\t\tif qTemplateProtocol != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"template.protocol\", qTemplateProtocol); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.TemplateVersion != nil {\n\n\t\t// query param template.version\n\t\tvar qrTemplateVersion string\n\n\t\tif o.TemplateVersion != nil {\n\t\t\tqrTemplateVersion = *o.TemplateVersion\n\t\t}\n\t\tqTemplateVersion := qrTemplateVersion\n\t\tif qTemplateVersion != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"template.version\", qTemplateVersion); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.UUID != nil {\n\n\t\t// query param uuid\n\t\tvar qrUUID string\n\n\t\tif o.UUID != nil {\n\t\t\tqrUUID = *o.UUID\n\t\t}\n\t\tqUUID := qrUUID\n\t\tif qUUID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"uuid\", qUUID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3ec67e8d26f8cabad51d2ed01ae89a80", "score": "0.6727598", "text": "func (o *TogglePacketGeneratorsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\tif err := r.SetBodyParam(o.Toggle); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9b90a024ad428b771c88c6908f203922", "score": "0.6725414", "text": "func (o *QueryActionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param Action\n\tif err := r.SetPathParam(\"Action\", o.Action); err != nil {\n\t\treturn err\n\t}\n\n\t// path param Resource\n\tif err := r.SetPathParam(\"Resource\", o.Resource); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dc3d388b49de65ab1c3cbb6a8063ce4b", "score": "0.67246693", "text": "func (o *GetAppsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Since != nil {\n\n\t\t// query param since\n\t\tvar qrSince int64\n\t\tif o.Since != nil {\n\t\t\tqrSince = *o.Since\n\t\t}\n\t\tqSince := swag.FormatInt64(qrSince)\n\t\tif qSince != \"\" {\n\t\t\tif err := r.SetQueryParam(\"since\", qSince); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param team_id\n\tif err := r.SetPathParam(\"team_id\", swag.FormatInt64(o.TeamID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e88737b8b1134f1c2971b610e03bed78", "score": "0.67238665", "text": "func (o *GetPublicTestParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.ExpectedResult != nil {\n\n\t\t// query param expected_result\n\t\tvar qrExpectedResult string\n\t\tif o.ExpectedResult != nil {\n\t\t\tqrExpectedResult = *o.ExpectedResult\n\t\t}\n\t\tqExpectedResult := qrExpectedResult\n\t\tif qExpectedResult != \"\" {\n\t\t\tif err := r.SetQueryParam(\"expected_result\", qExpectedResult); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "10b336a324895357bc32a3a86aa11c4b", "score": "0.6722997", "text": "func (o *ChangeTaglineParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param faxlineId\n\tif err := r.SetPathParam(\"faxlineId\", o.FaxlineID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param userId\n\tif err := r.SetPathParam(\"userId\", o.UserID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1610baf0bb202df7ee77b4badf426b56", "score": "0.6717835", "text": "func (o *GetEurekaInfoParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Options != nil {\n\n\t\t// query param options\n\t\tvar qrOptions string\n\t\tif o.Options != nil {\n\t\t\tqrOptions = *o.Options\n\t\t}\n\t\tqOptions := qrOptions\n\t\tif qOptions != \"\" {\n\t\t\tif err := r.SetQueryParam(\"options\", qOptions); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Params != nil {\n\n\t\t// query param params\n\t\tvar qrParams string\n\t\tif o.Params != nil {\n\t\t\tqrParams = *o.Params\n\t\t}\n\t\tqParams := qrParams\n\t\tif qParams != \"\" {\n\t\t\tif err := r.SetQueryParam(\"params\", qParams); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "82983d33fdc1390a458f26d92d85875c", "score": "0.67173916", "text": "func (o *Upload2Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.APIVersion != nil {\n\n\t\t// query param apiVersion\n\t\tvar qrAPIVersion string\n\n\t\tif o.APIVersion != nil {\n\t\t\tqrAPIVersion = *o.APIVersion\n\t\t}\n\t\tqAPIVersion := qrAPIVersion\n\t\tif qAPIVersion != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"apiVersion\", qAPIVersion); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\t// form file param file\n\tif err := r.SetFileParam(\"file\", o.File); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0a33471571a501e8f2fd443f6ca65d76", "score": "0.67153305", "text": "func (o *HostRecordGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Fields != nil {\n\n\t\t// binding items for fields\n\t\tjoinedFields := o.bindParamFields(reg)\n\n\t\t// query array param fields\n\t\tif err := r.SetQueryParam(\"fields\", joinedFields...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param host\n\tif err := r.SetPathParam(\"host\", o.Host); err != nil {\n\t\treturn err\n\t}\n\n\t// path param svm.uuid\n\tif err := r.SetPathParam(\"svm.uuid\", o.SvmUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.UseCache != nil {\n\n\t\t// query param use_cache\n\t\tvar qrUseCache bool\n\n\t\tif o.UseCache != nil {\n\t\t\tqrUseCache = *o.UseCache\n\t\t}\n\t\tqUseCache := swag.FormatBool(qrUseCache)\n\t\tif qUseCache != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"use_cache\", qUseCache); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ae3e93c9d892009a9f69c30df513ddd4", "score": "0.671383", "text": "func (o *CreateAnOrderParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// header param Accept\n\tif err := r.SetHeaderParam(\"Accept\", o.Accept); err != nil {\n\t\treturn err\n\t}\n\n\t// header param Content-Type\n\tif err := r.SetHeaderParam(\"Content-Type\", o.ContentType); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fbc322b2ceddf0a52281e82108e01648", "score": "0.67121786", "text": "func (o *ValidateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\tif o.Body == nil {\n\t\to.Body = new(models.WorkflowSpec)\n\t}\n\n\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aa0f0bb51ea934b2d2ef2218717086be", "score": "0.6706468", "text": "func (o *GetProductModelsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Attributes != nil {\n\n\t\t// query param attributes\n\t\tvar qrAttributes string\n\t\tif o.Attributes != nil {\n\t\t\tqrAttributes = *o.Attributes\n\t\t}\n\t\tqAttributes := qrAttributes\n\t\tif qAttributes != \"\" {\n\t\t\tif err := r.SetQueryParam(\"attributes\", qAttributes); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Locales != nil {\n\n\t\t// query param locales\n\t\tvar qrLocales string\n\t\tif o.Locales != nil {\n\t\t\tqrLocales = *o.Locales\n\t\t}\n\t\tqLocales := qrLocales\n\t\tif qLocales != \"\" {\n\t\t\tif err := r.SetQueryParam(\"locales\", qLocales); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int64\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt64(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PaginationType != nil {\n\n\t\t// query param pagination_type\n\t\tvar qrPaginationType string\n\t\tif o.PaginationType != nil {\n\t\t\tqrPaginationType = *o.PaginationType\n\t\t}\n\t\tqPaginationType := qrPaginationType\n\t\tif qPaginationType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"pagination_type\", qPaginationType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Scope != nil {\n\n\t\t// query param scope\n\t\tvar qrScope string\n\t\tif o.Scope != nil {\n\t\t\tqrScope = *o.Scope\n\t\t}\n\t\tqScope := qrScope\n\t\tif qScope != \"\" {\n\t\t\tif err := r.SetQueryParam(\"scope\", qScope); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Search != nil {\n\n\t\t// query param search\n\t\tvar qrSearch string\n\t\tif o.Search != nil {\n\t\t\tqrSearch = *o.Search\n\t\t}\n\t\tqSearch := qrSearch\n\t\tif qSearch != \"\" {\n\t\t\tif err := r.SetQueryParam(\"search\", qSearch); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.SearchAfter != nil {\n\n\t\t// query param search_after\n\t\tvar qrSearchAfter string\n\t\tif o.SearchAfter != nil {\n\t\t\tqrSearchAfter = *o.SearchAfter\n\t\t}\n\t\tqSearchAfter := qrSearchAfter\n\t\tif qSearchAfter != \"\" {\n\t\t\tif err := r.SetQueryParam(\"search_after\", qSearchAfter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.WithCount != nil {\n\n\t\t// query param with_count\n\t\tvar qrWithCount bool\n\t\tif o.WithCount != nil {\n\t\t\tqrWithCount = *o.WithCount\n\t\t}\n\t\tqWithCount := swag.FormatBool(qrWithCount)\n\t\tif qWithCount != \"\" {\n\t\t\tif err := r.SetQueryParam(\"with_count\", qWithCount); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f3df4874ec0e3dcf3f6f721fdf574003", "score": "0.6702038", "text": "func (o *ImageGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param imageID\n\tif err := r.SetPathParam(\"imageID\", o.ImageID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\t// setting the default header value\n\tif err := r.SetHeaderParam(\"User-Agent\", utils.UserAgentGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetHeaderParam(\"X-Amzn-Trace-Id\", utils.AmazonTraceIDGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9b79afc2ac99bb5999211a6e9e4187e4", "score": "0.6696347", "text": "func (o *ContainerGetStdoutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\tif o.OpID != nil {\n\n\t\t// header param Op-ID\n\t\tif err := r.SetHeaderParam(\"Op-ID\", *o.OpID); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.Deadline != nil {\n\n\t\t// query param deadline\n\t\tvar qrDeadline strfmt.DateTime\n\t\tif o.Deadline != nil {\n\t\t\tqrDeadline = *o.Deadline\n\t\t}\n\t\tqDeadline := qrDeadline.String()\n\t\tif qDeadline != \"\" {\n\t\t\tif err := r.SetQueryParam(\"deadline\", qDeadline); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aca56b0c478aa069a07bec869739155d", "score": "0.66935974", "text": "func (o *QueryEventStreamHandlerParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\tif o.EndDate != nil {\n\n\t\t// query param endDate\n\t\tvar qrEndDate string\n\t\tif o.EndDate != nil {\n\t\t\tqrEndDate = *o.EndDate\n\t\t}\n\t\tqEndDate := qrEndDate\n\t\tif qEndDate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"endDate\", qEndDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PageSize != nil {\n\n\t\t// query param pageSize\n\t\tvar qrPageSize int64\n\t\tif o.PageSize != nil {\n\t\t\tqrPageSize = *o.PageSize\n\t\t}\n\t\tqPageSize := swag.FormatInt64(qrPageSize)\n\t\tif qPageSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"pageSize\", qPageSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.StartDate != nil {\n\n\t\t// query param startDate\n\t\tvar qrStartDate string\n\t\tif o.StartDate != nil {\n\t\t\tqrStartDate = *o.StartDate\n\t\t}\n\t\tqStartDate := qrStartDate\n\t\tif qStartDate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"startDate\", qStartDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// setting the default header value\n\tif err := r.SetHeaderParam(\"User-Agent\", utils.UserAgentGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetHeaderParam(\"X-Amzn-Trace-Id\", utils.AmazonTraceIDGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\n\treturn nil\n}", "title": "" } ]
970e1f90979d7ef4426e9a9c4279abe3
GetNewParentInfo Returns a slice of ErrBaseInfo structures with the first element initialized to a new ErrBaseInfo structure.
[ { "docid": "d790dfa58466460385d2ba9012c1819a", "score": "0.87010455", "text": "func (b ErrBaseInfo) GetNewParentInfo(srcFile, parentObj, funcName string, baseErrID int64) []ErrBaseInfo {\n\tvar parent []ErrBaseInfo\n\n\tbi := b.New(srcFile, parentObj, funcName, baseErrID)\n\n\treturn append(parent, bi)\n}", "title": "" } ]
[ { "docid": "faa94d39f916a9749a03f0fe850eafb7", "score": "0.6864566", "text": "func (s *SpecErr) DeepCopyParentInfo(pi []ErrBaseInfo) []ErrBaseInfo {\n\n\tif len(pi) == 0 {\n\t\treturn pi\n\t}\n\n\ta := make([]ErrBaseInfo, 0, len(pi)+10)\n\tfor _, bi := range pi {\n\t\ta = append(a, bi.NewBaseInfo())\n\t}\n\n\treturn a\n}", "title": "" }, { "docid": "6775fa7b9a8333fca99d19d13a42c415", "score": "0.6507974", "text": "func (s *SpecErr) AddParentInfo(parent []ErrBaseInfo) {\n\tif len(parent) == 0 {\n\t\treturn\n\t}\n\n\tx := s.DeepCopyParentInfo(parent)\n\n\tfor _, bi := range x {\n\t\ts.ParentInfo = append(s.ParentInfo, bi.NewBaseInfo())\n\t}\n\n\treturn\n\n}", "title": "" }, { "docid": "737c7937b029761a7c2886530486ba2d", "score": "0.638149", "text": "func (s *SpecErr) SetParentInfo(parent []ErrBaseInfo) {\n\tif len(parent) == 0 {\n\t\treturn\n\t}\n\n\ts.ParentInfo = s.DeepCopyParentInfo(parent)\n}", "title": "" }, { "docid": "609f2c940f090a1b64dc1c8d040919aa", "score": "0.63736135", "text": "func (b ErrBaseInfo) NewBaseInfo() ErrBaseInfo {\n\treturn ErrBaseInfo{SourceFileName: b.SourceFileName, ParentObjectName: b.ParentObjectName, FuncName: b.FuncName, BaseErrorId: b.BaseErrorId}\n}", "title": "" }, { "docid": "e5b44d51d41f17255e04510f0a2c2652", "score": "0.59913373", "text": "func (b ErrBaseInfo) New(srcFile, parentObjName, funcName string, baseErrID int64) ErrBaseInfo {\n\treturn ErrBaseInfo{SourceFileName: srcFile, ParentObjectName: parentObjName, FuncName: funcName, BaseErrorId: baseErrID}\n}", "title": "" }, { "docid": "9335b69e1924d6a509f4acb736d4d4ac", "score": "0.5876106", "text": "func (s *SpecErr) AddBaseToParentInfo() []ErrBaseInfo {\n\n\ta := s.DeepCopyParentInfo(s.ParentInfo)\n\treturn append(a, s.BaseInfo.DeepCopyBaseInfo())\n}", "title": "" }, { "docid": "be31510b77423b62da43923063f415e5", "score": "0.58116806", "text": "func (s *SpecErr) ConfigureParentInfoFromParentSpecErr(parentSpecErr SpecErr) {\n\n\ts.AddParentInfo(parentSpecErr.ParentInfo)\n\n\ts.ParentInfo = append(s.ParentInfo, parentSpecErr.DeepCopyBaseInfo())\n\n}", "title": "" }, { "docid": "35548e555a61fea0727ca4532fa4494f", "score": "0.58078533", "text": "func (e *FatalClientErr) Parent() error {\n\treturn e.ParentErr\n}", "title": "" }, { "docid": "33757d50c72424fb398449b2eb7c66f6", "score": "0.5792451", "text": "func TestNewBaseInfo(t *testing.T) {\n\tex1 := \"TestSourceFileName\"\n\tex1ParentObj := \"TestObject\"\n\tex2 := \"TestFuncName\"\n\tex3 := int64(9000)\n\n\tx := ErrBaseInfo{}.New(ex1, ex1ParentObj, ex2, ex3)\n\n\tif x.SourceFileName != ex1 {\n\t\tt.Error(fmt.Sprintf(\"Expected %v got,\", ex1), x.SourceFileName)\n\t}\n\n\tif x.ParentObjectName != ex1ParentObj {\n\t\tt.Errorf(\"Expected x.ParentObjectName= %v. Instead, got: '%v'\", ex1ParentObj, x.ParentObjectName)\n\t}\n\n\tif x.FuncName != ex2 {\n\t\tt.Error(fmt.Sprintf(\"Expected %v got,\", ex2), x.FuncName)\n\t}\n\n\tif x.BaseErrorId != ex3 {\n\t\tt.Error(fmt.Sprintf(\"Expected %v got,\", ex3), x.BaseErrorId)\n\t}\n\n}", "title": "" }, { "docid": "8ec6e72cdda203fdfa406b8fa4ae7273", "score": "0.5655694", "text": "func (s SpecErr) InitializeBaseInfo(parent []ErrBaseInfo, currentBaseInfo ErrBaseInfo) SpecErr {\n\n\treturn SpecErr{\n\t\tParentInfo: s.DeepCopyParentInfo(parent),\n\t\tBaseInfo: currentBaseInfo.DeepCopyBaseInfo()}\n}", "title": "" }, { "docid": "33e9c41782886916cbd8e89f7f56667d", "score": "0.56165564", "text": "func (e Err) Parent() error {\n\treturn e.parentErr\n}", "title": "" }, { "docid": "566217a3a49c167994df339bb1b9b35a", "score": "0.56153643", "text": "func (e *ClientErr) Parent() error {\n\treturn e.ParentErr\n}", "title": "" }, { "docid": "5957ef9f8e4253694256d491c5e84343", "score": "0.5362926", "text": "func (e *ErrorClass) Parent() *ErrorClass {\n\treturn e.parent\n}", "title": "" }, { "docid": "9b4c701f361b0711211a4fc5108b33c9", "score": "0.5301147", "text": "func (b ErrBaseInfo) DeepCopyBaseInfo() ErrBaseInfo {\n\treturn ErrBaseInfo{SourceFileName: b.SourceFileName, ParentObjectName: b.ParentObjectName, FuncName: b.FuncName, BaseErrorId: b.BaseErrorId}\n}", "title": "" }, { "docid": "efc52ecda6217c5a404cd785d78c3fc3", "score": "0.50835526", "text": "func (ieri IdxEntityRefInfo) ParentEntity() *IdxEntityInfo {\n\to := ieri.c.parentEntity\n\n\tvar gop_o *IdxEntityInfo\n\tif o != nil {\n\t\tgop_o = &IdxEntityInfo{o}\n\t}\n\n\treturn gop_o\n}", "title": "" }, { "docid": "c953cd2dad0ac2a2ac269f35650a4411", "score": "0.50281835", "text": "func NewParentReferences(referencedMarkers *Markers) (newParentReferences *ParentReferences) {\n\tnewParentReferences = &ParentReferences{\n\t\tparentSequences: referencedMarkers.SequenceIDs(),\n\t\treferences: make(map[SequenceID]*thresholdmap.ThresholdMap),\n\t}\n\n\tinitialSequenceIndex := referencedMarkers.HighestIndex() + 1\n\treferencedMarkers.ForEach(func(sequenceID SequenceID, index Index) bool {\n\t\tthresholdMap := thresholdmap.New(thresholdmap.LowerThresholdMode)\n\n\t\tthresholdMap.Set(uint64(initialSequenceIndex), uint64(index))\n\t\tnewParentReferences.references[sequenceID] = thresholdMap\n\n\t\treturn true\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "4de4214c6db876285f4ffe5bc390deb3", "score": "0.49821246", "text": "func (e *Err) SetParent(err error) *Err {\n\te.parentErr = err\n\treturn e\n}", "title": "" }, { "docid": "73b0a663c7ec10a28e7fcfbbc7bc180a", "score": "0.49278075", "text": "func TestNewFunc(t *testing.T) {\n\tex1 := \"TestSourceFileName\"\n\tex1ParentObj := \"TestObject\"\n\tex2 := \"TestFuncName\"\n\tex3 := int64(9000)\n\tex4 := \"NewFuncName\"\n\n\tx := ErrBaseInfo{}.New(ex1, ex1ParentObj, ex2, ex3)\n\n\tif x.FuncName != ex2 {\n\t\tt.Error(fmt.Sprintf(\"Expected %v got,\", ex2), x.FuncName)\n\t}\n\n\ty := x.NewFunc(ex4)\n\n\tif y.SourceFileName != ex1 {\n\t\tt.Error(fmt.Sprintf(\"Expected %v got,\", ex1), y.SourceFileName)\n\t}\n\n\tif y.ParentObjectName != ex1ParentObj {\n\t\tt.Errorf(\"Expected y.ParentObjectName= %v. Instead, got: %v\", ex1ParentObj, y.ParentObjectName)\n\t}\n\n\tif y.FuncName != ex4 {\n\t\tt.Error(fmt.Sprintf(\"Expected %v got,\", ex4), y.FuncName)\n\t}\n\n\tif y.BaseErrorId != ex3 {\n\t\tt.Error(fmt.Sprintf(\"Expected %v got,\", ex3), y.BaseErrorId)\n\t}\n}", "title": "" }, { "docid": "426157d27796e0771a5427d3dbf8515d", "score": "0.4926874", "text": "func (m *_BACnetLogDataLogDataEntryFailure) InitializeParent(parent BACnetLogDataLogDataEntry, peekedTagHeader BACnetTagHeader) {\n\tm.PeekedTagHeader = peekedTagHeader\n}", "title": "" }, { "docid": "d2e58d6adc9263517c60495503f31873", "score": "0.4879797", "text": "func ToParentExecutionInfo(t *history.ParentExecutionInfo) *types.ParentExecutionInfo {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &types.ParentExecutionInfo{\n\t\tDomainUUID: t.GetDomainUUID(),\n\t\tDomain: t.GetDomain(),\n\t\tExecution: ToWorkflowExecution(t.Execution),\n\t\tInitiatedID: t.GetInitiatedId(),\n\t}\n}", "title": "" }, { "docid": "e999848dc340eed83a75438dccf89766", "score": "0.48733518", "text": "func GenerateNewTraceParent() TraceParent {\n\ttp := TraceParent{\n\t\tVersion: \"00\",\n\t\tTraceID: GenerateRandomHexString(TraceIDLength),\n\t\tSpanID: GenerateRandomHexString(SpanIDLength),\n\t\tFlags: \"00\",\n\t}\n\n\treturn tp\n}", "title": "" }, { "docid": "42b19c4be9d84cbd573cf8cd71849094", "score": "0.4859695", "text": "func newErrNotPrimary(si *meta.Snode, smap *smapX, detail ...string) *errNotPrimary {\n\tif len(detail) == 0 {\n\t\treturn &errNotPrimary{si, smap, \"\"}\n\t}\n\treturn &errNotPrimary{si, smap, detail[0]}\n}", "title": "" }, { "docid": "f2e01cfae3eaa17c25da359b2a2989a6", "score": "0.48345515", "text": "func (e *Entity) GetParent(_ resource.Type) (resource.Type, string) {\n\tif e.ApplicationID.Valid {\n\t\treturn resource.Application, e.ApplicationID.String\n\t} else if e.ApplicationTemplateVersionID.Valid {\n\t\treturn resource.ApplicationTemplateVersion, e.ApplicationTemplateVersionID.String\n\t}\n\n\treturn \"\", \"\"\n}", "title": "" }, { "docid": "16588415c7f1b36de9b706e34ce7b938", "score": "0.4816499", "text": "func (s *SpecErr) DeepCopyBaseInfo() ErrBaseInfo {\n\treturn s.BaseInfo.DeepCopyBaseInfo()\n}", "title": "" }, { "docid": "69cfba7916c4f0bcdde751cc4f10bbe8", "score": "0.4810634", "text": "func (s SpecErr) InitializeCurrentBaseInfo(currentBaseInfo ErrBaseInfo) SpecErr {\n\n\treturn SpecErr{\n\t\tBaseInfo: currentBaseInfo.DeepCopyBaseInfo()}\n\n}", "title": "" }, { "docid": "da6fb95ee92fb704cd96c14a9d7149d7", "score": "0.47947568", "text": "func (x *DeltaArchiveManifest) GetNewRootfsInfo() *PartitionInfo {\n\tif x != nil {\n\t\treturn x.NewRootfsInfo\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8ca83f6959bf2a41f8c4dcd81ab9e123", "score": "0.47792482", "text": "func (x *DeltaArchiveManifest) GetNewKernelInfo() *PartitionInfo {\n\tif x != nil {\n\t\treturn x.NewKernelInfo\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "766da46a41f5b261a9318187bbd4b08a", "score": "0.4768996", "text": "func (m *_APDUError) InitializeParent(parent APDU) {}", "title": "" }, { "docid": "b20513680898e6a1d7fd5d9aeb520546", "score": "0.4764046", "text": "func New(l int, c []int, e []string) Perror {\n\treturn perror{\n\t\tl: l,\n\t\tc: c,\n\t\te: e,\n\t}\n}", "title": "" }, { "docid": "118336cdfeb452e9eddae08b2cb3b04e", "score": "0.47312003", "text": "func (e BaselineGroupEdges) ParentOrErr() (*BaselineCharacteristicsModule, error) {\n\tif e.loadedTypes[0] {\n\t\tif e.Parent == nil {\n\t\t\t// The edge parent was loaded in eager-loading,\n\t\t\t// but was not found.\n\t\t\treturn nil, &NotFoundError{label: baselinecharacteristicsmodule.Label}\n\t\t}\n\t\treturn e.Parent, nil\n\t}\n\treturn nil, &NotLoadedError{edge: \"parent\"}\n}", "title": "" }, { "docid": "bb609feccc575b1b6178f298b4e5890f", "score": "0.4708093", "text": "func (f *Factory) readParentLocators() (parentlocator.ParentLocators, error) {\n\tvar err error\n\tcount := 8\n\tparentLocators := make(parentlocator.ParentLocators, count)\n\toffset := f.headerOffset + 576\n\tfor i := 0; i < count; i++ {\n\t\tparentLocFac := parentlocator.NewFactory(f.vhdReader, offset)\n\t\tparentLocators[i], err = parentLocFac.Create()\n\t\tif err != nil {\n\t\t\treturn nil, NewParseError(\"ParentLocator\", err)\n\t\t}\n\t\toffset += 24\n\t}\n\n\treturn parentLocators, nil\n}", "title": "" }, { "docid": "a4f6d6605189c78d60bc048dd9ae6ed4", "score": "0.46907204", "text": "func (m *_ModbusPDUGetComEventLogResponse) InitializeParent(parent ModbusPDU) {}", "title": "" }, { "docid": "eaba838049c2ad09b061088ba86cfce9", "score": "0.46837297", "text": "func FromParentExecutionInfo(t *types.ParentExecutionInfo) *history.ParentExecutionInfo {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &history.ParentExecutionInfo{\n\t\tDomainUUID: &t.DomainUUID,\n\t\tDomain: &t.Domain,\n\t\tExecution: FromWorkflowExecution(t.Execution),\n\t\tInitiatedId: &t.InitiatedID,\n\t}\n}", "title": "" }, { "docid": "1190888f154bec2320a0e9c4d38fd0f2", "score": "0.4669387", "text": "func ErrNew(code int, text string) Error {\n\treturn &errorString{code, text}\n}", "title": "" }, { "docid": "64af4e2dbf41b6a2f09e8e8b55f4d216", "score": "0.4664865", "text": "func (s *SpecErr) ConfigureBaseInfo(newBaseInfo ErrBaseInfo) {\n\ts.BaseInfo = newBaseInfo.DeepCopyBaseInfo()\n}", "title": "" }, { "docid": "98c5283e52cad3f0f34c471f0e28bf14", "score": "0.46626422", "text": "func (s *SpecErr) SetBaseInfo(bi ErrBaseInfo) {\n\ts.BaseInfo = bi.NewBaseInfo()\n}", "title": "" }, { "docid": "61136e9dccf78ff6cfea75a10c329237", "score": "0.4592738", "text": "func NewSpaceParentBadRequest() *SpaceParentBadRequest {\n\treturn &SpaceParentBadRequest{}\n}", "title": "" }, { "docid": "eccbd5b8213bcace183f2e1bea09f125", "score": "0.45906696", "text": "func (o LookupProjectResultOutput) Parent() ResourceIdResponseOutput {\n\treturn o.ApplyT(func(v LookupProjectResult) ResourceIdResponse { return v.Parent }).(ResourceIdResponseOutput)\n}", "title": "" }, { "docid": "0ba2998975a4e2a57f2b7a99db3a05e0", "score": "0.45874056", "text": "func (c OKPD1) GetParentCode() string {\n\treturn c.ParentCode\n}", "title": "" }, { "docid": "e0c9f18fbc7028f1cbb74ea9ce38a4c6", "score": "0.45282742", "text": "func (m *_ModbusPDUDiagnosticResponse) InitializeParent(parent ModbusPDU) {}", "title": "" }, { "docid": "52bdb41f293dd8583ea430e75c5c5429", "score": "0.452271", "text": "func Parent(i uint) (uint, error) {\n\tif i == 0 {\n\t\treturn 0, errors.New(\"no parent\")\n\t}\n\treturn (i - 1) / 2, nil // integer division truncates, thus floor result\n}", "title": "" }, { "docid": "20a2cb6bdd14bf163b7701e32d6a62f1", "score": "0.45091927", "text": "func (*stdLogic) CreateParents(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tvar prts []structs.Parents\n\tvar errs []structs.ErrorMessage\n\n\t_ = json.NewDecoder(r.Body).Decode(&prts)\n\n\tfor j := range prts {\n\t\tprt, errStr := stdService.ValidateParent(&prts[j])\n\t\tif errStr != nil {\n\t\t\terrs = append(errs, *errStr)\n\t\t\tcontinue\n\t\t}\n\n\t\tvar checkFamily int\n\t\tfor i := range prts[j].Students {\n\t\t\tcheckFamily = stdService.CheckFamily(prts[j].FamilyID, prts[j].Students[i].ID, prts[j].ID)\n\t\t\tif checkFamily != 0 {\n\t\t\t\terrStr := structs.ErrorMessage{Data: prts[j].Name, Message: structs.Family, SysMessage: \"\", Code: http.StatusInternalServerError}\n\t\t\t\terrs = append(errs, errStr)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif checkFamily != 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tif prts[j].Email != \"\" {\n\t\t\tcheckEmail := stdService.CheckEmail(prts[j].Email, prts[j].UserID)\n\t\t\tif checkEmail != 0 {\n\t\t\t\terrStr := structs.ErrorMessage{Data: prts[j].Email, Message: structs.Email, SysMessage: \"\", Code: http.StatusInternalServerError}\n\t\t\t\terrs = append(errs, errStr)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\terrStr = stdService.CreateParent(*prt)\n\t\tif errStr.Code != http.StatusOK {\n\t\t\terrs = append(errs, *errStr)\n\t\t\tcontinue\n\t\t} else {\n\t\t\terrs = append(errs, structs.ErrorMessage{Data: prts[j].Name, Message: structs.Success, SysMessage: \"\", Code: http.StatusOK})\n\t\t}\n\t}\n\tcommon.JSONErrs(w, &errs)\n\treturn\n\n}", "title": "" }, { "docid": "4465159995ce5eacbd8755b461ea25fb", "score": "0.44945708", "text": "func (e BaselineDenomEdges) ParentOrErr() (*BaselineCharacteristicsModule, error) {\n\tif e.loadedTypes[0] {\n\t\tif e.Parent == nil {\n\t\t\t// The edge parent was loaded in eager-loading,\n\t\t\t// but was not found.\n\t\t\treturn nil, &NotFoundError{label: baselinecharacteristicsmodule.Label}\n\t\t}\n\t\treturn e.Parent, nil\n\t}\n\treturn nil, &NotLoadedError{edge: \"parent\"}\n}", "title": "" }, { "docid": "75930d8a842a2492425f2b96123e6c4a", "score": "0.4477861", "text": "func (k *Generic) Parent() ds.Key {\n\tif len(k.toks) <= 1 {\n\t\treturn nil\n\t}\n\treturn &Generic{k.appID, k.namespace, k.toks[:len(k.toks)-1]}\n}", "title": "" }, { "docid": "6b7d75ae7b8d7cf931cfdb5ff22c1882", "score": "0.44605544", "text": "func (s SpecErr) InitializeBaseInfoWithSpecErr(parentSpeErr SpecErr, currentBaseInfo ErrBaseInfo) SpecErr {\n\n\tse := SpecErr{}\n\n\tse.ConfigureContext(parentSpeErr, currentBaseInfo)\n\n\treturn se\n\n}", "title": "" }, { "docid": "33408ebec639e9cca260ad715704ce8c", "score": "0.4456338", "text": "func (_class VDIClass) GetParent(sessionID SessionRef, self VDIRef) (_retval VDIRef, _err error) {\n\tif IsMock {\n\t\treturn _class.GetParentMock(sessionID, self)\n\t}\t\n\t_method := \"VDI.get_parent\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertVDIRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertVDIRefToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" }, { "docid": "028c28f006ed683f24c22d5d08207def", "score": "0.44352195", "text": "func (m *Rpc) Parent() Meta {\n\treturn m.parent\n}", "title": "" }, { "docid": "5351b8874718c52a15e3e7f03b878200", "score": "0.4428466", "text": "func NewInfo() *Info {\n\tinfo := NewBaseInfo()\n\truntime.SetFinalizer(info, func(i *Info) {\n\t\tif i.info != nil {\n\t\t\tC.DestroyImageInfo(i.info)\n\t\t\ti.info = nil\n\t\t}\n\t})\n\treturn info\n}", "title": "" }, { "docid": "883149e92912e9594db86a855d880c0c", "score": "0.4426182", "text": "func (pe PipelineEvent) ParentSpanID() (*string, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "0ddbbc101aaea3a2e8f91731a937700b", "score": "0.44223914", "text": "func (c OKPD2) GetParentCode() string {\n\treturn c.ParentCode\n}", "title": "" }, { "docid": "fe1594f726b6a29f7428f318b1a49f4d", "score": "0.4411994", "text": "func NewParent(ctx context.Context, name string) (context.Context, func()) {\n\tt := fromContext(ctx)\n\treturn t.new(ctx, name)\n}", "title": "" }, { "docid": "8a5d8dd21b3a6501fbe24ecfec13c904", "score": "0.44002616", "text": "func (m *Notification) Parent() Meta {\n\treturn m.parent\n}", "title": "" }, { "docid": "49a0c3d573cac30c57b05e7c87532c46", "score": "0.43982387", "text": "func (_ITellor *ITellorCallerSession) GetNewCurrentVariables() (struct {\n\tChallenge [32]byte\n\tRequestIds [5]*big.Int\n\tDifficutly *big.Int\n\tTip *big.Int\n}, error) {\n\treturn _ITellor.Contract.GetNewCurrentVariables(&_ITellor.CallOpts)\n}", "title": "" }, { "docid": "d9919d89618c292cf2a6d275af8a2a75", "score": "0.4379109", "text": "func (c *OrganizationsCreateCall) Parent(parent string) *OrganizationsCreateCall {\n\tc.urlParams_.Set(\"parent\", parent)\n\treturn c\n}", "title": "" }, { "docid": "6390949d1d84985b522f7d3aa5d1ae4f", "score": "0.43764475", "text": "func ErrNewInformer(err error) error {\n\treturn errors.New(ErrNewInformerCode, errors.Alert, []string{\"Error creating informer client\"}, []string{err.Error()}, []string{\"Informer is invalid or doesnt exist\"}, []string{\"Makes sure the you input valid resource for the informer\"})\n}", "title": "" }, { "docid": "51b803bb280d4887047f43f5aea9818f", "score": "0.4375566", "text": "func (m *RpcInput) Parent() Meta {\n\treturn m.parent\n}", "title": "" }, { "docid": "73a2714dcb31ca95904f8432541ed835", "score": "0.43684363", "text": "func (c *FuchsiaSDKRepoManagerConfig) splitParentChild() (parent.GitilesConfig, child.FuchsiaSDKConfig, error) {\n\tvar transitiveDeps []*version_file_common.TransitiveDepConfig\n\tif c.IncludeMacSDK {\n\t\ttransitiveDeps = []*version_file_common.TransitiveDepConfig{\n\t\t\t{\n\t\t\t\tChild: &version_file_common.VersionFileConfig{\n\t\t\t\t\tID: child.FuchsiaSDKGSLatestPathMac,\n\t\t\t\t\tPath: FuchsiaSDKVersionFilePathMac,\n\t\t\t\t},\n\t\t\t\tParent: &version_file_common.VersionFileConfig{\n\t\t\t\t\tID: child.FuchsiaSDKGSLatestPathMac,\n\t\t\t\t\tPath: FuchsiaSDKVersionFilePathMac,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n\tparentCfg := parent.GitilesConfig{\n\t\tDependencyConfig: version_file_common.DependencyConfig{\n\t\t\tVersionFileConfig: version_file_common.VersionFileConfig{\n\t\t\t\tID: \"FuchsiaSDK\",\n\t\t\t\tPath: FuchsiaSDKVersionFilePathLinux,\n\t\t\t},\n\t\t\tTransitiveDeps: transitiveDeps,\n\t\t},\n\t\tGitilesConfig: gitiles_common.GitilesConfig{\n\t\t\tBranch: c.NoCheckoutRepoManagerConfig.CommonRepoManagerConfig.ParentBranch,\n\t\t\tRepoURL: c.NoCheckoutRepoManagerConfig.CommonRepoManagerConfig.ParentRepo,\n\t\t},\n\t\tGerrit: c.Gerrit,\n\t}\n\tif err := parentCfg.Validate(); err != nil {\n\t\treturn parent.GitilesConfig{}, child.FuchsiaSDKConfig{}, skerr.Wrapf(err, \"generated parent config is invalid\")\n\t}\n\tchildCfg := child.FuchsiaSDKConfig{\n\t\tIncludeMacSDK: c.IncludeMacSDK,\n\t}\n\tif err := childCfg.Validate(); err != nil {\n\t\treturn parent.GitilesConfig{}, child.FuchsiaSDKConfig{}, skerr.Wrapf(err, \"generated child config is invalid\")\n\t}\n\treturn parentCfg, childCfg, nil\n}", "title": "" }, { "docid": "f0e2d3582ce6866cc7ff8a46eb7d9026", "score": "0.4356297", "text": "func newErr(err error) *Rlerror {\n\treturn &Rlerror{Error: uint32(ExtractErrno(err))}\n}", "title": "" }, { "docid": "10cb66d3bbdfa52f8b5e1ac06b568cd5", "score": "0.4353236", "text": "func (m *RpcOutput) Parent() Meta {\n\treturn m.parent\n}", "title": "" }, { "docid": "99f15e178c13c4252445695f4804c614", "score": "0.43489558", "text": "func (e GetClusterInfoRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "775b4f5566a53e1a9057e02adf83b00c", "score": "0.4335426", "text": "func (o LookupProjectResultOutput) Parent() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupProjectResult) string { return v.Parent }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "97e6531935f39428c77d2c9f4f0fb3c8", "score": "0.433328", "text": "func (self *CFrameT) GetParent() (ret *CFrameT) {\n\n\tcRet := C.cefingo_frame_get_parent((*C.cef_frame_t)(self.pc_frame))\n\n\tret = newCFrameT(cRet, byApp) // return GoObj\n\treturn ret\n}", "title": "" }, { "docid": "f52bed53ed957579f4e4f1c3bb565c11", "score": "0.43266904", "text": "func (c OKPD1) GetParentRow() int {\n\treturn c.ParentRow\n}", "title": "" }, { "docid": "6fcbbcae867d2c88a548b96c83befd88", "score": "0.43230626", "text": "func ParentInfoFromArgs(args []jsonutil.JSONMetaNode, segs []string) (jsonutil.JSONMetaNode, []string, error) {\n\tif len(args) == 0 {\n\t\treturn nil, segs, nil\n\t}\n\n\tvar bestCommonAnc jsonutil.JSONMetaNode\n\tvar remSegs []string\n\n\tfor _, arg := range args {\n\t\tif arg == nil {\n\t\t\tcontinue\n\t\t}\n\t\troot := arg\n\t\tfor root.Parent() != nil {\n\t\t\troot = root.Parent()\n\t\t}\n\n\t\t// Make sure this isn't just some const string arg.\n\t\tif _, ok := root.(jsonutil.JSONMetaPrimitiveNode); ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tp := arg.Path()\n\t\targSegs, err := jsonutil.SegmentPath(p)\n\t\tif err != nil {\n\t\t\treturn nil, segs, fmt.Errorf(\"argument %q does not have a valid path %s: %v\", arg.ProvenanceString(), p, err)\n\t\t}\n\n\t\tcommonAnc, rem, err := getCommonAncestor(root, argSegs, segs)\n\n\t\t// The best common node is the one closest to the leaf we want.\n\t\tif bestCommonAnc == nil || len(rem) < len(remSegs) {\n\t\t\tbestCommonAnc = commonAnc\n\t\t\tremSegs = rem\n\t\t}\n\t}\n\n\treturn bestCommonAnc, remSegs, nil\n}", "title": "" }, { "docid": "fb3d8c92702a1e7fb6ec45b767d2dd3c", "score": "0.43213582", "text": "func (o LookupProjectResultOutput) ParentId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LookupProjectResult) *string { return v.ParentId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5f462c32d46bc15dd3ed2735de9f67ed", "score": "0.43186536", "text": "func newClientErr(idx int, err error) error {\n\treturn newIterErr(\"client\", idx, err)\n}", "title": "" }, { "docid": "7e5fbaa6de6966ee373c4a7a56e06e2c", "score": "0.43103775", "text": "func (o *V1BioProject) GetParentAccessionsOk() (*[]string, bool) {\n\tif o == nil || o.ParentAccessions == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ParentAccessions, true\n}", "title": "" }, { "docid": "a0c9935ec359b8cad1fc7cf64e232e6e", "score": "0.43049562", "text": "func (*PParentInfo) Descriptor() ([]byte, []int) {\n\treturn file_v1_Span_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "a6c1cf9006a7a6daff3ab35d9f49713f", "score": "0.4303444", "text": "func ErrNewCode(code int) Error {\n\treturn &errorString{code, e.GetMsg(code),}\n}", "title": "" }, { "docid": "ea420ee09f6b415d2dd85527daeb72c2", "score": "0.43023035", "text": "func (e *RichEdit) ParentCreatedAt() *time.Ticket {\n\treturn e.parentCreatedAt\n}", "title": "" }, { "docid": "a5064d4b86546c012182a863043a4465", "score": "0.42970753", "text": "func createParents(parent distro.Distro, numNewParents int, pool *evergreen.ContainerPool) []Host {\n\thostsSpawned := make([]Host, numNewParents)\n\n\tfor idx := range hostsSpawned {\n\t\thostsSpawned[idx] = *NewIntent(parent, parent.GenerateName(), parent.Provider, generateParentCreateOptions(pool))\n\t}\n\treturn hostsSpawned\n}", "title": "" }, { "docid": "2b1055ee1193f1014eebc70ccaa5187f", "score": "0.42950785", "text": "func (b ErrBaseInfo) NewFunc(funcName string) ErrBaseInfo {\n\treturn ErrBaseInfo{SourceFileName: b.SourceFileName, ParentObjectName: b.ParentObjectName, FuncName: funcName, BaseErrorId: b.BaseErrorId}\n}", "title": "" }, { "docid": "63fd896d1a026bf4cbbee5e882ae2997", "score": "0.4291783", "text": "func GetParentSvgMap(rawSvg map[string]*pb.StatVarGroupNode) map[string][]string {\n\tparentSvgMap := map[string][]string{}\n\tfor svgID, svgData := range rawSvg {\n\t\tfor _, childSvg := range svgData.ChildStatVarGroups {\n\t\t\tif _, ok := parentSvgMap[childSvg.Id]; !ok {\n\t\t\t\tparentSvgMap[childSvg.Id] = []string{}\n\t\t\t}\n\t\t\tparentSvgMap[childSvg.Id] = append(parentSvgMap[childSvg.Id], svgID)\n\t\t}\n\t\tfor _, childSv := range svgData.ChildStatVars {\n\t\t\tif _, ok := parentSvgMap[childSv.Id]; !ok {\n\t\t\t\tparentSvgMap[childSv.Id] = []string{}\n\t\t\t}\n\t\t\tparentSvgMap[childSv.Id] = append(parentSvgMap[childSv.Id], svgID)\n\t\t}\n\t}\n\tfor _, parentSvgList := range parentSvgMap {\n\t\tsort.Strings(parentSvgList)\n\t}\n\treturn parentSvgMap\n}", "title": "" }, { "docid": "f313429941cd23677f33d0893494a4e3", "score": "0.42804652", "text": "func Info(err error, cmd ...interface{}) *ErrorInfo {\n\treturn &Frame{Err: err, Args: cmd}\n}", "title": "" }, { "docid": "0b52bc4880cac729a5e7e1870073adf6", "score": "0.42730102", "text": "func ParentReferencesFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (parentReferences *ParentReferences, err error) {\n\tparentReferences = &ParentReferences{\n\t\treferences: make(map[SequenceID]*thresholdmap.ThresholdMap),\n\t}\n\tif parentReferences.parentSequences, err = SequenceIDsFromMarshalUtil(marshalUtil); err != nil {\n\t\terr = xerrors.Errorf(\"failed to parse parent SequenceIDs from MarshalUtil: %w\", err)\n\t\treturn\n\t}\n\n\tsequenceCount, err := marshalUtil.ReadUint64()\n\tif err != nil {\n\t\terr = xerrors.Errorf(\"failed to parse Sequence count (%v): %w\", err, cerrors.ErrParseBytesFailed)\n\t\treturn\n\t}\n\tfor i := uint64(0); i < sequenceCount; i++ {\n\t\tsequenceID, sequenceIDErr := SequenceIDFromMarshalUtil(marshalUtil)\n\t\tif sequenceIDErr != nil {\n\t\t\terr = xerrors.Errorf(\"failed to parse SequenceID from MarshalUtil: %w\", sequenceIDErr)\n\t\t\treturn\n\t\t}\n\n\t\treferenceCount, referenceCountErr := marshalUtil.ReadUint64()\n\t\tif referenceCountErr != nil {\n\t\t\terr = xerrors.Errorf(\"failed to parse reference count (%v): %w\", referenceCountErr, cerrors.ErrParseBytesFailed)\n\t\t\treturn\n\t\t}\n\t\tthresholdMap := thresholdmap.New(thresholdmap.LowerThresholdMode)\n\t\tfor j := uint64(0); j < referenceCount; j++ {\n\t\t\treferencingIndex, referencingIndexErr := marshalUtil.ReadUint64()\n\t\t\tif referencingIndexErr != nil {\n\t\t\t\terr = xerrors.Errorf(\"failed to read referencing Index (%v): %w\", referencingIndexErr, cerrors.ErrParseBytesFailed)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\treferencedIndex, referencedIndexErr := marshalUtil.ReadUint64()\n\t\t\tif referencedIndexErr != nil {\n\t\t\t\terr = xerrors.Errorf(\"failed to read referenced Index (%v): %w\", referencedIndexErr, cerrors.ErrParseBytesFailed)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthresholdMap.Set(referencingIndex, referencedIndex)\n\t\t}\n\t\tparentReferences.references[sequenceID] = thresholdMap\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "b30198588433a22a3fcc417d29f5fadb", "score": "0.4270841", "text": "func generateParentCreateOptions(parentDistro distro.Distro, pool *evergreen.ContainerPool) CreateOptions {\n\toptions := CreateOptions{\n\t\tDistro: parentDistro,\n\t\tHasContainers: true,\n\t\tUserName: evergreen.User,\n\t\tContainerPoolSettings: pool,\n\t}\n\treturn options\n}", "title": "" }, { "docid": "13efea18752d73aaae0f1c105c528040", "score": "0.4264764", "text": "func (e BaselineMeasureDenomCountEdges) ParentOrErr() (*BaselineMeasureDenom, error) {\n\tif e.loadedTypes[0] {\n\t\tif e.Parent == nil {\n\t\t\t// The edge parent was loaded in eager-loading,\n\t\t\t// but was not found.\n\t\t\treturn nil, &NotFoundError{label: baselinemeasuredenom.Label}\n\t\t}\n\t\treturn e.Parent, nil\n\t}\n\treturn nil, &NotLoadedError{edge: \"parent\"}\n}", "title": "" }, { "docid": "8deca610dd4d0f2d9352ad68ea688ed0", "score": "0.42643085", "text": "func (m *SectionGroupItemRequestBuilder) ParentNotebook()(*ifd80636f14e683d62913d91e2113d5741272af4255c7eb71baed4c91f7a05610.ParentNotebookRequestBuilder) {\n return ifd80636f14e683d62913d91e2113d5741272af4255c7eb71baed4c91f7a05610.NewParentNotebookRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "bf93552633866b9eb5b075733d8fd58c", "score": "0.42631042", "text": "func (b *Block) Parent() snowman.Block {\n\tparentID := ids.ID(b.ethBlock.ParentHash())\n\tparentBlk, err := b.vm.GetBlockInternal(parentID)\n\tif err != nil {\n\t\treturn &missing.Block{BlkID: parentID}\n\t}\n\n\treturn parentBlk\n}", "title": "" }, { "docid": "cb8555590c41894db460ed338185f09e", "score": "0.42556363", "text": "func NewTraceParent(version int, traceID string, spanID string, flags int) (*TraceParent, error) {\n\n\terr := validateTraceData(version, traceID, spanID, flags)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &TraceParent{\n\t\tVersion: fmt.Sprintf(\"%02x\", version),\n\t\tTraceID: traceID,\n\t\tSpanID: spanID,\n\t\tFlags: fmt.Sprintf(\"%02x\", flags),\n\t}, nil\n}", "title": "" }, { "docid": "4528e0cb200b1780d9982ef933426084", "score": "0.42537177", "text": "func (_ITellor *ITellorSession) GetNewCurrentVariables() (struct {\n\tChallenge [32]byte\n\tRequestIds [5]*big.Int\n\tDifficutly *big.Int\n\tTip *big.Int\n}, error) {\n\treturn _ITellor.Contract.GetNewCurrentVariables(&_ITellor.CallOpts)\n}", "title": "" }, { "docid": "3b299c435889bc34547e48a7f0d8939e", "score": "0.42526", "text": "func (err *Error) Current() error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\treturn &Error{\n\t\terror: nil,\n\t\tstack: err.stack,\n\t\ttext: err.text,\n\t\tcode: err.code,\n\t}\n}", "title": "" }, { "docid": "3b299c435889bc34547e48a7f0d8939e", "score": "0.42526", "text": "func (err *Error) Current() error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\treturn &Error{\n\t\terror: nil,\n\t\tstack: err.stack,\n\t\ttext: err.text,\n\t\tcode: err.code,\n\t}\n}", "title": "" }, { "docid": "f95dbc7b4a309005ed96b18ef088e80f", "score": "0.42508498", "text": "func (_ITellor *ITellorCaller) GetNewCurrentVariables(opts *bind.CallOpts) (struct {\n\tChallenge [32]byte\n\tRequestIds [5]*big.Int\n\tDifficutly *big.Int\n\tTip *big.Int\n}, error) {\n\tvar out []interface{}\n\terr := _ITellor.contract.Call(opts, &out, \"getNewCurrentVariables\")\n\n\toutstruct := new(struct {\n\t\tChallenge [32]byte\n\t\tRequestIds [5]*big.Int\n\t\tDifficutly *big.Int\n\t\tTip *big.Int\n\t})\n\n\toutstruct.Challenge = out[0].([32]byte)\n\toutstruct.RequestIds = out[1].([5]*big.Int)\n\toutstruct.Difficutly = out[2].(*big.Int)\n\toutstruct.Tip = out[3].(*big.Int)\n\n\treturn *outstruct, err\n\n}", "title": "" }, { "docid": "dc0c8c2959231e80ad0d2c989011fcb4", "score": "0.4247404", "text": "func (p *basePlan) ReplaceParent(parent, newPar Plan) error {\n\tfor i, par := range p.parents {\n\t\tif par.GetID() == parent.GetID() {\n\t\t\tp.parents[i] = newPar\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn SystemInternalErrorType.Gen(\"ReplaceParent Failed!\")\n}", "title": "" }, { "docid": "4c9df7aa6fa9f834437cf7683e34ea43", "score": "0.4245721", "text": "func (m *_ServicesResponse) InitializeParent(parent TypeId) {}", "title": "" }, { "docid": "57a64bd6ddd41fa2643f6f75e5890f0b", "score": "0.4244137", "text": "func (s PartnerSet) OnchangeParentWarning() string {\n\tres := s.Collection().Call(\"OnchangeParentWarning\")\n\tresTyped, _ := res.(string)\n\treturn resTyped\n}", "title": "" }, { "docid": "499856c1df6d016ef99f950917e80dda", "score": "0.42409593", "text": "func NewClientErr(parent error, code string, description string) *ClientErr {\n\treturn &ClientErr{parent, code, description}\n}", "title": "" }, { "docid": "643caaa13d7c9869a5919614c3132ffc", "score": "0.42365485", "text": "func generateParentCreateOptions(pool *evergreen.ContainerPool) CreateOptions {\n\toptions := CreateOptions{\n\t\tHasContainers: true,\n\t\tUserName: evergreen.User,\n\t\tContainerPoolSettings: pool,\n\t}\n\treturn options\n}", "title": "" }, { "docid": "e590caab5782fbbe62857702682425db", "score": "0.42278478", "text": "func NewCallerInfo(name, file string, line int) *CallerInfo {\n\treturn &CallerInfo{\n\t\tName: name,\n\t\tFile: file,\n\t\tLine: line,\n\t}\n}", "title": "" }, { "docid": "73885b59134874f8446fd35708fe75da", "score": "0.42274547", "text": "func (a arithmetic) newPerror(m []string) perror.Perror {\n\treturn perror.New(\n\t\ta.t.Line(),\n\t\t[]int{\n\t\t\ta.t.Start(),\n\t\t},\n\t\tm,\n\t)\n}", "title": "" }, { "docid": "65a25c3e95ed7788803557a566562366", "score": "0.42272934", "text": "func (e OutcomeGroupEdges) ParentOrErr() (*OutcomeMeasure, error) {\n\tif e.loadedTypes[0] {\n\t\tif e.Parent == nil {\n\t\t\t// The edge parent was loaded in eager-loading,\n\t\t\t// but was not found.\n\t\t\treturn nil, &NotFoundError{label: outcomemeasure.Label}\n\t\t}\n\t\treturn e.Parent, nil\n\t}\n\treturn nil, &NotLoadedError{edge: \"parent\"}\n}", "title": "" }, { "docid": "6b1e4257a8235139651f46516c8b36de", "score": "0.42255938", "text": "func (c OKPD2) GetParentRow() int {\n\treturn c.ParentRow\n}", "title": "" }, { "docid": "7ca4bb62cee1655f7028f090f68a45ce", "score": "0.4209444", "text": "func (m *_EventNotificationList) InitializeParent(parent ExtensionObjectDefinition) {}", "title": "" }, { "docid": "d13d87b3b9da61d0e8bdbad31bb109e3", "score": "0.42046642", "text": "func InfoNewest() *ab.SeekInfo {\n\treturn newSeekInfo(newestPos, maxPos)\n}", "title": "" }, { "docid": "6f742476b126f8499a0ce3cdf6aceb4c", "score": "0.42027622", "text": "func (s SpecErr)NewNoErrsNoMsg() SpecErr {\n\n\tse := SpecErr{\n\t\tParentInfo: s.DeepCopyParentInfo(s.ParentInfo),\n\t\tBaseInfo: s.BaseInfo.DeepCopyBaseInfo(),\n\t\tErrorMsgType: SpecErrTypeNOERRORSALLCLEAR,\n\t}\n\n\treturn se\n}", "title": "" }, { "docid": "1f6624c775d93e16b7de9b2c6be22afa", "score": "0.41974604", "text": "func GetParent(entity Entity) Entity {\n\treturn entity.GetEntityData().Parent\n}", "title": "" }, { "docid": "c15df50cf54de48fadcfe6eaba0c1fd6", "score": "0.4196572", "text": "func (e InternalError) New() error {\n\treturn errors.Wrap(e, \"\")\n}", "title": "" }, { "docid": "a52d849e2a4649476361edaca5553fee", "score": "0.4191074", "text": "func (o *BulkExportedItemAllOf) GetParentItemOk() (*BulkExportedItemRelationship, bool) {\n\tif o == nil || o.ParentItem == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ParentItem, true\n}", "title": "" }, { "docid": "1dc763a04091042bc7b9c56ace139c93", "score": "0.4189265", "text": "func (m *LeafList) Parent() Meta {\n\treturn m.parent\n}", "title": "" } ]
91de49f02b2f121695781ddeaaded955
getNonce getting unique nonce
[ { "docid": "9d54c223937c2252bc6dbfd8789a4ff2", "score": "0.78915954", "text": "func getNonce() int64 {\n\tif nonce == 0 {\n\t\tnonce = time.Now().UnixNano()\n\t}\n\tnonce++\n\treturn nonce\n}", "title": "" } ]
[ { "docid": "e8b279b35bdc7d2a1b18df3881981845", "score": "0.7932341", "text": "func nonce() string {\n\treturn strconv.FormatInt(nonceGenerator.Int63(), 10)\n}", "title": "" }, { "docid": "2e0afa243eb7a88e1a3b9b763e2b317f", "score": "0.7908975", "text": "func nonce() string {\n\tnonceLock.Lock()\n\tdefer nonceLock.Unlock()\n\tif nonceCounter == 0 {\n\t\tbinary.Read(rand.Reader, binary.BigEndian, &nonceCounter)\n\t}\n\tresult := strconv.Uitob64(nonceCounter, 16)\n\tnonceCounter += 1\n\treturn result\n}", "title": "" }, { "docid": "33b58149ea683d89b21d10797ce0f409", "score": "0.7820963", "text": "func nonce() string {\n\treturn strconv.FormatUint(atomic.AddUint64(&nonceCounter, 1), 16)\n}", "title": "" }, { "docid": "83bb58ef0bf18b3e943c1f26a7db4b9d", "score": "0.7653757", "text": "func (_UGToken *UGTokenCaller) GetNonce(opts *bind.CallOpts, _addr common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _UGToken.contract.Call(opts, out, \"getNonce\", _addr)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "cc641f0ad7945875e019f93c3553391f", "score": "0.74899936", "text": "func nonce() string {\n\tvar nonce [16]byte\n\t_, err := rand.Read(nonce[:])\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn fmt.Sprintf(\"%x\", nonce)\n}", "title": "" }, { "docid": "b6daeaa8f09daf00e32cd314900c2bad", "score": "0.7407148", "text": "func GetNonce(e ld.Entity) interface{} { return e.Get(Prop_Nonce.ID) }", "title": "" }, { "docid": "4e57edcf7088ec94f26d17b37f74f74f", "score": "0.7256195", "text": "func (_UGToken *UGTokenCallerSession) GetNonce(_addr common.Address) (*big.Int, error) {\n\treturn _UGToken.Contract.GetNonce(&_UGToken.CallOpts, _addr)\n}", "title": "" }, { "docid": "3dbaa9b630d4db02848da59af3695581", "score": "0.72430515", "text": "func (mg *MinterGate) GetNonce(address string) (uint64, error) {\n\tnonce, err := mg.NodeClient.Nonce(address)\n\tif err != nil {\n\t\tmg.Logger.WithFields(logrus.Fields{\n\t\t\t\"address\": address,\n\t\t}).Warn(err)\n\t\treturn 0, err\n\t}\n\treturn nonce - 1, nil\n}", "title": "" }, { "docid": "8d95cf16699381c5f4ffe1cc07236760", "score": "0.7161979", "text": "func (k *Keeper) GetNonce(ctx sdk.Context, addr ethcmn.Address) uint64 {\n\treturn k.csdb.WithContext(ctx).GetNonce(addr)\n}", "title": "" }, { "docid": "15d2b056005c4ca58dc79119748b0949", "score": "0.7157931", "text": "func (mg *MinterGate) GetNonce(address string) (uint64, error) {\n\tnonce, err := mg.api.Nonce(address)\n\tif err != nil {\n\t\tmg.Logger.WithFields(logrus.Fields{\n\t\t\t\"address\": address,\n\t\t}).Warn(err)\n\t\treturn 0, err\n\t}\n\treturn nonce - 1, nil\n}", "title": "" }, { "docid": "15d2b056005c4ca58dc79119748b0949", "score": "0.7157931", "text": "func (mg *MinterGate) GetNonce(address string) (uint64, error) {\n\tnonce, err := mg.api.Nonce(address)\n\tif err != nil {\n\t\tmg.Logger.WithFields(logrus.Fields{\n\t\t\t\"address\": address,\n\t\t}).Warn(err)\n\t\treturn 0, err\n\t}\n\treturn nonce - 1, nil\n}", "title": "" }, { "docid": "35b022ec09bab4fdb94e037141999f64", "score": "0.71249145", "text": "func (_UGToken *UGTokenSession) GetNonce(_addr common.Address) (*big.Int, error) {\n\treturn _UGToken.Contract.GetNonce(&_UGToken.CallOpts, _addr)\n}", "title": "" }, { "docid": "9da940e767d965882f3bf233cd933669", "score": "0.70617074", "text": "func (c *ACMEClient) GetNonce() (string, error) {\n\treq, err := http.NewRequest(\"GET\", c.dir.NewNonce, http.NoBody)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"creating GET request %s failed\", c.dir.NewNonce)\n\t}\n\treq.Header.Set(\"User-Agent\", UserAgent)\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"client GET %s failed\", c.dir.NewNonce)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode >= 400 {\n\t\treturn \"\", readACMEError(resp.Body)\n\t}\n\treturn resp.Header.Get(\"Replay-Nonce\"), nil\n}", "title": "" }, { "docid": "5df6cf2cecff71dc62378e68fec595c9", "score": "0.704766", "text": "func randomNonce() uint32 {\n\treturn uint32(rand.Intn(0xffffffff))\n}", "title": "" }, { "docid": "5b7b50e67d27a2f9a424d86f698da9bb", "score": "0.6990637", "text": "func (csdb *CommitStateDB) GetNonce(addr ethcmn.Address) uint64 {\n\tso := csdb.getStateObject(addr)\n\tif so != nil {\n\t\treturn so.Nonce()\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "e3d96c06489649200d94b2b6230171f4", "score": "0.6957283", "text": "func nonce(arg string) error {\n\taddr, err := util.GetAddress(arg)\n\tif err != nil {\n\t\treturn output.NewError(output.AddressError, \"failed to get address\", err)\n\t}\n\taccountMeta, err := GetAccountMeta(addr)\n\tif err != nil {\n\t\treturn output.NewError(0, \"\", err)\n\t}\n\tmessage := nonceMessage{\n\t\tAddress: addr,\n\t\tPendingNonce: int(accountMeta.PendingNonce),\n\t}\n\tfmt.Println(message.String())\n\treturn nil\n}", "title": "" }, { "docid": "10dc4695ee9452333850c56b83c792eb", "score": "0.68602383", "text": "func (tsr *TimeStampReq) GenerateNonce() error {\n\t// Generate a 128 bit nonce\n\tb := make([]byte, 16, 16)\n\n\t_, err := rand.Read(b)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttsr.Nonce = new(big.Int)\n\ttsr.Nonce.SetBytes(b)\n\n\treturn nil\n}", "title": "" }, { "docid": "981062c6d0e9dec62e95bb19d0f04dee", "score": "0.68433636", "text": "func getCurrentNonce(from *keystore.Key) (uint64, error) {\n\tclient, err := InitClient()\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"init-client: %s\", err.Error())\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), config.Conf.Timeout)\n\tdefer cancel()\n\n\tnonce, err := client.NonceAt(ctx, from.Address, nil)\n\treturn nonce, nil\n}", "title": "" }, { "docid": "0c717e0ad67d59e3e05d1e47d7657a07", "score": "0.6830922", "text": "func (n *Nonce) Get() int64 {\n\tn.mtx.Lock()\n\tdefer n.mtx.Unlock()\n\treturn n.n\n}", "title": "" }, { "docid": "c6863d804e4cec4b619b0c744b85c2eb", "score": "0.6822621", "text": "func (d *Digest) RandomNonce() {\n\tvar timeNow sys.Timeval\n\tsys.Gettimeofday(&timeNow)\n\n\tcounter++\n\tseedData := fmt.Sprintf(\"%d.%06d%d\", timeNow.Sec, timeNow.Usec, counter)\n\n\t// Use MD5 to compute a 'random' nonce from this seed data:\n\th := md5.New()\n\tio.WriteString(h, seedData)\n\td.Nonce = hex.EncodeToString(h.Sum(nil))\n}", "title": "" }, { "docid": "25707df16b67e7b103dc72c5abb289b3", "score": "0.6750182", "text": "func currentNonce(address common.Address) (uint64, error) {\n\tvar currentNonce uint64\n\tif nonce == -1 {\n\t\tif client == nil {\n\t\t\terr := connect()\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\n\t\tvar tmpNonce uint64\n\t\tctx, cancel := context.WithTimeout(context.Background(), viper.GetDuration(\"timeout\"))\n\t\tdefer cancel()\n\t\ttmpNonce, err = client.PendingNonceAt(ctx, address)\n\t\tif err != nil {\n\t\t\treturn 0, fmt.Errorf(\"failed to obtain nonce for %s: %v\", address.Hex(), err)\n\t\t}\n\t\tcurrentNonce = uint64(tmpNonce)\n\t\tnonce = int64(tmpNonce)\n\t} else {\n\t\tcurrentNonce = uint64(nonce)\n\t}\n\treturn currentNonce, nil\n}", "title": "" }, { "docid": "80dd124c4f901810c9e1e12cc1aaadcd", "score": "0.6747984", "text": "func (bPtr *BlockGen) TxNonce(addr bgmcommon.Address) Uint64 {\n\tif !bPtr.statedbPtr.Exist(addr) {\n\t\tpanic(\"Fatal: account does not exist\")\n\t}\n\treturn bPtr.statedbPtr.GetNonce(addr)\n}", "title": "" }, { "docid": "ecfca8d0f44334ad6952761b98ebe215", "score": "0.67475706", "text": "func (blk Block) GetNonce() uint64 {\n\treturn blk.nonce\n}", "title": "" }, { "docid": "1e9e7e3fd4a3a3093b68f98160b3847b", "score": "0.67163974", "text": "func Nonce() uint64 {\n\t// TODO: replace with the real random number generator\n\tnonce := uint64(rand.Uint32())<<32 + uint64(rand.Uint32())\n\treturn nonce\n}", "title": "" }, { "docid": "5200503055330a4b18984d8a4ff6e0a5", "score": "0.6709935", "text": "func (t *TokenMachineServer) GetNonce(ctx context.Context, tokenString string) (*libtokenmachine.Nonce, error) {\n\n\ttoken, err := t.token.ParseToken(tokenString)\n\tif err != nil {\n\t\tzap.L().Debug(fmt.Sprintf(\"GetNonce(tokenString=%s)->%s\", tokenString, \"Error:\"+err.Error()))\n\t\treturn nil, err\n\t}\n\n\t// Validate that token is allowed to pull nonce\n\terr = t.policy.AuthGetNonce(ctx, token.Claims)\n\tif err != nil {\n\t\tzap.L().Debug(fmt.Sprintf(\"GetNonce(tokenString=%s)->%s\", tokenString, \"Error:\"+err.Error()))\n\t\treturn nil, err\n\t}\n\n\tnonce, err := t.nonce.NewNonce()\n\tif err != nil {\n\t\tzap.L().Debug(fmt.Sprintf(\"GetNonce(tokenString=%s)->%s\", tokenString, \"Error:\"+err.Error()))\n\t\treturn nil, err\n\t}\n\n\tzap.L().Debug(fmt.Sprintf(\"GetNonce(tokenString=%s)->%s\", tokenString, \"Granted\"))\n\treturn nonce.Copy(), nil\n}", "title": "" }, { "docid": "caac9f6f6e61f3bd21bf1002ff496438", "score": "0.6674867", "text": "func NewNonce() Nonce {\n\tvar n nonceArray\n\n\tmax := new(big.Int).Exp(big.NewInt(2), big.NewInt(int64(len(n)*8)), nil)\n\tnum, _ := rand.Int(rand.Reader, max)\n\n\tcopy(n[:], num.Bytes())\n\treturn &n\n}", "title": "" }, { "docid": "77492b87a008252c535568febd3707de", "score": "0.663116", "text": "func (t *Transaction) GenerateNonce(prefix []byte) uint32 {\n\n\tnewT := t\n\tfor {\n\n\t\tif CheckProofOfWork(prefix, newT.Hash()) {\n\t\t\tbreak\n\t\t}\n\n\t\tnewT.Header.Nonce++\n\t}\n\n\treturn newT.Header.Nonce\n}", "title": "" }, { "docid": "b00ceb9ba24e4ca4b3ca7683a5e6a250", "score": "0.6615313", "text": "func (_Did *DidCallerSession) Nonce(arg0 common.Address) (*big.Int, error) {\n\treturn _Did.Contract.Nonce(&_Did.CallOpts, arg0)\n}", "title": "" }, { "docid": "48c725562080bb929fca92aa4435cfdd", "score": "0.66127187", "text": "func GenerateNonce() (string, error) {\n\t// TODO: move this\n\tb := make([]byte, 32)\n\t_, err := rand.Read(b)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn base64.URLEncoding.EncodeToString(b), nil\n}", "title": "" }, { "docid": "2b243fb7c6f3aa4a89630e98ede60ecd", "score": "0.6602892", "text": "func makeNonce(data []byte) ([]byte, error) {\n\tsha := crypto.SHA256.New()\n\n\ttimestamp, err := time.Now().MarshalBinary()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshal timestamp: %w\", err)\n\t}\n\n\t_, err = sha.Write(timestamp)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to write timestamp to hash function: %w\", err)\n\t}\n\n\t_, err = sha.Write(data)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to write data to hash function: %w\", err)\n\t}\n\n\tcounter := atomic.AddUint32(&nonceCounter, 1)\n\n\t// nolint:gomnd\n\tsum := sha.Sum([]byte{\n\t\tbyte(counter),\n\t\tbyte(counter >> 8),\n\t\tbyte(counter >> 16),\n\t\tbyte(counter >> 24),\n\t})\n\n\treturn sum[:12], nil\n}", "title": "" }, { "docid": "2df85a609fa5836825ebe1381969a2f3", "score": "0.6570209", "text": "func nonce(n, d *big.Int, m []byte) (*big.Int, error) {\n\tkLen := len(n.Bytes()) + 8\n\tkBuf := new(bytes.Buffer)\n\n\tfor i := 0; i < kLen; i += sha256.Len {\n\t\tr, err := rand.Bytes(sha256.Len)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// p is the concatenation of i, d, m, and r.\n\t\tp := bytes.NewBuffer(make([]byte, 0, 128))\n\t\terr = binary.Write(p, binary.BigEndian, uint32(i))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tp.Write(d.Bytes())\n\t\tp.Write(m)\n\t\tp.Write(r)\n\t\th, err := sha256.DigestBytes(p.Bytes())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tkBuf.Write(h)\n\t}\n\n\tk := new(big.Int).SetBytes(kBuf.Bytes()[:kLen])\n\n\treturn k.Mod(k, n), nil\n}", "title": "" }, { "docid": "fd02b05bf107b952ebb1a8b2de75ca42", "score": "0.6538972", "text": "func (_Did *DidSession) Nonce(arg0 common.Address) (*big.Int, error) {\n\treturn _Did.Contract.Nonce(&_Did.CallOpts, arg0)\n}", "title": "" }, { "docid": "7cb352513de695fd1210f7079d551441", "score": "0.65192026", "text": "func GetNonce(cb GetNonceCallback) error {\n\tif cb == nil {\n\t\tcb = &GetNonceCallbackStub{}\n\t}\n\n\terr := CheckConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo func() {\n\t\tvalue, info, err := getNonceFromSharders(_config.wallet.ClientID)\n\t\tif err != nil {\n\t\t\tlogging.Error(err)\n\t\t\tcb.OnNonceAvailable(StatusError, 0, info)\n\t\t\treturn\n\t\t}\n\n\t\tcb.OnNonceAvailable(StatusSuccess, value, info)\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "8451b26f66027ed9bbc0ebf03548803d", "score": "0.65029675", "text": "func (i *InternalLinkTypePassportDataRequest) GetNonce() (value string) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.Nonce\n}", "title": "" }, { "docid": "1047c65382c771a325ddfb39921569b2", "score": "0.6489535", "text": "func NewNonce() []byte {\n\tnonce := make([]byte, 12)\n\t_, err := io.ReadFull(rand.Reader, nonce)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn nonce\n}", "title": "" }, { "docid": "d1062597a05657e2414318deffd798b6", "score": "0.6460632", "text": "func (n *nonceData) Nonce() string {\n\tkeys := make([]string, 0, len(n.ttKeysBase64))\n\tfor _, k := range n.ttKeysBase64 {\n\t\tkeys = append(keys, fmt.Sprintf(\"%v.%v.%v\", k.Key, k.IntervalNumber, k.IntervalCount))\n\t}\n\n\t// The cleartext is a combination of all of the data on the request\n\t// in a specific order.\n\t//\n\t// appPackageName|transmissionRisk|key[,key]|region[,region]|verificationAuthorityName\n\t// Keys are ancoded as\n\t// base64(exposureKey).itnervalNumber.IntervalCount\n\t// When there is > 1 key, keys are comma separated.\n\t// Keys must in sorted order based on the sorting of the base64 exposure key.\n\t// Regions are uppercased, sorted, and comma sepreated\n\tcleartext :=\n\t\tn.appPackageName + \"|\" +\n\t\t\tfmt.Sprintf(\"%v\", n.transmissionRisk) + \"|\" +\n\t\t\tstrings.Join(keys, \",\") + \"|\" + // where key is b64key.intervalNum.intervalCount\n\t\t\tstrings.Join(n.regions, \",\") + \"|\" +\n\t\t\tn.verification\n\n\t// Take the sha256 checksum of that data\n\tsum := sha256.Sum256([]byte(cleartext))\n\t// Base64 encode the result.\n\treturn base64.StdEncoding.EncodeToString(sum[:])\n}", "title": "" }, { "docid": "c12d9638b04ce4880d9956f4d24d1d90", "score": "0.6456116", "text": "func (t *BlockchainTransaction) Nonce() int32 {\n\treturn int32(t.tx.Nonce)\n}", "title": "" }, { "docid": "9d587246a1271085b02981dbe07efe9b", "score": "0.6451309", "text": "func NonceGTE(v string) predicate.AuthCode {\n\treturn predicate.AuthCode(sql.FieldGTE(FieldNonce, v))\n}", "title": "" }, { "docid": "836f56cddcefd818c8efe4247f921fad", "score": "0.64419967", "text": "func (s *secureChannel) generateNonce(nonce *[nonceSize]byte) error {\n\tif _, err := rand.Read(nonce[:nonceSize-8]); err != nil {\n\t\treturn err\n\t}\n\tbinary.BigEndian.PutUint64(nonce[nonceSize-8:], s.sequence)\n\treturn nil\n}", "title": "" }, { "docid": "1cf502cc8a9a1bb9b4340f0bac2e8072", "score": "0.6408988", "text": "func (_Did *DidCaller) Nonce(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Did.contract.Call(opts, out, \"nonce\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "b69061589e7618c660b2ea5b5e5c9425", "score": "0.6375128", "text": "func GenerateNonce() ([]byte, error) {\n\treturn util.RandBytes(NonceSize)\n}", "title": "" }, { "docid": "d22476d5db7baffeb11e43ad50a2c986", "score": "0.63679117", "text": "func GenerateNonce() (*[24]byte, error) {\n\tvar nonce [24]byte\n\t_, err := rand.Read(nonce[:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &nonce, nil\n\n}", "title": "" }, { "docid": "ca80f327e9f1f001eb4b3abec32fbac1", "score": "0.6347434", "text": "func getAccountNonce(ctx client.Context, backend backend.Backend, accAddr common.Address, pending bool, logger log.Logger) (uint64, error) {\n\t_, nonce, err := ctx.AccountRetriever.GetAccountNumberSequence(ctx, accAddr.Bytes())\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tif !pending {\n\t\treturn nonce, nil\n\t}\n\n\t// the account retriever doesn't include the uncommitted transactions on the nonce so we need to\n\t// to manually add them.\n\tpendingTxs, err := backend.PendingTransactions()\n\tif err != nil {\n\t\tlogger.Errorln(\"fails to fetch pending transactions\")\n\t\treturn nonce, nil\n\t}\n\n\t// add the uncommitted txs to the nonce counter\n\tif len(pendingTxs) != 0 {\n\t\tfor i := range pendingTxs {\n\t\t\tif pendingTxs[i] == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif pendingTxs[i].From == accAddr {\n\t\t\t\tnonce++\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nonce, nil\n}", "title": "" }, { "docid": "da22b59425e878e63d8a16a198775ca6", "score": "0.63386613", "text": "func GetFirstNonce() []byte {\n\t// Start with 8 bytes of zero\n\tnonce := []byte{0, 0, 0, 0, 0, 0, 0, 0}\n\t// Pick a random number to fill out our nonce (don't collide with other miners if in a pool)\n\tnonce = append(nonce, random.RandByteSliceOfLen(24)...)\n\treturn nonce\n}", "title": "" }, { "docid": "a26d16c8a8ec5ea7426557c0b1e62320", "score": "0.6317642", "text": "func Nonce(v string) predicate.AuthCode {\n\treturn predicate.AuthCode(sql.FieldEQ(FieldNonce, v))\n}", "title": "" }, { "docid": "c92d477230cd14a59e962f7a9ac22664", "score": "0.63007516", "text": "func (conn *ArbConnection) getCurrentNonce(\n\tctx context.Context,\n\taccount ethcommon.Address,\n) (*big.Int, error) {\n\tif conn.sequenceNum != nil {\n\t\treturn conn.sequenceNum, nil\n\t}\n\tsysConn, err := conn.getSysCon()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnum, err := sysConn.GetTransactionCount(\n\t\t&bind.CallOpts{Context: ctx, Pending: true},\n\t\taccount,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconn.sequenceNum = num\n\treturn num, nil\n}", "title": "" }, { "docid": "d7cebddaaeb20ff5a8d45d5ee98ea850", "score": "0.6294522", "text": "func getNonceTokenFromCSPHeaderScriptSrc(cspScriptSrc string) string {\n\tcspScriptSrc = strings.Trim(cspScriptSrc, \" \")\n\ttokens := strings.Split(cspScriptSrc, \" \")\n\tfor _, token := range tokens {\n\t\ttoken = strings.TrimSpace(token)\n\t\tif strings.HasPrefix(token, \"'nonce-\") {\n\t\t\ttoken = strings.TrimPrefix(token, \"'nonce-\")\n\t\t\ttoken = strings.TrimSuffix(token, \"'\")\n\t\t\treturn token\n\t\t}\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "b733497d2db8ae2244b0b4e718e30ec5", "score": "0.62877095", "text": "func (bc *blockchain) Nonce(addr string) (uint64, error) {\n\treturn bc.sf.Nonce(addr)\n}", "title": "" }, { "docid": "e9a76bac1fc991d44f65a01a9c9694a8", "score": "0.62637794", "text": "func (p *ParityClient) NormalizeNonce(data string) string {\n\tn := new(big.Int)\n\ti, _ := n.SetString(data, 16)\n\treturn fmt.Sprintf(\"%#0.16x\", i)\n}", "title": "" }, { "docid": "3495c084f938f50d379807575d6bd874", "score": "0.62237376", "text": "func GenerateNonce(size int) ([]byte, error) {\n\n\tb := make([]byte, size)\n\n\t// not checking len here because rand.Read doc reads:\n\t// On return, n == len(b) if and only if err == nil.\n\t_, err := rand.Read(b)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn b, nil\n}", "title": "" }, { "docid": "5dd63647d832b9de4e4f5df02445b0e9", "score": "0.6223423", "text": "func (act *action) Nonce() uint64 { return act.nonce }", "title": "" }, { "docid": "ed4387e0279f5e4c25158348a9e285db", "score": "0.62124836", "text": "func (c *Claim) Nonce() string {\n\treturn c.nonce\n}", "title": "" }, { "docid": "e338f5b84d458f10a2f7f6df203be7e4", "score": "0.6188057", "text": "func (c *Conn) currentNonce(ctx context.Context,\n\taddress common.Address,\n) (\n\tuint64,\n\terror,\n) {\n\t_, exists := c.nonces[address]\n\tif !exists {\n\t\tif c.client == nil {\n\t\t\t// Offline, fetch from supplied value.\n\t\t\ttmp := viper.GetString(\"nonce\")\n\t\t\tif tmp == \"\" {\n\t\t\t\treturn 0, errors.New(\"nonce not supplied\")\n\t\t\t}\n\t\t\tnonce, err := strconv.ParseUint(tmp, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, errors.Wrap(err, \"invalid nonce\")\n\t\t\t}\n\t\t\tc.nonces[address] = nonce\n\t\t} else {\n\t\t\t// Fetch from chain.\n\t\t\tctx, cancel := context.WithTimeout(ctx, c.timeout)\n\t\t\tdefer cancel()\n\t\t\tnonce, err := c.client.PendingNonceAt(ctx, address)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, errors.Wrap(err, fmt.Sprintf(\"failed to obtain nonce for %s\", address.Hex()))\n\t\t\t}\n\t\t\tc.nonces[address] = nonce\n\t\t}\n\t}\n\treturn c.nonces[address], nil\n}", "title": "" }, { "docid": "fde2b265992d66f7f7a22410b9db5218", "score": "0.6187883", "text": "func oauthNonceId(consumerKey, tokenKey, nonce string) string {\n\treturn consumerKey + tokenKey + nonce\n}", "title": "" }, { "docid": "0b892a48be9f334ddb60802e39f221c7", "score": "0.6187297", "text": "func GetMintNonce(cb GetInfoCallback) error {\n\terr := CheckConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo GetInfoFromSharders(withParams(GET_MINT_NONCE, Params{\n\t\t\"client_id\": _config.wallet.ClientID,\n\t}), OpGetMintNonce, cb)\n\treturn nil\n}", "title": "" }, { "docid": "e7afa78e2e6304253da96e5b38ae71d6", "score": "0.61774194", "text": "func NonceGT(v string) predicate.AuthCode {\n\treturn predicate.AuthCode(sql.FieldGT(FieldNonce, v))\n}", "title": "" }, { "docid": "c22cd7d4c760dd1265fe750d8a4f317e", "score": "0.6141042", "text": "func (t *TxRelay) GetNonce(addr string) (*big.Int, error) {\n\tnonce, err := t.txrContract.Nonce(nil, common.HexToAddress(addr))\n\n\treturn nonce, err\n}", "title": "" }, { "docid": "80f04135a0be40fd43cc7e98da1beebc", "score": "0.6132801", "text": "func createNonce() ([]byte, error) {\n\tnonce, err := getRandomNonce()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to generate random nonce: %s\", err)\n\t}\n\treturn nonce, nil\n}", "title": "" }, { "docid": "00ba8bac45b6aa32a7714931cc8e7eb1", "score": "0.61263096", "text": "func GenerateNonce() ([nonceLength]byte, error) {\n\trb := make([]byte, nonceLength)\n\t_, err := rand.Read(rb)\n\tif err != nil {\n\t\treturn [nonceLength]byte{}, err\n\t}\n\n\tvar result [nonceLength]byte\n\tfor i, x := range rb {\n\t\tresult[i] = x\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "7c68d97a2dd9e155083669dfdbc8d5b8", "score": "0.60996264", "text": "func basicAuthNonce(privateKey *ecdsa.PrivateKey) string {\n\t// for dev:\n\tif privateKey == nil {\n\t\treturn \"Basic \" + base64.StdEncoding.EncodeToString([]byte(\"dev:mode\"))\n\t}\n\n\tts := fmt.Sprintf(\"%d\", time.Now().UnixMilli())\n\tsignature, err := Sign(ts, privateKey)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tsignatureHex := fmt.Sprintf(\"0x%s\", hex.EncodeToString(signature))\n\n\tbasic := ts + \":\" + signatureHex\n\treturn \"Basic \" + base64.StdEncoding.EncodeToString([]byte(basic))\n}", "title": "" }, { "docid": "ba5bdabff8ef811b4e83e7b210abb2fb", "score": "0.6079323", "text": "func NextNonce(ctx context.Context, st state.Tree, mp *MessagePool, address address.Address) (uint64, error) {\n\tnonce := uint64(0)\n\n\t// Do the message pool check first: the address may not have an actor\n\t// on chain yet but might have a bunch of messages in the message pool.\n\t// TODO: consider what if anything to do if there's a gap with\n\t// what's in the pool.\n\tlargestInPool, found := LargestNonce(mp, address)\n\tif found {\n\t\tnonce = largestInPool + 1\n\t}\n\n\tactor, err := st.GetActor(ctx, address)\n\tif state.IsActorNotFoundError(err) {\n\t\treturn nonce, nil\n\t} else if err != nil {\n\t\treturn 0, err\n\t}\n\tif actor.Code.Defined() && !actor.Code.Equals(types.AccountActorCodeCid) {\n\t\treturn 0, xerrors.New(\"actor not an account or empty actor\")\n\t}\n\n\tactorNonce := uint64(actor.Nonce)\n\tif actorNonce > nonce {\n\t\tnonce = actorNonce\n\t}\n\n\treturn nonce, nil\n}", "title": "" }, { "docid": "74b8ca50590ccbcc703f4256b331a446", "score": "0.60550445", "text": "func GetWalletNonce(clientID string) (int64, error) {\n\tcb := &GetNonceCallbackStub{}\n\n\terr := CheckConfig()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\twait := &sync.WaitGroup{}\n\twait.Add(1)\n\tgo func() {\n\t\tdefer wait.Done()\n\t\tvalue, info, err := getNonceFromSharders(clientID)\n\t\tif err != nil {\n\t\t\tlogging.Error(err)\n\t\t\tcb.OnNonceAvailable(StatusError, 0, info)\n\t\t\treturn\n\t\t}\n\t\tcb.OnNonceAvailable(StatusSuccess, value, info)\n\t}()\n\n\twait.Wait()\n\n\tif cb.status == StatusSuccess {\n\t\treturn cb.nonce, nil\n\t}\n\n\treturn 0, stdErrors.New(cb.info)\n}", "title": "" }, { "docid": "557265f953dbf5eb845553ecb300b4b2", "score": "0.6014513", "text": "func (req *OffLedgerRequestData) Nonce() uint64 {\n\treturn req.nonce\n}", "title": "" }, { "docid": "e67fe8fed79445fa0edb5d14f922b5e9", "score": "0.5992214", "text": "func UpdateNonce(author *bind.TransactOpts, client *ethclient.Client, err error, args ...interface{}) {\n\taddr := strings.ToLower(author.From.String())\n\telePointer,ok := payAddressNonceMap.Load(addr)\n\tglog.Infoln(addr, \"begin update nonce:\",args, \"current nonce:\",author.Nonce, \"err:\",err)\n\tif ok {\n\t\tele := elePointer.(*element)\n\t\tupdateNonce := author.Nonce.Int64()\n\t\tif err == nil {\n\t\t\tupdateNonce = author.Nonce.Int64() + 1\n\t\t\tele.c <- big.NewInt(updateNonce)\n\t\t} else {//failed,write current nonce\n\t\t\t// failed try connect eth to get the latest nonce\n\t\t\t// prevent another process attach eth then let the nonce changed\n\t\t\tctx, cancel := context.WithTimeout(context.Background(), HTTPTIMEOUT)\n\t\t\tnonce, err := client.PendingNonceAt(ctx, author.From)\n\t\t\tdefer cancel()\n\t\t\tif err != nil { // get nonce err,write current nonce\n\t\t\t\tele.c <- author.Nonce\n\t\t\t\tglog.Errorln(\"nonce get error :\", err)\n\t\t\t} else {\n\t\t\t\tele.c <- big.NewInt(int64(nonce))\n\t\t\t}\n\t\t}\n\t\tglog.Infoln(addr, \"update nonce end:\",args,\"update nonce:\",updateNonce)\n\t}\n}", "title": "" }, { "docid": "e7385be2f0e1a2f3af42192046070ef4", "score": "0.5964283", "text": "func GenerateGCMNonce() []byte {\n\treturn ReadFromRand(GCM_NONCE_BYTES)\n}", "title": "" }, { "docid": "af5fafb69608e609502049fc7865bc43", "score": "0.5955228", "text": "func (c *Client) FetchNonce(address string) (uint64, error) {\n\tacc, err := c.FetchAccount(address)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"fetchNonce\")\n\t}\n\treturn acc.Nonce, nil\n}", "title": "" }, { "docid": "9e3deb5e5f069ec2254bfe446c58a1a5", "score": "0.5949804", "text": "func NonceNEQ(v string) predicate.AuthCode {\n\treturn predicate.AuthCode(sql.FieldNEQ(FieldNonce, v))\n}", "title": "" }, { "docid": "9cfa15db364ad7e1781c4507758a6f70", "score": "0.5903768", "text": "func (c *Conn) CurrentNonce(ctx context.Context,\n\taddress common.Address,\n) (\n\tuint64,\n\terror,\n) {\n\tc.noncesMu.Lock()\n\tdefer c.noncesMu.Unlock()\n\n\treturn c.currentNonce(ctx, address)\n}", "title": "" }, { "docid": "519ad12b896f1dbc4a43306ae0be23b1", "score": "0.5898184", "text": "func (b *BridgeClient) GetUserNonceMinted(ctx context.Context, rawEthereumAddress string) (*big.Int, error) {\n\tethereumAddress := common.HexToAddress(rawEthereumAddress)\n\tetherClient, err := b.CreateEthClient()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to create etherClient\")\n\t}\n\n\tcontractAddress := common.HexToAddress(b.BridgeAddress)\n\n\tvar bridgeInstance *binding.Bridge\n\tbridgeInstance, err = binding.NewBridge(contractAddress, etherClient)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to create bridge instance\")\n\t}\n\n\tvar nonce *big.Int\n\tnonce, err = bridgeInstance.GetUserNonceMinted(nil, ethereumAddress)\n\tif err != nil {\n\t\tLogger.Error(\"GetUserNonceMinted FAILED\", zap.Error(err))\n\t\tmsg := \"failed to execute GetUserNonceMinted call, ethereumAddress = %s\"\n\t\treturn nil, errors.Wrapf(err, msg, rawEthereumAddress)\n\t}\n\treturn nonce, err\n}", "title": "" }, { "docid": "9c5d3ed59f04bb63e7a14545952ee90c", "score": "0.5897641", "text": "func (c *Client) popNonce(ctx context.Context, url string) (string, error) {\n\tc.noncesMu.Lock()\n\tdefer c.noncesMu.Unlock()\n\tif len(c.nonces) == 0 {\n\t\tif c.dir != nil && c.dir.NonceURL != \"\" {\n\t\t\treturn c.fetchNonce(ctx, c.dir.NonceURL)\n\t\t}\n\t\tdirURL := c.directoryURL()\n\t\tv, err := c.fetchNonce(ctx, dirURL)\n\t\tif err != nil && url != dirURL {\n\t\t\tv, err = c.fetchNonce(ctx, url)\n\t\t}\n\t\treturn v, err\n\t}\n\tvar nonce string\n\tfor nonce = range c.nonces {\n\t\tdelete(c.nonces, nonce)\n\t\tbreak\n\t}\n\treturn nonce, nil\n}", "title": "" }, { "docid": "50c6d5e389fc9dece2d63d3e9a9c12ce", "score": "0.58785605", "text": "func (m *Miner) CalcNonce(ctx context.Context, b *block.Block) bool {\n\tfor i := uint32(0); i < m.Conf.NncLim; i++ {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn false\n\t\tdefault:\n\t\t\tb.Hdr.Nonce = i\n\t\t\tif b.SatisfiesPOW(m.DifTrg()) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ff68157c30d53138aaabfac888098238", "score": "0.5859379", "text": "func GenerateNACLNonce() *[24]byte {\n\treturn BytesToNACLNonce(ReadFromRand(NACL_NONCE_BYTES))\n}", "title": "" }, { "docid": "d5ee5216f7259fc4bcbb1b1826cf9deb", "score": "0.5853559", "text": "func (p *Pow) GenerateNonce() (nonce []byte, checksum []byte, err error) {\n\n\tnonce, err = p.NonceGenerator(p.NonceLength)\n\tif err != nil {\n\t\tnonce = []byte{}\n\t\treturn\n\t}\n\n\tif p.Check {\n\t\tchecksum = p.Hash(append(nonce, p.Secret...))\n\t}\n\treturn\n}", "title": "" }, { "docid": "6b165360bcc14d656a92068aab6fdda1", "score": "0.5852973", "text": "func (sess *Session) Nonce() (*PublicKey, error) {\n\tif sess.nonceCommitments == nil {\n\t\treturn nil, errors.New(\"nonce commitments must be set before revealing the nonce\")\n\t}\n\treturn sess.noncePriv.PubKey(), nil\n}", "title": "" }, { "docid": "d3e76ae6505caa1d709b0f27d1a3a66c", "score": "0.5851436", "text": "func NonceEQ(v string) predicate.AuthCode {\n\treturn predicate.AuthCode(sql.FieldEQ(FieldNonce, v))\n}", "title": "" }, { "docid": "728c428b9330573c5c284d0d6e419b78", "score": "0.58488834", "text": "func (n *Nonce) String() string {\n\tn.mtx.Lock()\n\tresult := strconv.FormatInt(n.n, 10)\n\tn.mtx.Unlock()\n\treturn result\n}", "title": "" }, { "docid": "dfd92ea9ac3e4ad2c12c90c07d312b1f", "score": "0.58368784", "text": "func (s *Ethereum) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error) {\n\treturn s.APIBackend.GetPoolNonce(ctx, addr)\n}", "title": "" }, { "docid": "600b6615e5244e83ea2efbcd1479b19a", "score": "0.58039784", "text": "func EncodeNonce(i uint64) BlockNonce {\n\tvar n BlockNonce\n\tbinary.BigEndian.PutUint64(n[:], i)\n\treturn n\n}", "title": "" }, { "docid": "880cb456c2de86ab7acab8e94a5f6828", "score": "0.58036464", "text": "func NonceLTE(v string) predicate.AuthCode {\n\treturn predicate.AuthCode(sql.FieldLTE(FieldNonce, v))\n}", "title": "" }, { "docid": "4c0c25ea5c454b449158ba2e2a435c0c", "score": "0.5793356", "text": "func GetAccountNonde(account, endpoint string) (uint64, error) {\n\treqTemplateStr := `{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionCount\",\"params\":[\"0x%s\",\"%s\"],\"id\":1}`\n\tresp, err := doPost(fmt.Sprintf(reqTemplateStr, account, \"pending\"), endpoint)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"failed to get account nonce, as: %v\", err)\n\t}\n\tnonceStr := new(string)\n\tjson.Unmarshal(resp.Result, nonceStr)\n\tnonce := uint64(hexstr2dec(*nonceStr))\n\treturn nonce, nil\n}", "title": "" }, { "docid": "34776825d30137f9f4239920593e744e", "score": "0.5787054", "text": "func nextNonce(address common.Address) (nextNonce uint64, err error) {\n\tif nonce == -1 {\n\t\t_, err = currentNonce(address)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\tnonce++\n\tnextNonce = uint64(nonce)\n\treturn\n}", "title": "" }, { "docid": "7691a8451783984e822374e9396838c4", "score": "0.5775861", "text": "func genNonce(ephemeralPubkey, pubKey *[KeySize]byte) (*[NonceSize]byte, error) {\n\tnonce := &[NonceSize]byte{}\n\n\tnonceHasher, err := blake2b.New(NonceSize, nil)\n\tnonceHasher.Reset()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, err = nonceHasher.Write(ephemeralPubkey[:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, err = nonceHasher.Write(pubKey[:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnonceSlice := nonceHasher.Sum(nil)\n\tcopy(nonce[:], nonceSlice)\n\n\treturn nonce, nil\n}", "title": "" }, { "docid": "34a701fce92e0c59a2514467535a9401", "score": "0.57719517", "text": "func (pki *PKI) GenerateNonce() (*[nonceSize]byte, error) {\n\tnonce := new([nonceSize]byte)\n\t_, err := io.ReadFull(rand.Reader, nonce[:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn nonce, nil\n}", "title": "" }, { "docid": "6e7fe094ac0d5004f02edb5fa8a6e83b", "score": "0.5770306", "text": "func (ap *actPool) getPendingNonce(addr string) (uint64, error) {\n\tif queue, ok := ap.accountActs[addr]; ok {\n\t\treturn queue.PendingNonce(), nil\n\t}\n\tcommittedNonce, err := ap.bc.Nonce(addr)\n\tpendingNonce := committedNonce + 1\n\treturn pendingNonce, err\n}", "title": "" }, { "docid": "6e7fe094ac0d5004f02edb5fa8a6e83b", "score": "0.5770306", "text": "func (ap *actPool) getPendingNonce(addr string) (uint64, error) {\n\tif queue, ok := ap.accountActs[addr]; ok {\n\t\treturn queue.PendingNonce(), nil\n\t}\n\tcommittedNonce, err := ap.bc.Nonce(addr)\n\tpendingNonce := committedNonce + 1\n\treturn pendingNonce, err\n}", "title": "" }, { "docid": "d0f4042ef379a9abb397373355a8254a", "score": "0.5752966", "text": "func (txn *txNoncer) get(addr common.Address) uint64 {\n\t// We use mutex for get operation is the underlying\n\t// state will mutate db even for read access.\n\ttxn.lock.Lock()\n\tdefer txn.lock.Unlock()\n\n\tif _, ok := txn.nonces[addr]; !ok {\n\t\ttxn.nonces[addr] = txn.fallback.GetNonce(addr)\n\t}\n\treturn txn.nonces[addr]\n}", "title": "" }, { "docid": "028ed3aad0d1828ebe3d2e34eb5cb79f", "score": "0.57294744", "text": "func (m *MockvmState) GetNonce(arg0 types.Address) (types.Nonce, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetNonce\", arg0)\n\tret0, _ := ret[0].(types.Nonce)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "cc57c8eefd09b4087ffb82a67dec24ba", "score": "0.5673512", "text": "func (a *Account) IncrNonce() {\n\ta.Nonce.Add(a.Nonce, big.NewInt(1))\n}", "title": "" }, { "docid": "d0eeb9732a420eb34da279e7014c8608", "score": "0.5664531", "text": "func computeNonceSecretHash(nonce int64, secret int64) string {\n\tsum := nonce + secret\n\tbuf := make([]byte, 512)\n\tn := binary.PutVarint(buf, sum)\n\th := md5.New()\n\th.Write(buf[:n])\n\tstr := hex.EncodeToString(h.Sum(nil))\n\treturn str\n}", "title": "" }, { "docid": "909af7de9475be30793c3416f9ff659f", "score": "0.5658892", "text": "func TestClient_BadNonce(t *testing.T) {\n\tpk, sk := cipher.GenerateKeyPair()\n\n\theaderCh := make(chan http.Header, 1)\n\tts := newTestServer(t, pk, headerCh)\n\tdefer ts.Close()\n\n\tc, err := NewClient(context.TODO(), ts.URL, pk, sk, &http.Client{}, ip, masterLogger)\n\trequire.NoError(t, err)\n\n\tc.nonce = 999\n\n\treq, err := http.NewRequest(http.MethodGet, ts.URL+\"/foo\", bytes.NewBufferString(payload))\n\trequire.NoError(t, err)\n\tres, err := c.Do(req)\n\trequire.NoError(t, err)\n\n\tb, err := io.ReadAll(res.Body)\n\trequire.NoError(t, err)\n\trequire.NoError(t, res.Body.Close())\n\tassert.Equal(t, uint64(2), c.nonce)\n\n\theaders := <-headerCh\n\tcheckResp(t, headers, b, pk, 1)\n}", "title": "" }, { "docid": "312cc72f46c03fd5c4a2ea0de504617a", "score": "0.56583685", "text": "func (k Keeper) GetLastObservedEventNonce(ctx sdk.Context) uint64 {\n\tstore := ctx.KVStore(k.storeKey)\n\tbytes := store.Get(types.LastObservedEventNonceKey)\n\n\tif len(bytes) == 0 {\n\t\treturn 0\n\t}\n\treturn types.UInt64FromBytes(bytes)\n}", "title": "" }, { "docid": "e2acfcd94d427f4d28e0b7b1266a4043", "score": "0.5654196", "text": "func sendNonceMessage(err error, clientAddr string) {\n\n\t// generate seed\n\trand.Seed(int64(time.Now().Nanosecond()))\n\tnonce63 := rand.Int()\n\n\t// convert int to int64\n\tvar nonce64 int64\n\tnonce64 = int64(nonce63)\n\n\t// create a NonceMessage\n\tvar nonce NonceMessage\n\tnonce.Nonce = nonce64\n\n\t// encoding NonceMessage to JSON to aserver\n\tjsonNonce, err := json.Marshal(nonce)\n\thandleError(err)\n\n\t// client address\n\tclientUdpAddr, err := net.ResolveUDPAddr(\"udp\", clientAddr)\n\thandleError(err)\n\n\t// sending NonceMessage\n\t_, err = conndp.WriteToUDP(jsonNonce, clientUdpAddr)\n\thandleError(err)\n\n\t// Nonce and Secret\n\tmd5Hash := computeNonceSecretHash(nonce64, secret)\n\n\tvar hash HashMessage\n\thash.Hash = md5Hash\n\n\t// Adding client and HashMessage value to global map\n\taserverClientMD5Map.Lock()\n\taserverClientMD5Map.m[clientAddr] = hash\n\taserverClientMD5Map.Unlock()\n}", "title": "" }, { "docid": "8197a14ff45c020a8fe33ece72c994e9", "score": "0.5618639", "text": "func (rt *RequestTemplate) SetNonce(i int64) {\n\trt.Nonce = i\n}", "title": "" }, { "docid": "b1c016fac4e3e33745ea5cc1c00fd543", "score": "0.55929404", "text": "func (t *Tokener) appendNonce(dst []byte) ([]byte, error) {\n\tnonce := dst[len(dst) : len(dst)+t.aead.NonceSize()]\n\tputTimestamp(nonce[:8])\n\terr := putRandom(nonce[8:])\n\treturn dst[:len(dst)+t.aead.NonceSize()], err\n}", "title": "" }, { "docid": "1890e34a662a818ea016058bddb791ed", "score": "0.55908483", "text": "func (c *Conn) NextNonce(ctx context.Context,\n\taddress common.Address,\n) (\n\tuint64,\n\terror,\n) {\n\tc.noncesMu.Lock()\n\tdefer c.noncesMu.Unlock()\n\n\tcurrentNonce, err := c.currentNonce(ctx, address)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tcurrentNonce++\n\tc.nonces[address]++\n\n\treturn currentNonce, nil\n}", "title": "" }, { "docid": "16ba7fa89e6241cbea4d3ab2bbf29660", "score": "0.5523443", "text": "func generateToken(Username string, Nonce string, Created time.Time, Password string) string {\n\n\tsDec, _ := base64.StdEncoding.DecodeString(Nonce)\n\n\thasher := sha1.New()\n\t//hasher.Write([]byte((base64.StdEncoding.EncodeToString([]byte(Nonce)) + Created.Format(time.RFC3339) + Password)))\n\thasher.Write([]byte(string(sDec) + Created.Format(time.RFC3339Nano) + Password))\n\n\treturn base64.StdEncoding.EncodeToString(hasher.Sum(nil))\n}", "title": "" }, { "docid": "be2ebac3d61ace048364da19e11c306c", "score": "0.55029374", "text": "func (n *Nonce) GetInc() int64 {\n\tn.mtx.Lock()\n\tdefer n.mtx.Unlock()\n\tn.n++\n\treturn n.n\n}", "title": "" }, { "docid": "ee916d7598e74759e9466439430622e7", "score": "0.54937315", "text": "func GetKeyNonce(key BoxSharedKey) (nonce BoxNonce) {\n\tkh := Sha256H(key[:], GetSha256Hash(key[:]).Bytes())\n\tcopy(nonce[:], kh[:BoxNonceLen])\n\treturn\n}", "title": "" }, { "docid": "41fb73fc71efb1dc8a644afb0a2002f1", "score": "0.54835767", "text": "func ErrInvalidNonce(msg string) sdk.Error {\n\treturn sdk.NewError(DefaultCodespace, CodeInvalidNonce, msg)\n}", "title": "" }, { "docid": "0fd7a48c56b295c951551a39dd1c22d2", "score": "0.5471017", "text": "func Nonce(nonce string) Option {\n\treturn func(authorization *Authorization) error {\n\t\tauthorization.nonce = nonce\n\t\treturn nil\n\t}\n}", "title": "" } ]
baa77d30462d696f0fe070eadaeb7506
SetTimeout adds the timeout to the create custom ID p params
[ { "docid": "d29f098d2c8a730e9da968bd967f0124", "score": "0.85898864", "text": "func (o *CreateCustomIDPParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" } ]
[ { "docid": "b91bbfc37635cbb68c4cbaca36464457", "score": "0.7552384", "text": "func (o *CreateCustomIDPParams) WithTimeout(timeout time.Duration) *CreateCustomIDPParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "f222b456d956834ad398e884d8fe8424", "score": "0.74520737", "text": "func (o *CreateAndConfirmPreregParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "227bb74e2d92ba2d4b60da3d6597f793", "score": "0.73542887", "text": "func (o *CreateUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1b812652296870231b4252d9c635b050", "score": "0.71764314", "text": "func (o *CreateCustomPropertyForTenantParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f56a74964a990066b0996fde856d3b27", "score": "0.7156984", "text": "func (o *CreateOrUpdateUsingPOST2Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "493692b31a7f3732953efce7cb316259", "score": "0.7153996", "text": "func (o *AddCallerIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "2249f46da326bcb9ce8a02ad0ac09604", "score": "0.70883524", "text": "func (o *PostIamAPIKeysMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "75bba48d71a2d740ed5469dac8c69f1c", "score": "0.70860827", "text": "func (o *CreateCreditParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "2d7937fc57b9242f03abef10a9579c95", "score": "0.7084046", "text": "func (o *CreateSecretParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "44ebd4278fa2cd3173506a9a45f33c6e", "score": "0.7082117", "text": "func (o *NodesPostSSHByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9b0f940a31ebcdc6dfabc3cea432897c", "score": "0.70746887", "text": "func (o *CreatePropertyGroupUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0f620b4af85d4c4790d6807c9c30e017", "score": "0.7073977", "text": "func (o *WeaviateSchemaThingsCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b766ec5860b2d4cd57f69c6c9169c858", "score": "0.7072591", "text": "func (o *GetClinicsClinicGUIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1995bb77ac1f16985cbd9d820566b9c5", "score": "0.7070001", "text": "func (o *CreateCapabilityParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "55fde4d50a12a7a4fb7a9248bdae2e39", "score": "0.7043797", "text": "func (o *CreateCustomRuleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "cf488d85337bc0ca453e9176c958d32d", "score": "0.70193547", "text": "func (o *CreateManagedNamespaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "2053875c747b2c2ae4b4f6ffa968f54b", "score": "0.69764036", "text": "func (o *PutCustomObjectDefinitionsByIDAttributeGroupsByIDAttributeDefinitionsByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c349b55ed7671114c9ff689980748329", "score": "0.69570595", "text": "func (o *PostCloudProjectServiceNameStorageContainerIDPublicURLParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d907c4cf6aee52aa468c6a68b6ec4c28", "score": "0.6921558", "text": "func NewCreateCustomIDPParamsWithTimeout(timeout time.Duration) *CreateCustomIDPParams {\n\tvar (\n\t\taidDefault = string(\"default\")\n\t\ttidDefault = string(\"default\")\n\t)\n\treturn &CreateCustomIDPParams{\n\t\tAid: aidDefault,\n\t\tTid: tidDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "dc884a5a23f6db67c021f10221d783fb", "score": "0.69175196", "text": "func (o *CreateResourceRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "2cd3205c9a1fcca11e0b26975440d18f", "score": "0.69126165", "text": "func (o *CreateLookRenderTaskParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "85da516eccf0b8feb7ae9b17c7e085a2", "score": "0.69047886", "text": "func (o *NodesWorkflowActionByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "107c0550241d94c19907cf388eee518b", "score": "0.69018024", "text": "func (o *PostAutoDiscoveryCloudaccountParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "75f582e06339309ec2afed39e4b9daa3", "score": "0.6879608", "text": "func (o *PutContainersUUIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "80f498eceed521299e459c96b63300f1", "score": "0.6878046", "text": "func (o *PostAccountsAccountIDClaimsTypeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "4ff36fd26010433931f3b57f8030c146", "score": "0.68720555", "text": "func (o *IntegrationsCreateWithVendorParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "83bf53659f010d28ba3247e6c1e703a1", "score": "0.68708503", "text": "func (o *PostWorkflowWorkflowDefinitionsMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "00a2ba228dc60d9be4de333f57073106", "score": "0.6856738", "text": "func (o *GetDomesticScheduledPaymentsDomesticScheduledPaymentIDPaymentDetailsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "bb2600fc224287602578585ab6494f52", "score": "0.6854531", "text": "func (o *GetNextCommandUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9766e831e4dd1a15e3e60f69197fbf90", "score": "0.6849247", "text": "func (o *PostNmsBackupsCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "dd9caea3bbafd977c312b41497ac25f9", "score": "0.684281", "text": "func (o *SchemaActionsCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "72e003e81fb975b425f7e0978ea8b47e", "score": "0.68394285", "text": "func (o *PostRetentionsIDExecutionsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c2f3e614774b8f0b75cad5f5e7c40d76", "score": "0.6817698", "text": "func (o *CreateZoneParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7b956150c820c8d5e61d59541afa60f1", "score": "0.6814598", "text": "func (o *CreateAppParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d9a1273b8c1ac193605333e63dddad67", "score": "0.6814246", "text": "func (o *PostManagementControllersMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "000d4ea2f6cecb4974c0c3d7b301b710", "score": "0.6795048", "text": "func (o *SaveRecipeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "59200df8fdac7f661a61269a3382ae24", "score": "0.679407", "text": "func (o *CreateSyncPolicyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "cfd3f0bbad0a310ab680fca4803b84bf", "score": "0.67934257", "text": "func (o *PatchSDTByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "20ea98ecbd7d12103219bc4829d7eeeb", "score": "0.6790982", "text": "func (o *CreateFutureInvoiceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "2986f144bdaec4bcaa6d663d26045e0d", "score": "0.6787421", "text": "func (o *GetCustomersByIDPaymentInstrumentsByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "45edbfdfaac47b4f9d88059716c04ddc", "score": "0.6779539", "text": "func (o *PostLTENetworkIDSubscribersParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "42dc0d142426f5214c61aa2017318b65", "score": "0.6775222", "text": "func (o *GetWebsiteByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f09e70051036eaff653e82a0ccf6ab79", "score": "0.677353", "text": "func (o *PatchPatientsPatientGUIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "26f4baa1978bc94fbe0695a9650b6118", "score": "0.6768733", "text": "func (o *PostSepainstantParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "eb9f9032f7cbc766b1d030804851f82e", "score": "0.67587054", "text": "func (c *OrganizationsEnvironmentsApisRevisionsDebugsessionsCreateCall) Timeout(timeout int64) *OrganizationsEnvironmentsApisRevisionsDebugsessionsCreateCall {\n\tc.urlParams_.Set(\"timeout\", fmt.Sprint(timeout))\n\treturn c\n}", "title": "" }, { "docid": "6c0db7c4389fe02aa8b71d86f30b05f7", "score": "0.6753565", "text": "func (o *HooksPatchByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d1b29e6d691a4dece6a256c8201cacf4", "score": "0.67521644", "text": "func (o *CreateNotificationRuleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "bf42276ae5a3d698c91fc243bb66b22a", "score": "0.67450017", "text": "func (o *CreateDevicePEMCertificateUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b877308ef5de9f37de0cb34b243060c8", "score": "0.6742808", "text": "func (o *PatchCatalogsByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5378d17ee008fa927abee1890f75ddc7", "score": "0.6739947", "text": "func (o *PublicCreateUserNamespaceSlotParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "27c8a510e5a92b883306b6f105e0a187", "score": "0.673583", "text": "func (o *PostStoragePhysicalDiskUsagesMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3846c8075cc7a00951c62d46d63b02eb", "score": "0.6732622", "text": "func (o *PostWalletInitParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c1fca66794baf65525073adcea365b0f", "score": "0.6724628", "text": "func (o *AllocateOrReleaseFromIPPoolParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c1fca66794baf65525073adcea365b0f", "score": "0.6724628", "text": "func (o *AllocateOrReleaseFromIPPoolParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7d73a4410944d0ade7318655863776e6", "score": "0.67197526", "text": "func (o *CreateChannelParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7ba5a538b9ff8deb6a333f76217665f4", "score": "0.6719321", "text": "func (o *CreateShareParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "eb39253f05556229b511aa14f65a9338", "score": "0.6708243", "text": "func (o *GetaspecificManagerSecretaryParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c9eb5a29f3dd10ee85d35dd41cd211e3", "score": "0.670277", "text": "func (o *CreateElfImageParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d3a81a0bbc833fffb9bc8ca4a4265d8b", "score": "0.6690059", "text": "func (o *CreateMeteringAssignmentStrategyUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "450bd5577342283a4040990f7b265c69", "score": "0.66858697", "text": "func (o *AddAPIKeyPrivilegeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "6d825eeece8ce6d430ac30fd3019b644", "score": "0.66827047", "text": "func (o *GetCIDGroupByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b9b57811f49604c3795c68091b14a3dd", "score": "0.6680411", "text": "func (o *InvoiceCreateCreditNoteCreateCreditNoteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9b6145a4c7336a1527ab384b65167916", "score": "0.6676154", "text": "func (ddc *DatabaseDetectorCreate) SetTimeout(s string) *DatabaseDetectorCreate {\n\tddc.mutation.SetTimeout(s)\n\treturn ddc\n}", "title": "" }, { "docid": "4a61a633b4a3f3deeeb97b15b85d3e02", "score": "0.66647094", "text": "func (o *EmployeesByIDPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e2558af6e5fe66d43e7479fd337ac772", "score": "0.6663147", "text": "func (o *PostWasmContractsContractAddressOwnerParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e38dbfd4bf5d53c2a03a3c335aec9da2", "score": "0.6660174", "text": "func (o *CreateApprovedResourceRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d1a048e503a6cc3e3f5ea7b67251930c", "score": "0.6638963", "text": "func (o *AddLibraryParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d369f48c05d73b9fc83d75a9adda94b3", "score": "0.66384995", "text": "func (o *GenerateDryRunInvoiceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c3a850f9bc444f29261022b5c2548773", "score": "0.66280216", "text": "func (o *CreateStrategyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "786eacab6dca73ca41b76c631956f56e", "score": "0.6626152", "text": "func (o *PublicGetQRCodeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9eac80143e1fb4097f69ff0b350ad5e4", "score": "0.6624111", "text": "func (o *PostVhostsVhostIDOperationsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5870fe3e81f530617e4bb2c0f1454b32", "score": "0.6621656", "text": "func (o *CreateHardeningResolveItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d20ad03127f8c70a8625602fe8d4d498", "score": "0.66177297", "text": "func (o *AddPartsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "055377cf77158b0ebe858f65b318aabe", "score": "0.6612979", "text": "func (o *DeleteCredentialsIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "42f3f7cbf1b3893036bcf24b8e83ada9", "score": "0.66128737", "text": "func (o *PatchProductsByIDVariationAttributesByIDValuesByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "dff815c6dbaa0b77f841d2cf3e146170", "score": "0.66110545", "text": "func SetTimeout(t time.Duration) {\n\ttimeout = t\n}", "title": "" }, { "docid": "262c55f1c75a5b9af8c6e087d5f67a2e", "score": "0.6607947", "text": "func (o *AddRoleSimplePostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3baedb89394d71524170a6387508c32e", "score": "0.6606545", "text": "func (o *GetMandatesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "4463635a1d145b4c19b5326ac357b7b0", "score": "0.66063195", "text": "func (o *CreatePoliciesPolicyCancelItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "018a0a43470ee29697f0b4284adec096", "score": "0.66048634", "text": "func (o *CreateRuleWaiverParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9edad7a8362295b0aef41ac6da22d517", "score": "0.66032046", "text": "func (o *GetMappingIdentityParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "883ecd2fd6e90839e2aad3ab99cd6c4a", "score": "0.6603137", "text": "func (o *CreateDeviceEventsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "afead7730f2c0411ec3f7e017210f4a3", "score": "0.6600757", "text": "func (o *AddComponentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5685d10a45c9143affe4a01d0256ae2f", "score": "0.6600608", "text": "func (o *CreateanewCFSourceSetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "31fae9077bd56442be7490dcb417ff5a", "score": "0.6594118", "text": "func (o *PutRecordsDisableIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "4d526bcadb552a26e2e0e248937d3efb", "score": "0.65925086", "text": "func (o *CreateanewUpnRewriteSetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e36779ed0b811feb27008914856d296f", "score": "0.6582921", "text": "func (o *GetPdusParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8937ec5507ce545832698fdb6d2b2681", "score": "0.6581489", "text": "func (o *PostItemCommandParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8e6358956a16f96a9b3b39b3afd91ec3", "score": "0.6581389", "text": "func (o *CreateAuthRoleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d2048a1f9684ff07275a0a66962d19ef", "score": "0.65764236", "text": "func (o *CreateSyncRuleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9b8502b9c16dbe7f826b160bdd49f84f", "score": "0.65741456", "text": "func (o *GetPrivateAddToAddressBookParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "29adf1c985579d692d47a3ebb09ea357", "score": "0.65739787", "text": "func (o *AddRemoteRDSNodeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d20992c4bd77fb8db93a315c15e7d860", "score": "0.65726125", "text": "func (o *GetRestapiV10AccountAccountIDExtensionExtensionIDMessageStoreMessageIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "6cdf03dc81195d4399837f63635b0b71", "score": "0.6572057", "text": "func (o *PutHostRsrcResourceSetRsidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "35271bf85664db8d52f60f1200d25ef3", "score": "0.65674067", "text": "func (o *PersonParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e3a70d0951c7491039824dc1025ac14b", "score": "0.65656745", "text": "func (o *AddCPUArchitectureParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "052d200ceeb715a5791290179738b08c", "score": "0.6560045", "text": "func (o *GetContentByIdsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e8e175152422fca88133664048d77fb0", "score": "0.65598756", "text": "func (o *PostStackInWorkspaceV4InternalParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b490f813cb222723c0e2bf2d2ebb0738", "score": "0.6558747", "text": "func (o *GetSitesByIDCampaignsByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "2af45966a1eb4fea4040ff5214f79b7a", "score": "0.65567464", "text": "func (o *RolesByIDPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" } ]
091a7ceb2570da0cf440d75613f0d7e9
firstRetryNoDelayBackoff modifies the target Backoff to not delay in the first retry.
[ { "docid": "67a9fd84165397c2a961d96e80e59413", "score": "0.88809335", "text": "func firstRetryNoDelayBackoff(target Backoff) Backoff {\n\treturn &backoffImpl{func(ctx Context) time.Duration {\n\t\tif ctx.RetryCount == 1 {\n\t\t\treturn 0\n\t\t} else {\n\t\t\treturn target.GetDelay(ctx.previous())\n\t\t}\n\t}}\n}", "title": "" } ]
[ { "docid": "bd61e26ded8306fe446414511c0efe2d", "score": "0.70270103", "text": "func (s Specification) FirstRetryDelay(t time.Duration) Specification {\n\ts.startDelay = t\n\treturn s\n}", "title": "" }, { "docid": "269b8ae0b3892e10a9715d1c2940d08d", "score": "0.6299966", "text": "func (b *backoff) Reset() {\n\tb.nextDelay = 0\n}", "title": "" }, { "docid": "2c91f840f7262a000d0507e8687270b8", "score": "0.621972", "text": "func DefaultFixedDelayBackoff() Backoff {\n\treturn FixedDelayBackoff(1 * time.Second)\n}", "title": "" }, { "docid": "a26dac84ae800c5d3df1a5cafffcf919", "score": "0.61351687", "text": "func (s *cachedService) resetRetryDelay() {\n\ts.lastRetryDelay = time.Duration(0)\n}", "title": "" }, { "docid": "7f9cb8ca0eae775d3b46e98fb0fdd96a", "score": "0.5801779", "text": "func DefaultUniformRandomBackoff() Backoff {\n\treturn UniformRandomBackoff(1 * time.Second)\n}", "title": "" }, { "docid": "22f3b856e081504ed81e9d7c1812d62b", "score": "0.5686761", "text": "func (b *Backoff) Reset() {\n\tb.numRetries = 0\n\tb.nextDelayMin = b.cfg.MinBackoff\n\tb.nextDelayMax = doubleDuration(b.cfg.MinBackoff, b.cfg.MaxBackoff)\n}", "title": "" }, { "docid": "5014780edcdfde90d6092aab1d641d31", "score": "0.5587444", "text": "func (_m *MockBackoffer) ResetSleepBackoff() {\n\t_m.Called()\n}", "title": "" }, { "docid": "dd8c7f6cedb231b1ce4160f80be5c108", "score": "0.55793715", "text": "func (o *oktaBackoff) Reset() {}", "title": "" }, { "docid": "898132db309c9aecfb9855d40d8cd6cf", "score": "0.5572402", "text": "func (t *Timeouts) DefaultBackoff() wait.Backoff {\n\treturn t.Backoff(2, 0.5, 5)\n}", "title": "" }, { "docid": "810ccdf4d1b6e3693aadc5649ec644cf", "score": "0.55624837", "text": "func NewNoBackoff() Backoff {\n\treturn noBackoff{}\n}", "title": "" }, { "docid": "d141d767c8c7d5f17656b14b1ed7f74d", "score": "0.55536526", "text": "func FixedDelayBackoff(delay time.Duration) Backoff {\n\treturn &backoffImpl{getDelayFunction(delay)}\n}", "title": "" }, { "docid": "3e5ea161d77f327172659a38c5fdad86", "score": "0.55175155", "text": "func defaultDelayFunc(tries int) time.Duration {\n\tif tries < 1 {\n\t\ttries = 1\n\t}\n\trn := rand.Intn(tries)\n\tif rn == 0 {\n\t\trn = 1\n\t}\n\treturn time.Duration(rn * 100 * int(time.Millisecond))\n}", "title": "" }, { "docid": "20a3f9d82479632f302c561171cdf92b", "score": "0.5484403", "text": "func (s *cachedService) nextRetryDelay() time.Duration {\n\ts.lastRetryDelay = s.lastRetryDelay * 2\n\tif s.lastRetryDelay < minRetryDelay {\n\t\ts.lastRetryDelay = minRetryDelay\n\t}\n\tif s.lastRetryDelay > maxRetryDelay {\n\t\ts.lastRetryDelay = maxRetryDelay\n\t}\n\treturn s.lastRetryDelay\n}", "title": "" }, { "docid": "8928a68eca99663bb5e7270c3c87d92d", "score": "0.5422632", "text": "func testOneShot_RetryBackoff() (bool, error) {\n\tvar (\n\t\tg Group\n\t\ti int\n\t\ttimes []time.Time\n\t)\n\n\tfailed := false\n\n\tconst retries = 6\n\n\th := fixture(func(r Registry, l hive.Lifecycle) {\n\t\tg = r.NewGroup()\n\n\t\tg.Add(\n\t\t\tOneShot(\"retry-backoff\", func(ctx context.Context) error {\n\t\t\t\tdefer func() { i++ }()\n\t\t\t\ttimes = append(times, time.Now())\n\t\t\t\treturn errors.New(\"Always error\")\n\t\t\t}, WithRetry(retries, workqueue.NewItemExponentialFailureRateLimiter(50*time.Millisecond, 10*time.Second))),\n\t\t)\n\n\t\tl.Append(g)\n\t})\n\n\tif err := h.Start(context.Background()); err != nil {\n\t\treturn true, err\n\t}\n\n\t// Continue as soon as all jobs stopped\n\tg.(*group).wg.Wait()\n\n\tif err := h.Stop(context.Background()); err != nil {\n\t\treturn true, err\n\t}\n\n\tvar last time.Duration\n\tfor i := 1; i < len(times); i++ {\n\t\tdiff := times[i].Sub(times[i-1])\n\t\tif i > 2 {\n\t\t\t// Test that the rate of change is 2 +- 50%, the 50% to account for CI time dilation.\n\t\t\t// The 10 factor is to add avoid integer rounding.\n\t\t\tfract := uint64(diff * 10 / last * 10)\n\t\t\tif fract < 150 || fract > 250 {\n\t\t\t\tfailed = true\n\t\t\t}\n\t\t}\n\t\tlast = diff\n\t}\n\n\treturn failed, nil\n}", "title": "" }, { "docid": "3dc5fe3188c0d1961e02c946916aca51", "score": "0.53728235", "text": "func (b *Backoff) Reset() {\n\tb.attempt = 0\n}", "title": "" }, { "docid": "1872b8077c1da1a626920b6b167e17c4", "score": "0.53323114", "text": "func (b *Backoff) Reset() {\n\tb.attempt = 0\n\tb.cur = b.Min\n}", "title": "" }, { "docid": "506132deefbe4cebf18c6fe6dd76bf40", "score": "0.5330597", "text": "func (b *Backoff) Reset() {\n\tb.attempts = 0\n}", "title": "" }, { "docid": "55d5170e30195c32001ef3ba572550af", "score": "0.5296606", "text": "func defaultDoDelay(ctx context.Context, delay time.Duration) error {\n\tif delay == 0 {\n\t\treturn nil\n\t}\n\n\ttimer := time.NewTimer(delay)\n\tselect {\n\tcase <-timer.C:\n\t\treturn nil\n\tcase <-ctx.Done():\n\t\ttimer.Stop()\n\t\treturn errors.WithStack(ctx.Err())\n\t}\n}", "title": "" }, { "docid": "1cdabdcf90af6733679b6318f75f6c07", "score": "0.527847", "text": "func TestOneShot_RetryBackoff(t *testing.T) {\n\tok := 0\n\tfor i := 0; i < 5; i++ {\n\t\tfailed, err := testOneShot_RetryBackoff()\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tif !failed {\n\t\t\tok++\n\t\t}\n\t}\n\n\tif ok == 0 {\n\t\tt.Fatal(\"0/5 retry backoff tests succeeded\")\n\t}\n}", "title": "" }, { "docid": "4b9757b9fa9f2a11a09d3a400a8e0eac", "score": "0.5261354", "text": "func (rs *RetryState) NextBackoff(error) time.Duration {\n\treturn rs.ExponentialBackoff()\n}", "title": "" }, { "docid": "9a2264ff7646467f9b4ca44745f9c783", "score": "0.51861775", "text": "func fixedJitterBackoff(delay time.Duration, target Backoff) Backoff {\n\treturn &backoffImpl{func(ctx Context) time.Duration {\n\t\treturn delay + target.GetDelay(ctx)\n\t}}\n}", "title": "" }, { "docid": "a73c764ad7cf4408b4afa4e778a79b90", "score": "0.51789695", "text": "func SetDefaultBackoff(b backoff.BackOff) {\n\tbackoffObject = b\n}", "title": "" }, { "docid": "471fe39ffaca6491bf00e48150e73131", "score": "0.5131791", "text": "func retry(attempts int, delay time.Duration, globals config.GlobalOptions,\n\tf func() error) error {\n\n\terr := f()\n\tif err != nil {\n\t\t// Increment attempts. If reached max retry just return error\n\t\tattempts++\n\t\tif attempts >= globals.MaxRetryCount {\n\t\t\treturn err\n\t\t}\n\t\t// Wait the delay. If exponential retry is set, double delay\n\t\ttime.Sleep(delay)\n\t\tfmt.Println(\"Backing off\")\n\t\tif globals.RetryExponentialBackoff {\n\t\t\tdelay = delay * 2\n\t\t}\n\t\t// Retry the function\n\t\treturn retry(attempts, delay, globals, f)\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "4bddfacf85e7b1e1b3f8697cae287298", "score": "0.5124941", "text": "func WhileUnsuccessfulDelay1Second(run func() error, timeout time.Duration) error {\n\treturn WhileUnsuccessful(run, time.Second, timeout)\n}", "title": "" }, { "docid": "2f8d16f67fb772ea2aced5a14282bd6a", "score": "0.51129836", "text": "func (_m *MockBackoffer) SleepBackoff() {\n\t_m.Called()\n}", "title": "" }, { "docid": "f2a08e75a9ce3b7300bf93e99030bfc1", "score": "0.51031816", "text": "func (_m *Backoff) Reset() {\n\t_m.Called()\n}", "title": "" }, { "docid": "54c24eb3d42c1880fb7ac07f826ad160", "score": "0.5101225", "text": "func (b *StreamingDataSourceBuilder) InitialReconnectDelay(\n\tinitialReconnectDelay time.Duration,\n) *StreamingDataSourceBuilder {\n\tif initialReconnectDelay <= 0 {\n\t\tb.initialReconnectDelay = DefaultInitialReconnectDelay\n\t} else {\n\t\tb.initialReconnectDelay = initialReconnectDelay\n\t}\n\treturn b\n}", "title": "" }, { "docid": "92a453f48bb879d697b5274c623bd710", "score": "0.50727147", "text": "func DefaultBackoff(min, max time.Duration, attemptNum int, resp *http.Response) time.Duration {\n\tmult := math.Pow(2, float64(attemptNum)) * float64(min)\n\tsleep := time.Duration(mult)\n\tif float64(sleep) != mult || sleep > max {\n\t\tsleep = max\n\t}\n\treturn sleep\n}", "title": "" }, { "docid": "c8f13f76eb126e81c0e44fcc5f28c874", "score": "0.5068076", "text": "func RetryBackoff(backoff func(int) time.Duration) Opt {\n\treturn clientOpt{func(cfg *cfg) { cfg.retryBackoff = backoff }}\n}", "title": "" }, { "docid": "355392de6945969a2e79f99c0db5846b", "score": "0.505217", "text": "func GetDefaultBackoff() backoff.BackOff {\n\treturn backoffObject\n}", "title": "" }, { "docid": "7d645ab4defb124686d3422944a768cc", "score": "0.5045498", "text": "func ExponentialDelayBackoff(initialDelay time.Duration, multiplier float64) Backoff {\n\treturn &backoffImpl{func(ctx Context) time.Duration {\n\t\treturn time.Duration(float64(initialDelay) * math.Pow(multiplier, float64(ctx.RetryCount-1)))\n\t}}\n}", "title": "" }, { "docid": "6ca317d16cf029ff31cab79d4be06cd1", "score": "0.50248104", "text": "func (m *PeerManager) retryDelay(peer *peerInfo, failures uint32) time.Duration {\n\tif failures == 0 {\n\t\treturn 0\n\t}\n\tif m.options.MinRetryTime == 0 {\n\t\treturn time.Duration(math.MaxInt64)\n\t}\n\tmaxDelay := m.options.MaxRetryTime\n\tif peer.Persistent && m.options.MaxRetryTimePersistent > 0 {\n\t\tmaxDelay = m.options.MaxRetryTimePersistent\n\t}\n\n\tdelay := m.options.MinRetryTime * time.Duration(math.Pow(2, float64(failures)))\n\tif maxDelay > 0 && delay > maxDelay {\n\t\tdelay = maxDelay\n\t}\n\t// FIXME: This should use a PeerManager-scoped RNG.\n\tdelay += time.Duration(rand.Int63n(int64(m.options.RetryTimeJitter))) // nolint:gosec\n\treturn delay\n}", "title": "" }, { "docid": "0877cfe24db7e5a6aa47224ddfcf2cbd", "score": "0.5016849", "text": "func (c check) InitialDelay() time.Duration { return c.initialDelay }", "title": "" }, { "docid": "adf5864fec48a8320178885b672b97b0", "score": "0.5012457", "text": "func randomJitterBackoff(maxDelay time.Duration, target Backoff) Backoff {\n\treturn &backoffImpl{func(ctx Context) time.Duration {\n\t\trandomDelay := getRandomDurationMinMax(-maxDelay, maxDelay)\n\t\treturn randomDelay + target.GetDelay(ctx)\n\t}}\n}", "title": "" }, { "docid": "77dc286c7fe0ba57b3aff8ac632c9da2", "score": "0.49939436", "text": "func (backoff *Backoff) FailSleep() {\n\ttime.Sleep(backoff.Fail())\n}", "title": "" }, { "docid": "bc70454d8317d10c4d4b8e86e0f752ab", "score": "0.49788025", "text": "func BackOffDelay(n uint, config *Config) time.Duration {\n\treturn config.delay * (1 << n)\n}", "title": "" }, { "docid": "16080f80816416da4cc5674d986be3f8", "score": "0.49707258", "text": "func (e *Error) SetNoRetry() *Error {\n\te.permanent = true\n\treturn e\n}", "title": "" }, { "docid": "a25502a2b3ca0c19b0f7b10c98a1fcf4", "score": "0.49534914", "text": "func WhileSuccessfulDelay1Second(run func() error, timeout time.Duration) error {\n\treturn WhileSuccessful(run, time.Second, timeout)\n}", "title": "" }, { "docid": "c4626e55c073b966bfbbbbdf5c359961", "score": "0.49425304", "text": "func (rs *RetryState) ExponentialBackoff() time.Duration {\n\trs.retryTimes++\n\tbackoff := rs.nextBackoff\n\trs.nextBackoff *= 2\n\tif rs.nextBackoff > rs.maxBackoff {\n\t\trs.nextBackoff = rs.maxBackoff\n\t}\n\treturn backoff\n}", "title": "" }, { "docid": "282b8d2b522b5ff427d85a555ed556dc", "score": "0.49366704", "text": "func testRetryPolicyThreeTimes() *backoff.ExponentialBackOff {\n\texpBack := backoff.NewExponentialBackOff()\n\texpBack.InitialInterval = 500 * time.Millisecond\n\texpBack.RandomizationFactor = 0\n\texpBack.Multiplier = 1.5\n\texpBack.MaxInterval = 1 * time.Second\n\texpBack.MaxElapsedTime = 2249 * time.Millisecond\n\treturn expBack\n}", "title": "" }, { "docid": "9f2f0e9c58fc7eee6b841e8e2011eb2d", "score": "0.49339134", "text": "func UniformRandomBackoff(maxDelay time.Duration) Backoff {\n\trandomDelay := getRandomDuration(maxDelay)\n\treturn &backoffImpl{getDelayFunction(randomDelay)}\n}", "title": "" }, { "docid": "4a35a42f307fdd1900cf0e9d03fd1aab", "score": "0.49030244", "text": "func (l *Loader) RetryDelay() time.Duration {\n\treturn l.cfg.RetryDelay\n}", "title": "" }, { "docid": "9994513287cdfa1ae1b053893f424887", "score": "0.4894395", "text": "func WhileUnsuccessfulDelay1SecondWithNotify(run func() error, timeout time.Duration, notify Notify) error {\n\treturn WhileUnsuccessfulWithNotify(run, time.Second, timeout, notify)\n}", "title": "" }, { "docid": "c7eeb115d59867dac171f86d087ecb8f", "score": "0.4860713", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Global_Timers_SpfPathAny) InitialDelay() *NetworkInstance_Protocol_Ospfv2_Global_Timers_Spf_InitialDelayPathAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Global_Timers_Spf_InitialDelayPathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"initial-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "110663b4c20c988f3f483fe24f0d99e9", "score": "0.48605058", "text": "func proportinalJitterBackoff(multiplier float64, target Backoff) Backoff {\n\treturn &backoffImpl{func(ctx Context) time.Duration {\n\t\tdelay := target.GetDelay(ctx)\n\t\trangeDelay := time.Duration(float64(delay) * math.Abs(multiplier))\n\t\trandomDelay := getRandomDurationMinMax(-rangeDelay, rangeDelay)\n\t\treturn delay + randomDelay\n\t}}\n}", "title": "" }, { "docid": "34d622bc04bc87c347c79461851befaa", "score": "0.4853652", "text": "func (s) TestPickFirst_OneServerDown(t *testing.T) {\n\tcc, r, backends := setupPickFirst(t, 2)\n\n\taddrs := backendsToAddrs(backends)\n\tr.UpdateState(resolver.State{Addresses: addrs})\n\n\tctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)\n\tdefer cancel()\n\tif err := checkPickFirst(ctx, cc, addrs[0].Addr); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Stop the backend which is currently being used. RPCs should get routed to\n\t// the next backend in the list.\n\tbackends[0].Stop()\n\tif err := checkPickFirst(ctx, cc, addrs[1].Addr); err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "8a5cf3cd5cf373c35ca4d0293538508f", "score": "0.48375848", "text": "func (e *Btcc) AutoSleep() {\n\tnow := time.Now().UnixNano()\n\tinterval := 1e+9/e.limit*conver.Float64Must(e.lastTimes) - conver.Float64Must(now-e.lastSleep)\n\tif interval > 0.0 {\n\t\ttime.Sleep(time.Duration(conver.Int64Must(interval)))\n\t}\n\te.lastTimes = 0\n\te.lastSleep = now\n}", "title": "" }, { "docid": "8974f003384de10094e5a29d48d4e9f8", "score": "0.48359668", "text": "func (o *WorkflowPropertiesAllOf) SetRetryDelay(v int64) {\n\to.RetryDelay = &v\n}", "title": "" }, { "docid": "13577044db79055fb72b2da36f585201", "score": "0.4816056", "text": "func (e *ExpectedBulkGet) WillDelay(delay time.Duration) *ExpectedBulkGet {\n\te.delay = delay\n\treturn e\n}", "title": "" }, { "docid": "45c5dad90f30e0a241c04e04518c0ed0", "score": "0.48152778", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Global_Timers_SpfPath) InitialDelay() *NetworkInstance_Protocol_Ospfv2_Global_Timers_Spf_InitialDelayPath {\n\treturn &NetworkInstance_Protocol_Ospfv2_Global_Timers_Spf_InitialDelayPath{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"initial-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "8bc5c2b157e489309aeb01fefe27a95b", "score": "0.48104525", "text": "func (ieb *IEBWithTimeout) Next() error {\n\t// Confirm there are retries left.\n\tleftSec := float64((ieb.timeout - time.Now().Sub(ieb.startedAt)).Nanoseconds())\n\tif leftSec <= 0 || ieb.nextDelay == 0 {\n\t\treturn errors.New(\"no more retries left\")\n\t}\n\ttime.Sleep(time.Duration(ieb.nextDelay))\n\tleftSec2 := leftSec - ieb.nextDelay\n\tminNano := float64(ieb.min.Nanoseconds())\n\tnewBackoffTime := ieb.nextDelay * ieb.factor\n\n\tif newBackoffTime > minNano && leftSec2 > newBackoffTime {\n\t\tieb.nextDelay = newBackoffTime\n\t} else if newBackoffTime > minNano && leftSec2 < newBackoffTime {\n\t\tieb.nextDelay = leftSec2 - float64(1*time.Second.Nanoseconds())\n\t} else if newBackoffTime < minNano && leftSec2 - minNano > 1 {\n\t\tieb.nextDelay = minNano\n\t} else if newBackoffTime < minNano && leftSec2 - minNano < minNano && leftSec2 > 1 {\n\t\t// if the newBackoffTime < minNano and leftSec-minNano < minNano and leftSec> 1 sec we should be able to do a retry one last time before 1sec of timeout.\n\t\tieb.nextDelay = leftSec2 - float64(1*time.Second.Nanoseconds())\n\t\tif ieb.nextDelay < 0{\n\t\t\tieb.nextDelay = 0\n\t\t}\n\t}\n\nreturn nil\n}", "title": "" }, { "docid": "bbf8143e25307fd05a765d25a5cccca3", "score": "0.47997665", "text": "func (s) TestPickFirst_AllServersDown(t *testing.T) {\n\tcc, r, backends := setupPickFirst(t, 2)\n\n\taddrs := backendsToAddrs(backends)\n\tr.UpdateState(resolver.State{Addresses: addrs})\n\n\tctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)\n\tdefer cancel()\n\tif err := checkPickFirst(ctx, cc, addrs[0].Addr); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tfor _, b := range backends {\n\t\tb.Stop()\n\t}\n\n\tclient := testgrpc.NewTestServiceClient(cc)\n\tfor {\n\t\tif ctx.Err() != nil {\n\t\t\tt.Fatalf(\"channel failed to move to Unavailable after all backends were stopped: %v\", ctx.Err())\n\t\t}\n\t\tif _, err := client.EmptyCall(ctx, &testpb.Empty{}); status.Code(err) == codes.Unavailable {\n\t\t\treturn\n\t\t}\n\t\ttime.Sleep(defaultTestShortTimeout)\n\t}\n}", "title": "" }, { "docid": "5263366c053648b5fed23a61522d2939", "score": "0.4778745", "text": "func (o LivenessCheckResponseOutput) InitialDelay() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LivenessCheckResponse) string { return v.InitialDelay }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "206597a65774429795d75dc7f8c0d8ec", "score": "0.47738642", "text": "func oneTimeAllowingThrottler(firstRPCDone *grpcsync.Event) *fakeThrottler {\n\treturn &fakeThrottler{\n\t\tthrottleFunc: firstRPCDone.HasFired,\n\t\tthrottleCh: make(chan struct{}, 1),\n\t}\n}", "title": "" }, { "docid": "d1302c112920bd8e57e45aa8f0484c91", "score": "0.4773294", "text": "func (t *TestingTB) SkipNow() {}", "title": "" }, { "docid": "e004682c62b3f1a5629467e4fbedf691", "score": "0.47676164", "text": "func (c *Client) RateLimitStrategySleep() {\n\tc.RateLimitFunc = func(rl RateLimit) {\n\t\tremaining := rl.WaitTimeRemaining()\n\t\ttime.Sleep(remaining)\n\t}\n}", "title": "" }, { "docid": "f288ed8ab6a14a285899356457ae1861", "score": "0.47672608", "text": "func DefaultBackoffBuilder() (Backoff, error) {\n\treturn NewSimpleBackoff(defaultBackoffStep, defaultBackoffMax), nil\n}", "title": "" }, { "docid": "fc43e35e44336ff4e24cb2ff57dac0eb", "score": "0.47628433", "text": "func (r *Request) RetryBackOff(intervals Intervals) *Request {\n\tr.retryIntervals = intervals\n\treturn r\n}", "title": "" }, { "docid": "64a2af6de964ff1f16d829a3b81a4ca7", "score": "0.47544673", "text": "func (mb *msgBlock) selectNextFirst() {\n\tvar seq uint64\n\tfor seq = mb.first.seq + 1; seq <= mb.last.seq; seq++ {\n\t\tif _, ok := mb.dmap[seq]; ok {\n\t\t\t// We will move past this so we can delete the entry.\n\t\t\tdelete(mb.dmap, seq)\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\t// Set new first sequence.\n\tmb.first.seq = seq\n\n\t// Check if we are empty..\n\tif mb.isEmpty() {\n\t\tmb.first.ts = 0\n\t\treturn\n\t}\n\n\t// Need to get the timestamp.\n\t// We will try the cache direct and fallback if needed.\n\tvar smv StoreMsg\n\tsm, _ := mb.cacheLookup(seq, &smv)\n\tif sm == nil {\n\t\t// Slow path, need to unlock.\n\t\tmb.mu.Unlock()\n\t\tsm, _, _ = mb.fetchMsg(seq, &smv)\n\t\tmb.mu.Lock()\n\t}\n\tif sm != nil {\n\t\tmb.first.ts = sm.ts\n\t} else {\n\t\tmb.first.ts = 0\n\t}\n}", "title": "" }, { "docid": "05e210ffd76e08dbc78b821279efe97b", "score": "0.4745598", "text": "func (l *HTTPBackend) delay() time.Duration {\n\n\t/*\n\t * if we are flushing,\n\t * we use a tighter range of 500ms - 1000ms.\n\t */\n\tif l.flush {\n\t\tdelay, _ := random.DurationInRange(500, 1000)\n\t\treturn *delay\n\t}\n\n\t/*\n\t * if we are not flushing,\n\t * we use a wider range of 1500ms - 3000ms.\n\t */\n\tdelay, _ := random.DurationInRange(1500, 3000)\n\treturn *delay\n}", "title": "" }, { "docid": "80f84b16bc45d84307012bca69d47f55", "score": "0.47429162", "text": "func (e *ExpectedGetAttachmentMeta) WillDelay(delay time.Duration) *ExpectedGetAttachmentMeta {\n\te.delay = delay\n\treturn e\n}", "title": "" }, { "docid": "8e7404c2502af8df8262731cec99b636", "score": "0.47407475", "text": "func (e *ExpectedAllDocs) WillDelay(delay time.Duration) *ExpectedAllDocs {\n\te.delay = delay\n\treturn e\n}", "title": "" }, { "docid": "2e97262ee6fe3140f6920215f52b6f09", "score": "0.47345528", "text": "func (eb *exponentialBackoff) setMin(min time.Duration) {\n\teb.b.Min = min\n\tif (eb.currentDelay) < min {\n\t\teb.currentDelay = min\n\t}\n}", "title": "" }, { "docid": "56e777e039406b6c2a1ead3f221cf23f", "score": "0.47285584", "text": "func boundedMinDelayBackoff(minDelay time.Duration, target Backoff) Backoff {\n\treturn &backoffImpl{func(ctx Context) time.Duration {\n\t\treturn time.Duration(math.Max(float64(target.GetDelay(ctx)), float64(minDelay)))\n\t}}\n}", "title": "" }, { "docid": "6354ec06fa842620d2e80bb2734462c8", "score": "0.4726789", "text": "func TestBackoff(t *testing.T) {\n\tb := exponentialBackoff{minBackoff, maxBackoff}\n\ttests := []struct {\n\t\tretries int\n\t\tmin time.Duration\n\t\tmax time.Duration\n\t}{\n\t\t{\n\t\t\tretries: 0,\n\t\t\tmin: minBackoff,\n\t\t\tmax: minBackoff,\n\t\t},\n\t\t{\n\t\t\tretries: 1,\n\t\t\tmin: minBackoff,\n\t\t\tmax: time.Duration(rate * float64(minBackoff)),\n\t\t},\n\t\t{\n\t\t\tretries: 3,\n\t\t\tmin: time.Duration(math.Pow(rate, 3) * (1 - jitter) * float64(minBackoff)),\n\t\t\tmax: time.Duration(math.Pow(rate, 3) * float64(minBackoff)),\n\t\t},\n\t\t{\n\t\t\tretries: 1000,\n\t\t\tmin: time.Duration((1 - jitter) * float64(maxBackoff)),\n\t\t\tmax: maxBackoff,\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tgot := b.delay(test.retries)\n\t\tif float64(got) < float64(test.min) || float64(got) > float64(test.max) {\n\t\t\tt.Errorf(\"delay(%v) = %v, want in range [%v, %v]\", test.retries, got, test.min, test.max)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fb1858541667f74116440213a9c29e02", "score": "0.47248906", "text": "func (m *MILDBackoff) Retry(f func() error) error {\n\terr := f()\n\n\tif err == nil {\n\t\treturn nil\n\t}\n\n\tfor m.Next() {\n\t\tif err := f(); err == nil {\n\t\t\tif len(m.Slots) == 0 {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tm.decrement()\n\t\t}\n\n\t\ttime.Sleep(m.Delay)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "1c6fc9a9447bace43678b5297b592bd2", "score": "0.47220543", "text": "func Test_Run_retryBackoff(t *testing.T) {\n\t// Create informer instance to test.\n\tinformer, _, _, _ := initInformer()\n\n\tinformer.retries = 1\n\tstartTime := time.Now()\n\tretryTime := time.Now() // Initializing to now ensures that the test fail if AddFunc is not called in the expected time.\n\tinformer.AddFunc = func(interface{}) { retryTime = time.Now() }\n\n\t// Execute function\n\tgo informer.Run(make(chan struct{}))\n\ttime.Sleep(2010 * time.Millisecond)\n\n\t// Verify backoff logic waits 2 seconds before retrying.\n\tif startTime.Add(2 * time.Second).After(retryTime) {\n\t\tt.Errorf(\"Backoff logic failed to wait for 2 seconds.\")\n\t}\n}", "title": "" }, { "docid": "80bf908881e7d3ef628ba21387cec94a", "score": "0.472159", "text": "func checkPickFirst(ctx context.Context, cc *grpc.ClientConn, wantAddr string) error {\n\tclient := testgrpc.NewTestServiceClient(cc)\n\tpeer := &peer.Peer{}\n\t// Make sure the RPC reaches the expected backend once.\n\tfor {\n\t\ttime.Sleep(time.Millisecond)\n\t\tif ctx.Err() != nil {\n\t\t\treturn fmt.Errorf(\"timeout waiting for RPC to be routed to %q\", wantAddr)\n\t\t}\n\t\tif _, err := client.EmptyCall(ctx, &testpb.Empty{}, grpc.Peer(peer)); err != nil {\n\t\t\t// Some tests remove backends and check if pick_first is happening across\n\t\t\t// the remaining backends. In such cases, RPCs can initially fail on the\n\t\t\t// connection using the removed backend. Just keep retrying and eventually\n\t\t\t// the connection using the removed backend will shutdown and will be\n\t\t\t// removed.\n\t\t\tcontinue\n\t\t}\n\t\tif peer.Addr.String() == wantAddr {\n\t\t\tbreak\n\t\t}\n\t}\n\t// Make sure subsequent RPCs are all routed to the same backend.\n\tfor i := 0; i < 10; i++ {\n\t\tif _, err := client.EmptyCall(ctx, &testpb.Empty{}, grpc.Peer(peer)); err != nil {\n\t\t\treturn fmt.Errorf(\"EmptyCall() = %v, want <nil>\", err)\n\t\t}\n\t\tif gotAddr := peer.Addr.String(); gotAddr != wantAddr {\n\t\t\treturn fmt.Errorf(\"rpc sent to peer %q, want peer %q\", gotAddr, wantAddr)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c5f4be1948b50c9c4b1cbffb6b2857ab", "score": "0.47172442", "text": "func (f *Fn) ResetDelay(d time.Duration) error {\n\tf.m.Lock()\n\tdefer f.m.Unlock()\n\n\tf.cancel()\n\n\tdebug(\"scheduled to run after %v\", d)\n\tf.d = d\n\treturn f.call()\n}", "title": "" }, { "docid": "e6642c41f05657196dc549b2afdfa6ef", "score": "0.4713916", "text": "func (r *R) FailFast() *R {\n\tr.noRetry = true\n\treturn r\n}", "title": "" }, { "docid": "e6642c41f05657196dc549b2afdfa6ef", "score": "0.4713916", "text": "func (r *R) FailFast() *R {\n\tr.noRetry = true\n\treturn r\n}", "title": "" }, { "docid": "d133c16341e0d5428dd4d2af58f33f0c", "score": "0.47078073", "text": "func (s *metricsIngestSender) backoff(d time.Duration) {\n\tbackoffTimer := s.getBackoffTimer(d)\n\tselect {\n\tcase <-s.stopChannel:\n\tcase <-backoffTimer.C:\n\t}\n}", "title": "" }, { "docid": "a570195372173e3a5171e63be8e249b2", "score": "0.47077233", "text": "func (e *ExpectedGetAttachment) WillDelay(delay time.Duration) *ExpectedGetAttachment {\n\te.delay = delay\n\treturn e\n}", "title": "" }, { "docid": "469baf728bcb4d5de545435ad4fa6e7b", "score": "0.47033143", "text": "func (e *ExpectedGetMeta) WillDelay(delay time.Duration) *ExpectedGetMeta {\n\te.delay = delay\n\treturn e\n}", "title": "" }, { "docid": "a9eecacc3a09cf3aa27bc9dd538a365f", "score": "0.46956265", "text": "func KeepTryingWithBackoff(\n\tctx context.Context,\n\tminBackoff time.Duration,\n\tmaxBackoff time.Duration,\n\tf func(retryN uint) (final bool, silent bool, err error)) error {\n\tbackoffTime := minBackoff\n\tfor retryN := uint(0); ; retryN++ {\n\t\tcallTs := time.Now()\n\t\tfinal, silent, err := f(retryN)\n\t\tif final || err == nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := ctx.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tisDeadlineErr := (err == context.DeadlineExceeded || status.Convert(err).Code() == codes.DeadlineExceeded)\n\t\tif (retryN >= 2 || isDeadlineErr) && !silent {\n\t\t\tstackTrace := errors.Wrap(err, \"\").(stackTracer).StackTrace()\n\t\t\tstackFrame := stackTrace[1]\n\t\t\tzlog.Warningf(\"%n (%s:%d) retry #%d: %s...\",\n\t\t\t\tstackFrame, stackFrame, stackFrame, retryN, err)\n\t\t}\n\t\tif backoffTime > maxBackoff {\n\t\t\tbackoffTime = maxBackoff\n\t\t}\n\t\tjitteredBackoffTime := backoffTime/2 + time.Duration(rand.Int63n(int64(backoffTime)))\n\t\tbackoffTime *= 2\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase <-time.After(callTs.Add(jitteredBackoffTime).Sub(time.Now())):\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b62113187d9b3ebbd76f2107fd67b908", "score": "0.46816713", "text": "func (c *cached[T]) shouldRetryWithBackoff() bool {\n\tif c.clock.Since(c.retried) > backoffDuration*time.Duration(math.Pow(2, float64(c.backoffCounter))) {\n\t\tc.backoffCounter++\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "63c65340e098371744c5880d5ecb772f", "score": "0.46807164", "text": "func (e *ExpectedBulkDocs) WillDelay(delay time.Duration) *ExpectedBulkDocs {\n\te.delay = delay\n\treturn e\n}", "title": "" }, { "docid": "fc6f1d42f8ea165025c8be3376baa29f", "score": "0.46605727", "text": "func (e *ExpectedCreateDoc) WillDelay(delay time.Duration) *ExpectedCreateDoc {\n\te.delay = delay\n\treturn e\n}", "title": "" }, { "docid": "32a2f5d483ee108ff2722c376d24fb55", "score": "0.46582386", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability_Prefix) GetOrCreateDelayMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability_Prefix_DelayMetric {\n\tif s.DelayMetric != nil {\n\t\treturn s.DelayMetric\n\t}\n\ts.DelayMetric = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability_Prefix_DelayMetric{}\n\treturn s.DelayMetric\n}", "title": "" }, { "docid": "c950d0408f70708fc215dd02aa2bfcc1", "score": "0.46566537", "text": "func (r *noRetrier) NextInterval(retry int) time.Duration {\n\treturn 0 * time.Millisecond\n}", "title": "" }, { "docid": "c950d0408f70708fc215dd02aa2bfcc1", "score": "0.46566537", "text": "func (r *noRetrier) NextInterval(retry int) time.Duration {\n\treturn 0 * time.Millisecond\n}", "title": "" }, { "docid": "ebc9275e816317e6282b2f7c872e28bc", "score": "0.46521944", "text": "func (o LivenessCheckOutput) InitialDelay() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LivenessCheck) *string { return v.InitialDelay }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4f93c951036739475509178db59d9c65", "score": "0.4647979", "text": "func (o Observable) BlockingFirst(ctx context.Context) (value interface{}, err error) {\n\tctx, cancel := context.WithCancel(ctx)\n\n\tvar observer Observer\n\tobserver = func(t Notification) {\n\t\tswitch {\n\t\tcase t.HasValue:\n\t\t\tobserver = NopObserver\n\t\t\tvalue = t.Value\n\t\t\tcancel()\n\t\tcase t.HasError:\n\t\t\terr = t.Value.(error)\n\t\t\tcancel()\n\t\tdefault:\n\t\t\terr = ErrEmpty\n\t\t\tcancel()\n\t\t}\n\t}\n\to.Subscribe(ctx, observer.Notify)\n\n\t<-ctx.Done()\n\treturn\n}", "title": "" }, { "docid": "7863753cf252c8b38fc883d038ce153b", "score": "0.4643977", "text": "func (b *BackoffTimer) Reset() {\n\tif !b.timer.Stop() {\n\t\t<-b.timer.C\n\t}\n\tb.timer.Reset(b.BackoffBase)\n\tb.backoffCurrent = b.BackoffBase\n}", "title": "" }, { "docid": "4d2b80bbfbedae6363eb3c8907c349b1", "score": "0.46374908", "text": "func (e *ExpectedCreateIndex) WillDelay(delay time.Duration) *ExpectedCreateIndex {\n\te.delay = delay\n\treturn e\n}", "title": "" }, { "docid": "fa4b1dee6d24ce79fb1586050cef25c1", "score": "0.46336213", "text": "func NewFixedBackoff(delay time.Duration) BackoffFactory {\n\treturn func() BackoffStrategy {\n\t\treturn &fixedBackoff{delay: delay}\n\t}\n}", "title": "" }, { "docid": "88e02c1bbe6a27935dd9797125ddfd80", "score": "0.46316478", "text": "func uniformJitterBackoff(maxDelay time.Duration, target Backoff) Backoff {\n\trandomDelay := getRandomDurationMinMax(-maxDelay, maxDelay)\n\treturn &backoffImpl{func(ctx Context) time.Duration {\n\t\treturn randomDelay + target.GetDelay(ctx)\n\t}}\n}", "title": "" }, { "docid": "9e8c0d35fb37de71a7c76c4bd5d210fc", "score": "0.46285495", "text": "func ExponentialBackoff(baseSleepTime time.Duration, maxRetries int) Policy {\n\treturn exponentialBackoff{\n\t\tbaseSleepTime: baseSleepTime,\n\t\tmaxRetries: maxRetries,\n\t}\n}", "title": "" }, { "docid": "2054a26e36409394e463233a022e7f9f", "score": "0.4620949", "text": "func (l *Lock) RetryDelay() time.Duration {\n\treturn l.retryDelay\n}", "title": "" }, { "docid": "7f6d01ec1672c246b716a3979d46528d", "score": "0.4615749", "text": "func DoWithBackoff(httpReq *http.Request, opts ...DoWithBackoffOption) (*http.Response, error) {\n\tvar opt doWithBackoff\n\topt.SetDefault()\n\topt.ApplyOptions(opts...)\n\tif opt.RetryAfter == nil {\n\t\topt.RetryAfter = RetryAfter\n\t}\n\topt.Complete()\n\n\tvar option []time_.ExponentialBackOffOption\n\toption = append(option, time_.WithExponentialBackOffOptionMaxElapsedCount(3))\n\toption = append(option, opt.ExponentialBackOffOption...)\n\tbackoff := time_.NewDefaultExponentialBackOff(option...)\n\trewindableErr := RequestWithBodyRewindable(httpReq)\n\tvar retries int\n\tfor {\n\t\tif retries > 0 && httpReq.GetBody != nil {\n\t\t\tnewBody, err := httpReq.GetBody()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\thttpReq.Body = newBody\n\t\t}\n\t\tvar do = opt.DoRetryHandler\n\t\thttpDo := do\n\t\tif opt.clientInterceptor != nil {\n\t\t\thttpDo = func(req *http.Request, retry int) (*http.Response, error) {\n\t\t\t\treturn opt.clientInterceptor(req, retry, do, opts...)\n\t\t\t}\n\t\t}\n\t\tresp, err := httpDo(httpReq, retries)\n\n\t\twait, ok := backoff.NextBackOff()\n\t\tif !ok {\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"http do reach backoff limit after retries %d: %w\", retries, err)\n\t\t\t} else {\n\t\t\t\treturn resp, nil\n\t\t\t}\n\t\t}\n\n\t\twait, retry := opt.RetryAfter(resp, err, wait)\n\t\tif !retry {\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"http do reach server limit after retries %d: %w\", retries, err)\n\t\t\t} else {\n\t\t\t\treturn resp, nil\n\t\t\t}\n\t\t}\n\n\t\tif rewindableErr != nil {\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"http do cannot rewindbody after retries %d: %w\", retries, err)\n\t\t\t} else {\n\t\t\t\treturn resp, nil\n\t\t\t}\n\t\t}\n\n\t\ttimer := time.NewTimer(wait)\n\t\tselect {\n\t\tcase <-timer.C:\n\t\t\tretries++\n\t\t\tcontinue\n\t\tcase <-httpReq.Context().Done():\n\t\t\ttimer.Stop()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"http do canceled after retries %d: %w\", retries, err)\n\t\t\t} else {\n\t\t\t\treturn resp, nil\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "413e1cf57ef9d0e58deb53e18c6c949b", "score": "0.4613882", "text": "func FixedDelay(_ uint, config *Config) time.Duration {\n\treturn config.delay\n}", "title": "" }, { "docid": "6027dc35d0923cfdc825a54fad206145", "score": "0.4607743", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelayPathAny) MinDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MinDelayPathAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MinDelayPathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"min-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "51a261988cf62bdc72527a47fb60722f", "score": "0.46061185", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix) GetOrCreateDelayMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix_DelayMetric {\n\tif s.DelayMetric != nil {\n\t\treturn s.DelayMetric\n\t}\n\ts.DelayMetric = &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix_DelayMetric{}\n\treturn s.DelayMetric\n}", "title": "" }, { "docid": "3f521efef1eb06fec1397a6f9d2eb800", "score": "0.4605808", "text": "func (e *ExpectedCopy) WillDelay(delay time.Duration) *ExpectedCopy {\n\te.delay = delay\n\treturn e\n}", "title": "" }, { "docid": "076a11c050ee82114807732b26bca396", "score": "0.46054533", "text": "func WhileSuccessfulDelay1SecondWithNotify(run func() error, timeout time.Duration, notify Notify) error {\n\treturn WhileSuccessfulWithNotify(run, time.Second, timeout, notify)\n}", "title": "" }, { "docid": "2fc57ea00e0062b7e87a77220ec18808", "score": "0.4601133", "text": "func (o GoogleCloudRunV2ProbeOutput) InitialDelaySeconds() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v GoogleCloudRunV2Probe) *int { return v.InitialDelaySeconds }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "18df41a2347cf61ebd3f0b5bf349030d", "score": "0.4593808", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelayPathAny) MinDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MinDelayPathAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MinDelayPathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"min-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "8dee2e34e0deaafea628f18b9d94806c", "score": "0.45918745", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelayPathAny) MinDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MinDelayPathAny {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_MinMaxLinkDelay_MinDelayPathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"min-delay\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7cead79e9beb47a4ab7cf08badaafbc5", "score": "0.45910886", "text": "func (r *Request) RetryBackOffErrFn(fn func(*http.Response, error) bool) *Request {\n\tr.retryErrFn = fn\n\treturn r\n}", "title": "" }, { "docid": "d0da085667019aa0e18badfd2a82490a", "score": "0.45825797", "text": "func (c *clusterLimitRedis) RetryAfter(s string) int {\n\tretr := c.Delta(s)\n\tres := int(retr / time.Second)\n\tif res > 0 {\n\t\treturn res + 1\n\t}\n\t// Less than 1s to wait -> so set to 1\n\treturn 1\n}", "title": "" } ]
fed4e249844cf365de5e721d82802159
Stop stops the alert engine.
[ { "docid": "696ebd47d1ee79d7c10f2df344ee64d2", "score": "0.7362073", "text": "func (a *StatsAlertEngine) Stop() {\n\ta.cancelFunc()\n\ta.wg.Wait()\n\n\t// close all the API clients\n\tfor _, apiCl := range a.apiClients.clients {\n\t\tif apiCl != nil {\n\t\t\tapiCl.Close()\n\t\t}\n\t}\n\ta.apiClients.clients = make([]apiclient.Services, 0, numAPIClients)\n}", "title": "" } ]
[ { "docid": "778248f98ab4834d2dea290daba1d31d", "score": "0.74459094", "text": "func (e *Engine) Stop() {\n\te.stopSig <- true\n}", "title": "" }, { "docid": "8afebbd5d121c0dac8a54e44a77073ab", "score": "0.7433983", "text": "func (ei *EngineInstance) Stop(signal os.Signal) error {\n\tei.runner.Signal(signal)\n\treturn nil\n}", "title": "" }, { "docid": "70e732b13b394affed9ccb65c4d8c96b", "score": "0.7350585", "text": "func (r *rtEngine) Stop() {\n\tr.stop = true\n}", "title": "" }, { "docid": "fe3ef3328c48e8119d0e439fc6328573", "score": "0.7122232", "text": "func (e *Engine) Stop() {\n\n\tlog.Info(\"Engine: Stopping...\")\n\n\ttriggers := trigger.Triggers()\n\n\t// stop triggers\n\tfor _, trigger := range triggers {\n\t\tutil.StopManaged(\"Trigger [ \"+trigger.Metadata().ID+\" ]\", trigger)\n\t}\n\n\trunner := e.runner.(interface{})\n\tmanagedRunner, ok := runner.(util.Managed)\n\n\tif ok {\n\t\tutil.StopManaged(\"ActionRunner\", managedRunner)\n\t}\n\n\tlog.Info(\"Engine: Stopping Services...\")\n\n\terr := e.serviceManager.Stop()\n\n\tif err != nil {\n\t\tlog.Error(\"Engine: Error Stopping Services - \" + err.Error())\n\t} else {\n\t\tlog.Info(\"Engine: Stopped Services\")\n\t}\n\n\tlog.Info(\"Engine: Stopped\")\n}", "title": "" }, { "docid": "4f1050bf6211e11e1306ca8b779abe9e", "score": "0.69871867", "text": "func Stop() {\n\tinstance.Stop()\n}", "title": "" }, { "docid": "6bd43b324cfb30a4fe58ae1428e370b3", "score": "0.6975692", "text": "func (b *Bot) Stop() {\n\tif !b.active {\n\t\treturn\n\t}\n\n\tb.stopPosMgmt <- true\n\tclose(b.stopPosMgmt)\n\tb.stopPriceSteer <- true\n\tclose(b.stopPriceSteer)\n}", "title": "" }, { "docid": "e32c0bbb28904ba0280275dae17582f1", "score": "0.68626064", "text": "func (e *EvtFailureDetector) Stop() {\n\te.stop <- struct{}{}\n}", "title": "" }, { "docid": "e32c0bbb28904ba0280275dae17582f1", "score": "0.68626064", "text": "func (e *EvtFailureDetector) Stop() {\n\te.stop <- struct{}{}\n}", "title": "" }, { "docid": "310ac4951c2a28f12ddc41fb833095be", "score": "0.678752", "text": "func (h *handlerImpl) Stop() {\n\th.engine.Stop()\n}", "title": "" }, { "docid": "a87fb3788406b5cb38c944734f60fd9a", "score": "0.67759746", "text": "func (ss *Sim) Stop() {\n\tss.StopNow = true\n}", "title": "" }, { "docid": "a87fb3788406b5cb38c944734f60fd9a", "score": "0.67759746", "text": "func (ss *Sim) Stop() {\n\tss.StopNow = true\n}", "title": "" }, { "docid": "8a5a2fa69580dfaaf30c60633a8c79a4", "score": "0.6694131", "text": "func (a *Agent) Stop() {\n\ta.stop <- true\n}", "title": "" }, { "docid": "b594985a42b3847754476a4214f6c64e", "score": "0.6691214", "text": "func Stop() error {\n\treturn Default.Stop()\n}", "title": "" }, { "docid": "0e3b493297c1362bb75c13170baf37e5", "score": "0.6674259", "text": "func (a *Agent) Stop() {\n\ta.stopSignalHandler()\n\ta.groupCancel()\n\n\ta.logger.Debug().\n\t\tInt(\"pid\", os.Getpid()).\n\t\tStr(\"name\", release.NAME).\n\t\tStr(\"ver\", release.VERSION).Msg(\"Stopped\")\n}", "title": "" }, { "docid": "f6958fc0df2e9500d1a2903e1e5c128c", "score": "0.6653267", "text": "func (w *Watcher) Stop() {\n\tw.active = false\n}", "title": "" }, { "docid": "2213c342b5095fed0f9b61171b5be57a", "score": "0.664716", "text": "func (s *Simulator) Stop() error {\n\treturn nil\n}", "title": "" }, { "docid": "ce27f270d18f9cd77045f1af8ab15556", "score": "0.6630193", "text": "func (e *APIEngine) Stop() {\n\t//enable the shutdown flag to prevent conflicts\n\te.alive.Clear()\n\t//add a short timeout to allow open HTTP responses to complete\n\ttime.Sleep(1)\n\t//close worker channels\n\tfor _, c := range e.inChans {\n\t\tclose(c)\n\t}\n\t//wait for workers to finish\n\tlog.Println(\"Waiting for workers to finish...\")\n\te.wg.Wait()\n\tos.Exit(0)\n}", "title": "" }, { "docid": "008b24afb6af3d2cab8aca0aad0b2b28", "score": "0.6606981", "text": "func (pp *PowerAPI) Stop() {\n\tos.Exit(0)\n}", "title": "" }, { "docid": "6f7d0a78d091c8d015ffc1c7d4112986", "score": "0.66036457", "text": "func (katagoRunner *KatagoRunner) Stop() error {\n\treturn katagoRunner.SendGTPCommand(\"quit\\n\")\n}", "title": "" }, { "docid": "f0e4d62dc65cd3801ab88c33eca548b3", "score": "0.65677905", "text": "func (a *Agent) Stop() {\n\tclose(a.closeCh)\n}", "title": "" }, { "docid": "dba0978478648fa0271beacd72d9fb86", "score": "0.6564087", "text": "func (s *Smr) Stop() {\n\ts.QuitCh <- true\n\ts.UnRegisterToNetwork()\n}", "title": "" }, { "docid": "fdee854ea400eab9b9a893d4a39bc07a", "score": "0.65368223", "text": "func (expirer *Expirer) Stop() {\n\texpirer.ticker.Stop()\n\tclose(expirer.quitChan)\n}", "title": "" }, { "docid": "492e9962c00489fb87c3e6e73a50077c", "score": "0.651876", "text": "func (a *Agent) Stop() {\n\tstopper := restart.NewSerialStopper(\n\t\trestart.NewParallelStopper(\n\t\t\ta.filesScanner,\n\t\t\ta.networkListener,\n\t\t\ta.containersScanner,\n\t\t\ta.journaldLauncher,\n\t\t\ta.windowsEventLauncher,\n\t\t),\n\t\ta.pipelineProvider,\n\t\ta.auditor,\n\t)\n\tstopper.Stop()\n}", "title": "" }, { "docid": "5c60e025611fa96d71e1d72656820355", "score": "0.65017384", "text": "func (self *Whisper) Stop() error {\n\tclose(self.quit)\n\tlog.Info(\"Whisper stopped\")\n\treturn nil\n}", "title": "" }, { "docid": "582143e961be690dfc0648617a880220", "score": "0.6485878", "text": "func (c *checkRunner) Stop() error { return nil }", "title": "" }, { "docid": "4d2a37cf2cc354bc286ff0eee1c67972", "score": "0.64857286", "text": "func (attachENIHandler *attachENIHandler) stop() {\n\tattachENIHandler.cancel()\n}", "title": "" }, { "docid": "8b66cd024665e2ae0f29e43473703a8e", "score": "0.64801747", "text": "func (t *Translator) Stop() error {\n\treturn nil\n}", "title": "" }, { "docid": "cbc80a8adaef8d37eeb2476179734c60", "score": "0.64778054", "text": "func (es *EthSpy) Stop() {\n\t// TODO : Stop running discovery\n\t// TODO : Stop running transaction listening and relaying\n\t// TODO : Clean up any left of threads or processes\n\n}", "title": "" }, { "docid": "138a12c40e7b03537fb3d9b651ece2d9", "score": "0.6477403", "text": "func (s *Scheduler) Stop() {\n\ts.isStop = true\n\ts.etcdCli.Close()\n}", "title": "" }, { "docid": "0b1f70272d023eb4891d6cd827efdd10", "score": "0.647287", "text": "func (eca *ECA) Stop() {\n\teca.srvp.Stop()\t\n\teca.srva.Stop()\n}", "title": "" }, { "docid": "4bde87e58bacbab1181bf86caef1c6fc", "score": "0.64701015", "text": "func (m *Manager) Stop() {\n\tm.signalCh <- true\n\t<-m.stopCh\n}", "title": "" }, { "docid": "2c6ac91c3cd786e16c815ce65176e53c", "score": "0.64532787", "text": "func (e *Eventer) Stop() {\n\te.c.Stop()\n}", "title": "" }, { "docid": "3a04776f53bf5f729fcbf07102ae5815", "score": "0.6450626", "text": "func (p *DissentProtocol) Stop() {\n\tp.HasStopped = true\n\tp.Shutdown()\n}", "title": "" }, { "docid": "2f75578a7619721de12d38b6beee029e", "score": "0.6443006", "text": "func (m *monitor) Stop() {\n\tclose(m.quit)\n\tm.State = MonitorStopped\n}", "title": "" }, { "docid": "bbfa49606d37c083054e96bf9d72b474", "score": "0.64404905", "text": "func (s *Supervisord) Stop() {\n\ts.cancel()\n\t<-s.stopped\n}", "title": "" }, { "docid": "7870192823b7a642f7b161265e576054", "score": "0.6437424", "text": "func (t *Timer) Stop() {\n\tt.status.Set(StatusStopped)\n}", "title": "" }, { "docid": "63afc318c96ec8c51864b345b5742ece", "score": "0.64365244", "text": "func (w *Watcher) Stop() {\n\tclose(w.stop)\n}", "title": "" }, { "docid": "57de60af460eb52a2914f347c2a3be93", "score": "0.64210224", "text": "func Stop() { stopReport() }", "title": "" }, { "docid": "01828f87d018adbc1d9ae4a10c11fda1", "score": "0.6406956", "text": "func (s *stop) Stop() {\n\tclose(Stop.c)\n\tStop.cancel()\n}", "title": "" }, { "docid": "0f8c947a04d0038caeced0bf5d9d6031", "score": "0.6392373", "text": "func (c *Core) Stop() {\n\tc.quit = true\n}", "title": "" }, { "docid": "959cc6dfb2a6475a63abf951903cfe0a", "score": "0.63903326", "text": "func (t *Trigger) Stop() error {\n\tt.socket.Close()\n\treturn nil\n}", "title": "" }, { "docid": "ff8d01dce77f9c6e1e697c810956e84d", "score": "0.63876444", "text": "func Stop() {\n\tlevel.Debug(em.logger).Log(\"event\", \"Calling Stop()\")\n\n\tlevel.Debug(em.logger).Log(\"event\", \"Stop() completed\")\n}", "title": "" }, { "docid": "1545bdaefeab2927dabc5c4f5d9a4e89", "score": "0.6371653", "text": "func (t *Timer) Stop() {\n\tclose(t.shutdown)\n\tt.Pause()\n}", "title": "" }, { "docid": "341bbe0c8c754551527d05390acb5064", "score": "0.63666266", "text": "func (d *PeerLeecher) Stop() {\n\td.Terminate()\n\td.wg.Wait()\n}", "title": "" }, { "docid": "8dc6a757c63dc6194dc5e782bf1c4bee", "score": "0.63612384", "text": "func (sup *Supervisor) stop() {\n\tif sup.status == stRunning {\n\t\tsup.terminate <- true\n\t}\n\tsup.status = stReady\n}", "title": "" }, { "docid": "72507bf4cb28a67518f3e588a08cd820", "score": "0.6355064", "text": "func (jl *Clock) Stop() {\r\n\tjl.exit()\r\n\r\n\tjl.cleanJobs()\r\n}", "title": "" }, { "docid": "fc5cb26e6c491c6590d7d42fa65113b7", "score": "0.635455", "text": "func (imsm *Glue) Stop() error {\n\treturn imsm.timeoutManager.Stop()\n}", "title": "" }, { "docid": "1537e184a5bf8e4614fa55f8a779575d", "score": "0.6349309", "text": "func (alertmgr *StatsAlertMgr) Stop() {\n\talertmgr.logger.Infof(\"stopping stats alert mgr\")\n\talertmgr.cancelFunc()\n\talertmgr.wg.Wait()\n\n\t// stop all the policy handlers\n\talertmgr.Lock()\n\tfor _, ph := range alertmgr.policyHandlers {\n\t\tph.Stop()\n\t\tdelete(alertmgr.policyHandlers, ph.Name())\n\t}\n\talertmgr.Unlock()\n\n\t// stop alert engine\n\tif alertmgr.alertEngine != nil {\n\t\talertmgr.alertEngine.Stop()\n\t\talertmgr.alertEngine = nil\n\t}\n\n\t// stop config watcher\n\tif alertmgr.configWatcher != nil {\n\t\talertmgr.configWatcher.Stop()\n\t\talertmgr.configWatcher = nil\n\t}\n\n\t// close the metrics client\n\tif alertmgr.metricsRPCClient != nil {\n\t\talertmgr.metricsRPCClient.Close()\n\t\talertmgr.metricsRPCClient = nil\n\t}\n\n\talertmgr.logger.Infof(\"stopped stats alert mgr\")\n}", "title": "" }, { "docid": "53c4ec573aa7750b4cf6a7f197f9daa2", "score": "0.6344605", "text": "func Stop(w http.ResponseWriter, req *http.Request) {\n\tlog.Println(\">>>\", req.URL)\n\tlog.Println(\">>>\", theContext)\n\n\tswitch theContext.State {\n\tcase INIT, CONFIGURED:\n\t\ttheContext.Message = messageStopIC[theContext.Lang]\n\t\ttheContext.AlertLevel = DANGER\n\t\ttheContext.Title = titleExperiment[theContext.Lang]\n\t\trender(w, \"experiment\", theContext)\n\tcase STOPPED:\n\t\t// we already are in this State\n\t\t// only put a message, but don't touch the process\n\t\ttheContext.Message = messageStopS[theContext.Lang]\n\t\ttheContext.AlertLevel = WARNING\n\t\ttheContext.Title = titleStop[theContext.Lang]\n\t\trender(w, \"experiment\", theContext)\n\tcase RUNNING:\n\t\t//correct state, do the stop process\n\t\t// stop process instruction here!\n\t\t// stop process instruction here!\n\t\t// stop process instruction here!\n\n\t\t//stop gorutines??\n\t\tlog.Printf(\"Stop Gourutines (no at this time)\")\n\t\tlog.Printf(\"There are %v goroutines\", runtime.NumGoroutine())\n\n\t\t//swich off the status led in the raspi\n\t\thwio.DigitalWrite(theOshi.statusLed, hwio.LOW)\n\t\t// close the GPIO pins\n\t\t//hwio.CloseAll()\n\n\t\t//stop the arduino from read sensor and sending data via BT\n\t\tsetArduinoStateOFF()\n\t\tlog.Printf(\"Set Arduino OFF\")\n\n\t\t//close the file\n\t\terr := theContext.DataFile.Sync()\n\t\tif err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t}\n\t\ttheContext.DataFile.Close()\n\n\t\ttheContext.Message = messageStopR[theContext.Lang]\n\t\ttheContext.Title = titleStop[theContext.Lang]\n\t\ttheContext.State = STOPPED\n\t\ttheContext.AlertLevel = SUCCESS\n\t\trender(w, \"stop\", theContext)\n\n\t}\n}", "title": "" }, { "docid": "9c0648d40986e3aa46da875d621238c8", "score": "0.6343158", "text": "func (m *MaxRateModule) Stop() {}", "title": "" }, { "docid": "3f0d4c94b519234951e4ffa10b77c21e", "score": "0.63422924", "text": "func (l *ECSListener) Stop() {\n\tl.stop <- true\n}", "title": "" }, { "docid": "0764b5ebefe89a3368bd297b291f26f3", "score": "0.633665", "text": "func Stop(params *trakt.ScrobbleParams) (*trakt.Scrobble, error) {\n\treturn getC().Stop(params)\n}", "title": "" }, { "docid": "6d6686429694c91235a59d85cdfa9cbe", "score": "0.63336915", "text": "func (s *HashcatEngine) Stop() error {\n\tif s.engine == nil {\n\t\treturn nil\n\t}\n\n\tif s.isBruteForce {\n\t\t// Attempt to checkpoint... if we cant, immediately abort\n\t\tif err := s.engine.StopAtCheckpoint(); err != nil {\n\t\t\ts.engine.AbortRunningTask()\n\t\t\treturn err\n\t\t}\n\t}\n\ts.engine.AbortRunningTask()\n\treturn nil\n}", "title": "" }, { "docid": "7e2a757834b32b97223c8bf092c0f506", "score": "0.6328677", "text": "func (engine *Engine) Stop() error {\n\t//stop Run() if Stop() called directly\n\tdefer engine.StopSignal()\n\n\tengine.Lock()\n\tdefer engine.Unlock()\n\tif engine.closed {\n\t\treturn nil\n\t}\n\n\tengine.closed = true\n\n\tlog.Print(\"natsrpc: stopping...\")\n\n\t//usubcribe\n\tfor _, r := range engine.rpcs {\n\t\tif r.sub != nil {\n\t\t\tr.sub.Unsubscribe()\n\t\t}\n\t}\n\n\t//waite for all started handlers\n\tfor _, r := range engine.rpcs {\n\t\tr.wait()\n\t}\n\n\tlog.Print(\"natsrpc: stopped\")\n\treturn nil\n}", "title": "" }, { "docid": "cb90628fc192e003fb4447a50de81d16", "score": "0.63248855", "text": "func (t *Term) Stop() {\n\tt.tty.Restore()\n\tt.tty.Close()\n}", "title": "" }, { "docid": "364064d9c532a8d0749756a4b5ee1ef2", "score": "0.63244396", "text": "func (sc *SlackClient) Stop() error {\n\treturn nil\n}", "title": "" }, { "docid": "77ca32666ef13abe063cac892a732e01", "score": "0.6318809", "text": "func (s *simpleSLAMonitor) Stop() error {\n\tif s.interval > 0 {\n\t\tboolc := make(chan bool)\n\t\ts.closing <- boolc\n\t\t<-boolc\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bffa80f38089616b0423c34523976b9e", "score": "0.63113296", "text": "func (t *ticker) Stop() {\n\tt.timer.Stop()\n}", "title": "" }, { "docid": "4e062689fea21f36ee876358931d9f30", "score": "0.6303792", "text": "func (p *ruleEngine) stop() {\n\tif p.consumer != nil {\n\t\tp.consumer.Close()\n\t}\n\tp.notifyChan <- 0\n\tp.wg.Wait()\n}", "title": "" }, { "docid": "dc9ed483ed8e37dddfd90962e0297650", "score": "0.6303553", "text": "func (receiver *Receiver) Stop() {\n\treceiver.stop <- struct{}{}\n}", "title": "" }, { "docid": "86aefa6240e06a4720099d803699b9fa", "score": "0.6302244", "text": "func (t Ticker) Stop() {\n\tt.stop <- true\n}", "title": "" }, { "docid": "1470eb7d4de46fd679c7968dd8100e1d", "score": "0.6301624", "text": "func (t *TimeLogger) Stop() {\n\tevt := event{\n\t\tworkspace: \"default\", //todo: add context in future\n\t\tuuid: t.factory.NewUUID(),\n\t\tname: \"stop\",\n\t\tat: t.factory.NewTime(),\n\t\tcomment: \"\",\n\t}\n\n\tif len(t.events) > 0 {\n\t\tprev := t.events[len(t.events)-1]\n\t\tif prev.name != \"stop\" {\n\t\t\tt.events = append(t.events, evt)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "be1a29ded8397627f2bd0c67ea0b6b99", "score": "0.6300964", "text": "func (gpi *graphicsPowerInterface) stop(ctx context.Context) error {\n\tif err := os.Remove(gpi.signalRunningFile); err != nil {\n\t\ttesting.ContextLogf(ctx, \"Failed to remove stop signal file %s to shutdown graphics_Power test process\", gpi.signalRunningFile)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bf6d7b042d00f53241206adaee59ea15", "score": "0.6300201", "text": "func (m *Model) Stop() error {\n\tif !m.running {\n\t\treturn errors.New(\"Model: Stop() failed: model not currently running!\")\n\t}\n\tclose(m.rc)\n\tm.running = false\n\tm.PopCPP = nil\n\tm.PopVP = nil\n\ttime.Sleep(pause)\n\tm.rc = make(chan struct{})\n\treturn nil\n}", "title": "" }, { "docid": "00e1d768f99d8b34d6f98b3c02421b42", "score": "0.6297257", "text": "func (w *Watcher) Stop() {\n\tclose(w.stopCh)\n}", "title": "" }, { "docid": "7e9703d28bc9be93dd399ca7e63e1a71", "score": "0.6292904", "text": "func (a *Alarm) Stop() {\n\ta.Wait()\n\ta.quit <- true\n\ta.scheduler.RemoveAlarm(a.id)\n}", "title": "" }, { "docid": "0bb1a9f721d51f03a90968a7a9a272e7", "score": "0.6286833", "text": "func (m *Last) Stop(_ context.Context) error {\n\tm.hk.RemoveHook(hook.C2SStreamElementReceived, m.onElementRecv)\n\tm.hk.RemoveHook(hook.S2SInStreamElementReceived, m.onElementRecv)\n\tm.hk.RemoveHook(hook.C2SStreamPresenceReceived, m.onC2SPresenceRecv)\n\tm.hk.RemoveHook(hook.UserDeleted, m.onUserDeleted)\n\n\tlevel.Info(m.logger).Log(\"msg\", \"stopped last module\")\n\treturn nil\n}", "title": "" }, { "docid": "ee4a0895bd682c89f2e0397b3bc3731f", "score": "0.62858754", "text": "func (a *EthAdaptor) Stop() error {\n\treturn nil\n}", "title": "" }, { "docid": "dd4524e0efd64098fb19085c01e5098b", "score": "0.6285802", "text": "func (u *MQTTUpdater) Stop() {\n\tu.stop <- 0\n}", "title": "" }, { "docid": "ec8aee269c0eab189e2da162eb0ec3f9", "score": "0.62804705", "text": "func (h *WsHub) Stop() {\n\th.kill <- true\n}", "title": "" }, { "docid": "5f4cab58aeef6b7725700c68f76057fd", "score": "0.627089", "text": "func (self *UtilsDebug) Stop() {\n self.Object.Call(\"stop\")\n}", "title": "" }, { "docid": "54a5cad3799887ee1d784c2fe4446859", "score": "0.62691194", "text": "func (s *Stater) Stop() {\n\tif s.cancel != nil {\n\t\ts.cancel()\n\t}\n}", "title": "" }, { "docid": "039976b77ec22415521d55ce43d1f0b8", "score": "0.6266133", "text": "func (t ExamModule) Stop() {\n fmt.Println(t.Name + \" stop\")\n}", "title": "" }, { "docid": "0864b6884fa05eb5e25f4aa3e4673c96", "score": "0.6256183", "text": "func (sw *SenderWatcher) Stop() {\n\tclose(sw.quit)\n\tsw.reserveChangeScope.Close()\n}", "title": "" }, { "docid": "2db14c52004dbf9a403c2dba720b0cd7", "score": "0.6254621", "text": "func (s *Switch) Stop() {\n}", "title": "" }, { "docid": "5490f5fb8bb746d4b16a7b06098d8eb6", "score": "0.62532425", "text": "func (e *Executor) Stop() {\n\te.stop = true\n}", "title": "" }, { "docid": "8aa2b03541c88467950816f830501e3b", "score": "0.6252604", "text": "func (t *Ticker) Stop() { t.running = false; close(t.C) }", "title": "" }, { "docid": "63a82ce480817194bb1322458f882c4b", "score": "0.62430763", "text": "func (w *Worker) Stop() {\n\tclose(w.signal)\n}", "title": "" }, { "docid": "630f8dbdbceb35131a15b9a267d54c34", "score": "0.6242933", "text": "func (sf *supervisableFunc) stop() {\n\tif sf.status == stRunning {\n\t\tsf.h.terminate <- true\n\t}\n\tsf.status = stReady\n}", "title": "" }, { "docid": "11c500d2f51672cc60c06fe9e93ee288", "score": "0.62398285", "text": "func Stop() error {\n\treturn statsHandler.Stop()\n}", "title": "" }, { "docid": "eef7e006d9930ee85e267853be1adf4d", "score": "0.62347186", "text": "func (api *API) Stop() error {\n\tctx, cnl := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cnl()\n\treturn api.Hs.Shutdown(ctx)\n}", "title": "" }, { "docid": "c8dad14ea9799d39c13e89c7af01d80b", "score": "0.62342316", "text": "func (t *Ticker) Stop() { t.ticker.Stop() }", "title": "" }, { "docid": "8d7b93de983bbb015f0782f283690313", "score": "0.623081", "text": "func (s *Stage) Stop() {\n\ts.l.Infof(\"attempting to stop\")\n\tclose(s.stopChan)\n\ts.wg.Wait()\n\ts.l.Infof(\"stopped.\")\n}", "title": "" }, { "docid": "40b0af7004e296424b11756664a94b96", "score": "0.6227741", "text": "func Stop() {\n\t_running = false\n\tif _chanMsg != nil {\n\t\tclose(_chanMsg)\n\t}\n}", "title": "" }, { "docid": "6fffd040197ff0accc819f32eac66134", "score": "0.6226252", "text": "func (self *Mailer) Stop() {\n self.Ctrl <- CTRL_STOP\n}", "title": "" }, { "docid": "cf5261c3432f97c9afee8e82b11c7128", "score": "0.62254894", "text": "func (t *Timer) Stop() {\n\tt.t.Stop()\n}", "title": "" }, { "docid": "c8d5f5a5dbcc3c60847586db62b7e805", "score": "0.6224201", "text": "func (c *Controller) Stop() {\n\tc.activator.Stop()\n}", "title": "" }, { "docid": "075c34d8b20cd9017e31929d42c88209", "score": "0.6212306", "text": "func (manager *Manager) Stop() {\n\tclose(manager.stopChan)\n}", "title": "" }, { "docid": "3da1a9dafc8e003b701454af430cd908", "score": "0.6211529", "text": "func Stop() {\n\tserverHalt()\n}", "title": "" }, { "docid": "26271eeb1aea386d8e4ba5ad77a9501d", "score": "0.62082535", "text": "func Stop(ctx context.Context, protoAddr string) error {\n\tvar eng *engine\n\tif s, ok := allEngines.Load(protoAddr); ok {\n\t\teng = s.(*engine)\n\t\teng.signalShutdown()\n\t\tdefer allEngines.Delete(protoAddr)\n\t} else {\n\t\treturn errors.ErrEngineInShutdown\n\t}\n\n\tif eng.isInShutdown() {\n\t\treturn errors.ErrEngineInShutdown\n\t}\n\n\tticker := time.NewTicker(shutdownPollInterval)\n\tdefer ticker.Stop()\n\tfor {\n\t\tif eng.isInShutdown() {\n\t\t\treturn nil\n\t\t}\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase <-ticker.C:\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0e22ed5c2ac4af93b90f3876f9d675f5", "score": "0.6192984", "text": "func (d *Driver) Stop() error {\n\treturn d.getClient().PowerOff(d.ID)\n}", "title": "" }, { "docid": "72e7172bc75d9662f3613217eee5c595", "score": "0.6188731", "text": "func (self *Engine) Stop() error {\n\tLogger.log.Info(\"Stopping Consensus engine...\")\n\tself.Lock()\n\tdefer self.Unlock()\n\n\tif !self.started {\n\t\treturn errors.New(\"Consensus engine isn't running\")\n\t}\n\tself.StopProducer()\n\tif self.cQuitSwap != nil {\n\t\tclose(self.cQuitSwap)\n\t}\n\tclose(self.cQuit)\n\tself.started = false\n\tLogger.log.Info(\"Consensus engine stopped\")\n\treturn nil\n}", "title": "" }, { "docid": "62a1b828778e433a69e8afbb6bd6af8c", "score": "0.61845714", "text": "func (t *instance) Stop() { t.pty.cancelFn() }", "title": "" }, { "docid": "62a1b828778e433a69e8afbb6bd6af8c", "score": "0.61845714", "text": "func (t *instance) Stop() { t.pty.cancelFn() }", "title": "" }, { "docid": "b7f121443a66659da6a357409b6bf386", "score": "0.6176679", "text": "func (hc *GPUHealthChecker) Stop() {\n\tnvml.DeleteEventSet(hc.eventSet)\n\thc.stop <- true\n\t<-hc.stop\n}", "title": "" }, { "docid": "75d3292114d0abd321b00f314ad682b1", "score": "0.617627", "text": "func (ta *TimedActionsPlayer) Stop() error {\n\treturn ta.sendCommand(control{\n\t\tCommand: cmdStop,\n\t})\n}", "title": "" }, { "docid": "c0dd63343d49a0094d2bf1c2056b10d9", "score": "0.617529", "text": "func (worker *Silencer) Stop() error {\n\tworker.tomb.Kill(nil)\n\treturn worker.tomb.Wait()\n}", "title": "" }, { "docid": "7d4cde9b5f8ffecfe0f6e71d7c3b6901", "score": "0.61695683", "text": "func (t *Terminator) Stop() {\n\tt.init()\n\n\t// close channel once\n\tt.onceStop.Do(func() {\n\t\tclose(t.stopping)\n\n\t\t// call notifiers\n\t\tgo func() {\n\t\t\tfor _, t := range t.notifiers {\n\t\t\t\tt()\n\t\t\t}\n\t\t}()\n\t})\n}", "title": "" }, { "docid": "50e3ccf5c5c4cea1a7cdd70d4274a154", "score": "0.61673415", "text": "func (api *API) Stop() error {\n\tapi.log.Info(\"stopping API server\")\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\treturn api.echo.Shutdown(ctx)\n}", "title": "" }, { "docid": "9f7b414b405e7ea7c9e0ceb3aef0d1c6", "score": "0.6164031", "text": "func (t *TrackingComponent) Stop() {\n\tt.stopping = !t.stopping\n\tif t.stopping {\n\t\tfmt.Println(\"Stopping...\")\n\t}\n}", "title": "" } ]
c89e3fd10223de271c7de6ab92dd013d
SetPreviousTapTimeA A timestamp representing when the Pointer was last tapped or clicked.
[ { "docid": "49f4cb407fbd7dbc459f1a40e67d8255", "score": "0.81827134", "text": "func (self *Pointer) SetPreviousTapTimeA(member int) {\n self.Object.Set(\"previousTapTime\", member)\n}", "title": "" } ]
[ { "docid": "f6d490d49b52cb2dbe60f330b1360557", "score": "0.64461684", "text": "func (k Keeper) SetPreviousAccrualTime(ctx sdk.Context, ctype string, previousAccrualTime time.Time) {\n\tstore := prefix.NewStore(ctx.KVStore(k.key), types.PreviousAccrualTimePrefix)\n\tbz, err := previousAccrualTime.MarshalBinary()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tstore.Set([]byte(ctype), bz)\n}", "title": "" }, { "docid": "bcbc663898153460f3c66c68fa1ce804", "score": "0.64347774", "text": "func (k Keeper) SetPreviousBlockTime(ctx sdk.Context, blockTime time.Time) {\n\tstore := ctx.KVStore(k.storeKey)\n\ttimestamp, _ := gogotypes.TimestampProto(blockTime)\n\tbz := k.cdc.MustMarshalLengthPrefixed(timestamp)\n\tstore.Set(types.PreviousBlockTimeKey, bz)\n}", "title": "" }, { "docid": "cbd9b78af300be19a7aa6f2ab084cee3", "score": "0.6204079", "text": "func (self *Pointer) PreviousTapTime() int{\n return self.Object.Get(\"previousTapTime\").Int()\n}", "title": "" }, { "docid": "ac931e5ed6f402338ff3e660854b1542", "score": "0.61717075", "text": "func (self *Pointer) SetMsSinceLastClickA(member int) {\n self.Object.Set(\"msSinceLastClick\", member)\n}", "title": "" }, { "docid": "bc82281682c6a91450db2464de930d59", "score": "0.59240365", "text": "func (s *ScheduledQueryDescription) SetPreviousInvocationTime(v time.Time) *ScheduledQueryDescription {\n\ts.PreviousInvocationTime = &v\n\treturn s\n}", "title": "" }, { "docid": "348cd7d844aaa739f7de13547663ef1e", "score": "0.58888316", "text": "func (s *ScheduledQuery) SetPreviousInvocationTime(v time.Time) *ScheduledQuery {\n\ts.PreviousInvocationTime = &v\n\treturn s\n}", "title": "" }, { "docid": "8dbda18811b64269c17192990811c144", "score": "0.5825177", "text": "func (a *Alert) SetPreviousAlert(previous time.Time) {\n\ta.rw.Lock()\n\tdefer a.rw.Unlock()\n\ta.previousalert = previous\n}", "title": "" }, { "docid": "06885240b9c38a0a342336e370d3282f", "score": "0.5373401", "text": "func (cl *MockClock) SetTime(t time.Time) {\n\tcl.mutex.Lock()\n\tcl.currentTime = t\n\tcl.mutex.Unlock()\n\tcl.broadcast()\n}", "title": "" }, { "docid": "b72b9e48f8efe0c8885a9d3102d3d79a", "score": "0.5327024", "text": "func (self *Pointer) SetTimeUpA(member int) {\n self.Object.Set(\"timeUp\", member)\n}", "title": "" }, { "docid": "12fbe76fc695b257b87010a5a1b33f69", "score": "0.5315361", "text": "func (self *Text) SetPreviousPositionA(member *Point) {\n self.Object.Set(\"previousPosition\", member)\n}", "title": "" }, { "docid": "4528a3d14d488107a284046fb939b05b", "score": "0.5228636", "text": "func SetTime(t time.Time) {\n\tup := time.Duration(rtos.Nanosec())\n\tt = t.Add(-up)\n\tsetStartTime(t)\n}", "title": "" }, { "docid": "f3dbe7c338dbd272ab3455e9d3169e40", "score": "0.51537627", "text": "func (self *Pointer) SetTimeDownA(member int) {\n self.Object.Set(\"timeDown\", member)\n}", "title": "" }, { "docid": "9b95c3b53420413fb9ecad835708a233", "score": "0.51527226", "text": "func (m *AppointmentResultsMutation) ResetTimeAppoint() {\n\tm.timeAppoint = nil\n}", "title": "" }, { "docid": "dd7e3c9c1de9017ef9f340576c69ef1c", "score": "0.50827914", "text": "func (t *Timestamp) SetTime(pt time.Time) error {\n\tts, err := types.TimestampProto(pt)\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Timestamp = *ts\n\treturn nil\n}", "title": "" }, { "docid": "9f6a59de2592fbc1beba85340a1a6060", "score": "0.502945", "text": "func (this *Player) SetTime(v int64) {\n\tif this.ptr != nil {\n\t\tC.libvlc_media_player_set_time(this.ptr, C.libvlc_time_t(v))\n\t}\n}", "title": "" }, { "docid": "7c05e29c07309c42ca11fee06ad235f0", "score": "0.49757627", "text": "func (series *memorySeries) SetTimestamp(newTime time.Time) {\n\t// TODO(rfratto): does this need to be a CAS-style function instead?\n\tseries.Lock()\n\tdefer series.Unlock()\n\tseries.timestamp = newTime\n}", "title": "" }, { "docid": "6b397e68795e6953d03ddf132dfc2018", "score": "0.4955113", "text": "func (self *Text) SetPreviousRotationA(member int) {\n self.Object.Set(\"previousRotation\", member)\n}", "title": "" }, { "docid": "4abe1e6e2118eb713b04402501554e87", "score": "0.49483323", "text": "func (c *rtc) SetTime(t time.Time) (err error) {\n\n\treturn nil\n}", "title": "" }, { "docid": "c1c2b83b7d18376daec2fff3c8e5c27b", "score": "0.4873984", "text": "func (o ApplicationInsightsComponentDataVolumeCapResponsePtrOutput) ResetTime() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *ApplicationInsightsComponentDataVolumeCapResponse) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ResetTime\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "d82234c697e8d32031ba2f183ca2cb49", "score": "0.48684177", "text": "func (m *UriClickSecurityState) SetClickDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {\n m.clickDateTime = value\n}", "title": "" }, { "docid": "d28d69de2d19f1a51579b770e2e02043", "score": "0.48304528", "text": "func (a *FineOffsetWH24DataPoint) SetTime(t time.Time) {\n\ta.Time = t\n}", "title": "" }, { "docid": "af77b7e6966cd5991b6961d72d4e0bca", "score": "0.48297265", "text": "func (t *Time) SetTime(time time.Time) {\n\tt.time = time\n}", "title": "" }, { "docid": "130dcc28cfa664641fd3621fd0247fba", "score": "0.48179084", "text": "func (a *CalibeurRF104DataPoint) SetTime(t time.Time) {\n\ta.Time = t\n}", "title": "" }, { "docid": "438409e3cc62938f0f9d958fa4989e6b", "score": "0.47943974", "text": "func SetTime(t time.Time, ns int64) {\n\ttime.Set(t, ns)\n\tsetStartTime(t.Add(time.Duration(-ns)))\n}", "title": "" }, { "docid": "b73a9ac15d31b9a2faded9c9dfb755a6", "score": "0.479012", "text": "func (o *UpdateAlarmsParams) SetTime(time string) {\n\to.Time = time\n}", "title": "" }, { "docid": "8412fb5002c600614a843533e15841c4", "score": "0.47723055", "text": "func (o *PcloudEventsGetqueryParams) SetTime(time *string) {\n\to.Time = time\n}", "title": "" }, { "docid": "5de5ed9e693f464473cb14510b88b305", "score": "0.47577938", "text": "func (p *DataPoint) SetTime(t time.Time) {\n\tp.Timestamp = proto.Int64(t.UnixNano() / int64(time.Millisecond))\n}", "title": "" }, { "docid": "89561bd9acbb48a6b7d4d6d9965be60d", "score": "0.4749981", "text": "func SetLastTime(newLastTime int) (err error) {\n\terr = models.SetUsedLastTime(newLastTime)\n\tif err != nil {\n\t\treturn\n\t}\n\tlastTime = newLastTime\n\treturn\n}", "title": "" }, { "docid": "b2a7ca8dd160c69750e2be9fe8ec63f5", "score": "0.4721293", "text": "func (in *ActionDatasetCreateInput) SetAtime(value bool) *ActionDatasetCreateInput {\n\tin.Atime = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Atime\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "0929342f52a621d8e12d08f2006a0b44", "score": "0.47071582", "text": "func (s *Session) SetLastShareTimestamp(t time.Time) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tif s.log != nil {\n\t\ts.log.Printf(\"Shares index: %d %s\\n\", s.lastShareSpot, t)\n\t}\n\ts.shareTimes[s.lastShareSpot] = t\n\ts.lastShareSpot++\n\tif s.lastShareSpot == s.vardiff.bufSize {\n\t\ts.lastShareSpot = 0\n\t}\n}", "title": "" }, { "docid": "8128ea67ca0bf8d8d0ad91bfac7250bd", "score": "0.46974298", "text": "func (xu *XUtil) TimeSet(t xproto.Timestamp) {\n\txu.eventTime = t\n}", "title": "" }, { "docid": "3787c8180b3cd62593bc077e89f21d86", "score": "0.4691084", "text": "func (o *QueryCandleStickParams) SetTime(time int64) {\n\to.Time = time\n}", "title": "" }, { "docid": "65bec695dff4e23b1fbbd9f064866060", "score": "0.46555036", "text": "func (c *MediaController) Previous(timeout time.Duration) (*api.CastMessage, error) {\n\treturn c.sendCommand(commandMediaPrevious, timeout)\n}", "title": "" }, { "docid": "9400933010683f64c3269b0ef314a1fa", "score": "0.46502694", "text": "func (m *StandardTimeZoneOffset) SetTime(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly)() {\n err := m.GetBackingStore().Set(\"time\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c11e0adf59183efef97fc6667990522e", "score": "0.46109867", "text": "func (m *DeviceHealthScriptTimeSchedule) SetTime(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly)() {\n err := m.GetBackingStore().Set(\"time\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "556aa4d900ab7bc4ce92d3baf19eb16e", "score": "0.4609822", "text": "func (p *producer) setTime() time.Time {\n\tcurrentTime := time.Now()\n\treturn currentTime\n}", "title": "" }, { "docid": "91974ed7dec9546a0f27b51f5ac1f59c", "score": "0.45910934", "text": "func (a Alert) PreviousAlert() time.Time {\n\ta.rw.RLock()\n\tdefer a.rw.RUnlock()\n\treturn a.previousalert\n}", "title": "" }, { "docid": "c9b43b947acf8e8ad747bfabd8556c5e", "score": "0.45582092", "text": "func (o *PaginatedApiResponseAllOfPages) SetPrevious(v string) {\n\to.Previous = v\n}", "title": "" }, { "docid": "9da074d3bb06436922a86edde89dd237", "score": "0.45543984", "text": "func (s *Store) SetLastAccessedTime(lastacc time.Time) {\n\ts.lastAccessedTime = lastacc\n}", "title": "" }, { "docid": "5c94f5e4db1499d101ca04e8efde6892", "score": "0.45542157", "text": "func (task *BaseTask) SetPreviousTask(newTask Task) {\n\ttask.previousTask = newTask\n}", "title": "" }, { "docid": "1827b54d47026f7912a19dde1f1d7765", "score": "0.45519966", "text": "func (d *DeferNode) ChangePrevious(nx NodePush) {\n\tif nx == nil {\n\t\treturn\n\t}\n\td.prev = nx\n}", "title": "" }, { "docid": "a7239473edc2ef499974b89f6518ad29", "score": "0.45508885", "text": "func SetPreviousHash(block, previousBlock interface{}) {\n\tif previousBlock == nil {\n\t\treturn\n\t}\n\tvalidateBlock(block)\n\tvalidateBlock(previousBlock)\n\n\thashField := GetFieldsTaggedWith(previousBlock, \"hash\")\n\tpreviousHashField := GetFieldsTaggedWith(block, \"previoushash\")\n\tpreviousHash := GetFieldValue(previousBlock, hashField[0])\n\tSetFieldValue(block, previousHashField[0], previousHash)\n}", "title": "" }, { "docid": "fe0cf0e8ff21adeae613f69079591ac0", "score": "0.45381123", "text": "func (o *MetricsDatapoint) SetTime(v time.Time) {\n\to.Time = v\n}", "title": "" }, { "docid": "eb57c13665e2dea3c95527f6676de7fe", "score": "0.45269793", "text": "func (k Keeper) GetPreviousAccrualTime(ctx sdk.Context, ctype string) (time.Time, bool) {\n\tstore := prefix.NewStore(ctx.KVStore(k.key), types.PreviousAccrualTimePrefix)\n\tbz := store.Get([]byte(ctype))\n\tif bz == nil {\n\t\treturn time.Time{}, false\n\t}\n\tvar previousAccrualTime time.Time\n\tif err := previousAccrualTime.UnmarshalBinary(bz); err != nil {\n\t\tpanic(err)\n\t}\n\treturn previousAccrualTime, true\n}", "title": "" }, { "docid": "8560414379993e32e4abae5c57f73db2", "score": "0.4526778", "text": "func (d *DeferNode) ResetPrevious() {\n\td.prev = nil\n}", "title": "" }, { "docid": "07545bddadf8781bda832fe6a9772f29", "score": "0.45240077", "text": "func (m *MockClock) Set(t time.Time) time.Time {\n\tm.nowMu.Lock()\n\tdefer m.nowMu.Unlock()\n\n\told := m.now\n\tif old.After(t) {\n\t\tpanic(fmt.Sprintf(\"current time (`%s`) is after the one being set (`%s`)\", old, t))\n\t}\n\tm.now = t\n\tm.notifyNow(t)\n\treturn old\n}", "title": "" }, { "docid": "7e0ccbddc49dfbf5f583e133cb265611", "score": "0.45028713", "text": "func (i *Inverter) SetTime(t time.Time) error {\n\tvalue := uint32(t.Unix() - InverterEpochOffset)\n\tbuf := new(bytes.Buffer)\n\tbinary.Write(buf, binary.BigEndian, value)\n\tbvalue := buf.Bytes()\n\t_, err := i.Communicate(SetTime, Byte(bvalue[0]), Byte(bvalue[1]), Byte(bvalue[2]), Byte(bvalue[3]))\n\treturn err\n}", "title": "" }, { "docid": "e9ed3bd2dcaeed7f113005871fb36423", "score": "0.44927353", "text": "func (ms *MemStore) SetTimeNow(timeNow func() time.Time) {\n\tms.timeNow = timeNow\n}", "title": "" }, { "docid": "65f9de1b2ff3442490e5dc2ce3c6681b", "score": "0.44838187", "text": "func (m *RightToTreatmentMutation) ResetStartTime() {\n\tm._StartTime = nil\n}", "title": "" }, { "docid": "3d067afc81679fc829e8216811e994ac", "score": "0.4447868", "text": "func SetDetectedTime(newDetectedTime int) (err error) {\n\terr = models.SetDetectedTime(newDetectedTime)\n\tif err != nil {\n\t\treturn\n\t}\n\tdetectedTime = newDetectedTime\n\treturn\n}", "title": "" }, { "docid": "2acc9094ad2c26f58231ca5658461f46", "score": "0.44200537", "text": "func (t *pointerUtils) Time(ptr *time.Time) time.Time {\n\treturn t.DefaultTime(ptr, time.Time{})\n}", "title": "" }, { "docid": "6346cd098612495e887dc29482d6a8c4", "score": "0.4418132", "text": "func (m *AppointmentResultsMutation) SetTimeAppoint(t time.Time) {\n\tm.timeAppoint = &t\n}", "title": "" }, { "docid": "f3c8ab99ee0d70044dd08184db24de35", "score": "0.4416973", "text": "func (m SettlementInstructions) SetTransactTime(v time.Time) {\n\tm.Set(field.NewTransactTime(v))\n}", "title": "" }, { "docid": "180e22431e7026beb34c696cc17fc5ee", "score": "0.4412273", "text": "func (rp *RandPlayer) PrevAction(prevAction *hex.Action) {\n\tif prevAction != nil {\n\t\trp.updatePlayerState(prevAction)\n\t}\n}", "title": "" }, { "docid": "c167879ad6de59c064a629e53941a5d5", "score": "0.44075382", "text": "func (self *Timer) SetTimeCapA(member int) {\n self.Object.Set(\"timeCap\", member)\n}", "title": "" }, { "docid": "0748cf4aa1cb4df6ce8038d7d05a7091", "score": "0.44063288", "text": "func earlier(a, b time.Time) time.Time {\n\tif a.IsZero() {\n\t\treturn b\n\t}\n\tif b.IsZero() {\n\t\treturn a\n\t}\n\tif a.Before(b) {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "0748cf4aa1cb4df6ce8038d7d05a7091", "score": "0.44063288", "text": "func earlier(a, b time.Time) time.Time {\n\tif a.IsZero() {\n\t\treturn b\n\t}\n\tif b.IsZero() {\n\t\treturn a\n\t}\n\tif a.Before(b) {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "00c29b39af5d58f197c6b5b191c9e326", "score": "0.4393182", "text": "func (mc *CacheDriver) SetPointer(key string, value interface{}, ttl time.Duration) error {\n\treturn mc.Set(key, value, ttl)\n}", "title": "" }, { "docid": "91207e5f61460be8a7680245941cdfb0", "score": "0.43921846", "text": "func (p *Period) Previous() {\n\tclone := *p\n\tduration := clone.GetDurationInterval()\n\tp.Start = clone.Start.Add(-1 * duration)\n\tp.End = clone.Start\n}", "title": "" }, { "docid": "b9e15c99c2c7f47f14f9b74ea0ca7e21", "score": "0.43859556", "text": "func (when *NTPLong) SetTime(t time.Time) {\n\tntpTime := t.Add(unixEpoch.Sub(ntpEpoch))\n\t// whole seconds\n\ts := ntpTime.Unix()\n\t// fractional nanoseconds\n\tns := ntpTime.UnixNano() - s*1e9\n\twhen.Seconds = uint32(s)\n\twhen.SetNanos(int(ns))\n}", "title": "" }, { "docid": "a26e0b7924ef708f24351b43c8e05f3c", "score": "0.43807545", "text": "func Prev(t time.Time, d time.Duration) time.Time {\n\tif d <= 0 {\n\t\treturn t\n\t}\n\tt2 := t.Truncate(d)\n\tif t2.Equal(t) {\n\t\tt2 = t2.Add(-d)\n\t}\n\treturn t2\n}", "title": "" }, { "docid": "e759dcbe68ffb151ab6ffb9cbe0f846d", "score": "0.43792307", "text": "func (self *Pointer) SetBackButtonA(member *DeviceButton) {\n self.Object.Set(\"backButton\", member)\n}", "title": "" }, { "docid": "519fa6d5a3d4c318c10a09608c1dec78", "score": "0.43789795", "text": "func (t *pointerUtils) TimePtr(val time.Time) *time.Time {\n\treturn &val\n}", "title": "" }, { "docid": "20e8110c4e9551bdadc439440246aa98", "score": "0.43731225", "text": "func (e *Entry) Tapped(ev *fyne.PointEvent) {\n\tif fyne.CurrentDevice().IsMobile() && e.selecting {\n\t\te.selecting = false\n\t}\n\te.updateMousePointer(ev, false)\n}", "title": "" }, { "docid": "7b9749741a89a27b15b012a2c0578acf", "score": "0.4369486", "text": "func (k Keeper) GetPreviousBlockTime(ctx sdk.Context) (blockTime time.Time, found bool) {\n\tstore := ctx.KVStore(k.storeKey)\n\tb := store.Get(types.PreviousBlockTimeKey)\n\tif b == nil {\n\t\treturn time.Time{}, false\n\t}\n\n\tvar timestamp gogotypes.Timestamp\n\tk.cdc.MustUnmarshalLengthPrefixed(b, &timestamp)\n\tblockTime, _ = gogotypes.TimestampFromProto(&timestamp)\n\treturn blockTime, true\n}", "title": "" }, { "docid": "02c1c2e83c361738989f614219c6002e", "score": "0.43571618", "text": "func (self *Pointer) SetDurationA(member int) {\n self.Object.Set(\"duration\", member)\n}", "title": "" }, { "docid": "b4f8edaa00e7047ce852254a6e94d179", "score": "0.43544507", "text": "func (o *PaginatedCommitstatuses) SetPrevious(v string) {\n\to.Previous = &v\n}", "title": "" }, { "docid": "d7f2b041299820de8edce1fa433f2963", "score": "0.43477136", "text": "func (m *MockRemediationManagerInterface) SetLastRemediationTime(remediationTime *v10.Time) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"SetLastRemediationTime\", remediationTime)\n}", "title": "" }, { "docid": "2c518124cbe1dc665984f9e8e7aa2be0", "score": "0.4345519", "text": "func (c *CachedBeatmap) SetLastRequested(t time.Time) {\n\tc.mtx.Lock()\n\tc.lastRequested = t\n\tc.mtx.Unlock()\n}", "title": "" }, { "docid": "c2bef0fc59f18431c1901380d8a2c02f", "score": "0.43391684", "text": "func (d *SQLite3Dictionary) SetCurrentTimestamp() string {\n\treturn `\n\t\tUPDATE migration_state SET ts = ? WHERE id = 0;\n\t`\n}", "title": "" }, { "docid": "dff049f3e46db802fc081bc959ba7e2e", "score": "0.4337678", "text": "func (m *AppointmentResultsMutation) ResetHourBeforeAppoint() {\n\tm.hourBeforeAppoint = nil\n\tm.addhourBeforeAppoint = nil\n}", "title": "" }, { "docid": "1d2b5c776f6b220c8d3a8bebd7c589b8", "score": "0.43355504", "text": "func Set(newClock Time) {\n\tclock = newClock\n}", "title": "" }, { "docid": "26f42a9f3670696bf638ea88f2f452b0", "score": "0.43062934", "text": "func (b *Base) SetTimeInfo(i amboy.JobTimeInfo) {\n\tb.mutex.Lock()\n\tdefer b.mutex.Unlock()\n\n\tb.timeInfo = i\n}", "title": "" }, { "docid": "11531ed905a10e42eff26accb13fdde6", "score": "0.42982233", "text": "func (o *TreeMapWidgetDefinition) SetTime(v WidgetTime) {\n\to.Time = &v\n}", "title": "" }, { "docid": "99f23a9620fb62ef96d5886ee2c6bc5c", "score": "0.42962053", "text": "func (c *Context) SetTraceStartTime() {\n\tt := time.Now()\n\tc.Set(ActionExecStartTime, t)\n\tc.Logger = c.Logger.With(log.Any(\"startTime\", t))\n}", "title": "" }, { "docid": "550a309d9435fb28cbe35f60a7dfd2d7", "score": "0.42957845", "text": "func (p *Player) Previous() error {\n\t// TODO: everything\n\treturn nil\n}", "title": "" }, { "docid": "a62d4a0602dd2c2876c333ba30dbb0c4", "score": "0.42877445", "text": "func ResetTime() { Default.ResetTime() }", "title": "" }, { "docid": "c011be7ab6b1116b2e7e5aa5a1a7a364", "score": "0.428693", "text": "func TimeBefore(t time.Time) *Filter {\n\treturn newTimeFilter(\n\t\t&TimeFilter{\n\t\t\tCondition: &TimeFilter_Before{\n\t\t\t\tBefore: timestamppb.New(t),\n\t\t\t},\n\t\t},\n\t)\n}", "title": "" }, { "docid": "2f3e9e22298da99e10c2973b36e81579", "score": "0.42849952", "text": "func (o OptionsAnswerCallbackQuery) SetCacheTime(cacheTime int) OptionsAnswerCallbackQuery {\n\to[\"cache_time\"] = cacheTime\n\treturn o\n}", "title": "" }, { "docid": "68a094c8e4603b3ea3c7e50d3c3ae221", "score": "0.4277726", "text": "func setRequestedRetransmissionTime(v time.Time) (a dia.RawAVP) {\n\ta = dia.RawAVP{Code: 3331, VenID: 10415, FlgV: true, FlgM: false, FlgP: false}\n\ta.Encode(v)\n\treturn\n}", "title": "" }, { "docid": "426967ea9b2ba2ee29cd1bb4c84db07f", "score": "0.42758697", "text": "func (c *Cursor) PreviousLine(n int) {\n\tc.Up(1)\n\tc.HorizontalAbsolute(0)\n}", "title": "" }, { "docid": "3985d445ff7ad1c702074d28ca692b22", "score": "0.42725885", "text": "func (m *TraceRouteHop) SetRoundTripTime(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration)() {\n err := m.GetBackingStore().Set(\"roundTripTime\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "e591d283819482b6006c55815baf61e2", "score": "0.42724404", "text": "func (m *BookingWorkTimeSlot) SetStartTime(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.TimeOnly)() {\n m.startTime = value\n}", "title": "" }, { "docid": "d02c547deea160108e6dda01405ef725", "score": "0.42600912", "text": "func (p *Party) Previous(uid UserUUID, sid SongUID) error {\n\tp.mux.Lock()\n\tdefer p.mux.Unlock()\n\n\t// TODO: check actual song\n\tif can, err := p.canUserPerformAction(uid, UserCanSkipPermission); err != nil {\n\t\treturn err\n\t} else if !can {\n\t\treturn fmt.Errorf(\"user doesn't have permission to skip\")\n\t}\n\n\t// get the most recent song\n\tprevSid, err := p.previous.Pop()\n\tif err != nil {\n\t\t// bad pop shouldn't change anything\n\t\treturn err\n\t}\n\n\t// check if something is currently playing\n\t// if it is, don't try to insert into the queue\n\tif p.nowPlaying.CurrentlyHasSong() {\n\t\t// get the current song\n\t\tcsid := p.nowPlaying.GetCurrentlyPlaying()\n\n\t\t// insert prev into the top of the play next queue\n\t\tif err = p.playNext.SetTop(csid); err != nil {\n\n\t\t\t// restore the previous queue\n\t\t\tp.previous.Push(prevSid)\n\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// set the currently playing\n\tp.nowPlaying.ChangeSong(prevSid)\n\tp.setUpdated()\n\n\treturn nil\n}", "title": "" }, { "docid": "0a9f429e3cab0dd0efe437135d32147c", "score": "0.425472", "text": "func (k cursorKind) storePrevCursor(c context.Context, pkg, cursor, prev string) {\n\titm := memcache.NewItem(c, k.cursorKey(pkg, cursor))\n\titm.SetValue([]byte(prev))\n\titm.SetExpiration(24 * time.Hour)\n\tif err := memcache.Set(c, itm); err != nil {\n\t\tlogging.WithError(err).Errorf(c, \"Failed to store prev cursor %q in memcache\", k)\n\t}\n}", "title": "" }, { "docid": "77a3496190d02e677fa656fb40f385c9", "score": "0.4253674", "text": "func (r *PreviousBlockHashRunner) setPrevBlockHash(hash string) {\n\tr.mx.Lock()\n\tdefer r.mx.Unlock()\n\tr.prevHashString = hash\n}", "title": "" }, { "docid": "79a835c0fe25b348e30769ecadade810", "score": "0.42516217", "text": "func (self *Pointer) SetTotalTouchesA(member int) {\n self.Object.Set(\"totalTouches\", member)\n}", "title": "" }, { "docid": "6e825c7f6257061ca628c45487de5f7b", "score": "0.4243198", "text": "func (m *IosCompliancePolicy) SetPasscodePreviousPasscodeBlockCount(value *int32)() {\n err := m.GetBackingStore().Set(\"passcodePreviousPasscodeBlockCount\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "31c906cd97294762b1f32271fdc86ebe", "score": "0.42375818", "text": "func (e *Event) TimeKey() string {\n\treturn \"events:time:\" + e.Camera\n}", "title": "" }, { "docid": "a7471e388d0decb33550bbff2407458f", "score": "0.4235151", "text": "func (m *AndroidWorkProfileGeneralDeviceConfiguration) SetPasswordPreviousPasswordBlockCount(value *int32)() {\n err := m.GetBackingStore().Set(\"passwordPreviousPasswordBlockCount\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c9124b92f2aa3d2848f0aad88483abcb", "score": "0.4229147", "text": "func (from *Note) ShiftTime(t float64) *Note {\n\tto := *from\n\tto.Position += t\n\treturn &to\n}", "title": "" }, { "docid": "ac3aa846598a1d3a7c33fb2eb5388767", "score": "0.42243895", "text": "func (t *TimerOperations) SetTime(s ktime.Setting) (ktime.Time, ktime.Setting) {\n\treturn t.timer.SwapAnd(s, func() { atomic.StoreUint64(&t.val, 0) })\n}", "title": "" }, { "docid": "14dad93dafd9c741db24bb575ab5897c", "score": "0.4215622", "text": "func (m *Operation) SetLastActionDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {\n err := m.GetBackingStore().Set(\"lastActionDateTime\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "eb6cedc6a65f9086c17989735a9e9228", "score": "0.4203041", "text": "func (m *AppointmentResultsMutation) OldTimeAppoint(ctx context.Context) (v time.Time, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldTimeAppoint is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldTimeAppoint requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldTimeAppoint: %w\", err)\n\t}\n\treturn oldValue.TimeAppoint, nil\n}", "title": "" }, { "docid": "a5aeed54f8e250172f48f4fd37e8cd9f", "score": "0.41947937", "text": "func (o ApplicationInsightsComponentDataVolumeCapResponseOutput) ResetTime() pulumi.IntOutput {\n\treturn o.ApplyT(func(v ApplicationInsightsComponentDataVolumeCapResponse) int { return v.ResetTime }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "e19deb5e1bec73f5ebd72f3ee91fddf2", "score": "0.41947654", "text": "func (l *enroller) SetPrevSpec(s types.Spec) {\n\treturn\n}", "title": "" }, { "docid": "ead3d55f6e4eab9540d830c17645225e", "score": "0.41913477", "text": "func (self *Pointer) MsSinceLastClick() int{\n return self.Object.Get(\"msSinceLastClick\").Int()\n}", "title": "" }, { "docid": "623fba829247fadde2b279d3cca26c7a", "score": "0.41893762", "text": "func (nc *NodeCreate) SetPrev(n *Node) *NodeCreate {\n\treturn nc.SetPrevID(n.ID)\n}", "title": "" }, { "docid": "1655601e087e1a7202eafa9b04467882", "score": "0.41834557", "text": "func Set(t time.Time) {\n\tl.Lock()\n\tinstall()\n\tcurrent = t\n\tl.Unlock()\n}", "title": "" }, { "docid": "14f82b49384c2e82e16b38fd0adaeec1", "score": "0.41818008", "text": "func (m *figure) SetPrevCoords(X, Y int) {\n\tm.PrevX = X\n\tm.PrevY = Y\n}", "title": "" } ]
82df8cf474740646eb50ed87f61603a2
List returns an error after repo.MaxListFiles files.
[ { "docid": "4651df7be80e02eec8ac549ba3ac7bae", "score": "0.78585076", "text": "func (repo *ErrorRepo) List(ctx context.Context, t restic.FileType, fn func(restic.ID, int64) error) error {\n\tif repo.MaxListFiles == 0 {\n\t\treturn errors.New(\"test error, max is zero\")\n\t}\n\n\tmax := repo.MaxListFiles\n\treturn repo.Repository.List(ctx, t, func(id restic.ID, size int64) error {\n\t\tif max == 0 {\n\t\t\treturn errors.New(\"test error, max reached zero\")\n\t\t}\n\n\t\tmax--\n\t\treturn fn(id, size)\n\t})\n}", "title": "" } ]
[ { "docid": "686a9f01339c606bf0c5c1fd739360b1", "score": "0.6939299", "text": "func (svc *service) FilesList(rq *contract.BaseRequest) ([]contract.FileInfo, error) {\n\n\terr := svc.validateBaseRQ(rq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = svc.setSettings(rq.User, rq.Repository, rq.Branch)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tw, err := svc.git.repo.Worktree()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tidx, err := w.Index()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres := []contract.FileInfo{}\n\tconf := make(map[string]struct{})\n\n\tvar c empty\n\n\tfor _, e := range idx.Entries {\n\t\tif e.Stage == index.Merged {\n\t\t\tres = append(res, contract.FileInfo{Path: e.Name})\n\t\t} else {\n\t\t\tconf[e.Name] = c\n\t\t}\n\t}\n\n\tfor p := range conf {\n\t\tres = append(res, contract.FileInfo{Path: p, IsConflict: true})\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "86cbd03a8179da18ee7d8a2e60e34837", "score": "0.66303325", "text": "func ListFiles(repo, version string) ([]string, error) {\n\n\turl, err := url.Parse(config.Config.ServerURL)\n\turl.Path = path.Join(url.Path, \"api\", \"repos\", repo, \"releases\", version)\n\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(\"GET\", url.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\n\tdata, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif res.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(string(data))\n\t}\n\n\tresponse := serverListFileResponse{}\n\terr = json.Unmarshal(data, &response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response.Files, nil\n}", "title": "" }, { "docid": "ce94e57459c768696544526fda2e2008", "score": "0.65523857", "text": "func TestListFiles(t *testing.T) {\n\tdefer testPanic(t) // handle panics and syntax errors\n\tsetTestInstance(t) // update test instance for logging\n\n\tt.Log(\"GOAL: you should be able to return a list of files starting at the top level directory\")\n\tvar index int\n\n\t// passing in empty string \"\" means list all files from the top level\n\tvar result = listFiles(fileData, \"\")\n\tif len(result) != 8 {\n\t\tt.Error(shouldBe(len(result), 8))\n\t}\n\n\tindex = testIndexOfStrings(result, \"index.html\")\n\tif index < 0 {\n\t\tt.Error(index, \"should be >= 0\")\n\t}\n\n\tindex = testIndexOfStrings(result, \"main.js\")\n\tif index < 0 {\n\t\tt.Error(index, \"should be >= 0\")\n\t}\n\n\tindex = testIndexOfStrings(result, \"notfound.js\")\n\tif index > 0 {\n\t\tt.Error(shouldBe(index, -1))\n\t}\n}", "title": "" }, { "docid": "298ef9d5b2ded19b5a85f2435b2f106e", "score": "0.65246147", "text": "func listFiles(configInfo *ConfigInfo) (err error) {\n\thttp.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}\n\tserverURL := \"https://\" + configInfo.tenantHostname + configInfo.serverEndpoint + uploadPath\n\tif configInfo.logLevel > 0 {\n\t\tfmt.Printf(\"Connecting to \" + configInfo.tenantHostname + configInfo.serverEndpoint + uploadPath + \"\\n\")\n\t}\n\tclient := &http.Client{}\n\trequest, err := http.NewRequest(\"GET\", serverURL, strings.NewReader(\"\"))\n\trequest.Header.Set(\"Authorization\", \"Bearer \"+configInfo.accessToken)\n\trequest.ContentLength = 0\n\tresp, err := client.Do(request)\n\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tcontents, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\tfmt.Fprintf(os.Stderr, \"Received response code %d from server\\n%s\\n\", resp.StatusCode, contents)\n\t\tos.Exit(1)\n\t}\n \n var fileListing FileListing\n if configInfo.logLevel > 1 {\n fmt.Printf(\"%s\\n\", string(contents))\n }\n\n err = json.Unmarshal(contents, &fileListing)\n if err != nil {\n fmt.Fprintf(os.Stderr, \"Error trying to unmarshal response: \\n%s \\n %s\", string(contents), err)\n return\n }\n\n fmt.Printf(\"Upload time Filename\\tActual\\tRequest\\tStatus\\tComment\\n\")\n for _, file := range fileListing {\n fmt.Printf(\"%s\\t%s\\t%d\\t%d\\t%s\\t%s\\n\", time.Unix(file.ModTime,0), file.Filename, file.FileSize, file.UploadSize, file.Status, file.Comment)\n }\n \n\treturn\n}", "title": "" }, { "docid": "2742c46474875ecccd9ca216d3f582db", "score": "0.64901", "text": "func listFiles(conn net.Conn, us *user.State) {\n\td := us.CurrentDir()\n\tfiles, err := ioutil.ReadDir(d)\n\tif err != nil {\n\t\tconn.Write([]byte(\"ER\"))\n\t\treturn\n\t}\n\tconn.Write([]byte(\"OK\"))\n\n\t// Get how many files/directories, convert to binary and send\n\tdir := make([]byte, 8)\n\tbinary.LittleEndian.PutUint64(dir, uint64(len(files)))\n\tconn.Write(dir)\n\n\t// Loop through files, get the length of the file name\n\t// convert it to binary and send it to the client\n\tflen := make([]byte, 8)\n\tfor _, fn := range files {\n\t\tconn.Write([]byte(\"OK\"))\n\n\t\tbinary.LittleEndian.PutUint64(flen, uint64(len(fn.Name())))\n\t\tconn.Write(flen)\n\t\tb := fillBuf([]byte(fn.Name()), BUFSIZE)\n\t\tconn.Write(b)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "f996d36c984aa6b7ae9b405f4d93b1e7", "score": "0.64836645", "text": "func (fs *FSConfig) ListFiles(args ...string) (fres *msg.Message) {\n\tvar buf strings.Builder\n\tf, err := os.Open(fs.currentDir)\n\tif err != nil {\n\t\treturn msg.New(msg.TYPE_ERROR, err.Error())\n\t}\n\tlist, err := f.Readdir(-1)\n\tf.Close()\n\tif err != nil {\n\t\treturn msg.New(msg.TYPE_ERROR, err.Error())\n\t}\n\tsort.Slice(list, func(i, j int) bool {\n\t\tif list[i].IsDir() && !list[j].IsDir() {\n\t\t\treturn true\n\t\t} else if !list[i].IsDir() && list[j].IsDir() {\n\t\t\treturn false\n\t\t}\n\t\treturn list[i].Name() < list[j].Name()\n\t})\n\tbuf.WriteString(fmt.Sprintf(\"\\n\\tDirectory: %s\\n\\n\", fs.currentDir))\n\tfor _, v := range list {\n\t\tfname := v.Name()\n\n\t\t// File filter\n\t\tif _, invisible := fs.invisibleFiles[fname]; invisible {\n\t\t\tcontinue\n\t\t}\n\t\tif v.IsDir() {\n\t\t\tfname = \".\" + fname\n\t\t}\n\t\tbuf.WriteString(fmt.Sprintf(\"%d/%d/%d\\t%s\\n\", v.ModTime().Month(), v.ModTime().Day(), v.ModTime().Year(), fname))\n\t}\n\treturn msg.New(msg.TYPE_RESPONSE, buf.String())\n}", "title": "" }, { "docid": "c24df2a299ac90e9dbabbc3774d52523", "score": "0.64530486", "text": "func ListFiles(c *gin.Context) {\n\tdataarr, err := listFiles()\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, Response{Error: err.Error()})\n\t} else {\n\t\tc.JSON(http.StatusOK, gin.H{\"files\": dataarr})\n\t}\n}", "title": "" }, { "docid": "7e59f10260f482e13093626035b8eb6b", "score": "0.64442205", "text": "func ListFiles(w http.ResponseWriter, r *http.Request) {\n\tfiles, err := ioutil.ReadDir(\".\")\n\tif err == nil {\n\t\tfor _, file := range files {\n\t\t\tfmt.Fprintf(w, \"<a href='%s'>%s</a><br/>\", file.Name(), file.Name())\n\t\t}\n\t} else {\n\t\tfmt.Fprintf(w, \"%s\", err.Error())\n\t}\n}", "title": "" }, { "docid": "98e55480d12961630bbf918ee225f9f0", "score": "0.6413989", "text": "func (xl XL) ListFiles(volume, prefix, marker string, recursive bool, count int) (filesInfo []FileInfo, eof bool, err error) {\n\tif !isValidVolname(volume) {\n\t\treturn nil, true, errInvalidArgument\n\t}\n\n\t// TODO: Fix: If readQuorum is met, its assumed that disks are in consistent file list.\n\t// exclude disks those are not in consistent file list and check count of remaining disks\n\t// are met readQuorum.\n\n\t// Treat empty file list specially\n\temptyCount := 0\n\terrCount := 0\n\tsuccessCount := 0\n\n\tvar firstFilesInfo []FileInfo\n\tvar firstEOF bool\n\tvar firstErr error\n\n\tfor _, disk := range xl.storageDisks {\n\t\tif filesInfo, eof, err = xl.listFiles(disk, volume, prefix, marker, recursive, count); err == nil {\n\t\t\t// we need to return first successful result\n\t\t\tif firstFilesInfo == nil {\n\t\t\t\tfirstFilesInfo = filesInfo\n\t\t\t\tfirstEOF = eof\n\t\t\t}\n\n\t\t\tif len(filesInfo) == 0 {\n\t\t\t\temptyCount++\n\t\t\t} else {\n\t\t\t\tsuccessCount++\n\t\t\t}\n\t\t} else {\n\t\t\tif firstErr == nil {\n\t\t\t\tfirstErr = err\n\t\t\t}\n\n\t\t\terrCount++\n\t\t}\n\t}\n\n\tif errCount >= xl.readQuorum {\n\t\treturn nil, false, firstErr\n\t} else if successCount >= xl.readQuorum {\n\t\treturn firstFilesInfo, firstEOF, nil\n\t} else if emptyCount >= xl.readQuorum {\n\t\treturn []FileInfo{}, true, nil\n\t}\n\n\treturn nil, false, errReadQuorum\n}", "title": "" }, { "docid": "ebb66fbe4496d4b8225cc0706a5f92a4", "score": "0.6385888", "text": "func (f *Fs) List(out fs.ListOpts, dir string) {\n\tdefer out.Finished()\n\n\tlistItem := func(remote string, object *yandex.ResourceInfoResponse, isDirectory bool) error {\n\t\tif isDirectory {\n\t\t\tt, err := time.Parse(time.RFC3339Nano, object.Modified)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdir := &fs.Dir{\n\t\t\t\tName: remote,\n\t\t\t\tWhen: t,\n\t\t\t\tBytes: int64(object.Size),\n\t\t\t\tCount: -1,\n\t\t\t}\n\t\t\tif out.AddDir(dir) {\n\t\t\t\treturn fs.ErrorListAborted\n\t\t\t}\n\t\t} else {\n\t\t\to, err := f.newObjectWithInfo(remote, object)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif out.Add(o) {\n\t\t\t\treturn fs.ErrorListAborted\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\tvar err error\n\tswitch out.Level() {\n\tcase 1:\n\t\tif dir == \"\" {\n\t\t\terr = f.listDir(listItem)\n\t\t} else {\n\t\t\terr = f.list(dir, listItem)\n\t\t}\n\tcase fs.MaxLevel:\n\t\terr = f.list(dir, listItem)\n\tdefault:\n\t\tout.SetError(fs.ErrorLevelNotSupported)\n\t}\n\n\tif err != nil {\n\t\t// FIXME\n\t\t// if err == swift.ContainerNotFound {\n\t\t// \terr = fs.ErrorDirNotFound\n\t\t// }\n\t\tout.SetError(err)\n\t}\n}", "title": "" }, { "docid": "c53036c7aa7b766287b14651ef553505", "score": "0.63706404", "text": "func (a Agent) FileList(sid int, cid int, cpw string, path string) ([]File, error) {\n\t// test if path is file. If true, return file\n\tf, err := a.FileInfo(sid, cid, cpw, path)\n\tif err == nil {\n\t\tf[0].IsFile = true // against contrary belief (docs) ftgetfileinfo **does not** return the type **and can not** be used on directories (returns error 1538 invalid parameter) *sighn*\n\t\treturn f, nil\n\t}\n\tfiles := []File{}\n\terr = a.Query.Do(\n\t\tlibts.Request{\n\t\t\tServerID: sid,\n\t\t\tCommand: \"ftgetfilelist\",\n\t\t\tArgs: map[string]interface{}{\n\t\t\t\t\"cid\": cid,\n\t\t\t\t\"cpw\": cpw,\n\t\t\t\t\"path\": path,\n\t\t\t},\n\t\t}, &files)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn files, err\n}", "title": "" }, { "docid": "92a43f1c7dde70db735fe0aa363f743b", "score": "0.6369159", "text": "func (l *Library) List(path string) ([]File, error) {\n\tvar flist []File\n\turls := \"/repos/\" + l.Id + \"/dir/\"\n\tif path != \"\" {\n\t\turls = urls + \"?p=\" + url.QueryEscape(path)\n\t}\n\tif err := l.sf.req(\"GET\", urls, nil, &flist); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor i, _ := range flist {\n\t\t\tflist[i].lib = l\n\t\t}\n\t\treturn flist, nil\n\t}\n}", "title": "" }, { "docid": "7c397f472420d4d4b768533f1bd0d2d6", "score": "0.634322", "text": "func (s *Drive) ListFiles() ([][]byte, error) {\n\treturn nil, errors.New(\"fail.Drive does what it says on the tin\")\n}", "title": "" }, { "docid": "2c58a2bfb86205f9d51217b7f7786964", "score": "0.63011247", "text": "func (f *Fs) list(ctx context.Context, bucket, directory, prefix string, addBucket bool, recurse bool, limit int, hidden bool, findFile bool, fn listFn) error {\n\tif !findFile {\n\t\tif prefix != \"\" {\n\t\t\tprefix += \"/\"\n\t\t}\n\t\tif directory != \"\" {\n\t\t\tdirectory += \"/\"\n\t\t}\n\t}\n\tdelimiter := \"\"\n\tif !recurse {\n\t\tdelimiter = \"/\"\n\t}\n\tbucketID, err := f.getBucketID(ctx, bucket)\n\tif err != nil {\n\t\treturn err\n\t}\n\tchunkSize := 1000\n\tif limit > 0 {\n\t\tchunkSize = limit\n\t}\n\tvar request = api.ListFileNamesRequest{\n\t\tBucketID: bucketID,\n\t\tMaxFileCount: chunkSize,\n\t\tPrefix: f.opt.Enc.FromStandardPath(directory),\n\t\tDelimiter: delimiter,\n\t}\n\tif directory != \"\" {\n\t\trequest.StartFileName = f.opt.Enc.FromStandardPath(directory)\n\t}\n\topts := rest.Opts{\n\t\tMethod: \"POST\",\n\t\tPath: \"/b2_list_file_names\",\n\t}\n\tif hidden || f.opt.VersionAt.IsSet() {\n\t\topts.Path = \"/b2_list_file_versions\"\n\t}\n\n\tlastFileName := \"\"\n\n\tfor {\n\t\tvar response api.ListFileNamesResponse\n\t\terr := f.pacer.Call(func() (bool, error) {\n\t\t\tresp, err := f.srv.CallJSON(ctx, &opts, &request, &response)\n\t\t\treturn f.shouldRetry(ctx, resp, err)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor i := range response.Files {\n\t\t\tfile := &response.Files[i]\n\t\t\tfile.Name = f.opt.Enc.ToStandardPath(file.Name)\n\t\t\t// Finish if file name no longer has prefix\n\t\t\tif prefix != \"\" && !strings.HasPrefix(file.Name, prefix) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif !strings.HasPrefix(file.Name, prefix) {\n\t\t\t\tfs.Debugf(f, \"Odd name received %q\", file.Name)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tremote := file.Name[len(prefix):]\n\t\t\t// Check for directory\n\t\t\tisDirectory := remote == \"\" || strings.HasSuffix(remote, \"/\")\n\t\t\tif isDirectory && len(remote) > 1 {\n\t\t\t\tremote = remote[:len(remote)-1]\n\t\t\t}\n\t\t\tif addBucket {\n\t\t\t\tremote = path.Join(bucket, remote)\n\t\t\t}\n\n\t\t\tif f.opt.VersionAt.IsSet() {\n\t\t\t\tif time.Time(file.UploadTimestamp).After(time.Time(f.opt.VersionAt)) {\n\t\t\t\t\t// Ignore versions that were created after the specified time\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif file.Name == lastFileName {\n\t\t\t\t\t// Ignore versions before the already returned version\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Send object\n\t\t\tlastFileName = file.Name\n\t\t\terr = fn(remote, file, isDirectory)\n\t\t\tif err != nil {\n\t\t\t\tif err == errEndList {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\t// end if no NextFileName\n\t\tif response.NextFileName == nil {\n\t\t\tbreak\n\t\t}\n\t\trequest.StartFileName = *response.NextFileName\n\t\tif response.NextFileID != nil {\n\t\t\trequest.StartFileID = *response.NextFileID\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "432c9795a156e4b81a43884c6935e272", "score": "0.62801194", "text": "func (release Release) ListFiles() []string {\n\treturn release.repo.ListDirRecursive(path.Join(release.Path(), \"files\"))\n}", "title": "" }, { "docid": "cfba4d22bfda23022a1425d2d0a94702", "score": "0.622928", "text": "func (fs *FileService) List() ([]*models.File, error) {\n\tclient, err := db.Client()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcollection := client.Database(\"challenge\").Collection(\"files\")\n\n\tfindOptions := options.Find()\n\n\tvar results []*models.File\n\n\tcur, err := collection.Find(context.TODO(), bson.D{{}}, findOptions)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor cur.Next(context.TODO()) {\n\n\t\tvar file models.File\n\t\terr := cur.Decode(&file)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tresults = append(results, &file)\n\t}\n\n\tif err := cur.Err(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tcur.Close(context.TODO())\n\treturn results, nil\n}", "title": "" }, { "docid": "800db658e55e9d221e522a61bf7060e2", "score": "0.6218543", "text": "func ListFile(w http.ResponseWriter, r *http.Request) {\n\t//fmt.Println(dir)\n\tfiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tvar listF lsFile\n\tfor _, file := range files {\n\t\tfmt.Println(file.Name())\n\t\tlistF.File = append(listF.File, file.Name())\n\t}\n\tjson.NewEncoder(w).Encode(listF)\n}", "title": "" }, { "docid": "49f119060c1aba8309695285e9f4b41a", "score": "0.6197569", "text": "func (s *SlackAPI) FilesList(data FileListArgs) ResponseFilesList {\n\tif data.Count == 0 {\n\t\tdata.Count = 100\n\t}\n\n\tvar response ResponseFilesList\n\ts.getRequest(&response, \"files.list\", data)\n\treturn response\n}", "title": "" }, { "docid": "fa68bc041db1acd9febc816a5ffc81dc", "score": "0.6196643", "text": "func listHandler(w http.ResponseWriter, r *http.Request) {\r\n\td, err := ioutil.ReadDir(\".\")\r\n\tif err != nil {\r\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t\treturn\r\n\t}\r\n\t//files := make([]string, 0)\r\n\tfiles := []string{}\r\n\tfor _, f := range d {\r\n\t\tif !f.IsDir() && strings.HasSuffix(f.Name(), \".txt\") {\r\n\t\t\tfiles = append(files, strings.TrimSuffix(f.Name(), \".txt\"))\r\n\t\t}\r\n\t}\r\n\terr = templates.ExecuteTemplate(w, \"list.html\", files)\r\n\tif err != nil {\r\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t\treturn\r\n\t}\r\n}", "title": "" }, { "docid": "f1a5cde4f4594d1feed98466b8fe004a", "score": "0.61889446", "text": "func (s *Drive) ListFiles() ([][]byte, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "2edd172122fa7796ea33bb17eba29204", "score": "0.61521584", "text": "func (ko *Operation) List(path string) ([]string, error) {\n\tcmd := exec.Command(ko.KeybaseBinaryPath, \"fs\", \"ls\", \"-1\", \"--nocolor\", path)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list files in /keybase/team/: %s (%v)\", strings.TrimSpace(string(output)), err)\n\t}\n\tvar ret []string\n\tfor _, s := range strings.Split(string(output), \"\\n\") {\n\t\tif s != \"\" {\n\t\t\tret = append(ret, s)\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "991d41e6a73fde28fd267401c279a78c", "score": "0.61451805", "text": "func (d *driver) List(ctx context.Context, subPath string) ([]string, error) {\n\tfmt.Println(\"Begin to call List\")\n\tfullPath := d.getFullPath(subPath)\n\tdir, err := os.Open(fullPath)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil, storagedriver.PathNotFoundError{Path: subPath}\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tdefer dir.Close()\n\n\tfileNames, err := dir.Readdirnames(0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkeys := make([]string, 0, len(fileNames))\n\tfor _, fileName := range fileNames {\n\t\tkeys = append(keys, path.Join(subPath, fileName))\n\t}\n\tfmt.Println(\"List called finished\")\n\treturn keys, nil\n}", "title": "" }, { "docid": "96bda2feade4241f6f731ce78259fd29", "score": "0.60768694", "text": "func ListFilesHandler(c *gin.Context) {\n\n\tpq := db.GetDB()\n\tquery := \"SELECT id, file_name, file_label FROM files ORDER BY created_at DESC;\"\n\trows, err := pq.Db.Query(query)\n\tdefer rows.Close()\n\tif err != nil {\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": \"Ocurrio un error al buscar los archivos\"})\n\t\tlog.Print(\"There was an error saving the file: %s\", err.Error())\n\t\treturn\n\t}\n\tfiles := make([]File, 0)\n\tfor rows.Next() {\n\t\tvar file File\n\t\tif err := rows.Scan(&file.ID, &file.Filename, &file.FileLabel); err != nil {\n\t\t\tlog.Print(\"ERROR SCAN FILES\", err)\n\t\t}\n\t\tfiles = append(files, file)\n\t}\n\tif err != nil {\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": \"Ocurrio un error, los archivos no se pudieron leer correctamente\"})\n\t\tlog.Println(\"The files were not read correctly\")\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, files)\n\treturn\n}", "title": "" }, { "docid": "ca3d29d6e5c84b4a63fb53c1b23c4dd3", "score": "0.60641855", "text": "func GetFileList(c *gin.Context) {\n\tusername := c.Param(\"login\")\n\turlpath := c.Param(\"path\")\n\tif len(urlpath) == 0 {\n\t\turlpath += \"/\"\n\t}\n\turlpathtousername := \"upload/\" + username\n\n\tstoragepath := GetPathWhereToStoreByUsername(username)\n\tfullfspath := storagepath + urlpath\n\t// if strings.Contains(fullfspath, `..`) {\n\t// \tc.JSON(http.StatusBadRequest, gin.H{\"error\": \"bad file path in URL.\"})\n\t// \treturn\n\t// }\n\n\tvar listFilter liteimp.RequestForFileList\n\terr := c.ShouldBindQuery(&listFilter)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": \"expecting '?filter=*' URL parameter\"})\n\t\treturn\n\t}\n\tisnamefilter := false\n\tvar reg *regexp.Regexp\n\tif listFilter.Filter != \"\" {\n\t\treg, err = regexp.Compile(listFilter.Filter)\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": \"'filter' URL parameter regexp is bad\"})\n\t\t\treturn\n\n\t\t}\n\t\tisnamefilter = true\n\n\t}\n\tstat, err := os.Stat(fullfspath)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tc.JSON(http.StatusOK, gin.H{\"error\": \"no files yet\"})\n\t\t} else {\n\t\t\tlog.Printf(\"For user %s, error while reading his directory: %s\\r\\n\", username, err)\n\t\t\tc.JSON(http.StatusForbidden, gin.H{\"error\": \"Unexpected directory structure\"})\n\t\t}\n\t\treturn\n\n\t}\n\tif !stat.IsDir() {\n\t\tlog.Printf(\"For user %s, error while reading his directory: not a directory: %s\\r\\n\", username, fullfspath)\n\t\tc.JSON(http.StatusForbidden, gin.H{\"error\": \"Unexpected directory structure\"})\n\t\treturn\n\t}\n\n\tnameslist := fillnameslist(fullfspath, isnamefilter, reg)\n\ttmpl, err := template.ParseFiles(filepath.Join(ConfigThisService.RunningFromDir, \"htmltemplates/filelist.html\"))\n\tif err != nil {\n\t\tlog.Printf(\"%s\\r\\n\", err)\n\t\tc.JSON(http.StatusOK, gin.H{\"error\": fmt.Errorf(\"can't parse html template ./htmltemplates/filelist.html : %s\", err)})\n\n\t\treturn\n\t}\n\ttype topage struct {\n\t\tPath string\n\t\tFiles []smallinf\n\t\tParent string\n\t}\n\tparent := path.Dir(urlpath)\n\tvtopage := topage{\n\t\tPath: urlpathtousername + urlpath,\n\t\tFiles: nameslist,\n\t\tParent: urlpathtousername + parent,\n\t}\n\terr = tmpl.Execute(c.Writer, vtopage)\n\tif err != nil {\n\t\tlog.Printf(\"%s\\r\\n\", err)\n\t\tc.JSON(http.StatusOK, gin.H{\"error\": fmt.Errorf(\"html template failed to execute. : %s\", err)})\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "b1f77c87c5c4c3359c92adbece22c22c", "score": "0.6063389", "text": "func mustListFiles(t *testing.T, dir string) []string {\n\tfiles := make([]string, 0)\n\n\tif err := filepath.Walk(dir, func(relname string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tif filepath.Ext(relname) == \".proto\" {\n\t\t\treturn nil\n\t\t}\n\t\tfiles = append(files, relname)\n\t\treturn nil\n\t}); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\treturn files\n}", "title": "" }, { "docid": "de84729b3a11b5c416d6e433ec82c01b", "score": "0.60611326", "text": "func ListFiles() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tfileService := services.NewFileService()\n\t\tfiles, _ := fileService.List()\n\n\t\tvar resp []models.FileResponse\n\t\tfor _, file := range files {\n\t\t\tvar fileResp models.FileResponse\n\t\t\tfileResp.ID = file.ID.Hex()\n\t\t\tfileResp.Name = file.Name\n\t\t\tfileResp.CreatedAt = file.CreatedAt\n\n\t\t\tfileResp.URL = fileResp.BuildURL(r, fileResp.ID)\n\t\t\tresp = append(resp, fileResp)\n\t\t}\n\n\t\tbyteResp, _ := json.Marshal(resp)\n\t\tw.Header().Set(\"content-type\", \"application/json\")\n\t\tw.Write(byteResp)\n\t}\n}", "title": "" }, { "docid": "99999f25989b0e8e7e4db8eaee2fbb4b", "score": "0.60598344", "text": "func getFilelist(fpath string) ([]string, error) {\n\tpaths := make([]string, 0)\n\terr := filepath.Walk(fpath, func(path string, f os.FileInfo, err error) error {\n\t\tif f == nil {\n\t\t\treturn err\n\t\t}\n\t\tif f.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tpaths = append(paths, path)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\treturn paths, err\n}", "title": "" }, { "docid": "991b38c76f471ab2af158051f84bd576", "score": "0.6053543", "text": "func (driver *Driver) ListFiles(cc server.ClientContext, path string) ([]os.FileInfo, error) {\n\treturn ioutil.ReadDir(filepath.Join(driver.baseDir, path))\n}", "title": "" }, { "docid": "a58ce4de6c8def8e586cc9cb0c8bf664", "score": "0.6052932", "text": "func (s *fileStorage) List() (<-chan storage.Entry, <-chan error) {\n\tresult := make(chan storage.Entry)\n\terrorChannel := make(chan error)\n\ts.wg.Add(1)\n\tgo func() {\n\t\tdefer s.wg.Done()\n\t\tif err := filepath.Walk(s.directory, func(path string, info os.FileInfo, err error) error {\n\t\t\tif !info.IsDir() && info.Size() > 0 && !strings.Contains(info.Name(), \".\") {\n\t\t\t\tresult <- storage.Entry{\n\t\t\t\t\tName: info.Name(),\n\t\t\t\t\tMetadata: map[string]string{},\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn err\n\t\t}); err != nil {\n\t\t\terrorChannel <- err\n\t\t}\n\t\tclose(result)\n\t\tclose(errorChannel)\n\t}()\n\treturn result, errorChannel\n}", "title": "" }, { "docid": "a7041a0ea0cf0114adbdb49d13093fb0", "score": "0.6048031", "text": "func (d *doozerFileSystem) List(u *url.URL) (ret []string, err error) {\n\tvar rev int64\n\n\trev, err = d.conn.Rev()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tret, err = d.conn.Getdir(u.Path, rev, 0, -1)\n\treturn\n}", "title": "" }, { "docid": "b4420b076a9eaa013d865ac7153909f1", "score": "0.6043573", "text": "func (b *Bucket) List(pathElements ...interface{}) ([]string, error) {\n\tlistURL := b.ExpandListURL(pathElements...)\n\tres, err := getResponseWithRetry(listURL.String())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to GET %v: %v\", listURL, err)\n\t}\n\tif res.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"Got a non-success response %v while listing %v\", res.StatusCode, listURL.String())\n\t}\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to read the response for %v: %v\", listURL.String(), err)\n\t}\n\tvar data map[string]interface{}\n\terr = json.Unmarshal(body, &data)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to unmarshal %v: %v\", string(body), err)\n\t}\n\tvar ret []string\n\tif _, ok := data[\"items\"]; !ok {\n\t\tglog.Warningf(\"No matching files were found (from: %v)\", listURL.String())\n\t\treturn ret, nil\n\t}\n\tfor _, item := range data[\"items\"].([]interface{}) {\n\t\tret = append(ret, (item.(map[string]interface{})[\"name\"]).(string))\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "ddfb3c546d2e3c20efdb39bc30925151", "score": "0.60372746", "text": "func (sftp Context) List(opt TransferOptions) ([]string, error) {\n\n\tscript := make([]string, 0)\n\n\tif opt.RemoteDirectory != \"\" {\n\t\tscript = append(script, \"cd \"+opt.RemoteDirectory)\n\t}\n\n\tscript = append(script, \"ls -1 \"+opt.FilePattern)\n\tscript = append(script, \"exit\")\n\n\treturn sftp.runScript(script)\n}", "title": "" }, { "docid": "c535a31fdf2034bbccac30e04f7f834a", "score": "0.60348797", "text": "func (m *MockGitserverClient) ListFiles(v0 context.Context, v1 int, v2 string, v3 *regexp.Regexp) ([]string, error) {\n\tr0, r1 := m.ListFilesFunc.nextHook()(v0, v1, v2, v3)\n\tm.ListFilesFunc.appendCall(GitserverClientListFilesFuncCall{v0, v1, v2, v3, r0, r1})\n\treturn r0, r1\n}", "title": "" }, { "docid": "6b72a9bc8b20b255fbed59710fefd5fe", "score": "0.6032611", "text": "func (g *Gitiles) ListFiles(ctx context.Context, ref, path string) ([]string, error) {\n\tres, err := g.client.ListFiles(ctx, &gpb.ListFilesRequest{\n\t\tProject: g.project,\n\t\tCommittish: ref,\n\t\tPath: path,\n\t})\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\tfiles := res.GetFiles()\n\tpaths := make([]string, len(files))\n\tfor i, f := range files {\n\t\tpaths[i] = f.GetPath()\n\t}\n\treturn paths, nil\n}", "title": "" }, { "docid": "8c690ef131da5e922a24c5dc8d66563a", "score": "0.6024524", "text": "func listUploadedFiles(w http.ResponseWriter, r *http.Request) {\n\tlog.Info(\"Hit file listing router...\")\n\tdefer panicHandler(w)()\n\n\tfiles, err := ioutil.ReadDir(UgcDir)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to list dir:%v\", err)\n\t\tfmt.Fprintln(w, \"Failed to list uploaded files.\")\n\t}\n\n\ttype Files struct {\n\t\tObjs []FileObj `json:\"objs\"`\n\t}\n\n\tfileList := make([]FileObj, 0)\n\tfor _, f := range files {\n\t\tfileList = append(fileList, FileObj{\n\t\t\tName: strings.Split(f.Name(), \"-\")[2],\n\t\t\tModTime: f.ModTime(),\n\t\t\tSize: f.Size(),\n\t\t\tRealName: f.Name(),\n\t\t})\n\t}\n\n\ttmpl, err := template.ParseFiles(\"./static/index.html\")\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to parse HTML file:%v\", err)\n\t\tfmt.Fprintln(w, \"Failed to list uploaded files.\")\n\t}\n\n\ttmpl.Execute(w, Files{Objs: fileList})\n}", "title": "" }, { "docid": "51d9895061061e73b9d20aa2c3b00d73", "score": "0.6013057", "text": "func (f *Fs) List(ctx context.Context, relative string) (entries fs.DirEntries, err error) {\n\tfs.Debugf(f, \"ls ./%s\", relative)\n\n\tbucketName, bucketPath := f.absolute(relative)\n\n\tdefer func() {\n\t\tif errors.Is(err, uplink.ErrBucketNotFound) {\n\t\t\terr = fs.ErrorDirNotFound\n\t\t}\n\t}()\n\n\tif bucketName == \"\" {\n\t\tif bucketPath != \"\" {\n\t\t\treturn nil, fs.ErrorListBucketRequired\n\t\t}\n\n\t\treturn f.listBuckets(ctx)\n\t}\n\n\treturn f.listObjects(ctx, relative, bucketName, bucketPath)\n}", "title": "" }, { "docid": "78151d7dfe401fd15c407daf19387cfd", "score": "0.5965629", "text": "func (f *Fs) List(out fs.ListOpts, dir string) {\n\tdefer out.Finished()\n\n\t// List the objects and directories\n\tlistInnerRecurse(f, &out, dir, 1, func(remote string, blob *storage.Blob, isDirectory bool) error {\n\t\tif isDirectory {\n\n\t\t\tdir := &fs.Dir{\n\t\t\t\tName: remote,\n\t\t\t\tBytes: int64(0),\n\t\t\t\tCount: 0,\n\t\t\t}\n\t\t\tif out.AddDir(dir) {\n\t\t\t\treturn fs.ErrorListAborted\n\t\t\t}\n\t\t} else {\n\t\t\to, err := f.newObjectWithInfo(remote, blob)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif out.Add(o) {\n\t\t\t\treturn fs.ErrorListAborted\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\treturn\n}", "title": "" }, { "docid": "1254661062b6861128896b37635aa908", "score": "0.59642047", "text": "func (f FileManager) List(dir string) ([]string, error) {\n\tfileInfos, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar dirs []string\n\tfor _, f := range fileInfos {\n\t\tn := f.Name()\n\t\tif !f.IsDir() {\n\t\t\tdirs = append(dirs, n)\n\t\t}\n\t}\n\n\treturn dirs, nil\n}", "title": "" }, { "docid": "6149368fb6e3e45005040ba1a6be48bd", "score": "0.5964019", "text": "func (g *Git) ListFiles(id string) (files []*GitFile, e error) {\n\tg.mutex.Lock()\n\tdefer g.mutex.Unlock()\n\n\t// git --no-pager ls-tree --long -r master\n\tout, err := g.Env.ExecLines(\"git\", \"--no-pager\", \"ls-tree\", \"--long\", \"-r\", id)\n\n\t//e.g. <mode> SP <type> SP <object> SP <object size> TAB <file>\n\tres := make([]*GitFile, 0)\n\tstopChars := []rune{' ', '\\t'}\n\tfor _, line := range out {\n\n\t\ttokens := make([]string, 0)\n\n\t\ttext, off := scanUntil(line, 0, stopChars)\n\t\ttokens = append(tokens, text)\n\n\t\ttext, off = scanUntil(line, off, stopChars)\n\t\ttokens = append(tokens, text)\n\n\t\ttext, off = scanUntil(line, off, stopChars)\n\t\ttokens = append(tokens, text)\n\n\t\ttext, off = scanUntil(line, off, stopChars)\n\t\ttokens = append(tokens, text)\n\n\t\ttext, off = scanUntil(line, off, []rune{})\n\t\ttokens = append(tokens, text)\n\n\t\tif len(tokens) != 5 {\n\t\t\treturn nil, fmt.Errorf(\"unsupported line format: \" + line)\n\t\t}\n\n\t\tmode, e := strconv.ParseInt(tokens[0], 10, 32)\n\t\tif e != nil {\n\t\t\treturn nil, e\n\t\t}\n\n\t\tsize, e := strconv.ParseInt(tokens[3], 10, 64)\n\t\tif e != nil {\n\t\t\treturn nil, e\n\t\t}\n\n\t\tres = append(res, &GitFile{Mode: int(mode), Type: tokens[1], Object: tokens[2], Size: size, Name: strings.TrimSpace(tokens[4])})\n\n\t}\n\treturn res, err\n}", "title": "" }, { "docid": "4de6bc93229d2f9be8cc97b87b36a327", "score": "0.5952259", "text": "func GetFileMetaList(limit int) ([]TableFile, error) {\n\tstmt, err := mydb.DBConn().Prepare(\n\t\t\"select file_sha1, file_addr, file_name, file_size from tbl_file \" +\n\t\t\t\"where status = 1 limit ?\",\n\t)\n\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil, err\n\t}\n\tdefer stmt.Close()\n\n\trows, err := stmt.Query(limit)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil, err\n\t}\n\n\tcolumns, _ := rows.Columns()\n\tvalues := make([]sql.RawBytes, len(columns))\n\tvar tfiles []TableFile\n\tfor i := 0; i < len(values) && rows.Next(); i++ {\n\t\ttfile := TableFile{}\n\t\terr = rows.Scan(&tfile.FileHash, &tfile.FileAddr,\n\t\t\t&tfile.FileName, &tfile.FileSize)\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t\tbreak\n\t\t}\n\t\ttfiles = append(tfiles, tfile)\n\t}\n\tfmt.Println(len(tfiles))\n\treturn tfiles, nil\n}", "title": "" }, { "docid": "6106324f89345c8e1a193aa97829882a", "score": "0.5942473", "text": "func list(c *cli.Context) error {\n\tname := \"lst.tmp\"\n\tif err := commands.ExecAndWrite(name); err != nil {\n\t\treturn fmt.Errorf(\"unable to execute command: %v\", err)\n\t}\n\n\tdata, err := files.Read(name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to read from %s: %v\", name, err)\n\t}\n\tfor _, d := range data.Records {\n\t\tfmt.Println(\"DATA: \", d)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6569219c680d1347d593bd112d870a71", "score": "0.5939625", "text": "func (f *defaultService) ListFiles(relativePath string) ([]string, error) {\n\trelativePath = filepath.Clean(relativePath)\n\tinfos, err := f.runtime.ReadDir(relativePath)\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), \"no such file or directory\") {\n\t\t\treturn nil, &NoSuchFolderError{Path: relativePath}\n\t\t}\n\t\treturn nil, fmt.Errorf(\"error reading folder to list files: %w\", err)\n\t}\n\tvar files []string\n\tfor _, info := range infos {\n\t\tif info.Mode().IsRegular() {\n\t\t\tfiles = append(files, info.Name())\n\t\t}\n\t}\n\tsort.Slice(files, func(i, j int) bool {\n\t\treturn files[i] < files[j]\n\t})\n\treturn files, nil\n}", "title": "" }, { "docid": "25fd029e7e4ec883bc4468b516d60e9c", "score": "0.5939252", "text": "func (i *Info) FileList() []File {\n\tvar (\n\t\tbegin int64\n\t\toffset int\n\t)\n\tfiles := make([]File, len(i.Files))\n\tfor j, f := range i.Files {\n\t\tfiles[j] = File{f.Path, f.Length, begin, offset}\n\t\toffset = int(f.Length % int64(i.PieceLength))\n\t\tbegin += f.Length / int64(i.PieceLength)\n\t\tif offset != 0 {\n\t\t\tbegin++\n\t\t}\n\t}\n\treturn files\n}", "title": "" }, { "docid": "ae86f05d822bf78204a26574d3e65b99", "score": "0.59307325", "text": "func (d *driver) List(ctx context.Context, subPath string) ([]string, error) {\n\tfullPath := d.fullPath(subPath)\n\n\tdir, err := os.Open(fullPath)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil, storagedriver.PathNotFoundError{Path: subPath}\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tdefer dir.Close()\n\n\tfileNames, err := dir.Readdirnames(0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkeys := make([]string, 0, len(fileNames))\n\tfor _, fileName := range fileNames {\n\t\tkeys = append(keys, path.Join(subPath, fileName))\n\t}\n\n\t// Ensure consistent sorting across platforms.\n\tsort.Strings(keys)\n\n\treturn keys, nil\n}", "title": "" }, { "docid": "bbd60ea5d9849de4e844d8d046dd52c6", "score": "0.5922987", "text": "func (m *Magic) List(file string) error {\n\tif m.ptr == nil {\n\t\treturn ConnectionError\n\t}\n\n\tcf := C.CString(file)\n\tdefer C.free(unsafe.Pointer(cf))\n\n\tC.magic_list(m.ptr, cf)\n\treturn m.check()\n}", "title": "" }, { "docid": "0520479bc973db7a843651fa0f8296ef", "score": "0.59228694", "text": "func (peer *Peer) ListFiles() ([]RemoteFile, error) {\n\tr := []RemoteFile{}\n\taddress := \"http://\" + peer.entry.AddrIPv4[0].String() + \":\" + strconv.Itoa(peer.entry.Port)\n\t_, body, errs := gorequest.New().Get(address + \"/api/files\").End()\n\tif len(errs) > 0 {\n\t\treturn []RemoteFile{}, errs[0]\n\t}\n\n\terr := json.Unmarshal([]byte(body), &r)\n\tif err != nil {\n\t\treturn []RemoteFile{}, err\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "2881e181b087796fa475400a43026745", "score": "0.5921968", "text": "func (fs *memFS) List() []string {\n\tvar (\n\t\tout = make([]string, len(fs.files))\n\t\ti = 0\n\t)\n\tfor p := range fs.files {\n\t\tout[i] = p\n\t\ti++\n\t}\n\treturn out\n}", "title": "" }, { "docid": "ae0b53610e911f6d2ae3022778545480", "score": "0.5917806", "text": "func (fs *FileStore) List() (names []string) {\n\n\tif fs.Names != nil {\n\t\treturn fs.Names\n\t}\n\n\tfiles, err := ioutil.ReadDir(fs.Basepath)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, file := range files {\n\t\tfs.Names = append(fs.Names, file.Name())\n\t}\n\treturn fs.Names\n}", "title": "" }, { "docid": "63a4e4978a7f5cf8314909f580ffa967", "score": "0.5915777", "text": "func listFiles() ([]string, error) {\n\tstrarr := make([]string, 0)\n\terr := filepath.Walk(\"filestore/\", func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tstrarr = append(strarr, path)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn strarr, nil\n}", "title": "" }, { "docid": "297c9522c4b03ad7b26e73c781f18319", "score": "0.5887923", "text": "func (b *BaseInfo) getList(ptoken, q, fields string) (*drive.FileList, error) {\n\tvar err error\n\tvar r *drive.FileList\n\tf := []googleapi.Field{\"nextPageToken\", googleapi.Field(fields)}\n\tfilesListCall := b.Srv.Files.List().PageSize(1000).PageToken(ptoken).OrderBy(\"name\").Q(q).SupportsAllDrives(true).IncludeItemsFromAllDrives(true).Fields(f...)\n\tif b.SearchFolder.DriveId != \"\" {\n\t\tr, err = filesListCall.Corpora(\"drive\").DriveId(b.SearchFolder.DriveId).Do()\n\t} else {\n\t\tr, err = filesListCall.Do()\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "8bd569a744e88723a79556538aa01aef", "score": "0.5882485", "text": "func (driver *ClientDriver) ListFiles(cc server.ClientContext) ([]os.FileInfo, error) {\n\tif cc.Path() == virtualPath {\n\t\tfiles := make([]os.FileInfo, 0)\n\t\tfiles = append(files,\n\t\t\tvirtualFileInfo{\n\t\t\t\tname: \"localpath.txt\",\n\t\t\t\tmode: os.FileMode(0600),\n\t\t\t\tsize: 1024,\n\t\t\t},\n\t\t\tvirtualFileInfo{\n\t\t\t\tname: \"file2.txt\",\n\t\t\t\tmode: os.FileMode(0666),\n\t\t\t\tsize: 2048,\n\t\t\t},\n\t\t)\n\t\treturn files, nil\n\t} else if cc.Path() == debugPath {\n\t\treturn make([]os.FileInfo, 0), nil\n\t}\n\n\tpath := driver.BaseDir + cc.Path()\n\n\tfiles, err := ioutil.ReadDir(path)\n\n\t// We add a virtual dir\n\tif cc.Path() == \"/\" && err == nil {\n\t\tfiles = append(files, virtualFileInfo{\n\t\t\tname: \"virtual\",\n\t\t\tmode: os.FileMode(0666) | os.ModeDir,\n\t\t\tsize: 4096,\n\t\t})\n\t}\n\n\treturn files, err\n}", "title": "" }, { "docid": "c99be965f746d25b317817c7ced4f364", "score": "0.58651674", "text": "func (m Manager) List() (vols []Volume, err error) {\n\tfiles, err := ioutil.ReadDir(m.root)\n\tif err != nil {\n\t\terr = errors.Wrapf(err,\n\t\t\t\"Couldn't list files/directories from %s\", m.root)\n\t\treturn\n\t}\n\n\tfor _, file := range files {\n\t\tif file.IsDir() {\n\t\t\tvar quota *xfs.Quota\n\t\t\tabsPath := filepath.Join(m.root, file.Name())\n\n\t\t\tquota, err = m.quotaCtl.GetQuota(absPath)\n\t\t\tif err != nil {\n\t\t\t\terr = errors.Wrapf(err,\n\t\t\t\t\t\"Couldn't retrieve quota for directory %s\",\n\t\t\t\t\tfile.Name())\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvols = append(vols, Volume{\n\t\t\t\tName: file.Name(),\n\t\t\t\tSize: quota.Size,\n\t\t\t\tINode: quota.INode,\n\t\t\t\tPath: absPath,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2967a80a9ed86a537a7eb32689cc0697", "score": "0.5862384", "text": "func (f *Fs) netStorageListRequest(ctx context.Context, URL, endPath string) ([]File, string, error) {\n\tactionHeader := \"version=1&action=list&mtime_all=yes&format=xml&encoding=utf-8\"\n\tif !pathIsOneLevelDeep(endPath) {\n\t\t// Add end= to limit the depth to endPath\n\t\tescapeEndPath := url.QueryEscape(strings.TrimSuffix(endPath, \"/\"))\n\t\t// The \"0\" character exists in place of the trailing slash to\n\t\t// accommodate ObjectStore directory logic\n\t\tend := \"&end=\" + strings.TrimSuffix(escapeEndPath, \"/\") + \"0\"\n\t\tactionHeader += end\n\t}\n\tlistResp := &List{}\n\tif _, err := f.callBackend(ctx, URL, \"GET\", actionHeader, false, listResp, nil); err != nil {\n\t\tif err == fs.ErrorObjectNotFound {\n\t\t\t// List action is known to return 404 for a valid [CP Code] path with no objects inside.\n\t\t\t// Call stat to find out whether it is an empty directory or path does not exist.\n\t\t\tfs.Debugf(nil, \"NetStorage action list returned 404, call stat for %q\", URL)\n\t\t\tfiles, err := f.netStorageStatRequest(ctx, URL, true)\n\t\t\tif err == nil && len(files) > 0 && files[0].Type == \"dir\" {\n\t\t\t\treturn []File{}, \"\", nil\n\t\t\t}\n\t\t}\n\t\tfs.Debugf(nil, \"NetStorage action list failed for %q: %v\", URL, err)\n\t\treturn nil, \"\", err\n\t}\n\treturn listResp.Files, listResp.Resume.Start, nil\n}", "title": "" }, { "docid": "471f3a661f5cef5901a709d8e764c756", "score": "0.58565456", "text": "func (fs OSFilesystem) ListFiles(path string) ([]os.FileInfo, error) {\n\td, err := os.Open(path)\n\tdefer d.Close()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read directory %s: %s\", path, err)\n\t}\n\tfiles, err := d.Readdir(-1)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read files from directory %s: %s\", path, err)\n\t}\n\treturn files, nil\n}", "title": "" }, { "docid": "a87713bf1e4127829afb650894a99eac", "score": "0.583689", "text": "func ListDir(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t// 获取ls参数, 即目标路径\n\tlspath := path.Clean(r.URL.Query().Get(\"path\"))\n\tlspath = path.Clean(lspath)\n\tlog.Println(lspath)\n\tfor strings.HasPrefix(lspath, \"../\") || strings.HasPrefix(lspath, \"./\") {\n\t\tlspath = strings.ReplaceAll(lspath, \"../\", \"\")\n\t\tlspath = strings.ReplaceAll(lspath, \"./\", \"\")\n\t}\n\tif lspath == \"..\" {\n\t\tlspath = \"\"\n\t}\n\tif lspath == \".\" {\n\t\tlspath = \"\"\n\t}\n\tif lspath == \"\" {\n\t\tlspath = \"/404\"\n\t}\n\n\t// no /\n\t// lspath = url.PathEscape(lspath)\n\tlog.Println(\"listing:\", lspath)\n\n\tfi, err := os.Stat(lspath)\n\tif err != nil {\n\n\t\tw.Write([]byte(err.Error()))\n\t\treturn\n\t}\n\tvar filelist []FileInfo\n\tmode := fi.Mode()\n\tswitch {\n\tcase mode&os.ModeSymlink != 0:\n\tcase mode.IsRegular():\n\t\tfileinfo := FileInfo{\n\t\t\tfi.Name(),\n\t\t\t0,\n\t\t\tfi.Name(),\n\t\t}\n\n\t\tfilelist = []FileInfo{fileinfo}\n\n\tcase mode.IsDir():\n\t\tdir, err := os.Open(lspath)\n\t\t// 尝试读取文件内容\n\t\tfiles, err := dir.Readdirnames(100)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\treturn\n\t\t}\n\n\t\tfilelist = make([]FileInfo, len(files)+1)\n\t\tfilelist[0] = FileInfo{\n\t\t\tName: \"../\",\n\t\t\tLinkName: \"../\",\n\t\t\tSize: 0,\n\t\t}\n\n\t\tfor i, filename := range files {\n\t\t\ti++\n\t\t\tfilllFileInfo(path.Join(lspath, filename), &filelist[i])\n\n\t\t}\n\n\tdefault:\n\t\tlog.Printf(\"Not matched %s ,filemode: %d\", lspath, fi.Mode())\n\n\t}\n\tbytes, err := json.Marshal(filelist)\n\tif err != nil {\n\t\tw.Write([]byte(err.Error()))\n\t\treturn\n\t}\n\tw.Write(bytes)\n\treturn\n}", "title": "" }, { "docid": "d8c1800f3e91f40c219879343607792c", "score": "0.5833086", "text": "func (f *Fs) list(dir string, fn listFn) error {\n\t//request files list. list is divided into pages. We send request for each page\n\t//items per page is limited by limit\n\t//TODO may be add config parameter for the items per page limit\n\tvar limit uint32 = 1000 // max number of object per request\n\tvar itemsCount uint32 //number of items per page in response\n\tvar offset uint32 //for the next page of request\n\t// yandex disk api request options\n\tvar opt yandex.FlatFileListRequestOptions\n\topt.Limit = &limit\n\topt.Offset = &offset\n\tprefix := f.diskRoot\n\tif dir != \"\" {\n\t\tprefix += dir + \"/\"\n\t}\n\t//query each page of list until itemCount is less then limit\n\tfor {\n\t\t//send request\n\t\tinfo, err := f.yd.NewFlatFileListRequest(opt).Exec()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\titemsCount = uint32(len(info.Items))\n\n\t\t//list files\n\t\tfor _, item := range info.Items {\n\t\t\t// filter file list and get only files we need\n\t\t\tif strings.HasPrefix(item.Path, prefix) {\n\t\t\t\t//trim root folder from filename\n\t\t\t\tvar name = strings.TrimPrefix(item.Path, f.diskRoot)\n\t\t\t\terr = fn(name, &item, false)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//offset for the next page of items\n\t\toffset += itemsCount\n\t\t//check if we reached end of list\n\t\tif itemsCount < limit {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d6efa3a54bb3017e7d9e98883ffd60b7", "score": "0.58269477", "text": "func List() []string {\n\tout := make([]string, 0)\n\tfiles, err := filepath.Glob(path.Join(getPath(), \"*\"))\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"could not glob files: %s\", err))\n\t}\n\tfor _, f := range files {\n\t\tif path.Ext(f) != \".go\" {\n\t\t\tout = append(out, path.Base(f))\n\t\t}\n\t}\n\treturn out\n}", "title": "" }, { "docid": "9a4e91e4972fab1ef3d6b9f21b1020dd", "score": "0.5814021", "text": "func ListFiles(path string) <-chan string {\n\tout := make(chan string, 3)\n\tgo func() {\n\t\tdirList, err := ioutil.ReadDir(path)\n\t\tif err != nil {\n\t\t\tmylog.Tf(\"[Error]\", \"MyUtil\", \"ListFiles\", \"List files in \"+path+\" was err. %s\", err.Error())\n\t\t}\n\t\tfor _, v := range dirList {\n\t\t\tout <- v.Name()\n\t\t}\n\t\tclose(out)\n\t}()\n\treturn out\n}", "title": "" }, { "docid": "e4a14c8d718f57538f785e5c1223e199", "score": "0.58072656", "text": "func listFiles(dir string) error {\n\treturn filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\tlog.Printf(\"%v\\n\", err)\n\t\t\treturn err\n\t\t}\n\t\tif info.Mode()&os.ModeSymlink > 0 {\n\t\t\tlink, err := os.Readlink(path)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlog.Printf(\"%s -> %s\", path, link)\n\t\t\treturn nil\n\t\t}\n\n\t\tlog.Println(path)\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "2eb5f0e5d902ab38c6c8dec41c24f370", "score": "0.5796671", "text": "func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error) {\n\tbucket, directory := f.split(dir)\n\tif bucket == \"\" {\n\t\tif directory != \"\" {\n\t\t\treturn nil, fs.ErrorListBucketRequired\n\t\t}\n\t\treturn f.listBuckets(ctx)\n\t}\n\treturn f.listDir(ctx, bucket, directory, f.rootDirectory, f.rootBucket == \"\")\n}", "title": "" }, { "docid": "5106e982e9e0ca60591a09b899d96fc0", "score": "0.57892615", "text": "func (f *Fs) listAll(ctx context.Context, dirID, kind, trashed string, fn listAllFn) (found bool, err error) {\n\t// Url Parameters\n\tparams := url.Values{}\n\tparams.Set(\"thumbnail_size\", api.ThumbnailSizeM)\n\tparams.Set(\"limit\", strconv.Itoa(api.ListLimit))\n\tparams.Set(\"with_audit\", strconv.FormatBool(true))\n\tif parentID := parentIDForRequest(dirID); parentID != \"\" {\n\t\tparams.Set(\"parent_id\", parentID)\n\t}\n\n\t// Construct filter string\n\tfilters := &api.Filters{}\n\tfilters.Set(\"Phase\", \"eq\", api.PhaseTypeComplete)\n\tfilters.Set(\"Trashed\", \"eq\", trashed)\n\tfilters.Set(\"Kind\", \"eq\", kind)\n\tif filterStr, err := json.Marshal(filters); err == nil {\n\t\tparams.Set(\"filters\", string(filterStr))\n\t}\n\t// fs.Debugf(f, \"list params: %v\", params)\n\n\topts := rest.Opts{\n\t\tMethod: \"GET\",\n\t\tPath: \"/drive/v1/files\",\n\t\tParameters: params,\n\t}\n\n\tpageToken := \"\"\nOUTER:\n\tfor {\n\t\topts.Parameters.Set(\"page_token\", pageToken)\n\n\t\tvar info api.FileList\n\t\tvar resp *http.Response\n\t\terr = f.pacer.Call(func() (bool, error) {\n\t\t\tresp, err = f.rst.CallJSON(ctx, &opts, nil, &info)\n\t\t\treturn f.shouldRetry(ctx, resp, err)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn found, fmt.Errorf(\"couldn't list files: %w\", err)\n\t\t}\n\t\tif len(info.Files) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tfor _, item := range info.Files {\n\t\t\titem.Name = f.opt.Enc.ToStandardName(item.Name)\n\t\t\tif fn(item) {\n\t\t\t\tfound = true\n\t\t\t\tbreak OUTER\n\t\t\t}\n\t\t}\n\t\tif info.NextPageToken == \"\" {\n\t\t\tbreak\n\t\t}\n\t\tpageToken = info.NextPageToken\n\t}\n\treturn\n}", "title": "" }, { "docid": "dc68db09494bf230d366e38fc53c8922", "score": "0.57840824", "text": "func (fs *Storage) List(prefix string) ([]string, error) {\n\tfiles, err := ioutil.ReadDir(fs.baseDirectory)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres := make([]string, 0)\n\tfor _, f := range files {\n\t\tname := f.Name()\n\t\tif strings.HasPrefix(name, prefix) {\n\t\t\tres = append(res, name)\n\t\t}\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "39cab9edeb9f2d310ebb1f1d1edbd843", "score": "0.57787085", "text": "func listFiles(dirPath string) ([]string, error) {\n\n\tres := []string{}\n\n\twalkFunc := func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif info.Mode().IsRegular() {\n\t\t\tres = append(res, path)\n\t\t}\n\t\treturn nil\n\t}\n\n\terr := filepath.Walk(dirPath, walkFunc)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading directory \\\"%q\\\": %w\", dirPath, err)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "1f829707d57f9f33874bb25e5753322f", "score": "0.57733756", "text": "func GetFiles(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\tif err := json.NewEncoder(w).Encode(list); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "1bc7a6c796e5b9de6663931271fd5eaf", "score": "0.57700485", "text": "func (r *Repository) List() (infos []*ResourceInfo, err error) {\n\treturn r.list(SubdirDefault)\n}", "title": "" }, { "docid": "ed5913029c082c2aeccbe7b886b95f42", "score": "0.5764536", "text": "func listFiles(bucket, path string) (listing []string, err error) {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"storage.NewClient: %v\", err)\n\t}\n\tdefer client.Close()\n\n\tctx, cancel := context.WithTimeout(ctx, time.Second*10)\n\tdefer cancel()\n\n\tquery := &storage.Query{Prefix: path}\n\tit := client.Bucket(bucket).Objects(ctx, query)\n\tfor {\n\t\tattrs, err := it.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Bucket(%q).Objects: %v\", bucket, err)\n\t\t}\n\t\tlisting = append(listing, attrs.Name)\n\t}\n\treturn listing, nil\n}", "title": "" }, { "docid": "90cbc69549e0b9bf38e7985a5d0c10e4", "score": "0.57298845", "text": "func (s *DefaultServer) commandList(c *gin.Context, args Args) {\n\tlog.Println(\"server:\", \"sending file list\")\n\tfiles := make(chan File)\n\tmax := args.GetInt64(\"max_filecount\")\n\t// spawning goroutine that reads from database\n\t// and sends files to channel\n\tlog.Println(\"server:\", \"we have\", s.db.Count(), \"files in db\")\n\tgo func() {\n\t\tif err := s.db.GetBatch(files, max); err != nil {\n\t\t\tlog.Println(\"server:\", \"failed to generate file list\", err)\n\t\t}\n\t\tclose(files)\n\t}()\n\tvar count int64\n\tfor file := range files {\n\t\tcount++\n\t\tfmt.Fprintln(c.Writer, file)\n\t}\n\tlog.Println(\"server:\", \"sent\", count)\n}", "title": "" }, { "docid": "418be905aeb5f49c6ecfcabd118165ec", "score": "0.57242036", "text": "func (r *Repository) list(subdir string) (infos []*ResourceInfo, err error) {\n\terr = r.forEach(subdir, func(path string, f os.FileInfo) error {\n\t\t// best-effort duration here\n\t\tduration, _ := ApproxDurationMs(path)\n\t\tinfos = append(infos, &ResourceInfo{\n\t\t\tId: f.Name(),\n\t\t\tFile: path,\n\t\t\tSizeBytes: f.Size(),\n\t\t\tLastModified: f.ModTime().Unix(),\n\t\t\tDuration: int64(duration),\n\t\t})\n\t\treturn nil\n\t})\n\treturn infos, err\n}", "title": "" }, { "docid": "d393fdda5bc1a2a2dc2486383cf64252", "score": "0.57135314", "text": "func (s *FileSystemStore) List(pattern string) ([]string, error) {\n\tfilenames, err := filepath.Glob(filepath.Join(s.dir, pattern+\".json\"))\n\tresult := []string{}\n\tif err != nil {\n\t\treturn result, err\n\t}\n\n\tprefix := s.dir + string(os.PathSeparator)\n\tfor _, filename := range filenames {\n\t\twithoutExtension := strings.TrimSuffix(filename, \".json\")\n\t\twithoutDirectory := strings.TrimPrefix(withoutExtension, prefix)\n\t\tresult = append(result, withoutDirectory)\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "35d939c37bdcd0100f2ea8a22a741664", "score": "0.5689874", "text": "func (b *Backups) list(outputPath string, max int) error {\n\n\tdir := filepath.Dir(outputPath)\n\tns, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn err // Path error\n\t}\n\n\tprefix, ext := getPrefixAndExt(outputPath)\n\n\tfor _, f := range ns {\n\t\tif f.IsDir() {\n\t\t\tcontinue\n\t\t}\n\t\tif ts := parseTime(f.Name(), prefix, ext); ts != 0 {\n\t\t\theap.Push(b, Backup{ts, filepath.Join(dir, f.Name())})\n\t\t\tcontinue\n\t\t}\n\t}\n\n\tfor b.Len() > max {\n\t\tv := heap.Pop(b)\n\t\tos.Remove(v.(Backup).fp)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "19765d29d80bd47f91082ae308bf583c", "score": "0.56845963", "text": "func ListFiles(path string) ([]string, error) {\n\tfiles := []string{}\n\tif PathDoesNotExist(path) {\n\t\treturn files, errors.New(\"Path not valid\")\n\t}\n\tfilesInfo, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\treturn files, err\n\t}\n\tfor _, file := range filesInfo {\n\t\tfiles = append(files, file.Name())\n\t}\n\treturn files, nil\n}", "title": "" }, { "docid": "617f37d6ffa12bfe5c4c485359974fb5", "score": "0.5675224", "text": "func (c *Cache) List(ctx context.Context, storage interface{}, p string) ([]*File, error) {\n\tstorageID, err := toIntID(storage)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar rows *sql.Rows\n\tphash := fmt.Sprintf(\"%x\", md5.Sum([]byte(strings.Trim(p, \"/\"))))\n\trows, err = c.db.QueryContext(ctx, `\n\t\tSELECT\n\t\t\tfc.fileid, fc.storage, fc.path, fc.parent, fc.permissions, fc.mimetype, fc.mimepart,\n\t\t\tmt.mimetype, fc.size, fc.mtime, fc.storage_mtime, fc.encrypted, fc.unencrypted_size,\n\t\t\tfc.name, fc.etag, fc.checksum\n\t\tFROM oc_filecache fc\n\t\tLEFT JOIN oc_mimetypes mt ON fc.mimetype = mt.id\n\t\tWHERE storage = ? AND parent = (SELECT fileid FROM oc_filecache WHERE storage = ? AND path_hash=?) AND name IS NOT NULL\n\t`, storageID, storageID, phash)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tentries := []*File{}\n\tfor rows.Next() {\n\t\tentry, err := c.rowToFile(rows)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tentries = append(entries, entry)\n\t}\n\n\treturn entries, nil\n}", "title": "" }, { "docid": "47ab98744c45f67a106fd568b2c0ad75", "score": "0.5674807", "text": "func TestListDir(t *testing.T) {\n\tdefer testPanic(t) // handle panics and syntax errors\n\tsetTestInstance(t) // update test instance for logging\n\n\tt.Log(\"GOAL: you should be able to return a list of files starting at the named subdirectory\")\n\tvar index int\n\n\tvar result = listFiles(fileData, \"js\")\n\tif len(result) != 7 {\n\t\tt.Error(shouldBe(len(result), 7))\n\t}\n\n\tindex = testIndexOfStrings(result, \"main.js\")\n\tif index < 0 {\n\t\tt.Error(index, \"should be >= 0\")\n\t}\n\n\tindex = testIndexOfStrings(result, \"index.html\")\n\tif index > 0 {\n\t\tt.Error(shouldBe(index, -1))\n\t}\n}", "title": "" }, { "docid": "fc820ce69ab3cba30ca4191e9b10829c", "score": "0.56715393", "text": "func listAllMessageFiles(startDir string) ([]string, []string) {\n\tvar fileNames []string\n\tvar filePaths []string\n\terr := filepath.Walk(startDir,\n\t\tfunc(path string, info os.FileInfo, err error) error {\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif strings.HasSuffix(info.Name(), \".json\") {\n\t\t\t\tfileNames = append(fileNames, info.Name())\n\t\t\t\tfilePaths = append(filePaths, path)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn fileNames, filePaths\n}", "title": "" }, { "docid": "e30e49af7fe6f5f8d4909ad19514406a", "score": "0.5667564", "text": "func GetFiles(project string) (files []File, err error) {\n\n\t// If omitted, default is 50\n\t// The minimum value for the query parameter limit is 1.\n\t// The maximum value for the query parameter limit is 100.\n\tlimit := 100\n\n\turl, _ := url.Parse(api.UrlFiles)\n\tq := url.Query()\n\tq.Set(\"limit\", strconv.Itoa(limit))\n\tq.Set(\"project\", project)\n\turl.RawQuery = q.Encode()\n\n\trespBody, totalOffset, err := api.CGCRequestAndReadTotalOffset(\"GET\", url.String(), nil)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"GET files failed\")\n\t}\n\tjsonResp := JsonResponse{}\n\terr = json.Unmarshal(respBody, &jsonResp)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unmarshaling files failed\")\n\t}\n\n\tfiles = append(files, jsonResp.Items...)\n\n\tblocksNum := totalOffset / limit\n\tfor i := 1; i <= blocksNum; i++ {\n\t\toffset := strconv.Itoa(limit * i)\n\n\t\tq.Set(\"offset\", offset)\n\t\turl.RawQuery = q.Encode()\n\t\trespBody, err := api.CGCRequestAndRead(\"GET\", url.String(), nil)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"GET files with offset failed\")\n\t\t}\n\n\t\tjsonResp = JsonResponse{}\n\t\terr = json.Unmarshal(respBody, &jsonResp)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, fmt.Sprintf(\"unmarshaling files failed for block num %d\", i))\n\t\t}\n\n\t\tfiles = append(files, jsonResp.Items...)\n\t}\n\treturn files, nil\n}", "title": "" }, { "docid": "5fdb53f11d117bfd64aa1ce87645f3c3", "score": "0.56655806", "text": "func (s *repositoryService) List(ctx context.Context, opts scm.ListOptions) ([]*scm.Repository, *scm.Response, error) {\n\treturn nil,nil,scm.ErrNotSupported\n}", "title": "" }, { "docid": "b2453f00e539e2c129c844823400db64", "score": "0.5656976", "text": "func (adp *fileStorage) Files(ctx context.Context, ptn string) ([]string, error) {\n\tmatches, err := filepath.Glob(adp.dsn.Join(ptn))\n\tif err != nil {\n\t\tlogger.Printf(\"Failed to retrieve list files %s\", err)\n\t\treturn []string{}, err\n\t}\n\n\treturn matches, nil\n}", "title": "" }, { "docid": "e7a6c6e6d943b45d883798739abf87cb", "score": "0.5651961", "text": "func listFiles(dirname string) []string {\n\tf, _ := os.Open(dirname)\n\n\tnames, _ := f.Readdirnames(-1)\n\tf.Close()\n\n\tsort.Strings(names)\n\n\tdirs := []string{}\n\tfiles := []string{}\n\n\t// sort: directories in front of files\n\tfor _, name := range names {\n\t\tpath := filepath.Join(dirname, name)\n\t\tfio, err := os.Lstat(path)\n\n\t\tif nil != err {\n\t\t\tlogger.Warnf(\"Can't read file info [%s]\", path)\n\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.HasSuffix(name, \".coditor\") { // skip Coditor meta-data files\n\t\t\tcontinue\n\t\t}\n\n\t\tif fio.IsDir() {\n\t\t\tdirs = append(dirs, name)\n\t\t} else {\n\t\t\tfiles = append(files, name)\n\t\t}\n\t}\n\n\treturn append(dirs, files...)\n}", "title": "" }, { "docid": "5d30165f9397a08edaaca06cc18ed5ed", "score": "0.5644743", "text": "func (a *Archive) List() ([]string, error) {\n\n\tvar filenames []string\n\n\tr, err := zip.OpenReader(a.filePath)\n\tif err != nil {\n\t\treturn filenames, err\n\t}\n\tdefer r.Close()\n\n\tfor _, f := range r.File {\n\n\t\trc, err := f.Open()\n\t\tif err != nil {\n\t\t\treturn filenames, err\n\t\t}\n\t\tdefer rc.Close()\n\t\tfilenames = append(filenames, removeLeadingSlash(f.Name))\n\t}\n\n\treturn filenames, nil\n}", "title": "" }, { "docid": "b06b780f1c71c842a951a15e1594a619", "score": "0.5640893", "text": "func (f *Fs) List(dir string) (entries fs.DirEntries, err error) {\n\tif f.bucket == \"\" {\n\t\treturn f.listBuckets(dir)\n\t}\n\treturn f.listDir(dir)\n}", "title": "" }, { "docid": "330e7b6b08baa4d03289808ebd800e78", "score": "0.5637592", "text": "func ListFiles(path string) []string {\n sep := GetFileSeperator()\n if !strings.HasSuffix(path, sep) {\n path += sep\n }\n fileList := []string{}\n files, _ := ioutil.ReadDir(path)\n\n for _, f := range files {\n filePath := path + f.Name()\n if IsFileExists(filePath) {\n fileList = append(fileList, filePath)\n }\n }\n return fileList\n}", "title": "" }, { "docid": "7dc7a20f4f1c91dc41f47d5cee60ebe9", "score": "0.5634256", "text": "func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error) {\n\tif f.filetype == \"\" {\n\t\t// This happens in two scenarios.\n\t\t// 1. NewFs is done on a nonexistent object, then later rclone attempts to List/ListR this NewFs.\n\t\t// 2. List/ListR is called from the context of test_all and not the regular rclone binary.\n\t\terr := f.initFs(ctx, dir)\n\t\tif err != nil {\n\t\t\tif err == fs.ErrorObjectNotFound {\n\t\t\t\treturn nil, fs.ErrorDirNotFound\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tURL := f.url(dir)\n\tfiles, err := f.netStorageDirRequest(ctx, dir, URL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif dir != \"\" && !strings.HasSuffix(dir, \"/\") {\n\t\tdir += \"/\"\n\t}\n\tfor _, item := range files {\n\t\tname := dir + f.getFileName(&item)\n\t\tswitch item.Type {\n\t\tcase \"dir\":\n\t\t\twhen := time.Unix(item.Mtime, 0)\n\t\t\tentry := fs.NewDir(name, when).SetSize(item.Bytes).SetItems(item.Files)\n\t\t\tentries = append(entries, entry)\n\t\tcase \"file\":\n\t\t\tif entry, _ := f.newObjectWithInfo(name, &item); entry != nil {\n\t\t\t\tentries = append(entries, entry)\n\t\t\t}\n\t\tcase \"symlink\":\n\t\t\tvar entry fs.Object\n\t\t\t// Add .rclonelink suffix to allow local backend code to convert to a symlink.\n\t\t\t// In case both .rclonelink file AND symlink file exists, the first will be used.\n\t\t\tif entry, _ = f.newObjectWithInfo(name+\".rclonelink\", &item); entry != nil {\n\t\t\t\tfs.Infof(nil, \"Converting a symlink to the rclonelink %s target %s\", entry.Remote(), item.Target)\n\t\t\t\tentries = append(entries, entry)\n\t\t\t}\n\t\tdefault:\n\t\t\tfs.Logf(nil, \"Ignoring unsupported object type %s for %q path\", item.Type, name)\n\t\t}\n\t}\n\treturn entries, nil\n}", "title": "" }, { "docid": "5c2faf502c43110c6acd4754300496aa", "score": "0.56311893", "text": "func ListFiles(csv_dir string) ([]FileInfo, error) {\n\n\t// list of file to return\n\tfileinfos := make([]FileInfo, 0)\n\n\t// Read files from os\n\tfiles, err := ioutil.ReadDir(csv_dir)\n\tif err != nil {\n\t\treturn fileinfos, err\n\t}\n\n\t// copy into our struct\n\tfor _, f := range files {\n\t\tfileinfos = append(fileinfos, FileInfo{FileName: f.Name(),\n\t\t\tSize: f.Size(),\n\t\t\tDate: f.Name()[8 : len(f.Name())-4]})\n\t}\n\treturn fileinfos, nil\n}", "title": "" }, { "docid": "ba42b390627a8c2ca31f7ac676858e50", "score": "0.56231016", "text": "func ListPaginatedFiles(filePath string, options *ListPaginatedFilesOptions) (*PaginatedFileResponse, error) {\n\tfileInfo, err := os.Stat(filePath)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil, PathNotExist\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\tif !fileInfo.IsDir() {\n\t\treturn nil, NotADirectory\n\t}\n\n\n\tresult := make([]*File, 0)\n\terr = filepath.Walk(filePath, func(path string, info os.FileInfo, err error) error {\n\t\tif filePath == path {\n\t\t\treturn nil\n\t\t}\n\n\t\tif !options.ShowHidden && strings.HasPrefix(info.Name(), \".\") {\n\t\t\tif info.IsDir() {\n\t\t\t\treturn filepath.SkipDir\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\textension := filepath.Ext(path)\n\t\tfileName := info.Name()\n\t\tif len(extension) > 0 {\n\t\t\t// Remove period from extension\n\t\t\textension = extension[1:]\n\t\t}\n\n\t\tnewFile := File{\n\t\t\tPath: path,\n\t\t\tName: fileName,\n\t\t\tSize: info.Size(),\n\t\t\tExtension: extension,\n\t\t\tLastModified: info.ModTime().UTC(),\n\t\t\tDirectory: info.IsDir(),\n\t\t}\n\n\t\tresult = append(result, &newFile)\n\n\t\tif info.IsDir() {\n\t\t\treturn filepath.SkipDir\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tsort.SliceStable(result, func(i, j int) bool {\n\t\tlhFile := result[i]\n\t\trhFile := result[j]\n\n\t\tif (lhFile.Directory && rhFile.Directory) ||\n\t\t\t(!lhFile.Directory && !rhFile.Directory) {\n\t\t\treturn strings.Compare(strings.ToLower(lhFile.Name), strings.ToLower(rhFile.Name)) < 0\n\t\t}\n\n\t\tif lhFile.Directory {\n\t\t\treturn true\n\t\t}\n\n\t\treturn false\n\t})\n\n\tstart := (options.Page - 1) * options.PerPage\n\tif start < 0 {\n\t\tstart = 0\n\t}\n\n\tend := start + options.PerPage\n\tif end > len(result) {\n\t\tend = len(result)\n\t}\n\tparts := result[start:end]\n\n\tcount := len(parts)\n\ttotalCount := len(result)\n\n\tresponse := &PaginatedFileResponse{\n\t\tCount: count,\n\t\tPage: options.Page,\n\t\tPages: int(math.Ceil(float64(totalCount) / float64(options.PerPage))),\n\t\tTotalCount: totalCount,\n\t\tFiles: parts,\n\t\tParentPath: FilePathToParentPath(filePath),\n\t}\n\n\treturn response, err\n}", "title": "" }, { "docid": "34b4e64bf47da794bf63c9da7aa2c28c", "score": "0.5617499", "text": "func ListNewFiles(oPath, nPath string) ([]string, error) {\n\tof, err := readFilesDir(oPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnf, err := readFilesDir(nPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcontrol := make(map[string]int)\n\tfor _, file := range of {\n\t\tcontrol[file.Name()]++\n\t}\n\tvar new []string\n\tfor _, file := range nf {\n\t\tif control[file.Name()] == 0 {\n\t\t\tnew = append(new, file.Name())\n\t\t}\n\t}\n\treturn new, nil\n}", "title": "" }, { "docid": "e2d45eb8f2fbac6aaaebc559d612cdc7", "score": "0.56094944", "text": "func (s *s3Loader) list(ctx context.Context, startAfter string, tolerateErr bool) ([]*s3File, error) {\n\tprefix := s.path(s.commonFilePrefix())\n\n\ts3Files := make([]*s3File, 0)\n\tvar parseMetaErr error\n\tif err := s.client.ListObjectsV2PagesWithContext(ctx, &s3.ListObjectsV2Input{\n\t\tBucket: aws.String(s.bucket),\n\t\tPrefix: aws.String(prefix),\n\t\tStartAfter: aws.String(startAfter),\n\t}, func(output *s3.ListObjectsV2Output, lastPage bool) bool {\n\t\tfor _, object := range output.Contents {\n\t\t\tfilename := aws.StringValue(object.Key)\n\t\t\tfileMeta, err := parseFeedFileName(filename)\n\t\t\tif err != nil {\n\t\t\t\tparseMetaErr = errors.E(err, fmt.Sprintf(\"failed to parse spot feed data file name %s\", filename))\n\t\t\t\tif tolerateErr {\n\t\t\t\t\ts.log.Print(parseMetaErr)\n\t\t\t\t\tcontinue\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// skips s3Files that do not match the loader criteria. Truncate the startTime of the filter to ensure that\n\t\t\t// we do not skip files at hour HH:00 with a startTime of (i.e.) HH:30.\n\t\t\tif s.filterTruncatedStartTime(fileMeta) {\n\t\t\t\ts.log.Printf(\"%s does not pass fileMeta filter, skipping\", filename)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ts3Files = append(s3Files, &s3File{\n\t\t\t\tfileMeta,\n\t\t\t\ts.bucket,\n\t\t\t\tfilename,\n\t\t\t\ts.client,\n\t\t\t})\n\t\t}\n\t\treturn true\n\t}); err != nil {\n\t\treturn nil, fmt.Errorf(\"list on path %s failed with error: %s\", prefix, err)\n\t}\n\tif !tolerateErr && parseMetaErr != nil {\n\t\treturn nil, parseMetaErr\n\t}\n\treturn s3Files, nil\n}", "title": "" }, { "docid": "bf416c1968a6850f4fedf80842177c24", "score": "0.56043637", "text": "func List(ctx *context.Context) {\n\ttemplateNames, err := templates.AssetFS().ListFiles(\"devtest\", true)\n\tif err != nil {\n\t\tctx.ServerError(\"AssetFS().ListFiles\", err)\n\t\treturn\n\t}\n\tvar subNames []string\n\tfor _, tmplName := range templateNames {\n\t\tsubName := strings.TrimSuffix(tmplName, \".tmpl\")\n\t\tif subName != \"list\" {\n\t\t\tsubNames = append(subNames, subName)\n\t\t}\n\t}\n\tctx.Data[\"SubNames\"] = subNames\n\tctx.HTML(http.StatusOK, \"devtest/list\")\n}", "title": "" }, { "docid": "feba34bf1c622dbf8ce7582442971b9a", "score": "0.559824", "text": "func listRepositoryTree(client *http.Client, baseurl string, params queryParams) ([]GitlabFile, error) {\n\tvar files []GitlabFile\n\tcurrentPage := 0\n\ttotalPages := 1\n\n\tfor currentPage != totalPages {\n\t\tparsedURL, _ := url.Parse(baseurl + \"tree\")\n\t\treq := configureRequest(parsedURL, params)\n\t\tresp, err := client.Do(req)\n\t\tif err != nil {\n\t\t\treturn []GitlabFile{}, errors.Wrapf(err, \"failed GET request\")\n\t\t}\n\n\t\tvar newFiles []GitlabFile\n\t\tdefer resp.Body.Close()\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn []GitlabFile{}, errors.Wrap(err, \"failed to read response body\")\n\t\t}\n\n\t\terr = json.Unmarshal(body, &newFiles)\n\t\tif err != nil {\n\t\t\treturn []GitlabFile{}, errors.Wrap(err, \"failed to parse json\")\n\t\t}\n\n\t\tfiles = append(files, newFiles...)\n\n\t\tcurrentPage, _ = strconv.Atoi(resp.Header.Get(\"x-page\"))\n\t\ttotalPages, _ = strconv.Atoi(resp.Header.Get(\"x-total-pages\"))\n\t\tparams.page, _ = strconv.Atoi(resp.Header.Get(\"x-next-page\"))\n\t}\n\n\treturn files, nil\n}", "title": "" }, { "docid": "c4afa07b8c532ed90231a616ae8b4df5", "score": "0.5596065", "text": "func (d Block) ListFiles(dirname string) ([]os.FileInfo, *probe.Error) {\n\td.lock.Lock()\n\tdefer d.lock.Unlock()\n\n\tdir, err := os.Open(filepath.Join(d.path, dirname))\n\tif err != nil {\n\t\treturn nil, probe.NewError(err)\n\t}\n\tdefer dir.Close()\n\tcontents, err := dir.Readdir(-1)\n\tif err != nil {\n\t\treturn nil, probe.NewError(err)\n\t}\n\tvar files []os.FileInfo\n\tfor _, content := range contents {\n\t\t// Include only regular files, ignore everything else\n\t\tif content.Mode().IsRegular() {\n\t\t\tfiles = append(files, content)\n\t\t}\n\t}\n\treturn files, nil\n}", "title": "" }, { "docid": "f2efce0e9ed02c4e7e9f2fe8625242d8", "score": "0.5588013", "text": "func (ffs *FakeFileSystem) ListFiles(directoryPath string) ([]string, error) {\n\tffs.lock.RLock()\n\tdefer ffs.lock.RUnlock()\n\n\tfiles := []string{}\n\tif err := ffs.getError(directoryPath); err != nil {\n\t\treturn files, err\n\t}\n\tfor path := range ffs.lookup {\n\t\tif strings.HasPrefix(path, directoryPath+\"/\") {\n\t\t\tfiles = append(files, path)\n\t\t}\n\t}\n\treturn files, nil\n}", "title": "" }, { "docid": "6b4aaaf46fbb1f2c5e70b93b0c815240", "score": "0.5572996", "text": "func (impl *LambdaAPIClient) Files(ctx context.Context, token *api.Token, uid string, dir string) (reply []types.File, err error) {\n\terr = client.CallHTTP(ctx, impl.BaseURL, \"LambdaAPI.Files\", atomic.AddUint64(&impl.sequence, 1), &reply, token, uid, dir)\n\treturn\n}", "title": "" }, { "docid": "6425f0a725bb0afaec42361bc1180a6d", "score": "0.55674195", "text": "func (this *FileSystem) List(path string) ([]*oss.Object, error) {\n\tvar (\n\t\tobjects []*oss.Object\n\t\tfullpath = this.GetFullPath(path)\n\t)\n\n\tfilepath.Walk(fullpath, func(path string, info os.FileInfo, err error) error {\n\t\tif path == fullpath {\n\t\t\treturn nil\n\t\t}\n\n\t\tif err == nil && !info.IsDir() {\n\t\t\tmodTime := info.ModTime()\n\t\t\tobjects = append(objects, &oss.Object{\n\t\t\t\tPath: strings.TrimPrefix(path, this.Base),\n\t\t\t\tName: info.Name(),\n\t\t\t\tLastModified: &modTime,\n\t\t\t\tStorageInterface: this,\n\t\t\t})\n\t\t}\n\t\treturn nil\n\t})\n\n\treturn objects, nil\n}", "title": "" }, { "docid": "c6c5472dff18c81310e3d3ad81e2a800", "score": "0.5558436", "text": "func (msgSvc *MessageService) GetFileList(inbuf []byte, /*message *string,*/ reply *([]string)) error {\n\tvar message = new(string)\n\tLogger.UnpackReceive(\"file list requested\", inbuf, &message)\n\n\tfilesCond.L.Lock()\n\t(*reply) = globalFileList\n\tfilesCond.L.Unlock()\n\t\n\tLogger.LogLocalEvent(\"returned file list\")\n\treturn nil\n}", "title": "" }, { "docid": "e171a369419d8243c6cf5e204a679778", "score": "0.55518055", "text": "func ls() string {\n\tfileList := \"\"\n\tfiles, err := ioutil.ReadDir(\"./\")\n\tif err != nil {\n\t\treturn \"Failed to get list of files\"\n\t}\n\t//loop through all the files in the directory and append them to fileList\n\tfor _, f := range files {\n\t\tfileList += fmt.Sprintf(\"%s\\n\", f.Name())\n\t}\n\treturn fileList\n}", "title": "" }, { "docid": "500574abb9f26defdda6dc9b6d84a271", "score": "0.55509514", "text": "func fileList(fl string) []string {\n\tif fl != \"\" {\n\t\tvar fs []string\n\t\tfor _, k := range strings.Split(fl, \",\") {\n\t\t\tfs = append(fs, strings.Trim(k, \"\\t\\n \"))\n\t\t}\n\t\treturn fs\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5f3987535f3559020426c57a33445399", "score": "0.5538487", "text": "func (c *FileSystemClient) List(path string, args ...interface{}) (Entries, error) {\n\tvar entries []*Entry\n\tresolvedPath := c.resolvePath(path, args)\n\n\tlog.Debugf(\"Listing files %s\", resolvedPath)\n\n\terr := filepath.Walk(resolvedPath, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// don't walk recursively\n\t\tif info.IsDir() {\n\t\t\tif path != resolvedPath {\n\t\t\t\treturn filepath.SkipDir\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}\n\n\t\text := filepath.Ext(path)\n\t\tif ext != \".yaml\" {\n\t\t\treturn nil\n\t\t}\n\n\t\tyaml, err := ioutil.ReadFile(path)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvar data map[string]interface{}\n\t\tif err = yaml2.Unmarshal(yaml, &data); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tname := filepath.Base(path)\n\t\tname = name[0 : len(name)-len(ext)]\n\t\tentries = append(entries, &Entry{Name: name, Value: data})\n\t\treturn nil\n\t})\n\n\tif os.IsNotExist(err) {\n\t\treturn nil, nil\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn entries, nil\n}", "title": "" }, { "docid": "df9f38f18cbcada65ad469951e7abffd", "score": "0.55329037", "text": "func list(hash, archive string) ([]string, error) {\n\tglob := fileName(hash, archive)\n\ttars, err := filepath.Glob(glob)\n\tif err != nil {\n\t\treturn tars, err\n\t}\n\tsort.Strings(tars) // sort by date instead?\n\treturn tars, err\n}", "title": "" }, { "docid": "a5f34aba4cdb1e82660b8d061dbcb854", "score": "0.5527433", "text": "func listFiles(extensions []string) []string {\n\tif !isDir(directory) {\n\t\tlog.Panic(\"directory %s not found\")\n\t}\n\tfiles, err := ioutil.ReadDir(directory)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\t// check for presence of given extensions\n\textMatch := func(extensions []string, extension string) bool {\n\t\tfor _, ext := range extensions {\n\t\t\tif ext == extension {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\n\t// put together the valid files and return the list\n\tvar ret []string\n\tfor _, fileName := range files {\n\t\tif extMatch(extensions, filepath.Ext(fileName.Name())) {\n\t\t\tret = append(ret, fileName.Name())\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "62e822d39701bf640e29e53703a4be5a", "score": "0.5521904", "text": "func List(ctx context.Context) ([]Metadata, error) {\n\tclient, err := storage.NewClient(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"csimg: failed to create client: %v\", err)\n\t}\n\tdefer client.Close()\n\n\tbucket, err := file.DefaultBucketName(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"csimg: %v\", err)\n\t}\n\tbhandle := client.Bucket(bucket)\n\n\tq := &storage.Query{Prefix: filePrefix}\n\titer := bhandle.Objects(ctx, q)\n\n\tvar metadata []Metadata\n\tfor {\n\t\tobj, err := iter.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\te := fmt.Errorf(\"csimg: failure iterating: %v\", err)\n\t\t\treturn nil, e\n\t\t}\n\n\t\tcsURL := getCloudStorageURL(bucket, obj.Name)\n\t\tblobKey, err := getBlobKey(ctx, bucket, obj.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tservingURL, err := getServingURL(ctx, blobKey)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tm := Metadata{\n\t\t\tID: \"\", // we don't have this\n\t\t\tBlobKey: string(blobKey),\n\t\t\tFilename: obj.Name,\n\t\t\tSize: strconv.FormatInt(obj.Size, 10),\n\t\t\tServingURL: servingURL,\n\t\t\tCloudStorageURL: csURL,\n\t\t}\n\n\t\tmetadata = append(metadata, m)\n\t}\n\n\treturn metadata, nil\n}", "title": "" }, { "docid": "c43675c2d94e7ebc2888ea4e7024e380", "score": "0.55213267", "text": "func getfiles_fromdir(dir string) (*dll.List){\n list := dll.New()\n files, err := ioutil.ReadDir(dir)\n if err != nil {\n log.Fatal(err)\n }\n for i :=0; i<len(files); i++ {\n if files[i].Name() != \"Splits\"{\n list.Add(files[i].Name())\n }\n\n }\n return list\n}", "title": "" } ]
8ac0cd3b9f011106e6bc7839d88c6821
WithNameNic adds the nameNic to the dcim power port templates list params
[ { "docid": "27f608c794e35f95298034b7cf8bcf22", "score": "0.6745883", "text": "func (o *DcimPowerPortTemplatesListParams) WithNameNic(nameNic *string) *DcimPowerPortTemplatesListParams {\n\to.SetNameNic(nameNic)\n\treturn o\n}", "title": "" } ]
[ { "docid": "f34d6de261597cdf97d849b316c15740", "score": "0.59739655", "text": "func (o *IpamRouteTargetsListParams) WithNameNic(nameNic *string) *IpamRouteTargetsListParams {\n\to.SetNameNic(nameNic)\n\treturn o\n}", "title": "" }, { "docid": "aefff0a497f0ce5cfc3afe8ea9701d9f", "score": "0.5782134", "text": "func (o *VirtualizationInterfacesListParams) WithNameNic(nameNic *string) *VirtualizationInterfacesListParams {\n\to.SetNameNic(nameNic)\n\treturn o\n}", "title": "" }, { "docid": "55efcd564e857623d4cb973e03cf78c7", "score": "0.5675096", "text": "func (o *DcimPowerPortTemplatesListParams) SetNameNic(nameNic *string) {\n\to.NameNic = nameNic\n}", "title": "" }, { "docid": "f9f4d6d64718efbda217558128418f4a", "score": "0.567409", "text": "func (o *DcimPowerPortTemplatesListParams) WithNameNisw(nameNisw *string) *DcimPowerPortTemplatesListParams {\n\to.SetNameNisw(nameNisw)\n\treturn o\n}", "title": "" }, { "docid": "f256217ff9cd67e71438903a4e10ef87", "score": "0.56486505", "text": "func (o *DcimPowerPortTemplatesListParams) WithIDn(iDn *string) *DcimPowerPortTemplatesListParams {\n\to.SetIDn(iDn)\n\treturn o\n}", "title": "" }, { "docid": "e4a1545f50208366029c36fddaacdf82", "score": "0.5258895", "text": "func (a *NicApiService) CreateNic(ctx _context.Context, localVarOptionals *CreateNicOpts) (CreateNicResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue CreateNicResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/CreateNic\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tif localVarOptionals != nil && localVarOptionals.CreateNicRequest.IsSet() {\n\t\tlocalVarOptionalCreateNicRequest, localVarOptionalCreateNicRequestok := localVarOptionals.CreateNicRequest.Value().(CreateNicRequest)\n\t\tif !localVarOptionalCreateNicRequestok {\n\t\t\treturn localVarReturnValue, nil, reportError(\"createNicRequest should be CreateNicRequest\")\n\t\t}\n\t\tlocalVarPostBody = &localVarOptionalCreateNicRequest\n\t}\n\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v CreateNicResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "0c39e1e9ab8643b077a6639dd891cf3b", "score": "0.521742", "text": "func (o *DcimPowerPortTemplatesListParams) WithNameIc(nameIc *string) *DcimPowerPortTemplatesListParams {\n\to.SetNameIc(nameIc)\n\treturn o\n}", "title": "" }, { "docid": "2a943a0e7f0e0a678c06816933faa252", "score": "0.5101705", "text": "func (o *DcimPowerPortTemplatesListParams) WithNameIe(nameIe *string) *DcimPowerPortTemplatesListParams {\n\to.SetNameIe(nameIe)\n\treturn o\n}", "title": "" }, { "docid": "5881aa4a09021205827140c5d8acb7c4", "score": "0.50840765", "text": "func CreateNIC(ctx context.Context, rg, nicname, subscription, loc, subid string, ch chan string) {\n\tclient := network.NewInterfacesClient(subscription)\n\tauthorizer, err := auth.NewAuthorizerFromCLI()\n\tif err == nil {\n\t\tclient.Authorizer = authorizer\n\t}\n\t//defer errRecover()\n\tresp, err := client.CreateOrUpdate(ctx,\n\t\trg,\n\t\tnicname,\n\t\tnetwork.Interface{\n\t\t\tLocation: to.StringPtr(loc),\n\t\t\tInterfacePropertiesFormat: &network.InterfacePropertiesFormat{\n\t\t\t\tIPConfigurations: &[]network.InterfaceIPConfiguration{\n\t\t\t\t\t{\n\t\t\t\t\t\tName: to.StringPtr(\"ipConfig\"),\n\t\t\t\t\t\tInterfaceIPConfigurationPropertiesFormat: &network.InterfaceIPConfigurationPropertiesFormat{\n\t\t\t\t\t\t\tPrivateIPAllocationMethod: network.Dynamic,\n\t\t\t\t\t\t\tPrivateIPAddressVersion: network.IPv4,\n\t\t\t\t\t\t\tSubnet: &network.Subnet{\n\t\t\t\t\t\t\t\tID: to.StringPtr(subid),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t//EnableAcceleratedNetworking: to.BoolPtr(true),\n\t\t\t},\n\t\t},\n\t)\n\t//time.Sleep(time.Second * 5)\n\tinter, err := resp.Result(client)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tch <- *inter.ID\n}", "title": "" }, { "docid": "b38973ed16be0c974c47bdd91c5f7d5d", "score": "0.4952082", "text": "func (o *DcimPowerPortTemplatesListParams) WithNamen(namen *string) *DcimPowerPortTemplatesListParams {\n\to.SetNamen(namen)\n\treturn o\n}", "title": "" }, { "docid": "a807da9e4cd3f1a9a7d810951f0a9161", "score": "0.4891944", "text": "func (o *DcimPowerPortTemplatesListParams) WithDevicetypeIDn(devicetypeIDn *string) *DcimPowerPortTemplatesListParams {\n\to.SetDevicetypeIDn(devicetypeIDn)\n\treturn o\n}", "title": "" }, { "docid": "a8e30a5e7a95063a97d0dddfae082b36", "score": "0.48819828", "text": "func NICByNumber(opt int) (string, error) {\n\n\tcount := 0\n\tdevices, err := pcap.FindAllDevs()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, device := range devices {\n\t\tcount++\n\t\tif count == opt {\n\t\t\treturn device.Name, nil\n\t\t}\n\t}\n\n\treturn \"\", fmt.Errorf(\"Interface not found\")\n\n}", "title": "" }, { "docid": "77058f79efb962dbe23011b670ada8b2", "score": "0.4873153", "text": "func (o *IpamRouteTargetsListParams) SetNameNic(nameNic *string) {\n\to.NameNic = nameNic\n}", "title": "" }, { "docid": "2cb6b66dcbe6b32e88b63d16a47f9d8d", "score": "0.48533016", "text": "func (o *DcimPowerPortTemplatesListParams) WithNameIsw(nameIsw *string) *DcimPowerPortTemplatesListParams {\n\to.SetNameIsw(nameIsw)\n\treturn o\n}", "title": "" }, { "docid": "4753ff0b83452dd4d00557c3e8b058ef", "score": "0.48532844", "text": "func (a *AzureInstanceAttribute) configureNic() {\n\tvar err error\n\tfmt.Println(\"Add public ip to nic\")\n\tfmt.Println(\"\")\n\targuments := fmt.Sprintf(\"az network nic ip-config update -g %s --nic-name %s --public-ip-address %s -n %s\", a.RescourceGroupName, a.NicName, a.NamePublicIP, a.NicName)\n\tcaptured := capture()\n\toperate(\"az\", arguments)\n\t_, err = captured()\n\tcheckError(err)\n}", "title": "" }, { "docid": "3711cd70e18f3854a520c48fe5d539e2", "score": "0.47445714", "text": "func (o *DcimPowerPortTemplatesListParams) WithNameNiew(nameNiew *string) *DcimPowerPortTemplatesListParams {\n\to.SetNameNiew(nameNiew)\n\treturn o\n}", "title": "" }, { "docid": "9e09ad369c08c4cb6f5ed3b22a9be27d", "score": "0.4671644", "text": "func (o *DcimPowerPortTemplatesListParams) SetNameNisw(nameNisw *string) {\n\to.NameNisw = nameNisw\n}", "title": "" }, { "docid": "b62c09ed292a0eed10709792e545ab82", "score": "0.4647115", "text": "func (a *NicApiService) LinkNic(ctx _context.Context, localVarOptionals *LinkNicOpts) (LinkNicResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue LinkNicResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/LinkNic\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tif localVarOptionals != nil && localVarOptionals.LinkNicRequest.IsSet() {\n\t\tlocalVarOptionalLinkNicRequest, localVarOptionalLinkNicRequestok := localVarOptionals.LinkNicRequest.Value().(LinkNicRequest)\n\t\tif !localVarOptionalLinkNicRequestok {\n\t\t\treturn localVarReturnValue, nil, reportError(\"linkNicRequest should be LinkNicRequest\")\n\t\t}\n\t\tlocalVarPostBody = &localVarOptionalLinkNicRequest\n\t}\n\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v LinkNicResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "2c96a9316087d4159cd5fa751eea7b12", "score": "0.46291512", "text": "func (o *VirtualizationInterfacesListParams) WithNameNisw(nameNisw *string) *VirtualizationInterfacesListParams {\n\to.SetNameNisw(nameNisw)\n\treturn o\n}", "title": "" }, { "docid": "b211fa08ec29190c2035fc78d5302776", "score": "0.4617619", "text": "func (p *QCNicProvider) CreateNic() (*pkg.HostNic, error) {\n\tvxNetID := p.chooseVxNet()\n\treturn p.CreateNicInVxnet(vxNetID)\n}", "title": "" }, { "docid": "47456161250414cd782f729a09a4f6d2", "score": "0.4570836", "text": "func (v VMwareCbtNicInput) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"isPrimaryNic\", v.IsPrimaryNic)\n\tpopulate(objectMap, \"isSelectedForMigration\", v.IsSelectedForMigration)\n\tpopulate(objectMap, \"nicId\", v.NicID)\n\tpopulate(objectMap, \"targetNicName\", v.TargetNicName)\n\tpopulate(objectMap, \"targetStaticIPAddress\", v.TargetStaticIPAddress)\n\tpopulate(objectMap, \"targetSubnetName\", v.TargetSubnetName)\n\tpopulate(objectMap, \"testStaticIPAddress\", v.TestStaticIPAddress)\n\tpopulate(objectMap, \"testSubnetName\", v.TestSubnetName)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "276662ff45d839609e4b24912c060b5a", "score": "0.4566684", "text": "func (r *Router) addNIC(nic NIC) error {\n\tifc, err := nic.getInterface(\"eth0\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar ips []net.IP\n\n\tif ips = nic.getStaticIPs(); len(ips) == 0 {\n\t\t// assign an IP address\n\t\tip, err2 := r.assignIPAddress()\n\t\tif err2 != nil {\n\t\t\treturn err2\n\t\t}\n\t\tips = append(ips, ip)\n\t}\n\n\tfor _, ip := range ips {\n\t\tif !r.ipv4Net.Contains(ip) {\n\t\t\treturn fmt.Errorf(\"%w: %s\", errStaticIPisBeyondSubnet, r.ipv4Net.String())\n\t\t}\n\n\t\tifc.AddAddress(&net.IPNet{\n\t\t\tIP: ip,\n\t\t\tMask: r.ipv4Net.Mask,\n\t\t})\n\n\t\tr.nics[ip.String()] = nic\n\t}\n\n\treturn nic.setRouter(r)\n}", "title": "" }, { "docid": "855999cdaa14ae1e3ab5200022ac6d50", "score": "0.4534801", "text": "func (o *DcimPowerPortTemplatesListParams) WithNameNie(nameNie *string) *DcimPowerPortTemplatesListParams {\n\to.SetNameNie(nameNie)\n\treturn o\n}", "title": "" }, { "docid": "bdbcdd80b6581c926b4c560535b77e1c", "score": "0.45008823", "text": "func (p *QCNicProvider) CreateNicInVxnet(vxNetID string) (*pkg.HostNic, error) {\n\tinstanceID := p.Host.InstanceID\n\n\tvxNet, err := p.GetVxNet(vxNetID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinput := &service.CreateNicsInput{\n\t\tVxNet: &vxNetID,\n\t\tNICName: pkg.StringPtr(fmt.Sprintf(\"hostnic_%s\", instanceID))}\n\toutput, err := p.nicService.CreateNics(input)\n\t//TODO check too many nic in vDxnet err, and retry with another vxnet.\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif *output.RetCode == 0 && len(output.Nics) > 0 {\n\t\tnic := output.Nics[0]\n\t\thostNic := &pkg.HostNic{ID: *nic.NICID, HardwareAddr: *nic.NICID, Address: *nic.PrivateIP}\n\t\terr := p.attachNic(hostNic, instanceID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tniclink, err := pkg.LinkByMacAddr(*nic.NICID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = netlink.LinkSetDown(niclink)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\thostNic.VxNet = vxNet\n\t\treturn hostNic, nil\n\t}\n\treturn nil, fmt.Errorf(\"CreateNic output [%+v] error\", *output)\n}", "title": "" }, { "docid": "92fed6cd6209450e490416172a4b6bab", "score": "0.44924042", "text": "func (o *DcimPowerPortTemplatesListParams) SetIDn(iDn *string) {\n\to.IDn = iDn\n}", "title": "" }, { "docid": "ace706c4e3303b154db90ad17c19828e", "score": "0.44673425", "text": "func (o *DcimPowerPortTemplatesListParams) WithNameIew(nameIew *string) *DcimPowerPortTemplatesListParams {\n\to.SetNameIew(nameIew)\n\treturn o\n}", "title": "" }, { "docid": "a972571e3019cc97d60c122fd7bcbd60", "score": "0.44380596", "text": "func (o *VirtualizationInterfacesListParams) SetNameNic(nameNic *string) {\n\to.NameNic = nameNic\n}", "title": "" }, { "docid": "fe549b2c17eb4f601931a6e76601d425", "score": "0.44149268", "text": "func (c Cobbler) modifyNicForNewSystem(sysID, nicName, mac, token string) {\n\tbuf := fmt.Sprintf(modifyNicTpl, sysID, nicName, mac, token)\n\thttp.Post(c.APIURL, \"text/xml\", bytes.NewBuffer([]byte(buf)))\n}", "title": "" }, { "docid": "fed680a4f6235b9a930e3e52534e4e82", "score": "0.44074205", "text": "func (o *DcimPowerPortTemplatesListParams) WithName(name *string) *DcimPowerPortTemplatesListParams {\n\to.SetName(name)\n\treturn o\n}", "title": "" }, { "docid": "1f730cbacda8c19ee39d3df9d1d5007c", "score": "0.44069937", "text": "func (a *NicApiService) UpdateNic(ctx _context.Context, localVarOptionals *UpdateNicOpts) (UpdateNicResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue UpdateNicResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/UpdateNic\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tif localVarOptionals != nil && localVarOptionals.UpdateNicRequest.IsSet() {\n\t\tlocalVarOptionalUpdateNicRequest, localVarOptionalUpdateNicRequestok := localVarOptionals.UpdateNicRequest.Value().(UpdateNicRequest)\n\t\tif !localVarOptionalUpdateNicRequestok {\n\t\t\treturn localVarReturnValue, nil, reportError(\"updateNicRequest should be UpdateNicRequest\")\n\t\t}\n\t\tlocalVarPostBody = &localVarOptionalUpdateNicRequest\n\t}\n\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v UpdateNicResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "cda7d6693ff5ab06abdd4a2a9d3d388c", "score": "0.43981406", "text": "func (v VMNicInputDetails) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"enableAcceleratedNetworkingOnRecovery\", v.EnableAcceleratedNetworkingOnRecovery)\n\tpopulate(objectMap, \"enableAcceleratedNetworkingOnTfo\", v.EnableAcceleratedNetworkingOnTfo)\n\tpopulate(objectMap, \"ipConfigs\", v.IPConfigs)\n\tpopulate(objectMap, \"nicId\", v.NicID)\n\tpopulate(objectMap, \"recoveryNetworkSecurityGroupId\", v.RecoveryNetworkSecurityGroupID)\n\tpopulate(objectMap, \"recoveryNicName\", v.RecoveryNicName)\n\tpopulate(objectMap, \"recoveryNicResourceGroupName\", v.RecoveryNicResourceGroupName)\n\tpopulate(objectMap, \"reuseExistingNic\", v.ReuseExistingNic)\n\tpopulate(objectMap, \"selectionType\", v.SelectionType)\n\tpopulate(objectMap, \"targetNicName\", v.TargetNicName)\n\tpopulate(objectMap, \"tfoNetworkSecurityGroupId\", v.TfoNetworkSecurityGroupID)\n\tpopulate(objectMap, \"tfoNicName\", v.TfoNicName)\n\tpopulate(objectMap, \"tfoNicResourceGroupName\", v.TfoNicResourceGroupName)\n\tpopulate(objectMap, \"tfoReuseExistingNic\", v.TfoReuseExistingNic)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "81f676329a29aca75944519f41a1731f", "score": "0.43753234", "text": "func (o *DcimPowerPortTemplatesListParams) WithAllocatedDrawn(allocatedDrawn *string) *DcimPowerPortTemplatesListParams {\n\to.SetAllocatedDrawn(allocatedDrawn)\n\treturn o\n}", "title": "" }, { "docid": "b6d00f76985057faef84a902f465ebfb", "score": "0.43728742", "text": "func (v VMNicInputDetails) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"enableAcceleratedNetworkingOnRecovery\", v.EnableAcceleratedNetworkingOnRecovery)\n\tpopulate(objectMap, \"enableAcceleratedNetworkingOnTfo\", v.EnableAcceleratedNetworkingOnTfo)\n\tpopulate(objectMap, \"ipConfigs\", v.IPConfigs)\n\tpopulate(objectMap, \"nicId\", v.NicID)\n\tpopulate(objectMap, \"recoveryNetworkSecurityGroupId\", v.RecoveryNetworkSecurityGroupID)\n\tpopulate(objectMap, \"recoveryNicName\", v.RecoveryNicName)\n\tpopulate(objectMap, \"recoveryNicResourceGroupName\", v.RecoveryNicResourceGroupName)\n\tpopulate(objectMap, \"reuseExistingNic\", v.ReuseExistingNic)\n\tpopulate(objectMap, \"selectionType\", v.SelectionType)\n\tpopulate(objectMap, \"targetNicName\", v.TargetNicName)\n\tpopulate(objectMap, \"tfoNetworkSecurityGroupId\", v.TfoNetworkSecurityGroupID)\n\tpopulate(objectMap, \"tfoNicName\", v.TfoNicName)\n\tpopulate(objectMap, \"tfoNicResourceGroupName\", v.TfoNicResourceGroupName)\n\tpopulate(objectMap, \"tfoReuseExistingNic\", v.TfoReuseExistingNic)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "3f715c921c0bf0c740e0221cb05709e1", "score": "0.43338373", "text": "func (vmcnd VMwareCbtNicDetails) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif vmcnd.IsPrimaryNic != nil {\n\t\tobjectMap[\"isPrimaryNic\"] = vmcnd.IsPrimaryNic\n\t}\n\tif vmcnd.TargetIPAddress != nil {\n\t\tobjectMap[\"targetIPAddress\"] = vmcnd.TargetIPAddress\n\t}\n\tif vmcnd.TargetIPAddressType != \"\" {\n\t\tobjectMap[\"targetIPAddressType\"] = vmcnd.TargetIPAddressType\n\t}\n\tif vmcnd.TargetSubnetName != nil {\n\t\tobjectMap[\"targetSubnetName\"] = vmcnd.TargetSubnetName\n\t}\n\tif vmcnd.IsSelectedForMigration != nil {\n\t\tobjectMap[\"isSelectedForMigration\"] = vmcnd.IsSelectedForMigration\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "162e3dea1ea91a32fadae1791a0d1bd6", "score": "0.43335572", "text": "func (o *VolumeProperties) SetNicHotPlug(v bool) {\n\n\to.NicHotPlug = &v\n\n}", "title": "" }, { "docid": "d1da481dd940259223738a3b2dae006e", "score": "0.43153965", "text": "func (a *NicApiService) DeleteNic(ctx _context.Context, localVarOptionals *DeleteNicOpts) (DeleteNicResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue DeleteNicResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/DeleteNic\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tif localVarOptionals != nil && localVarOptionals.DeleteNicRequest.IsSet() {\n\t\tlocalVarOptionalDeleteNicRequest, localVarOptionalDeleteNicRequestok := localVarOptionals.DeleteNicRequest.Value().(DeleteNicRequest)\n\t\tif !localVarOptionalDeleteNicRequestok {\n\t\t\treturn localVarReturnValue, nil, reportError(\"deleteNicRequest should be DeleteNicRequest\")\n\t\t}\n\t\tlocalVarPostBody = &localVarOptionalDeleteNicRequest\n\t}\n\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v DeleteNicResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "2e1e40216bc8a36f301421d5dfdff56a", "score": "0.4311766", "text": "func (srv *Server) createNICsOnRun(instId string, instSubnet *subnet, ifacesToCreate []ec2.RunNetworkInterface) []ec2.NetworkInterface {\n\tif instSubnet == nil {\n\t\t// No subnet specified, nothing to do.\n\t\treturn nil\n\t}\n\n\tvar createdNICs []ec2.NetworkInterface\n\tfor _, ifaceToCreate := range ifacesToCreate {\n\t\tnicId := ifaceToCreate.Id\n\t\tmacAddress := fmt.Sprintf(\"20:%02x:60:cb:27:37\", srv.ifaceId.get())\n\t\tif nicId == \"\" {\n\t\t\t// Simulate a NIC got created.\n\t\t\tnicId = fmt.Sprintf(\"eni-%d\", srv.ifaceId.next())\n\t\t\tmacAddress = fmt.Sprintf(\"20:%02x:60:cb:27:37\", srv.ifaceId.get())\n\t\t}\n\t\tgroups := make([]ec2.SecurityGroup, len(ifaceToCreate.SecurityGroupIds))\n\t\tfor i, sgId := range ifaceToCreate.SecurityGroupIds {\n\t\t\tgroups[i] = srv.group(ec2.SecurityGroup{Id: sgId}).ec2SecurityGroup()\n\t\t}\n\t\t// Find the primary private IP address for the NIC\n\t\t// inside the PrivateIPs slice.\n\t\tprimaryIP := \"\"\n\t\tfor i, ip := range ifaceToCreate.PrivateIPs {\n\t\t\tif ip.IsPrimary {\n\t\t\t\tprimaryIP = ip.Address\n\t\t\t\tdnsName := srv.dnsNameFromPrivateIP(primaryIP)\n\t\t\t\tifaceToCreate.PrivateIPs[i].DNSName = dnsName\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tattach := ec2.NetworkInterfaceAttachment{\n\t\t\tId: fmt.Sprintf(\"eni-attach-%d\", srv.attachId.next()),\n\t\t\tInstanceId: instId,\n\t\t\tInstanceOwnerId: ownerId,\n\t\t\tDeviceIndex: ifaceToCreate.DeviceIndex,\n\t\t\tStatus: \"in-use\",\n\t\t\tAttachTime: time.Now().Format(time.RFC3339),\n\t\t\tDeleteOnTermination: true,\n\t\t}\n\t\tsrv.networkAttachments[attach.Id] = &interfaceAttachment{attach}\n\t\tnic := ec2.NetworkInterface{\n\t\t\tId: nicId,\n\t\t\tSubnetId: instSubnet.Id,\n\t\t\tVPCId: instSubnet.VPCId,\n\t\t\tAvailZone: instSubnet.AvailZone,\n\t\t\tDescription: ifaceToCreate.Description,\n\t\t\tOwnerId: ownerId,\n\t\t\tStatus: \"in-use\",\n\t\t\tMACAddress: macAddress,\n\t\t\tPrivateIPAddress: primaryIP,\n\t\t\tPrivateDNSName: srv.dnsNameFromPrivateIP(primaryIP),\n\t\t\tSourceDestCheck: true,\n\t\t\tGroups: groups,\n\t\t\tPrivateIPs: ifaceToCreate.PrivateIPs,\n\t\t\tAttachment: attach,\n\t\t}\n\t\tsrv.ifaces[nicId] = &iface{nic}\n\t\tcreatedNICs = append(createdNICs, nic)\n\t}\n\treturn createdNICs\n}", "title": "" }, { "docid": "832533411479e0eae88220895cee8660", "score": "0.42795506", "text": "func TestVnicContainer_GetDeviceByName(t *testing.T) {\n\tassert := assert.New(t)\n\n\tvnic1, err := NewContainerVnic(\"testvnic\")\n\tassert.Nil(err)\n\tvnic1.LinkName = \"testiface\"\n\n\terr = vnic1.Create()\n\tassert.Nil(err)\n\n\tvnic, err := NewContainerVnic(\"testvnic\")\n\tassert.Nil(err)\n\n\tassert.Nil(vnic.GetDeviceByName(\"testiface\"))\n\tperformVnicOps(true, assert, vnic)\n}", "title": "" }, { "docid": "6ae9ff9a1384ddc9464d8dce5c7d592e", "score": "0.42608845", "text": "func (o *IpamRouteTargetsListParams) WithDescriptionNic(descriptionNic *string) *IpamRouteTargetsListParams {\n\to.SetDescriptionNic(descriptionNic)\n\treturn o\n}", "title": "" }, { "docid": "dff3f0875b061d3e8413e2185c92616b", "score": "0.42461506", "text": "func (v VMwareCbtNicDetails) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"isPrimaryNic\", v.IsPrimaryNic)\n\tpopulate(objectMap, \"isSelectedForMigration\", v.IsSelectedForMigration)\n\tpopulate(objectMap, \"nicId\", v.NicID)\n\tpopulate(objectMap, \"sourceIPAddress\", v.SourceIPAddress)\n\tpopulate(objectMap, \"sourceIPAddressType\", v.SourceIPAddressType)\n\tpopulate(objectMap, \"sourceNetworkId\", v.SourceNetworkID)\n\tpopulate(objectMap, \"targetIPAddress\", v.TargetIPAddress)\n\tpopulate(objectMap, \"targetIPAddressType\", v.TargetIPAddressType)\n\tpopulate(objectMap, \"targetNicName\", v.TargetNicName)\n\tpopulate(objectMap, \"targetSubnetName\", v.TargetSubnetName)\n\tpopulate(objectMap, \"testIPAddress\", v.TestIPAddress)\n\tpopulate(objectMap, \"testIPAddressType\", v.TestIPAddressType)\n\tpopulate(objectMap, \"testNetworkId\", v.TestNetworkID)\n\tpopulate(objectMap, \"testSubnetName\", v.TestSubnetName)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "dd4015d783e0b9afdc3d5546b1ec8b19", "score": "0.42299324", "text": "func (c *Client) CreateNetworks(i string) (*CreateNetworkOutput, error) {\n\treq, err := http.NewRequest(\"POST\", fmt.Sprintf(\"%s/fmc_config/v1/domain/%s/object/networks\", c.baseURL, c.Domain), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar test CreateNetworkInput\n\t//test that the json structur is OK\n\terr = json.Unmarshal([]byte(i), &test)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error found in input '%v' failed with '%v'\", i, err)\n\t}\n\n\treq.Body = ioutil.NopCloser(strings.NewReader(i))\n\tres := CreateNetworkOutput{}\n\t// create Pointer for Network Struct\n\terr = c.sendRequest(req, &res)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed %v\", err)\n\t}\n\treturn &res, nil\n}", "title": "" }, { "docid": "3b076ff857b214a2fb89a3cf09290059", "score": "0.42285278", "text": "func (s *Server) AddNIC(ctx context.Context, req *l2API.NicRequest) (*l2API.Nic, error) {\n\tif err := s.validateAddNicRequest(req); err != nil {\n\t\treturn nil, err\n\t}\n\n\tstack, err := s.fetchStack(req.VpcId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tok, err := HasNIC(stack, req.Id)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create nic: %s\", err)\n\t} else if ok && !req.ManuallyAdded {\n\t\treturn nil, fmt.Errorf(\"NIC already exists\")\n\t}\n\n\ts.m.Lock()\n\tdefer s.m.Unlock()\n\n\tvar link netlink.Link\n\n\tif req.ManuallyAdded {\n\t\tlink, err = GetNIC(stack, req.Id)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to find nic: %s\", err)\n\t\t}\n\t\ts.stacks[req.VpcId].Nics[req.Id] = &VNic{id: req.Id, vlan: uint16(req.SubnetVlanId), link: link, manual: true}\n\t} else {\n\t\tlink, err = CreateNIC(stack, req.Id, uint16(req.SubnetVlanId))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create nic: %s\", err)\n\t\t}\n\t}\n\n\tfor _, ip := range req.Ip {\n\t\thwaddr := link.Attrs().HardwareAddr\n\t\tif req.ManuallyAdded {\n\t\t\thwaddr, _ = net.ParseMAC(req.ManualHwaddr)\n\t\t}\n\t\ts.sdn.RegisterMacIP(uint32(req.VpcId), req.SubnetVlanId, hwaddr, net.ParseIP(ip))\n\t}\n\n\t// if err := s.transport.AddVLAN(uint32(stack.VPCID), uint16(req.SubnetVlanId)); err != nil {\n\t// \tlog.Printf(\"failed to update vlan trunk: %s\", err)\n\t// }\n\n\ts.logChange(&l2API.StackChange{\n\t\tVpcId: req.VpcId,\n\t\tAction: \"nic_added\",\n\t})\n\n\treturn formatToAPINic(stack, link, req.Id), nil\n}", "title": "" }, { "docid": "202531d332e3226e1003e0fe2f4fa50f", "score": "0.4226284", "text": "func (o *IpamRouteTargetsListParams) WithNameNisw(nameNisw *string) *IpamRouteTargetsListParams {\n\to.SetNameNisw(nameNisw)\n\treturn o\n}", "title": "" }, { "docid": "6bb68abd9b5e9616b462f31dfe50f229", "score": "0.42043996", "text": "func dockerNetCreate(t *testing.T, subnet net.IPNet, gw net.IP, bridge string, subnetID string) error {\n\tassert := assert.New(t)\n\tdefer logTime(t, time.Now(), \"dockerNetCreate\")\n\tcmd := exec.Command(\"docker\", \"network\", \"create\", \"-d=ciao\",\n\t\t\"--subnet=\"+subnet.String(), \"--gateway=\"+gw.String(),\n\t\t\"--opt\", \"bridge=\"+bridge, subnetID)\n\n\tout, err := cmd.CombinedOutput()\n\tassert.Nil(err, string(out))\n\treturn err\n}", "title": "" }, { "docid": "b4b5b347c978ff79a6a799fc48e252ec", "score": "0.42023516", "text": "func initNetWork(ports []string) string {\n\texecCMD(\"docker network prune -f\")\n\n\tvar name string\n\tif ports != nil {\n\t\tname = \"docker-\" + strings.Join(ports, \"_\")\n\t\texecCMD(fmt.Sprintf(\"docker network create -d bridge %s\", name))\n\t}\n\n\treturn name\n}", "title": "" }, { "docid": "f9ac63c6f5de63d782419b6002669733", "score": "0.41959408", "text": "func (m *Machine) SetNIC(n int, nic driver.NIC) error {\n\tfmt.Println(\"Set NIC\")\n\treturn nil\n}", "title": "" }, { "docid": "13c4e81cdeb81857ce2ad292405dcf44", "score": "0.41490766", "text": "func (o *DcimPowerPortTemplatesListParams) SetNameIc(nameIc *string) {\n\to.NameIc = nameIc\n}", "title": "" }, { "docid": "8da54d99da8483439f226fe11e5c20e9", "score": "0.41451204", "text": "func (v VMNicDetails) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"enableAcceleratedNetworkingOnRecovery\", v.EnableAcceleratedNetworkingOnRecovery)\n\tpopulate(objectMap, \"enableAcceleratedNetworkingOnTfo\", v.EnableAcceleratedNetworkingOnTfo)\n\tpopulate(objectMap, \"ipConfigs\", v.IPConfigs)\n\tpopulate(objectMap, \"nicId\", v.NicID)\n\tpopulate(objectMap, \"recoveryNetworkSecurityGroupId\", v.RecoveryNetworkSecurityGroupID)\n\tpopulate(objectMap, \"recoveryNicName\", v.RecoveryNicName)\n\tpopulate(objectMap, \"recoveryNicResourceGroupName\", v.RecoveryNicResourceGroupName)\n\tpopulate(objectMap, \"recoveryVMNetworkId\", v.RecoveryVMNetworkID)\n\tpopulate(objectMap, \"replicaNicId\", v.ReplicaNicID)\n\tpopulate(objectMap, \"reuseExistingNic\", v.ReuseExistingNic)\n\tpopulate(objectMap, \"selectionType\", v.SelectionType)\n\tpopulate(objectMap, \"sourceNicArmId\", v.SourceNicArmID)\n\tpopulate(objectMap, \"targetNicName\", v.TargetNicName)\n\tpopulate(objectMap, \"tfoNetworkSecurityGroupId\", v.TfoNetworkSecurityGroupID)\n\tpopulate(objectMap, \"tfoRecoveryNicName\", v.TfoRecoveryNicName)\n\tpopulate(objectMap, \"tfoRecoveryNicResourceGroupName\", v.TfoRecoveryNicResourceGroupName)\n\tpopulate(objectMap, \"tfoReuseExistingNic\", v.TfoReuseExistingNic)\n\tpopulate(objectMap, \"tfoVMNetworkId\", v.TfoVMNetworkID)\n\tpopulate(objectMap, \"vMNetworkName\", v.VMNetworkName)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "27947aace43483a32867fae285b4202f", "score": "0.4144524", "text": "func (n *NodeService) CreateNetInterface(ctx context.Context, nodeName string, nif NetInterface) error {\n\t_, err := n.client.doPOST(ctx, \"/v1/nodes/\"+nodeName+\"/net-interfaces\", nif)\n\treturn err\n}", "title": "" }, { "docid": "a05e8f69b73db614f6302a2e8bff3c30", "score": "0.41363695", "text": "func (c *Client) ServerAddNic(serverId, netId, ip string) (err error) {\n\treturn c.changeNic(\"POST\", fmt.Sprintf(\"/v2/servers/%s/%s/networks\", c.AccountAlias, serverId), struct {\n\t\t// (Hex) ID of the network.\n\t\tNetworkId string `json:\"networkId\"`\n\n\t\t// Optional IP address for the networkId\n\t\tIpAddress string `json:\"ipAddress,omitempty\"`\n\t}{netId, ip})\n}", "title": "" }, { "docid": "54295bb989b7ce79d282113d8f4fe3b6", "score": "0.41339007", "text": "func (o *VirtualizationInterfacesListParams) WithMacAddressNic(macAddressNic *string) *VirtualizationInterfacesListParams {\n\to.SetMacAddressNic(macAddressNic)\n\treturn o\n}", "title": "" }, { "docid": "57fc3a361b4735a6a45ead4296d9cd2f", "score": "0.4116287", "text": "func (o *ListPrivateIpsParams) WithVnicID(vnicID *string) *ListPrivateIpsParams {\n\to.SetVnicID(vnicID)\n\treturn o\n}", "title": "" }, { "docid": "ead520df6856db954b36246e6c0e45c4", "score": "0.41129276", "text": "func (v VMNicDetails) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"enableAcceleratedNetworkingOnRecovery\", v.EnableAcceleratedNetworkingOnRecovery)\n\tpopulate(objectMap, \"enableAcceleratedNetworkingOnTfo\", v.EnableAcceleratedNetworkingOnTfo)\n\tpopulate(objectMap, \"ipConfigs\", v.IPConfigs)\n\tpopulate(objectMap, \"nicId\", v.NicID)\n\tpopulate(objectMap, \"recoveryNetworkSecurityGroupId\", v.RecoveryNetworkSecurityGroupID)\n\tpopulate(objectMap, \"recoveryNicName\", v.RecoveryNicName)\n\tpopulate(objectMap, \"recoveryNicResourceGroupName\", v.RecoveryNicResourceGroupName)\n\tpopulate(objectMap, \"recoveryVMNetworkId\", v.RecoveryVMNetworkID)\n\tpopulate(objectMap, \"replicaNicId\", v.ReplicaNicID)\n\tpopulate(objectMap, \"reuseExistingNic\", v.ReuseExistingNic)\n\tpopulate(objectMap, \"selectionType\", v.SelectionType)\n\tpopulate(objectMap, \"sourceNicArmId\", v.SourceNicArmID)\n\tpopulate(objectMap, \"targetNicName\", v.TargetNicName)\n\tpopulate(objectMap, \"tfoNetworkSecurityGroupId\", v.TfoNetworkSecurityGroupID)\n\tpopulate(objectMap, \"tfoRecoveryNicName\", v.TfoRecoveryNicName)\n\tpopulate(objectMap, \"tfoRecoveryNicResourceGroupName\", v.TfoRecoveryNicResourceGroupName)\n\tpopulate(objectMap, \"tfoReuseExistingNic\", v.TfoReuseExistingNic)\n\tpopulate(objectMap, \"tfoVMNetworkId\", v.TfoVMNetworkID)\n\tpopulate(objectMap, \"vMNetworkName\", v.VMNetworkName)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "fbb832bf442811ac32f71da9e872ebaa", "score": "0.41054505", "text": "func getNicInfo(vm *VM, vmMo mo.VirtualMachine) []VirtualEthernetCard {\n\tnicInfo := make([]VirtualEthernetCard, 0)\n\tif vmMo.Config == nil {\n\t\treturn nicInfo\n\t}\n\tfor _, dev := range vmMo.Config.Hardware.Device {\n\t\tvar nic VirtualEthernetCard\n\t\tc, ok := dev.(types.BaseVirtualEthernetCard)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tnwcard := c.GetVirtualEthernetCard()\n\t\tnic.MacAddress = nwcard.MacAddress\n\t\tnic.NicName = nwcard.DeviceInfo.GetDescription().Label\n\t\tnic.DeviceKey = nwcard.Key\n\t\tswitch backing := nwcard.Backing.(type) {\n\t\tcase *types.VirtualEthernetCardNetworkBackingInfo:\n\t\t\tnic.NetworkName = backing.DeviceName\n\t\tcase *types.VirtualEthernetCardDistributedVirtualPortBackingInfo:\n\t\t\tdvpMo, err := getDvpGroupName(vm, backing)\n\t\t\tif err == nil {\n\t\t\t\tnic.NetworkName = dvpMo.Name\n\t\t\t}\n\t\t}\n\t\tnicInfo = append(nicInfo, nic)\n\t}\n\n\treturn nicInfo\n}", "title": "" }, { "docid": "c376fd240b0487088f168953fcd1b450", "score": "0.4097937", "text": "func (o *IpConsumer) SetNicId(v string) {\n\to.NicId = &v\n}", "title": "" }, { "docid": "b56eda03a6a1d2915c510b4a329294bc", "score": "0.40643176", "text": "func (d *Ec2Driver) Create_Natgateway_DryRun(ctx driver.Context, params map[string]interface{}) (interface{}, error) {\n\tif _, ok := params[\"elasticip-id\"]; !ok {\n\t\treturn nil, errors.New(\"create natgateway: missing required params 'elasticip-id'\")\n\t}\n\n\tif _, ok := params[\"subnet\"]; !ok {\n\t\treturn nil, errors.New(\"create natgateway: missing required params 'subnet'\")\n\t}\n\n\td.logger.Verbose(\"params dry run: create natgateway ok\")\n\treturn fakeDryRunId(\"natgateway\"), nil\n}", "title": "" }, { "docid": "3018f230597a2643a202e7db138a6af4", "score": "0.4063481", "text": "func (o *DcimPowerPortTemplatesListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.AllocatedDraw != nil {\n\n\t\t// query param allocated_draw\n\t\tvar qrAllocatedDraw string\n\n\t\tif o.AllocatedDraw != nil {\n\t\t\tqrAllocatedDraw = *o.AllocatedDraw\n\t\t}\n\t\tqAllocatedDraw := qrAllocatedDraw\n\t\tif qAllocatedDraw != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"allocated_draw\", qAllocatedDraw); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.AllocatedDrawGt != nil {\n\n\t\t// query param allocated_draw__gt\n\t\tvar qrAllocatedDrawGt string\n\n\t\tif o.AllocatedDrawGt != nil {\n\t\t\tqrAllocatedDrawGt = *o.AllocatedDrawGt\n\t\t}\n\t\tqAllocatedDrawGt := qrAllocatedDrawGt\n\t\tif qAllocatedDrawGt != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"allocated_draw__gt\", qAllocatedDrawGt); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.AllocatedDrawGte != nil {\n\n\t\t// query param allocated_draw__gte\n\t\tvar qrAllocatedDrawGte string\n\n\t\tif o.AllocatedDrawGte != nil {\n\t\t\tqrAllocatedDrawGte = *o.AllocatedDrawGte\n\t\t}\n\t\tqAllocatedDrawGte := qrAllocatedDrawGte\n\t\tif qAllocatedDrawGte != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"allocated_draw__gte\", qAllocatedDrawGte); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.AllocatedDrawLt != nil {\n\n\t\t// query param allocated_draw__lt\n\t\tvar qrAllocatedDrawLt string\n\n\t\tif o.AllocatedDrawLt != nil {\n\t\t\tqrAllocatedDrawLt = *o.AllocatedDrawLt\n\t\t}\n\t\tqAllocatedDrawLt := qrAllocatedDrawLt\n\t\tif qAllocatedDrawLt != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"allocated_draw__lt\", qAllocatedDrawLt); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.AllocatedDrawLte != nil {\n\n\t\t// query param allocated_draw__lte\n\t\tvar qrAllocatedDrawLte string\n\n\t\tif o.AllocatedDrawLte != nil {\n\t\t\tqrAllocatedDrawLte = *o.AllocatedDrawLte\n\t\t}\n\t\tqAllocatedDrawLte := qrAllocatedDrawLte\n\t\tif qAllocatedDrawLte != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"allocated_draw__lte\", qAllocatedDrawLte); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.AllocatedDrawn != nil {\n\n\t\t// query param allocated_draw__n\n\t\tvar qrAllocatedDrawn string\n\n\t\tif o.AllocatedDrawn != nil {\n\t\t\tqrAllocatedDrawn = *o.AllocatedDrawn\n\t\t}\n\t\tqAllocatedDrawn := qrAllocatedDrawn\n\t\tif qAllocatedDrawn != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"allocated_draw__n\", qAllocatedDrawn); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Created != nil {\n\n\t\t// query param created\n\t\tvar qrCreated string\n\n\t\tif o.Created != nil {\n\t\t\tqrCreated = *o.Created\n\t\t}\n\t\tqCreated := qrCreated\n\t\tif qCreated != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"created\", qCreated); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.CreatedGte != nil {\n\n\t\t// query param created__gte\n\t\tvar qrCreatedGte string\n\n\t\tif o.CreatedGte != nil {\n\t\t\tqrCreatedGte = *o.CreatedGte\n\t\t}\n\t\tqCreatedGte := qrCreatedGte\n\t\tif qCreatedGte != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"created__gte\", qCreatedGte); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.CreatedLte != nil {\n\n\t\t// query param created__lte\n\t\tvar qrCreatedLte string\n\n\t\tif o.CreatedLte != nil {\n\t\t\tqrCreatedLte = *o.CreatedLte\n\t\t}\n\t\tqCreatedLte := qrCreatedLte\n\t\tif qCreatedLte != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"created__lte\", qCreatedLte); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.DevicetypeID != nil {\n\n\t\t// query param devicetype_id\n\t\tvar qrDevicetypeID string\n\n\t\tif o.DevicetypeID != nil {\n\t\t\tqrDevicetypeID = *o.DevicetypeID\n\t\t}\n\t\tqDevicetypeID := qrDevicetypeID\n\t\tif qDevicetypeID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"devicetype_id\", qDevicetypeID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.DevicetypeIDn != nil {\n\n\t\t// query param devicetype_id__n\n\t\tvar qrDevicetypeIDn string\n\n\t\tif o.DevicetypeIDn != nil {\n\t\t\tqrDevicetypeIDn = *o.DevicetypeIDn\n\t\t}\n\t\tqDevicetypeIDn := qrDevicetypeIDn\n\t\tif qDevicetypeIDn != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"devicetype_id__n\", qDevicetypeIDn); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ID != nil {\n\n\t\t// query param id\n\t\tvar qrID string\n\n\t\tif o.ID != nil {\n\t\t\tqrID = *o.ID\n\t\t}\n\t\tqID := qrID\n\t\tif qID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"id\", qID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.IDGt != nil {\n\n\t\t// query param id__gt\n\t\tvar qrIDGt string\n\n\t\tif o.IDGt != nil {\n\t\t\tqrIDGt = *o.IDGt\n\t\t}\n\t\tqIDGt := qrIDGt\n\t\tif qIDGt != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"id__gt\", qIDGt); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.IDGte != nil {\n\n\t\t// query param id__gte\n\t\tvar qrIDGte string\n\n\t\tif o.IDGte != nil {\n\t\t\tqrIDGte = *o.IDGte\n\t\t}\n\t\tqIDGte := qrIDGte\n\t\tif qIDGte != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"id__gte\", qIDGte); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.IDLt != nil {\n\n\t\t// query param id__lt\n\t\tvar qrIDLt string\n\n\t\tif o.IDLt != nil {\n\t\t\tqrIDLt = *o.IDLt\n\t\t}\n\t\tqIDLt := qrIDLt\n\t\tif qIDLt != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"id__lt\", qIDLt); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.IDLte != nil {\n\n\t\t// query param id__lte\n\t\tvar qrIDLte string\n\n\t\tif o.IDLte != nil {\n\t\t\tqrIDLte = *o.IDLte\n\t\t}\n\t\tqIDLte := qrIDLte\n\t\tif qIDLte != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"id__lte\", qIDLte); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.IDn != nil {\n\n\t\t// query param id__n\n\t\tvar qrIDn string\n\n\t\tif o.IDn != nil {\n\t\t\tqrIDn = *o.IDn\n\t\t}\n\t\tqIDn := qrIDn\n\t\tif qIDn != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"id__n\", qIDn); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.LastUpdated != nil {\n\n\t\t// query param last_updated\n\t\tvar qrLastUpdated string\n\n\t\tif o.LastUpdated != nil {\n\t\t\tqrLastUpdated = *o.LastUpdated\n\t\t}\n\t\tqLastUpdated := qrLastUpdated\n\t\tif qLastUpdated != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"last_updated\", qLastUpdated); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.LastUpdatedGte != nil {\n\n\t\t// query param last_updated__gte\n\t\tvar qrLastUpdatedGte string\n\n\t\tif o.LastUpdatedGte != nil {\n\t\t\tqrLastUpdatedGte = *o.LastUpdatedGte\n\t\t}\n\t\tqLastUpdatedGte := qrLastUpdatedGte\n\t\tif qLastUpdatedGte != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"last_updated__gte\", qLastUpdatedGte); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.LastUpdatedLte != nil {\n\n\t\t// query param last_updated__lte\n\t\tvar qrLastUpdatedLte string\n\n\t\tif o.LastUpdatedLte != nil {\n\t\t\tqrLastUpdatedLte = *o.LastUpdatedLte\n\t\t}\n\t\tqLastUpdatedLte := qrLastUpdatedLte\n\t\tif qLastUpdatedLte != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"last_updated__lte\", qLastUpdatedLte); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MaximumDraw != nil {\n\n\t\t// query param maximum_draw\n\t\tvar qrMaximumDraw string\n\n\t\tif o.MaximumDraw != nil {\n\t\t\tqrMaximumDraw = *o.MaximumDraw\n\t\t}\n\t\tqMaximumDraw := qrMaximumDraw\n\t\tif qMaximumDraw != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"maximum_draw\", qMaximumDraw); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MaximumDrawGt != nil {\n\n\t\t// query param maximum_draw__gt\n\t\tvar qrMaximumDrawGt string\n\n\t\tif o.MaximumDrawGt != nil {\n\t\t\tqrMaximumDrawGt = *o.MaximumDrawGt\n\t\t}\n\t\tqMaximumDrawGt := qrMaximumDrawGt\n\t\tif qMaximumDrawGt != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"maximum_draw__gt\", qMaximumDrawGt); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MaximumDrawGte != nil {\n\n\t\t// query param maximum_draw__gte\n\t\tvar qrMaximumDrawGte string\n\n\t\tif o.MaximumDrawGte != nil {\n\t\t\tqrMaximumDrawGte = *o.MaximumDrawGte\n\t\t}\n\t\tqMaximumDrawGte := qrMaximumDrawGte\n\t\tif qMaximumDrawGte != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"maximum_draw__gte\", qMaximumDrawGte); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MaximumDrawLt != nil {\n\n\t\t// query param maximum_draw__lt\n\t\tvar qrMaximumDrawLt string\n\n\t\tif o.MaximumDrawLt != nil {\n\t\t\tqrMaximumDrawLt = *o.MaximumDrawLt\n\t\t}\n\t\tqMaximumDrawLt := qrMaximumDrawLt\n\t\tif qMaximumDrawLt != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"maximum_draw__lt\", qMaximumDrawLt); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MaximumDrawLte != nil {\n\n\t\t// query param maximum_draw__lte\n\t\tvar qrMaximumDrawLte string\n\n\t\tif o.MaximumDrawLte != nil {\n\t\t\tqrMaximumDrawLte = *o.MaximumDrawLte\n\t\t}\n\t\tqMaximumDrawLte := qrMaximumDrawLte\n\t\tif qMaximumDrawLte != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"maximum_draw__lte\", qMaximumDrawLte); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.MaximumDrawn != nil {\n\n\t\t// query param maximum_draw__n\n\t\tvar qrMaximumDrawn string\n\n\t\tif o.MaximumDrawn != nil {\n\t\t\tqrMaximumDrawn = *o.MaximumDrawn\n\t\t}\n\t\tqMaximumDrawn := qrMaximumDrawn\n\t\tif qMaximumDrawn != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"maximum_draw__n\", qMaximumDrawn); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Name != nil {\n\n\t\t// query param name\n\t\tvar qrName string\n\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.NameEmpty != nil {\n\n\t\t// query param name__empty\n\t\tvar qrNameEmpty string\n\n\t\tif o.NameEmpty != nil {\n\t\t\tqrNameEmpty = *o.NameEmpty\n\t\t}\n\t\tqNameEmpty := qrNameEmpty\n\t\tif qNameEmpty != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"name__empty\", qNameEmpty); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.NameIc != nil {\n\n\t\t// query param name__ic\n\t\tvar qrNameIc string\n\n\t\tif o.NameIc != nil {\n\t\t\tqrNameIc = *o.NameIc\n\t\t}\n\t\tqNameIc := qrNameIc\n\t\tif qNameIc != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"name__ic\", qNameIc); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.NameIe != nil {\n\n\t\t// query param name__ie\n\t\tvar qrNameIe string\n\n\t\tif o.NameIe != nil {\n\t\t\tqrNameIe = *o.NameIe\n\t\t}\n\t\tqNameIe := qrNameIe\n\t\tif qNameIe != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"name__ie\", qNameIe); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.NameIew != nil {\n\n\t\t// query param name__iew\n\t\tvar qrNameIew string\n\n\t\tif o.NameIew != nil {\n\t\t\tqrNameIew = *o.NameIew\n\t\t}\n\t\tqNameIew := qrNameIew\n\t\tif qNameIew != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"name__iew\", qNameIew); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.NameIsw != nil {\n\n\t\t// query param name__isw\n\t\tvar qrNameIsw string\n\n\t\tif o.NameIsw != nil {\n\t\t\tqrNameIsw = *o.NameIsw\n\t\t}\n\t\tqNameIsw := qrNameIsw\n\t\tif qNameIsw != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"name__isw\", qNameIsw); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Namen != nil {\n\n\t\t// query param name__n\n\t\tvar qrNamen string\n\n\t\tif o.Namen != nil {\n\t\t\tqrNamen = *o.Namen\n\t\t}\n\t\tqNamen := qrNamen\n\t\tif qNamen != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"name__n\", qNamen); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.NameNic != nil {\n\n\t\t// query param name__nic\n\t\tvar qrNameNic string\n\n\t\tif o.NameNic != nil {\n\t\t\tqrNameNic = *o.NameNic\n\t\t}\n\t\tqNameNic := qrNameNic\n\t\tif qNameNic != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"name__nic\", qNameNic); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.NameNie != nil {\n\n\t\t// query param name__nie\n\t\tvar qrNameNie string\n\n\t\tif o.NameNie != nil {\n\t\t\tqrNameNie = *o.NameNie\n\t\t}\n\t\tqNameNie := qrNameNie\n\t\tif qNameNie != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"name__nie\", qNameNie); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.NameNiew != nil {\n\n\t\t// query param name__niew\n\t\tvar qrNameNiew string\n\n\t\tif o.NameNiew != nil {\n\t\t\tqrNameNiew = *o.NameNiew\n\t\t}\n\t\tqNameNiew := qrNameNiew\n\t\tif qNameNiew != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"name__niew\", qNameNiew); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.NameNisw != nil {\n\n\t\t// query param name__nisw\n\t\tvar qrNameNisw string\n\n\t\tif o.NameNisw != nil {\n\t\t\tqrNameNisw = *o.NameNisw\n\t\t}\n\t\tqNameNisw := qrNameNisw\n\t\tif qNameNisw != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"name__nisw\", qNameNisw); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Type != nil {\n\n\t\t// query param type\n\t\tvar qrType string\n\n\t\tif o.Type != nil {\n\t\t\tqrType = *o.Type\n\t\t}\n\t\tqType := qrType\n\t\tif qType != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"type\", qType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Typen != nil {\n\n\t\t// query param type__n\n\t\tvar qrTypen string\n\n\t\tif o.Typen != nil {\n\t\t\tqrTypen = *o.Typen\n\t\t}\n\t\tqTypen := qrTypen\n\t\tif qTypen != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"type__n\", qTypen); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bd4e18c6ba05d22b40706b93f11f608b", "score": "0.40531704", "text": "func (m *MCIRApi) CreateSpecWithSpecNameByParam(req *TbSpecCreateRequest) (string, error) {\n\tif m.requestMCIR == nil {\n\t\treturn \"\", errors.New(\"The Open() function must be called\")\n\t}\n\n\tholdType, _ := m.GetInType()\n\tm.SetInType(\"json\")\n\tj, err := json.Marshal(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tm.requestMCIR.InData = string(j)\n\tresult, err := m.requestMCIR.CreateSpecWithSpecName()\n\tm.SetInType(holdType)\n\n\treturn result, err\n}", "title": "" }, { "docid": "a9f6b0869bf0c5c398821d4b59b50160", "score": "0.40498418", "text": "func (o *DcimPowerPortTemplatesListParams) SetNameIe(nameIe *string) {\n\to.NameIe = nameIe\n}", "title": "" }, { "docid": "d9ba20c9664e4eeec7b40baad3bdcadb", "score": "0.40418386", "text": "func SetUsersViaUserNicename(iUserNicename string, users *Users) (int64, error) {\n\tusers.UserNicename = iUserNicename\n\treturn Engine.Insert(users)\n}", "title": "" }, { "docid": "91ef11a2b9fc6419002430bbd3010508", "score": "0.4038303", "text": "func (ag *NMD) CreateSmartNIC(n *cmd.DistributedServiceCard) error {\n\tag.Lock()\n\tdefer ag.Unlock()\n\tag.NicAdded[objectKey(n.ObjectMeta)] = n\n\treturn nil\n}", "title": "" }, { "docid": "bd951c11aae7052da967e4ae3771e802", "score": "0.40273646", "text": "func TestVnic_GetDeviceByName(t *testing.T) {\n\tassert := assert.New(t)\n\tvnic1, _ := NewVnic(\"testvnic\")\n\tvnic1.LinkName = \"testiface\"\n\n\tassert.Nil(vnic1.Create())\n\tvnic, _ := NewVnic(\"testvnic\")\n\n\tassert.Nil(vnic.GetDeviceByName(\"testiface\"))\n\tassert.NotEqual(vnic.InterfaceName(), \"\")\n\tassert.Equal(vnic.InterfaceName(), vnic1.InterfaceName())\n\tassert.NotEqual(vnic1.PeerName(), \"\")\n\tassert.Equal(vnic1.PeerName(), vnic.PeerName())\n\n\tperformVnicOps(true, assert, vnic)\n}", "title": "" }, { "docid": "42a8546e8bbc0509a1b2ec25868a8afd", "score": "0.402697", "text": "func (o *DcimPowerPortTemplatesListParams) SetNameIsw(nameIsw *string) {\n\to.NameIsw = nameIsw\n}", "title": "" }, { "docid": "945f45a29697412e5e98573e798be587", "score": "0.40266657", "text": "func (o *DcimPowerPortTemplatesListParams) WithAllocatedDraw(allocatedDraw *string) *DcimPowerPortTemplatesListParams {\n\to.SetAllocatedDraw(allocatedDraw)\n\treturn o\n}", "title": "" }, { "docid": "f196aeb0dc449220725a58f96c932567", "score": "0.4025048", "text": "func CreateNetwork(driver, subnet, name string) error {\n\t_, ipNet, err := net.ParseCIDR(subnet)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"fail to parse cidr ip address %s : %v\", subnet, err)\n\t}\n\tip, err := ipAllocator.Allocate(ipNet)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"fail to allocate cidr ip address %s : %v\", subnet, err)\n\t}\n\tipNet.IP = ip\n\tnw, err := drivers[driver].Create(ipNet.String(), name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"fail to create network for cidr ip address %s : %v\", subnet, err)\n\t}\n\treturn nw.dump(defaultNetworkPath)\n}", "title": "" }, { "docid": "23cac604c7b104fea465e98982a7f93f", "score": "0.4020161", "text": "func (cli *NetworkCli) CmdNetworkCreate(chain string, args ...string) error {\n\tcmd := cli.Subcmd(chain, \"create\", \"NETWORK-NAME\", \"Creates a new network with a name specified by the user\", false)\n\tflDriver := cmd.String([]string{\"d\", \"-driver\"}, \"\", \"Driver to manage the Network\")\n\tflID := cmd.String([]string{\"-id\"}, \"\", \"Network ID string\")\n\tflOpts := cmd.String([]string{\"o\", \"-opt\"}, \"\", \"Network options\")\n\tflInternal := cmd.Bool([]string{\"-internal\"}, false, \"Config the network to be internal\")\n\tflIPv6 := cmd.Bool([]string{\"-ipv6\"}, false, \"Enable IPv6 on the network\")\n\tflSubnet := cmd.String([]string{\"-subnet\"}, \"\", \"Subnet option\")\n\tflRange := cmd.String([]string{\"-ip-range\"}, \"\", \"Range option\")\n\n\tcmd.Require(flag.Exact, 1)\n\terr := cmd.ParseFlags(args, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tnetworkOpts := make(map[string]string)\n\tif *flInternal {\n\t\tnetworkOpts[netlabel.Internal] = \"true\"\n\t}\n\tif *flIPv6 {\n\t\tnetworkOpts[netlabel.EnableIPv6] = \"true\"\n\t}\n\n\tdriverOpts := make(map[string]string)\n\tif *flOpts != \"\" {\n\t\topts := strings.Split(*flOpts, \",\")\n\t\tfor _, opt := range opts {\n\t\t\tdriverOpts[netlabel.Key(opt)] = netlabel.Value(opt)\n\t\t}\n\t}\n\n\tvar icList []ipamConf\n\tif *flSubnet != \"\" {\n\t\tic := ipamConf{\n\t\t\tPreferredPool: *flSubnet,\n\t\t}\n\n\t\tif *flRange != \"\" {\n\t\t\tic.SubPool = *flRange\n\t\t}\n\n\t\ticList = append(icList, ic)\n\t}\n\n\t// Construct network create request body\n\tnc := networkCreate{Name: cmd.Arg(0), NetworkType: *flDriver, ID: *flID, IPv4Conf: icList, DriverOpts: driverOpts, NetworkOpts: networkOpts}\n\tobj, _, err := readBody(cli.call(\"POST\", \"/networks\", nc, nil))\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar replyID string\n\terr = json.Unmarshal(obj, &replyID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Fprintf(cli.out, \"%s\\n\", replyID)\n\treturn nil\n}", "title": "" }, { "docid": "a749ef1e7c6d52b574b38e0d4e87556f", "score": "0.40088966", "text": "func (ag *NMD) SetSmartNIC(nic *cmd.DistributedServiceCard) error {\n\tag.Lock()\n\tdefer ag.Unlock()\n\tag.Nic = nic\n\treturn nil\n}", "title": "" }, { "docid": "a27f202c63bb1fceadc7d4db5377196f", "score": "0.39936498", "text": "func (client *Client) PrintByTemplateWithOptions(request *PrintByTemplateRequest, runtime *util.RuntimeOptions) (_result *PrintByTemplateResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tbody := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.DeviceName)) {\n\t\tbody[\"DeviceName\"] = request.DeviceName\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.HistoryPrintTopic)) {\n\t\tbody[\"HistoryPrintTopic\"] = request.HistoryPrintTopic\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.IotId)) {\n\t\tbody[\"IotId\"] = request.IotId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.IotInstanceId)) {\n\t\tbody[\"IotInstanceId\"] = request.IotInstanceId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ParamsJsonString)) {\n\t\tbody[\"ParamsJsonString\"] = request.ParamsJsonString\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ProductKey)) {\n\t\tbody[\"ProductKey\"] = request.ProductKey\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.TemplateBizCode)) {\n\t\tbody[\"TemplateBizCode\"] = request.TemplateBizCode\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tBody: openapiutil.ParseToMap(body),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"PrintByTemplate\"),\n\t\tVersion: tea.String(\"2018-01-20\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &PrintByTemplateResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "title": "" }, { "docid": "310bfea175268dde1fc2aba3a2c048bb", "score": "0.39814842", "text": "func (o *VirtualizationInterfacesListParams) SetMacAddressNic(macAddressNic *string) {\n\to.MacAddressNic = macAddressNic\n}", "title": "" }, { "docid": "8728641b3099b7a900c12dcb4dce6d7f", "score": "0.39809197", "text": "func (d *HostNicDriver) ensureNic(nic *HostNic) bool {\n\texistNic := d.findNicFromInterfaces(nic.HardwareAddr)\n\tif existNic == nil {\n\t\texistNic = d.findNicFromLinks(nic.HardwareAddr)\n\t}\n\tif existNic != nil {\n\t\t// nic dev name may be changed by os, so ensure it is update.\n\t\tnic.Name = existNic.Name\n\t}\n\treturn existNic != nil\n}", "title": "" }, { "docid": "e1a21f3412c56f3646bfe50a1be4e934", "score": "0.39657974", "text": "func (o *VirtualizationInterfacesListParams) WithIDn(iDn *string) *VirtualizationInterfacesListParams {\n\to.SetIDn(iDn)\n\treturn o\n}", "title": "" }, { "docid": "168b67753817904edc57fcbb9fb5f93a", "score": "0.39624828", "text": "func (o *VirtualizationInterfacesListParams) SetNameNisw(nameNisw *string) {\n\to.NameNisw = nameNisw\n}", "title": "" }, { "docid": "e5ed50e34c056371a96d8ce21c3f1b74", "score": "0.39613795", "text": "func (o *VolumeProperties) SetNicHotUnplug(v bool) {\n\n\to.NicHotUnplug = &v\n\n}", "title": "" }, { "docid": "dec3c6ae71f45b3dc91f1470ecfaf43a", "score": "0.39598352", "text": "func (a *NicApiService) ReadNics(ctx _context.Context, localVarOptionals *ReadNicsOpts) (ReadNicsResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue ReadNicsResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/ReadNics\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tif localVarOptionals != nil && localVarOptionals.ReadNicsRequest.IsSet() {\n\t\tlocalVarOptionalReadNicsRequest, localVarOptionalReadNicsRequestok := localVarOptionals.ReadNicsRequest.Value().(ReadNicsRequest)\n\t\tif !localVarOptionalReadNicsRequestok {\n\t\t\treturn localVarReturnValue, nil, reportError(\"readNicsRequest should be ReadNicsRequest\")\n\t\t}\n\t\tlocalVarPostBody = &localVarOptionalReadNicsRequest\n\t}\n\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v ReadNicsResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "fcc98eae1e6b3d00a6231207effce22b", "score": "0.39577028", "text": "func CreateNetwork(cli *client.Client, networkName, subnet, iprange, gateway string) (string, error) {\n\tctx := context.Background()\n\n\tcommon.DebugMessage(\"Creating options\")\n\topts := types.NetworkCreate{\n\t\tCheckDuplicate: true,\n\t\tDriver: \"bridge\",\n\t\tIPAM: &network.IPAM{\n\t\t\t//\t\t\tDriver: \"bridge\",\n\t\t\tOptions: make(map[string]string),\n\t\t\tConfig: []network.IPAMConfig{\n\t\t\t\tnetwork.IPAMConfig{\n\t\t\t\t\tSubnet: subnet,\n\t\t\t\t\tIPRange: iprange,\n\t\t\t\t\tGateway: gateway,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tcommon.DebugMessage(\"Creating network\")\n\tnetresp, err := cli.NetworkCreate(ctx, networkName, opts)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcommon.DebugMessage(\"ID: \" + netresp.ID)\n\tif netresp.Warning != \"\" {\n\t\tcommon.DebugMessage(\"Warning: \" + netresp.Warning)\n\t}\n\n\treturn netresp.ID, err\n}", "title": "" }, { "docid": "27d701e10c083faa1c4946a53b0880b9", "score": "0.3957557", "text": "func (o *IpamRouteTargetsListParams) SetDescriptionNic(descriptionNic *string) {\n\to.DescriptionNic = descriptionNic\n}", "title": "" }, { "docid": "5d75dd0ae600ca03b96dfe8e9fd80ace", "score": "0.3956445", "text": "func (c *DockerRuntime) CreateNet(ctx context.Context) (err error) {\n\tnctx, cancel := context.WithTimeout(ctx, c.config.Timeout)\n\tdefer cancel()\n\n\t// linux bridge name that is used by docker network\n\tbridgeName := c.Mgmt.Bridge\n\n\tlog.Debugf(\"Checking if docker network '%s' exists\", c.Mgmt.Network)\n\tnetResource, err := c.Client.NetworkInspect(nctx, c.Mgmt.Network, dockerTypes.NetworkInspectOptions{})\n\tswitch {\n\tcase dockerC.IsErrNotFound(err):\n\t\tlog.Debugf(\"Network '%s' does not exist\", c.Mgmt.Network)\n\t\tlog.Infof(\"Creating docker network: Name='%s', IPv4Subnet='%s', IPv6Subnet='%s', MTU='%s'\",\n\t\t\tc.Mgmt.Network, c.Mgmt.IPv4Subnet, c.Mgmt.IPv6Subnet, c.Mgmt.MTU)\n\n\t\tenableIPv6 := false\n\t\tvar ipamConfig []network.IPAMConfig\n\t\tif c.Mgmt.IPv4Subnet != \"\" {\n\t\t\tipamConfig = append(ipamConfig, network.IPAMConfig{\n\t\t\t\tSubnet: c.Mgmt.IPv4Subnet,\n\t\t\t})\n\t\t}\n\t\tif c.Mgmt.IPv6Subnet != \"\" {\n\t\t\tipamConfig = append(ipamConfig, network.IPAMConfig{\n\t\t\t\tSubnet: c.Mgmt.IPv6Subnet,\n\t\t\t})\n\t\t\tenableIPv6 = true\n\t\t}\n\n\t\tipam := &network.IPAM{\n\t\t\tDriver: \"default\",\n\t\t\tConfig: ipamConfig,\n\t\t}\n\n\t\tnetwOpts := map[string]string{\n\t\t\t\"com.docker.network.driver.mtu\": c.Mgmt.MTU,\n\t\t}\n\n\t\tif bridgeName != \"\" {\n\t\t\tnetwOpts[\"com.docker.network.bridge.name\"] = bridgeName\n\t\t}\n\n\t\topts := dockerTypes.NetworkCreate{\n\t\t\tCheckDuplicate: true,\n\t\t\tDriver: \"bridge\",\n\t\t\tEnableIPv6: enableIPv6,\n\t\t\tIPAM: ipam,\n\t\t\tInternal: false,\n\t\t\tAttachable: false,\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"containerlab\": \"\",\n\t\t\t},\n\t\t\tOptions: netwOpts,\n\t\t}\n\n\t\tnetCreateResponse, err := c.Client.NetworkCreate(nctx, c.Mgmt.Network, opts)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(netCreateResponse.ID) < 12 {\n\t\t\treturn fmt.Errorf(\"could not get bridge ID\")\n\t\t}\n\t\t// when bridge is not set by a user explicitly\n\t\t// we use the 12 chars of docker net as its name\n\t\tif bridgeName == \"\" {\n\t\t\tbridgeName = \"br-\" + netCreateResponse.ID[:12]\n\t\t}\n\n\tcase err == nil:\n\t\tlog.Debugf(\"network '%s' was found. Reusing it...\", c.Mgmt.Network)\n\t\tif len(netResource.ID) < 12 {\n\t\t\treturn fmt.Errorf(\"could not get bridge ID\")\n\t\t}\n\t\tswitch c.Mgmt.Network {\n\t\tcase \"bridge\":\n\t\t\tbridgeName = \"docker0\"\n\t\tdefault:\n\t\t\tif netResource.Options[\"com.docker.network.bridge.name\"] != \"\" {\n\t\t\t\tbridgeName = netResource.Options[\"com.docker.network.bridge.name\"]\n\t\t\t} else {\n\t\t\t\tbridgeName = \"br-\" + netResource.ID[:12]\n\t\t\t}\n\t\t}\n\n\tdefault:\n\t\treturn err\n\t}\n\n\tif c.Mgmt.Bridge == \"\" {\n\t\tc.Mgmt.Bridge = bridgeName\n\t}\n\n\tlog.Debugf(\"Docker network '%s', bridge name '%s'\", c.Mgmt.Network, bridgeName)\n\n\tlog.Debug(\"Disable RPF check on the docker host\")\n\terr = setSysctl(\"net/ipv4/conf/all/rp_filter\", 0)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to disable RP filter on docker host for the 'all' scope: %v\", err)\n\t}\n\terr = setSysctl(\"net/ipv4/conf/default/rp_filter\", 0)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to disable RP filter on docker host for the 'default' scope: %v\", err)\n\t}\n\n\tlog.Debugf(\"Enable LLDP on the linux bridge %s\", bridgeName)\n\tfile := \"/sys/class/net/\" + bridgeName + \"/bridge/group_fwd_mask\"\n\n\terr = ioutil.WriteFile(file, []byte(strconv.Itoa(16384)), 0640)\n\tif err != nil {\n\t\tlog.Warnf(\"failed to enable LLDP on docker bridge: %v\", err)\n\t}\n\n\tlog.Debugf(\"Disabling TX checksum offloading for the %s bridge interface...\", bridgeName)\n\terr = utils.EthtoolTXOff(bridgeName)\n\tif err != nil {\n\t\tlog.Warnf(\"failed to disable TX checksum offloading for the %s bridge interface: %v\", bridgeName, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "88481aef556beefca97215ce46ca5b2d", "score": "0.3952942", "text": "func (o *VirtualizationInterfacesListParams) WithNameNiew(nameNiew *string) *VirtualizationInterfacesListParams {\n\to.SetNameNiew(nameNiew)\n\treturn o\n}", "title": "" }, { "docid": "53a11a38f431cc47253ae836e525e610", "score": "0.39267132", "text": "func (s *Server) DeleteNIC(ctx context.Context, req *l2API.Nic) (*l2API.Empty, error) {\n\tif req.VpcId > 16777215 || req.VpcId == 0 {\n\t\treturn nil, fmt.Errorf(\"VPC ID out of range\")\n\t}\n\n\tif req.Vlan == 0 {\n\t\treturn nil, fmt.Errorf(\"vlan must be set and non-zero\")\n\t}\n\n\tstack, err := s.fetchStack(req.VpcId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tok, err := HasNIC(stack, req.Id)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create nic: %s\", err)\n\t} else if !ok {\n\t\treturn nil, fmt.Errorf(\"NIC does not exist: %s\", req.Id)\n\t}\n\n\tlink, _ := GetNIC(stack, req.Id)\n\n\tfor _, ip := range req.Ip {\n\t\tif err := s.sdn.DeregisterMacIP(uint32(req.VpcId), req.Vlan, link.Attrs().HardwareAddr, net.ParseIP(ip)); err != nil {\n\t\t\tlog.Printf(\"Failed to deregister NIC: %s\", err)\n\t\t}\n\t}\n\n\ts.m.Lock()\n\tdefer s.m.Unlock()\n\n\tnic, ok := stack.Nics[req.Id]\n\n\t// if err := s.transport.DelVLAN(uint32(stack.VPCID), nic.vlan); err != nil {\n\t// \tlog.Printf(\"failed to update vlan trunk: %s\", err)\n\t// }\n\n\tif ok && !nic.manual {\n\t\terr = DeleteNIC(stack, req.Id)\n\t} else if ok {\n\t\tdelete(stack.Nics, req.Id)\n\t}\n\n\ts.logChange(&l2API.StackChange{\n\t\tVpcId: req.VpcId,\n\t\tAction: \"nic_deleted\",\n\t})\n\n\treturn &l2API.Empty{}, err\n}", "title": "" }, { "docid": "6ef6f30a192fa376d846f00fd7cf3dbd", "score": "0.3922947", "text": "func (srv *Server) addDefaultNIC(instSubnet *subnet) []ec2.RunNetworkInterface {\n\tif instSubnet == nil {\n\t\t// No subnet specified, nothing to do.\n\t\treturn nil\n\t}\n\n\tip, ipnet, err := net.ParseCIDR(instSubnet.CIDRBlock)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"subnet %q has invalid CIDR: %v\", instSubnet.Id, err.Error()))\n\t}\n\t// Just pick a valid subnet IP, it doesn't have to be unique\n\t// across instances, as this is a testing server.\n\tip[len(ip)-1] = 5\n\tif !ipnet.Contains(ip) {\n\t\tpanic(fmt.Sprintf(\"%q does not contain IP %q\", instSubnet.Id, ip))\n\t}\n\treturn []ec2.RunNetworkInterface{{\n\t\tId: fmt.Sprintf(\"eni-%d\", srv.ifaceId.next()),\n\t\tDeviceIndex: 0,\n\t\tDescription: \"created by ec2test server\",\n\t\tDeleteOnTermination: true,\n\t\tPrivateIPs: []ec2.PrivateIP{{\n\t\t\tAddress: ip.String(),\n\t\t\tDNSName: srv.dnsNameFromPrivateIP(ip.String()),\n\t\t\tIsPrimary: true,\n\t\t}},\n\t}}\n}", "title": "" }, { "docid": "17456edc8293970415dfd0f0af87e489", "score": "0.39074674", "text": "func (o *DcimPowerPortTemplatesListParams) SetNamen(namen *string) {\n\to.Namen = namen\n}", "title": "" }, { "docid": "911587073549fb23aab74b23b3b9e2bf", "score": "0.39070708", "text": "func (api *API) createIPFSNetwork(c *gin.Context) {\n\tif !dev {\n\t\tFail(c, errors.New(\"private networks not supported in production, please use https://dev.api.temporal.cloud\"))\n\t\treturn\n\t}\n\tusername, err := GetAuthenticatedUserFromContext(c)\n\tif err != nil {\n\t\tapi.LogError(c, err, eh.NoAPITokenError)(http.StatusBadRequest)\n\t\treturn\n\t}\n\t// extract network name\n\tnetworkName, exists := c.GetPostForm(\"network_name\")\n\tif !exists {\n\t\tFailWithMissingField(c, \"network_name\")\n\t\treturn\n\t}\n\t// make sure the name is something other than public\n\tif strings.ToLower(networkName) == \"public\" {\n\t\tFail(c, errors.New(\"network name can't be public, or PUBLIC\"))\n\t}\n\t// retrieve parameters - thse are all optional\n\tswarmKey, _ := c.GetPostForm(\"swarm_key\")\n\tbPeers, _ := c.GetPostFormArray(\"bootstrap_peers\")\n\tusers := c.PostFormArray(\"users\")\n\tif users == nil {\n\t\tusers = []string{username}\n\t} else {\n\t\tusers = append(users, username)\n\t}\n\t// create the network in our database\n\tnetwork, err := api.nm.CreateHostedPrivateNetwork(networkName, swarmKey, bPeers, models.NetworkAccessOptions{Users: users, Owner: username})\n\tif err != nil {\n\t\tapi.LogError(c, err, eh.NetworkCreationError)(http.StatusBadRequest)\n\t\treturn\n\t}\n\t// request orchestrator to start up network and create it after registering it in the database\n\tresp, err := api.orch.StartNetwork(c, &nexus.NetworkRequest{\n\t\tNetwork: networkName,\n\t})\n\tif err != nil {\n\t\tapi.LogError(c, err, \"failed to start private network\",\n\t\t\t\"network_name\", networkName,\n\t\t)(http.StatusBadRequest)\n\t\treturn\n\t}\n\tlogger := api.l.With(\"user\", username, \"network_name\", networkName)\n\tlogger.Info(\"network creation request received\")\n\tlogger.With(\"db_id\", network.ID).Info(\"database entry created\")\n\t// update allows users who can access the network\n\tif len(users) > 0 {\n\t\tfor _, v := range users {\n\t\t\tif err := api.um.AddIPFSNetworkForUser(v, networkName); err != nil && err.Error() != \"network already configured for user\" {\n\t\t\t\tapi.LogError(c, err, eh.NetworkCreationError)(http.StatusBadRequest)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tapi.l.With(\"user\", v).Info(\"network added to user)\")\n\t\t}\n\t}\n\tapi.l.With(\"response\", resp).Info(\"network node started\")\n\t// respond with network details\n\tRespond(c, http.StatusOK, gin.H{\n\t\t\"response\": gin.H{\n\t\t\t\"id\": network.ID,\n\t\t\t\"peer_id\": resp.GetPeerId(),\n\t\t\t\"network_name\": networkName,\n\t\t\t\"swarm_key\": resp.GetSwarmKey(),\n\t\t\t\"users\": network.Users,\n\t\t},\n\t})\n}", "title": "" }, { "docid": "87563535129c74c4e6e4d32db0672c3a", "score": "0.39029163", "text": "func (m *CreateSpecType) GetNetworkCfgChoiceDRefInfo() ([]db.DRefInfo, error) {\n\tif m.GetNetworkCfgChoice() == nil {\n\t\treturn nil, nil\n\t}\n\tswitch m.GetNetworkCfgChoice().(type) {\n\tcase *CreateSpecType_DefaultNetworkConfig:\n\n\t\treturn nil, nil\n\n\tcase *CreateSpecType_CustomNetworkConfig:\n\t\tdrInfos, err := m.GetCustomNetworkConfig().GetDRefInfo()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"GetCustomNetworkConfig().GetDRefInfo() FAILED\")\n\t\t}\n\t\tfor i := range drInfos {\n\t\t\tdri := &drInfos[i]\n\t\t\tdri.DRField = \"custom_network_config.\" + dri.DRField\n\t\t}\n\t\treturn drInfos, err\n\n\tdefault:\n\t\treturn nil, nil\n\t}\n\n}", "title": "" }, { "docid": "27600cfa04cd94ce0c384ee9b59d0e95", "score": "0.38968197", "text": "func (o *DcimPowerPortTemplatesListParams) WithTimeout(timeout time.Duration) *DcimPowerPortTemplatesListParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "95f16355ecd9d472bd454676d5af2b36", "score": "0.38891536", "text": "func NetworkName(nif string) string {\n\tif nif == \"\" {\n\t\tnif = C.GoString(C.guessWifiInterfaceName())\n\t}\n\n\tif nif == \"\" {\n\t\tlog.Debug(\"Could not find Wi-Fi network interface\")\n\t\treturn \"\"\n\t}\n\n\tactive := C.getWifiActive(C.CString(nif))\n\tpowerOn := C.getWifiPowerOn(C.CString(nif))\n\n\tif !active {\n\t\tlog.Debug(\"Wi-Fi network interface is not active\")\n\t\treturn \"\"\n\t}\n\n\tif !powerOn {\n\t\tlog.Debug(\"Wi-Fi network interface is not powered on\")\n\t\treturn \"\"\n\t}\n\n\tssid := C.GoString(C.getWifiSSID(C.CString(nif)))\n\n\tif ssid == \"\" {\n\t\tlog.Error(\"Wi-Fi network interface ssid empty\")\n\t}\n\n\treturn ssid\n}", "title": "" }, { "docid": "dda9ecbddf31c6126fea479df9e2e198", "score": "0.3882435", "text": "func (m *StaticIPParametersType) GetNetworkPrefixChoiceDRefInfo() ([]db.DRefInfo, error) {\n\tif m.GetNetworkPrefixChoice() == nil {\n\t\treturn nil, nil\n\t}\n\tswitch m.GetNetworkPrefixChoice().(type) {\n\tcase *StaticIPParametersType_NodeStaticIp:\n\n\t\treturn nil, nil\n\n\tcase *StaticIPParametersType_ClusterStaticIp:\n\n\t\treturn nil, nil\n\n\tcase *StaticIPParametersType_FleetStaticIp:\n\t\tdrInfos, err := m.GetFleetStaticIp().GetDRefInfo()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"GetFleetStaticIp().GetDRefInfo() FAILED\")\n\t\t}\n\t\tfor i := range drInfos {\n\t\t\tdri := &drInfos[i]\n\t\t\tdri.DRField = \"fleet_static_ip.\" + dri.DRField\n\t\t}\n\t\treturn drInfos, err\n\n\tdefault:\n\t\treturn nil, nil\n\t}\n\n}", "title": "" }, { "docid": "8f55e268b36e2245402deebbaabe35d4", "score": "0.3882289", "text": "func nic_path(dcid, srvid, nicid string) string {\n\treturn nic_col_path(dcid, srvid) + slash(nicid)\n}", "title": "" }, { "docid": "2efdf7fca599aebf6ac212ae00ebc52a", "score": "0.3875818", "text": "func NSGWirelessPort(nsPortCfg map[string]interface{}, parent *vspk.NSGateway) *vspk.WirelessPort {\n\n\tnsPorts, err := parent.WirelessPorts(&bambou.FetchingInfo{\n\t\tFilter: nsPortCfg[\"Name\"].(string)})\n\thandleError(err, \"READ\", \"Wireless Port\")\n\n\t// init the nsPort struct that will hold either the received object\n\t// or will be created from the nsPortCfg\n\tnsPort := &vspk.WirelessPort{}\n\n\tif nsPorts != nil {\n\t\tlog.Infof(\"Wireless Port already exists\")\n\n\t\tnsPort = nsPorts[0]\n\t\terrMergo := mergo.Map(nsPort, nsPortCfg, mergo.WithOverride)\n\t\tif errMergo != nil {\n\t\t\tlog.Fatal(errMergo)\n\t\t}\n\n\t\tnsPort.Save()\n\t} else {\n\t\terrMergo := mergo.Map(nsPort, nsPortCfg, mergo.WithOverride)\n\t\tif errMergo != nil {\n\t\t\tlog.Fatal(errMergo)\n\t\t}\n\t\terr := parent.CreateWirelessPort(nsPort)\n\t\thandleError(err, \"CREATE\", \"Wireless Port \")\n\n\t\tlog.Infof(\"Wireless Port created\")\n\t}\n\n\tlog.Infof(\"%#v \\n\", nsPort)\n\treturn nsPort\n}", "title": "" }, { "docid": "b40086ee3b5b2660141e9497bdf84f5f", "score": "0.3867321", "text": "func (v *VMwareCbtNicInput) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"isPrimaryNic\":\n\t\t\terr = unpopulate(val, \"IsPrimaryNic\", &v.IsPrimaryNic)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"isSelectedForMigration\":\n\t\t\terr = unpopulate(val, \"IsSelectedForMigration\", &v.IsSelectedForMigration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"nicId\":\n\t\t\terr = unpopulate(val, \"NicID\", &v.NicID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"targetNicName\":\n\t\t\terr = unpopulate(val, \"TargetNicName\", &v.TargetNicName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"targetStaticIPAddress\":\n\t\t\terr = unpopulate(val, \"TargetStaticIPAddress\", &v.TargetStaticIPAddress)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"targetSubnetName\":\n\t\t\terr = unpopulate(val, \"TargetSubnetName\", &v.TargetSubnetName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"testStaticIPAddress\":\n\t\t\terr = unpopulate(val, \"TestStaticIPAddress\", &v.TestStaticIPAddress)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"testSubnetName\":\n\t\t\terr = unpopulate(val, \"TestSubnetName\", &v.TestSubnetName)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "094eb3fa73a09945fea4b61331b6ce4c", "score": "0.3867287", "text": "func (client *Client) CreateNatIpWithOptions(request *CreateNatIpRequest, runtime *util.RuntimeOptions) (_result *CreateNatIpResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.ClientToken)) {\n\t\tquery[\"ClientToken\"] = request.ClientToken\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.DryRun)) {\n\t\tquery[\"DryRun\"] = request.DryRun\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.NatGatewayId)) {\n\t\tquery[\"NatGatewayId\"] = request.NatGatewayId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.NatIp)) {\n\t\tquery[\"NatIp\"] = request.NatIp\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.NatIpCidr)) {\n\t\tquery[\"NatIpCidr\"] = request.NatIpCidr\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.NatIpDescription)) {\n\t\tquery[\"NatIpDescription\"] = request.NatIpDescription\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.NatIpName)) {\n\t\tquery[\"NatIpName\"] = request.NatIpName\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerAccount)) {\n\t\tquery[\"OwnerAccount\"] = request.OwnerAccount\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerId)) {\n\t\tquery[\"OwnerId\"] = request.OwnerId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.RegionId)) {\n\t\tquery[\"RegionId\"] = request.RegionId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.RegionId)) {\n\t\tquery[\"RegionId\"] = request.RegionId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerAccount)) {\n\t\tquery[\"ResourceOwnerAccount\"] = request.ResourceOwnerAccount\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerId)) {\n\t\tquery[\"ResourceOwnerId\"] = request.ResourceOwnerId\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"CreateNatIp\"),\n\t\tVersion: tea.String(\"2016-04-28\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &CreateNatIpResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "title": "" }, { "docid": "2eda45bbac2496448b6036452e97c5c4", "score": "0.38569334", "text": "func (client *Client) addNicToServer(serverID string, nicConfiguration *serverNic) (nicID string, err error) {\n\tif nicConfiguration == nil {\n\t\treturn \"\", fmt.Errorf(\"Must supply a valid server NIC configuration\")\n\t}\n\n\t// Don't submit VLAN ID to CloudControl when IPv4 address has been supplied (one implies the other)\n\tif nicConfiguration.PrivateIPv4 != \"\" {\n\t\tnicConfiguration.VlanID = \"\"\n\t}\n\n\torganizationID, err := client.getOrganizationID()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\trequestURI := fmt.Sprintf(\"%s/server/addNic\",\n\t\turl.QueryEscape(organizationID),\n\t)\n\trequest, err := client.newRequestV29(requestURI, http.MethodPost, &addNicConfiguration{\n\t\tServerID: serverID,\n\t\tNic: *nicConfiguration,\n\t})\n\tresponseBody, statusCode, err := client.executeRequest(request)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tapiResponse, err := readAPIResponseAsJSON(responseBody, statusCode)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif apiResponse.ResponseCode != ResponseCodeInProgress {\n\t\treturn \"\", apiResponse.ToError(\"Request to notify add a nic failed with unexpected status code %d (%s): %s\", statusCode, apiResponse.ResponseCode, apiResponse.Message)\n\t}\n\tnicIDMessage := apiResponse.GetFieldMessage(\"nicId\")\n\tif nicIDMessage == nil {\n\t\treturn \"\", apiResponse.ToError(\"Received an unexpected response (missing 'nicId') with status code %d (%s): %s\", statusCode, apiResponse.ResponseCode, apiResponse.Message)\n\t}\n\treturn *nicIDMessage, nil\n}", "title": "" }, { "docid": "33d14ae4e1641b70d0871f3881444f0c", "score": "0.3851413", "text": "func (o *KubernetesBaremetalNodeProfile) SetNetworkInfo(v KubernetesBaremetalNetworkInfo) {\n\to.NetworkInfo.Set(&v)\n}", "title": "" }, { "docid": "197eafad7b13f22b6a181d3fa5778936", "score": "0.38470125", "text": "func (o *VirtualizationInterfacesListParams) WithNameNie(nameNie *string) *VirtualizationInterfacesListParams {\n\to.SetNameNie(nameNie)\n\treturn o\n}", "title": "" }, { "docid": "8cbc447d63c1138c95f9ac84b8911b65", "score": "0.38272372", "text": "func (o *DcimPowerPortTemplatesListParams) WithType(typeVar *string) *DcimPowerPortTemplatesListParams {\n\to.SetType(typeVar)\n\treturn o\n}", "title": "" }, { "docid": "1429f0c18e04d13c330793fa19e39f21", "score": "0.38191855", "text": "func (fscnmi FabricSpecificCreateNetworkMappingInput) MarshalJSON() ([]byte, error) {\n\tfscnmi.InstanceType = InstanceTypeFabricSpecificCreateNetworkMappingInput\n\tobjectMap := make(map[string]interface{})\n\tif fscnmi.InstanceType != \"\" {\n\t\tobjectMap[\"instanceType\"] = fscnmi.InstanceType\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "23435f9000d696a70bbedefc703beebc", "score": "0.38140327", "text": "func (i InMageRcmNicInput) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"isPrimaryNic\", i.IsPrimaryNic)\n\tpopulate(objectMap, \"isSelectedForFailover\", i.IsSelectedForFailover)\n\tpopulate(objectMap, \"nicId\", i.NicID)\n\tpopulate(objectMap, \"targetStaticIPAddress\", i.TargetStaticIPAddress)\n\tpopulate(objectMap, \"targetSubnetName\", i.TargetSubnetName)\n\tpopulate(objectMap, \"testStaticIPAddress\", i.TestStaticIPAddress)\n\tpopulate(objectMap, \"testSubnetName\", i.TestSubnetName)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b59d3a05d0fc7c9bff4881106f920ddb", "score": "0.38105157", "text": "func (c *HTTPAPIClient) CreateNetworkIPAM(t *testing.T, ni *models.NetworkIpam) {\n\tc.CreateResource(t, NetworkIpamPluralPath, &services.CreateNetworkIpamRequest{NetworkIpam: ni})\n}", "title": "" }, { "docid": "2eee78962303a68d5f0cc09230835eea", "score": "0.38077727", "text": "func (r *Runtime) createNetNS(ctr *Container) (err error) {\n\tctrNS, err := ns.NewNS()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"error creating network namespace for container %s\", ctr.ID())\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif err2 := ctrNS.Close(); err2 != nil {\n\t\t\t\tlogrus.Errorf(\"Error closing partially created network namespace for container %s: %v\", ctr.ID(), err2)\n\t\t\t}\n\t\t}\n\t}()\n\n\tlogrus.Debugf(\"Made network namespace at %s for container %s\", ctrNS.Path(), ctr.ID())\n\n\tpodNetwork := getPodNetwork(ctr.ID(), ctr.Name(), ctrNS.Path(), ctr.config.PortMappings)\n\n\tif err := r.netPlugin.SetUpPod(podNetwork); err != nil {\n\t\treturn errors.Wrapf(err, \"error configuring network namespace for container %s\", ctr.ID())\n\t}\n\n\tif len(ctr.config.PortMappings) != 0 {\n\t\tip, err := r.netPlugin.GetPodNetworkStatus(podNetwork)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to get status of network for container %s\", ctr.ID())\n\t\t}\n\n\t\tip4 := net.ParseIP(ip).To4()\n\t\tif ip4 == nil {\n\t\t\treturn errors.Wrapf(err, \"failed to parse IPv4 address for container %s\", ctr.ID())\n\t\t}\n\n\t\tportMappings, err := portMappingToHostport(ctr.config.PortMappings)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to generate port ammpings for container %s\", ctr.ID())\n\t\t}\n\n\t\terr = r.hostportManager.Add(ctr.ID(), &hostport.PodPortMapping{\n\t\t\tName: ctr.Name(),\n\t\t\tPortMappings: portMappings,\n\t\t\tIP: ip4,\n\t\t\tHostNetwork: false,\n\t\t}, \"lo\")\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to add port mappings for container %s\", ctr.ID())\n\t\t}\n\t}\n\n\tctr.state.NetNS = ctrNS\n\n\treturn nil\n}", "title": "" }, { "docid": "48d5a2343794d539355d3baf33c2962a", "score": "0.38076356", "text": "func (client *Client) AddNicToServer(serverID string, ipv4Address string, vlanID string) (nicID string, err error) {\n\torganizationID, err := client.getOrganizationID()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar serverNicConfiguration = serverNic{\n\t\tPrivateIPv4: ipv4Address,\n\t\tVlanID: vlanID,\n\t}\n\trequestURI := fmt.Sprintf(\"%s/server/addNic\", organizationID)\n\trequest, err := client.newRequestV22(requestURI, http.MethodPost, &addNicConfiguration{\n\t\tServerID: serverID,\n\t\tNic: serverNicConfiguration,\n\t})\n\tresponseBody, statusCode, err := client.executeRequest(request)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tapiResponse, err := readAPIResponseAsJSON(responseBody, statusCode)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif apiResponse.ResponseCode != ResponseCodeInProgress {\n\t\treturn \"\", apiResponse.ToError(\"Request to notify add a nic failed with unexpected status code %d (%s): %s\", statusCode, apiResponse.ResponseCode, apiResponse.Message)\n\t}\n\tnicIDMessage := apiResponse.GetFieldMessage(\"nicId\")\n\tif nicIDMessage == nil {\n\t\treturn \"\", apiResponse.ToError(\"Received an unexpected response (missing 'nicId') with status code %d (%s): %s\", statusCode, apiResponse.ResponseCode, apiResponse.Message)\n\t}\n\treturn *nicIDMessage, nil\n}", "title": "" }, { "docid": "0fd5af1674d0aac68992e9be3205ea2c", "score": "0.38076082", "text": "func (o *DcimPowerPortTemplatesListParams) WithTypen(typen *string) *DcimPowerPortTemplatesListParams {\n\to.SetTypen(typen)\n\treturn o\n}", "title": "" } ]
203c1fb630183badb450a033b2783ec6
Conn, get connection to database configured with given user info
[ { "docid": "a8aaf778858a2dfa6ccc0fefdedea18d", "score": "0.66608155", "text": "func Conn(configures *config.TomlConfig) (db *gorm.DB,err error) {\n\tlog = logging.GetLogger(configures.Log.Level)\n\n\tmysqlConf := configures.Mysql\n\tmysqlHost := mysqlConf.Host + \":\" + mysqlConf.Port\n\tmysqlDB := mysqlConf.DB\n\tmysqlUser := mysqlConf.User\n\tmysqlPassword := mysqlConf.Password\n\n\tdbUrl := fmt.Sprintf(\"%s:%s@tcp(%s)/%s?charset=utf8&parseTime=True&loc=Local\", mysqlUser, mysqlPassword, mysqlHost, mysqlDB)\n\tlog.Printf(\"Debug mysql connect string:%s\", dbUrl)\n\n\tdb, err = gorm.Open(\"mysql\", dbUrl)\n\tif err != nil {\n\t\tlog.Fatalf(\"Connect mysql error!%s\", err)\n\t\treturn nil, err\n\t}\n\treturn db, nil\n}", "title": "" } ]
[ { "docid": "dfec4d4ab8d1a1771571f265ab33aedc", "score": "0.7029167", "text": "func GetConnection() (database *sql.DB) {\n\tdatabaseDriver := \"mysql\"\n\tdatabaseUser := \"newuser\"\n\tdatabasePass := \"newuser\"\n\tdatabaseName := \"crm\"\n\tdatabase, error := sql.Open(databaseDriver, databaseUser+\":\"+databasePass+\"@/\"+databaseName)\n\tif error != nil {\n\t\tpanic(error.Error())\n\t}\n\treturn database\n}", "title": "" }, { "docid": "b692def278dcd2191fea6bd1370b996a", "score": "0.69147384", "text": "func Conn(user string) error {\n\t// connect to database as user\n\tconnectionDetails, _ := getConnectionDetails()\n\tconnectionDetails.User = user\n\tconnectionDetails.Password = getUserPswd(user)\n\tconnectionDetails.DatabaseName = \"mynsb\"\n\n\terr := connectionDetails.connect()\n\tif err != nil {\n\t\treturn errors.New(\"could not connect to database\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "85bbb5ee8e6be50a83d995ec3557a537", "score": "0.6853271", "text": "func Connection() (*sql.DB, error) {\n dbUser := os.Getenv(\"DB_USER\")\n dbPassword := os.Getenv(\"DB_PASSWORD\")\n dbName := os.Getenv(\"DB_NAME\")\n if dbName == \"\" || dbUser == \"\" || dbPassword == \"\" {\n return nil, errors.New(\"Invalid DB Settings\")\n }\n dbinfo := fmt.Sprintf(\"%s:%s@tcp(localhost:3306)/%s\", dbUser, dbPassword, dbName)\n\n db, db_err := sql.Open(\"mysql\", dbinfo)\n if db_err != nil {\n return nil, db_err\n }\n return db, nil\n}", "title": "" }, { "docid": "f02f8d7864ce42c46561d00430763bd1", "score": "0.6827916", "text": "func GetConnection(user string, password string, host string, db string) *gorm.DB {\n\tconnection, err := gorm.Open(\"postgres\", fmt.Sprintf(\"postgres://%s:%s@%s/%s?sslmode=disable\", user, password, host, db))\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn connection\n}", "title": "" }, { "docid": "60d57939c33767109fb9a02152af8177", "score": "0.66919047", "text": "func getDBConnection() *sql.DB {\n\t//var dbCredential string = \"root:admin@/testdb\"\n\t//var dbCredential string = \"testuser:123@/testdb\"\n\tvar dbCredential string = \"testuser:123@tcp(mysql:3306)/testdb\"\n\n\tdb, err := sql.Open(\"mysql\", dbCredential)\n if err != nil {\n\t\tlog.Printf(\"DB Connection [ERROR]\")\n\t}else{\n\t\tlog.Printf(\"DB Connection [SUCCESS]\")\n }\n\n\tif err = db.Ping(); err != nil {\n log.Printf(\"Error connecting to the database: %s\\n\", err)\n\t\treturn db\n }\n\n\treturn db\n}", "title": "" }, { "docid": "2a6b73b7bcb7a728c4623dbca3bce1cf", "score": "0.6690308", "text": "func GetConnection() *gorm.DB {\n\tvar err error\n\tvar sqlpass = os.Getenv(\"SQLPASS\")\n\tvar sqlserver = os.Getenv(\"SQLSERVER\")\n\tfmt.Println(sqlserver)\n\t//db, err = gorm.Open(\"mssql\", \"sqlserver://sa:!_ucKy-!uKe@localhost:1433?database=labb\")\n\t//db, err := gorm.Open(\"mysql\", \"formula:sofarfrompassword@tcp(172.17.0.2:3306)/formula?charset=utf8&pa\trseTime=True\")\n\tdb, err := gorm.Open(\"mysql\", \"formula:\" + sqlpass + \"@tcp(\" + sqlserver + \")/formula?charset=utf8&parseTime=True\")\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn db\n}", "title": "" }, { "docid": "561e12d81affa1499b3886e4d75b1d64", "score": "0.6687546", "text": "func GetConnection() *gorm.DB {\n\tcnn := getConfig()\n\tdsn := fmt.Sprintf(\n\t\t\"%s:%s@tcp(%s:%s)/%s?charset=utf8&parseTime=true&local\",\n\t\tcnn.User,\n\t\tcnn.Password,\n\t\tcnn.Server,\n\t\tcnn.Port,\n\t\tcnn.Database)\n\n\tdb, err := gorm.Open(\"mysql\", dsn)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "189f52ef15c8d0feca3e9cc892cc3ac3", "score": "0.6666681", "text": "func Conn() *sql.DB {\r\n\tdb, err := sql.Open(\"mysql\", \"root:@tcp(127.0.0.1:3306)/user\")\r\n\tif err != nil {\r\n\t\tfmt.Println(err)\r\n\t}\r\n\r\n\t//check if it pings\r\n\terr = db.Ping()\r\n\tif err != nil {\r\n\t\tfmt.Println(err)\r\n\t}\r\n\treturn db\r\n}", "title": "" }, { "docid": "84a5ffeb1b0df540c1d88d5975af0c97", "score": "0.66454345", "text": "func getConn(t *testing.T) *sol.DB {\n\t// Check if an ENV VAR has been set, otherwise, use travis\n\tcredentials := os.Getenv(\"MANAGER_TEST\")\n\tif credentials == \"\" {\n\t\tcredentials = travisCI\n\t}\n\n\tonce.Do(func() {\n\t\tvar err error\n\t\tif testconn, err = sol.Open(\"postgres\", credentials); err != nil {\n\t\t\tt.Fatalf(\"Failed to open connection: %s\", err)\n\t\t}\n\t\ttestconn.SetMaxOpenConns(25)\n\t})\n\treturn testconn\n}", "title": "" }, { "docid": "495131b3eaad1b5bc1691250684e13c1", "score": "0.6634902", "text": "func GetConnection(dsn string) (*sql.DB, error) {\n\tif dsn == \"\" {\n\t\tdsn = GetDSN(GetCfg(\"\"))\n\t}\n\tlog.Printf(\"GetConnection dsn=%v\", dsn)\n\tconn, err := sql.Open(\"ora\", dsn)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"dsn=\"+dsn)\n\t}\n\treturn conn, nil\n}", "title": "" }, { "docid": "c033e7256d819a3589e1d82984c051be", "score": "0.6608756", "text": "func GetConnection() *gorm.DB {\n\tc := getConfiguration()\n\tdsn := fmt.Sprintf(\"%s:%s@tcp(%s:%s)/%s?charset=utf8&parseTime=True&loc=Local\", c.User,c.Password,c.Server,c.Port, c.Database) //devuelve un string formateado\n\n\tdb, err := gorm.Open(\"mysql\", dsn)\n\tif err != nil{\n\t\tlog.Fatal(err)\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "df6808c9e7a8695039150085317b5f5a", "score": "0.66058296", "text": "func (accessor *DbAccessor) Conn(ctx context.Context) (*sql.Conn, error) {\n\treturn accessor.db.Conn(ctx)\n}", "title": "" }, { "docid": "e446a1225ee7bde13679b4923f1fd94e", "score": "0.65912825", "text": "func GetConnection(URL, AuthPassword, AuthUserName string) (*mgo.Session, error) {\n\tmongoDBDialInfo := &mgo.DialInfo{\n\t\tAddrs: []string{URL},\n\t\tTimeout: 1 * time.Second,\n\t\tUsername: AuthUserName,\n\t\tPassword: AuthPassword,\n\t}\n\tsession, err := mgo.DialWithInfo(mongoDBDialInfo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsession.SetMode(mgo.Monotonic, true)\n\treturn session, nil\n}", "title": "" }, { "docid": "3f4db208b58172a8e7fce8227bd59832", "score": "0.65910465", "text": "func getDbConn() (db *sql.DB) {\n\tvar err error\n\tdb, err = sql.Open(\"mysql\", dbConnectionString)\n\tfatalErr(err)\n\treturn db\n}", "title": "" }, { "docid": "72acc6dbbdc9a9210c8e874463145a83", "score": "0.6558382", "text": "func GetConnect() *pg.DB {\n\tparsedURL, err := url.Parse(os.Getenv(\"DATABASE_URL\"))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t//parsedURL += \"?sslmode=prefer\"\n\t\n\ttlsConfig := &tls.Config{\n InsecureSkipVerify: true,\n // ServerName: \"localhost\",\n }\n\n\tpgOptions := &pg.Options{\n\t\tUser: parsedURL.User.Username(),\n\t\tDatabase: parsedURL.Path[1:],\n\t\tAddr: parsedURL.Host,\n\t\tTLSConfig: tlsConfig,\n\t}\n\n\tif password, ok := parsedURL.User.Password(); ok {\n\t\tpgOptions.Password = password\n\t}\n\n\treturn pg.Connect(pgOptions)\n}", "title": "" }, { "docid": "d22c664b9ab6dfce038f89e74010330a", "score": "0.65304446", "text": "func GetConnection() *gorm.DB {\n\n\tvar (\n\t\tonce sync.Once\n\t\tdb *gorm.DB\n\t)\n\n\tonce.Do(func() {\n\t\tdb, err := gorm.Open(\"postgres\", \"host=\"+config.AppConfig.Host+\" port=\"+config.AppConfig.Port+\" dbname=\"+config.AppConfig.Dbname+\" user=\"+config.AppConfig.User+\" password=\"+config.AppConfig.Password+\" sslmode=disable\")\n\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Could not connecto to database \", err)\n\t\t}\n\n\t\tdb.AutoMigrate(&models.User{}, &models.Article{})\n\t})\n\n\treturn db\n}", "title": "" }, { "docid": "96aee71e36df723a45ce2b855a4fbc9f", "score": "0.6523012", "text": "func DbConn() (db *sql.DB, err error) {\n\tusername := os.Getenv(\"name\")\n\tuserpwd := os.Getenv(\"password\")\n\thost := os.Getenv(\"dbhost\")\n\tport := os.Getenv(\"dbport\")\n\tdbname := os.Getenv(\"dbname\")\n\n\tpath := fmt.Sprintf(\"%s:%s@tcp(%s:%s)/%s\", username, userpwd, host, port, dbname)\n\n\tdb, err = sql.Open(\"mysql\", path)\n\n\treturn db, err\n\n}", "title": "" }, { "docid": "36e8cfc108e606ecf95361ec99eda0ca", "score": "0.65147716", "text": "func (config *Config) getConnection(tId int, secretMap internal.Secret) *sql.DB {\n\n\tpw, err := GetPassword(secretMap, config.Tenants[tId].Name)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"tenant\": config.Tenants[tId].Name,\n\t\t}).Error(\"Cannot find password for tenant.\")\n\t\treturn nil\n\t}\n\tdb := config.dbConnect(tId, pw)\n\tif db == nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"tenant\": config.Tenants[tId].Name,\n\t\t}).Error(\"Can't get connection.\")\n\t\treturn nil\n\t}\n\t// defer db.Close()\n\n\tif err := db.Ping(); err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"tenant\": config.Tenants[tId].Name,\n\t\t}).Error(\"Cannot ping tenant. Perhaps wrong password?\")\n\t\treturn nil\n\t}\n\treturn db\n}", "title": "" }, { "docid": "68498c4e07f96f352aa5dbe233732428", "score": "0.649107", "text": "func GetConnection(dbType, user, password, name, host string) (*sqlx.DB, error) {\n\n\tvar err error\n\tvar connection *sqlx.DB\n\tswitch dbType {\n\tcase PostgresType:\n\t\tconnection, err = getPostgresConnection(user, password, name, host)\n\tdefault:\n\t\treturn nil, errors.New(\"unsupported database type\")\n\t}\n\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"impossible to get %s database connection\", dbType)\n\t}\n\n\tif err := connection.Ping(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"impossible to reach database\")\n\t}\n\n\treturn connection, nil\n}", "title": "" }, { "docid": "18e97e10291f94d0f9449214631d36a2", "score": "0.64848083", "text": "func dbConn() (db *sql.DB) {\n\n\tdbDriver := \"mysql\" // Database driver\n\tdbUser := \"root\" // Mysql username\n\tdbPass := \"root\" // Mysql password\n\tdbName := \"base\" // Mysql schema\n\n\t// Realize the connection with mysql driver\n\tdb, err := sql.Open(dbDriver, dbUser+\":\"+dbPass+\"@/\"+dbName)\n\n\t// If error stop the application\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\t// Return db object to be used by other functions\n\treturn db\n}", "title": "" }, { "docid": "25c906deb8a47fce08730bebe9e8b7b0", "score": "0.64795643", "text": "func GetConexion() (db *sql.DB, err error) {\n\tdbDriver := \"mysql\"\n\tdbUser := \"root\"\n\tdbPass := \"123456\"\n\tdbName := \"resturanteapi\"\n\n\tdb, err = sql.Open(dbDriver, dbUser+\":\"+dbPass+\"@/\"+dbName)\n\treturn\n}", "title": "" }, { "docid": "16e0adc9f8dbd4d3a61d09382b7d1cde", "score": "0.6475765", "text": "func (c *SQLConnection) GetConnection() *gorm.DB {\n\tvar env string\n\tswitch os.Getenv(\"GLOO_ENV\") {\n\tcase \"dev\":\n\t\tenv = fmt.Sprintf(\"%s_dev\", c.Database)\n\t\tlog.Println(\"Started on development\")\n\tcase \"rec\":\n\t\tenv = fmt.Sprintf(\"%s_rec\", c.Database)\n\t\tlog.Println(\"Started on recipe\")\n\tcase \"prod\":\n\t\tenv = fmt.Sprintf(\"%s_prod\", c.Database)\n\t\tlog.Println(\"Started on production\")\n\tdefault:\n\t\tenv = fmt.Sprintf(\"%s_dev\", c.Database)\n\t\tlog.Println(\"Warning : No GLOO_ENV selected\")\n\t\tlog.Println(\"Default --> Started on development\")\n\t}\n\tconn := fmt.Sprintf(\"%s:%s@tcp(%s:%s)/%s?charset=utf8&parseTime=True&loc=Local\", c.Login, c.Password, c.Host, c.Port, env)\n\treturn models.InitMariaDB(conn)\n}", "title": "" }, { "docid": "1a762c709f4729ebf82aa9f369abbc60", "score": "0.64733", "text": "func Conn() *sql.DB {\n\tgodotenv.Load()\n\n\tconnStr := fmt.Sprintf(\"%s:%s@tcp(%s:%s)/%s?parseTime=true\",\n\t\tos.Getenv(\"DB_USER\"),\n\t\tos.Getenv(\"DB_PASS\"),\n\t\tos.Getenv(\"DB_HOST\"),\n\t\tos.Getenv(\"DB_PORT\"),\n\t\tos.Getenv(\"DB_DBDB\"),\n\t)\n\n\tdb, err := sql.Open(os.Getenv(\"DB_DRIVER\"), connStr)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tDB = db\n\tconsole.PrintColoredLn(\"DB connected\", console.Success)\n\treturn db\n}", "title": "" }, { "docid": "5ad5532057b6df9e6e1f619a86e4c25c", "score": "0.6433886", "text": "func getConnection() (conn *sql.DB) {\n\tconn, err := sql.Open(\"mysql\", DBUSER+\":\"+DBPASS+\"@/\"+DBNAME)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "075ddb8d4bc070af7d5f2161791d293e", "score": "0.63672996", "text": "func getDB(conn string) (*sql.DB, error) {\n\t// TODO conn should be named as dataSourceName or dsn or something\n\tcfg, err := mysql.ParseDSN(conn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcfg.ParseTime = true\n\treturn sql.Open(\"mysql\", cfg.FormatDSN())\n}", "title": "" }, { "docid": "cc68a70fb5fe3da7a8399b475912d0f5", "score": "0.63375604", "text": "func aquireConn(dbConf config.DbConfig) (*sqlx.DB, error) {\n\tconnStr := fmt.Sprintf(\"postgres://%s:%s@%s/%s?sslmode=disable\",\n\t\tdbConf.User,\n\t\tdbConf.Pass,\n\t\tdbConf.Host,\n\t\tdbConf.DbName,\n\t)\n\tconn, err := sqlx.Connect(\"postgres\", connStr)\n\treturn conn, err\n}", "title": "" }, { "docid": "f835bf043d392722b3c39288e43b03fd", "score": "0.6325392", "text": "func GetConn() *sql.DB {\r\n\tcondb, errdb := sql.Open(\"sqlserver\", \"server=.;user id=sa;password=deemes;database=ThesisData\")\r\n\tif errdb != nil {\r\n\t\tfmt.Println(\" Error open db:\", errdb.Error())\r\n\t}\r\n\treturn condb\r\n}", "title": "" }, { "docid": "78ab58cde2563d00c7129b8372be3388", "score": "0.62902015", "text": "func dbConn() (db *sql.DB) {\n\tdbDriver := \"mysql\"\n\tdbUser := \"root\"\n\tdbPass := \"Kikker12\"\n\tdbName := \"vitaintellectdb\"\n\tdb, err := sql.Open(dbDriver, dbUser+\":\"+dbPass+\"@/\"+dbName)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn db\n}", "title": "" }, { "docid": "75ad0dca7e0ea08090c770325ad002ab", "score": "0.6279056", "text": "func databaseConnection() *sql.DB {\n\tuser := os.Getenv(\"MYSQL_USER\")\n\tpassword := os.Getenv(\"MYSQL_PASSWORD\")\n\thost := os.Getenv(\"MYSQL_HOST\")\n\tdatabase := os.Getenv(\"MYSQL_DATABASE\")\n\n\tdb, err := sql.Open(\"mysql\", user+\":\"+password+\"@tcp(\"+host+\")/\"+database)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\treturn db\n}", "title": "" }, { "docid": "2de98b33aac7ebfde5d34e940f1a655a", "score": "0.6250946", "text": "func GetConnection() (*sql.DB, error) {\n\tif db == nil || db.Ping() == nil {\n\t\tdbt, err := sql.Open(\"sqlite3\", \"todos.db\")\n\t\tdb = dbt\n\t\tdb.SetMaxIdleConns(5)\n\t\tdb.SetMaxOpenConns(5)\n\t\treturn db, err\n\t}\n\treturn db, nil\n}", "title": "" }, { "docid": "ad2da07380175de8a2ded21720c73825", "score": "0.6243651", "text": "func Connection(d drivers.Driver) *sql.DB {\n\tif db == nil {\n\t\tconnect(d)\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "18435775f4172c582638bd8ee30bfc52", "score": "0.6238338", "text": "func GetConn(URL string) Connection {\n\tvar conn Connection\n\n\tif strings.HasPrefix(URL, \"postgres\") {\n\t\tif isRedshift(URL) {\n\t\t\tconn = &RedshiftConn{URL: URL}\n\t\t} else {\n\t\t\tconn = &PostgresConn{URL: URL}\n\t\t}\n\t} else if strings.HasPrefix(URL, \"mysql:\") {\n\t\tconn = &MySQLConn{URL: URL}\n\t} else if strings.HasPrefix(URL, \"sqlserver:\") {\n\t\tconn = &BaseConn{URL: URL, Type: \"sqlserver\"}\n\t} else if strings.HasPrefix(URL, \"oracle:\") {\n\t\tconn = &OracleConn{URL: URL}\n\t} else if strings.HasPrefix(URL, \"file:\") {\n\t\tconn = &BaseConn{URL: URL, Type: \"sqlite3\"}\n\t} else {\n\t\tconn = &BaseConn{URL: URL}\n\t}\n\n\t// Init\n\tconn.Init()\n\n\treturn conn\n}", "title": "" }, { "docid": "0a8034401493dc5205ceea583cd08626", "score": "0.623217", "text": "func GetDatabaseConnObject() *mongodb.Session {\n\treturn DbConnection;\n}", "title": "" }, { "docid": "ddad85362850b9227fef4b58fdc74261", "score": "0.62246054", "text": "func Dbconn() (db *gorm.DB) {\n\tdns := dbUser + \":\" + dbPass + \"@tcp(127.0.0.1:3306)/\" + dbName + \"?charset=utf8mb4&parseTime=True&loc=Local\"\n\tdb, err := gorm.Open(mysql.Open(dns), &gorm.Config{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn db\n}", "title": "" }, { "docid": "44d42fdda91f8e2b885220c31f8af738", "score": "0.6220095", "text": "func (c *Config) dbConnInfo(host string) string {\n\t// For the connection string syntax, see\n\t// https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING.\n\t// Set the statement_timeout config parameter for this session.\n\t// See https://www.postgresql.org/docs/current/runtime-config-client.html.\n\ttimeoutOption := fmt.Sprintf(\"-c statement_timeout=%d\", StatementTimeout/time.Millisecond)\n\treturn fmt.Sprintf(\n\t\t\"user='%s' password='%s' host='%s' port=%s dbname='%s' sslmode='%s' options='%s'\",\n\t\tc.DBUser, c.DBPassword, host, c.DBPort, c.DBName, c.DBSSL, timeoutOption,\n\t)\n}", "title": "" }, { "docid": "9f6e049718e31fc7e2a09419bf544297", "score": "0.6211792", "text": "func GetConnection() *gorm.DB {\n\tconfig := &dBConfig{\n\t\tHost: \"app_mariadb\",\n\t\tPort: 3306,\n\t\tUser: \"dev\",\n\t\tDBName: \"fullstackAsociacion\",\n\t\tPassword: \"passdev\",\n\t}\n\tdb, err := gorm.Open(mysql.Open(dbURL(config)), &gorm.Config{})\n\tif err != nil {\n\t\tlog.Fatal(\"Error BBDD\")\n\t} else {\n\t\tlog.Printf(\"I'm connected!\")\n\t}\n\treturn db\n}", "title": "" }, { "docid": "30009a65fd4b6b86ce716bbfa0a908c1", "score": "0.6205168", "text": "func (ch *ClickHouse) GetConn() *sqlx.DB {\n\treturn ch.conn\n}", "title": "" }, { "docid": "30009a65fd4b6b86ce716bbfa0a908c1", "score": "0.6205168", "text": "func (ch *ClickHouse) GetConn() *sqlx.DB {\n\treturn ch.conn\n}", "title": "" }, { "docid": "86294284f4d9e91ddb9a08e25a8216fc", "score": "0.6182603", "text": "func databaseConn() {\n\tvar (\n\t\tconnectionString string\n\t\terr error\n\t)\n\n\tif conf.Conf.Database.Adapter == \"mysql\" {\n\t\tconnectionString = fmt.Sprintf(\"%s:%s@tcp(%s:%d)/%s?parseTime=true\",\n\t\t\tconf.Conf.Database.UserName, conf.Conf.Database.Pwd,\n\t\t\tconf.Conf.Database.Host, conf.Conf.Database.Port, conf.Conf.Database.Name)\n\t} else if conf.Conf.Database.Adapter == \"postgres\" {\n\t\tconnectionString = fmt.Sprintf(\"postgresql://%s:%s@%s:%d/%s?sslmode=%s\",\n\t\t\tconf.Conf.Database.UserName, conf.Conf.Database.Pwd,\n\t\t\tconf.Conf.Database.Host, conf.Conf.Database.Port, conf.Conf.Database.Name,\n\t\t\t\"disable\")\n\t} else if conf.Conf.Database.Adapter == \"sqlite3\" {\n\t\tconnectionString = conf.Conf.Database.Name\n\t} else {\n\t\tpanic(\"known database adapter..(\" + conf.Conf.Database.Adapter + \")\")\n\t}\n\n\tif db, err = gorm.Open(conf.Conf.Database.Adapter, connectionString); err != nil {\n\t\tfmt.Println(\"데이터 베이스 연결 오류\")\n\t\tpanic(err)\n\t}\n\tif err = db.DB().Ping(); err != nil {\n\t\tpanic(err)\n\t}\n\n\tdb.LogMode(conf.Conf.Database.LogMode)\n\tdb.DB().SetMaxIdleConns(conf.Conf.Database.IdleConns)\n\tdb.DB().SetMaxOpenConns(conf.Conf.Database.OpenConns)\n}", "title": "" }, { "docid": "67c600e99639186377fdaeaf8fc62294", "score": "0.61745936", "text": "func (s *Store) Conn() (*sql.DB, error) {\n\treturn s.PqDB, nil\n}", "title": "" }, { "docid": "53947bfa3b9ffd97206be36a439bc262", "score": "0.61614287", "text": "func GetConnection(cfg *pgx.ConnConfig) *pgx.Conn {\n\tmainConfig := GetPgxConnectionConfig(cfg)\n\n\tconnStr := fmt.Sprintf(\"dbname=%s sslmode=disable user=%s password=%s host=%s port=%d\",\n\t\tmainConfig.Database, mainConfig.User, mainConfig.Password, mainConfig.Host, mainConfig.Port)\n\n\tconn, err := pgx.Connect(mainConfig)\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error connecting to database: %v\", err)\n\t}\n\n\terr = conn.Ping(context.Background())\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error testing database connection: %v\", err)\n\t}\n\n\tfmt.Printf(\"Connected to database %s\\n\", connStr)\n\n\treturn conn\n}", "title": "" }, { "docid": "4409d8c258aa3140d9854be8b302e973", "score": "0.61422557", "text": "func GetDatabaseConnection() *gorm.DB { // Check Connection Status\n\tif gormConn != nil && gormConn.DB() != nil && gormConn.DB().Ping() == nil {\n\t\treturn gormConn\n\t}\n\n\tconn, err := gorm.Open(\"postgres\", \"host=localhost port=5432 user=test dbname=test password=test sslmode=disable\")\n\n\tif err != nil {\n\t\tpanic(err) // log error without close\n\t}\n\tconn.LogMode(true)\n\tgormConn = conn\n\treturn gormConn\n}", "title": "" }, { "docid": "76ba7b52c99cd49a4749e00d0acdc647", "score": "0.61289334", "text": "func (conn *BaseConn) GetGormConn() (*gorm.DB, error) {\n\treturn gorm.Open(getDriverName(conn.Type), conn.URL)\n}", "title": "" }, { "docid": "f7e50e0e74e13558b3f56d6c0bc5d855", "score": "0.61271244", "text": "func connection() *sql.DB {\n\tdbLogin := dbInfo.User + \":\" + dbInfo.Password + \"@tcp(\" + dbInfo.Host + \")/\" + dbInfo.Database\n\n\tdb, err := sql.Open(\"mysql\", dbLogin)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\terr = db.Ping()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "268eee67510976de48ce80ec90e03c19", "score": "0.61172724", "text": "func dbConn() (db *sql.DB) {\n\tdb, err := sql.Open(DBDriver, DBURL)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn db\n}", "title": "" }, { "docid": "a5b9f21780d4c9ae796a3e65dfa70e4d", "score": "0.6111196", "text": "func GetConnection(ctx context.Context, connectionString string) (*sql.DB, error) {\n\tlog := logger.Log(ctx).\n\t\tWithField(\"function\", \"GetConnection\")\n\tif connectionString == \"\" {\n\t\treturn nil, logger.ErrorfAsError(log, \"database connection string is required\")\n\t}\n\tlog.Debugf(\"opening database connection to %s\", logger.SanitizedURLString(connectionString))\n\t/*parsed, err := pgx.ParseConnectionString(connectionString)\n\tif err != nil {\n\t\treturn nil, logger.ErrorfAsError(log, \"error parsing connection string: %s\", err)\n\t}*/\n\t// conn, err := pgx.Connect(parsed)\n\tconn, err := sql.Open(\"postgres\", connectionString)\n\tif err != nil {\n\t\treturn nil, logger.ErrorfAsError(log, \"error connecting to database: %s\", err)\n\t}\n\treturn conn, err\n}", "title": "" }, { "docid": "61ee3b3a036d837cd81700222c518bd9", "score": "0.6100472", "text": "func GetConnection() Data {\n\tvar data Data\n\tdsn, _ := os.LookupEnv(\"DB_URI\")\n\n\tdb, err := gorm.Open(postgres.Open(dsn), &gorm.Config{\n\t\tLogger: logger.Default.LogMode(logger.Silent), //logger blocked\n\t})\n\n\tif err != nil {\n\t\tdata.Db = &gorm.DB{}\n\t\tdata.Success = false\n\t\tdata.Error = err\n\t\treturn data\n\t}\n\n\tdata.Db = db\n\tdata.Success = true\n\tdatabase = data.Db\n\n\t//migrations of the schemas\n\tCreateTables(data.Db)\n\n\t//set the value of the db in Task module\n\tmodels.InstanceDatabase(data.Db)\n\treturn data\n}", "title": "" }, { "docid": "2e9c14a43b0473e4fa32c56d5320a52c", "score": "0.60899234", "text": "func GetDbConnection(name string) *sql.DB {\n\tvar res *sql.DB\n\tvar keyDbConnection = \"db_connection_\" + name\n\tcacheApp := GetCache()\n\tresFromCache, ok := cacheApp.Get(keyDbConnection)\n\tif ok {\n\t\tres = resFromCache.(*sql.DB)\n\t} else {\n\t\tres = GetNoCachedDbConnection(name)\n\t\tcacheApp.Set(keyDbConnection, res, cache.NoExpiration)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "924352b881a99f2071445eb37202ad8c", "score": "0.6080682", "text": "func Conn() *sql.DB {\n fmt.Println(\"open connection to database\")\n\n // db, err := sql.Open(\"mysql\", \"root:$$superstar@tcp(127.0.0.1:5432)/stelita_stag\")\n db, err := sql.Open(\"mysql\", \"root:$$superstar@tcp(127.0.0.1)/stelita_stag\")\n if err != nil {\n panic(\"ERROR connecting to the database\")\n panic(err.Error())\n }\n\n return db\n}", "title": "" }, { "docid": "e1aabdc2209de0a4d4d025b1ff93a87e", "score": "0.607656", "text": "func DB(config Config) (*sql.DB, error) {\n\tif config.CA != nil {\n\t\tif err := mysql.RegisterTLSConfig(\"custom\", tls.WithCA(config.CA)); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tdb, err := sql.Open(\"mysql\", dataSourceName(config))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif config.MaxOpen > 0 {\n\t\tdb.SetMaxOpenConns(config.MaxOpen)\n\t}\n\tif config.MaxIdle > 0 {\n\t\tdb.SetMaxIdleConns(config.MaxIdle)\n\t}\n\tif config.MaxLifetime > 0 {\n\t\tdb.SetConnMaxLifetime(time.Duration(config.MaxLifetime) * time.Minute)\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "b1a5d191c6e7ab16b5a24a4f452da17f", "score": "0.6054419", "text": "func ConnDB() *sql.DB {\n\tif db == nil {\n\t\tconn := getConnectionString()\n\t\tvar err error\n\t\tdb, err = sql.Open(\"mysql\", conn)\n\t\tif err != nil {\n\t\t\toutputErrorLog(\"DB 接続 エラー\", err)\n\t\t}\n\t}\n\treturn db\n}", "title": "" }, { "docid": "dfd7a477f02c550762532de95f6edbbe", "score": "0.60469985", "text": "func (es *EventService) Conn() *sqlx.DB {\n\tif es.DB == nil {\n\t\tlog.Println(\"No DB connection - establishing...\")\n\t\tcfg := env.Config()\n\t\tdb, err := sqlx.Open(\"mysql\", cfg.ConnectionString)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprint(\"Couldn't load database; error\", err))\n\t\t}\n\t\tes.DB = db\n\t\treturn es.DB\n\t}\n\n\terr := es.DB.Ping()\n\tif err != nil {\n\t\tlog.Println(\"No DB connection - ping failed/ establishing...\")\n\n\t\tcfg := env.Config()\n\t\tdb, err := sqlx.Open(\"mysql\", cfg.ConnectionString)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprint(\"Couldn't establish database connection; err: \", err))\n\t\t}\n\t\tes.DB = db\n\t\treturn es.DB\n\t}\n\tlog.Println(\"DB connection - ping success!\")\n\n\treturn es.DB\n}", "title": "" }, { "docid": "1bbb0d5c08c83e267bb0ae7480f55a9a", "score": "0.60374516", "text": "func GetConnection() (*sql.DB, error) {\n\treturn loadConnection()\n}", "title": "" }, { "docid": "acff4bd76d4458e2fcb820ce0783cce7", "score": "0.60367143", "text": "func (t *tenantDB) Get(name string) (*sql.DB, error) {\n\tconn, err := connector.Connect(t.driver, t.connection, name)\n\treturn conn, err\n}", "title": "" }, { "docid": "9d8f6bcf21ef27987c68651344d7301b", "score": "0.60149276", "text": "func DBConn() (db *sql.DB) {\n\tdbDriver := \"mysql\"\n\n\tdb, err := sql.Open(dbDriver, helper.MysqlHost)\n\tif err != nil {\n\t\tfmt.Println(\"error al conectar con la bd\")\n\t\tpanic(err.Error())\n\t}\n\tfmt.Println(\"connect db success \")\n\treturn db\n}", "title": "" }, { "docid": "f51d02bbbbdfcabc26a081c766c652b0", "score": "0.60144883", "text": "func Conn() *sqlx.DB {\n\treturn db\n}", "title": "" }, { "docid": "4fcc4b69beb4e1432b60384703753166", "score": "0.60144144", "text": "func (d Database) GetConnection() *sql.DB {\n\tif d.connDB == nil {\n\t\tprocessError(\"GetConnection\", errors.New(\"Call Init() before GetConnection()\"))\n\t}\n\treturn d.connDB\n}", "title": "" }, { "docid": "9b20668d134a38042b2c6fcac3b1ecd7", "score": "0.59932095", "text": "func Conectar() (*sql.DB, error) { //ou vai retornar a conexao ou o erro\n\tstringConexao := \"go_user:Go_pass123@/devbook?charset=utf8&parseTime=True&loc=Local\"\n\n\tdb, erro := sql.Open(\"mysql\", stringConexao)\n\tif erro != nil {\n\t\treturn nil, erro\n\t}\n\n\tif erro = db.Ping(); erro != nil { //verificar conexao\n\t\treturn nil, erro\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "212c74ae5a3a97d13bacc8ab8de8ca7d", "score": "0.5992863", "text": "func GetConnection() *gorm.DB {\n\treturn db\n}", "title": "" }, { "docid": "c3792bb891bdc3733ad9c3634677d7b9", "score": "0.59877104", "text": "func (c *Client) GetConnection() *sql.DB {\n\treturn c.conn\n}", "title": "" }, { "docid": "ff68f98347f188d028eb4243ea73c9fb", "score": "0.5978788", "text": "func GetDatabaseConnection() *sql.DB {\n\tdb, err := sql.Open(\"mysql\", \"abraham_linkedin:seattlelife12345@tcp(\"+\n\t\t\"abrahamlinkedin.ccwrpjrudb04.us-east-1.rds.amazonaws.com:3306)/\"+\n\t\t\"AbrahamLinkedIn\")\n\n\tif err != nil {\n\t\tpanic(\"Failed to connect to DB: \" + err.Error())\n\t}\n\n\terr = db.Ping()\n\tif err != nil {\n\t\tpanic(\"Failed to connect to DB: \" + err.Error())\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "a57c257ff851e40bc1850df60a13b82c", "score": "0.5978647", "text": "func GetDBConn(ctx *common.Context) *Tx {\n\ttx := CtxGetDbSession(ctx)\n\tif tx == nil {\n\t\tlogger.Warningf(\"The variable in context is not DB session : %d\", debug.Stack())\n\t\tpanic(\"DB session is not exist\")\n\t}\n\n\treturn tx\n}", "title": "" }, { "docid": "ad12a1705854a737623db27e8818405d", "score": "0.59663194", "text": "func DBConn() (db *sqlx.DB) {\n\tdbDriver := \"mysql\"\n\tdbUser := \"root\"\n\tdbPass := \"\"\n\tdbName := \"servicehelper\"\n\t//var err error\n\tdb, err := sqlx.Open(dbDriver, dbUser+\":\"+dbPass+\"@/\"+dbName+\"?parseTime=true\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn db\n}", "title": "" }, { "docid": "5fb80fc841d2eb6a04d4797a5d6e33a5", "score": "0.59646153", "text": "func (o *oracle) Connection() *sql.DB {\n\treturn o.connection\n}", "title": "" }, { "docid": "de399cd9a86e58b91f8a9181d7244ec5", "score": "0.5957009", "text": "func ConnectionDB() string {\n\tvar config models.Tomlconf\n\tf, err := os.Open(\"pkg/config/env/config.toml\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer f.Close()\n\tcontent, err := ioutil.ReadAll(f)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\ttoml.Unmarshal(content, &config)\n\tconnURL := fmt.Sprintf(\"%s:%s@tcp(%s:%s)/%s\", config.Database.User, config.Database.Password, config.Database.Host, config.Database.Port, config.Database.Name)\n\treturn connURL\n}", "title": "" }, { "docid": "993d5f79c4c30b2a46bb44ed2208ee03", "score": "0.5953043", "text": "func (db *DB) Conn(ctx context.Context) (*Conn, error) {\n\tsqlxconn, err := db.DB.Connx(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Conn{sqlxconn}, nil\n}", "title": "" }, { "docid": "28ed1517481786c9ba8d61ab8af09eb4", "score": "0.5950117", "text": "func getConnectionString() string {\n host := getParamString(\"db.host\", \"\")\n port := getParamString(\"db.port\", \"3306\")\n user := getParamString(\"db.user\", \"\")\n pass := getParamString(\"db.password\", \"\")\n dbname := getParamString(\"db.name\", \"\")\n protocol := getParamString(\"db.protocol\", \"tcp\")\n dbargs := getParamString(\"db.args\", \" \")\n\n if strings.Trim(dbargs, \" \") != \"\" {\n dbargs = \"?\" + dbargs\n } else {\n dbargs = \"\"\n }\n\n conStr := fmt.Sprintf(\"%s:%s@%s([%s]:%s)/%s%s\", user, pass, protocol, host, port, dbname, dbargs)\n // revel.INFO.Println(conStr)\n return conStr\n}", "title": "" }, { "docid": "458ef1fd3ac706dc5a21f42d3dc138ff", "score": "0.5945725", "text": "func (d Database) GetConnection(ctx context.Context) (string, string, error) {\n\tisParamBased := false\n\n\t// if the connection parameters are not supplied via URI, assume parameter based\n\tdriver, err := d.getDbType()\n\tif err != nil {\n\t\treturn \"\", \"\", errors.Wrap(err, \"failed to get database type\")\n\t}\n\n\tif driver == \"postgres\" {\n\t\tisParamBased = d.Spec.Connection.Postgres.URI.IsEmpty()\n\t} else if driver == \"cockroachdb\" {\n\t\tisParamBased = d.Spec.Connection.CockroachDB.URI.IsEmpty()\n\t} else if driver == \"mysql\" {\n\t\tisParamBased = d.Spec.Connection.Mysql.URI.IsEmpty()\n\t} else if driver == \"cassandra\" {\n\t\tisParamBased = true\n\t} else if driver == \"rqlite\" {\n\t\tisParamBased = d.Spec.Connection.RQLite.URI.IsEmpty()\n\t} else if driver == \"timescaledb\" {\n\t\tisParamBased = d.Spec.Connection.TimescaleDB.URI.IsEmpty()\n\t}\n\n\tif isParamBased {\n\t\treturn d.getConnectionFromParams(ctx)\n\t}\n\n\treturn d.getConnectionFromURI(ctx)\n}", "title": "" }, { "docid": "3f9caa8c74c645cc7b6bd58e5e3be68a", "score": "0.5945427", "text": "func (c *Config) GetDatabaseConnection() (*gorm.DB, *FameError) {\n\tif c.databaseConnection != nil {\n\t\treturn c.databaseConnection, nil\n\t}\n\n\tlog.Debug(\"Opening new database connection...\")\n\n\tdb, err := gorm.Open(c.DatabaseType, c.DatabaseConnectionString)\n\tif err != nil {\n\t\treturn nil, InternalError(\n\t\t\tfmt.Errorf(\"Could not connect to database with type \\\"%s\\\" and connection string \\\"%s\\\"! %s\", c.DatabaseType, c.DatabaseConnectionString, err),\n\t\t)\n\t}\n\tif log.GetLevel() == log.DebugLevel {\n\t\tdb = db.Debug()\n\t}\n\tc.databaseConnection = db\n\treturn c.databaseConnection, nil\n}", "title": "" }, { "docid": "619954009a10a0dd1feaf1764e7a90ac", "score": "0.5941178", "text": "func DBConn() *gorm.DB {\n\treturn conn\n}", "title": "" }, { "docid": "8ca4970632d2781bbe646dac98147d82", "score": "0.5940269", "text": "func Connect(dialect, host string, port int, user, dbname, pass string) (*gorm.DB, error) {\n\tlog.Info(\"initializing database...\")\n\tvar url string\n\tif databaseURL := os.Getenv(\"DATABASE_URL\"); databaseURL != \"\" {\n\t\turl = databaseURL\n\t} else {\n\t\turl = fmt.Sprintf(\"sslmode=disable host=%s port=%d user=%s dbname=%s password=%s\", host, port, user, dbname, pass)\n\t}\n\tonce.Do(func() {\n\t\tvar err error\n\t\tDB, err = gorm.Open(\n\t\t\tdialect,\n\t\t\turl)\n\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Failed to load %s DB: %s\", dialect, err.Error())\n\t\t}\n\t})\n\n\treturn DB, nil\n}", "title": "" }, { "docid": "322c46f0639b7130225487866c14aaa7", "score": "0.5938958", "text": "func InitConn(Log *zap.Logger, dsn string) (connect *sql.DB, err error) {\n\tdb, err := sql.Open(\"godror\", dsn)\n\tif err != nil {\n\t\tLog.Error(\"Не удалось создать подключение к БД\", zap.String(\"dsn:\", dsn), zap.Error(err))\n\t\treturn nil, err\n\t}\n\tdb.SetMaxOpenConns(1000)\n\tdb.SetMaxIdleConns(1000)\n\tdb.SetConnMaxLifetime(5 * time.Minute)\n\n\tvar ctx context.Context\n\tctx = context.Background()\n\tctx, cancel := context.WithTimeout(ctx, 5*time.Second)\n\tdefer cancel()\n\n\tif err := db.PingContext(ctx); err != nil {\n\t\tLog.Error(\"Не удалось проверить подключение к БД\", zap.String(\"dsn:\", dsn), zap.Error(err))\n\t\treturn nil, err\n\t} else {\n\t\tLog.Info(\"Подключение к БД - OK\", zap.String(\"dsn:\", dsn))\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "964391a26b6bf5ec5ff7eb0eef8365f5", "score": "0.59385186", "text": "func DBConn() *sql.DB {\n\treturn db\n}", "title": "" }, { "docid": "18c28143f3c9ff99fa4d0120ce872766", "score": "0.59334636", "text": "func Connection() (*gorm.DB, error) {\n\tvar err error\n\n\tif connection == nil {\n\t\tdbURL := os.Getenv(\"DATABASE_URL\")\n\t\tconnection, err = gorm.Open(\"postgres\", dbURL)\n\t}\n\n\treturn connection, err\n}", "title": "" }, { "docid": "7b3b0d3d3b8596f9fd2873b558f15768", "score": "0.59328794", "text": "func PgConn(ctx *Ctx) *sql.DB {\n\tconnectionString := \"client_encoding=UTF8 sslmode='\" + ctx.PgSSL + \"' host='\" + ctx.PgHost + \"' port=\" + ctx.PgPort + \" dbname='\" + ctx.PgDB + \"' user='\" + ctx.PgUser + \"' password='\" + ctx.PgPass + \"'\"\n\tif ctx.QOut {\n\t\t// Use fmt.Printf (not lib.Printf that logs to DB) here\n\t\t// Avoid trying to log something to DB while connecting\n\t\tfmt.Printf(\"PgConnectString: %s\\n\", connectionString)\n\t}\n\tcon, err := sql.Open(\"postgres\", connectionString)\n\tFatalOnError(err)\n\treturn con\n}", "title": "" }, { "docid": "5a66a9b31562eb402e6cb2c885c85f45", "score": "0.5928755", "text": "func createConnection() *gorm.DB {\n\tcfg := config.GetConfig()\n\tconnectionString := fmt.Sprintf(\n\t\t\"%s:%s@tcp(%s:%s)/%s?charset=utf8&parseTime=True\",\n\t\tcfg.Db.User, cfg.Db.Password, cfg.Db.Host, cfg.Db.Port, cfg.Db.Schema)\n\tdb, err := gorm.Open(\n\t\t\"mysql\",\n\t\tconnectionString,\n\t)\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not connect to DB: %v\\n\", err)\n\t\treturn nil\n\t}\n\n\tif cfg.Db.IsDebugMode {\n\t\treturn db.Debug()\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "dfb9fdfe58806a6245e73a172d431bb2", "score": "0.59146935", "text": "func (d *daocache) GetConn() dao.Conn {\n\treturn d.DAO.(dao.DAO).GetConn()\n}", "title": "" }, { "docid": "f2a9f3dcfef73c071d280ff8c0562a2a", "score": "0.59043425", "text": "func Connect(c *ConnectionConfig) (*gorm.DB, *sql.DB) {\n\tif c == nil {\n\t\tc = defaultConfig()\n\t}\n\n\thandleError := func(err error) {\n\t\tif err != nil {\n\t\t\tpanic(errors.Wrap(err, \"Unable to connect to database\"))\n\t\t}\n\t}\n\tdsn := postgres.Open(fmt.Sprintf(\n\t\t\"host=%s port=%s user=%s dbname=%s password=%s sslmode=disable\",\n\t\tc.Host,\n\t\tc.Port,\n\t\tc.User,\n\t\tc.Name,\n\t\tc.Pass,\n\t))\n\tdb, err := gorm.Open(dsn, &gorm.Config{})\n\thandleError(err)\n\tsqlDB, err := db.DB()\n\thandleError(err)\n\treturn db, sqlDB\n}", "title": "" }, { "docid": "169f7142d1b8bcc3dae94e4841b75f52", "score": "0.5902498", "text": "func CassConn() (*gocql.Session, error) {\n\tcluster := gocql.NewCluster(os.Getenv(\"CASSANDRA_HOST\"))\n\tcluster.Timeout = time.Second * 2\n\tsession, err := cluster.CreateSession()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := initDb(session); err != nil {\n\t\treturn nil, err\n\t}\n\treturn session, nil\n}", "title": "" }, { "docid": "ad756140d2058c4133e42e234d195d4e", "score": "0.5899593", "text": "func DBConnFromFlags() (*sql.DB, error) {\n\treturn sql.Open(\"mysql\", dbURI(DBURIFromFlags()))\n}", "title": "" }, { "docid": "fa78171d0b9b4f16c1ab9cbca8a5ae93", "score": "0.58954465", "text": "func GetDBConnection(dbFlag DbType) (*ConnPool, *errors.Error) {\n\tvar err *errors.Error\n\tswitch dbFlag {\n\tcase InMemory:\n\t\tinMemDBConnPool, err := getInmemoryDBConnection()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn inMemDBConnPool, err\n\n\tcase OnDisk:\n\t\tonDiskDBConnPool, err = getOnDiskDBConnection()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn onDiskDBConnPool, err\n\n\tdefault:\n\t\treturn nil, errors.PackError(errors.UndefinedErrorType, \"error invalid db type selection\")\n\t}\n}", "title": "" }, { "docid": "fd05168a6af641bceff5ac7c620ac87a", "score": "0.5890104", "text": "func Connector() *pg.DB {\n\tonce.Do(func() {\n\t\tvar config dBConfig\n\t\tconfig.getConfig()\n\t\tdataBase = pg.Connect(&pg.Options{\n\t\t\tUser: config.DbUser,\n\t\t\tDatabase: config.DbName,\n\t\t\tPassword: config.Password,\n\t\t})\n\t})\n\treturn dataBase\n}", "title": "" }, { "docid": "e62b23c00386f052a9e272653aaefb72", "score": "0.58702093", "text": "func createConnection() *sql.DB {\n\t//load .env file\n\terr := godotenv.Load(\".env\")\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error loading .env file\")\n\t}\n\n\t//open connection\n\tdb, err := sql.Open(\"postgres\", os.Getenv(\"POSTGRES_DB\"))\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t//check connection\n\terr = db.Ping()\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"Successfully connected!\")\n // return the connection\n return db\n}", "title": "" }, { "docid": "e32bcc072735293b4e7c34e515188b3a", "score": "0.5861294", "text": "func PgConnDB(ctx *Ctx, dbName string) *sql.DB {\n\tconnectionString := \"client_encoding=UTF8 sslmode='\" + ctx.PgSSL + \"' host='\" + ctx.PgHost + \"' port=\" + ctx.PgPort + \" dbname='\" + dbName + \"' user='\" + ctx.PgUser + \"' password='\" + ctx.PgPass + \"'\"\n\tif ctx.QOut {\n\t\t// Use fmt.Printf (not lib.Printf that logs to DB) here\n\t\t// Avoid trying to log something to DB while connecting\n\t\tfmt.Printf(\"ConnectString: %s\\n\", connectionString)\n\t}\n\tctx.CanReconnect = false\n\tcon, err := sql.Open(\"postgres\", connectionString)\n\tFatalOnError(err)\n\treturn con\n}", "title": "" }, { "docid": "7af07ba9c56fc87fa5a93f50cea5d946", "score": "0.58584696", "text": "func GetDatabaseConnection() *sql.DB {\n\tdb, err := sql.Open(\"postgres\",\n\t\t\"postgres://\"+constants.DatabaseUsername+\":\"+\n\t\t\tconstants.DatabasePassword+\"@\"+constants.DatabaseHost+\"/calagora\"+\n\t\t\tconstants.DatabaseExtraArgs)\n\n\tif err != nil {\n\t\tpanic(\"Failed to connect to DB: \" + err.Error())\n\t}\n\n\terr = db.Ping()\n\tif err != nil {\n\t\tpanic(\"Failed to connect to DB: \" + err.Error())\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "ff839aa39f3cd4405345108013e27e8b", "score": "0.58266824", "text": "func dbconn() *sql.DB {\n\tdb, err := sql.Open(\"mysql\", \"root:@tcp(127.0.0.1:3306)/spark\")\n\tcheckErr(err)\n\treturn db\n}", "title": "" }, { "docid": "1fce33d20ade38c346d38965d1ac8119", "score": "0.5821662", "text": "func Conn() gorm.DB {\n\treturn db\n}", "title": "" }, { "docid": "b6fce0f40d439f0d3a0515caf2de54eb", "score": "0.5821171", "text": "func NewConnection(cfg *config.GlobalConfig) (*sql.DB, error) {\n\tvar connectionURL string\n\n\tswitch cfg.DB.Driver {\n\tcase \"mysql\":\n\t\tconnectionURL = fmt.Sprintf(\n\t\t\t\"%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=True&loc=Local\",\n\t\t\tcfg.DB.User,\n\t\t\tcfg.DB.Pass,\n\t\t\tcfg.DB.Host,\n\t\t\tcfg.DB.Port,\n\t\t\tcfg.DB.Name,\n\t\t)\n\tcase \"sqlite3\":\n\t\tconnectionURL = cfg.DB.Path\n\tdefault:\n\t\terrorMessage := fmt.Sprintf(\"DB_DRIVER: %s, not supported\", cfg.DB.Driver)\n\t\treturn nil, errors.New(errorMessage)\n\t}\n\n\tdb, _ := sql.Open(cfg.DB.Driver, connectionURL)\n\n\tif err := db.Ping(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "5fedf8831a61cd1496d9388227059044", "score": "0.58208406", "text": "func (mongodal *MongoDAL) GetConnectionString() (err error) {\n\t// use env\n\tuser := os.Getenv(\"MONGO_USER\")\n\tpw := os.Getenv(\"MONGO_PW\")\n\thost := os.Getenv(\"MONGO_HOST\")\n\tport := os.Getenv(\"MONGO_PORT\")\n\t// db := os.Getenv(\"MONGO_DB\")\n\tfor _, part := range []string{user, pw, host, port} {\n\t\tif len(part) == 0 {\n\t\t\terr = errors.New(\"could not format connection string, check environment variables\")\n\t\t\tfmt.Println(err)\n\t\t\treturn\n\t\t}\n\t}\n\t// format conn string\n\tconnString := fmt.Sprintf(\"mongodb://%s:%s@%s:%s/\", user, pw, host, port)\n\tfmt.Println(\"MongoDB connection string\")\n\tfmt.Println(connString)\n\tmongodal.url = connString\n\treturn\n}", "title": "" }, { "docid": "e9f1f97994e7025f9eeca79d31843847", "score": "0.58112085", "text": "func DBConn() (*pgx.Conn, error) {\n\n\tconnUrl := fmt.Sprintf(\"postgres://%s:%s@%s/%s\", viper.GetString(\"db_user\"), viper.GetString(\"db_password\"), viper.GetString(\"db_addr\"), viper.GetString(\"db_database\"))\n\tdb, err := pgx.Connect(context.Background(), connUrl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "862f6290c36848a2e2de225f8c622641", "score": "0.5809104", "text": "func connect(d,h,u,p,db string) (c *sql.DB,err error) {\n\tif d == \"mysql\" {\n\t\tc, err = sql.Open(d, u+\":\"+p+\"@tcp(\"+h+\":3306)/\"+db+\"?allowOldPasswords=1\")\n\t} else {\n\t\t//c, err = sql.Open(d, \"postgres://\"+u+\":\"+p+\"@\"+h+\"/\"+db+\"?sslmode=verify-full\")\n\t\tc, err = sql.Open(d, \"postgres://\"+u+\":\"+p+\"@\"+h+\"/\"+db)\n\t}\n\t\n\tif err != nil {\n\t\treturn nil,err\n\t} else {\n\t\t//defer c.Close()\n\t\treturn c,nil\n\t}\n\n}", "title": "" }, { "docid": "cc9c0ba22da8714d09b49b9e55842acf", "score": "0.5808125", "text": "func GetConnection() (*mongo.Database,error) {\n\t//select client options\n\tclientOptions := options.Client().ApplyURI(config.MongoURI)\n\n\t//connect to MongoDB\n\tmongoClient, err := mongo.Connect(context.TODO(),clientOptions)\n\n\tif err != nil {\n\t\tlog.Println(\"Error in connecting to MongoDB\" + err.Error())\n\t\treturn nil,err\n\t}\n\n\tlog.Println(\"Connected to MongoDB : \"+ config.MongoURI)\n\n\treturn mongoClient.Database(config.Database),nil\n}", "title": "" }, { "docid": "315544e58771ec0100e0a11a99585f0a", "score": "0.5806877", "text": "func Connect(config *SQLConfig) *sql.DB {\n\tconnectionURI := fmt.Sprintf(\"%s:%s@/%s?parseTime=true\", config.User, config.Password, config.Database)\n\n\tdb, err := sql.Open(\"mysql\", connectionURI)\n\tif err != nil { // most likely the SQL config was faulty\n\t\tpanic(err)\n\t}\n\n\t// See \"Important settings\" section.\n\tdb.SetConnMaxLifetime(time.Minute * 3) // a connection can only be active for 3 minutes\n\tdb.SetMaxOpenConns(10) // if this exceeds the server will panic and stop\n\tdb.SetMaxIdleConns(10) // connection pool, so close the connection when it's not being used anymore\n\n\treturn db // can be used to execute SQL queries\n}", "title": "" }, { "docid": "7143cc00b82dab1ac9e3eadb588fb39a", "score": "0.57964754", "text": "func connectDB(cfg DBConfig) (*sql.DB, error) {\n\tvar dsn string\n\n\t// Different DSNs for different types.\n\tif cfg.Type == dbPostgres {\n\t\tdsn = fmt.Sprintf(\"user=%s dbname=%s password=%s sslmode=disable port=%d host=%s\",\n\t\t\tcfg.Username, cfg.DBname, cfg.Password, cfg.Port, cfg.Host)\n\t} else if cfg.Type == dbMySQL {\n\t\tdsn = fmt.Sprintf(\"%s:%s@tcp(%s:%d)/%s\",\n\t\t\tcfg.Username, cfg.Password, cfg.Host, cfg.Port, cfg.DBname)\n\t}\n\n\tdb, err := sql.Open(cfg.Type, dsn)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error connecting to DB: %v\", err)\n\t}\n\n\tdb.SetMaxIdleConns(cfg.MaxIdleConns)\n\tdb.SetMaxOpenConns(cfg.MaxActiveConns)\n\tdb.SetConnMaxLifetime(time.Second * cfg.ConnectTimeout)\n\n\t// Ping database to check for connection issues.\n\tif err = db.Ping(); err != nil {\n\t\treturn nil, fmt.Errorf(\"Couldn't connect to DB: %v\", err)\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "bf1927800360d3b8ef3593eb4a42648a", "score": "0.57803494", "text": "func ConnectFromEnv() (*sql.DB, error) {\n\tconn_string := fmt.Sprintf(\n\t\t\"dbname=%s user=%s password=%s host=%s port=%s sslmode=%s\",\n\t\tos.Getenv(\"PG_DBNAME\"),\n\t\tos.Getenv(\"PG_USER\"),\n\t\tos.Getenv(\"PG_PASS\"),\n\t\tos.Getenv(\"PG_HOST\"),\n\t\tos.Getenv(\"PG_PORT\"),\n\t\tos.Getenv(\"PG_SSLMODE\"))\n\tdb, err := sql.Open(\"postgres\", conn_string)\n\tif err != nil {\n\t\tlog.Printf(\"[!] dbase couldn't open database connection: %s\",\n\t\t\terr)\n\t\tdb = nil\n\t}\n\n\treturn db, err\n}", "title": "" }, { "docid": "1a03bdbf4c05b4fe97388cd5d32a4e8d", "score": "0.57799625", "text": "func (s *userServiceServer) connect(ctx context.Context) (*sql.Conn, error) {\n\tc, err := s.db.Conn(ctx)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Unknown, \"failed to connect to database-> \"+err.Error())\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "4c6e2c67744565f122a85d5224803da1", "score": "0.5778074", "text": "func Connection() {\r\n\tauthDB := fmt.Sprintf(\"host=%s port=%s user=%s dbname=%s sslmode=disable password=%s\",\r\n\t\tos.Getenv(\"DB_HOST\"),\r\n\t\tos.Getenv(\"DB_PORT\"),\r\n\t\tos.Getenv(\"DB_USER\"),\r\n\t\tos.Getenv(\"DB_NAME\"),\r\n\t\tos.Getenv(\"DB_PASS\"),\r\n\t)\r\n\r\n\tconn, err = gorm.Open(\"postgres\", authDB)\r\n\tif err != nil {\r\n\t\tlogging.Error(\"DB\", err)\r\n\t}\r\n}", "title": "" }, { "docid": "338c6c2d38af355a10711d3d968b1a90", "score": "0.57758015", "text": "func GetDbAdminConnection() *sql.DB {\n\treturn GetDbConnection(GetString(DB_ADMIN_ROLE))\n}", "title": "" }, { "docid": "01af63029f354992c79825fd6f3579c0", "score": "0.57741106", "text": "func getConnectionString() string {\n host := getParamString(\"db.host\", \"\")\n port := getParamString(\"db.port\", \"3306\")\n user := getParamString(\"db.user\", \"\")\n pass := getParamString(\"db.password\", \"\")\n dbname := getParamString(\"db.name\", \"heliumink\")\n protocol := getParamString(\"db.protocol\", \"tcp\")\n //dbargs := getParamString(\"dbargs\", \"parseTime=true&tls=true&charset=utf8\")\n dbargs := getParamString(\"dbargs\", \"parseTime=true&charset=utf8\")\n\n if strings.Trim(dbargs, \" \") != \"\" {\n dbargs = \"?\" + dbargs\n } else {\n dbargs = \"\"\n }\n return fmt.Sprintf(\"%s:%s@%s([%s]:%s)/%s%s\", \n user, pass, protocol, host, port, dbname, dbargs)\n}", "title": "" }, { "docid": "30096a30d6c08baf4d81a11bf3489395", "score": "0.57693154", "text": "func MakeDbConnection(config *config.Config) (*sql.DB, error) {\n\turl := fmt.Sprintf(\"user=%v password=%v host=%v port=%v dbname=%v\",\n\t\tconfig.DB.Username,\n\t\tconfig.DB.Password,\n\t\tconfig.DB.Endpoint,\n\t\tconfig.DB.Port,\n\t\tconfig.DB.Name)\n\n\tvar err error\n\tvar db *sql.DB\n\n\tif db, err = sql.Open(\"postgres\", url); err != nil {\n\t\treturn nil, fmt.Errorf(\"DB connect error : (%v)\", err)\n\t}\n\n\treturn db, nil\n}", "title": "" } ]
c4eda072a6b3519b02e58bbea37785df
Create a new user
[ { "docid": "f07f33ba822c48264f1dc1da9378874a", "score": "0.0", "text": "func (u *User) Create() error {\n\n\tsvc := db.GetSession()\n\n\t// generate a unique UUID for this user\n\tuserID, _ := gocql.RandomUUID()\n\n\tu.Guid = userID.String()\n\n\t// Salt the password\n\tu.Password = HashAndSalt([]byte(u.Password))\n\n\tav, err := dynamodbattribute.MarshalMap(u)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tinput := &dynamodb.PutItemInput{\n\t\tItem: av,\n\t\tTableName: aws.String(\"users\"),\n\t}\n\n\t_, err = svc.PutItem(input)\n\n\treturn err\n}", "title": "" } ]
[ { "docid": "a730d198b33c2a4f82672f0d3879f4a6", "score": "0.78569764", "text": "func CreateNewUser(c *fiber.Ctx) error {\n\n\treturn c.SendStatus(200)\n}", "title": "" }, { "docid": "644eccc8adfa212c580f2da793f0f93d", "score": "0.785146", "text": "func createUser(c *gin.Context) {\n\tif user, err := createNewUser(c.PostForm(\"firstname\"), c.PostForm(\"lastname\")); err == nil {\n\t\t// If the user is created successfully, show success page\n\t\tc.HTML(http.StatusOK, \"creation-successful.html\", gin.H{\"title\": \"Creation Successful\", \"payload\": user})\n\t} else {\n\t\tshowErrorPage(c, err.Error())\n\t}\n}", "title": "" }, { "docid": "d8ebc9275a6fca07a90e857cee6ae857", "score": "0.7843487", "text": "func CreateUser(w http.ResponseWriter, r *http.Request) {\r\n\tvar newUser model.UserInfo\r\n\r\n\terr := json.NewDecoder(r.Body).Decode(&newUser)\r\n\tif err != nil {\r\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t\treturn\r\n\t}\r\n\r\n\terr = database.AddNewUser(newUser)\r\n\tif err != nil {\r\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t\treturn\r\n\t}\r\n\r\n\tw.WriteHeader(http.StatusCreated)\r\n}", "title": "" }, { "docid": "fbb1fa0c495d8f1231ad2ce78873393b", "score": "0.7795738", "text": "func CreateUser(w http.ResponseWriter, r *http.Request) {\n\n\tuser := &models.User{}\n\tjson.NewDecoder(r.Body).Decode(user)\n\n\t// log.Println(\"user \", user)\n\n\t//check if user already present\n\tif _, ok := models.UserDetailMap[user.Email]; ok {\n\t\tvar resp = map[string]interface{}{\"message\": \"User with this Email address already exists\"}\n\t\tw.WriteHeader(http.StatusConflict)\n\t\tjson.NewEncoder(w).Encode(resp)\n\t\treturn\n\t}\n\n\tpass, err := bcrypt.GenerateFromPassword([]byte(user.Password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\terr := ErrorResponse{\n\t\t\tErr: \"Password Encryption failed\",\n\t\t}\n\t\tjson.NewEncoder(w).Encode(err)\n\t\treturn\n\t}\n\n\tuser.Password = string(pass)\n\n\tmodels.UserIDCounter++\n\n\tuser.UserID = models.UserIDCounter\n\n\t//insert in global map\n\tmodels.UserDetailMap[user.Email] = user\n\tmodels.UserIDMap[user.UserID] = user.Email\n\n\tw.WriteHeader(http.StatusCreated)\n}", "title": "" }, { "docid": "066c1a9baf1f605c6fb4d7655878ff50", "score": "0.7728639", "text": "func CreateUser(w http.ResponseWriter, r *http.Request) {\n\treqBody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tresponses.ReturnError(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tvar user models.User\n\tif err = json.Unmarshal(reqBody, &user); err != nil {\n\t\tresponses.ReturnError(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tif err = user.Prepare(\"SignUp\"); err != nil {\n\t\tresponses.ReturnError(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tdb, err := db.Connect()\n\tif err != nil {\n\t\tresponses.ReturnError(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tdefer db.Close()\n\n\tusersRepository := repositories.NewUsersRepository(db)\n\tuser.ID, err = usersRepository.Create(user)\n\tif err != nil {\n\t\tresponses.ReturnError(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tresponses.ReturnJSON(w, http.StatusCreated, user)\n}", "title": "" }, { "docid": "b183cbb95f1d3652c8db8670a99041ba", "score": "0.77048725", "text": "func UserCreate(c *fiber.Ctx) error {\n\tuser := &models.User{\n\t\tName: c.FormValue(\"user\"),\n\t}\n\tdatabase.Insert(user)\n\treturn c.JSON(fiber.Map{\n\t\t\"success\": true,\n\t\t\"user\": user,\n\t})\n}", "title": "" }, { "docid": "827b6f5742edfeda9a63956143d8117a", "score": "0.77035755", "text": "func CreateUser(w http.ResponseWriter, r *http.Request) {\n\trequestBody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\terrors.Err(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tvar user models.User\n\tif err = json.Unmarshal(requestBody, &user); err != nil {\n\t\terrors.Err(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tif err = validations.Prepare(&user, \"register\"); err != nil {\n\t\terrors.Err(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tdb, err := database.Connect()\n\tif err != nil {\n\t\terrors.Err(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\trepositorie := repositories.NewUserRepositorie(db)\n\tuser.ID, err = repositorie.Create(user)\n\tif err != nil {\n\t\terrors.Err(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tpresentation.JSON(w, http.StatusCreated, user)\n}", "title": "" }, { "docid": "c406f16051ade47c2d544ac6c807f1cd", "score": "0.77001154", "text": "func userCreate(w http.ResponseWriter, r *http.Request, create func(user *datastructures.User) (*datastructures.User, error), t string) {\n\t// Check if user is a support\n\tu := CtxGetValue(r, STORE_AUTH).(*datastructures.User)\n\tif u == nil {\n\t\tutils.WriteError(w, http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError), \"\")\n\t\treturn\n\t}\n\tif u.Type != datastructures.USER_TYPE_SUPPORT {\n\t\tutils.WriteError(w, http.StatusUnauthorized, http.StatusText(http.StatusUnauthorized), \"Support required\")\n\t\treturn\n\t}\n\n\tvar payload *userCreatePayload\n\n\t// Bind body with payload\n\terr := utils.BindJSON(r, &payload)\n\tif err != nil {\n\t\tutils.WriteError(w, http.StatusBadRequest, http.StatusText(http.StatusBadRequest), err.Error())\n\t\treturn\n\t}\n\n\t// Generate Password\n\tp, err := utils.GeneratePassword()\n\tif err != nil {\n\t\tutils.WriteError(w, http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError), \"\")\n\t\treturn\n\t}\n\n\t// Init the new user\n\tpayload.Firstname = t\n\tpayload.Lastname = t\n\tpayload.User.Password = p\n\tpayload.Password = p\n\tu, err = create(&payload.User)\n\tpayload.User = *u\n\tif err != nil {\n\t\tutils.WriteError(w, http.StatusBadRequest, http.StatusText(http.StatusBadRequest), err.Error())\n\t\treturn\n\t}\n\tutils.WriteJSON(w, payload)\n}", "title": "" }, { "docid": "da5abc57780c80ae879c3395a33c2b27", "score": "0.76896036", "text": "func Create(c *gin.Context) {\n\tvar user users.User\n\n\t// read the body from request, and bind user JSON\n\tif err := c.ShouldBindJSON(&user); err != nil {\n\t\tjsonErr := rest_errors.NewBadRequestError(\"invalid json body\")\n\t\tc.JSON(jsonErr.Status(), jsonErr)\n\t\treturn\n\t}\n\n\tresult, saveErr := services.UsersService.CreateUser(&user)\n\tif saveErr != nil {\n\t\tc.JSON(saveErr.Status(), saveErr)\n\t\treturn\n\t}\n\tc.JSON(http.StatusCreated, result.Marshall(c.GetHeader(\"X-PUBLIC\") == \"true\"))\n}", "title": "" }, { "docid": "abc2eddc7fec4c2ecd6cee4e675380be", "score": "0.7660603", "text": "func (obj *UserController) CreateNewUser(c *fiber.Ctx) error {\n\tuserRequest := new(request.UserRequest)\n\n\tif err := c.BodyParser(userRequest); err != nil {\n\t\treturn util.ResponseError(err.Error(), nil)\n\t}\n\n\thash, err := util.HashPassword(userRequest.Password)\n\tif err != nil {\n\t\treturn util.ResponseError(\"Không thể mã hoá mật khẩu\", err)\n\t}\n\n\tuser := model.User{\n\t\tName: userRequest.Name,\n\t\tUsername: userRequest.Username,\n\t\tPassword: hash,\n\t\tGender: userRequest.Gender,\n\t\tStatus: util.StatusActivated,\n\t}\n\n\tif _, err = obj.userRepository.SaveUser(user); err != nil {\n\t\treturn util.ResponseError(err.Error(), nil)\n\t}\n\n\treturn util.ResponseSuccess(\"Thành công\", nil)\n}", "title": "" }, { "docid": "d9317a4fcb20b289a7ed57a437ed415c", "score": "0.76428175", "text": "func Create(w http.ResponseWriter, r *http.Request) {\n\tauth.EnableCors(&w)\n\tvar newUser User\n\terr := json.NewDecoder(r.Body).Decode(&newUser)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t// Make token\n\ttoken := tokenGenerator()\n\tJSONtoken := APIToken{token}\n\tjs, err := json.Marshal(JSONtoken)\n\tif err != nil {\n\t\t// handle error\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(newUser.Password)\n\tnewUser.Password = hashAndSalt([]byte(newUser.Password))\n\tfmt.Println(newUser.Password)\n\terr = json.Unmarshal(js, &newUser)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 400)\n\t\treturn\n\t}\n\tif err != nil {\n\t\t// handle error\n\t\tlog.Fatal(err)\n\t}\n\t// Create\n\tdb.DB.Create(&newUser)\n\n\t//json resp\n\tmsg := Message{\"success\", \"User added.\"}\n\tjs, err = json.Marshal(msg)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(js)\n}", "title": "" }, { "docid": "e4cf5df37c1a3db92fe58a6eaf7a2834", "score": "0.7622255", "text": "func createUser(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tvar newUser user\n\treqBody, err := ioutil.ReadAll(r.Body)\n\tfatalError(err)\n\n\tjson.Unmarshal(reqBody, &newUser)\n\n\tdb := openConnection()\n\n\t//insert data\n\tinsertDynStmt := `INSERT into users(id, name, gender, email, address) values($1, $2, $3, $4, $5)`\n\t_, i := db.Exec(insertDynStmt, newUser.ID, newUser.Name, newUser.Gender, newUser.Email, newUser.Address)\n\tCheckError(i)\n\n\tdefer db.Close()\n\n\tw.WriteHeader(http.StatusCreated)\n\tusers = getUsers()\n\n\tjson.NewEncoder(w).Encode(newUser)\n}", "title": "" }, { "docid": "b0e0d11fd216e22385bd412b771dee64", "score": "0.7604181", "text": "func CreateUser(w http.ResponseWriter, response *http.Request) {\n\n\trequest, error := ioutil.ReadAll(response.Body)\n\n\tif error != nil {\n\t\tresponses.GetError(w, http.StatusUnprocessableEntity, error)\n\t\treturn\n\t}\n\n\tvar user model.User\n\tif error = json.Unmarshal(request, &user); error != nil {\n\t\tresponses.GetError(w, http.StatusBadRequest, error)\n\t\treturn\n\t}\n\n\tdb, error := database.Connect()\n\tif error != nil {\n\t\tresponses.GetError(w, http.StatusInternalServerError, error)\n\t\treturn\n\t}\n\tdefer db.Close()\n\n\trepository := repository.NewUserRepository(db)\n\tuser.ID, error = repository.Create(user)\n\tif error != nil {\n\t\tresponses.GetError(w, http.StatusInternalServerError, error)\n\t\treturn\n\t}\n\tresponses.GetJsonResponse(w, http.StatusCreated, user)\n}", "title": "" }, { "docid": "c76df06a00d28b256a863c52688f8897", "score": "0.76033074", "text": "func (u *Users) Create(w http.ResponseWriter, r *http.Request) {\n\tvar user models.User\n\tjson.NewDecoder(r.Body).Decode(&user)\n\n\tif err := u.us.Create(&user); err != nil {\n\t\tpanic(err)\n\t}\n\tjwtToken, err := u.signIn(w, &user)\n\tif err != nil {\n\t\thttp.Redirect(w, r, \"/login\", http.StatusFound)\n\t\treturn\n\t}\n\terr = json.NewEncoder(w).Encode(jwtToken)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "4de711ec27b39d2be8c0ef1684045c59", "score": "0.75969726", "text": "func CreateUser(res http.ResponseWriter, req *http.Request) {\n\t// Temporary user variable when grabbing the information from the body\n\tvar user UserConstruct\n\n\t// Decode the information and pass into the temporary variable\n\terr := json.NewDecoder(req.Body).Decode(&user)\n\tif err, ok := OnError(err, http.StatusBadRequest); !ok {\n\t\tres.Write(err)\n\t\treturn\n\t}\n\n\t//Hash the current password from the temporary variable\n\thashedPassword, err := bcrypt.GenerateFromPassword([]byte(user.Password), bcrypt.DefaultCost)\n\tif err, ok := OnError(err, http.StatusBadRequest); !ok {\n\t\tres.Write(err)\n\t\treturn\n\t}\n\n\t// Prepare Qeury returns statment to insert new user\n\tstmt, err := DB.Prepare(`INSERT INTO users(firstname, lastname, email, admin, creator, organization, password, register)\n\t\tVALUES($1,$2,$3,$4,$5,$6,$7,$8);`)\n\tdefer stmt.Close()\n\tif err, ok := OnError(err, http.StatusInternalServerError); !ok {\n\t\tres.Write(err)\n\t\treturn\n\t}\n\n\t// Execute the prepared statement and add to the DB\n\t_, err = stmt.Exec(user.FirstName, user.LastName, user.Email, false, false, user.Organization, string(hashedPassword), time.Now())\n\tif err, ok := OnError(err, http.StatusInternalServerError); !ok {\n\t\tres.Write(err)\n\t\treturn\n\t}\n\n\t// Generate a new signing key to assign to the created user\n\ttoken := jwt.New(jwt.SigningMethodRS256)\n\tSignedKey, err := token.SignedString(SignKey)\n\tif err, ok := OnError(err, http.StatusUnauthorized); !ok {\n\t\tres.Write(err)\n\t\treturn\n\t}\n\n\t// Create the new user and Marshal data to be sent back\n\tuserInfo, err := json.Marshal(struct {\n\t\tFirstName string `json:\"firstname\"`\n\t\tLastName string `json:\"lastname\"`\n\t\tToken string `json:\"token\"`\n\t}{\n\t\tFirstName: user.FirstName,\n\t\tLastName: user.LastName,\n\t\tToken: SignedKey,\n\t})\n\tif err, ok := OnError(err, http.StatusInternalServerError); !ok {\n\t\tres.Write(err)\n\t\treturn\n\t}\n\n\t// Respond with user information and json key\n\tres.Header().Set(\"Content-Type\", \"application/json\")\n\tres.Write(userInfo)\n\n}", "title": "" }, { "docid": "8a8293430c63d4139f3260a7d133d6dd", "score": "0.75962925", "text": "func (u *Users) Create(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tur := new(createUserRequest)\n\terr := json.NewDecoder(r.Body).Decode(ur)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusUnprocessableEntity)\n\t\treturn\n\t}\n\n\tuser := models.User{\n\t\tID: \"1\",\n\t\tName: ur.Name,\n\t\tEmail: ur.Email,\n\t\tPassword: ur.Password,\n\t}\n\terr = u.us.Register(&user)\n\tif err != nil {\n\t\tswitch err {\n\t\tcase models.ErrEmailRequired, models.ErrEmailInvalid, models.ErrEmailTaken, models.ErrPasswordRequired, models.ErrPasswordTooShort, models.ErrNameRequired:\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\tjson.NewEncoder(w).Encode(&messageResponse{\n\t\t\t\tMessage: err.Error(),\n\t\t\t})\n\t\tdefault:\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t}\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusCreated)\n\tjson.NewEncoder(w).Encode(&loginResponse{\n\t\tmessageResponse{Message: fmt.Sprintf(\"User %v created!\", user.Name)},\n\t\tuser.AccessToken,\n\t})\n}", "title": "" }, { "docid": "56e100fe3e5ad710813231a8537fd27d", "score": "0.7587756", "text": "func createUser(db *pg.DB, username, email string) (user models.User, err error) {\n\tuser = models.User{\n\t\tUsername: username,\n\t\tEmail: email,\n\t\tCreatedAt: time.Now(),\n\t}\n\terr = db.Insert(&user)\n\treturn\n}", "title": "" }, { "docid": "c05fe39deb8583b9095c4f883a02f8db", "score": "0.75806266", "text": "func CreateUser(w http.ResponseWriter, r *http.Request) {\n\n\tuser := &models.User{}\n\tjson.NewDecoder(r.Body).Decode(user)\n\n\tpass, err := bcrypt.GenerateFromPassword([]byte(user.Password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\terr := ErrorResponse{\n\t\t\tErr: \"Password Encryption failed\",\n\t\t}\n\t\tjson.NewEncoder(w).Encode(err)\n\t}\n\n\tuser.Password = string(pass)\n\n\tcreatedUser := db.Create(user)\n\tvar errMessage = createdUser.Error\n\n\tif createdUser.Error != nil {\n\t\tfmt.Println(errMessage)\n\t}\n\tjson.NewEncoder(w).Encode(createdUser)\n}", "title": "" }, { "docid": "645a1c4c2b9ba24c99a90463586b3366", "score": "0.7552136", "text": "func NewUser(w http.ResponseWriter, r *http.Request) {\n\tdb, err = gorm.Open(\"postgres\", Config.DbConnectionString)\n\tif err != nil {\n\t\tpanic(\"Could not connect to the database\")\n\t}\n\tdefer db.Close()\n\n\tdecoder := json.NewDecoder(r.Body)\n\n\tvar newUser User\n\terr := decoder.Decode(&newUser)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\thashedPassword := hashAndSalt([]byte(newUser.Password))\n\n\tdb.Create(&User{Email: newUser.Email, Password: hashedPassword})\n\tw.WriteHeader(http.StatusCreated)\n}", "title": "" }, { "docid": "d17979691fd34df7d2766a51020af8af", "score": "0.7546643", "text": "func (s *Setup) CreateUser(w http.ResponseWriter, r *http.Request) {\n\trequest := model.User{}\n\tif err := json.NewDecoder(r.Body).Decode(&request); err != nil {\n\t\terrhandler.DecodeError(w, r, s.logger, errDecode, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tctx := r.Context()\n\n\tif err := s.validator.StructCtx(ctx, request); err != nil {\n\t\tvalidation.ValidatorMessage(w, err)\n\t\treturn\n\t}\n\n\thashPass, err := s.HashPassword(request.Password, 10)\n\tif err != nil {\n\t\terrhandler.DecodeError(w, r, s.logger, errPassHash, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\thashAPI := uuid.New()\n\n\tuser := model.User{\n\t\tName: request.Name,\n\t\tEmail: request.Email,\n\t\tPassword: hashPass,\n\t\tAPIToken: hashAPI,\n\t\tCreatedAt: time.Now(),\n\t\tUpdatedAt: time.Now(),\n\t}\n\n\terr = s.model.CreateUser(ctx, &user)\n\tif err != nil {\n\t\terrhandler.DecodeError(w, r, s.logger, errCreate, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\ts.ToJSON(w, http.StatusCreated, &errhandler.APIMessage{Message: \"User created successfully!\"})\n}", "title": "" }, { "docid": "c50557e1fdd010ebe2e6c92b63fdc006", "score": "0.75429034", "text": "func CreateUser(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\tvar u User\n\tif err := json.NewDecoder(r.Body).Decode(&u); err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, \"Invalid request payload\")\n\t\treturn\n\t}\n\tu.ID = bson.NewObjectId()\n\tif err := dao.CreateUser(u); err != nil {\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\trespondWithJson(w, http.StatusCreated, u)\n}", "title": "" }, { "docid": "3d5c88a287c65d727cb41c174eda84eb", "score": "0.7535042", "text": "func (a *Actions) CreateNewUser(userID uint, password string) error {\n\tuser := &users.User{\n\t\tTelegramID: userID,\n\t\tPassword: password,\n\t}\n\tmanager := users.NewUserManager(a.Db)\n\treturn manager.Save(user)\n}", "title": "" }, { "docid": "a0543109a42a904677ce0b1aab93b4ab", "score": "0.7520081", "text": "func (u *Users) Create(w http.ResponseWriter, r *http.Request) {\n\tif err := r.ParseForm(); err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Fprintln(w, r.PostForm[\"email\"])\n\tfmt.Fprintln(w, r.PostForm[\"password\"])\n}", "title": "" }, { "docid": "de10bfc798af8f250516b26c9f9d14f2", "score": "0.7510773", "text": "func (g *AuthService) Create(ctx context.Context, req *auth.CreateUserRequest, rsp *auth.CreateUserResponse) error {\n\treturn nil\n}", "title": "" }, { "docid": "df42c4d773e081300f2440b42f88a64e", "score": "0.7503046", "text": "func (u UserController) Create(c *gin.Context) {\n var newUser User\n newUser.FirstName = c.Query(\"firstname\")\n newUser.LastName = c.Query(\"lastname\")\n newUser.Email = c.Query(\"email\")\n pass, _ := c.Get(\"password\")\n newUser.Password = fmt.Sprintf(\"%v\", pass)\n\n if !newUser.IsValid() {\n c.String(http.StatusBadRequest, \"Invalid input\")\n } else if newUser.DoesExist() {\n c.String(http.StatusConflict, fmt.Sprintf(\"User with email %s already exists\", newUser.Email))\n } else {\n newUser.Save()\n Login(c, newUser.Email)\n c.String(http.StatusConflict, \"User has been created\")\n }\n}", "title": "" }, { "docid": "01eda4026b7bd5de35f41f30d604101d", "score": "0.7502862", "text": "func CreateUser(c *fiber.Ctx) error {\n\tu := new(models.User)\n\n\tif err := c.BodyParser(u); err != nil {\n\t\treturn c.JSON(fiber.Map{\n\t\t\t\"error\": true,\n\t\t\t\"input\": \"Please review your input\",\n\t\t})\n\t}\n\n\t// validate if the email, username and password are in correct format\n\terrors := util.ValidateRegister(u)\n\tif errors.Err {\n\t\treturn c.JSON(errors)\n\t}\n\n\tif count := db.DB.Where(&models.User{Email: u.Email}).First(new(models.User)).RowsAffected; count > 0 {\n\t\terrors.Err, errors.Email = true, \"Email is already registered\"\n\t}\n\tif count := db.DB.Where(&models.User{Username: u.Username}).First(new(models.User)).RowsAffected; count > 0 {\n\t\terrors.Err, errors.Username = true, \"Username is already registered\"\n\t}\n\tif errors.Err {\n\t\treturn c.JSON(errors)\n\t}\n\n\t// Hashing the password with a random salt\n\tpassword := []byte(u.Password)\n\thashedPassword, err := bcrypt.GenerateFromPassword(\n\t\tpassword,\n\t\trand.Intn(bcrypt.MaxCost-bcrypt.MinCost)+bcrypt.MinCost,\n\t)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tu.Password = string(hashedPassword)\n\n\tif err := db.DB.Create(&u).Error; err != nil {\n\t\treturn c.JSON(fiber.Map{\n\t\t\t\"error\": true,\n\t\t\t\"general\": \"Something went wrong, please try again later. 😕\",\n\t\t})\n\t}\n\n\t// setting up the authorization cookies\n\taccessToken, refreshToken := util.GenerateTokens(u.UUID.String())\n\taccessCookie, refreshCookie := util.GetAuthCookies(accessToken, refreshToken)\n\tc.Cookie(accessCookie)\n\tc.Cookie(refreshCookie)\n\n\treturn c.Status(fiber.StatusOK).JSON(fiber.Map{\n\t\t\"access_token\": accessToken,\n\t\t\"refresh_token\": refreshToken,\n\t})\n}", "title": "" }, { "docid": "a5d96d5d7954bd3903e9683a775f68e9", "score": "0.7501133", "text": "func newUser(name, email, password string) models.User {\n\tvar u models.User\n\tif len(name) != 0 {\n\t\tu.Name = template.HTMLEscapeString(name)\n\t}\n\tu.Email = template.HTMLEscapeString(email)\n\tu.Password = []byte(template.HTMLEscapeString(password))\n\treturn u\n}", "title": "" }, { "docid": "c1d47e8377afd3420849f0f33bac7871", "score": "0.7500694", "text": "func CreateUser(c *gin.Context) {\n\tvar user models.User\n\terr := c.Bind(&user)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\tc.Header(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tc.AbortWithError(400, errors.New(\"Bad JSON\"))\n\t\treturn\n\t}\n\tfmt.Println(user)\n\n\tpassword, err := bcrypt.GenerateFromPassword([]byte(user.Password), 10)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\tc.Header(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tc.AbortWithError(400, err)\n\t\treturn\n\t}\n\n\tlog.Debug(\"Generate password\")\n\n\ttx, err := database.DB.Begin()\n\tstmt, err := tx.Prepare(\"INSERT INTO users (username, first_name, last_name, password, status) VALUES ($1, $2, $3, $4, $5)\")\n\tif err != nil {\n\t\ttx.Rollback()\n\t\tlog.Error(err)\n\t\tc.Header(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tc.AbortWithError(400, err)\n\t\treturn\n\t}\n\n\t_, err = stmt.Exec(user.Username, user.FirstName, user.LastName, string(password), true)\n\tif err != nil {\n\t\ttx.Rollback()\n\t\tlog.Error(err)\n\t\tc.Header(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tc.AbortWithError(400, err)\n\t\treturn\n\t}\n\n\ttx.Commit()\n\t//url := location.Get(c)\n\t//c.Header(\"Location\", fmt.Sprintf(\"%s%s/%s\", url, c.Request.URL, fmt.Sprintf(\"%d\", lastID)))\n\tc.Data(201, gin.MIMEJSON, nil)\n}", "title": "" }, { "docid": "fa28a331c63cddb11b3e918fdf1e36b5", "score": "0.7497036", "text": "func CreateUser(w http.ResponseWriter, r *http.Request) {\n\tdata := &UserRequest{}\n\tif err := render.Bind(r, data); err != nil {\n\t\trender.Render(w, r, ErrBadRequest(err))\n\t\treturn\n\t}\n\tuser := data.User\n\tsummonerID, err := checkSummonerID(data.SummonerName, data.Code)\n\tif err != nil {\n\t\trender.Render(w, r, ErrAccountLink(err))\n\t\treturn\n\t}\n\tuser.SummonerID = summonerID\n\tid, err := dbNewUser(user)\n\tif err != nil {\n\t\trender.Render(w, r, ErrDB(err))\n\t\treturn\n\t}\n\tuser.ID = id\n\trender.Render(w, r, NewUserResponse(user))\n}", "title": "" }, { "docid": "05e3e311a28b1fee91728f141ebec084", "score": "0.7496053", "text": "func (h *Handlers) CreateUser(w http.ResponseWriter, r *http.Request) (interface{}, error) {\n\tif r.Method == methodPost {\n\t\treq := &models.CreateUserRequest{}\n\n\t\tdecoder := json.NewDecoder(r.Body)\n\t\terr := decoder.Decode(&req)\n\n\t\tif err != nil {\n\t\t\th.logger.Error(err)\n\t\t\treturn nil, fmt.Errorf(\"Invalid format\")\n\t\t}\n\n\t\tif err = req.Validate(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tuser := &models.User{Name: *req.Name, Email: *req.Email}\n\n\t\terr = h.stg.CreateUser(user)\n\n\t\tif err != nil {\n\t\t\th.logger.Error(err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\th.stg.LogCreateUser(user)\n\n\t\texp := time.Now().Add(24 * 365 * time.Hour)\n\t\ttokenString, err := h.auth.GenerateToken(user.ID.Hex(), exp)\n\n\t\tif err != nil {\n\t\t\th.logger.Error(err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres := &models.CreateUserResponse{Token: tokenString, Expires: exp.Unix()}\n\t\treturn res, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"Invalid method: %s\", r.Method)\n}", "title": "" }, { "docid": "0625dfa3d2ac499ca4fde7a89aba69b0", "score": "0.7493317", "text": "func (u *UserController) CreateNewUser(c *gin.Context) {\n\tuser, error := getUserDataBaseOnRequest(c)\n\n\tif error != nil {\n\t\thelpers.OutputErr(error, c)\n\t} else {\n\t\tresult := user.CreateLogin()\n\n\t\tif result != constants.OK {\n\t\t\tc.JSON(200, gin.H{\n\t\t\t\t\"success\": false,\n\t\t\t\t\"message\": result,\n\t\t\t})\n\t\t} else {\n\t\t\tc.JSON(200, gin.H{\n\t\t\t\t\"success\": true,\n\t\t\t})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0998d5ae42c240a96c9445fed8f35fdf", "score": "0.7474883", "text": "func CreateUser(c *gin.Context) {\n\tvar user Models.User\n\tc.BindJSON(&user)\n\terr := Models.CreateUser(&user)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tc.AbortWithStatus(http.StatusNotFound)\n\t} else {\n\t\tc.JSON(http.StatusOK, user)\n\t}\n}", "title": "" }, { "docid": "a8f733502f5182c12005befd4adf2bda", "score": "0.74736583", "text": "func NewUser(w http.ResponseWriter, r *http.Request) {\r\n\tvar newUser *authentication.User\r\n\terr := json.NewDecoder(r.Body).Decode(&newUser)\r\n\tif err != nil {\r\n\t\tresponse.HTTPError(w, r, http.StatusBadRequest, \"Failed to parse user\")\r\n\t\treturn\r\n\t}\r\n\r\n\tif newUser.Password == \"\" || newUser.Nickname == \"\" {\r\n\t\tresponse.HTTPError(w, r, http.StatusBadRequest, \"invalid information\")\r\n\t\treturn\r\n\t}\r\n\r\n\tctx, cancel := context.WithCancel(r.Context())\r\n\tdefer cancel()\r\n\tusersData := data.NewUserData()\r\n\terr = usersData.NewUser(ctx, newUser)\r\n\tif err != nil {\r\n\t\tresponse.HTTPError(w, r, http.StatusBadRequest, err.Error())\r\n\t\treturn\r\n\t}\r\n\r\n\trender.Status(r, http.StatusCreated)\r\n\trender.JSON(w, r, render.M{\"user\": newUser.Nickname})\r\n\r\n}", "title": "" }, { "docid": "7e0e3e804c5b2eaddf627796e7efc999", "score": "0.74695086", "text": "func createUser(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(r.Method,r.URL.Path)\n\tif r.Method == \"POST\" {\n\t\t\tvar new_user User\n\t\t\terr := json.NewDecoder(r.Body).Decode(&new_user)\n\t\t\t if err != nil {\n\t\t\t\t\t http.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\t\t\t return\n\t\t\t }\n\t\t\t\tsaveUser(*u_collection,&new_user)\n\t\t\t\tfmt.Fprintf(w, \"created user\")\n\t}\n}", "title": "" }, { "docid": "37602a76247e1daf93faac033c8b89ed", "score": "0.7453608", "text": "func (cr *UserController) Create(cx *goweb.Context) {\n\t// Log Request\n\tLogRequest(cx.Request)\n\tif _, ok := cx.Request.Header[\"Authorization\"]; !ok {\n\t\tcx.RespondWithError(http.StatusUnauthorized)\n\t\treturn\n\t}\n\theader := cx.Request.Header.Get(\"Authorization\")\n\ttmpAuthArray := strings.Split(header, \" \")\n\n\tauthValues, err := base64.URLEncoding.DecodeString(tmpAuthArray[1])\n\tif err != nil {\n\t\terr = errors.New(\"Failed to decode encoded auth settings in http request.\")\n\t\tcx.RespondWithError(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tauthValuesArray := strings.Split(string(authValues), \":\")\n\tif conf.ANON_CREATEUSER == false && len(authValuesArray) != 4 {\n\t\tif len(authValuesArray) == 2 {\n\t\t\tcx.RespondWithErrorMessage(e.UnAuth, http.StatusUnauthorized)\n\t\t\treturn\n\t\t} else {\n\t\t\tcx.RespondWithError(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t}\n\tname := authValuesArray[0]\n\tpasswd := authValuesArray[1]\n\tadmin := false\n\tif len(authValuesArray) == 4 {\n\t\tif authValuesArray[2] != fmt.Sprint(conf.SECRET_KEY) {\n\t\t\tcx.RespondWithErrorMessage(e.UnAuth, http.StatusUnauthorized)\n\t\t\treturn\n\t\t} else if authValuesArray[3] == \"true\" {\n\t\t\tadmin = true\n\t\t}\n\t}\n\tu, err := user.New(name, passwd, admin)\n\tif err != nil {\n\t\t// Duplicate key check\n\t\tif e.MongoDupKeyRegex.MatchString(err.Error()) {\n\t\t\tlog.Error(\"Err@user_Create: duplicate key error\")\n\t\t\tcx.RespondWithErrorMessage(\"Username not available\", http.StatusBadRequest)\n\t\t\treturn\n\t\t} else {\n\t\t\tlog.Error(\"Err@user_Create: \" + err.Error())\n\t\t\tcx.RespondWithError(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\tcx.RespondWithData(u)\n\treturn\n}", "title": "" }, { "docid": "145ee9b25829310e7e84c63a74380971", "score": "0.7452001", "text": "func createUser(userName string, identities []string, groups []string, h *helper.H) (*userv1.User, error) {\n\tuser := &userv1.User{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: userName,\n\t\t},\n\t\tIdentities: identities,\n\t\tGroups: groups,\n\t}\n\treturn h.User().UserV1().Users().Create(context.TODO(), user, metav1.CreateOptions{})\n}", "title": "" }, { "docid": "50c3d3d7e2b374f7e3da968701a1d47b", "score": "0.74482983", "text": "func CreateUser(w http.ResponseWriter, r *http.Request) {\n\tvar user mod.User\n\tdefer r.Body.Close()\n\n\tif err := json.NewDecoder(r.Body).Decode(&user); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\terr := ser.CreateUser(r.Context(), user)\n\tif err == uti.ErrUserOk {\n\t\trespond(w, response{Message: \"Usuario ingresado correctamente\"}, http.StatusOK)\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\trespondError(w, err)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "1d69501bba58a4189e79a82863b22c3a", "score": "0.74456185", "text": "func CreateUser(c *gin.Context) {\n\tusers := model.User{\n\t\tEmail: c.PostForm(\"email\"),\n\t\tName: c.PostForm(\"name\"),\n\t\tUsername: c.PostForm(\"username\"),\n\t\tPassword: c.PostForm(\"password\"),\n\t}\n\t//check field can't empty\n\tif users.Username == \"\" || users.Name == \"\" || users.Password == \"\" || users.Email == \"\" {\n\t\tutil.CallUserError(c, \"field can't be null\", nil)\n\t\treturn\n\t}\n\t//check username exist or not\n\tvar exists model.User\n\tif err := config.DB.Where(\"username = ?\", users.Username).First(&exists).Error; err == nil {\n\t\tutil.CallServerError(c, \"username already exist\", err)\n\t\treturn\n\t}\n\t//Password Encryption\n\tpassword, err := bcrypt.GenerateFromPassword([]byte(users.Password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\tutil.CallServerError(c, \"password encryption failed\", err)\n\t\treturn\n\t}\n\n\tusers.Password = string(password)\n\terr = config.DB.Save(&users).Error\n\tif err != nil {\n\t\tutil.CallServerError(c, \"Failed Create User!\", err)\n\t}\n\tutil.CallSuccessOK(c, \"User created Successfully!\", users.ID)\n}", "title": "" }, { "docid": "49c742acf5f7396f3144026c72d4da0c", "score": "0.7439309", "text": "func UserCreate(response http.ResponseWriter, request *http.Request, routeParams httprouter.Params) {\n\tprintln(\"UserCreate\")\n\n\trequest.ParseForm()\n\n\t// Validation: is mail field set?\n\tif len(request.Form.Get(\"mail\")) < 1 {\n\t\t// Not set, send error\n\t\tJSONResponse := JSONError{\n\t\t\tStatus: \"Error\",\n\t\t\tHTTPErrorCode: http.StatusBadRequest,\n\t\t\tMessage: \"'mail' parameter is mandatory\",\n\t\t}\n\t\tJSONResponse.Send(response)\n\t\treturn\n\t}\n\n\t// Validate email via regexp\n\tvalidator := Validation{fieldType: FieldTypeMail, value: request.Form.Get(\"mail\")}\n\tvalidator.Run()\n\tif !validator.valid {\n\t\tJSONResponse := JSONError{\n\t\t\tStatus: \"Error\",\n\t\t\tHTTPErrorCode: http.StatusBadRequest,\n\t\t\tMessage: \"'mail' parameter is not valid. Please use a valid mail address. You sent: \" + request.Form.Get(\"mail\"),\n\t\t}\n\t\tJSONResponse.Send(response)\n\t\treturn\n\t}\n\n\t// Check for existence\n\tfound, _ := getUserByMail(request.Form.Get(\"mail\"))\n\tfmt.Printf(\"found mail: %+v\", found)\n\t// err is true if not found\n\tif len(found.Mail) > 0 {\n\t\tJSONResponse := JSONError{\n\t\t\tStatus: \"Error\",\n\t\t\tHTTPErrorCode: http.StatusBadRequest,\n\t\t\tMessage: \"A user is already registered with this mail\",\n\t\t}\n\t\tJSONResponse.Send(response)\n\t\treturn\n\t}\n\n\tfmt.Printf(\"mail %+v\", request.Form.Get(\"mail\"))\n\n\t// Creation\n\tuser := User{Mail: request.Form.Get(\"mail\")}\n\tuser.generateID()\n\tuser.insert()\n\n\t// @TODO insert to database\n\tfmt.Printf(\"new user: %+v\", user)\n\tsendJSONResponse(user, response)\n}", "title": "" }, { "docid": "74778a871faf363b3ceb24fb10497437", "score": "0.74373525", "text": "func createUser(w http.ResponseWriter, r *http.Request) {\n\tif strings.ToLower(r.Method) != \"post\" {\n\t\thttp.Error(w, \"HTTP POST only\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\terr := r.ParseForm()\n\tif err != nil {\n\t\thttp.Error(w, \"invalid parameters\", http.StatusBadRequest)\n\t\tlog.Println(\"error parsing createUser form:\", err.Error())\n\t\treturn\n\t}\n\tusername := r.Form.Get(\"username\")\n\tpassword := r.Form.Get(\"password\")\n\tif len(username) < 1 || len(password) < 1 {\n\t\thttp.Error(w, \"missing username or password\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tif ok, err := regexp.Match(userNameRule, []byte(username)); !ok || err != nil {\n\t\thttp.Error(w, \"username must have form of: \"+userNameRule, http.StatusBadRequest)\n\t\treturn\n\t}\n\terr = db.CreateUser(username, password)\n\tif err != nil {\n\t\tif strings.HasPrefix(err.Error(), \"UNIQUE constraint failed:\") {\n\t\t\thttp.Error(w, \"username allready in use\", http.StatusInternalServerError)\n\t\t} else {\n\t\t\thttp.Error(w, \"cannot register user:\", http.StatusInternalServerError)\n\t\t\tlog.Println(\"error:\", err.Error())\n\t\t}\n\t\treturn\n\t}\n\thttp.Redirect(w, r, \"/\", http.StatusTemporaryRedirect)\n}", "title": "" }, { "docid": "f037ee12e0b4659e8e9abe111fafe42c", "score": "0.74288315", "text": "func Createuser(response http.ResponseWriter, request *http.Request) {\n\tresponse.Header().Add(\"content-type\", \"application/json\")\n\tvar user User\n\tjson.NewDecoder(request.Body).Decode(&user)\n\tvar Newpass = user.Password\n\tuser.Password = getHashed256(Newpass)\n\tcollection := client.Database(\"appointytask\").Collection(\"users\")\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\tresult, _ := collection.InsertOne(ctx, user)\n\tjson.NewEncoder(response).Encode(result)\n}", "title": "" }, { "docid": "4b961b6b1d4722f4560e794f553100bb", "score": "0.74166566", "text": "func CreateUser(w http.ResponseWriter, r *http.Request) {\n\tbd, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tlog.Println(fmt.Errorf(\"couldn't get json body\"))\n\t\treturn\n\t}\n\n\tvar user *models.User\n\tvar login *models.Login\n\n\terr = json.Unmarshal(bd, &user)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlog.Println(fmt.Errorf(\"couldn't parse json body\"))\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(bd, &login)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t// return json with offending issue\n\t\tlog.Println(fmt.Errorf(\"failed to parse login data %s\", err))\n\t\treturn\n\t}\n\n\t// create user and check for errors\n\tif user.Create() != nil {\n\t\tw.WriteHeader(http.StatusConflict)\n\t\t// return json with conflicting fields\n\t\tlog.Println(fmt.Errorf(\"error creating user %s\", err))\n\t\treturn\n\t}\n\n\tuserAuth := &models.UserAuth{\n\t\tID: user.ID,\n\t\tEmail: user.Email,\n\t\tUsername: user.Username,\n\t\tVerified: false,\n\t\tHash: auth.HashPassword(login.Password),\n\t}\n\n\t// create internal user authentication model and check for errors\n\tif userAuth.Create() != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlog.Println(fmt.Errorf(\"failed to create internal user auth %s\", err))\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusCreated)\n\tlog.Println(\"Created new user \", user.Username)\n}", "title": "" }, { "docid": "2119da43386abf514228cd96af17da3c", "score": "0.7415939", "text": "func (s *UsersService) Create(user *User) (*User, *Response, error) {\n\tu := \"/api/v1/users\"\n\tv := new(User)\n\n\tresp, err := s.client.Call(\"POST\", u, user, v)\n\treturn v, resp, err\n}", "title": "" }, { "docid": "e8cacdc3058030967fb1dc55f20a2c97", "score": "0.74147826", "text": "func (uc UserController) CreateUser(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tu := common.User{}\n\tif r.Header.Get(\"Content-Type\") == \"application/json\" {\n\t\tjson.NewDecoder(r.Body).Decode(&u)\n\t} else {\n\t\tu.Username = r.FormValue(\"id\")\n\t\tu.Email = r.FormValue(\"email\")\n\t\tu.FirstName = r.FormValue(\"first_name\")\n\t\tu.LastName = r.FormValue(\"last_name\")\n\t\tu.Password = r.FormValue(\"password\")\n\t}\n\n\terr := u.ValidateSignup()\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprintf(w, \"%v\", err)\n\t}\n\n\tif uc.lp.ExistsUser(u.Username) == true {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprintf(w, \"User %s already exists\", u.Username)\n\t\treturn\n\t}\n\n\terr = uc.lp.AddUser(&u)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprintf(w, \"Unable to create user %s. Please try again\", u.Username)\n\t\treturn\n\t}\n\n\terr = uc.lp.AddGroup(ldap.Users)\n\tw.WriteHeader(http.StatusCreated)\n\tfmt.Fprintf(w, \"User %s created\", u.Username)\n}", "title": "" }, { "docid": "83d5f3be623f8086198f5006c0bb6e08", "score": "0.74113345", "text": "func (us *userService) Create(FirstName string, LastName string) {\n\tuser := models.User{Id: core.NewId(), FirstName: FirstName, LastName: LastName}\n\tus.db.Orm().Create(user)\n}", "title": "" }, { "docid": "b6f3ff7e8bb59416d5b32459213c9694", "score": "0.74061537", "text": "func Create(w http.ResponseWriter, r *http.Request) {\n\t//Init cassandra connection and wait until we're done\n\tSession = app.Init()\n\tdefer Session.Close()\n\n\t//Instanciate an user\n\tvar user User\n\n\t//Get POST values of the body\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tfmt.Fprintf(w, \"Can't retrieve the data from the request\")\n\t}\n\n\t//Marshal the POST values into our user\n\tjson.Unmarshal(body, &user)\n\tfmt.Println(user)\n\t//Insert our new user into the database\n\tif err := Session.Query(\"INSERT INTO users.users(uuid,auth0_id, email, birthday, country, firstname, language, lastname) VALUES(?, ?, ?, ?, ?, ?, ?, ?)\",\n\t\tgocql.TimeUUID(), user.Auth0_id, user.Mail, user.Birthday, user.Country, user.Firstname, user.Language, user.Lastname).Exec(); err != nil {\n\t\tpanic(err)\n\t}\n\n\t//Send HTTP Code 200\n\tw.WriteHeader(http.StatusCreated)\n}", "title": "" }, { "docid": "8aedae53beaae9050c777a575495756a", "score": "0.73948675", "text": "func (uc UserController) CreateUser(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\t// Stub an user to be populated from the body\n\tu := models.USER{}\n\n\t// Populate the user data\n\tjson.NewDecoder(r.Body).Decode(&u)\n\n\t// Add an Id\n\tu.ID = bson.NewObjectId()\n\n\t// Write the user to mongo\n\tuc.session.DB(ndpdbname).C(\"users\").Insert(u)\n\n\t// Marshal provided interface into JSON structure\n\tuj, _ := json.Marshal(u)\n\n\t// Write content-type, statuscode, payload\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(201)\n\tfmt.Fprintf(w, \"%s\", uj)\n}", "title": "" }, { "docid": "7083e19360c9e135c562763dd1a2a868", "score": "0.73924404", "text": "func CreateUser(w http.ResponseWriter, r *http.Request) {\n\tdata := &payloads.UserRequest{}\n\tif err := render.Bind(r, data); err != nil {\n\t\trender.Render(w, r, payloads.ErrInvalidRequest(err))\n\t\treturn\n\t}\n\n\t// Creating a new User\n\tuser := data.User\n\treturnedUser, err := models.LayerInstance().User.Insert(*user)\n\n\tif err != nil {\n\t\trender.Render(w, r, payloads.ErrInvalidRequest(err))\n\t\treturn\n\t}\n\tuserID := returnedUser.ID\n\n\tvar jwt string\n\t// Try to get current session\n\t// TODO: cache\n\tsession, err := models.LayerInstance().Session.GetUser(userID)\n\n\t// Session not found, create new session\n\tif err != nil || session == (models.Session{}) {\n\t\treturnedSession, err := models.LayerInstance().Session.Insert(userID)\n\t\tif err != nil {\n\t\t\trender.Render(w, r, payloads.ErrInternalError(err))\n\t\t\treturn\n\t\t} else {\n\t\t\tjwt = returnedSession.JWT\n\t\t}\n\t} else {\n\t\tjwt = session.JWT\n\t}\n\trender.Status(r, http.StatusCreated)\n\trender.Render(w, r, payloads.NewSessionResponse(jwt, &returnedUser))\n}", "title": "" }, { "docid": "77eea094ff2a5e9800643f6ceb660f8e", "score": "0.7381102", "text": "func (s service) Create(ctx context.Context, req CreateUserRequest) (User, error) {\n\n\tif err := req.Validate(); err != nil {\n\t\treturn User{}, err\n\t}\n\n\thash, err := bcrypt.GenerateFromPassword([]byte(req.Password), bcrypt.MinCost)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tid := entity.GenerateID()\n\tnow := time.Now()\n\terr = s.repo.Create(ctx, entity.User{\n\t\tID: id,\n\t\tEmail: req.Email,\n\t\tPassword: string(hash),\n\t\tCreatedAt: now,\n\t\tUpdatedAt: &now,\n\t})\n\tif err != nil {\n\t\treturn User{}, err\n\t}\n\treturn s.Get(ctx, id)\n}", "title": "" }, { "docid": "6ec5bb974ae91d0877d3720567560e8e", "score": "0.7380374", "text": "func CreateUser(w http.ResponseWriter, r *http.Request) (int, error) {\n\tvar user model.User\n\tvar registrationForm formStruct.RegistrationForm\n\tvar status int\n\tvar err error\n\n\tmodelHelper.BindValueForm(&registrationForm, r)\n\tusernameCandidate := SuggestUsername(registrationForm.Username)\n\tif usernameCandidate != registrationForm.Username {\n\t\treturn http.StatusInternalServerError, fmt.Errorf(\"Username already taken, you can choose: %s\", usernameCandidate)\n\t}\n\tif registrationForm.Email != \"\" && CheckEmail(registrationForm.Email) {\n\t\treturn http.StatusInternalServerError, errors.New(\"email address already in database\")\n\t}\n\tpassword, err := bcrypt.GenerateFromPassword([]byte(registrationForm.Password), 10)\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, err\n\t}\n\tregistrationForm.Password = string(password)\n\tuser, err = CreateUserFromForm(registrationForm)\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, err\n\t}\n\tif registrationForm.Email != \"\" {\n\t\tSendVerificationToUser(user, registrationForm.Email)\n\t}\n\tstatus, err = RegisterHandler(w, r)\n\treturn status, err\n}", "title": "" }, { "docid": "f62a75a1f6cb58b3acf1acc54c91c691", "score": "0.73630387", "text": "func (uh *UserHandler) Create(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\n\tvar user gosample.User\n\n\terr = json.Unmarshal(body, &user)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\n\tvar lastInsertID int64\n\tlastInsertID, err = uh.userService.Create(r.Context(), user)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\n\tuser.ID = lastInsertID\n\n\tJSONResponse(w, user)\n}", "title": "" }, { "docid": "61e61a8c20817bcb1959376832c0b694", "score": "0.7362847", "text": "func UserCreate(w http.ResponseWriter, r *http.Request) {\n r.ParseForm()\n userName := r.Form[\"username\"][0]\n password := r.Form[\"password\"][0]\n uid, err := raftStore.RequestPropose(newTimeoutCtx(), METHOD_UserCreate,\n UserCreateParams{UserInfo{\n UserName: userName,\n Password: password,\n }})\n var ret []byte\n if err != nil {\n w.WriteHeader(http.StatusInternalServerError)\n ret, _ = json.Marshal(requestRetType{\n \"result\": nil,\n \"error\": err.Error(),\n })\n } else {\n w.WriteHeader(http.StatusCreated)\n ret, _ = json.Marshal(requestRetType{\n \"result\": uid,\n \"error\": nil,\n })\n }\n w.Write(ret)\n}", "title": "" }, { "docid": "cc6153bf4594a5432bcf71460550c1c8", "score": "0.7349639", "text": "func CreateUser(id string, username string, password string, fName string, lName string, accounts []acc.Account) User {\n\treturn User{id, username, password, fName, lName, accounts}\n}", "title": "" }, { "docid": "e5681d9460749c456523479f9ea81055", "score": "0.7343903", "text": "func (a *App) CreateUser(w http.ResponseWriter, r *http.Request) {\n\tvar u users.User\n\tdecoder := json.NewDecoder(r.Body)\n\tif err := decoder.Decode(&u); err != nil {\n\t\tutils.RespondWithError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\tif err := u.Create(a.DB); err != nil {\n\t\tutils.RespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tutils.RespondWithJSON(w, http.StatusCreated, u)\n}", "title": "" }, { "docid": "3072e31342a5b85b65e0b6434bf703df", "score": "0.7342332", "text": "func (v UsersResource) Create(c buffalo.Context) error {\n\t// Allocate an empty User\n\tuser := &models.User{}\n\n\t// Bind user to the html form elements\n\tif err := c.Bind(user); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\t// user.Role = nulls.NewString(\"member\")\n\n\t// Get the DB connection from the context\n\ttx, ok := c.Value(\"tx\").(*pop.Connection)\n\tif !ok {\n\t\treturn errors.WithStack(errors.New(\"no transaction found\"))\n\t}\n\n\tif user.Password != user.ConfirmPassword {\n\t\treturn c.Render(422, r.JSON(map[string]interface{}{\"error\": \"passwords do not match!\"}))\n\t}\n\n\t// Validate the data from the html form\n\tverrs, err := tx.ValidateAndCreate(user)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif verrs.HasAny() {\n\t\t// Make the errors available inside the html template\n\t\tc.Set(\"errors\", verrs)\n\n\t\t// Render again the new.html template that the user can\n\t\t// correct the input.\n\t\treturn c.Render(422, r.JSON(map[string]interface{}{\"error\": verrs}))\n\t}\n\n\t// If there are no errors set a success message\n\tc.Flash().Add(\"success\", \"User was created successfully\")\n\n\tuser.Password = \"\"\n\tuser.ConfirmPassword = \"\"\n\t// and redirect to the users index page\n\treturn c.Render(201, r.JSON(user))\n}", "title": "" }, { "docid": "905380a499de60cc1ad75348fdce5034", "score": "0.7334155", "text": "func createUser(name string, email string) (*User, error) {\n\tvar l = logger.WithFields(logrus.Fields{\n\t\t\"method\": \"createUser\",\n\t\t\"param_email\": email,\n\t\t\"param_name\": name,\n\t})\n\n\tl.Infof(\"Creating user\")\n\n\tdb := getDB()\n\n\tu := &User{\n\t\tEmail: email,\n\t\tName: name,\n\t\tCash: STARTING_CASH,\n\t\tTotal: STARTING_CASH,\n\t\tCreatedAt: utils.GetCurrentTimeISO8601(),\n\t\tIsHuman: true,\n\t\tReservedCash: 0,\n\t\tIsPhoneVerified: false,\n\t\tIsOTPBlocked: false,\n\t\tOTPRequestCount: 0,\n\t\tIsBlocked: false,\n\t\tBlockCount: 0,\n\t}\n\n\terr := db.Save(u).Error\n\tif err != nil {\n\t\tl.Errorf(\"Failed: %+v\", err)\n\t\treturn nil, err\n\t}\n\n\t//update total user count\n\tatomic.AddUint32(&TotalUserCount, 1)\n\n\tl.Infof(\"Created user\")\n\treturn u, nil\n}", "title": "" }, { "docid": "09d833da143316a3dffb987d1eb0d1ff", "score": "0.73285", "text": "func CreateUser(c *gin.Context) {\n\tuser := &drepository.User{}\n\terr := c.Bind(user)\n\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"error\": \"binding params: \" + err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\t_, err = user.Insert()\n\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"result\": user})\n}", "title": "" }, { "docid": "5c9e4586489768665f7c46f144f66e3f", "score": "0.73204404", "text": "func (app *App) CreateUser(w http.ResponseWriter, r *http.Request) {\n\n\t// Load session\n\tsession, _ := app.Sessions.Get(r, \"session-name\")\n\n\t// Parse the post data\n\terr := r.ParseForm()\n\tif err != nil {\n\t\tapp.ClientError(w, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Model the new user based on html form\n\tform := &forms.NewUser{\n\t\tUsername: r.PostForm.Get(\"username\"),\n\t\tEmail: r.PostForm.Get(\"email\"),\n\t\tInviteCode: r.PostForm.Get(\"invitecode\"),\n\t\tPassword: r.PostForm.Get(\"password\"),\n\t}\n\n\t// Validate form\n\tif !form.Valid() {\n\t\tapp.RenderHTML(w, r, \"signup.page.html\", &HTMLData{Form: form})\n\t\treturn\n\t}\n\n\t// Validate request\n\tused, err := app.DB.ValidateInvite(form.InviteCode)\n\tif err != nil {\n\t\tapp.ServerError(w, err)\n\t\treturn\n\t}\n\tif used {\n\t\t// Save failure message\n\t\tsession.AddFlash(\"Invalid invite code.\", \"default\")\n\n\t\t// Save session\n\t\terr = session.Save(r, w)\n\t\tif err != nil {\n\t\t\tapp.ServerError(w, err)\n\t\t\treturn\n\t\t}\n\n\t\thttp.Redirect(w, r, \"/user/login\", http.StatusSeeOther)\n\t\treturn\n\t}\n\n\t// Insert the new user\n\terr = app.DB.InsertUser(form.Username, form.Email, form.Password)\n\tif err != nil {\n\t\tapp.ServerError(w, err)\n\t\treturn\n\t}\n\n\t// Fill invite\n\terr = app.DB.FillInvite(form.Username, form.InviteCode)\n\tif err != nil {\n\t\tapp.ServerError(w, err)\n\t\treturn\n\t}\n\n\tsession.AddFlash(\"Your account was created successfully! Please login.\", \"default\")\n\n\t// Save session\n\terr = session.Save(r, w)\n\tif err != nil {\n\t\tapp.ServerError(w, err)\n\t\treturn\n\t}\n\n\thttp.Redirect(w, r, \"/user/login\", http.StatusSeeOther)\n}", "title": "" }, { "docid": "aaa055a473de43bfc63fa0f94d0c7fa7", "score": "0.73156446", "text": "func (u *User) Create(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error {\n\treqDB, err := u.MasterDB.MGOCopy()\n\tif err != nil {\n\t\treturn errors.Wrapf(web.ErrDBNotConfigured, \"\")\n\t}\n\tdefer reqDB.MGOClose()\n\n\tvar usr user.CreateUser\n\tif err := web.Unmarshal(r.Body, &usr); err != nil {\n\t\treturn errors.Wrap(err, \"\")\n\t}\n\n\tnUsr, err := user.Create(ctx, reqDB, &usr)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"User: %+v\", &usr)\n\t}\n\n\tweb.Respond(ctx, w, nUsr, http.StatusCreated)\n\treturn nil\n}", "title": "" }, { "docid": "680e4495fcb15bee3a142619c5ca5fc8", "score": "0.73140925", "text": "func (userCtrl *UserControllerImpl) Create(w http.ResponseWriter, r *http.Request) {\n\tvar user entities.User\n\n\tmethod := \"user::create\"\n\n\t// Read user info\n\tuserIdentifier := r.Header.Get(XAuthToken)\n\tif userIdentifier == \"\" {\n\t\tw.WriteHeader(http.StatusForbidden)\n\t\tuserCtrl.Log(\n\t\t\tlog.LogRequestURI, r.RequestURI,\n\t\t\tlog.LogRemoteAddr, r.RemoteAddr,\n\t\t\tlog.LogHTTPStatus, http.StatusForbidden,\n\t\t\tlog.LogController, method,\n\t\t\tlog.LogMessage, \"empty token\",\n\t\t)\n\t\treturn\n\t}\n\n\tcurrentUser, err := userCtrl.Interactor.Authorize(userIdentifier)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusForbidden)\n\t\tuserCtrl.Log(\n\t\t\tlog.LogRequestURI, r.RequestURI,\n\t\t\tlog.LogRemoteAddr, r.RemoteAddr,\n\t\t\tlog.LogHTTPStatus, http.StatusForbidden,\n\t\t\tlog.LogController, method,\n\t\t\tlog.LogToken, userIdentifier,\n\t\t\tlog.LogMessage, err.Error(),\n\t\t)\n\t\treturn\n\t}\n\n\tisAllowedCreateUser, err := currentUser.IsAllowedCreateUser()\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tuserCtrl.Log(\n\t\t\tlog.LogRequestURI, r.RequestURI,\n\t\t\tlog.LogRemoteAddr, r.RemoteAddr,\n\t\t\tlog.LogHTTPStatus, http.StatusInternalServerError,\n\t\t\tlog.LogController, method,\n\t\t\tlog.LogToken, userIdentifier,\n\t\t\tlog.LogUserID, currentUser.ID,\n\t\t\tlog.LogMessage, err.Error(),\n\t\t)\n\t\treturn\n\t}\n\n\tif !isAllowedCreateUser {\n\t\tw.WriteHeader(http.StatusForbidden)\n\t\tuserCtrl.Log(\n\t\t\tlog.LogRequestURI, r.RequestURI,\n\t\t\tlog.LogRemoteAddr, r.RemoteAddr,\n\t\t\tlog.LogHTTPStatus, http.StatusForbidden,\n\t\t\tlog.LogController, method,\n\t\t\tlog.LogToken, userIdentifier,\n\t\t\tlog.LogUserID, currentUser.ID,\n\t\t\tlog.LogMessage, \"Not allowed to create new user\",\n\t\t)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tinput, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tuserCtrl.Log(\n\t\t\tlog.LogRequestURI, r.RequestURI,\n\t\t\tlog.LogRemoteAddr, r.RemoteAddr,\n\t\t\tlog.LogHTTPStatus, http.StatusInternalServerError,\n\t\t\tlog.LogController, method,\n\t\t\tlog.LogToken, userIdentifier,\n\t\t\tlog.LogUserID, currentUser.ID,\n\t\t\tlog.LogMessage, err.Error(),\n\t\t)\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(input, &user)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tuserCtrl.Log(\n\t\t\tlog.LogRequestURI, r.RequestURI,\n\t\t\tlog.LogRemoteAddr, r.RemoteAddr,\n\t\t\tlog.LogHTTPStatus, http.StatusBadRequest,\n\t\t\tlog.LogController, method,\n\t\t\tlog.LogToken, userIdentifier,\n\t\t\tlog.LogUserID, currentUser.ID,\n\t\t\tlog.LogMessage, fmt.Sprintf(\"json parse failed: %s\", err.Error()),\n\t\t)\n\t\tfmt.Println(err.Error())\n\t\treturn\n\t}\n\n\t// Create user\n\terr = userCtrl.Interactor.Create(&user)\n\tif err == interactors.ErrUserAlreadyExists {\n\t\tw.WriteHeader(http.StatusConflict)\n\t\tuserCtrl.Log(\n\t\t\tlog.LogRequestURI, r.RequestURI,\n\t\t\tlog.LogRemoteAddr, r.RemoteAddr,\n\t\t\tlog.LogHTTPStatus, http.StatusConflict,\n\t\t\tlog.LogController, method,\n\t\t\tlog.LogToken, userIdentifier,\n\t\t\tlog.LogUserID, currentUser.ID,\n\t\t\tlog.LogMessage, fmt.Sprintf(\"unable to create user %s: %s\", user.Username, err.Error()),\n\t\t)\n\t\treturn\n\t}\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tuserCtrl.Log(\n\t\t\tlog.LogRequestURI, r.RequestURI,\n\t\t\tlog.LogRemoteAddr, r.RemoteAddr,\n\t\t\tlog.LogHTTPStatus, http.StatusInternalServerError,\n\t\t\tlog.LogController, method,\n\t\t\tlog.LogToken, userIdentifier,\n\t\t\tlog.LogUserID, currentUser.ID,\n\t\t\tlog.LogMessage, fmt.Sprintf(\"unable to create user %s: %s\", user.Username, err.Error()),\n\t\t)\n\t\treturn\n\t}\n\n\tuserJSON, err := json.Marshal(user)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tuserCtrl.Log(\n\t\t\tlog.LogRequestURI, r.RequestURI,\n\t\t\tlog.LogRemoteAddr, r.RemoteAddr,\n\t\t\tlog.LogHTTPStatus, http.StatusInternalServerError,\n\t\t\tlog.LogController, method,\n\t\t\tlog.LogToken, userIdentifier,\n\t\t\tlog.LogUserID, currentUser.ID,\n\t\t\tlog.LogMessage, fmt.Sprintf(\"json encode failed: %s\", err.Error()),\n\t\t)\n\t\treturn\n\t}\n\n\t_, err = w.Write(userJSON)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tuserCtrl.Log(\n\t\t\tlog.LogRequestURI, r.RequestURI,\n\t\t\tlog.LogRemoteAddr, r.RemoteAddr,\n\t\t\tlog.LogHTTPStatus, http.StatusInternalServerError,\n\t\t\tlog.LogController, method,\n\t\t\tlog.LogToken, userIdentifier,\n\t\t\tlog.LogUserID, currentUser.ID,\n\t\t\tlog.LogMessage, fmt.Sprintf(\"unable to write response for %s: %s\", user.Username, err.Error()),\n\t\t)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tuserCtrl.Log(\n\t\tlog.LogRequestURI, r.RequestURI,\n\t\tlog.LogRemoteAddr, r.RemoteAddr,\n\t\tlog.LogHTTPStatus, http.StatusOK,\n\t\tlog.LogController, method,\n\t\tlog.LogToken, userIdentifier,\n\t\tlog.LogUserID, currentUser.ID,\n\t\tlog.LogMessage, fmt.Sprintf(\"user %s created successfully\", user.Username),\n\t)\n}", "title": "" }, { "docid": "ce158de9d14445e90425c5af3a65d54f", "score": "0.7299119", "text": "func NewUser(w http.ResponseWriter, r *http.Request) {\n\t// only allow http POST requests\n\tif r.Method == \"POST\" {\n\t\t// parse through the form\n\t\terr := r.ParseForm()\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadGateway)\n\t\t\treturn\n\t\t}\n\t\t// Parse age and name from request form\n\t\tName := r.FormValue(\"USERNAME\")\n\t\tAge := r.FormValue(\"AGE\")\n\t\t// check if we actually got a value\n\t\tif Name == \"\" || Age == \"\" {\n\t\t\thttp.Error(w, \"DID NOT RECEIVE A FIELD\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\t// err convert string to int\n\t\tAgeInt, err := strconv.Atoi(Age)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Invalid Age Input\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\t//add to database\n\t\tfmt.Fprintf(w, \"Successfully Received Process and will be added to database xd\")\n\t\tdb.Create(&Person{Name: Name, Age: AgeInt})\n\t\tlog.Info(\"Added to database with Name \" + Name + \" and Age \" + strconv.Itoa(AgeInt))\n\t} else {\n\t\thttp.Error(w, \"INVALID REQUEST METHOD\", http.StatusBadRequest)\n\t}\n}", "title": "" }, { "docid": "54b3cbce0327d3ad332b22c5e256afdd", "score": "0.7290214", "text": "func CreateUser(cmd *cobra.Command, args []string) {\n\tdatabase.InitDB()\n\tdb := database.GetDB()\n\n\tusername := viper.GetString(\"name\")\n\tif username == \"\" {\n\t\tfmt.Println(\"Required 'name' parameter not specified\")\n\t\treturn\n\t}\n\n\tfmt.Printf(\"Creating User %s...\\n\", username)\n\n\tfor _, item := range db.Users {\n\t\tif item.Username == username {\n\t\t\tlogrus.Errorf(\"User %s already exists in the database\", username)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Generate TOTP\n\tinit2FA, err := gototp.New(gototp.RandomSecret(10))\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\treturn\n\t}\n\n\t// check if password was specified, otherwise, go interactive\n\tpassword := viper.GetString(\"password\")\n\tif password == \"\" {\n\t\tpassword = prompter.Password(\"Enter password to use\")\n\t}\n\n\tuser, err := pwMan.NewUser(username, password, init2FA.Secret())\n\tif err != nil {\n\t\tfmt.Printf(\"Error while creating user %s: %v\\n\", username, err)\n\t}\n\n\tdb.AddUser(*user)\n\n\tfmt.Printf(\"User %s created. Caracteristics :\\n\", username)\n\tfmt.Printf(\"2FA init: %s || QRCode link: %s\\n\", init2FA.Secret(), init2FA.QRCodeGoogleChartsUrl(\"Code\", 320))\n\t//fmt.Println(.QRCodeTerminal(\"label\"))\n\n}", "title": "" }, { "docid": "2a0abbdc0ff0f2adbb807cd300bf8676", "score": "0.72895783", "text": "func UserCreate(ac echo.Context) error {\n\tc := ac.(*context.AppContext)\n\tresponse := NewAPIResponse(c)\n\n\t// get body\n\tbody, err := ioutil.ReadAll(c.Request().Body)\n\tif err != nil {\n\t\tresponse.Log = fmt.Sprintf(\"handlers.UserCreate - failed to read request body: %v\", err)\n\t\tresponse.Code = \"requestBodyNotReadable\"\n\t\treturn response.KO(http.StatusBadRequest)\n\n\t}\n\t// unmarshal\n\trequestData := struct {\n\t\tEmail string\n\t\tPassword string\n\t\tUsername string\n\t}{}\n\n\tif err = json.Unmarshal(body, &requestData); err != nil {\n\t\tresponse.Log = fmt.Sprintf(\"handlers.UserAdd - unmarshall request body failed: %v\", err)\n\t\tresponse.Code = \"requestBodyNotValidJson\"\n\t\treturn response.KO(http.StatusBadRequest)\n\t}\n\n\t// check entries\n\t// todo remove space from password &&\n\t// todo username must be alnum\n\n\tuser, err := user.Create(requestData.Email, requestData.Username, requestData.Password)\n\tif err != nil {\n\t\tresponse.Log = fmt.Sprintf(\"handlers.UserAdd - user.Create() failed: %v\", err)\n\t\tresponse.Code = \"userCreateFailed\"\n\t\treturn response.KO(http.StatusInternalServerError)\n\t}\n\n\t// todo set username in session\n\t// todo pas besoin de retourner l'user\n\tresponse.Data, err = json.Marshal(user)\n\tif err != nil {\n\t\tresponse.Log = fmt.Sprintf(\"handlers.UserAdd - activitypub.Marshal(user) failed: %v\", err)\n\t\tresponse.Code = \"userMarshalFailed\"\n\t\treturn response.KO(http.StatusInternalServerError)\n\t}\n\n\tresponse.Log = fmt.Sprintf(\"handlers.UserAdd - new user created: %s %s\", user.Username, user.Email)\n\treturn response.OK(http.StatusCreated)\n}", "title": "" }, { "docid": "c41e265687981f0b920222890ed45b6f", "score": "0.7289121", "text": "func CreateUser(c *gin.Context) {\n\tvar user users.User\n\t// bytes, err := ioutil.ReadAll(c.Request.Body)\n\t// if err != nil {\n\t// \tfmt.Println(err.Error())\n\t// }\n\n\t// if err := json.Unmarshal(bytes, &user); err != nil {\n\t// \tfmt.Println(err.Error())\n\t// }\n\n\tif err := c.ShouldBindJSON(&user); err != nil {\n\t\trestErr := errors.StatusBadRequestError(\"Invalid json Body\")\n\t\tc.JSON(restErr.Status, restErr)\n\t\treturn\n\t}\n\n\tResult, saveErr := services.Userservice.CreateUser(user)\n\tif saveErr != nil {\n\n\t\tc.JSON(saveErr.Status, saveErr)\n\t\treturn\n\t}\n\tc.JSON(http.StatusCreated, Result.Marshal(c.GetHeader(\"X-Public\") == \"true\"))\n}", "title": "" }, { "docid": "01e4b10bc32a9e04a92a8e85bd779691", "score": "0.72854745", "text": "func (s userService) Create(username, email, fullName string) (*api.User, error) {\n\terr := api.ValidateUsername(username)\n\tif err != nil {\n\t\treturn nil, errio.Error(err)\n\t}\n\n\terr = api.ValidateEmail(email)\n\tif err != nil {\n\t\treturn nil, errio.Error(err)\n\t}\n\n\terr = api.ValidateFullName(fullName)\n\tif err != nil {\n\t\treturn nil, errio.Error(err)\n\t}\n\n\taccountKey, err := generateAccountKey()\n\tif err != nil {\n\t\treturn nil, errio.Error(err)\n\t}\n\n\treturn s.create(username, email, fullName, accountKey)\n}", "title": "" }, { "docid": "700f4b01c2688dbb534e8a62acb72858", "score": "0.7281877", "text": "func (c *UserController) Create(ctx *app.CreateUserContext) error {\n\tif ctx.Payload.Password == nil && ctx.Payload.ExternalID == nil {\n\t\treturn ctx.BadRequest(goa.ErrBadRequest(\"password or externalID must be specified!\"))\n\t}\n\n\tif len(ctx.Payload.Roles) == 0 {\n\t\tctx.Payload.Roles = append(ctx.Payload.Roles, \"user\")\n\t}\n\n\t// Hashing password\n\tif ctx.Payload.Password != nil {\n\t\thashedPassword, err := stringToBcryptHash(*ctx.Payload.Password)\n\t\tif err != nil {\n\t\t\treturn ctx.InternalServerError(goa.ErrInternal(err))\n\t\t}\n\n\t\tctx.Payload.Password = &hashedPassword\n\t}\n\n\tuser := &store.UserRecord{\n\t\tActive: false,\n\t\tEmail: ctx.Payload.Email,\n\t\t//ExternalID: ctx.Payload.ExternalID == nil ? \"\": *ctx.Payload.ExternalID,\n\t\tNamespaces: ctx.Payload.Namespaces,\n\t\tOrganizations: ctx.Payload.Organizations,\n\t\tPassword: *ctx.Payload.Password,\n\t\tRoles: ctx.Payload.Roles,\n\t\tCreatedAt: helpers.CurrentTimeMilliseconds(),\n\t\t//Token: ctx.Payload.Token,\n\t}\n\n\tif ctx.Payload.ExternalID != nil {\n\t\tuser.ExternalID = *ctx.Payload.ExternalID\n\t}\n\tif ctx.Payload.Token != nil {\n\t\tuser.Token = *ctx.Payload.Token\n\t}\n\n\tresult, err := c.Store.Users.Save(user, nil)\n\tif err != nil {\n\t\tif backends.IsErrAlreadyExists(err) || backends.IsErrInvalidInput(err) {\n\t\t\treturn ctx.BadRequest(goa.ErrBadRequest(err))\n\t\t}\n\t\treturn ctx.InternalServerError(goa.ErrInternal(err))\n\t}\n\n\tif ctx.Payload.Token == nil {\n\t\ttoken := generateToken(42)\n\t\tctx.Payload.Token = &token\n\t}\n\n\ttokenPayload := map[string]interface{}{\n\t\t\"email\": ctx.Payload.Email,\n\t\t\"token\": ctx.Payload.Token,\n\t}\n\n\t_, err = c.Store.Tokens.Save(&tokenPayload, nil)\n\tif err != nil {\n\t\treturn ctx.InternalServerError(err)\n\t}\n\n\treturn ctx.Created(result.(*store.UserRecord).ToAppUsers())\n}", "title": "" }, { "docid": "60c4e78fde1112d36e82b8b60bbb9140", "score": "0.72788644", "text": "func Create(rw http.ResponseWriter, r *http.Request) {\n\tusername, password, ok := r.BasicAuth()\n\tif !ok {\n\t\tlog.Println(\"Username and/or password missing\")\n\t\trw.WriteHeader(http.StatusBadRequest)\n\t\trw.Write([]byte(\"Username and/or password missing\"))\n\t\treturn\n\t}\n\n\tif strings.TrimSpace(username) == \"\" {\n\t\tlog.Println(\"Empty username\")\n\t\trw.WriteHeader(http.StatusUnauthorized)\n\t\trw.Write([]byte(\"Username must not be empty\"))\n\t\treturn\n\t}\n\n\tif strings.TrimSpace(password) == \"\" {\n\t\tlog.Println(\"Empty password\")\n\t\trw.WriteHeader(http.StatusUnauthorized)\n\t\trw.Write([]byte(\"Password must not be empty\"))\n\t\treturn\n\t}\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Printf(\"Error reading request body: %s\\n\", err)\n\t\trw.WriteHeader(http.StatusBadRequest)\n\t\trw.Write([]byte(\"Error reading request body\"))\n\t\treturn\n\t}\n\n\tu := User{}\n\terr = json.Unmarshal(body, &u)\n\tif err != nil {\n\t\tlog.Printf(\"Error reading request body: %s\\n\", err)\n\t\trw.WriteHeader(http.StatusBadRequest)\n\t\trw.Write([]byte(\"Error reading request body\"))\n\t\treturn\n\t}\n\n\tcurrUserName := \"\"\n\tquery := `SELECT username\n\t\tFROM users\n\t\tWHERE username = $1`\n\n\terr = conn.DB.QueryRow(query, username).Scan(&currUserName)\n\n\tswitch {\n\tcase err == sql.ErrNoRows:\n\t\t// User doesn't already exist, add user\n\t\tpasswordHash, err := bcrypt.GenerateFromPassword([]byte(password), 14)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error creating user: %s\\n\", err)\n\t\t\trw.WriteHeader(http.StatusInternalServerError)\n\t\t\trw.Write([]byte(\"Error creating user\"))\n\t\t\treturn\n\t\t}\n\n\t\tif strings.TrimSpace(u.FirstName) == \"\" {\n\t\t\tlog.Println(\"Empty first name\")\n\t\t\trw.WriteHeader(http.StatusUnauthorized)\n\t\t\trw.Write([]byte(\"First name must not be empty\"))\n\t\t\treturn\n\t\t}\n\n\t\tif strings.TrimSpace(u.LastName) == \"\" {\n\t\t\tlog.Println(\"Empty last name\")\n\t\t\trw.WriteHeader(http.StatusUnauthorized)\n\t\t\trw.Write([]byte(\"Last name must not be empty\"))\n\t\t\treturn\n\t\t}\n\n\t\tuserID := -1\n\t\tquery = `INSERT INTO users\n\t\t\t(username, password, \"first_name\", \"last_name\")\n\t\t\tVALUES ($1, $2, $3, $4)\n\t\t\tRETURNING id`\n\n\t\terr = conn.DB.QueryRow(query, username, passwordHash, u.FirstName, u.LastName).Scan(&userID)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error creating user: %s\\n\", err)\n\t\t\trw.WriteHeader(http.StatusInternalServerError)\n\t\t\trw.Write([]byte(\"Error creating user\"))\n\t\t\treturn\n\t\t}\n\n\t\t// token := generateToken(userID, username)\n\n\t\tcookie, err := generateCookie(string(userID))\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error generating cookie: %s\\n\", err)\n\t\t\trw.WriteHeader(http.StatusInternalServerError)\n\t\t\trw.Write([]byte(\"Error creating user\"))\n\t\t\treturn\n\t\t}\n\t\thttp.SetCookie(rw, &cookie)\n\n\t\tlog.Printf(\"User %s created\\n\", username)\n\t\trw.WriteHeader(http.StatusOK)\n\t\trw.Write([]byte(fmt.Sprintf(\"User %s created\", username)))\n\tcase err != nil:\n\t\t// Other error\n\t\tlog.Printf(\"Error: %s\\n\", err)\n\t\trw.WriteHeader(http.StatusInternalServerError)\n\t\trw.Write([]byte(\"Error creating user\"))\n\tdefault:\n\t\t// User already exists\n\t\tlog.Printf(\"User %s already exists\\n\", username)\n\t\trw.WriteHeader(http.StatusForbidden)\n\t\trw.Write([]byte(fmt.Sprintf(\"User %s already exists\", username)))\n\t}\n}", "title": "" }, { "docid": "14f1a172fe04d87a877da8c7b6eb90b8", "score": "0.7278789", "text": "func (dal *DataAccessLayer) CreateUser(email string, firstName string, lastName string, password string, tenantId int64, tenantSchema string, roleId int64) (*User, error) {\n // Step 1: Hash our user's password for added security or error on any condition.\n passwordHash, err := utils.HashPassword(password)\n if err != nil {\n return nil, err\n }\n\n // Step 2: Generate SQL statement for creating a new `user` in `postgres`.\n statement := `INSERT INTO users (email, first_name, last_name, password_hash, tenant_id, tenant_schema, role_id) VALUES ($1, $2, $3, $4, $5, $6, $7)`\n\n // Step 3: Execute our SQL statement and either return our new user or\n // our error.\n _, err = dal.db.Exec(statement, email, firstName, lastName, passwordHash, tenantId, tenantSchema, roleId)\n if err != nil {\n return nil, err\n }\n return dal.FindUserByEmail(email)\n}", "title": "" }, { "docid": "31f7aecfe444b0b4edbc869cf88617a4", "score": "0.72747266", "text": "func CreateUser(username, password, email string) error {\n\tuser := types.User{}\n\tuser.Name = username\n\tuser.Password = password\n\tuser.Email = email\n\tdb := openDb()\n\terr = db.Insert(&user).Do()\n\treturn err\n}", "title": "" }, { "docid": "ebe0ea38c40c5230b1250e4c472d450b", "score": "0.72731143", "text": "func CreateUser(c *gin.Context) {\r\n\tvar user Model.T1\r\n\tc.BindJSON(&user)\r\n\tfmt.Println(user)\r\n\terr := Model.CreateUser(&user)\r\n\tif err != nil {\r\n\t\tfmt.Println(err.Error())\r\n\t\tc.AbortWithStatus(http.StatusNotFound)\r\n\t} else {\r\n\t\tc.JSON(http.StatusOK, user)\r\n\t}\r\n}", "title": "" }, { "docid": "089d2f25211c1c49aa4075c5b417170a", "score": "0.7263323", "text": "func CreateUser(w http.ResponseWriter, r *http.Request) {\n\tdomainName := chi.URLParam(r, \"domain\")\n\n\tdec := json.NewDecoder(r.Body)\n\tdefer r.Body.Close()\n\n\ttype UserInput struct {\n\t\tUsername string\n\t\tPassword string\n\t}\n\tvar user UserInput\n\terr := dec.Decode(&user)\n\tif err != nil {\n\t\thttp.Error(w, \"Error deconding JSON body\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tdomain, err := DomainByName(domainName)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t_, err = domain.CreateUser(user.Username, user.Password)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusCreated)\n}", "title": "" }, { "docid": "05ad6cd180b5b670df31484dc6cff1b8", "score": "0.7261738", "text": "func (r *UserRepository) Create(request CreateUserRequest) error {\n\trestRequest := rest.Request{Endpoint: \"/openstack/users\", Body: request}\n\n\treturn r.Client.Post(restRequest)\n}", "title": "" }, { "docid": "372b12bd3bb2d59ff69843ba5310ad14", "score": "0.72611976", "text": "func CreateNewUser(username, password, fullname, nickname, email string) (*User, error) {\n\tuser := &User{\n\t\tUsername: username,\n\t\tPassword: password,\n\t\tFullName: fullname,\n\t\tNickName: nickname,\n\t\tEmail: email,\n\t\tPasswordExpired: false,\n\t\tActive: true,\n\t}\n\n\terr := insert(user)\n\treturn user, err\n}", "title": "" }, { "docid": "4538b73ccd1d507a89b1908243ba1e48", "score": "0.725783", "text": "func (s *Service) CreateUser(email, password, firstName, lastName string)(uuid.UUID, error) {\n\tu, err := entity.NewUser(email, password, firstName, lastName)\n\tif err != nil {\n\t\treturn entity.NewID(), err\n\t}\n\treturn s.repo.Create(u)\n}", "title": "" }, { "docid": "21b76cea773be33b35b23b48f3f19529", "score": "0.72560537", "text": "func CreateUser(w http.ResponseWriter, r *http.Request) {\n\n\tvar user userModel.User\n\n\terr := json.NewDecoder(r.Body).Decode(&user)\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error %v\", err)\n\t}\n\n\t// call insert user function\n\tinsertID := UserController.InsertUser(user)\n\n\t// format a response object\n\tres := response{\n\t\tUserID: insertID,\n\t\tMessage: \"Пользователь успешно добавлен.\",\n\t}\n\n\t// Response\n\tjson.NewEncoder(w).Encode(res)\n}", "title": "" }, { "docid": "c34339c439315ef15a8f4616ccfdfe10", "score": "0.72531873", "text": "func (s *userService) Create(userPassword string, user models.User) (models.User, error) {\n\tif user.ID > 0 || userPassword == \"\" || user.Firstname == \"\" || user.Username == \"\" {\n\t\treturn models.User{}, errors.New(\"unable to create this user\")\n\t}\n\n\thashed, err := models.GeneratePassword(userPassword)\n\tif err != nil {\n\t\treturn models.User{}, err\n\t}\n\tuser.HashedPassword = hashed\n\n\treturn s.repo.InsertOrUpdate(user)\n}", "title": "" }, { "docid": "16b5e3f1a6934df4c80e6787d4c20524", "score": "0.7252385", "text": "func (repository *repository) CreateUser(spotifyID string, email string) *User {\n\tuser := NewUser(spotifyID, email)\n\trepository.connectionHandler.GetConnection().Create(&user)\n\n\treturn &user\n}", "title": "" }, { "docid": "b4628f8e24da48b9f18f1f6f0970aa53", "score": "0.7249737", "text": "func (u *User) Create(data []byte) (*Response, error) {\n\tresp := new(Response)\n\tif err := u.Client.Request(http.MethodPost, \"user\", bytes.NewReader(data), resp); err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "0861961b1c8eca160fd0e0d27d784ebe", "score": "0.7223352", "text": "func (p *CmnIrepo) CreateUser(w http.ResponseWriter, r *http.Request) {\n\tusr := cmnmdl.User{}\n\tjson.NewDecoder(r.Body).Decode(&usr)\n\tnewID, err := p.ICmnrepo.CreateUser(r.Context(), &usr)\n\tif err != nil {\n\t\tutils.RespondWithError(w, http.StatusInternalServerError, err.Error())\n\t} else {\n\n\t\tutils.RespondwithJSON(w, http.StatusOK, map[string]int64{\"id\": newID})\n\t}\n}", "title": "" }, { "docid": "2bbe737e975754616fa8c86356ef59e8", "score": "0.7220323", "text": "func (u *UserAPI) create(r *http.Request) (interface{}, mw.Response) {\n\tvar user types.User\n\n\tdefer r.Body.Close()\n\n\tif err := json.NewDecoder(r.Body).Decode(&user); err != nil {\n\t\treturn nil, mw.BadRequest(err)\n\t}\n\n\t// https://github.com/threefoldtech/zos/issues/706\n\tif err := user.Validate(); err != nil {\n\t\treturn nil, mw.BadRequest(err)\n\t}\n\n\tdb := mw.Database(r)\n\tuser, err := types.UserCreate(r.Context(), db, user.Name, user.Email, user.Pubkey)\n\tif err != nil && errors.Is(err, types.ErrUserExists) {\n\t\treturn nil, mw.Conflict(err)\n\t} else if err != nil {\n\t\treturn nil, mw.Error(err)\n\t}\n\n\treturn user, mw.Created()\n}", "title": "" }, { "docid": "bf9f29dc391ff49bc0e0f611ef676cec", "score": "0.72148055", "text": "func CreateUser(ctx *iris.Context) {\n\tresp := entity.RespPostUser{}\n\n\tuser := &entity.ReqPostUser{}\n\terr := ctx.ReadJSON(user)\n\tif err != nil {\n\t\tresp.Errmsg = err.Error()\n\t\tresp.ErrNo = iris.StatusBadRequest\n\t\tctx.JSON(resp.ErrNo, resp)\n\t\treturn\n\t}\n\n\tnewUser, err := service.CreateUser(*user)\n\tif err != nil {\n\t\tresp.Errmsg = err.Error()\n\t\tresp.ErrNo = iris.StatusInternalServerError\n\t\tif err == service.ErrUsernameConflict {\n\t\t\tresp.ErrNo = iris.StatusConflict\n\t\t}\n\t\tctx.JSON(resp.ErrNo, resp)\n\t\treturn\n\t}\n\n\tresp.Success = true\n\tnewUser.Password = entity.HidenString\n\tresp.User = *newUser\n\tctx.JSON(iris.StatusOK, resp)\n\treturn\n}", "title": "" }, { "docid": "5f0ca2236376e1a751b8f921b003ad5b", "score": "0.72022486", "text": "func (ctrl *Controller) CreateUser(c *gin.Context) {\n\n\tctx := c.Request.Context()\n\n\tresponse := make(map[string]interface{})\n\trequest := new(models.User)\n\terr := c.BindJSON(request)\n\n\tif err != nil {\n\t\tlogger.Log().Error(\"error while binding request body to user\", zap.Error(err))\n\t\tresponse[\"error\"] = common.BadRequestError\n\t\tc.JSON(http.StatusBadRequest, response)\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\t// input validation.\n\tif !isEmailValid(request.Email) {\n\t\tlogger.Log().Info(\"invalid email\", zap.String(\"email\", request.Email))\n\t\tresponse[\"error\"] = common.EmailValidationError\n\t\tc.JSON(http.StatusBadRequest, response)\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tif !isPasswordValid(request.Password) {\n\t\tlogger.Log().Info(\"invalid password\", zap.String(\"password\", request.Password))\n\t\tresponse[\"error\"] = common.PasswordValidationError\n\t\tc.JSON(http.StatusBadRequest, response)\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tif strings.Trim(request.Name, \" \") == \"\" {\n\t\tlogger.Log().Info(\"empty name\", zap.String(\"name\", request.Name))\n\t\tresponse[\"error\"] = common.BadRequestError\n\t\tc.JSON(http.StatusBadRequest, response)\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\terr = ctrl.userProvider.Create(ctx, request)\n\tif err != nil {\n\t\tif err.Error() == common.AccountAlreadyExistsError {\n\t\t\tlogger.Log().Info(\"empty name\", zap.String(\"request\", request.Email), zap.Error(err))\n\t\t\tresponse[\"error\"] = common.AccountAlreadyExistsError\n\t\t\tc.JSON(http.StatusConflict, response)\n\t\t\tc.Abort()\n\t\t\treturn\n\t\t}\n\n\t\tlogger.Log().Error(\"error while creating user\", zap.Error(err))\n\t\tresponse[\"error\"] = err.Error()\n\t\tc.JSON(http.StatusBadRequest, response)\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tresponse[\"success\"] = \"created\"\n\tc.JSON(http.StatusCreated, response)\n}", "title": "" }, { "docid": "718ff90042ec55a94cc187c7ac46aba1", "score": "0.72000176", "text": "func (u *Auth) Create(w http.ResponseWriter, r *http.Request) {\n\n\tcredentials := Credentials{\n\t}\n\n\terr := parseJSON(r, &credentials)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tcompanyUser := models.User{\n\t\tRoleID: 1,\n\t\tPassword: credentials.Password,\n\t\tEmail: credentials.Email,\n\t}\n\n\tif err := u.us.Create(&companyUser); err != nil {\n\t\t//vd.SetAlert(err)\n\t\trespondJSON(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\trespondJSON(w, http.StatusCreated, \"resource created successfully\")\n}", "title": "" }, { "docid": "0ac45bdc923502e85fe11eeb345b505e", "score": "0.7199202", "text": "func (a *UserCtrls) Create(user db.User) map[string]interface{} {\n\n\tfmt.Println(\"Create\")\n\tif _, ok := a.Validate(user); !ok {\n\t\tfmt.Println(\"Not validated\")\n\t\treturn nil\n\t}\n\n\thashedPassword, _ := bcrypt.GenerateFromPassword([]byte(user.Password), bcrypt.DefaultCost)\n\tuser.Password = string(hashedPassword)\n\n\terr := db.CreateObject(&user)\n\n\tif err != nil {\n\t\treturn u.Message(http.StatusBadRequest, \"Failed to create user, connection error.\")\n\t}\n\n\t//Create new JWT token for the newly registered user\n\ttk := &db.Token{UserID: user.ID}\n\ttoken := jwt.NewWithClaims(jwt.GetSigningMethod(\"HS256\"), tk)\n\ttokenString, _ := token.SignedString([]byte(os.Getenv(\"token_password\")))\n\tuser.Token = tokenString\n\n\tuser.Password = \"\" //delete password\n\n\tresponse := u.Message(http.StatusCreated, \"User has been created\")\n\tresponse[\"user\"] = user\n\treturn response\n}", "title": "" }, { "docid": "48af63f17e04da617dd22eeb0254f00a", "score": "0.71907544", "text": "func createUser(user User) (string, error) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\tclient := dataLayer.InitDataLayer()\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\tdefer client.Disconnect(ctx)\n\tusersCollection := client.Database(\"appointy\").Collection(\"users\")\n\tuser.PASSWORD = string(cryptoPass.Encrypt([]byte(user.PASSWORD), os.Getenv(\"HASH_KEY\")))\n\tif _, err := usersCollection.InsertOne(ctx, user); err == nil {\n\t\treturn \"success\", nil\n\t} else {\n\t\treturn \"\", err\n\t}\n}", "title": "" }, { "docid": "3f1e3285a41a1766d8fee4d316be86d6", "score": "0.7182097", "text": "func (s *pgDbService) CreateUser(email, pwhash, name, apikey string, isActive, isSuperuser bool) (*User, error) {\n\tnewUser := new(User)\n\n\tvar userId int\n\n\tnewUser.Email = email\n\tnewUser.Pwhash = pwhash\n\tnewUser.Name = name\n\tnewUser.IsActive = isActive\n\tnewUser.IsSuperuser = isSuperuser\n\tnewUser.ApiKey = apikey\n\n\tif !newUser.Validate() {\n\t\treturn nil, NewValidationError(UserInvalid, newUser.Errors())\n\t}\n\n\tinsertSql := s.db.Rebind(`INSERT INTO \"user\" (\n email,\n pwhash,\n name,\n is_active,\n is_superuser,\n apikey\n ) VALUES (?, ?, ?, ?, ?, ?) RETURNING id;`)\n\n\terr := s.db.QueryRowx(insertSql,\n\t\tnewUser.Email,\n\t\tnewUser.Pwhash,\n\t\tnewUser.Name,\n\t\tnewUser.IsActive,\n\t\tnewUser.IsSuperuser,\n\t\tnewUser.ApiKey).Scan(&userId)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewUser.Id = userId\n\n\treturn newUser, nil\n}", "title": "" }, { "docid": "e7498ecc05372118eb1f6ca9acdaf19b", "score": "0.7178451", "text": "func CreateUser(username string, password string) (model.User, error) {\n\t//Encode password and insert salt\n\tencryptedPassword, salt, err := passwords.GenerateSecurePassword(password)\n\treturn model.User{0, username, encryptedPassword, salt}, err\n}", "title": "" }, { "docid": "5f738c02e6c24e275c7912786bf33752", "score": "0.7177556", "text": "func CreateUser(c *gin.Context) {\n\tvar user users.User\n\tif err := c.ShouldBindJSON(&user); err != nil {\n\t\trestErr := api_errors.NewBadRequestError(\"invalid json body\")\n\t\tc.JSON(restErr.Status(), restErr)\n\t\treturn\n\t}\n\n\tresult, saveErr := services.UsersService.CreateUser(user)\n\tif saveErr != nil {\n\t\tc.JSON(saveErr.Status(), saveErr)\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusCreated, result.Marshal())\n}", "title": "" }, { "docid": "928d2f54c4d0601cafbc5366e0e60375", "score": "0.71734315", "text": "func CreateUser(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tvar newUser mymodels.User\n\treqBody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\titrlog.Info(err.Error(), CurrentLocalTime)\n\t\tfmt.Fprintf(w, err.Error())\n\t\treturn\n\t}\n\n\tDb, err := config.MYSQLConnection()\n\tdefer Db.Close()\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\titrlog.Info(err.Error(), CurrentLocalTime)\n\t\tfmt.Fprintf(w, err.Error())\n\t\treturn\n\t}\n\tjson.Unmarshal(reqBody, &newUser)\n\tswitch {\n\tcase (newUser.FirstLastName == nil) || (len(*newUser.FirstLastName) == 0):\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprintf(w, \"FirstLastName is empty or not valid\")\n\t\treturn\n\tcase (newUser.SecondLastName == nil) || (len(*newUser.SecondLastName) == 0):\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprintf(w, \"SecondLastName is empty or not valid\")\n\t\treturn\n\tcase (newUser.FirstName == nil) || (len(*newUser.FirstName) == 0):\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprintf(w, \"FirstName is empty or not valid\")\n\t\treturn\n\tcase (newUser.OtherNames == nil):\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprintf(w, \"OtherNames is empty or not valid\")\n\t\treturn\n\tcase (newUser.CountryID == nil) || (*newUser.CountryID*1 <= 0):\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprintf(w, \"CountryID is empty or not valid\")\n\t\treturn\n\tcase (newUser.DocumentTypeID == nil) || (*newUser.DocumentTypeID*1 <= 0):\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprintf(w, \"DocumentTypeID is empty or not valid\")\n\t\treturn\n\tcase (newUser.Document == nil) || (len(*newUser.Document) == 0):\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprintf(w, \"Document is empty or not valid\")\n\t\treturn\n\tcase (newUser.StartDate == nil) || (len(*newUser.StartDate) == 0):\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprintf(w, \"StartDate is empty or not valid\")\n\t\treturn\n\tcase (newUser.AreaID == nil) || (*newUser.AreaID*1 <= 0):\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprintf(w, \"AreaID is empty or not valid\")\n\t\treturn\n\tcase (newUser.Status == nil) || (len(*newUser.Status) == 0):\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprintf(w, \"Status is empty or not valid\")\n\t\treturn\n\tdefault:\n\t\trow, err := Db.Query(\"CALL CreateUser(?,?,?,?,?,?,?,?,?,?)\", newUser.FirstLastName, newUser.SecondLastName, newUser.FirstName, newUser.OtherNames, newUser.CountryID, newUser.DocumentTypeID, newUser.Document, newUser.StartDate, newUser.AreaID, newUser.Status)\n\t\tdefer row.Close()\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusConflict)\n\t\t\titrlog.Info(err.Error(), CurrentLocalTime)\n\t\t\tfmt.Fprintf(w, err.Error())\n\t\t\treturn\n\t\t}\n\t\texistDocument := true\n\t\tfor row.Next() {\n\t\t\texistDocument = false\n\t\t\tvar userID, countryID, documentTypeID, areaID int\n\t\t\tvar firstLastName, secondLastName, firstName, otherNames, country, documentType, document, email, startDate, status, area, registrationDate string\n\t\t\tif err := row.Scan(&userID, &firstLastName, &secondLastName, &firstName, &otherNames, &countryID, &country, &documentTypeID, &documentType, &document, &email, &startDate, &status, &areaID, &area, &registrationDate); err != nil {\n\t\t\t\tfmt.Fprintf(w, \"(SQL) %v\", err.Error())\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Next line is used in production because it has\n\t\t\t// RegistrationDate attribute\n\t\t\tvar newUser = mymodels.User{ID: &userID, FirstLastName: &firstLastName, SecondLastName: &secondLastName, FirstName: &firstName, OtherNames: &otherNames, CountryID: &countryID, Country: &country, DocumentTypeID: &documentTypeID, DocumentType: &documentType, Document: &document, Email: &email, StartDate: &startDate, AreaID: &areaID, Area: &area, Status: &status, RegistrationDate: &registrationDate}\n\n\t\t\t// Next line is used in development because RegistrationDate\n\t\t\t// attribute is always changing.\n\t\t\t// var newUser = mymodels.User{ID: &userID, FirstLastName: &firstLastName, SecondLastName: &secondLastName, FirstName: &firstName, OtherNames: &otherNames, CountryID: &countryID, Country: &country, DocumentTypeID: &documentTypeID, DocumentType: &documentType, Document: &document, Email: &email, StartDate: &startDate, AreaID: &areaID, Area: &area, Status: &status}\n\t\t\tw.WriteHeader(http.StatusCreated)\n\t\t\tjson.NewEncoder(w).Encode(newUser)\n\t\t}\n\t\tif existDocument {\n\t\t\tw.WriteHeader(http.StatusConflict)\n\t\t\tfmt.Fprintf(w, \"El documento ingresado no es válido o ya existe en el sistema\")\n\t\t}\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "8cde62a1966c52fbf7ac136fa3e8189d", "score": "0.7172603", "text": "func (u *Handler) Create(ctx *routing.Context) error {\n\tuser := entities.User{}\n\tif err := json.Unmarshal(ctx.Request.Body(), &user); err != nil {\n\t\tlogger.Get().Error(err)\n\t\tutils.MakeJSONResponseFromBytes(ctx, http.StatusInternalServerError, nil)\n\t\treturn nil\n\t}\n\n\tif errors := utils.Validate(&user); len(errors) != 0 {\n\t\tutils.MakeJSONResponseFromMap(ctx, http.StatusBadRequest, errors)\n\t\treturn nil\n\t}\n\n\tif err := u.db.Create(context.TODO(), &user); err != nil {\n\t\tlogger.Get().Error(err)\n\t\tutils.MakeJSONResponseFromBytes(ctx, http.StatusInternalServerError, nil)\n\t\treturn nil\n\t}\n\n\tutils.MakeJSONResponseFromBytes(ctx, http.StatusOK, nil)\n\treturn nil\n}", "title": "" }, { "docid": "a3e853b8c4155568adf4c1a34eca426c", "score": "0.7162576", "text": "func CreateUserHandler(w http.ResponseWriter, r *http.Request) {\n\terr := r.ParseForm()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbs, err := bcrypt.GenerateFromPassword([]byte(r.PostFormValue(\"password\")), bcrypt.MinCost)\n\tif err != nil {\n\t\thttp.Error(w, \"Internal server error\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tuser := models.User{\n\t\tName: r.PostFormValue(\"name\"),\n\t\tEmail: r.PostFormValue(\"email\"),\n\t\tPassword: bs,\n\t}\n\n\tif err := user.Create(); err != nil {\n\t\treturn\n\t}\n\n\thttp.Redirect(w, r, \"/login\", 302)\n}", "title": "" }, { "docid": "6135287199c0cf824cf3da933daa64e4", "score": "0.7158184", "text": "func (s *Service) Create(newUser *NewUser) (*userDomain.User, error) {\n\tdomain := newUser.toDomainMapper()\n\n\thash, err := bcrypt.GenerateFromPassword([]byte(newUser.Password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn &userDomain.User{}, err\n\t}\n\tdomain.HashPassword = string(hash)\n\tdomain.Status = true\n\n\treturn s.UserRepository.Create(domain)\n}", "title": "" }, { "docid": "7f082b187c647d500d884980bb26812f", "score": "0.7157206", "text": "func CreateUser(w http.ResponseWriter, r *http.Request) {\n\tvar user models.User\n\n\t// Extract JSON payload\n\tbody, err := ioutil.ReadAll(io.LimitReader(r.Body, 1048576))\n\tif err != nil {\n\t\tRespondWithError(w, http.StatusBadRequest, \"Invalid payload\")\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\t// Parse JSON data with User struct\n\terr = json.Unmarshal(body, &user)\n\tif err != nil {\n\t\tRespondWithError(w, http.StatusUnprocessableEntity, \"The user was not created\")\n\t\treturn\n\t}\n\n\t// Create the new user\n\tuser, err = db.RepoCreateUser(user)\n\tif err != nil {\n\t\tRespondWithError(w, http.StatusConflict, \"The user was not created\")\n\t\treturn\n\t}\n\tRespondWithJSON(w, http.StatusCreated, user)\n}", "title": "" }, { "docid": "6e4e07cd3de1639c488de4c359af0308", "score": "0.71567017", "text": "func (uc UserController) CreateUser(w http.ResponseWriter, req *http.Request, p httprouter.Params) {\n\t// composite literal - type and curly braces\n\tu := models.User{}\n\n\t//Decode the json that came in from the stream\n\t// ... put the json payload into u\n\tjson.NewDecoder(req.Body).Decode(&u)\n\n\t//create the bson ID\n\tu.ID = bson.NewObjectId()\n\n\t//store the user in mongodb\n\tuc.session.DB(\"go-web-dev-db\").C(\"users\").Insert(u)\n\n\t//Now re-marshal back into a JSON and assign to a variable uj\n\tuj, err := json.Marshal(u)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\t//Write content-type, status-code, payload\n\tw.Header().Set(\"Context-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusCreated) //201\n\tfmt.Fprintf(w, \"%s\\n\", uj) // see the updated uj value\n\n}", "title": "" }, { "docid": "614d00239b0ae36ae97332725f89d280", "score": "0.715405", "text": "func createUser(username string, password string) []error {\n\tpasswordEncrypt, _ := crypto.PasswordEncrypt(password)\n\tdb := gormConnect()\n\tdefer db.Close()\n\t// Insert a new user to db\n\tif err := db.Create(\n\t\t&User{Username: username, Password: passwordEncrypt},\n\t).GetErrors(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c578bb5e0281b543fe41ba25c33fa5c0", "score": "0.7136131", "text": "func (cip Usermanager) CreateUser(username string, email string, password string) error {\n\tuserAttributes := []*cognitoidentityprovider.AttributeType{\n\t\t&cognitoidentityprovider.AttributeType{\n\t\t\tName: aws.String(\"email\"),\n\t\t\tValue: aws.String(email),\n\t\t},\n\t\t&cognitoidentityprovider.AttributeType{\n\t\t\tName: aws.String(\"email_verified\"),\n\t\t\tValue: aws.String(\"true\"),\n\t\t},\n\t}\n\tnewUser := &cognitoidentityprovider.AdminCreateUserInput{\n\t\tUsername: aws.String(username),\n\t\tTemporaryPassword: aws.String(password),\n\t\tMessageAction: aws.String(\"SUPPRESS\"),\n\t\tUserPoolId: aws.String(cip.UserPoolID),\n\t\tUserAttributes: userAttributes,\n\t}\n\t_, err := cip.Svc.AdminCreateUser(newUser)\n\treturn err\n}", "title": "" }, { "docid": "c33f1d247f922316c9330c117f09dd0d", "score": "0.7134901", "text": "func (usecase *UserUseCase) Create(user *domain.User) error {\n\n\t_, err := usecase.UserRepository.Insert(user)\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error to create user %v:\", user)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "db6461325db1037d896c969f9d59791c", "score": "0.7133425", "text": "func (s *UserService) Create(firstname, lastname, email,\n\tpassword string) error {\n\t// Check if a user already exists.\n\t_, err := s.repo.ByEmail(email)\n\tif err == nil {\n\t\treturn ErrUserAlreadyExist\n\t}\n\n\t// Hash the password.\n\tpassNew, err := s.hash.Hash(password)\n\tif err != nil {\n\t\treturn ErrPasswordHash\n\t}\n\n\t// Create the user.\n\titem := new(User)\n\titem.FirstName = firstname\n\titem.LastName = lastname\n\titem.Email = email\n\titem.Password = passNew\n\n\t// Store the user.\n\treturn s.repo.Store(item)\n}", "title": "" }, { "docid": "99623aaa3b0993e70c5e9113268684e6", "score": "0.71285474", "text": "func CreateUser(empresa, grupo, miembros string) *User {\n\tuser := NewUser(empresa, grupo, miembros)\n\tuser.Save()\n\treturn user\n\n}", "title": "" }, { "docid": "33be26b5542bc545f705d113bb70d5ab", "score": "0.7125386", "text": "func Create(c echo.Context) error {\n\t// Grab our user data\n\tvar user User\n\tif err:= c.Bind(&user); err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(pholey): Password validation, refactoring\n\t// Hash our password\n\tsalt, iterations, hash := pass.HashPass(user.Password)\n\n\t// Create our statement\n\tsql, args, _ := db.Sq.\n\t\tInsert(\"\\\"user\\\"\").\n\t\tColumns(\"username\", \"name\", \"email\", \"password_hash\",\n\t\t\t\"password_iterations\", \"password_salt\").\n\t\tValues(user.UserName, user.Name, user.Email, hash, iterations, salt).\n\t\tToSql()\n\n\trows, err := db.Client.Query(sql, args...)\n\n\t_ = (rows)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.Response().Header().Set(\"Content-Type\", \"application/json;charset=UTF-8\")\n\t// Since we were sent JSON, we should be nice and return an empty JSON object\n\tc.JSON(http.StatusCreated, struct{}{})\n\n\treturn nil;\n}", "title": "" }, { "docid": "a5368e24f1f6a01c5d085e833e06ea83", "score": "0.71243024", "text": "func CreateUser(\n\tctx context.Context,\n\tcompanyKey *datastore.Key,\n\tfirstName, lastName, email, password, timezone string,\n) (*User, error) {\n\n\tuser := NewUser()\n\tuserKey := NewUserKey(ctx, companyKey, email)\n\tif err := nds.Get(ctx, userKey, &user); err != datastore.ErrNoSuchEntity {\n\t\treturn nil, ErrUserExists\n\t}\n\n\tuser.Company = companyKey\n\tuser.FirstName = firstName\n\tuser.LastName = lastName\n\tuser.Email = email\n\tuser.SetPassword(password)\n\tuser.Timezone = timezone\n\tif _, err := nds.Put(ctx, userKey, user); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn user, nil\n}", "title": "" } ]
a2aec2ff0f23808d18a28dc14d488307
GetTenant returns the authenticated tenant from the current request, or an error otherwise.
[ { "docid": "1f4d449d7d01c8b9ac50bc6ec1b3dfe0", "score": "0.8221136", "text": "func GetTenant(r *http.Request) (*tenant.Tenant, error) {\n\tif rv := context.Get(r, tenantKey); rv != nil {\n\t\tt, ok := rv.(*tenant.Tenant)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"Tenant found but not of correct type\")\n\t\t}\n\t\treturn t, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"No tenant found in current request\")\n}", "title": "" } ]
[ { "docid": "beef7e5b73444c4943886902b4074821", "score": "0.7552277", "text": "func GetTenant(ctx context.Context, name string) (*api.Tenant, error) {\n\treturn tenant.Get(handler.K8sClient, name)\n}", "title": "" }, { "docid": "3a605944a13d81e3cd00d51fa619cea1", "score": "0.7441598", "text": "func (c *clientConn) GetTenant() Tenant {\n\tif c != nil {\n\t\treturn c.clientInfo.Tenant\n\t}\n\treturn EmptyTenant\n}", "title": "" }, { "docid": "eef66ad303e93aafbe16be7af652585d", "score": "0.7303542", "text": "func GetTenant(ctx context.Context) string {\n\ttenant := ctx.Value(tenantKey)\n\tif tenant == nil {\n\t\treturn \"\"\n\t}\n\n\tif s, ok := tenant.(string); ok {\n\t\treturn s\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "8454c1dee8050d73ff2567af4032e512", "score": "0.72699445", "text": "func (c *operatorClient) TenantGet(ctx context.Context, namespace string, instanceName string, options metav1.GetOptions) (*miniov2.Tenant, error) {\n\treturn c.client.MinioV2().Tenants(namespace).Get(ctx, instanceName, options)\n}", "title": "" }, { "docid": "1a2f06ce71a356f3f3b525e5ea858a54", "score": "0.72614735", "text": "func GetTenant(ctx context.Context, tenant *api.Tenant) (*api.Tenant, error) {\n\treturn getTenantInterface(ctx).Get(tenant.GetName(), metav1.GetOptions{})\n}", "title": "" }, { "docid": "16db4ff0131d1f260c7ad5db4f64bfda", "score": "0.69947886", "text": "func (f *FakeCRDClient) GetTenant(tenantName string) (*crv1.Tenant, error) {\n\tf.Lock()\n\tdefer f.Unlock()\n\tf.appendCalled(\"GetTenant\", tenantName)\n\tif err := f.getError(\"GetTenant\"); err != nil {\n\t\treturn nil, err\n\t}\n\n\ttenant, ok := f.Tenants[tenantName]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Tenant %s not found\", tenantName)\n\t}\n\n\treturn tenant, nil\n}", "title": "" }, { "docid": "7e674083e575b42d6608024d775c1952", "score": "0.68852156", "text": "func (m *AzureActiveDirectoryTenant) GetTenantId()(*string) {\n val, err := m.GetBackingStore().Get(\"tenantId\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "bf64a0f5b5b1556f71e7f77c7bf69dfb", "score": "0.66655785", "text": "func GetTenantFromRequest(r *http.Request) string {\n\treturn metav1.TenantSystem\n}", "title": "" }, { "docid": "d59fb86bcf051aaa1891d7ac4efa6ffb", "score": "0.6577188", "text": "func (c *Client) GetTenantID() string {\n\treturn c.tenantID\n}", "title": "" }, { "docid": "ed8aa8ebec3a8b6e61478be5944a9cfe", "score": "0.65259653", "text": "func (m *NetworkAccessTraffic) GetTenantId()(*string) {\n val, err := m.GetBackingStore().Get(\"tenantId\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "acb001d2c62aa3418777cb0dfc01326b", "score": "0.6522686", "text": "func (m *Chat) GetTenantId()(*string) {\n val, err := m.GetBackingStore().Get(\"tenantId\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "28c3b16b794cdb7ff16bec794e114684", "score": "0.65076435", "text": "func getTenant(ctx *cliContext) string {\n\tswitch ctx.subcmd {\n\tcase \"host\":\n\t\treturn \"\"\n\tcase \"distributedservicecard\":\n\t\treturn \"\"\n\tcase \"cluster\":\n\t\treturn \"\"\n\tdefault:\n\t\treturn ctx.tenant\n\t}\n}", "title": "" }, { "docid": "f215b1455e40a441dd176dcbc07d4563", "score": "0.6408968", "text": "func GetEnrolledTenant() (string, error) {\n\tcmd := getCinfoPath()\n\tout, err := exec.Command(cmd, \"--tenant\").Output()\n\n\tif err != nil {\n\t\texitError, ok := err.(*exec.ExitError)\n\t\tif ok {\n\t\t\tif exitError.ProcessState.ExitCode() == ExitCodeNotEnrolled {\n\t\t\t\t// return specific error for this case\n\t\t\t\treturn \"\", ErrNotEnrolled\n\t\t\t}\n\t\t}\n\t\treturn \"\", err\n\t}\n\n\t// get tenant URL, strip off https:// and trailing \"/\" and newline\n\tres := string(out)\n\tres = strings.TrimSuffix(res, \"/\\n\")\n\treturn strings.TrimPrefix(res, \"https://\"), nil\n}", "title": "" }, { "docid": "59ab2c254d83521ba1f61ba52cc83619", "score": "0.6406774", "text": "func GetTenantConfig(ctx context.Context, ID string) (TenantConfig, error) {\n\tvar config TenantConfig\n\n\targs := []string{\"show\", \"tenant\", ID, \"-f\", \"{{tojson .}}\"}\n\terr := RunCIAOCmdAsAdminJS(ctx, \"\", args, &config)\n\n\treturn config, err\n}", "title": "" }, { "docid": "a2a48ff15fbac0cee69d49e8ba5b5418", "score": "0.6393866", "text": "func (m *SkypeForBusinessUserConversationMember) GetTenantId()(*string) {\n val, err := m.GetBackingStore().Get(\"tenantId\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "185fa21977720a67df48928d51a2b993", "score": "0.6329072", "text": "func getTenant(ctx echo.Context) error {\n\tid := ctx.Param(\"id\")\n\t// Get registry store instance by context\n\tr, err := db.NewRegistry(ctx.(*apiContext).config)\n\tif err != nil {\n\t\treturn ctx.JSON(http.StatusInternalServerError, &response{Message: err.Error()})\n\t}\n\tdefer r.Release()\n\n\tif err := r.DeleteTenant(id); err != nil {\n\t\treturn ctx.JSON(http.StatusInternalServerError, &response{Message: err.Error()})\n\t}\n\t// Notify kafka\n\tutil.AsyncProduceMessage(ctx.(*apiContext).config,\n\t\t\"tenant\",\n\t\tutil.TopicNameTenant,\n\t\t&util.TenantTopic{\n\t\t\tTenantId: id,\n\t\t\tAction: util.ObjectActionDelete,\n\t\t})\n\n\treturn ctx.JSON(http.StatusOK, &response{})\n}", "title": "" }, { "docid": "d6ecdce8375731c6c929282ea275dae9", "score": "0.6308154", "text": "func GetTenantDetail(w http.ResponseWriter, r *http.Request) {\n\tfLog := tenantMgmtLog.WithField(\"func\", \"GetTenantDetail\").WithField(\"RequestID\", r.Context().Value(constants.RequestID)).WithField(\"path\", r.URL.Path).WithField(\"method\", r.Method)\n\tiauthctx := r.Context().Value(constants.HansipAuthentication)\n\tif iauthctx == nil {\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusUnauthorized, \"You are not authorized to access this resource\", nil, nil)\n\t\treturn\n\t}\n\tauthCtx := iauthctx.(*hansipcontext.AuthenticationContext)\n\tif !authCtx.IsAnAdmin() {\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusForbidden, \"You don't have the right to access this resource\", nil, nil)\n\t\treturn\n\t}\n\n\tparams, err := helper.ParsePathParams(fmt.Sprintf(\"%s/management/tenant/{tenantRecId}\", apiPrefix), r.URL.Path)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttenant, err := TenantRepo.GetTenantByRecID(r.Context(), params[\"tenantRecId\"])\n\tif err != nil {\n\t\tfLog.Errorf(\"TenantRepo.GetTenantByRecID got %s\", err.Error())\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusInternalServerError, err.Error(), nil, nil)\n\t\treturn\n\t}\n\tif tenant == nil {\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusNotFound, fmt.Sprintf(\"Tenant recid %s not exist\", params[\"tenantRecId\"]), nil, nil)\n\t\treturn\n\t}\n\thelper.WriteHTTPResponse(r.Context(), w, http.StatusOK, \"Tenant retrieved\", nil, tenant)\n}", "title": "" }, { "docid": "6b2ee037e972311c4cb3d1c9c303d8ba", "score": "0.6280353", "text": "func GetTenantId(ctx *pulumi.Context) string {\n\treturn config.Get(ctx, \"openstack:tenantId\")\n}", "title": "" }, { "docid": "1b3ebab2372b22d73c5b2f7ed090b410", "score": "0.6168575", "text": "func (c *FakeTenants) Get(name string, options v1.GetOptions) (result *lessoriov1.Tenant, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewGetAction(tenantsResource, c.ns, name), &lessoriov1.Tenant{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*lessoriov1.Tenant), err\n}", "title": "" }, { "docid": "d38f02af10dd9b405789355928dded4e", "score": "0.6045616", "text": "func (o *ApiKey) GetTenantId() string {\n\tif o == nil || o.TenantId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.TenantId\n}", "title": "" }, { "docid": "99e5c86b5dd1a5e2be78cbb0baaaec25", "score": "0.6020892", "text": "func GetTenantId(ctx *pulumi.Context) string {\n\treturn config.Get(ctx, \"azure-native:tenantId\")\n}", "title": "" }, { "docid": "4f7b1830f50f5d51c4bcab51b0d279c6", "score": "0.601676", "text": "func (o *StorageNetAppNfsServiceAllOf) GetTenant() StorageNetAppStorageVmRelationship {\n\tif o == nil || o.Tenant == nil {\n\t\tvar ret StorageNetAppStorageVmRelationship\n\t\treturn ret\n\t}\n\treturn *o.Tenant\n}", "title": "" }, { "docid": "5ee73a9304298213d58bb70c1d83aaf8", "score": "0.59993666", "text": "func GetTenantName(ctx *pulumi.Context) string {\n\treturn config.Get(ctx, \"openstack:tenantName\")\n}", "title": "" }, { "docid": "637b99198176b018f84ce9598b865927", "score": "0.59768903", "text": "func (id *identity) TenantId() (string, error) {\n\tif !id.IsAuthenticated() {\n\t\treturn \"\", fmt.Errorf(\"Not authenticated\")\n\t}\n\treturn id.tenantId, nil\n}", "title": "" }, { "docid": "5e3109f4933aca5e39fd3ef420e4d6dd", "score": "0.595844", "text": "func lookupTenant(tenant string) (*Tenant, error) {\n\turi := fmt.Sprintf(\"https://%s.atlassian.net/_edge/tenant_info\", tenant)\n\tres, err := http.Get(uri)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\tif res.StatusCode > 299 {\n\t\treturn nil, fmt.Errorf(\"Error code %d\", res.StatusCode)\n\t}\n\tout := new(Tenant)\n\terr = json.NewDecoder(res.Body).Decode(out)\n\treturn out, err\n}", "title": "" }, { "docid": "573b61b2c90777c3381c1faf81185681", "score": "0.5957546", "text": "func GetTenantID(ctx context.Context) (string, error) {\n\ttenantID, ok := ctx.Value(TenantIDKey).(string)\n\tif ok {\n\t\treturn tenantID, nil\n\t}\n\treturn tenantID, fmt.Errorf(\"There's no tenant on this Context\")\n}", "title": "" }, { "docid": "bf01d53469edbf2776133476db101f59", "score": "0.5950602", "text": "func GetRegistratorTenant() string {\n\tif GlobalDefinition.Ggs.Service.Registry.Registrator.Tenant != \"\" {\n\t\treturn GlobalDefinition.Ggs.Service.Registry.Registrator.Tenant\n\t}\n\treturn GlobalDefinition.Ggs.Service.Registry.Tenant\n}", "title": "" }, { "docid": "0ff4ca73d1e3472fe800ac5d93b704ea", "score": "0.5857398", "text": "func GetOperTenant(obj *TenantInspect) error {\n\t// Check if we handle this object\n\tif objCallbackHandler.TenantCb == nil {\n\t\tlog.Errorf(\"No callback registered for tenant object\")\n\t\treturn errors.New(\"Invalid object type\")\n\t}\n\n\t// Perform callback\n\terr := objCallbackHandler.TenantCb.TenantGetOper(obj)\n\tif err != nil {\n\t\tlog.Errorf(\"TenantDelete retruned error for: %+v. Err: %v\", obj, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "56ecb46132787e3e4626a9275a1006ab", "score": "0.5830463", "text": "func VerifyTenant(r *http.Request) (string, string, bool) {\n\tvars := mux.Vars(r)\n\tsub := r.Header.Get(injectedSubs)\n\tif tenantName, ok := vars[\"tenant\"]; ok {\n\t\tif VerifySubject(tenantName, sub) {\n\t\t\treturn tenantName, sub, true\n\t\t}\n\t}\n\treturn \"\", sub, false\n}", "title": "" }, { "docid": "3ce06167b406153afbb32de4bb1bb973", "score": "0.5814171", "text": "func (m *UserMutation) Tenant() (r string, exists bool) {\n\tv := m.tenant\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "2566ddc5bcb603a20e2b263b908c4a86", "score": "0.5765405", "text": "func FindTenant(key string) *Tenant {\n\tobj := collections.tenants[key]\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\treturn obj\n}", "title": "" }, { "docid": "7b7eb4b09d072a298827d7978969c9af", "score": "0.5674572", "text": "func (o FastHttpsAppOutput) Tenant() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *FastHttpsApp) pulumi.StringOutput { return v.Tenant }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b2603476f323028a933fc8ceb187f1ce", "score": "0.56205", "text": "func (a *Client) TenantsGet(params *TenantsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantsGetOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewTenantsGetParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"tenants.get\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/schema/{className}/tenants\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/yaml\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &TenantsGetReader{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.(*TenantsGetOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for tenants.get: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "c3258bbffaf05ae8272565dc267c0314", "score": "0.5567893", "text": "func (t *TenantConfig) GetTenantConfig(tenantName string) *Tenant {\n\ttenant, ok := t.data[tenantName]\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn tenant\n}", "title": "" }, { "docid": "f380befe7719ecfae8157f2e0c9e02e9", "score": "0.5562018", "text": "func (o *ApiKey) GetTenantIdOk() (*string, bool) {\n\tif o == nil || o.TenantId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.TenantId, true\n}", "title": "" }, { "docid": "493308588129aaf9fb2fbe3a9fca41eb", "score": "0.55092466", "text": "func (_m *ClientRunner) GetTenant(ctx context.Context, tid string, client apiclient.HttpRunner) (*tenant.Tenant, error) {\n\tret := _m.Called(ctx, tid, client)\n\n\tvar r0 *tenant.Tenant\n\tif rf, ok := ret.Get(0).(func(context.Context, string, apiclient.HttpRunner) *tenant.Tenant); ok {\n\t\tr0 = rf(ctx, tid, client)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*tenant.Tenant)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, string, apiclient.HttpRunner) error); ok {\n\t\tr1 = rf(ctx, tid, client)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "b70a541ecf2777e3388091db54624ac8", "score": "0.5497432", "text": "func TenantID() string {\r\n\treturn tenantID\r\n}", "title": "" }, { "docid": "90cced9095ba1a0d65a6902476326a14", "score": "0.5456626", "text": "func GetTenantUUID(tenantName string) (string, error) {\n\tvar uuid string\n\n\tc, err := getIdentityClient()\n\tif err != nil {\n\t\tlog.Println(\"Error getting Identity Client: \", err)\n\t\treturn \"\", err\n\t}\n\n\tpager := projects.List(c, projects.ListOpts{Name: tenantName})\n\tpager.EachPage(\n\t\tfunc(page pagination.Page) (bool, error) {\n\t\t\tprojectList, _ := projects.ExtractProjects(page)\n\t\t\tfor _, project := range projectList {\n\t\t\t\tif project.Name == tenantName {\n\t\t\t\t\tuuid = project.ID\n\t\t\t\t\t// stop iterating and return tenant.Name\n\t\t\t\t\treturn false, nil\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true, nil\n\t\t},\n\t)\n\n\tif uuid == \"\" {\n\t\tlog.Printf(\"Tenant (Name: %s) not found.\\n\", tenantName)\n\t\treturn \"\", util.ErrTenantNotFound\n\t}\n\n\treturn uuid, nil\n}", "title": "" }, { "docid": "016bd8dad169e480d795656c0752a294", "score": "0.54554987", "text": "func (o *StorageNetAppNfsServiceAllOf) GetTenantOk() (*StorageNetAppStorageVmRelationship, bool) {\n\tif o == nil || o.Tenant == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Tenant, true\n}", "title": "" }, { "docid": "918625167edd556f134f060a6a1e2d53", "score": "0.5442099", "text": "func (c *ConnectionOptions) GetTenantDomain() string {\n\tif c == nil || c.TenantDomain == nil {\n\t\treturn \"\"\n\t}\n\treturn *c.TenantDomain\n}", "title": "" }, { "docid": "3b8d76d3c423f95a2b4fcf597b9c75ca", "score": "0.54273677", "text": "func GetContractDiscoveryTenant() string {\n\tif GlobalDefinition.Cse.Service.Registry.ContractDiscovery.Tenant != \"\" {\n\t\treturn GlobalDefinition.Cse.Service.Registry.ContractDiscovery.Tenant\n\t}\n\treturn GlobalDefinition.Cse.Service.Registry.Tenant\n}", "title": "" }, { "docid": "14d053a6f7ed3a7c3b5d29152716ff89", "score": "0.54232395", "text": "func (o *Task) Tenant(exec boil.Executor, mods ...qm.QueryMod) tenantQuery {\n\tqueryMods := []qm.QueryMod{\n\t\tqm.Where(\"id=?\", o.TenantID),\n\t}\n\n\tqueryMods = append(queryMods, mods...)\n\n\tquery := Tenants(exec, queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"tenants\\\"\")\n\n\treturn query\n}", "title": "" }, { "docid": "b5caf33840ec387b9722ea4d66f68c90", "score": "0.5395289", "text": "func GcTenant(\n\tctx context.Context,\n\texecCfg *sql.ExecutorConfig,\n\ttenID uint64,\n\tprogress *jobspb.SchemaChangeGCProgress,\n) error {\n\treturn gcTenant(ctx, execCfg, tenID, progress)\n}", "title": "" }, { "docid": "f56d355a586ef20781a6d22a2e0617f2", "score": "0.53418714", "text": "func (o *ApiKey) GetActingTenantId() string {\n\tif o == nil || o.ActingTenantId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ActingTenantId\n}", "title": "" }, { "docid": "56292b47fbe54fe40641a6af761b328a", "score": "0.53332615", "text": "func (m *NetworkAccessRoot) GetTenantStatus()(TenantStatusable) {\n val, err := m.GetBackingStore().Get(\"tenantStatus\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(TenantStatusable)\n }\n return nil\n}", "title": "" }, { "docid": "b88bc9be86dabe0a9df61085d90c030e", "score": "0.5328818", "text": "func httpInspectTenant(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {\n\tvar obj TenantInspect\n\tlog.Debugf(\"Received httpInspectTenant: %+v\", vars)\n\n\tkey := vars[\"key\"]\n\n\tobjConfig := collections.tenants[key]\n\tif objConfig == nil {\n\t\tlog.Errorf(\"tenant %s not found\", key)\n\t\treturn nil, errors.New(\"tenant not found\")\n\t}\n\tobj.Config = *objConfig\n\n\tif err := GetOperTenant(&obj); err != nil {\n\t\tlog.Errorf(\"GetTenant error for: %+v. Err: %v\", obj, err)\n\t\treturn nil, err\n\t}\n\n\t// Return the obj\n\treturn &obj, nil\n}", "title": "" }, { "docid": "5afdebb9297ee83773b0ad8991b8d62d", "score": "0.52899516", "text": "func (o GetWorkspaceIdentityOutput) TenantId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetWorkspaceIdentity) string { return v.TenantId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "1e745cc9f2db1d88043a27ac5a6f24c2", "score": "0.5276282", "text": "func (o IdentityProviderAadb2cOutput) SigninTenant() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *IdentityProviderAadb2c) pulumi.StringOutput { return v.SigninTenant }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4ff3f668b7beaea6b9766fff2c0f2770", "score": "0.5215196", "text": "func (o FastUdpAppOutput) Tenant() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *FastUdpApp) pulumi.StringOutput { return v.Tenant }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "cad98a9388c887d799ebef9dfd570c4b", "score": "0.5178215", "text": "func NewTenant() *Tenant {\n\tthis := Tenant{}\n\treturn &this\n}", "title": "" }, { "docid": "4ccc1f4082e0bcba1d6831aac5031782", "score": "0.51632404", "text": "func (o DataConnectorMicrosoftCloudAppSecurityOutput) TenantId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *DataConnectorMicrosoftCloudAppSecurity) pulumi.StringOutput { return v.TenantId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d2eaa92eb7f35cd8bb994467978b4e74", "score": "0.5160031", "text": "func DeleteTenant(w http.ResponseWriter, r *http.Request) {\n\tfLog := tenantMgmtLog.WithField(\"func\", \"DeleteTenant\").WithField(\"RequestID\", r.Context().Value(constants.RequestID)).WithField(\"path\", r.URL.Path).WithField(\"method\", r.Method)\n\tiauthctx := r.Context().Value(constants.HansipAuthentication)\n\tif iauthctx == nil {\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusUnauthorized, \"You are not authorized to access this resource\", nil, nil)\n\t\treturn\n\t}\n\tauthCtx := iauthctx.(*hansipcontext.AuthenticationContext)\n\tif !authCtx.IsAdminOfDomain(config.Get(\"hansip.domain\")) {\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusForbidden, \"You don't have the right to access this resource\", nil, nil)\n\t\treturn\n\t}\n\n\tparams, err := helper.ParsePathParams(fmt.Sprintf(\"%s/management/tenant/{tenantRecId}\", apiPrefix), r.URL.Path)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttenant, err := TenantRepo.GetTenantByRecID(r.Context(), params[\"tenantRecId\"])\n\tif err != nil {\n\t\tfLog.Errorf(\"TenantRepo.GetTenantByRecID got %s\", err.Error())\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusInternalServerError, err.Error(), nil, nil)\n\t\treturn\n\t}\n\tif tenant == nil {\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusNotFound, fmt.Sprintf(\"Tenant recid %s not exist\", params[\"tenantRecId\"]), nil, nil)\n\t\treturn\n\t}\n\terr = TenantRepo.DeleteTenant(r.Context(), tenant)\n\tif err != nil {\n\t\tfLog.Errorf(\"TenantRepo.DeleteTenant got %s\", err.Error())\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusInternalServerError, err.Error(), nil, nil)\n\t\treturn\n\t}\n\thelper.WriteHTTPResponse(r.Context(), w, http.StatusOK, \"Group deleted\", nil, nil)\n}", "title": "" }, { "docid": "8deb3bafda280a6c9a72eeec4e8351c0", "score": "0.5149458", "text": "func (o *DnsServerDataData) GetAzTenantid() string {\n\tif o == nil || o.AzTenantid == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.AzTenantid\n}", "title": "" }, { "docid": "d00331f812b606c7f4934914a27d4275", "score": "0.51449186", "text": "func (r *Registry) GetTenantTopicFlavor(tenantId string, flavorName string) (TopicFlavor, error) {\n\tc := r.db.C(dbNameTopicFlavors)\n\tflavor := TopicFlavor{}\n\tif err := c.Find(bson.M{\"TenantId\": tenantId, \"FlavorName\": flavorName}).One(&flavor); err != nil {\n\t\treturn flavor, err\n\t}\n\treturn flavor, nil\n}", "title": "" }, { "docid": "41d6b78f95ebddbe8cbd0c064c4742b7", "score": "0.51443607", "text": "func (r *Replica) TenantID() (roachpb.TenantID, bool) {\n\tr.mu.RLock()\n\tdefer r.mu.RUnlock()\n\treturn r.getTenantIDRLocked()\n}", "title": "" }, { "docid": "04106189241f7f4e846d43d0d21fe93d", "score": "0.51396626", "text": "func (o *AzureAccount) GetTenantName() string {\n\tif o == nil || o.TenantName == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.TenantName\n}", "title": "" }, { "docid": "de5a6b17507512521749813114a1f96f", "score": "0.5134074", "text": "func (o GetFwPolicyV2ResultOutput) TenantId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetFwPolicyV2Result) string { return v.TenantId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a81e3141d2c0473192d0c1c08fcee410", "score": "0.51162577", "text": "func (t Mock) GetTenantInfo(tenantID string) (ti Info, err error) {\n\treturn Info{\n\t\tData: InfoData{\n\t\t\tAttributes: Attributes{\n\t\t\t\tNamespaces: []Namespace{\n\t\t\t\t\t{\n\t\t\t\t\t\tClusterURL: \"Valid_OpenShift_API_URL\",\n\t\t\t\t\t\tType: \"jenkins\",\n\t\t\t\t\t\tName: \"namespace-jenkins\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tID: \"\",\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "cf1a2d7fc5821c24fb97cfd781b760ee", "score": "0.5102292", "text": "func (o UserIdentityResponseOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v UserIdentityResponse) *string { return v.TenantId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "cf1a2d7fc5821c24fb97cfd781b760ee", "score": "0.5102292", "text": "func (o UserIdentityResponseOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v UserIdentityResponse) *string { return v.TenantId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e11614252d76e10b2623620fedd45121", "score": "0.50685847", "text": "func (o RemoteRenderingAccountResponseIdentityOutput) TenantId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RemoteRenderingAccountResponseIdentity) string { return v.TenantId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "49f8c1fa9386bf87256d3a9bb1ec6ef9", "score": "0.5051509", "text": "func (p *provider) GetTenantParameters() (map[string]interface{}, fail.Error) {\n\treturn p.tenantParameters, nil\n}", "title": "" }, { "docid": "c5a5192cc9136a6cf18398607de768ec", "score": "0.5041681", "text": "func (o LookupDirectoryResultOutput) TenantId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupDirectoryResult) string { return v.TenantId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6295f08a31071f84eaf70f4ee2a5517d", "score": "0.5030824", "text": "func (o UploadServicePrincipalResponseOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v UploadServicePrincipalResponse) *string { return v.TenantId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "22a58e00ee78e53b1c9ce397df377749", "score": "0.5027204", "text": "func GetTenants(username, password, domain, tenant, tenantID, authURL, region string) ([]osprojects.Project, error) {\n\tauthClient, err := getAuthClient(username, password, domain, tenant, tenantID, authURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't get auth client: %v\", err)\n\t}\n\n\ttenants, err := getTenants(authClient, region)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't get tenants for region %s: %v\", region, err)\n\t}\n\n\treturn tenants, nil\n}", "title": "" }, { "docid": "270dc0c8a43063adf640598762408309", "score": "0.5014806", "text": "func ExtractTenant(tokenSub string) (string, string) {\n\tvar case1 string\n\t// expect `-` in subject unless it is superuser, or admin\n\t// so return them as is\n\tparts := strings.Split(tokenSub, subDelimiter)\n\tif len(parts) < 2 {\n\t\treturn tokenSub, tokenSub\n\t}\n\n\t// cases to cover with only `-` as delimiter\n\tvalidLength := len(parts) - 1\n\tcase1 = strings.Join(parts[:validLength], subDelimiter)\n\n\tif parts[validLength-1] == \"client\" {\n\t\treturn case1, strings.Join(parts[:(validLength-1)], subDelimiter)\n\t}\n\tif parts[validLength-1] == \"admin\" {\n\t\treturn case1, strings.Join(parts[:(validLength-1)], subDelimiter)\n\t}\n\treturn case1, case1\n}", "title": "" }, { "docid": "41a9a202e6f07b9ae642c6d2cf10fd2b", "score": "0.50105315", "text": "func (o VerifiedAccessTrustProviderDeviceOptionsPtrOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *VerifiedAccessTrustProviderDeviceOptions) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.TenantId\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "faed43796f9da75652797132df5cf894", "score": "0.50097114", "text": "func (o UserIdentityOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v UserIdentity) *string { return v.TenantId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "faed43796f9da75652797132df5cf894", "score": "0.50097114", "text": "func (o UserIdentityOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v UserIdentity) *string { return v.TenantId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "69135c90f5f9335b0840bdec886b3bc5", "score": "0.500422", "text": "func (o GetComputeMachineIdentityOutput) TenantId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetComputeMachineIdentity) string { return v.TenantId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3808b4082d2f5f221407698be1258816", "score": "0.49887368", "text": "func (o IdentityResponseOutput) TenantId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v IdentityResponse) string { return v.TenantId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3808b4082d2f5f221407698be1258816", "score": "0.49887368", "text": "func (o IdentityResponseOutput) TenantId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v IdentityResponse) string { return v.TenantId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8fde90f54fbf333acec29a4b43714b40", "score": "0.49860153", "text": "func (o WorkspaceIdentityOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WorkspaceIdentity) *string { return v.TenantId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e6656d6817868011c06dd291055aed1a", "score": "0.49799323", "text": "func (o LookupKeyVaultResultOutput) TenantId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupKeyVaultResult) string { return v.TenantId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0bf32a97c9379308e663d8f9a25414a7", "score": "0.4979588", "text": "func (o LoadBalancerOutput) TenantId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *LoadBalancer) pulumi.StringOutput { return v.TenantId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "13dad6b82ad1cc9df71a318ed60b4b71", "score": "0.49780354", "text": "func (o UserAssignedIdentitiesResponseOutput) TenantId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v UserAssignedIdentitiesResponse) string { return v.TenantId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5c9d9d72afca158f7a9cbe1db2404d74", "score": "0.4976399", "text": "func getID(r *http.Request) (uuid.UUID, *api.APIError) {\n\t// parse the id from the url\n\tvars := mux.Vars(r)\n\n\t// convert the id into an uuid and return\n\tid, err := uuid.Parse(vars[\"id\"])\n\tif err != nil {\n\t\treturn id, &api.APIError{Err: err,\n\t\t\tCode: http.StatusBadRequest,\n\t\t\tType: &api.ValidationError{},\n\t\t\tMessage: \"error getting tenant\",\n\t\t}\n\t}\n\n\treturn id, nil\n}", "title": "" }, { "docid": "908483db515db89187ed116af0a743f7", "score": "0.49592003", "text": "func GetTenantName(uuid string) (string, error) {\n\tc, err := getIdentityClient()\n\tif err != nil {\n\t\tlog.Println(\"Error getting Identity Client: \", err)\n\t\treturn \"\", err\n\t}\n\tresult := projects.Get(c, uuid, projects.GetOpts{})\n\tproject, err := result.Extract()\n\tif err != nil {\n\t\tlog.Printf(\"Error looking up name for uuid %s: %s.\\n\", uuid, err)\n\t\treturn \"\", err\n\t}\n\n\treturn project.Name, nil\n}", "title": "" }, { "docid": "1ed937233e205d4e2211f6e7e73fc73d", "score": "0.49488714", "text": "func (o UserIdentityResponsePtrOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *UserIdentityResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.TenantId\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1ed937233e205d4e2211f6e7e73fc73d", "score": "0.49488714", "text": "func (o UserIdentityResponsePtrOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *UserIdentityResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.TenantId\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c4fbf8fb395e761cad6ff0cc5c0947a1", "score": "0.4945696", "text": "func (o DataConnectorMicrosoftThreatIntelligenceOutput) TenantId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *DataConnectorMicrosoftThreatIntelligence) pulumi.StringOutput { return v.TenantId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5a1d61c4ad75d38d504624ecc098d1d0", "score": "0.49449766", "text": "func (o UploadServicePrincipalResponsePtrOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *UploadServicePrincipalResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.TenantId\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "6f633e5e8fe9a2a68a434c5a02e97e51", "score": "0.4944114", "text": "func (client ServicesClient) GetTenantWhitelistingResponder(resp *http.Response) (result Result, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "a21277dbaeed5beb270f6dd15894fb59", "score": "0.49439174", "text": "func GetTransactant(ctx context.Context, tid int64, t *Transactant) error {\n\n\tvar (\n\t// err error\n\t)\n\n\t// session... context\n\tif !(RRdb.noAuth && AppConfig.Env != extres.APPENVPROD) {\n\t\t_, ok := SessionFromContext(ctx)\n\t\tif !ok {\n\t\t\treturn ErrSessionRequired\n\t\t}\n\t}\n\n\tvar row *sql.Row\n\tfields := []interface{}{tid}\n\tif tx, ok := DBTxFromContext(ctx); ok { // if transaction is supplied\n\t\tstmt := tx.Stmt(RRdb.Prepstmt.GetTransactant)\n\t\tdefer stmt.Close()\n\t\trow = stmt.QueryRow(fields...)\n\t} else {\n\t\trow = RRdb.Prepstmt.GetTransactant.QueryRow(fields...)\n\t}\n\treturn ReadTransactant(row, t)\n}", "title": "" }, { "docid": "c62b99ff3683d6d7d638f5d68e638cdd", "score": "0.4942536", "text": "func (o AccountIdentityOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AccountIdentity) *string { return v.TenantId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "82b0709790986d02c729e214a9302e1c", "score": "0.49347347", "text": "func (o UploadServicePrincipalOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v UploadServicePrincipal) *string { return v.TenantId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2f89af66a86fdfb7c95aab4994a4ac9e", "score": "0.4927755", "text": "func (o *ApiKey) GetActingTenantIdOk() (*string, bool) {\n\tif o == nil || o.ActingTenantId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ActingTenantId, true\n}", "title": "" }, { "docid": "7da5e7679b893a4745ca7f14a796d6cf", "score": "0.49247903", "text": "func (o InferenceClusterIdentityOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v InferenceClusterIdentity) *string { return v.TenantId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "85aa6f427725be8e1ded3f22b86f3caa", "score": "0.4920698", "text": "func (h APIHhandler) GetTenants(w http.ResponseWriter, r *http.Request, argv map[string]string) {\n\tvar res []storage.Tenant\n\n\tres = h.Storage.GetTenants()\n\tresJSON, _ := json.Marshal(res)\n\n\tw.WriteHeader(200)\n\tfmt.Fprintln(w, string(resJSON))\n}", "title": "" }, { "docid": "643644f3aab64f13a5b39f825118566e", "score": "0.49169305", "text": "func (o VerifiedAccessTrustProviderDeviceOptionsOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v VerifiedAccessTrustProviderDeviceOptions) *string { return v.TenantId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "373b3ba149b9a289e9749af59aa28d04", "score": "0.4915114", "text": "func (o InferenceClusterIdentityPtrOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *InferenceClusterIdentity) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.TenantId\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "75f09c37ddf68770c8c4fa73d924dfe3", "score": "0.49130484", "text": "func Tenant(str string) Option {\n\treturn func(o *Options) {\n\t\to.ConfigTenant = str\n\t}\n}", "title": "" }, { "docid": "1855ceb8735a90b93461104a9f75a23d", "score": "0.4907883", "text": "func NewTenant() *Tenant {\n\n\treturn &Tenant{\n\t\tModelVersion: 1,\n\t}\n}", "title": "" }, { "docid": "264165089cfa38ad14f38086a6372aa7", "score": "0.49030003", "text": "func (p *TenantService) getTenantByName(tenantname string) (tenant *entity.Tenant, err error) {\n\t// query := strings.Join([]string{\"{\\\"tenantname\\\": \\\"\", tenantname, \"\\\"}\"}, \"\")\n\n\tselector := make(bson.M)\n\tselector[\"tenantname\"] = tenantname\n\t// err = json.Unmarshal([]byte(query), &selector)\n\t// if err != nil {\n\t// \treturn\n\t// }\n\t// selector, err = mejson.Unmarshal(selector)\n\t// if err != nil {\n\t// \treturn\n\t// }\n\n\ttenant = new(entity.Tenant)\n\tqueryStruct := dao.QueryStruct{\n\t\tCollectionName: p.collectionName,\n\t\tSelector: selector,\n\t\tSkip: 0,\n\t\tLimit: 0,\n\t\tSort: \"\"}\n\n\terr = dao.HandleQueryOne(tenant, queryStruct)\n\tif err != nil {\n\t\tlogrus.Warnln(\"get tenant by name error %v\", err)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "4ac0f059b52d6764a8baee570fd5e2c1", "score": "0.48878074", "text": "func (o SynapseSparkIdentityOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SynapseSparkIdentity) *string { return v.TenantId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "65da2842b404f05b69d8273835ab83ed", "score": "0.48862746", "text": "func (o ComputeClusterIdentityOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ComputeClusterIdentity) *string { return v.TenantId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3c7ea506618d3b1b52ceb55322208ec8", "score": "0.48795205", "text": "func (o IdentityProviderInputOutput) TenantId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v IdentityProviderInput) string { return v.TenantId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8489ac338248ad6ef74dfbec766da3bd", "score": "0.48751032", "text": "func (o ServerIdentityOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ServerIdentity) *string { return v.TenantId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a4ee6cb69d8a55c06a60fda6e46b6c14", "score": "0.4867925", "text": "func (o RemoteRenderingAccountResponseIdentityPtrOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RemoteRenderingAccountResponseIdentity) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.TenantId\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "db1bcb9ff9dd0aea32513f12b213758f", "score": "0.48604712", "text": "func (o WorkspaceIdentityPtrOutput) TenantId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WorkspaceIdentity) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.TenantId\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" } ]
357a3b958e7689efd736f3fb55508af4
Run is the entrypoint for the agent
[ { "docid": "1c5deb40709fd5e8cc91e98f1d2584d5", "score": "0.73452806", "text": "func (a *Agent) Run() {\n\ta.Init()\n\tlog.Info().\n\t\tInt(\"hosts_count\", len(a.hosts)).\n\t\tMsg(\"Finished hosts import.\")\n\ta.reconciliationLoop()\n}", "title": "" } ]
[ { "docid": "776215ca0c242d55473cc4729ebc80b6", "score": "0.727896", "text": "func (s *agentRunner) Run(conf []byte) error {\n\tcfgPath, err := s.createConfigFile(conf)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"agent: error creating config: %v\", err)\n\t}\n\ttimeout := time.After(10 * time.Second)\n\texit := s.runAgentConfig(cfgPath)\n\tfor {\n\t\tselect {\n\t\tcase err := <-exit:\n\t\t\treturn fmt.Errorf(\"agent: %v, log output:\\n%s\", err, s.Log())\n\t\tcase <-timeout:\n\t\t\treturn fmt.Errorf(\"agent: timed out waiting for start, log:\\n%s\", s.Log())\n\t\tdefault:\n\t\t\tif strings.Contains(s.log.String(), \"Listening for traces at\") {\n\t\t\t\tif s.verbose {\n\t\t\t\t\tlog.Print(\"agent: Listening for traces\")\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\ttime.Sleep(5 * time.Millisecond)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "35627395d908d819ed3213b211852fee", "score": "0.71840113", "text": "func Run(ctx context.Context) {\n\t// setup logger\n\tsetupLogger()\n\n\tconfig, err := newConfig()\n\tif err != nil {\n\t\tlog.Printf(\"failed to load config: %v\\n\", err)\n\t\treturn\n\t}\n\n\tnewLauncher(config).launch(ctx)\n}", "title": "" }, { "docid": "5f5ae0a4f5924f6496a158a8371c98b0", "score": "0.70908535", "text": "func (a *agent) Run() error {\n\ta.Info(\"starting CRI Resource Manager Agent\")\n\n\tif err := a.server.Start(opts.agentSocket); err != nil {\n\t\treturn agentError(\"failed to start gRPC server: %v\", err)\n\t}\n\n\tif err := a.watcher.Start(); err != nil {\n\t\treturn agentError(\"failed to start watcher: %v\", err)\n\t}\n\n\tif err := a.updater.Start(); err != nil {\n\t\treturn agentError(\"failed to start config updater: %v\", err)\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase config, ok := <-a.watcher.ConfigChan():\n\t\t\tif ok {\n\t\t\t\ta.updater.UpdateConfig(&config)\n\t\t\t}\n\t\tcase adjust, ok := <-a.watcher.AdjustmentChan():\n\t\t\tif ok {\n\t\t\t\ta.updater.UpdateAdjustment(&adjust)\n\t\t\t}\n\t\tcase status, ok := <-a.updater.StatusChan():\n\t\t\tif ok {\n\t\t\t\ta.Info(\"got status %v\", status)\n\t\t\t\tif err := a.watcher.UpdateStatus(status); err != nil {\n\t\t\t\t\ta.Error(\"failed to update adjustment node status: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "35679418c87b2a1c36950526fb77daa1", "score": "0.69863075", "text": "func Run(ctx context.Context, cfg cmds.Agent) error {\n\tif err := cgroups.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\tif cfg.Rootless && !cfg.RootlessAlreadyUnshared {\n\t\tif err := rootless.Rootless(cfg.DataDir); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tproxy, err := createProxyAndValidateToken(ctx, &cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn run(ctx, cfg, proxy)\n}", "title": "" }, { "docid": "4bde1eb1121d89cc96b7402b637b034c", "score": "0.69420415", "text": "func main() {\n\tfmt.Println(\"Starting agent...\")\n\n\teventFileName, contextFileName := parseCommandLineArguments()\n\n\trun(eventFileName, contextFileName, cronTopic, instancesURL)\n\n\tfmt.Println(\"Exiting main, nothing left to do\")\n}", "title": "" }, { "docid": "c43cc52a1daae6903512800c6676a26a", "score": "0.6928185", "text": "func run() error {\n\tdiscoveryAgent, err := agent.New()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = discoveryAgent.CheckHealth()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdiscoveryAgent.Run()\n\treturn nil\n}", "title": "" }, { "docid": "bfa092f07fc8c6e7c41654530f9c56ee", "score": "0.68698704", "text": "func run(log log.T) {\n\tdefer func() {\n\t\t// recover in case the agent panics\n\t\t// this should handle some kind of seg fault errors.\n\t\tif msg := recover(); msg != nil {\n\t\t\tlog.Errorf(\"Core Agent crashed with message %v!\", msg)\n\t\t\tlog.Errorf(\"%s: %s\", msg, debug.Stack())\n\t\t}\n\t}()\n\n\t// run ssm agent\n\tcoreAgent, contextLog, err := initializeBasicModules(log)\n\tif err != nil {\n\t\tcontextLog.Errorf(\"Error occurred when starting amazon-ssm-agent: %v\", err)\n\t\treturn\n\t}\n\tstatusChannels := &contracts.StatusComm{\n\t\tTerminationChan: make(chan struct{}, 1),\n\t\tDoneChan: make(chan struct{}, 1),\n\t}\n\tstartCoreAgent(contextLog, coreAgent, statusChannels)\n\tblockUntilSignaled(contextLog, statusChannels)\n\tcoreAgent.Stop()\n}", "title": "" }, { "docid": "4f4ed5fa01c8c009fbeed96755c12423", "score": "0.68635756", "text": "func Run() {\n\t// Parse cl\n\tcli.VersionPrinter = printVersion\n\n\tapp := cli.NewApp()\n\n\tapp.Name = path.Base(os.Args[0])\n\tapp.Usage = \"Bitrise Analytics plugin\"\n\tapp.Version = version.VERSION\n\n\tapp.Author = \"\"\n\tapp.Email = \"\"\n\n\tapp.Flags = []cli.Flag{\n\t\tcli.StringFlag{\n\t\t\tName: \"loglevel, l\",\n\t\t\tUsage: \"Log level (options: debug, info, warn, error, fatal, panic).\",\n\t\t\tEnvVar: \"LOGLEVEL\",\n\t\t},\n\t}\n\tapp.Before = before\n\tapp.Commands = commands\n\tapp.Action = action\n\n\tif err := app.Run(os.Args); err != nil {\n\t\tlog.Errorf(\"Finished with Error: %s\", err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "de2bd04f2c2758188de8617f737b6716", "score": "0.6773255", "text": "func main() {\n\tconfig := agent.NewDefaultConfig()\n\tagent.InitFlags(config)\n\tflag.Parse()\n\tcontext := &agent.Agent{Config: config}\n\n\terr := context.Initialize()\n\tif err != nil {\n\t\tos.Exit(1)\n\t}\n\tagent.Start(context)\n}", "title": "" }, { "docid": "10ae8a792446612c3a440d93bd16818e", "score": "0.6759857", "text": "func (lightnode Lightnode) Run(ctx context.Context) {\n\tgo lightnode.updater.Run(ctx)\n\tgo lightnode.cacher.Run(ctx)\n\tgo lightnode.dispatcher.Run(ctx)\n\tgo lightnode.confirmer.Run(ctx)\n\tgo lightnode.btcWatcher.Run(ctx)\n\tgo lightnode.zecWatcher.Run(ctx)\n\tgo lightnode.bchWatcher.Run(ctx)\n\tgo lightnode.submitter.Run(ctx)\n\n\tlightnode.server.Listen(ctx, fmt.Sprintf(\":%s\", lightnode.options.Port))\n}", "title": "" }, { "docid": "98fe0b3ada6ded307d9b77ee8cd5071b", "score": "0.67448294", "text": "func (a *Agent) Run() {\n\tfor _, starter := range []interface{ Start() }{\n\t\ta.Receiver,\n\t\ta.Concentrator,\n\t\ta.ClientStatsAggregator,\n\t\ta.PrioritySampler,\n\t\ta.ErrorsSampler,\n\t\ta.NoPrioritySampler,\n\t\ta.EventProcessor,\n\t\ta.OTLPReceiver,\n\t\ta.RemoteConfigHandler,\n\t\ta.DebugServer,\n\t} {\n\t\tstarter.Start()\n\t}\n\n\tgo a.TraceWriter.Run()\n\tgo a.StatsWriter.Run()\n\n\t// Having GOMAXPROCS/2 processor threads is\n\t// enough to keep the downstream writer busy.\n\t// Having more processor threads would not speed\n\t// up processing, but just expand memory.\n\tworkers := runtime.GOMAXPROCS(0) / 2\n\tif workers < 1 {\n\t\tworkers = 1\n\t}\n\n\tfor i := 0; i < workers; i++ {\n\t\tgo a.work()\n\t}\n\n\ta.loop()\n}", "title": "" }, { "docid": "db17ab474f2fc9f4749c9d921051851f", "score": "0.67357016", "text": "func (a *Agent) Run() {\n\t// Kick off the three threads we need for our async processes\n\tsvcstop := a.StartServiceHeartbeatThread()\n\tmachstop := a.StartMachineHeartbeatThread()\n\n\ta.events.RegisterListener(a, a.Machine)\n\ta.events.Open()\n\n\t// Block until we receive a stop signal\n\t<-a.stop\n\n\t// Signal each of the threads we started to also stop\n\tsvcstop <- true\n\tmachstop <- true\n\n\ta.events.Close()\n}", "title": "" }, { "docid": "16e4abfd59408e3c032dbf2337241908", "score": "0.6735695", "text": "func Run() {\n\tmg.Deps(Build)\n\t// launch the server\n\tsh.Run(path.Join(MageRoot, \"serve\"))\n}", "title": "" }, { "docid": "e932aa31382a288e00cc22adb58c942c", "score": "0.67341584", "text": "func Run() {\n\tgetHandlers()\n\trouter.Run(\":9990\")\n}", "title": "" }, { "docid": "a5e4fe86837df908e9bc3d6dc8404bea", "score": "0.67142975", "text": "func (s *Service) Run(ctx context.Context) {\n\ts.logger.Info(\"starting...\")\n\n\tgo running.WithBackOff(ctx,\n\t\ts.logger,\n\t\t\"crawler\",\n\t\ts.crawler,\n\t\ts.config.NormalTime,\n\t\ts.config.AbnormalPeriod,\n\t\ts.config.MaxAbnormalPeriod)\n\n\tgo running.WithBackOff(ctx,\n\t\ts.logger,\n\t\t\"saleCloser\",\n\t\ts.saleCloser,\n\t\ts.config.NormalTime,\n\t\ts.config.AbnormalPeriod,\n\t\ts.config.MaxAbnormalPeriod)\n\n\tserverConf := listener.Config{\n\t\tHost: s.config.Host,\n\t\tCheckSignature: false,\n\t\tPort: s.config.Port,\n\t}\n\tlistener.RunServer(ctx, s.logger, s.router(), serverConf)\n}", "title": "" }, { "docid": "dca61d658305f0c7987daf22096fc5bb", "score": "0.6692891", "text": "func (a *Agent) Run(log logging.Logger, period time.Duration) error {\n\tlog.Debug(\"Starting\", \"sync-period\", period.String())\n\n\tclusterRemoteClient, err := client.New(a.ClusterConfig, client.Options{})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot create cluster remote client\")\n\t}\n\n\tmgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{SyncPeriod: &period, MetricsBindAddress: \"0.0.0.0:8080\"})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot start local cluster manager\")\n\t}\n\n\tif err := crds.AddToScheme(mgr.GetScheme()); err != nil {\n\t\treturn errors.Wrap(err, \"Cannot add CustomResourceDefinition API to scheme\")\n\t}\n\n\tif err := apiextensions.AddToScheme(mgr.GetScheme()); err != nil {\n\t\treturn errors.Wrap(err, \"Cannot add Crossplane apiextensions API to scheme\")\n\t}\n\t// TODO(muvaf): Need to pass in the default config.\n\tif err := xrd.Setup(mgr, clusterRemoteClient, log); err != nil {\n\t\treturn errors.Wrap(err, \"cannot setup CompositeResourceDefinition reconciler\")\n\t}\n\n\treturn errors.Wrap(mgr.Start(ctrl.SetupSignalHandler()), \"cannot start controller manager\")\n}", "title": "" }, { "docid": "a6251d112d27ae1d88be7b83d80c941c", "score": "0.6687544", "text": "func Run(remainingArgs []string) {\n\t// turn on some simple stderr diagnostics\n\t// tracer := utils.NewSimpleTracer(map[string]bool{\n\t// \t// tracing.SpanRecover: true,\n\t// \t//tracing.SpanNegotiateClaim: true,\n\t// \t// tracing.SpanRecoverClient: true,\n\t// \t// tracing.SpanRecoverLink: true,\n\t// }, nil)\n\n\t// tab.Register(tracer)\n\n\tallTests := map[string]func(args []string){\n\t\t\"constantDetach\": ConstantDetachment,\n\t\t\"constantDetachmentSender\": ConstantDetachmentSender,\n\t\t\"emptySessions\": EmptySessions,\n\t\t\"finitePeeks\": FinitePeeks,\n\t\t\"finiteSendAndReceive\": FiniteSendAndReceiveTest,\n\t\t\"finiteSessions\": FiniteSessions,\n\t\t\"idleFastReconnect\": IdleFastReconnect,\n\t\t\"infiniteSendAndReceive\": InfiniteSendAndReceiveRun,\n\t\t\"longRunningRenewLock\": LongRunningRenewLockTest,\n\t\t\"mostlyIdleReceiver\": MostlyIdleReceiver,\n\t\t\"rapidOpenClose\": RapidOpenCloseTest,\n\t\t\"receiveCancellation\": ReceiveCancellation,\n\t\t\"sendAndReceiveDrain\": SendAndReceiveDrain,\n\t}\n\n\tif len(remainingArgs) == 0 {\n\t\tprintUsageAndQuit(allTests)\n\t}\n\n\ttestFn, validTestName := allTests[remainingArgs[0]]\n\n\tif !validTestName {\n\t\tprintUsageAndQuit(allTests)\n\t}\n\n\tif err := shared.LoadEnvironment(); err != nil {\n\t\tlog.Fatalf(\"Failed to load .env file: %s\", err.Error())\n\t}\n\n\ttestFn(remainingArgs[1:])\n}", "title": "" }, { "docid": "d9228035d1d6c3af7b02ec920d776a75", "score": "0.66393554", "text": "func (e *Exporter) Run() {\n\tvar err error\n\n\tvar healthzEndpoint *healthz.Endpoint\n\t{\n\t\tc := healthz.Config{\n\t\t\tLogger: e.logger,\n\t\t}\n\t\thealthzEndpoint, err = healthz.New(c)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"%#v\\n\", err))\n\t\t}\n\t}\n\n\tvar newServer server.Server\n\t{\n\t\tc := server.Config{\n\t\t\tEnableDebugServer: true,\n\t\t\tEndpoints: []server.Endpoint{healthzEndpoint},\n\t\t\tListenAddress: e.address,\n\t\t\tLogger: e.logger,\n\t\t}\n\n\t\tnewServer, err = server.New(c)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"%#v\\n\", err))\n\t\t}\n\t}\n\n\tprometheus.MustRegister(e.collectors...)\n\n\tgo newServer.Boot()\n\n\tlistener := make(chan os.Signal, 2)\n\tsignal.Notify(listener, os.Interrupt, syscall.SIGTERM)\n\n\t<-listener\n\n\tgo func() {\n\t\tvar wg sync.WaitGroup\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tnewServer.Shutdown()\n\t\t}()\n\n\t\tos.Exit(0)\n\t}()\n\n\t<-listener\n\n\tos.Exit(0)\n}", "title": "" }, { "docid": "0783754cc896d86237527075fc98e928", "score": "0.6592206", "text": "func Run(addr string) {\r\n\tmainServer.Run(addr)\r\n}", "title": "" }, { "docid": "7389dac29f4c478af8770d89ec26bc8f", "score": "0.6575476", "text": "func Run() {\n\tsettingsInit()\n\tdatabaseInit()\n\tdatabaseSeed()\n\tloadPlugins()\n\troutesInit()\n}", "title": "" }, { "docid": "7b73b73bc0aabbed21a1524bd48d5985", "score": "0.65602624", "text": "func (a App) Run() {\n\tcfg := a.Config\n\terr := godotenv.Load()\n\tif err == nil {\n\t\tlog.Println(\"Loaded .env file\")\n\t}\n\n\terr = envconfig.Init(&cfg)\n\tif err != nil {\n\t\tlog.Fatal(\"Error loading config\", err)\n\t}\n\n\tlogger, err := configureLogger(cfg.LOG.Level)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create zap logger: %s\", err.Error())\n\t}\n\n\tif err := Start(cfg, logger); err != nil {\n\t\tlogger.Fatal(\"Failed to start server\", zap.Error(err))\n\t}\n}", "title": "" }, { "docid": "64b133ebcbdd925a4676f2b593eca22c", "score": "0.65496737", "text": "func (r *Runner) Run() (err error) {\n\terr = r.prepareNamespace()\n\tif err != nil {\n\t\terr = fmt.Errorf(\"failed to prepare the namespace: %v\", err)\n\t\treturn\n\t}\n\terr = r.prepareDeployment()\n\tif err != nil {\n\t\terr = fmt.Errorf(\"failed to prepare the deployment: %v\", err)\n\t\treturn\n\t}\n\terr = r.prepareService()\n\tif err != nil {\n\t\terr = fmt.Errorf(\"failed to prepare the service: %v\", err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "a7808f48a6782595e1b0a1eb36924b6f", "score": "0.6540549", "text": "func (probe *Probe) Run() {\n\tprobe.stat.startTime = time.Now()\n\tprobe.probeGroup.Add(3)\n\tdefer probe.printFinal()\n\tdefer probe.probeGroup.Wait()\n\tgo probe.runGenURLTask()\n\tgo probe.runDownloadTask()\n\tgo probe.runSaveDataTask()\n\tgo probe.runLoggingTask()\n}", "title": "" }, { "docid": "253d209ae10239b0a7b047571177b001", "score": "0.65362346", "text": "func (c *CLI) Run(args []string) int {\n\tlog.SetOutput(c.errStream)\n\n\tvar (\n\t\tver bool\n\t\tcredits bool\n\n\t\tonce bool\n\t\tdbuser string\n\t\tdbpass string\n\t\tdbhost string\n\t\tdbport string\n\t\tdbname string\n\t)\n\tflags := flag.NewFlagSet(\"mftracerd\", flag.ContinueOnError)\n\tflags.SetOutput(c.errStream)\n\tflags.Usage = func() {\n\t\tfmt.Fprint(c.errStream, helpText)\n\t}\n\tflags.BoolVar(&once, \"once\", false, \"\")\n\tflags.StringVar(&dbuser, \"dbuser\", \"\", \"\")\n\tflags.StringVar(&dbpass, \"dbpass\", \"\", \"\")\n\tflags.StringVar(&dbhost, \"dbhost\", \"\", \"\")\n\tflags.StringVar(&dbport, \"dbport\", \"\", \"\")\n\tflags.StringVar(&dbname, \"dbname\", \"\", \"\")\n\tflags.BoolVar(&ver, \"version\", false, \"\")\n\tflags.BoolVar(&credits, \"credits\", false, \"\")\n\tif err := flags.Parse(args[1:]); err != nil {\n\t\treturn exitCodeErr\n\t}\n\n\tif ver {\n\t\t// fmt.Fprintf(c.errStream, \"%s version %s, build %s, date %s \\n\", name, version, commit, date)\n\t\treturn exitCodeOK\n\t}\n\n\tif credits {\n\t\tfmt.Fprintln(c.outStream, creditsText)\n\t\treturn exitCodeOK\n\t}\n\n\tlog.Println(\"--> Connecting postgres ...\")\n\tdb, err := db.New(&db.Opt{\n\t\tDBName: dbname,\n\t\tUser: dbuser,\n\t\tPassword: dbpass,\n\t\tHost: dbhost,\n\t\tPort: dbport,\n\t})\n\tif err != nil {\n\t\tlog.Printf(\"postgres initialize error: %v\\n\", err)\n\t\treturn exitCodeErr\n\t}\n\tlog.Println(\"Connected postgres\")\n\n\tif once {\n\t\tif err := agent.RunOnce(db); err != nil {\n\t\t\tlog.Printf(\"%+v\\n\", err)\n\t\t\treturn exitCodeErr\n\t\t}\n\t} else {\n\t\tagent.Start(defaultIntervalSec*time.Second, db)\n\t}\n\n\treturn exitCodeOK\n}", "title": "" }, { "docid": "fb15d830b7bd843a753e93ac72670ca6", "score": "0.6522002", "text": "func (s *APIServer) Run() {\n\t// initialize config.\n\ts.initConfig()\n\n\t// initialize logger.\n\ts.initLogger()\n\tdefer s.Stop()\n\n\t// initialize server modules.\n\ts.initMods()\n\n\t// init api http server.\n\ts.initService()\n\n\t// hanging here.\n\tselect {}\n}", "title": "" }, { "docid": "52137941c3db0ee01a92e58d0f02db05", "score": "0.6517165", "text": "func main() {\n\tporterHome := os.Getenv(\"PORTER_HOME\")\n\tif porterHome == \"\" {\n\t\tporterHome = \"/app/.porter\"\n\t}\n\tporterConfig := os.Getenv(\"PORTER_CONFIG\")\n\tif porterConfig == \"\" {\n\t\tporterConfig = \"/porter-config\"\n\t}\n\terr, run := agent.Execute(os.Args[1:], porterHome, porterConfig)\n\tif err != nil {\n\t\tif !run {\n\t\t\tfmt.Fprintln(os.Stderr, err)\n\t\t}\n\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "1a9dea6f446629f2a30c57e65faeb66c", "score": "0.65095", "text": "func (vm *Manager) Run(ctx context.Context) {\n\tvm.startOnce.Do(func() {\n\t\tvm.run(ctx)\n\t})\n}", "title": "" }, { "docid": "b010453b385636593567cca0befb1b81", "score": "0.6509391", "text": "func (ins *Inspector) Run(ctx context.Context) error {\n\tdefer ins.bs.Close()\n\tdefer ins.ss.Close()\n\n\treturn startRPCServers(ctx, ins.config, ins.logger, ins.routes)\n}", "title": "" }, { "docid": "b9b1622fe6b674edd0cf1d58a5ce49b7", "score": "0.64976597", "text": "func main() {\n\n\t// Delegate this run to the SDK. InvokeMap takes a map of test case names\n\t// and test case functions, and dispatches accordingly depending on the test\n\t// case being run. The run.Invoke* functions are entrypoint functions.\n\trun.InvokeMap(testcases)\n}", "title": "" }, { "docid": "a8917c2885102794886d07bb45417ad3", "score": "0.64958376", "text": "func Run() {\n\tdefaultRoutes()\n\trouter.Run(\":5000\")\n}", "title": "" }, { "docid": "ff795b3c4398c2228544761740bb19f3", "score": "0.6492736", "text": "func Run(log api.Logger, host string, port int) error {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\tonSignals(log, cancel)\n\n\taddr := fmt.Sprintf(\"%s:%d\", host, port)\n\tif err := Start(ctx, log, addr); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c049e72ec2389542b6bb88a0dd3115d8", "score": "0.6478351", "text": "func (app *App) Run() error {\n\tfmt.Println(\"Setting up our App\")\n\treturn nil\n}", "title": "" }, { "docid": "68f5f79a8499151f91248da0404c344e", "score": "0.6470501", "text": "func Run() {\n\trouter := mux.NewRouter()\n\n\troutes.InitializeRoutes(router)\n\n\terr := godotenv.Load()\n\tif err != nil {\n\t\tlog.Printf(\"failed to load environment variables: %v\", err)\n\t}\n\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tlog.Println(r)\n\t\t}\n\t\tlog.Println(\"server starting on port 8080\")\n\n\t\tport := \":\" + os.Getenv(\"PORT\")\n\n\t\terr := http.ListenAndServe(port, router)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Server failed to start with err: %v\", err)\n\t\t}\n\t}()\n\n\tif err := config.InitializeFirebase(); err != nil {\n\t\tlog.Printf(\"Failed to initialize firebase: %v\", err)\n\t}\n\tdatabase.InitializeDB()\n\n\tmessageQueue.InitializeMessageQueue()\n\n}", "title": "" }, { "docid": "ada92c084b1303d088f368fe1013de5a", "score": "0.64641726", "text": "func main() {\n\tep := &ExamplePlugin{\n\t\tLog: logging.DefaultLogger,\n\t\texampleFinished: make(chan struct{}),\n\t}\n\n\t// Start Agent\n\ta := agent.NewAgent(\n\t\tagent.AllPlugins(ep),\n\t\tagent.QuitOnClose(ep.exampleFinished),\n\t)\n\tif err := a.Run(); err != nil {\n\t\tlog.Fatal()\n\t}\n}", "title": "" }, { "docid": "570f70c606ece63873a60254ac44c2f7", "score": "0.6462161", "text": "func (s *Supervisor) Run() {\n\n\ts.MetricsRecorder = prometheus.NewRecorder(\n\t\tprometheus.StartPrometheusServer()).WithID(s.genKsuid().String())\n\n\tctx := metrics.SetRecorderOnContext(context.TODO(), s.MetricsRecorder)\n\n\tif len(config.Config.Targets.Requests) > 0 {\n\t\tlog.Debug().Msg(\"Request target detected! executing ...\")\n\t\ts.launchRequestTargets(ctx)\n\t}\n\nLOOP:\n\tfor {\n\t\t// Calling Sleep method\n\t\ttime.Sleep(TickerTime * time.Second)\n\t\tselect {\n\t\tcase <-execute.Done:\n\t\t\tlog.Info().Msg(\"Graceful termination\")\n\t\t\tos.Exit(0)\n\t\tcase <-execute.Stop:\n\t\t\tlog.Warn().Msg(\"Process terminated by external signal\")\n\t\t\tbreak LOOP\n\t\tcase <-execute.Reload:\n\t\t\tlog.Info().Msg(\"Reloading configuration\")\n\t\tdefault:\n\t\t\tlog.Debug().Msg(\"Supervisor loop signal\")\n\t\t}\n\t}\n\tos.Exit(1)\n}", "title": "" }, { "docid": "b3e6cc02ffb0253108342b6311dcd21f", "score": "0.64455724", "text": "func Run() error {\n\tlogger.InitToConsole(logger.LevelTrace)\n\n\trepository.Init()\n\tdefer repository.Done()\n\n\ta := newApp()\n\treturn a.cli.Run(os.Args)\n}", "title": "" }, { "docid": "4d76d275138af889164191fe4609373b", "score": "0.644048", "text": "func Run(ps *pubsub.PubSub) {\n\tversionPtr := flag.Bool(\"v\", false, \"Version\")\n\tdebugPtr := flag.Bool(\"d\", false, \"Debug flag\")\n\tflag.Parse()\n\tdebug = *debugPtr\n\tdebugOverride = debug\n\tif debugOverride {\n\t\tlog.SetLevel(log.DebugLevel)\n\t} else {\n\t\tlog.SetLevel(log.InfoLevel)\n\t}\n\tif *versionPtr {\n\t\tfmt.Printf(\"%s: %s\\n\", os.Args[0], Version)\n\t\treturn\n\t}\n\tagentlog.Init(agentName)\n\n\tif err := pidfile.CheckAndCreatePidfile(agentName); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Infof(\"Starting %s\", agentName)\n\n\t// create the directories\n\tinitializeDirs()\n\n\t// These settings can be overridden by GlobalConfig\n\tctx := volumemgrContext{\n\t\tvdiskGCTime: 3600,\n\t\tglobalConfig: types.DefaultConfigItemValueMap(),\n\t}\n\n\t// Run a periodic timer so we always update StillRunning\n\tstillRunning := time.NewTicker(25 * time.Second)\n\tagentlog.StillRunning(agentName, warningTime, errorTime)\n\n\t// Look for global config such as log levels\n\tsubGlobalConfig, err := ps.NewSubscription(pubsub.SubscriptionOptions{\n\t\tAgentName: \"\",\n\t\tTopicImpl: types.ConfigItemValueMap{},\n\t\tActivate: false,\n\t\tCtx: &ctx,\n\t\tCreateHandler: handleGlobalConfigModify,\n\t\tModifyHandler: handleGlobalConfigModify,\n\t\tDeleteHandler: handleGlobalConfigDelete,\n\t\tWarningTime: warningTime,\n\t\tErrorTime: errorTime,\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.subGlobalConfig = subGlobalConfig\n\tsubGlobalConfig.Activate()\n\n\t// Create the background worker\n\tctx.workerOld = InitHandleWorkOld(&ctx)\n\tctx.worker = InitHandleWork(&ctx)\n\n\t// Set up our publications before the subscriptions so ctx is set\n\tpubAppImgDownloadConfig, err := ps.NewPublication(pubsub.PublicationOptions{\n\t\tAgentName: agentName,\n\t\tAgentScope: types.AppImgObj,\n\t\tTopicType: types.DownloaderConfig{},\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.pubAppImgDownloadConfig = pubAppImgDownloadConfig\n\n\tpubAppImgVerifierConfig, err := ps.NewPublication(pubsub.PublicationOptions{\n\t\tAgentName: agentName,\n\t\tAgentScope: types.AppImgObj,\n\t\tTopicType: types.VerifyImageConfig{},\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.pubAppImgVerifierConfig = pubAppImgVerifierConfig\n\n\tpubBaseOsDownloadConfig, err := ps.NewPublication(pubsub.PublicationOptions{\n\t\tAgentName: agentName,\n\t\tAgentScope: types.BaseOsObj,\n\t\tTopicType: types.DownloaderConfig{},\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.pubBaseOsDownloadConfig = pubBaseOsDownloadConfig\n\n\tpubBaseOsVerifierConfig, err := ps.NewPublication(pubsub.PublicationOptions{\n\t\tAgentName: agentName,\n\t\tAgentScope: types.BaseOsObj,\n\t\tTopicType: types.VerifyImageConfig{},\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.pubBaseOsVerifierConfig = pubBaseOsVerifierConfig\n\n\tpubContentTreeResolveConfig, err := ps.NewPublication(pubsub.PublicationOptions{\n\t\tAgentName: agentName,\n\t\tAgentScope: types.AppImgObj,\n\t\tTopicType: types.ResolveConfig{},\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tpubContentTreeResolveConfig.ClearRestarted()\n\tctx.pubContentTreeResolveConfig = pubContentTreeResolveConfig\n\n\tpubContentTreeStatus, err := ps.NewPublication(pubsub.PublicationOptions{\n\t\tAgentName: agentName,\n\t\tAgentScope: types.AppImgObj,\n\t\tTopicType: types.ContentTreeStatus{},\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.pubContentTreeStatus = pubContentTreeStatus\n\n\tpubVolumeStatus, err := ps.NewPublication(pubsub.PublicationOptions{\n\t\tAgentName: agentName,\n\t\tAgentScope: types.AppImgObj,\n\t\tTopicType: types.VolumeStatus{},\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.pubVolumeStatus = pubVolumeStatus\n\n\tpubUnknownVolumeStatus, err := ps.NewPublication(pubsub.PublicationOptions{\n\t\tAgentName: agentName,\n\t\tAgentScope: types.UnknownObj,\n\t\tTopicType: types.VolumeStatus{},\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.pubUnknownVolumeStatus = pubUnknownVolumeStatus\n\n\tpubContentTreeToHash, err := ps.NewPublication(pubsub.PublicationOptions{\n\t\tAgentName: agentName,\n\t\tPersistent: true,\n\t\tTopicType: types.AppAndImageToHash{},\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.pubContentTreeToHash = pubContentTreeToHash\n\n\tpubAppVolumeStatus, err := ps.NewPublication(pubsub.PublicationOptions{\n\t\tAgentName: agentName,\n\t\tAgentScope: types.AppImgObj,\n\t\tTopicType: types.OldVolumeStatus{},\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.pubAppVolumeStatus = pubAppVolumeStatus\n\n\tpubBaseOsVolumeStatus, err := ps.NewPublication(pubsub.PublicationOptions{\n\t\tAgentName: agentName,\n\t\tAgentScope: types.BaseOsObj,\n\t\tTopicType: types.OldVolumeStatus{},\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.pubBaseOsVolumeStatus = pubBaseOsVolumeStatus\n\n\tpubUnknownOldVolumeStatus, err := ps.NewPublication(pubsub.PublicationOptions{\n\t\tAgentName: agentName,\n\t\tAgentScope: types.UnknownObj,\n\t\tTopicType: types.OldVolumeStatus{},\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.pubUnknownOldVolumeStatus = pubUnknownOldVolumeStatus\n\n\tpubCertObjStatus, err := ps.NewPublication(\n\t\tpubsub.PublicationOptions{\n\t\t\tAgentName: agentName,\n\t\t\tTopicType: types.CertObjStatus{},\n\t\t})\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tpubCertObjStatus.ClearRestarted()\n\tctx.pubCertObjStatus = pubCertObjStatus\n\n\tpubCertObjDownloadConfig, err := ps.NewPublication(\n\t\tpubsub.PublicationOptions{\n\t\t\tAgentName: agentName,\n\t\t\tAgentScope: types.CertObj,\n\t\t\tTopicType: types.DownloaderConfig{},\n\t\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tpubCertObjDownloadConfig.ClearRestarted()\n\tctx.pubCertObjDownloadConfig = pubCertObjDownloadConfig\n\n\t// Set up our publications before the subscriptions so ctx is set\n\tpubAppImgPersistStatus, err := ps.NewPublication(\n\t\tpubsub.PublicationOptions{\n\t\t\tAgentName: agentName,\n\t\t\tAgentScope: types.AppImgObj,\n\t\t\tTopicType: types.PersistImageStatus{},\n\t\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.pubAppImgPersistStatus = pubAppImgPersistStatus\n\n\tpubBaseOsPersistStatus, err := ps.NewPublication(\n\t\tpubsub.PublicationOptions{\n\t\t\tAgentName: agentName,\n\t\t\tAgentScope: types.BaseOsObj,\n\t\t\tTopicType: types.PersistImageStatus{},\n\t\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.pubBaseOsPersistStatus = pubBaseOsPersistStatus\n\n\t// Publish existing volumes with RefCount zero in the \"unknown\"\n\t// agentScope\n\t// Note that nobody subscribes to this. Used internally\n\t// to look up a Volume.\n\tpopulateInitialOldVolumeStatus(&ctx, rwImgDirname)\n\tpopulateInitialOldVolumeStatus(&ctx, roContImgDirname)\n\tpopulateInitialVolumeStatus(&ctx, volumeEncryptedDirName)\n\n\t// Look for global config such as log levels\n\tsubZedAgentStatus, err := ps.NewSubscription(pubsub.SubscriptionOptions{\n\t\tAgentName: \"zedagent\",\n\t\tTopicImpl: types.ZedAgentStatus{},\n\t\tActivate: false,\n\t\tCtx: &ctx,\n\t\tCreateHandler: handleZedAgentStatusModify,\n\t\tModifyHandler: handleZedAgentStatusModify,\n\t\tWarningTime: warningTime,\n\t\tErrorTime: errorTime,\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.subZedAgentStatus = subZedAgentStatus\n\tsubZedAgentStatus.Activate()\n\n\t// Look for DownloaderStatus from downloader\n\tsubAppImgDownloadStatus, err := ps.NewSubscription(pubsub.SubscriptionOptions{\n\t\tAgentName: \"downloader\",\n\t\tAgentScope: types.AppImgObj,\n\t\tTopicImpl: types.DownloaderStatus{},\n\t\tActivate: false,\n\t\tCtx: &ctx,\n\t\tCreateHandler: handleDownloaderStatusModify,\n\t\tModifyHandler: handleDownloaderStatusModify,\n\t\tDeleteHandler: handleDownloaderStatusDelete,\n\t\tWarningTime: warningTime,\n\t\tErrorTime: errorTime,\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.subAppImgDownloadStatus = subAppImgDownloadStatus\n\tsubAppImgDownloadStatus.Activate()\n\n\t// Look for VerifyImageStatus from verifier\n\tsubAppImgVerifierStatus, err := ps.NewSubscription(pubsub.SubscriptionOptions{\n\t\tAgentName: \"verifier\",\n\t\tAgentScope: types.AppImgObj,\n\t\tTopicImpl: types.VerifyImageStatus{},\n\t\tActivate: false,\n\t\tCtx: &ctx,\n\t\tCreateHandler: handleVerifyImageStatusModify,\n\t\tModifyHandler: handleVerifyImageStatusModify,\n\t\tDeleteHandler: handleVerifyImageStatusDelete,\n\t\tRestartHandler: handleVerifierRestarted,\n\t\tWarningTime: warningTime,\n\t\tErrorTime: errorTime,\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.subAppImgVerifierStatus = subAppImgVerifierStatus\n\tsubAppImgVerifierStatus.Activate()\n\n\t// Look for PersistImageStatus from verifier\n\tsubAppImgPersistStatus, err := ps.NewSubscription(\n\t\tpubsub.SubscriptionOptions{\n\t\t\tAgentName: \"verifier\",\n\t\t\tAgentScope: types.AppImgObj,\n\t\t\tTopicImpl: types.PersistImageStatus{},\n\t\t\tActivate: false,\n\t\t\tCtx: &ctx,\n\t\t\tCreateHandler: handlePersistImageStatusCreate,\n\t\t\tWarningTime: warningTime,\n\t\t\tErrorTime: errorTime,\n\t\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.subAppImgPersistStatus = subAppImgPersistStatus\n\tsubAppImgPersistStatus.Activate()\n\n\t// Look for PersistImageStatus from verifier\n\tsubBaseOsPersistStatus, err := ps.NewSubscription(\n\t\tpubsub.SubscriptionOptions{\n\t\t\tAgentName: \"verifier\",\n\t\t\tAgentScope: types.BaseOsObj,\n\t\t\tTopicImpl: types.PersistImageStatus{},\n\t\t\tActivate: false,\n\t\t\tCtx: &ctx,\n\t\t\tCreateHandler: handlePersistImageStatusCreate,\n\t\t\tWarningTime: warningTime,\n\t\t\tErrorTime: errorTime,\n\t\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.subBaseOsPersistStatus = subBaseOsPersistStatus\n\tsubBaseOsPersistStatus.Activate()\n\n\t// Look for DownloaderStatus from downloader\n\tsubBaseOsDownloadStatus, err := ps.NewSubscription(pubsub.SubscriptionOptions{\n\t\tAgentName: \"downloader\",\n\t\tAgentScope: types.BaseOsObj,\n\t\tTopicImpl: types.DownloaderStatus{},\n\t\tActivate: false,\n\t\tCtx: &ctx,\n\t\tCreateHandler: handleDownloaderStatusModify,\n\t\tModifyHandler: handleDownloaderStatusModify,\n\t\tDeleteHandler: handleDownloaderStatusDelete,\n\t\tWarningTime: warningTime,\n\t\tErrorTime: errorTime,\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.subBaseOsDownloadStatus = subBaseOsDownloadStatus\n\tsubBaseOsDownloadStatus.Activate()\n\n\t// Look for VerifyImageStatus from verifier\n\tsubBaseOsVerifierStatus, err := ps.NewSubscription(pubsub.SubscriptionOptions{\n\t\tAgentName: \"verifier\",\n\t\tAgentScope: types.BaseOsObj,\n\t\tTopicImpl: types.VerifyImageStatus{},\n\t\tActivate: false,\n\t\tCtx: &ctx,\n\t\tCreateHandler: handleVerifyImageStatusModify,\n\t\tModifyHandler: handleVerifyImageStatusModify,\n\t\tDeleteHandler: handleVerifyImageStatusDelete,\n\t\tRestartHandler: handleVerifierRestarted,\n\t\tWarningTime: warningTime,\n\t\tErrorTime: errorTime,\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.subBaseOsVerifierStatus = subBaseOsVerifierStatus\n\tsubBaseOsVerifierStatus.Activate()\n\n\t// Look for CertObjConfig, from zedagent\n\tsubCertObjConfig, err := ps.NewSubscription(\n\t\tpubsub.SubscriptionOptions{\n\t\t\tAgentName: \"zedagent\",\n\t\t\tTopicImpl: types.CertObjConfig{},\n\t\t\tActivate: false,\n\t\t\tCtx: &ctx,\n\t\t\tCreateHandler: handleCertObjCreate,\n\t\t\tModifyHandler: handleCertObjModify,\n\t\t\tDeleteHandler: handleCertObjConfigDelete,\n\t\t\tWarningTime: warningTime,\n\t\t\tErrorTime: errorTime,\n\t\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.subCertObjConfig = subCertObjConfig\n\tsubCertObjConfig.Activate()\n\n\t// Look for Certs DownloaderStatus from downloader\n\tsubCertObjDownloadStatus, err := ps.NewSubscription(\n\t\tpubsub.SubscriptionOptions{\n\t\t\tAgentName: \"downloader\",\n\t\t\tAgentScope: types.CertObj,\n\t\t\tTopicImpl: types.DownloaderStatus{},\n\t\t\tActivate: false,\n\t\t\tCtx: &ctx,\n\t\t\tCreateHandler: handleDownloadStatusModify,\n\t\t\tModifyHandler: handleDownloadStatusModify,\n\t\t\tDeleteHandler: handleDownloadStatusDelete,\n\t\t\tWarningTime: warningTime,\n\t\t\tErrorTime: errorTime,\n\t\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.subCertObjDownloadStatus = subCertObjDownloadStatus\n\tsubCertObjDownloadStatus.Activate()\n\n\t// Look for ContentTreeResolveStatus from downloader\n\tsubContentTreeResolveStatus, err := ps.NewSubscription(pubsub.SubscriptionOptions{\n\t\tAgentName: \"downloader\",\n\t\tAgentScope: types.AppImgObj,\n\t\tTopicImpl: types.ResolveStatus{},\n\t\tActivate: false,\n\t\tCtx: &ctx,\n\t\tCreateHandler: handleResolveStatusModify,\n\t\tModifyHandler: handleResolveStatusModify,\n\t\tWarningTime: warningTime,\n\t\tErrorTime: errorTime,\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.subContentTreeResolveStatus = subContentTreeResolveStatus\n\tsubContentTreeResolveStatus.Activate()\n\n\tsubContentTreeConfig, err := ps.NewSubscription(pubsub.SubscriptionOptions{\n\t\tCreateHandler: handleContentTreeCreate,\n\t\tModifyHandler: handleContentTreeModify,\n\t\tDeleteHandler: handleContentTreeDelete,\n\t\tWarningTime: warningTime,\n\t\tErrorTime: errorTime,\n\t\tAgentName: \"zedagent\",\n\t\tTopicImpl: types.ContentTreeConfig{},\n\t\tCtx: &ctx,\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.subContentTreeConfig = subContentTreeConfig\n\tsubContentTreeConfig.Activate()\n\n\tsubVolumeConfig, err := ps.NewSubscription(pubsub.SubscriptionOptions{\n\t\tCreateHandler: handleVolumeCreate,\n\t\tModifyHandler: handleVolumeModify,\n\t\tDeleteHandler: handleVolumeDelete,\n\t\tWarningTime: warningTime,\n\t\tErrorTime: errorTime,\n\t\tAgentName: \"zedagent\",\n\t\tTopicImpl: types.VolumeConfig{},\n\t\tCtx: &ctx,\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.subVolumeConfig = subVolumeConfig\n\tsubVolumeConfig.Activate()\n\n\tsubAppVolumeConfig, err := ps.NewSubscription(pubsub.SubscriptionOptions{\n\t\tCreateHandler: handleAppImgCreate,\n\t\tModifyHandler: handleAppImgModify,\n\t\tDeleteHandler: handleAppImgDelete,\n\t\tWarningTime: warningTime,\n\t\tErrorTime: errorTime,\n\t\tAgentName: \"zedmanager\",\n\t\tAgentScope: types.AppImgObj,\n\t\tTopicImpl: types.OldVolumeConfig{},\n\t\tCtx: &ctx,\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.subAppVolumeConfig = subAppVolumeConfig\n\tsubAppVolumeConfig.Activate()\n\n\tsubBaseOsVolumeConfig, err := ps.NewSubscription(pubsub.SubscriptionOptions{\n\t\tCreateHandler: handleBaseOsCreate,\n\t\tModifyHandler: handleBaseOsModify,\n\t\tDeleteHandler: handleBaseOsDelete,\n\t\tWarningTime: warningTime,\n\t\tErrorTime: errorTime,\n\t\tAgentName: \"baseosmgr\",\n\t\tAgentScope: types.BaseOsObj,\n\t\tTopicImpl: types.OldVolumeConfig{},\n\t\tCtx: &ctx,\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx.subBaseOsVolumeConfig = subBaseOsVolumeConfig\n\tsubBaseOsVolumeConfig.Activate()\n\n\t// Pick up debug aka log level before we start real work\n\tfor !ctx.GCInitialized {\n\t\tlog.Infof(\"waiting for GCInitialized\")\n\t\tselect {\n\t\tcase change := <-subGlobalConfig.MsgChan():\n\t\t\tsubGlobalConfig.ProcessChange(change)\n\t\tcase <-stillRunning.C:\n\t\t}\n\t\tagentlog.StillRunning(agentName, warningTime, errorTime)\n\t}\n\tlog.Infof(\"processed GlobalConfig\")\n\n\tif err := containerd.InitContainerdClient(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer containerd.CtrdClient.Close()\n\n\t// First we process the verifierStatus to avoid triggering a download\n\t// of an image we already have in place.\n\tfor ctx.verifierRestarted != 2 {\n\t\tlog.Infof(\"Waiting for verifierRestarted: is %d\",\n\t\t\tctx.verifierRestarted)\n\n\t\tselect {\n\t\tcase change := <-subGlobalConfig.MsgChan():\n\t\t\tsubGlobalConfig.ProcessChange(change)\n\n\t\tcase change := <-subAppImgVerifierStatus.MsgChan():\n\t\t\tsubAppImgVerifierStatus.ProcessChange(change)\n\n\t\tcase change := <-subAppImgPersistStatus.MsgChan():\n\t\t\tsubAppImgPersistStatus.ProcessChange(change)\n\n\t\tcase change := <-subBaseOsVerifierStatus.MsgChan():\n\t\t\tsubBaseOsVerifierStatus.ProcessChange(change)\n\n\t\tcase res := <-ctx.workerOld.MsgChan():\n\t\t\tHandleWorkResultOld(&ctx, ctx.workerOld.Process(res))\n\n\t\tcase res := <-ctx.worker.MsgChan():\n\t\t\tHandleWorkResult(&ctx, ctx.worker.Process(res))\n\n\t\tcase <-stillRunning.C:\n\t\t}\n\t\tagentlog.StillRunning(agentName, warningTime, errorTime)\n\t}\n\tlog.Infof(\"Handling all inputs\")\n\n\t// We will cleanup zero RefCount objects after a while\n\t// We run timer 10 times more often than the limit on LastUse\n\t// We start the timer once ZedAgentStatus tells us we are receiving\n\t// config (or using a saved config) to avoid removing volumes when\n\t// they might become used.\n\tduration := time.Duration(ctx.vdiskGCTime / 10)\n\tctx.gc = time.NewTicker(duration * time.Second)\n\tctx.gc.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase change := <-ctx.subGlobalConfig.MsgChan():\n\t\t\tctx.subGlobalConfig.ProcessChange(change)\n\n\t\tcase change := <-subZedAgentStatus.MsgChan():\n\t\t\tsubZedAgentStatus.ProcessChange(change)\n\t\t\tif ctx.usingConfig && !ctx.gcRunning {\n\t\t\t\tlog.Infof(\"Starting gc timer\")\n\t\t\t\tduration := time.Duration(ctx.vdiskGCTime / 10)\n\t\t\t\tctx.gc = time.NewTicker(duration * time.Second)\n\t\t\t\t// Update the LastUse here to be now\n\t\t\t\tgcResetOldObjectsLastUse(&ctx, rwImgDirname)\n\t\t\t\tgcResetOldObjectsLastUse(&ctx, roContImgDirname)\n\t\t\t\tgcResetObjectsLastUse(&ctx, volumeEncryptedDirName)\n\t\t\t\tgcResetPersistObjectLastUse(&ctx)\n\t\t\t\tctx.gcRunning = true\n\t\t\t}\n\n\t\tcase change := <-ctx.subCertObjConfig.MsgChan():\n\t\t\tctx.subCertObjConfig.ProcessChange(change)\n\n\t\tcase change := <-subAppImgDownloadStatus.MsgChan():\n\t\t\tsubAppImgDownloadStatus.ProcessChange(change)\n\n\t\tcase change := <-subAppImgVerifierStatus.MsgChan():\n\t\t\tsubAppImgVerifierStatus.ProcessChange(change)\n\n\t\tcase change := <-subBaseOsDownloadStatus.MsgChan():\n\t\t\tsubBaseOsDownloadStatus.ProcessChange(change)\n\n\t\tcase change := <-subBaseOsVerifierStatus.MsgChan():\n\t\t\tsubBaseOsVerifierStatus.ProcessChange(change)\n\n\t\tcase change := <-ctx.subCertObjDownloadStatus.MsgChan():\n\t\t\tctx.subCertObjDownloadStatus.ProcessChange(change)\n\n\t\tcase change := <-subContentTreeResolveStatus.MsgChan():\n\t\t\tctx.subContentTreeResolveStatus.ProcessChange(change)\n\n\t\tcase change := <-ctx.subContentTreeConfig.MsgChan():\n\t\t\tctx.subContentTreeConfig.ProcessChange(change)\n\n\t\tcase change := <-ctx.subVolumeConfig.MsgChan():\n\t\t\tctx.subVolumeConfig.ProcessChange(change)\n\n\t\tcase change := <-ctx.subAppVolumeConfig.MsgChan():\n\t\t\tctx.subAppVolumeConfig.ProcessChange(change)\n\n\t\tcase change := <-ctx.subBaseOsVolumeConfig.MsgChan():\n\t\t\tctx.subBaseOsVolumeConfig.ProcessChange(change)\n\n\t\tcase change := <-subAppImgPersistStatus.MsgChan():\n\t\t\tsubAppImgPersistStatus.ProcessChange(change)\n\n\t\tcase change := <-subBaseOsPersistStatus.MsgChan():\n\t\t\tsubBaseOsPersistStatus.ProcessChange(change)\n\n\t\tcase <-ctx.gc.C:\n\t\t\tstart := time.Now()\n\t\t\tgcOldObjects(&ctx, rwImgDirname)\n\t\t\tgcOldObjects(&ctx, roContImgDirname)\n\t\t\tgcObjects(&ctx, volumeEncryptedDirName)\n\t\t\tgcVerifiedObjects(&ctx)\n\t\t\tpubsub.CheckMaxTimeTopic(agentName, \"gc\", start,\n\t\t\t\twarningTime, errorTime)\n\n\t\tcase res := <-ctx.workerOld.MsgChan():\n\t\t\tHandleWorkResultOld(&ctx, ctx.workerOld.Process(res))\n\n\t\tcase res := <-ctx.worker.MsgChan():\n\t\t\tHandleWorkResult(&ctx, ctx.worker.Process(res))\n\n\t\tcase <-stillRunning.C:\n\t\t}\n\t\tagentlog.StillRunning(agentName, warningTime, errorTime)\n\t}\n}", "title": "" }, { "docid": "611f88edf4d141d557815b9593226294", "score": "0.6434955", "text": "func Run() {\n\t// This binary is only ever invoked _after_ the\n\t// startup binary has been invoked and the modified environments have\n\t// been sourced. Therefore, the NODENAME environment will always be\n\t// set at this point.\n\tnodename := os.Getenv(\"NODENAME\")\n\tif nodename == \"\" {\n\t\tlogrus.Panic(\"NODENAME environment is not set\")\n\t}\n\n\trun(nodename)\n}", "title": "" }, { "docid": "e55296dd95146baa947a724143c40858", "score": "0.6432052", "text": "func Run(ctx context.Context, opts *options.Options) error {\n\tconfig, err := controllerruntime.GetConfig()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\thookManager, err := controllerruntime.NewManager(config, controllerruntime.Options{\n\t\tLogger: klog.Background(),\n\t\tHost: opts.BindAddress,\n\t\tPort: opts.SecurePort,\n\t\tCertDir: opts.CertDir,\n\t\tLeaderElection: false,\n\t})\n\tif err != nil {\n\t\tklog.Errorf(\"Failed to build webhook server: %v\", err)\n\t\treturn err\n\t}\n\n\tklog.Info(\"Registering webhooks to the webhook server\")\n\thookServer := hookManager.GetWebhookServer()\n\thookServer.Register(\"/interpreter-workload\", interpreter.NewWebhook(&workloadInterpreter{}, interpreter.NewDecoder(gclient.NewSchema())))\n\thookServer.WebhookMux().Handle(\"/readyz/\", http.StripPrefix(\"/readyz/\", &healthz.Handler{}))\n\n\t// blocks until the context is done.\n\tif err := hookManager.Start(ctx); err != nil {\n\t\tklog.Errorf(\"Webhook server exits unexpectedly: %v\", err)\n\t\treturn err\n\t}\n\n\t// never reach here\n\treturn nil\n}", "title": "" }, { "docid": "e0912e10199eb51885e0be78f2371d57", "score": "0.64299333", "text": "func Run() {\n\tregisterClientForProgram(\"1\")\n}", "title": "" }, { "docid": "4b8df293a79c43192d0d5cb3cb341b58", "score": "0.6420112", "text": "func (runner *runner) Main() {\n\n\tparseArguments(os.Args[1:], runner.arguments)\n\trunner.storeArgs()\n\n\tif _, needHelp := runner.arguments.elmoFlags[helpFlag]; needHelp {\n\t\thelp()\n\t\treturn\n\t}\n\n\tif _, wantsVersion := runner.arguments.elmoFlags[versionFlag]; wantsVersion {\n\t\tfmt.Printf(\"%v\\n\", elmo.Version)\n\t\treturn\n\t}\n\n\t_, elmo.GlobalSettings().Debug = runner.arguments.elmoFlags[debugFlag]\n\t_, elmo.GlobalSettings().HotReload = runner.arguments.elmoFlags[autoreloadFlag]\n\t_, elmo.GlobalSettings().StartRepl = runner.arguments.elmoFlags[replFlag]\n\n\trunner.context.RegisterModule(elmo.NewModule(\"debug\", initDebugModule(runner, elmo.GlobalSettings().Debug)))\n\n\tif runner.arguments.elmoFile == \"\" {\n\t\t// no source specified so running elmo as a REPL\n\t\t//\n\t\trunner.Repl()\n\t} else {\n\n\t\trunner.read(runner.arguments.elmoFile)\n\n\t\tif elmo.GlobalSettings().StartRepl {\n\t\t\trunner.Repl()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3e2bbb195c0d04666a6693a7d690b6b7", "score": "0.64104015", "text": "func (server *Server) Run() {\n\tserver.newGRPC()\n\tserver.listenAndServeHTTP()\n}", "title": "" }, { "docid": "7f4b0f9c114f6900a0057df39a55b640", "score": "0.6399071", "text": "func Run() error {\n\tcfg := config.Load()\n\n\tapp := &cli.App{\n\t\tName: \"hetzner_exporter\",\n\t\tVersion: version.String,\n\t\tUsage: \"Hetzner Exporter\",\n\t\tAuthors: []*cli.Author{\n\t\t\t{\n\t\t\t\tName: \"Thomas Boerger\",\n\t\t\t\tEmail: \"thomas@webhippie.de\",\n\t\t\t},\n\t\t},\n\t\tFlags: RootFlags(cfg),\n\t\tCommands: []*cli.Command{\n\t\t\tHealth(cfg),\n\t\t},\n\t\tAction: func(c *cli.Context) error {\n\t\t\tlogger := setupLogger(cfg)\n\n\t\t\tif cfg.Target.Username == \"\" {\n\t\t\t\tlevel.Error(logger).Log(\n\t\t\t\t\t\"msg\", \"Missing required hetzner.username\",\n\t\t\t\t)\n\n\t\t\t\treturn fmt.Errorf(\"missing required hetzner.username\")\n\t\t\t}\n\n\t\t\tif cfg.Target.Password == \"\" {\n\t\t\t\tlevel.Error(logger).Log(\n\t\t\t\t\t\"msg\", \"Missing required hetzner.password\",\n\t\t\t\t)\n\n\t\t\t\treturn fmt.Errorf(\"missing required hetzner.password\")\n\t\t\t}\n\n\t\t\treturn action.Server(cfg, logger)\n\t\t},\n\t}\n\n\tcli.HelpFlag = &cli.BoolFlag{\n\t\tName: \"help\",\n\t\tAliases: []string{\"h\"},\n\t\tUsage: \"Show the help, so what you see now\",\n\t}\n\n\tcli.VersionFlag = &cli.BoolFlag{\n\t\tName: \"version\",\n\t\tAliases: []string{\"v\"},\n\t\tUsage: \"Print the current version of that tool\",\n\t}\n\n\treturn app.Run(os.Args)\n}", "title": "" }, { "docid": "87ae03e21535a5a05851954976b36096", "score": "0.63896805", "text": "func Run(addr string) error {\n\tprotocolFactory := thrift.NewTJSONProtocolFactory()\n\ttransportFactory := thrift.NewTTransportFactory()\n\ttransport, err := thrift.NewTServerSocket(addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\thandler := newCalculateHandler()\n\tprocessor := calculate.NewCalculatorProcessor(handler)\n\tserver := thrift.NewTSimpleServer4(processor, transport, transportFactory, protocolFactory)\n\tlog.Println(\"Starting the server on \", addr)\n\treturn server.Serve()\n}", "title": "" }, { "docid": "a8ff5ab8f77f3983f69ecec6655bb2b8", "score": "0.6386857", "text": "func Run() {\n\tshoop()\n}", "title": "" }, { "docid": "a5522b25cc7deafd0c14eedb8003e045", "score": "0.63843554", "text": "func Run(server *Server) error {\n\tserver.Start()\n\treturn nil\n}", "title": "" }, { "docid": "532c10e3a6c074f6729cedc9c19b3bc9", "score": "0.63724816", "text": "func Run() {\n\tengine := gin.Default()\n\n\tperson.Routes(engine)\n\tstatus.Routes(engine)\n\ttest.Routes(engine)\n\n\tengine.Run(\":5000\")\n}", "title": "" }, { "docid": "ca3eddadd831eb2ef4e594796da78f3b", "score": "0.6366825", "text": "func Run(program *vm.Program, env interface{}) (interface{}, error) {\n\treturn vm.Run(program, env)\n}", "title": "" }, { "docid": "05d78f11d17d109ecc14dfc8f1b918ed", "score": "0.6345268", "text": "func Run(ps *pubsub.PubSub, loggerArg *logrus.Logger, logArg *base.LogObject, arguments []string) int {\n\tlogger = loggerArg\n\tlog = logArg\n\tctx := &ucContext{agentName: \"upgradeconverter\",\n\t\tpersistDir: types.PersistDir,\n\t\tpersistConfigDir: types.PersistConfigDir,\n\t\tpersistStatusDir: types.PersistStatusDir,\n\t\tps: ps,\n\t}\n\tagentbase.Init(ctx, logger, log, agentName,\n\t\tagentbase.WithPidFile(),\n\t\tagentbase.WithArguments(arguments))\n\n\tctx.persistDir = *ctx.persistPtr // XXX remove? Or use for tests?\n\tctx.noFlag = *ctx.noFlagPtr\n\n\tphase := UCPhasePreVault\n\tif len(ctx.args) != 0 {\n\t\tswitch ctx.args[0] {\n\t\tcase \"pre-vault\":\n\t\t\tphase = UCPhasePreVault\n\t\tcase \"post-vault\":\n\t\t\tphase = UCPhasePostVault\n\t\tdefault:\n\t\t\tlog.Errorf(\"Unknown argument %s, running pre-vault phase\", ctx.args[0])\n\t\t}\n\t}\n\trunPhase(ctx, phase)\n\treturn 0\n}", "title": "" }, { "docid": "d39c9280c78110ceba93f252641caa8d", "score": "0.6342261", "text": "func (a *arc) Run() (int, error) {\n\tu, err := user.Current()\n\tif err != nil {\n\t\treturn 1, err\n\t}\n\n\t// Create base request.\n\treq := route.NewRequest(a.Name(), u.Username, time.Now().UTC().String())\n\n\t// Parse the request from the command line.\n\treq.Parse(os.Args[2:])\n\tlog.Info(\"Creating %s request for user %q\", req, u.Username)\n\n\t// Load the data from the provider unless there is a Load, Help or Config command.\n\tswitch req.Command() {\n\tcase route.None, route.Load:\n\t\t// Invalid commands: issue a help command.\n\t\treq.SetCommand(route.Help)\n\t\ta.Route(req)\n\t\treturn 1, nil\n\tcase route.Help, route.Config:\n\t\t// Skip loading for help and config commands since we aren't going to\n\t\t// interact with the provider.\n\t\tbreak\n\tdefault:\n\t\tif req.TestFlag() {\n\t\t\tbreak\n\t\t}\n\t\tlog.Info(\"Loading arc: %q\", a.Name())\n\t\tif resp := a.Route(req.Clone(route.Load)); resp != route.OK {\n\t\t\treturn 1, fmt.Errorf(\"Failed to load datacenter %s\", a.Name())\n\t\t}\n\t\tlog.Info(\"Loading complete\")\n\t}\n\n\tlog.Info(\"Routing request: %q\", req)\n\tresp := a.Route(req)\n\tif resp != route.OK {\n\t\tlog.Info(\"Exiting, %s request failed\\n\", req)\n\t\treturn 1, nil\n\t}\n\tlog.Info(\"Exiting successfully\\n\")\n\treturn 0, nil\n}", "title": "" }, { "docid": "7173d28e714947e98593e1fa391230ec", "score": "0.6335987", "text": "func (h *Harness) Run() {\n\tvar paths []string\n\tif revel.Config.BoolDefault(\"watch.gopath\", false) {\n\t\tgopaths := filepath.SplitList(build.Default.GOPATH)\n\t\tpaths = append(paths, gopaths...)\n\t}\n\tpaths = append(paths, revel.CodePaths...)\n\twatcher = revel.NewWatcher()\n\twatcher.Listen(h, paths...)\n\n\tgo func() {\n\t\taddr := fmt.Sprintf(\"%s:%d\", revel.HttpAddr, revel.HttpPort)\n\t\trevel.INFO.Printf(\"Listening on %s\", addr)\n\n\t\tvar err error\n\t\tif revel.HttpSsl {\n\t\t\terr = http.ListenAndServeTLS(addr, revel.HttpSslCert,\n\t\t\t\trevel.HttpSslKey, h)\n\t\t} else {\n\t\t\terr = http.ListenAndServe(addr, h)\n\t\t}\n\t\tif err != nil {\n\t\t\trevel.ERROR.Fatalln(\"Failed to start reverse proxy:\", err)\n\t\t}\n\t}()\n\n\t// Kill the app on signal.\n\tch := make(chan os.Signal)\n\tsignal.Notify(ch, os.Interrupt, os.Kill)\n\t<-ch\n\tif h.app != nil {\n\t\th.app.Kill()\n\t}\n\tos.Exit(1)\n}", "title": "" }, { "docid": "4e627d22931ff306d93bd38a2b8cfc82", "score": "0.633294", "text": "func (g *game) Run() {\n\tg.Call(\"run\")\n}", "title": "" }, { "docid": "bbbfd312e9be8870cba49f72f27aa059", "score": "0.6332756", "text": "func (s *Suite) Run() {\n\ts.osExit(s.run())\n}", "title": "" }, { "docid": "aada4aa5e9a19a4aeff995ba9567cd09", "score": "0.6322143", "text": "func Run(ctx *cli.Context) {\n\n\tif ctx.Bool(\"debug\") {\n\t\tlog.SetLevel(log.DebugLevel)\n\t}\n\n\tipam := vzIpam{}\n\n\thandler := driver.NewHandler(ipam)\n\n\thandler.ServeTCP(\"vzipam\", \":8080\")\n}", "title": "" }, { "docid": "5bbaf74f0b2839100da019b6e614b106", "score": "0.6318234", "text": "func (fed *Federator) Run(stopCh chan struct{}) {\n\n\t// dump events into 'actions' queue\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase a := <-fed.responder.GetRequestCh():\n\t\t\t\tlog.Debugf(\"received action: %+v\", a)\n\t\t\t\tfed.actions <- a\n\t\t\tcase d := <-fed.hubCreator.didFinishHubCreation:\n\t\t\t\tfed.actions <- d\n\t\t\t}\n\t\t}\n\t}()\n\n\t// process actions\n\tgo func() {\n\t\tfor {\n\t\t\ta := <-fed.actions\n\t\t\tlog.Debugf(\"processing action %s\", reflect.TypeOf(a))\n\t\t\tstart := time.Now()\n\t\t\ta.Execute(fed)\n\t\t\tstop := time.Now()\n\t\t\tlog.Debugf(\"finished processing action -- %s\", stop.Sub(start))\n\t\t}\n\t}()\n\n\tlog.Infof(\"starting HTTP server on port %d\", fed.config.Port)\n\tgo func() {\n\t\taddr := fmt.Sprintf(\":%d\", fed.config.Port)\n\t\thttp.ListenAndServe(addr, fed.router)\n\t}()\n\t<-stopCh\n}", "title": "" }, { "docid": "59d95d4c5555fb4ad741eb1a3e866690", "score": "0.6318029", "text": "func (s *Server) Run() {\n\n\tdefer s.logger.Sync()\n\n\ts.observability()\n\n\t//s.router.Handle(\"/metrics\", promhttp.Handler())\n\ts.routerHandler()\n\n\th := &ochttp.Handler{Handler: s.router}\n\tif err := view.Register(ochttp.DefaultServerViews...); err != nil {\n\t\tlog.Fatal(\"failed to register ochttp.DefaultServerViews\")\n\t}\n\ts.initialiseConsumer()\n\ts.logger.Info(\"edith is listening at port\", zap.String(\"port\", s.port))\n\terr := http.ListenAndServe(fmt.Sprintf(\":%s\", s.port), h)\n\tif err != nil {\n\t\ts.logger.Error(\"edith starting failed \", zap.String(\"port\", s.port), zap.Error(err))\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "c1cca498f1c830f6502c973088ef45b9", "score": "0.63098335", "text": "func Run(done <-chan struct{}) {\n\t// This binary is only ever invoked _after_ the\n\t// startup binary has been invoked and the modified environments have\n\t// been sourced. Therefore, the NODENAME environment will always be\n\t// set at this point.\n\tnodename := os.Getenv(\"NODENAME\")\n\tif nodename == \"\" {\n\t\tlog.Panic(\"NODENAME environment is not set\")\n\t}\n\n\t// Load felix environment configuration. Note that this does not perform the full hierarchical load of felix\n\t// configuration nor does this watch for changes, so if it is critical that the configuration value used is correct\n\t// and may be defined outside of an environment variable, do not use this.\n\tfelixEnvConfig := loadFelixEnvConfig()\n\n\t// Load the client config from environment.\n\tcfg, c := calicoclient.CreateClient()\n\n\trun(nodename, cfg, c, felixEnvConfig, done)\n}", "title": "" }, { "docid": "e0aedb2f4987481be2a0cbc251bb91df", "score": "0.630952", "text": "func Run() int {\n\treturn cli.Run(&etcd.Cluster{})\n}", "title": "" }, { "docid": "eb3e95dfea53eb62d94314e4aa14f4ff", "score": "0.63087636", "text": "func (s *Behaviour) Run() error {\n\tlog.Infof(`serving \"%s\" behaviour \"%s\" on port %d`, s.Name(), s.Description(), s.port)\n\treturn s.server.Run(s.port, s.handleRequest)\n}", "title": "" }, { "docid": "15c546f4dcae08ab53f84f040de3e086", "score": "0.6306081", "text": "func (s *VanillaSimulation) Run(config *onet.SimulationConfig) error {\n\t//Create admin who can approve dark changes\n\ts.Admin = darc.NewSignerEd25519(nil, nil)\n\t//Create the identity of the model builder\n\tconsumer := darc.NewSignerEd25519(nil, nil)\n\n\t// Create the calypso client\n\terr := s.CreateLedger(config)\n\tif err != nil{\n\t\treturn errors.New(\"couldn't create Calypso client: \" + err.Error())\n\t}\n\n\t//Load the dataset records\n\tlog.Print(\"Reading dataset from \", s.Dataset)\n\trecords, err := vanilla.GetDataPointsFromCSV(s.Dataset)\n\tif err != nil{\n\t\treturn errors.New(\"couldn't read dataset: \" + err.Error())\n\t} else {\n\t\tlog.Print(\"Dataset has \", len(records), \" instances\")\n\t}\n\t//Create data providers and associate identities\n\tproviders := make([]darc.Signer, len(records))\n\n\tfor i,_ := range providers {\n\t\tproviders[i] = darc.NewSignerEd25519(nil, nil)\n\t}\n\tlog.Print(\"Created identities for data providers\")\n\n\tproviders_ids := vanilla.GetIdentitiesFromSigners(providers)\n\tconsumer_id := consumer.Identity()\n\n\tsecrets, darcs, err := vanilla.AssociateProviders(\n\t\tproviders_ids, records, \"BreastDancerData\", &consumer_id)\n\tif err != nil{\n\t\treturn errors.New(\"Couldn't associate data to providers: \" + err.Error())\n\t} else{\n\t\tlog.Print(\"Assigned data point to each provider and created darcs\")\n\t}\n\n\twrite_insts := make([]byzcoin.InstanceID, len(records))\n\twrite_proofs := make([]*byzcoin.Proof, len(records))\n\tread_proofs := make([]*byzcoin.Proof, len(records))\n\tread_insts := make([]byzcoin.InstanceID, len(records))\n\n\tprepare_t := monitor.NewTimeMeasure(\"prepare\")\n\t//uint64 counter := 0\n\t//counter = counter + 1\n\tfor i, secret := range *secrets {\n\t\ts.Client.SpawnDarc(s.Admin, uint64(i+1), s.Gm.GenesisDarc, *darcs[i], 4)\n\t\tlog.Printf(\"Darc %d spawned\", i)\n\t\twrite := calypso.NewWrite(cothority.Suite,\n\t\t\ts.LtsReply.LTSID,\n\t\t\tdarcs[i].GetBaseID(),\n\t\t\ts.LtsReply.X,\n\t\t\tsecret)\n\t\treply, err := s.Client.AddWrite(write, providers[i], uint64(1), *darcs[i], 0)\n\t\tif err != nil{\n\t\t\treturn errors.New(\"couldn't spawn write instance: \" + err.Error())\n\t\t}\n\t\twrite_insts[i] = reply.InstanceID\n\t}\n\n\t//Wait for all write instructions to be executed\n\tfor i, _ := range write_insts {\n\t\tprf, err := s.Client.WaitProof(write_insts[i], s.Gm.BlockInterval, nil)\n\t\tif err != nil{\n\t\t\treturn errors.New(\"couldn't get write proof: \" + err.Error())\n\t\t}\n\t\twrite_proofs[i] = prf\n\t}\n\tprepare_t.Record()\n\n\tpipeline_t := monitor.NewTimeMeasure(\"pipeline\")\n\tfor i, darc := range darcs {\n\t\tread_spawn_t := monitor.NewTimeMeasure(\"read_spawn\")\n\t\treply, err := s.Client.AddRead(write_proofs[i], consumer,\n\t\t\tuint64(i+1), *darc, 0)\n\t\tif err != nil{\n\t\t\treturn errors.New(\"couldn't spawn read instance: \" + err.Error())\n\t\t}\n\t\tread_insts[i] = reply.InstanceID\n\t\tread_spawn_t.Record()\n\t}\n\n\t//Wait for all read instructions to be executed\n\tfor i, _ := range read_insts {\n\t\tread_proof_t := monitor.NewTimeMeasure(\"read_proof\")\n\t\tprf, err := s.Client.WaitProof(read_insts[i], s.Gm.BlockInterval, nil)\n\t\tif err != nil{\n\t\t\treturn errors.New(\"couldn't get read proof: \" + err.Error())\n\t\t}\n\t\tread_proofs[i] = prf\n\t\tread_proof_t.Record()\n\t}\n\n\tpoints := make([]vanilla.MlDataPoint, len(records))\n\n\tfor i, _ := range points {\n\t\tdecrypt_t := monitor.NewTimeMeasure(\"decrypt\")\n\t\treply, err := s.Client.DecryptKey(&calypso.DecryptKey{\n\t\t\t*read_proofs[i], *write_proofs[i]})\n\t\tif err != nil{\n\t\t\treturn errors.New(\"couldn't decrypt key: \" + err.Error())\n\t\t}\n\t\tif !reply.X.Equal(s.LtsReply.X) {\n\t\t\treturn errors.New(\"LTS didn't match\")\n\t\t}\n\t\tdata_bytes, err := calypso.DecodeKey(cothority.Suite, s.LtsReply.X,\n\t\t\treply.Cs, reply.XhatEnc, consumer.Ed25519.Secret)\n\t\tif err != nil{\n\t\t\treturn errors.New(\"couldn't decode data point: \" + err.Error())\n\t\t}\n\t\terr = json.Unmarshal(data_bytes, &points[i])\n\t\tif err != nil{\n\t\t\treturn errors.New(\"couldn't cast data point from binary: \" + err.Error())\n\t\t}\n\t\tdecrypt_t.Record()\n\t}\n\n\tr, err := vanilla.VanillaTrainRegressionModel(points)\n\tif err != nil{\n\t\treturn errors.New(\"couldn't train model: \" + err.Error())\n\t} else {\n\t\tlog.Printf(\"Training finished, formula is: %s\", r.Formula)\n\t}\n\tpipeline_t.Record()\n\t// We wait a bit before closing because c.GetProof is sent to the\n\t// leader, but at this point some of the children might still be doing\n\t// updateCollection. If we stop the simulation immediately, then the\n\t// database gets closed and updateCollection on the children fails to\n\t// complete.\n\ttime.Sleep(time.Second)\n\treturn nil\n}", "title": "" }, { "docid": "f692cfa0675fb7b2ffefed25d28da634", "score": "0.63010216", "text": "func (a *Application) Run(setup func()) error {\n\ta.PostWait(setup)\n\treturn a.Wait()\n}", "title": "" }, { "docid": "6aab0c84118ed7231cd77457c31d5755", "score": "0.6299659", "text": "func (a *DgtApp) Run() {\n\ta.getStartFEN()\n\ta.openPort()\n\ta.createBoard()\n\ta.initialiseBoard()\n\ta.runForever()\n}", "title": "" }, { "docid": "815dcfdef90ee8b989260b7efa14a28f", "score": "0.62989974", "text": "func (a *App) Run(addr string) {}", "title": "" }, { "docid": "167cd16d80494dc4565cb59ba3265e15", "score": "0.6292764", "text": "func (api *API) Run() {\n\tglog.Infof(\"Starting api at %v\", api.server.Addr)\n\tif err := api.server.ListenAndServe(); err != nil {\n\t\tglog.Warning(err)\n\t}\n}", "title": "" }, { "docid": "867d272b41ebd3758ef8f6bcea902057", "score": "0.6284482", "text": "func Run() {\n\n\tc := &cli{\n\t\tlog: NewConsoleLogger(),\n\t\tconf: &Config{\n\t\t\tdb: \"default\",\n\t\t\tbranch: \"master\",\n\t\t\tcache: true,\n\t\t},\n\t}\n\n\tc.initDSL()\n\tc.initCLI()\n}", "title": "" }, { "docid": "7759a6cfd9560b6bbcf119d3fcc974e5", "score": "0.6281669", "text": "func (r *InfoActionRunner) Run() {\n\tr.run()\n}", "title": "" }, { "docid": "e763a94dbb55a153efccd5531d4ec556", "score": "0.6279975", "text": "func (opts *agentCommand) run() error {\n\topts.configureLogger()\n\n\tif opts.iptables {\n\t\tlog.Infof(\"configuring iptables\")\n\t\trules := newIPTablesRules(opts.hostIP, opts.ListenPort, opts.hostInterface)\n\t\terr := rules.Add()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"error configuring iptables: %s\", err.Error())\n\t\t\treturn err\n\t\t}\n\t\tif opts.iptablesRemove {\n\t\t\tdefer func() {\n\t\t\t\tlog.Infof(\"undoing iptables changes\")\n\t\t\t\trules.Remove()\n\t\t\t}()\n\t\t}\n\t}\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\tgo opts.telemetryOptions.start(ctx, \"agent\")\n\n\tstopChan := make(chan os.Signal, 8)\n\tsignal.Notify(stopChan, os.Interrupt, syscall.SIGTERM)\n\n\tctxGateway, cancelCtxGateway := context.WithTimeout(context.Background(), opts.timeoutKiamGateway)\n\tdefer cancelCtxGateway()\n\n\tb := kiamserver.NewKiamGatewayBuilder().WithAddress(opts.serverAddress).WithKeepAlive(opts.keepaliveParams)\n\t_, err := b.WithTLS(opts.certificatePath, opts.keyPath, opts.caPath)\n\tif err != nil {\n\t\tlog.Errorf(\"error configuring TLS: %s\", err.Error())\n\t\treturn err\n\t}\n\n\tgateway, err := b.Build(ctxGateway)\n\tif err != nil {\n\t\tlog.Errorf(\"error creating server gateway: %s\", err.Error())\n\t\treturn err\n\t}\n\tdefer gateway.Close()\n\n\tserver, err := http.NewWebServer(opts.ServerOptions, gateway)\n\tif err != nil {\n\t\tlog.Errorf(\"error creating agent http server: %s\", err.Error())\n\t\treturn err\n\t}\n\n\terrCh := make(chan error, 1)\n\tgo func() {\n\t\terrCh <- server.Serve()\n\t}()\n\n\tselect {\n\tcase err := <-errCh:\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"error running server: %s\", err.Error())\n\t\t\treturn err\n\t\t}\n\tcase sig := <-stopChan:\n\t\tlog.Infof(\"received signal (%s): starting server shutdown\", sig.String())\n\t\tif err := server.Stop(ctx); err != nil {\n\t\t\tlog.Errorf(\"error shutting down server: %s\", err.Error())\n\t\t\treturn err\n\t\t}\n\t\tlog.Infoln(\"gracefully shutdown server\")\n\t}\n\tlog.Infoln(\"stopped\")\n\treturn nil\n}", "title": "" }, { "docid": "924bba96b6c19335e5e3058b41076e12", "score": "0.62760836", "text": "func (c *CLI) Run(args []string) error {\n\treturn c.app.Run(args)\n}", "title": "" }, { "docid": "01baaf85b734b17c7d93ee5c68b0a1b0", "score": "0.6269453", "text": "func (s *Service) Run(account string) error {\n\tresponse, err := s.fetcher.Fetch(account)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = s.farwarder.Farward(response)\n\treturn err\n}", "title": "" }, { "docid": "f0c14e83557f8d71e04687c0b0b63fb1", "score": "0.62613535", "text": "func (m *Martini) Run() {\n\tport := os.Getenv(\"PORT\")\n\tif len(port) == 0 {\n\t\tport = \"3000\"\n\t}\n\n\thost := os.Getenv(\"HOST\")\n\n\tm.RunOnAddr(host + \":\" + port)\n}", "title": "" }, { "docid": "0bef9467635cc665ebe73cdff2cdd77c", "score": "0.62604994", "text": "func (d *Driver) Run() {\n\ts := cmicommon.NewNonBlockingGRPCServer()\n\ts.Start(d.endpoint,\n\t\tnil,\n\t\tNewMachineServer(d))\n\ts.Wait()\n}", "title": "" }, { "docid": "9abbf90ec4e4c4ba0fb0f83492a5795f", "score": "0.6256383", "text": "func Run() {\n\tvar port = flag.String(\"port\", \"8085\", \"The address the server communicates.\")\n\tflag.Parse()\n\n\t// load app defaults\n\tload()\n\t// replace the specifier with the correct addr\n\ttcpAddress := fmt.Sprintf(\"%s:%s\", config.GetInstance().Server.Host, *port)\n\tserverAddr := fmt.Sprintf(\"http://%s\", tcpAddress)\n\t// setup app\n\tsetup(serverAddr)\n\t// create a new room\n\troom := app.NewRoom()\n\t// assign new Trace object to room\n\troom.Tracer = trace.New(os.Stdout)\n\t// Register URL paths\n\tregisterHandlers(room)\n\t// run room inside a Go routine\n\tgo room.Run()\n\t// start the web server\n\tstartServer(tcpAddress)\n}", "title": "" }, { "docid": "246ae2e2be039f9836ddf275a2ae15e3", "score": "0.6253429", "text": "func main() {\n\tif err := run(os.Args[1:]); err != nil {\n\t\tlog.Fatalf(\"!! %+v\", err)\n\t}\n}", "title": "" }, { "docid": "56eeb916128011453c8b0832726fa4ef", "score": "0.6251386", "text": "func main() {\n\n\tswitch os.Args[1] {\n\n\tcase \"run\":\n\n\t\trun()\n\n\t\tdefault:\n\n\t\t\tpanic(\"bad command\")\n\n\t\t}\n\n\t}", "title": "" }, { "docid": "6130cdc69dbeeeee36e03f7e571f6f68", "score": "0.6249864", "text": "func (h *Handler) Run() {\n\tlog.Printf(\"Listening on :%s\\n\", h.server.Addr)\n\tif err := h.server.ListenAndServe(); err != nil {\n\t\tlog.Println(err)\n\t}\n}", "title": "" }, { "docid": "414e0897f98e59a80d100a64ed382bc8", "score": "0.6236678", "text": "func Run() {\n\tif err := utils.InitEnvironmentSettings(); err != nil {\n\t\tlog.Fatalf(\"cannot init settings\", err)\n\t}\n\n\thttp_server.RunServer()\n}", "title": "" }, { "docid": "48234ec0e7e6fa3166c2397dc63fc02f", "score": "0.6231197", "text": "func main() {\n\tstartTime = time.Now()\n\t// Handle the env vars before calling into Run().\n\t// That way, if debug is on, we will get the start message for Run().\n\terr := HandleEnvVars()\n\tif err == nil {\n\t\terr = Run()\n\t}\n\tif err != nil {\n\t\t// Not using Stderr(...) here because I don't want the time and function prefix on this.\n\t\tfmt.Fprintf(os.Stderr, \"error: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "a3daef691d12291693b04b6e03579b5d", "score": "0.62242717", "text": "func Run() (err error) {\n\n\t// Start Garbage Collector\n\tif pfmCtrl.garbageCollector != nil {\n\t\terr = pfmCtrl.garbageCollector.Start()\n\t\tif err != nil {\n\t\t\tlog.Error(\"Failed to start Garbage Collector with error: \", err.Error())\n\t\t\treturn err\n\t\t}\n\t\tlog.Info(\"Garbage Collector started\")\n\t}\n\n\t// Start Swagger API Manager (provider & aggregator)\n\terr = pfmCtrl.apiMgr.Start(true, true)\n\tif err != nil {\n\t\tlog.Error(\"Failed to start Swagger API Manager with error: \", err.Error())\n\t\treturn err\n\t}\n\tlog.Info(\"Swagger API Manager started\")\n\n\tlog.Info(\"Platform Controller started\")\n\treturn nil\n}", "title": "" }, { "docid": "be773469b315c6a88ac7cf54c3f97800", "score": "0.6223422", "text": "func Run() {\n\tRunWithController(DefaultController)\n}", "title": "" }, { "docid": "310cfea497a38cb9ffeded6c890db3a5", "score": "0.62212664", "text": "func (a *App) Run(writer io.Writer) error {\n\tlog.SetOutput(writer)\n\n\ta.instance = tview.NewApplication()\n\n\tcfg, err := external.LoadDefaultAWSConfig()\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\"err\": err.Error()}).Fatal(\"unable to load SDK config\")\n\t}\n\n\ta.config = cfg\n\n\ta.ecs()\n\n\tif err := a.instance.Run(); err != nil {\n\t\tlog.Fatalf(\"Error running application: %s\\n\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8378d46a99fbe830b7222d749ef7cd41", "score": "0.6219645", "text": "func (s *Server) Run() error {\n\tif err := s.init(); err != nil {\n\t\t// errors are propagated upstream as panic.\n\t\treturn err\n\t}\n\tlog.Info(\"DataNode gRPC services successfully initialized\")\n\tif err := s.start(); err != nil {\n\t\t// errors are propagated upstream as panic.\n\t\treturn err\n\t}\n\tlog.Info(\"DataNode gRPC services successfully started\")\n\treturn nil\n}", "title": "" }, { "docid": "bcfe447a8889e52a6ae911a4b612de6a", "score": "0.6217971", "text": "func (s *Service) Run() error {\n\tvErr := s.Configuration.Validate()\n\tif vErr != nil {\n\t\tlog.Fatal().Str(\"err\", vErr.DebugReport()).Msg(\"invalid configuration\")\n\t}\n\ts.Configuration.Print()\n\n\tauthConfig, authErr := s.Configuration.LoadAuthConfig()\n\tif authErr != nil {\n\t\tlog.Fatal().Str(\"err\", authErr.DebugReport()).Msg(\"cannot load authx config\")\n\t}\n\n\tlog.Info().Bool(\"AllowsAll\", authConfig.AllowsAll).Int(\"permissions\", len(authConfig.Permissions)).Msg(\"Auth config\")\n\n\tgo s.LaunchGRPC(authConfig)\n\treturn s.LaunchHTTP()\n\n}", "title": "" }, { "docid": "037788b56c135f35cc96d53c59a6e0c6", "score": "0.6217051", "text": "func Run(options *options.App) error {\n\tmainApp := application.NewWithOptions(options)\n\treturn mainApp.Run()\n}", "title": "" }, { "docid": "c603a78d70e6e3ea44d6cb50c70d5bb5", "score": "0.62163997", "text": "func Run(ctx context.Context, port string) error {\n\tr := chi.NewRouter()\n\n\t// Middleware\n\tr.Use(middleware.RequestID)\n\tr.Use(middleware.Logger)\n\tr.Use(middleware.Recoverer)\n\n\t// Initialize services\n\ts := service.New(ctx, time.Now)\n\n\t// Initialize routes\n\tr.Get(\"/\", controller.HandleGetBlockchain(s))\n\tr.Post(\"/\", controller.HandleWriteBlock(s))\n\n\t// Launch http server\n\tlog.Printf(\"Server listening on port: '%s'\", port)\n\terr := http.ListenAndServe(\":\"+port, r)\n\tif err != nil {\n\t\tlog.Printf(\"Cannot launch http server: '%v'\", err)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "3a6f316ebf0180661ddd8c38ff35c4a0", "score": "0.6216367", "text": "func (c *Coordinator) Run(ctx context.Context) error {\n\t// create a new PubSub service using the GossipSub router\n\tps, err := pubsub.NewGossipSub(ctx, c.host)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"create pubsub service: %w\", err)\n\t}\n\n\tg, ctx := errgroup.WithContext(ctx)\n\n\tg.Go(func() error {\n\t\treturn c.pubsubBlocks(ctx, ps)\n\t})\n\n\tg.Go(func() error {\n\t\treturn c.hello(ctx)\n\t})\n\n\treturn g.Wait()\n}", "title": "" }, { "docid": "f6f1a684de1d4da738d03db8a44db5ce", "score": "0.6212778", "text": "func (s *Server) Run() {\n\ts.bot.Run()\n}", "title": "" }, { "docid": "bcc82738525082a07f471c6e2f9d84c8", "score": "0.620265", "text": "func (gl GinLexa) Run() {\n\tgl.app.Run(gl.cfg.ServerPort)\n}", "title": "" }, { "docid": "f390fdda6952f1f89195730c5b8f3822", "score": "0.62002397", "text": "func Run() error {\n\treturn application.Run()\n}", "title": "" }, { "docid": "010ff176c8305b7b353a661be8dc3a4f", "score": "0.61989766", "text": "func Run() (err error) {\n\n\t// Start Swagger API Manager (provider)\n\terr = sbi.apiMgr.Start(true, false)\n\tif err != nil {\n\t\tlog.Error(\"Failed to start Swagger API Manager with error: \", err.Error())\n\t\treturn err\n\t}\n\tlog.Info(\"Swagger API Manager started\")\n\n\t// Add module Swagger APIs\n\terr = sbi.apiMgr.AddApis()\n\tif err != nil {\n\t\tlog.Error(\"Failed to add Swagger APIs with error: \", err.Error())\n\t\treturn err\n\t}\n\tlog.Info(\"Swagger APIs successfully added\")\n\n\t// Register Message Queue handler\n\thandler := mq.MsgHandler{Handler: msgHandler, UserData: nil}\n\tsbi.handlerId, err = sbi.mqLocal.RegisterHandler(handler)\n\tif err != nil {\n\t\tlog.Error(\"Failed to register local Msg Queue listener: \", err.Error())\n\t\treturn err\n\t}\n\tlog.Info(\"Registered local Msg Queue listener\")\n\n\treturn nil\n}", "title": "" }, { "docid": "44d50bdc3ce412dc4d7b896cd9cf7848", "score": "0.6198522", "text": "func (cli *CLI) Run() {\n\tcli.validateArgs()\n\n\tnodeID := os.Getenv(\"NODE_ID\")\n\tif nodeID == \"\" {\n\t\tfmt.Printf(\"NODE_ID env. var is not set!\")\n\t\tos.Exit(1)\n\t}\n\n\tcreateDataCmd := flag.NewFlagSet(\"createdata\", flag.ExitOnError)\n\taddDataCmd := flag.NewFlagSet(\"adddata\", flag.ExitOnError)\n printDataCmd := flag.NewFlagSet(\"printdata\", flag.ExitOnError)\n\tstartNodeCmd := flag.NewFlagSet(\"startnode\", flag.ExitOnError)\n\n\tgetDataToCreate := createDataCmd.String(\"data\", \"\", \"The data to create the initial data set\")\n\tgetDataToAdd := addDataCmd.String(\"data\", \"\", \"The data to add to the data set\")\n\n\tswitch os.Args[1] {\n\tcase \"createdata\":\n\t\terr := createDataCmd.Parse(os.Args[2:])\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\tcase \"adddata\":\n\t\terr := addDataCmd.Parse(os.Args[2:])\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n case \"printdata\":\n\t\terr := printDataCmd.Parse(os.Args[2:])\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\tcase \"startnode\":\n\t\terr := startNodeCmd.Parse(os.Args[2:])\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\tdefault:\n\t\tcli.printUsage()\n\t\tos.Exit(1)\n\t}\n\n\tif createDataCmd.Parsed() {\n\t\tif *getDataToCreate == \"\" {\n\t\t\tcreateDataCmd.Usage()\n\t\t\tos.Exit(1)\n\t\t}\n\t\tcli.createData(*getDataToCreate, nodeID)\n\t}\n\n\tif addDataCmd.Parsed() {\n\t\tif *getDataToAdd == \"\" {\n\t\t\taddDataCmd.Usage()\n\t\t\tos.Exit(1)\n\t\t}\n\t\tcli.addData(*getDataToAdd, nodeID)\n\t}\n\n if printDataCmd.Parsed() {\n\t\tcli.printData(nodeID)\n\t}\n\n\tif startNodeCmd.Parsed() {\n\t\tcli.startNode(nodeID)\n\t}\n}", "title": "" }, { "docid": "8c7c8d4b6217e578390ea467613f8fcc", "score": "0.61886024", "text": "func (extract *CFSMExtract) Run() {\n\tstartTime := time.Now()\n\tmainPkg := ssabuilder.MainPkg(extract.SSA.Prog)\n\tif mainPkg == nil {\n\t\tfmt.Fprintf(os.Stderr, \"Error: 'main' package not found\\n\")\n\t\tos.Exit(1)\n\t}\n\tinit := mainPkg.Func(\"init\")\n\tmain := mainPkg.Func(\"main\")\n\tfr := makeToplevelFrame(extract)\n\tfor _, pkg := range extract.SSA.Prog.AllPackages() {\n\t\tfor _, memb := range pkg.Members {\n\t\t\tswitch val := memb.(type) {\n\t\t\tcase *ssa.Global:\n\t\t\t\tswitch derefAll(val.Type()).(type) {\n\t\t\t\tcase *types.Array:\n\t\t\t\t\tvd := utils.NewDef(val)\n\t\t\t\t\tfr.env.globals[val] = vd\n\t\t\t\t\tfr.env.arrays[vd] = make(Elems)\n\n\t\t\t\tcase *types.Struct:\n\t\t\t\t\tvd := utils.NewDef(val)\n\t\t\t\t\tfr.env.globals[val] = vd\n\t\t\t\t\tfr.env.structs[vd] = make(Fields)\n\n\t\t\t\tcase *types.Chan:\n\t\t\t\t\tvar c *types.Chan\n\t\t\t\t\tvd := utils.NewDef(utils.EmptyValue{T: c})\n\t\t\t\t\tfr.env.globals[val] = vd\n\n\t\t\t\tdefault:\n\t\t\t\t\tfr.env.globals[val] = utils.NewDef(val)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfmt.Fprintf(os.Stderr, \"++ call.toplevel %s()\\n\", orange(\"init\"))\n\tvisitFunc(init, fr)\n\tif main == nil {\n\t\tfmt.Fprintf(os.Stderr, \"Error: 'main()' function not found in 'main' package\\n\")\n\t\tos.Exit(1)\n\t}\n\tfmt.Fprintf(os.Stderr, \"++ call.toplevel %s()\\n\", orange(\"main\"))\n\tvisitFunc(main, fr)\n\n\tfr.env.session.Types[fr.gortn.role] = fr.gortn.root\n\n\tvar goFrm *frame\n\tfor len(extract.goQueue) > 0 {\n\t\tgoFrm, extract.goQueue = extract.goQueue[0], extract.goQueue[1:]\n\t\tfmt.Fprintf(os.Stderr, \"\\n%s\\nLOCATION: %s%s\\n\", goFrm.fn.Name(), goFrm.gortn.role.Name(), loc(goFrm, goFrm.fn.Pos()))\n\t\tvisitFunc(goFrm.fn, goFrm)\n\t\tgoFrm.env.session.Types[goFrm.gortn.role] = goFrm.gortn.root\n\t}\n\n\textract.Time = time.Since(startTime)\n\textract.Done <- struct{}{}\n}", "title": "" }, { "docid": "3caa5d7ab6c9c557def247af42009084", "score": "0.61882406", "text": "func (gr *Graph) Run() {\n\tgo RunMarbles()\n}", "title": "" }, { "docid": "77763faeebe7cf61a08491f894a320e7", "score": "0.61861444", "text": "func (_e *Module_Expecter) Run(ctx interface{}) *Module_Run_Call {\n\treturn &Module_Run_Call{Call: _e.mock.On(\"Run\", ctx)}\n}", "title": "" }, { "docid": "21eac972a880898c2636809186236873", "score": "0.6185039", "text": "func (s *Server) Run() {\n\ts.routerHandler()\n\n\ts.initialiseConsumer()\n\terr := http.ListenAndServe(\":8080\", s.router)\n\tif err != nil {\n\t\tlog.Fatalf(\"Processor starting failed. error %v\", err)\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "095aab6d0b953eb6caba8ba967e18dd6", "score": "0.6174225", "text": "func Run() int {\n\tclientset, err := initKubeClient()\n\tif err != nil {\n\t\tlog.Error(err.Error())\n\t\treturn config.EXITKUBEINIT\n\t}\n\n\tstop := make(chan struct{})\n\n\tregisterPodWatcher(clientset, stop)\n\tregisterServiceWatcher(clientset, stop)\n\t//\tregisterNodeWatcher(clientset, stop)\n\n\t<-stop\n\n\treturn config.EXITNORMAL\n}", "title": "" }, { "docid": "95113e58d9e83b093cf4733bb685547d", "score": "0.6173409", "text": "func (service *Common) Run(_ context.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "84ad3f3a4843f7e0edf21d0c67c199c8", "score": "0.6173356", "text": "func Run(name, url string) {\n\t// create notifier\n\tnotifier := stdout.NewNotifier(os.Stdout)\n\n\t// create checker\n\tchecker := web.Checker{\n\t\tClient: http.DefaultClient,\n\t\tNotifier: notifier,\n\t}\n\n\ttarget := internal.Target{\n\t\tName: name,\n\t\tURL: url,\n\t}\n\n\terr := checker.DoCheck(target)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "e6bed485f64d0dd7d81d90f3407e2ad1", "score": "0.61720663", "text": "func (c *Collector) Run() {\n\tvar err error\n\n\tdefer func() {\n\t\tc.cfg.ReturnChan <- struct{}{}\n\t}()\n\n\tif err = c.setup(); err != nil {\n\t\tlog.Crit(\"[collector] Setup failed\", \"err\", err)\n\t\treturn\n\t}\n\n\tgo c.exitFunction()\n\n\tif c.measurements.Latency {\n\t\tif err := c.measureLatency(); err != nil {\n\t\t\tlog.Trace(\"Measuring latency\", \"err\", err)\n\t\t}\n\t}\n\n\tif c.measurements.PathSwitching {\n\t\tc.wg.Add(1)\n\t\tgo c.measurePathSwitching()\n\t} else {\n\t\tc.cfg.SetupChan <- struct{}{}\n\t}\n\n\tif c.measurements.Bandwidth {\n\t\tc.wg.Add(1)\n\t\tgo c.measureBandwidth()\n\t}\n\n\tif c.measurements.Paths {\n\t\tc.wg.Add(1)\n\t\tgo c.getPaths()\n\t}\n\n\tif c.measurements.ResourceUsage {\n\t\tc.wg.Add(1)\n\t\tgo c.measureResourceUsage()\n\t}\n\n\tc.wg.Wait()\n\n\tlog.Debug(\"Running aggregator...\")\n\t// Run the aggregator\n\tAnalyzeResults(c.cfg.LogsPath)\n}", "title": "" }, { "docid": "94319a80b5034efc6c6b84e05372cc2c", "score": "0.6169218", "text": "func main() {\n\tflag.Parse()\n\tmanager.NewFHCManager(runCase).WaitEnd()\n}", "title": "" }, { "docid": "d0125f09953ce221753e0899c9f67c41", "score": "0.6169134", "text": "func Run(localHost string, port int, downloadRoot, uploadRoot string) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\thandler := createHandler(hub.New(localHost, &upload.Uploader{Root: uploadRoot}), downloadRoot, cancel)\n\n\tif err := startServer(ctx, port, handler); err != nil {\n\t\tlog.Print(err)\n\t}\n}", "title": "" } ]
4c7adfdc25a78ee808eae2ae3e8c61dd
Draw is a function that will draw the border
[ { "docid": "c895c4aa70573d758ba3f5f719f93a7c", "score": "0.0", "text": "func (fm *FieldMap) Draw(screen *tl.Screen) {\n\tfor v := range fm.fm {\n\t\tscreen.RenderCell(v.x, v.y, &tl.Cell{\n\t\t\tBg: tl.ColorBlack,\n\t\t})\n\t}\n}", "title": "" } ]
[ { "docid": "09cef06ac484c374a7691c6f838aab80", "score": "0.76834923", "text": "func (w *PdfWriter) drawBorder() {\n\tlineTo := func(x, y Unit) {\n\t\tw.doc.LineTo(float64(x/Mm), float64(y/Mm))\n\t}\n\n\tw.doc.SetLineWidth(float64(w.BorderWidth / Mm))\n\n\tw.doc.MoveTo(float64((w.current.X+Mm)/Mm), float64((w.current.Y+Mm)/Mm))\n\tlineTo(w.current.X+Mm, w.current.Y+cardHeight-Mm)\n\tlineTo(w.current.X+cardWidth-Mm, w.current.Y+cardHeight-Mm)\n\tlineTo(w.current.X+cardWidth-Mm, w.current.Y+Mm)\n\tlineTo(w.current.X+Mm-w.BorderWidth/2, w.current.Y+Mm)\n\n\tw.doc.ClosePath()\n\tw.doc.DrawPath(\"D\")\n}", "title": "" }, { "docid": "413595b6e114f2a029cda19addd62acd", "score": "0.7393965", "text": "func (border *Border) Draw(screen *tl.Screen) {\n\tfor v := range border.bCoords {\n\t\tscreen.RenderCell(v.X, v.Y, &tl.Cell{\n\t\t\tFg: tl.ColorBlue,\n\t\t\tCh: '▓',\n\t\t})\n\t}\n}", "title": "" }, { "docid": "e41f3c651f5eefec7412cce67e4aadea", "score": "0.7322048", "text": "func (g *Grid) DrawBorder() {\n\tcanvasWidth := float64(g.cellSize * g.cols)\n\tcanvasHeight := float64(g.cellSize * g.rows)\n\n\tg.ctx.Push()\n\tg.ctx.MoveTo(0, 0)\n\tg.ctx.LineTo(0, canvasHeight)\n\tg.ctx.LineTo(canvasWidth, canvasHeight)\n\tg.ctx.LineTo(canvasWidth, 0)\n\tg.ctx.LineTo(0, 0)\n\n\tif g.borderDashes > 0 {\n\t\tg.ctx.SetDash(g.borderDashes)\n\t} else {\n\t\tg.ctx.SetDash()\n\t}\n\n\tg.ctx.SetLineWidth(g.borderStrokeWidth)\n\tg.ctx.SetHexColor(g.borderColor)\n\tg.ctx.Stroke()\n\tg.ctx.Pop()\n}", "title": "" }, { "docid": "b2546128f3b499c722878e12d0ed56fa", "score": "0.69631535", "text": "func drawBorders(v *gocui.View) error {\n\tdrawBlock(point{x: 0, y: 0}, point{x: vMaxX - 1, y: 0}, v)\n\tdrawBlock(point{x: 0, y: vMaxY - 1}, point{x: vMaxX - 1, y: vMaxY - 1}, v)\n\n\treturn nil\n}", "title": "" }, { "docid": "1b9c0103628db1852f9488bb8b817631", "score": "0.68145454", "text": "func (png *PNG) Border(x, y, w, h int) {\n\tc := \"border\"\n\tpng.Line(c, x, y, x+w, y)\n\tpng.Line(c, x+w, y, x+w, y+h)\n\tpng.Line(c, x+w, y+h, x, y+h)\n\tpng.Line(c, x, y+h, x, y)\n}", "title": "" }, { "docid": "eb8cdb01ec2df0aa301bf179e4a2acca", "score": "0.6274266", "text": "func Draw() {\n\tb.Draw()\n}", "title": "" }, { "docid": "6753c461cdc54e340aaa77d17386b035", "score": "0.62472063", "text": "func (ui *UI) DrawBorders() {\n\tx, y := 1, 1\n\tw, h := termbox.Size()\n\tc := ' '\n\tfg := termbox.ColorDefault\n\tbg := termbox.Attribute(0xf7)\n\t// draw top and bottom borders\n\tfor i := x; i < w-x; i++ {\n\t\ttermbox.SetCell(i, y, c, fg, bg)\n\t\ttermbox.SetCell(i, h-y, c, fg, bg)\n\t}\n\t// draw left and right borders\n\tfor j := y; j < h-y; j++ {\n\t\ttermbox.SetCell(x, j, c, fg, bg)\n\t\ttermbox.SetCell(x+1, j, c, fg, bg)\n\t\ttermbox.SetCell(w-x-2, j, c, fg, bg)\n\t\ttermbox.SetCell(w-x-1, j, c, fg, bg)\n\t}\n}", "title": "" }, { "docid": "4256739ea15cb548387f55da8ac9c7f4", "score": "0.61401254", "text": "func newBorder(x, y, width, height float64) *border {\n\tborder := &border{}\n\n\tborder.x = x\n\tborder.y = y\n\tborder.width = width\n\tborder.height = height\n\n\tborder.borderColorTop = model.NewPdfColorDeviceRGB(0, 0, 0)\n\tborder.borderColorBottom = model.NewPdfColorDeviceRGB(0, 0, 0)\n\tborder.borderColorLeft = model.NewPdfColorDeviceRGB(0, 0, 0)\n\tborder.borderColorRight = model.NewPdfColorDeviceRGB(0, 0, 0)\n\n\tborder.borderWidthTop = 0\n\tborder.borderWidthBottom = 0\n\tborder.borderWidthLeft = 0\n\tborder.borderWidthRight = 0\n\n\tborder.LineStyle = draw.LineStyleSolid\n\treturn border\n}", "title": "" }, { "docid": "27cde774b6afcbb8f676a0721f8c339e", "score": "0.6120992", "text": "func Draw(root Widget) {\n\ttermbox.Clear(termbox.ColorDefault, termbox.ColorDefault)\n\tdefer termbox.Flush()\n\tif root == nil {\n\t\treturn\n\t}\n\tp := &Pen{fg: termbox.ColorDefault, bg: termbox.ColorDefault}\n\tp.w, p.h = termbox.Size()\n\troot.Draw(p)\n}", "title": "" }, { "docid": "8a24a12162aca2b90c3d7bfac1c0a34c", "score": "0.6058513", "text": "func (p *Private) Draw(r *mondrian.Region) {\n\tdrawTime(r, p.ToA)\n\tr.Xbase = r.Cx\n\tr.LPrintf(\"<%s> \", p.Nick)\n\tr.Printf(\"%s\", p.Content)\n}", "title": "" }, { "docid": "f289f6fc10058b9fe7a9891e1c1a57f9", "score": "0.60438097", "text": "func (rdr *Renderer) renderTopBottomBorder(width int) {\n\t// NOTE: Didn't use (width + 2) to prevent potential overflow\n\tfmt.Fprint(rdr.writer, \"-\")\n\tfor i := 0; i < width; i++ {\n\t\tfmt.Fprint(rdr.writer, \"-\")\n\t}\n\tfmt.Fprintln(rdr.writer, \"-\")\n}", "title": "" }, { "docid": "32e70493a88c2e2e41716063dc73cd17", "score": "0.59572583", "text": "func (n *notice) Draw(r *mondrian.Region) {\n\tdrawTime(r, n.ToA)\n\tr.Xbase = r.Cx\n\tr.Attr(termbox.AttrBold, termbox.ColorDefault)\n\tr.Print(n.Text)\n\tr.AttrDefault()\n}", "title": "" }, { "docid": "d1d6203b1ad023e34e86fa35e2f704a9", "score": "0.5947267", "text": "func (eb *EditBox) Draw(x, y, w, h int) {\n\teb.AdjustVOffset(w)\n\n\tconst coldef = termbox.ColorDefault\n\tconst colred = termbox.ColorRed\n\n\tfill(x, y, w, h, termbox.Cell{Ch: ' '})\n\n\tt := eb.text\n\tlx := 0\n\ttabstop := 0\n\tfor {\n\t\trx := lx - eb.lineVoffset\n\t\tif len(t) == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tif lx == tabstop {\n\t\t\ttabstop += tabstopLength\n\t\t}\n\n\t\tif rx >= w {\n\t\t\ttermbox.SetCell(x+w-1, y, arrowRight,\n\t\t\t\tcolred, coldef)\n\t\t\tbreak\n\t\t}\n\n\t\tr, size := utf8.DecodeRune(t)\n\t\tif r == '\\t' {\n\t\t\tfor ; lx < tabstop; lx++ {\n\t\t\t\trx = lx - eb.lineVoffset\n\t\t\t\tif rx >= w {\n\t\t\t\t\tgoto next\n\t\t\t\t}\n\n\t\t\t\tif rx >= 0 {\n\t\t\t\t\ttermbox.SetCell(x+rx, y, ' ', coldef, coldef)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif rx >= 0 {\n\t\t\t\ttermbox.SetCell(x+rx, y, r, coldef, coldef)\n\t\t\t}\n\t\t\tlx += runewidth.RuneWidth(r)\n\t\t}\n\tnext:\n\t\tt = t[size:]\n\t}\n\n\tif eb.lineVoffset != 0 {\n\t\ttermbox.SetCell(x, y, arrowLeft, colred, coldef)\n\t}\n}", "title": "" }, { "docid": "c4a71021c54463bb82e1b59e80c9726d", "score": "0.5923148", "text": "func (w *Window) BorderBottom() int { return w.borderBottom }", "title": "" }, { "docid": "670855c32a0bb786a6acb84f910b2bc5", "score": "0.5913728", "text": "func (e *AppElement) DrawBox() {\n\ta := e.microapp\n\tf := e.frame\n\tHborder := tcell.RuneHLine\n\tVborder := tcell.RuneVLine\n\tULC := tcell.RuneULCorner\n\tURC := tcell.RuneURCorner\n\tLLC := tcell.RuneLLCorner\n\tLRC := tcell.RuneLRCorner\n\tif !e.checked {\n\t\tHborder = ' '\n\t\tVborder = ' '\n\t\tULC = ' '\n\t\tURC = ' '\n\t\tLLC = ' '\n\t\tLRC = ' '\n\t}\n\tx1 := e.pos.X + f.left\n\ty1 := e.pos.Y + f.top\n\tx2 := e.pos.X + f.left + e.width\n\ty2 := e.pos.Y + f.top + e.height\n\tif y2 < y1 {\n\t\ty1, y2 = y2, y1\n\t}\n\tif x2 < x1 {\n\t\tx1, x2 = x2, x1\n\t}\n\n\tfor col := x1; col <= x2; col++ {\n\t\ta.screen.SetContent(col, y1, Hborder, nil, e.style)\n\t\ta.screen.SetContent(col, y2, Hborder, nil, e.style)\n\t}\n\tfor row := y1 + 1; row < y2; row++ {\n\t\ta.screen.SetContent(x1, row, Vborder, nil, e.style)\n\t\ta.screen.SetContent(x2, row, Vborder, nil, e.style)\n\t}\n\tif y1 != y2 && x1 != x2 {\n\t\t// Only add corners if we need to\n\t\ta.screen.SetContent(x1, y1, ULC, nil, e.style)\n\t\ta.screen.SetContent(x2, y1, URC, nil, e.style)\n\t\ta.screen.SetContent(x1, y2, LLC, nil, e.style)\n\t\ta.screen.SetContent(x2, y2, LRC, nil, e.style)\n\t}\n\tfor row := y1 + 1; row < y2; row++ {\n\t\tfor col := x1 + 1; col < x2; col++ {\n\t\t\ta.screen.SetContent(col, row, ' ', nil, e.style)\n\t\t}\n\t}\n\tif e.label != \"\" {\n\t\te.frame.PrintStyle(e.label, e.pos.X+1, e.pos.Y, &e.style)\n\t}\n}", "title": "" }, { "docid": "4828aad091010e54c20e61a5f000ba21", "score": "0.5904835", "text": "func (t *Table) Draw(p *Painter) {\n\ts := t.Size()\n\n\tif t.hasBorder {\n\t\tborder := 1\n\n\t\t// Draw outmost border.\n\t\tp.DrawRect(0, 0, s.X, s.Y)\n\n\t\t// Draw column dividers.\n\t\tvar coloff int\n\t\tfor i := 0; i < t.cols-1; i++ {\n\t\t\tx := t.colWidths[i] + coloff + border\n\t\t\tp.DrawVerticalLine(x, 0, s.Y-1)\n\t\t\tp.DrawRune(x, 0, '┬')\n\t\t\tp.DrawRune(x, s.Y-1, '┴')\n\t\t\tcoloff = x\n\t\t}\n\n\t\t// Draw row dividers.\n\t\tvar rowoff int\n\t\tfor j := 0; j < t.rows-1; j++ {\n\t\t\ty := t.rowHeights[j] + rowoff + border\n\t\t\tp.DrawHorizontalLine(0, s.X-1, y)\n\t\t\tp.DrawRune(0, y, '├')\n\t\t\tp.DrawRune(s.X-1, y, '┤')\n\t\t\trowoff = y\n\t\t}\n\n\t\t// Polish the intersections.\n\t\trowoff = 0\n\t\tfor j := 0; j < t.rows-1; j++ {\n\t\t\ty := t.rowHeights[j] + rowoff + border\n\t\t\tcoloff = 0\n\t\t\tfor i := 0; i < t.cols-1; i++ {\n\t\t\t\tx := t.colWidths[i] + coloff + border\n\t\t\t\tp.DrawRune(x, y, '┼')\n\t\t\t\tcoloff = x\n\t\t\t}\n\t\t\trowoff = y\n\t\t}\n\t}\n\n\t// Draw cell content.\n\tfor i := 0; i < t.cols; i++ {\n\t\tfor j := 0; j < t.rows; j++ {\n\t\t\tstyle := \"table.cell\"\n\t\t\tif j == t.selected {\n\t\t\t\tstyle += \".selected\"\n\t\t\t}\n\n\t\t\tp.WithStyle(style, func(p *Painter) {\n\t\t\t\tpos := image.Point{i, j}\n\t\t\t\twp := t.mapCellToLocal(pos)\n\n\t\t\t\tp.Translate(wp.X, wp.Y)\n\t\t\t\tdefer p.Restore()\n\n\t\t\t\tif w, ok := t.cells[pos]; ok {\n\t\t\t\t\tsize := w.Size()\n\t\t\t\t\tsize.X = t.colWidths[i]\n\n\t\t\t\t\tp.FillRect(0, 0, size.X, size.Y)\n\n\t\t\t\t\tp.WithMask(image.Rectangle{\n\t\t\t\t\t\tMin: image.ZP,\n\t\t\t\t\t\tMax: size,\n\t\t\t\t\t}, func(p *Painter) {\n\t\t\t\t\t\tw.Draw(p)\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "39ef8fc1a659e63481cc5a0c777c3035", "score": "0.58883", "text": "func (n *NodeDetailsWidget) Draw(buf *ui.Buffer) {\n\tif n.Visible {\n\t\tn.Paragraph.Draw(buf)\n\t} else {\n\t\trect := n.Paragraph.GetRect()\n\t\temptyCell := ui.NewCell(' ')\n\t\tbuf.Fill(emptyCell, rect)\n\t}\n}", "title": "" }, { "docid": "16dc7e2eebfc00d2e1146dc0ae298f29", "score": "0.5849614", "text": "func drawend(close int32, fill int32) {\n\tif noarch.Not(fill) {\n\t\tfill = 2\n\t} else {\n\t\tfill = fill\n\t}\n\tif l_page != page_n || l_size != o_s || l_wid != pdf_linewid || l_cap != pdf_linecap || l_join != pdf_linejoin {\n\t\tvar lwid int32 = pdf_linewid * o_s\n\t\tsbuf_printf(pg, []byte(\"%d.%03d w\\n\\x00\"), lwid/1000, lwid%1000)\n\t\tsbuf_printf(pg, []byte(\"%d J %d j\\n\\x00\"), pdf_linecap, pdf_linejoin)\n\t\tl_page = page_n\n\t\tl_size = o_s\n\t\tl_wid = pdf_linewid\n\t\tl_cap = pdf_linecap\n\t\tl_join = pdf_linejoin\n\t}\n\tif fill&2 != 0 {\n\t\t// stroking color\n\t\tsbuf_printf(pg, []byte(\"%s RG\\n\\x00\"), pdfcolor(o_m))\n\t}\n\tif fill&1 != 0 {\n\t\tsbuf_printf(pg, func() []byte {\n\t\t\tif fill&2 != 0 {\n\t\t\t\treturn []byte(\"b\\n\\x00\")\n\t\t\t}\n\t\t\treturn []byte(\"f\\n\\x00\")\n\t\t}())\n\t} else {\n\t\tsbuf_printf(pg, func() []byte {\n\t\t\tif close != 0 {\n\t\t\t\treturn []byte(\"s\\n\\x00\")\n\t\t\t}\n\t\t\treturn []byte(\"S\\n\\x00\")\n\t\t}())\n\t}\n\tp_v = 0\n\tp_h = 0\n}", "title": "" }, { "docid": "4433000fdfccb49604f37d60d6ee14c9", "score": "0.58277607", "text": "func (kui *KubeKnarkUI) Draw(errNetChan chan error) {\n\tgo func() {\n\t\tif err := ui.Init(); err != nil {\n\t\t\terrNetChan <- err\n\t\t\treturn\n\t\t}\n\t\tdefer ui.Close()\n\t\t// draw external paragraph\n\t\ttermWidth, termHeight := ui.TerminalDimensions()\n\t\tkui.buildParagraph(termWidth, termHeight)\n\t\t// init event tables\n\t\tkui.buildFileSystemTable(termWidth, termHeight)\n\t\tkui.buildNetTable(termWidth, termHeight)\n\t\t// render to ui\n\t\tui.Render(kui.paragraph, kui.fsTable, kui.netTable)\n\t\t// watch for net , file system events\n\t\tkui.watchEvents(ui.PollEvents())\n\t}()\n}", "title": "" }, { "docid": "e84f4833bf84c856f0e81bcbe6298bc2", "score": "0.58096987", "text": "func (w *Window) BorderStyle() Style { return w.style.Border }", "title": "" }, { "docid": "353b9e071679636291485682cf22f28c", "score": "0.579448", "text": "func (board Board) Draw(width int, reverse bool, highlights []Highlight) image.Image {\n\tgc, dest := initializeDrawing(width)\n\tboard.doDraw(gc, reverse, highlights)\n\tlabel(gc, reverse)\n\treturn dest\n}", "title": "" }, { "docid": "b4f73770a405ae2357aaf5fe5f6c5107", "score": "0.5792723", "text": "func (abc *BoxDrawer) Draw(prims *graphics.Primitives) {\n\tdx := 0.5 * abc.boxWidth\n\tfor _, segment := range abc.boxes.AsSegments() {\n\t\tleft := abc.centreX - dx\n\t\tright := abc.centreX + dx\n\t\ttop := segment.Start\n\t\tbottom := segment.End\n\t\tprims.AddRect(left, top, right, bottom)\n\t}\n}", "title": "" }, { "docid": "fc2f2e9f78ccac56722af589f03edbc3", "score": "0.5785775", "text": "func (s *Simple) Draw(r *mondrian.Region) {\n\tr.LPrintf(\"%s\", s.Text)\n}", "title": "" }, { "docid": "710be6c406241d01c2b092c5b972a675", "score": "0.5783842", "text": "func (j *Join) Draw(r *mondrian.Region) {\n\tdrawTime(r, j.ToA)\n\tr.Xbase = r.Cx\n\tr.Attr(termbox.ColorCyan|termbox.AttrBold, termbox.ColorDefault)\n\tr.Printf(\"%s\", j.Nick)\n\tr.AttrDefault()\n\tr.LPrintf(\" [\")\n\tr.Attr(termbox.ColorCyan, termbox.ColorDefault)\n\tr.Printf(\"%s\", j.Host)\n\tr.AttrDefault()\n\tr.Printf(\"] has joined\")\n\tr.LPrintf(\" \")\n\tr.Attr(termbox.ColorDefault|termbox.AttrBold, termbox.ColorDefault)\n\tr.Printf(\"%s\", j.Channel)\n\tr.AttrDefault()\n}", "title": "" }, { "docid": "92b326f14f81b773e95acd27eae7b029", "score": "0.5775103", "text": "func (b *Board) Draw() {\n\t// Clear the terminal\n\ttm.Clear()\n\ttm.MoveCursor(1, 1)\n\ttm.Println()\n\ttm.Println()\n\ttm.Println()\n\ttm.Println()\n\tfor i := int8(0); i < b.Height; i++ {\n\t\tfor j := int8(0); j < b.Width; j++ {\n\t\t\ttm.Printf(\"|%d\", b.Values[i][j])\n\t\t}\n\t\ttm.Println(\"|\")\n\t}\n\n\ttm.Flush() // Call it every time at the end of rendering\n}", "title": "" }, { "docid": "1ee1ce4b604a14638373331ddc14f232", "score": "0.5754723", "text": "func (textBox *TextBox) DrawOn(page *Page) [2]float32 {\n\treturn textBox.drawTextAndBorders(page)\n}", "title": "" }, { "docid": "a68e86dc234a62e8de800598466b80a7", "score": "0.57510626", "text": "func (p *Panel) Draw(cvs Canvas) {\n\t// Draw background and border\n\tcvs.FillBgBox(\n\t\t0, 0,\n\t\tp.Model.Width().Value(),\n\t\tp.Model.Height().Value(),\n\t\tcurrentPalate.ResolveBg(p.StyleBackground))\n\tif p.Model.Border() != nil {\n\t\tcvs.DrawBorder(\n\t\t\t0, 0,\n\t\t\tp.Model.Width().Value(),\n\t\t\tp.Model.Height().Value(),\n\t\t\tp.Model.Border(),\n\t\t\tcurrentPalate.ResolveFg(p.StyleBorder))\n\t}\n\t// Draw title\n\tif p.Model.Title() != \"\" {\n\t\tcvs.DrawRuneFg(\n\t\t\t2, 0,\n\t\t\t'[',\n\t\t\tcurrentPalate.ResolveFg(p.StyleBorder))\n\n\t\ttitle := \" \" + p.Model.Title() + \" \"\n\t\tcvs.DrawStringFg(\n\t\t\t3, 0,\n\t\t\ttitle,\n\t\t\tcurrentPalate.ResolveFg(p.StyleLabel))\n\t\tcvs.DrawRuneFg(\n\t\t\tRelCoord(len(title)+3), 0,\n\t\t\t']',\n\t\t\tcurrentPalate.ResolveFg(p.StyleBorder))\n\t}\n\n\t// Shrink the canvas if there is a border, so children will be drawn inside the border\n\tif p.Model.Border() != nil {\n\t\tcvs.X++\n\t\tcvs.Y++\n\t\tcvs.W -= 2\n\t\tcvs.H -= 2\n\t}\n\n\t// Draw children\n\tfor _, child := range p.Model.Children().InZorder() {\n\t\tchild.Component.Draw(cvs.ForChild(child.Component.PositionalModel()))\n\t}\n}", "title": "" }, { "docid": "f970bc25413443acfb8952281ac25160", "score": "0.5747572", "text": "func (b Box) Draw(gd gruid.Grid) gruid.Grid {\n\trg := gd.Range()\n\tmax := rg.Size()\n\tif max.X < 2 || max.Y < 2 {\n\t\treturn gd.Slice(gruid.Range{})\n\t}\n\tcgrid := gd.Slice(rg.Shift(1, 0, -1, 0))\n\tcrg := cgrid.Range()\n\tcell := gruid.Cell{Style: b.Style}\n\tcell.Rune = '─'\n\tmax = crg.Size()\n\tline := cgrid.Slice(crg.Line(0))\n\tline.Fill(cell)\n\tif b.Title.Text() != \"\" {\n\t\tb.Title.drawTextLine(line, b.AlignTitle)\n\t}\n\tline = cgrid.Slice(crg.Line(max.Y - 1))\n\tline.Fill(cell)\n\tif b.Footer.Text() != \"\" {\n\t\tb.Footer.drawTextLine(line, b.AlignFooter)\n\t}\n\tmax = rg.Size()\n\tgd.Set(rg.Min, cell.WithRune('┌'))\n\tgd.Set(gruid.Point{X: max.X - 1}, cell.WithRune('┐'))\n\tgd.Set(gruid.Point{Y: max.Y - 1}, cell.WithRune('└'))\n\tgd.Set(rg.Max.Shift(-1, -1), cell.WithRune('┘'))\n\tcell.Rune = '│'\n\tcol := gd.Slice(rg.Shift(0, 1, 0, -1).Column(0))\n\tcol.Fill(cell)\n\tcol = gd.Slice(rg.Shift(0, 1, 0, -1).Column(max.X - 1))\n\tcol.Fill(cell)\n\treturn gd\n}", "title": "" }, { "docid": "b357242b00c488af0e0773b1f535037e", "score": "0.5743161", "text": "func (e *AppElement) Draw() {\n\tif !e.visible {\n\t\treturn\n\t}\n\tif e.form == \"box\" {\n\t\te.DrawBox()\n\t} else if e.form == \"label\" {\n\t\te.DrawLabel()\n\t} else if e.form == \"textbox\" {\n\t\te.DrawTextBox()\n\t} else if e.form == \"radio\" {\n\t\te.DrawRadio()\n\t} else if e.form == \"checkbox\" {\n\t\te.DrawCheckBox()\n\t} else if e.form == \"select\" {\n\t\te.DrawSelect()\n\t} else if e.form == \"textarea\" {\n\t\te.DrawTextArea()\n\t} else if e.form == \"button\" {\n\t\te.DrawButton()\n\t}\n}", "title": "" }, { "docid": "12fbafac054575efdf7927395c455679", "score": "0.5699009", "text": "func (w *HeaderWidget) Draw(buf *ui.Buffer) {\n\tif w.Visible {\n\t\tw.Paragraph.Draw(buf)\n\t}\n}", "title": "" }, { "docid": "85e586b478facb8e938f610c5bbc836b", "score": "0.56884664", "text": "func (g *OWImg) DrawBox(pix Pixel) *OWImg {\n\n\n if !g.gotimg {\n return g\n }\n\n if !g.gotto || !g.gotfrom {\n // line without start or end ? So just a point...\n return g\n }\n for y:=0;y+g.pos.y<=g.pos.y2;y++ {\n g.At(0,y).Plot(pix)\n g.At(g.pos.x2-g.pos.x,y).Plot(pix)\n }\n for x:=0;x+g.pos.x<=g.pos.x2;x++ {\n g.At(x,0).Plot(pix)\n g.At(x,g.pos.y2-g.pos.y).Plot(pix)\n }\n return g\n}", "title": "" }, { "docid": "d8c9f61c5b6f3042414b2a649dac589c", "score": "0.5673751", "text": "func (s *Log) Draw(r *mondrian.Region) {\n\tr.LPrintf(\"LOG: %s\", s.text)\n}", "title": "" }, { "docid": "165bec66b719d63e3cc7cb0fba2d2b13", "score": "0.565861", "text": "func (e *Entry) Draw(p *Painter) {\n\ts := e.Size()\n\n\tstyle := \"entry\"\n\tif e.focused {\n\t\tstyle += \".focused\"\n\t}\n\n\tp.WithStyledBrush(style, func(p *Painter) {\n\t\tp.FillRect(0, 0, s.X, 1)\n\t\tp.DrawText(0, 0, e.text)\n\n\t\tif e.focused {\n\t\t\tp.DrawCursor(len(e.text), 0)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "ed4b8e7655406a27d80e1ffbed19bc16", "score": "0.5654074", "text": "func draw() {\n\t// Get size of whole window.\n\tcontext.Width, context.Height = termbox.Size()\n\tdrawHome()\n\ttermbox.Flush()\n}", "title": "" }, { "docid": "46f3ba9cfdbc8e52e1566bc91f58924c", "score": "0.5633876", "text": "func (i *Instance) Draw(target *ebiten.Image) {\n\ti.layerObjects.Draw(target)\n}", "title": "" }, { "docid": "2749942733e11da10e77dc40d81b4fe1", "score": "0.56007856", "text": "func wb_drawe(wb_c4go_postfix []wb, c int32, h int32, v int32) {\n\twb_flush(wb_c4go_postfix)\n\tsbuf_printf((*[10000]sbuf)(unsafe.Pointer(&wb_c4go_postfix[0].sbuf))[:], []byte(\"%cD'%c %du %du'\\x00\"), c_ec, c, h, v)\n\twb_c4go_postfix[0].h += h\n}", "title": "" }, { "docid": "2e41891727edc8248f79725cae1ba591", "score": "0.5592372", "text": "func (h *house) draw() {\n\tfmt.Printf(\"[H] %+v\\n\", *h)\n}", "title": "" }, { "docid": "c12905c57a92c32234d2660c32e6e6f8", "score": "0.5572385", "text": "func (t Grid) Draw(p *Pen) {\n\t// println(\"grid\", p.x, p.y, p.w, p.h)\n\tcols := 0\n\tfor _, row := range t {\n\t\tif len(row) > cols {\n\t\t\tcols = len(row)\n\t\t}\n\t}\n\n\tw := make([]int, cols)\n\th := make([]int, len(t))\n\n\tfor i, row := range t {\n\t\tfor j, t := range row {\n\t\t\tn, _ := t.ReqWidth()\n\t\t\tif n > w[j] {\n\t\t\t\tw[j] = n\n\t\t\t}\n\t\t\tn, _ = t.ReqHeight()\n\t\t\tif n > h[i] {\n\t\t\t\th[i] = n\n\t\t\t}\n\t\t}\n\t}\n\n\ty := 0\n\tfor i, row := range t {\n\t\tx := 0\n\t\tfor j, t := range row {\n\t\t\tt.Draw(p.Clip(x, y, w[j], h[i]))\n\t\t\tx += w[j] + 1\n\t\t}\n\t\ty += h[i]\n\t}\n}", "title": "" }, { "docid": "27971f01db900351a77d64fc5ae455ed", "score": "0.5557034", "text": "func initWindow() {\n\twin.Clear(backgroundColor)\n\tborder.Draw(win)\n}", "title": "" }, { "docid": "8b99d52277eff26dc204ea80c3d2a146", "score": "0.55390775", "text": "func draw(canvas *draw2dimg.GraphicContext, x float64, y float64, allvect []Vector) (x2, y2 float64){\r\n\tcanvas.MoveTo(x,y)\r\n\tvar a,b,c uint8\r\n\tfor _, currvect := range allvect {\r\n\t\tcanvas.SetStrokeColor(MakeColor(a, b, c))\r\n\t\ta,b,c = currvect.a, currvect.b, currvect.c\r\n\t\tif currvect.dir == 2 {\r\n\t\t\ty = y + 5\r\n\t\t}\r\n\t\tif currvect.dir == 0 {\r\n\t\t\ty = y - 5\r\n\t\t}\r\n\t\tif currvect.dir == 1 {\r\n\t\t\tx = x + 5\r\n\t\t}\r\n\t\tif currvect.dir == 3 {\r\n\t\t\tx = x - 5\r\n\t\t}\r\n\t\tcanvas.LineTo(x,y)\r\n\t}\r\n\tcanvas.Stroke()\r\n\tcanvas.FillStroke()\r\n\treturn x,y\r\n}", "title": "" }, { "docid": "88e66b021171e6e21d0b1ea15de079c1", "score": "0.5535756", "text": "func addBoxAround(d *drawer.Drawer, startX, startY, endX, endY int) error {\n\t// Checking that start and end coordinates are valid\n\tif startX < 0 || startY < 0 || endX < 0 || endY < 0 {\n\t\treturn fmt.Errorf(\"can't draw on negative coordinates %d %d %d %d\", startX, startY, endX, endY)\n\t}\n\tif startX > endX || startY > endY {\n\t\treturn fmt.Errorf(\"start should be before end %d %d %d %d\", startX, startY, endX, endY)\n\t}\n\tdW, dH := d.Dimens()\n\tif endX >= dW || endY >= dH {\n\t\treturn fmt.Errorf(\"end overflows the drawer with dimes %d %d, %d %d %d %d\", dW, dH, startX, startY, endX, endY)\n\t}\n\n\t// Drawing corners\n\terr := d.DrawRune('╭', startX, startY)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error while drawing ╭: %v\", err)\n\t}\n\terr = d.DrawRune('╮', endX, startY)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error while drawing ╮: %v\", err)\n\t}\n\terr = d.DrawRune('╰', startX, endY)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error while drawing ╰: %v\", err)\n\t}\n\terr = d.DrawRune('╯', endX, endY)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error while drawing ╯: %v\", err)\n\t}\n\n\t// Drawing edges\n\tfor x := startX + 1; x < endX; x++ {\n\t\tfor yMul := 0; yMul <= 1; yMul++ {\n\t\t\terr = d.DrawRune('─', x, yMul*(endY-startY)+startY)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error while drawing ─: %v\", err)\n\t\t\t}\n\t\t}\n\t}\n\tfor y := startY + 1; y < endY; y++ {\n\t\tfor xMul := 0; xMul <= 1; xMul++ {\n\t\t\terr = d.DrawRune('│', xMul*(endX-startX)+startX, y)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error while drawing │: %v\", err)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5a98798cea1e9fe126da327628f87084", "score": "0.5521446", "text": "func drawGameOver() {\n\tgameOverBox.Draw(win)\n\tgameOverTxt.Draw(win, pixel.IM.Moved(win.Bounds().Center().Sub(gameOverTxt.Bounds().Center())))\n}", "title": "" }, { "docid": "bb7505340a10ce5a4ad646c6de154ede", "score": "0.5516109", "text": "func wb_drawl(wb_c4go_postfix []wb, c int32, h int32, v int32) {\n\twb_flush(wb_c4go_postfix)\n\tsbuf_printf((*[10000]sbuf)(unsafe.Pointer(&wb_c4go_postfix[0].sbuf))[:], []byte(\"%cD'%c %du %du'\\x00\"), c_ec, c, h, v)\n\twb_c4go_postfix[0].h += h\n\twb_c4go_postfix[0].v += v\n\twb_stsb(wb_c4go_postfix)\n}", "title": "" }, { "docid": "8aa293f4f70899ed395ba2fec76b86a2", "score": "0.5505025", "text": "func draw() {\n\t// Testing the step\n\tvar x int32\n\tvar y int32\n\n\tfmt.Print(\"|\")\n\tfor i := 0; i < width; i++ {\n\t\tfmt.Print(\" \")\n\t}\n\tfmt.Println(\"|\")\n\tfor y = 0; y < height; y++ {\n\t\tfmt.Print(\"|\")\n\t\tfor x = 0; x < width; x++ {\n\t\t\tstat := curBoard[cell{x, y}]\n\t\t\tswitch {\n\t\t\tcase stat == dead:\n\t\t\t\tfmt.Print(deadChar)\n\t\t\tcase stat == alive:\n\t\t\t\tfmt.Print(aliveChar)\n\t\t\tcase stat == edge:\n\t\t\t\tfmt.Print(edgeChar)\n\t\t\t}\n\t\t}\n\t\tfmt.Printf(\"|\\n\")\n\t}\n\tfmt.Printf(\"|\")\n\tfor a := 0; a < width; a++ {\n\t\tfmt.Print(\"_\")\n\t}\n\tfmt.Println(\"|\")\n}", "title": "" }, { "docid": "14b023cc449170bfad4a02ee2f651d6e", "score": "0.55037993", "text": "func (search *Search) Draw(buf *ui.Buffer) {\n\tif !search.active {\n\t\treturn\n\t}\n\n\tstyle := ui.NewStyle(ui.ColorWhite, ui.ColorClear)\n\tcursorStyle := ui.NewStyle(ui.ColorWhite, ui.ColorWhite)\n\tvoidStyle := ui.NewStyle(ui.ColorBlack, ui.ColorBlack)\n\n\tlabel := \"Search: [\"\n\n\tmaximumContentLength := search.Max.X - search.Min.X - len(label) - 2\n\n\tif maximumContentLength <= 0 {\n\t\treturn\n\t}\n\t// Subtract 1 to take into account cursor\n\tcontent := search.GetContent(maximumContentLength)\n\n\t// Fill with initial content including start of search block\n\tlabel += content\n\tp := image.Pt(search.Min.X, search.Min.Y)\n\tbuf.SetString(label, style, p)\n\tp.X += len(label)\n\n\t// Render cursor\n\tbuf.SetString(\" \", cursorStyle, p)\n\tp.X++\n\n\t// Potentially fill the rest of the search block\n\tremaining := maximumContentLength - len(content)\n\tbuf.SetString(strings.Repeat(\" \", remaining), voidStyle, p)\n\tp.X += remaining\n\n\t// Render end of search block\n\tbuf.SetString(\"]\", style, p)\n}", "title": "" }, { "docid": "03a53eb158d7db95c527ca4e6027431e", "score": "0.55034226", "text": "func (game *Game) Draw() {\n\tclearScreen()\n\n\tfmt.Printf(\"Generation : %v\\n\", game.Generation)\n\n\tfor _, r := range game.Rows {\n\t\tfor _, c := range r.Cells {\n\t\t\tif c.Value == 1 {\n\t\t\t\tcolor.Print(fmt.Sprintf(\"%v \", c.Color))\n\t\t\t} else {\n\t\t\t\tcolor.Print(\"@c.\")\n\t\t\t}\n\t\t}\n\t\tfmt.Printf(\"\\n\")\n\t}\n\n\tgame.Sleep()\n}", "title": "" }, { "docid": "986f82ee9bfc373e924439e533bcec76", "score": "0.55024475", "text": "func (b *Button) Draw(target sf.RenderTarget, renderStates sf.RenderStates) {\n\tb.rect.Draw(target, renderStates)\n\tb.sprite.Draw(target, renderStates)\n\tb.text.Draw(target, renderStates)\n\n}", "title": "" }, { "docid": "88d824fafb5c04b7c6ed6ec20f4f56ef", "score": "0.5497316", "text": "func (w *Window) RemoveOnPaintBorderBottom() { RemoveOnPaintHandler(&w.onPaintBorderBottom) }", "title": "" }, { "docid": "92b0cd05fdd15898d615ea2f45af3d2b", "score": "0.5488047", "text": "func (tp *Tabpane) drawPointWithBorder(p point, ch rune, chbord rune, chdown rune, chup rune) []point {\n\tvar addp []point\n\tp.Ch = ch\n\tif tp.Border {\n\t\tp.Ch = chdown\n\t\tp.Y = tp.InnerY() - 1\n\t\taddp = append(addp, p)\n\t\tp.Ch = chup\n\t\tp.Y = tp.InnerY() + 1\n\t\taddp = append(addp, p)\n\t\tp.Ch = chbord\n\t}\n\tp.Y = tp.InnerY()\n\treturn append(addp, p)\n}", "title": "" }, { "docid": "82ae777f0167e2ef4c892cbdcad76117", "score": "0.54819685", "text": "func (c *Container) Draw(gtx *layout.Context, th *material.Theme) error {\n\tgtx.Dimensions = c.Layout(gtx.Ops)\n\t_, err := c.Elements(gtx, DrawAction(gtx, th))\n\treturn err\n}", "title": "" }, { "docid": "99b2087f6c842423412fc8c26810c765", "score": "0.5477365", "text": "func (e *AppElement) DrawTextBox() {\n\tvar r rune\n\n\ta := e.microapp\n\tf := e.frame\n\tval := []rune(e.value)\n\tif e.offset > 0 || (e.height > e.width && len(val) >= e.width) {\n\t\t// possible overflow, find offset\n\t\tif a.cursor.X == e.apose.X {\n\t\t\te.offset = e.cursor.X - e.width + 1\n\t\t} else if a.cursor.X == e.aposb.X && e.offset > 0 {\n\t\t\te.offset--\n\t\t\tif e.cursor.X-e.width+1 > 0 {\n\t\t\t\te.offset++\n\t\t\t}\n\t\t}\n\t\tif e.offset < 0 || (a.cursor.X == e.aposb.X && e.offset > 0 && len(val) <= e.width) {\n\t\t\tif e.offset > 0 && a.cursor.X == e.aposb.X {\n\t\t\t\ta.cursor.X = e.aposb.X + e.cursor.X\n\t\t\t\tif a.cursor.X > e.apose.X {\n\t\t\t\t\ta.cursor.X = e.apose.X\n\t\t\t\t\te.cursor.X--\n\t\t\t\t}\n\t\t\t}\n\t\t\te.offset = 0\n\t\t}\n\t}\n\te.frame.PrintStyle(e.label, e.pos.X, e.pos.Y, &e.style)\n\tstyle := e.style.Underline(true)\n\tfor W := 0; W < e.width; W++ {\n\t\tif W+e.offset < len(val) {\n\t\t\tr = val[W+e.offset]\n\t\t} else {\n\t\t\tr = ' '\n\t\t}\n\t\ta.screen.SetContent(e.aposb.X+W+f.left, e.pos.Y+f.top, r, nil, style)\n\t}\n}", "title": "" }, { "docid": "6f56eed414bd8a2ec0c91b2f33a60893", "score": "0.54719836", "text": "func (line BasicLine) Draw(gsName string) ([]byte, *pdf.PdfRectangle, error) {\n\tw := line.LineWidth\n\n\tpath := NewPath()\n\tpath = path.AppendPoint(NewPoint(line.X1, line.Y1))\n\tpath = path.AppendPoint(NewPoint(line.X2, line.Y2))\n\n\tcc := pdfcontent.NewContentCreator()\n\n\tpathBbox := path.GetBoundingBox()\n\n\tDrawPathWithCreator(path, cc)\n\n\tif line.LineStyle == LineStyleDashed {\n\t\tcc.Add_d([]int64{1, 1}, 0)\n\t}\n\tcc.Add_RG(line.LineColor.R(), line.LineColor.G(), line.LineColor.B()).\n\t\tAdd_w(w).\n\t\tAdd_S().\n\t\tAdd_Q()\n\n\t// Bounding box - global coordinate system.\n\tbbox := &pdf.PdfRectangle{}\n\tbbox.Llx = pathBbox.X\n\tbbox.Lly = pathBbox.Y\n\tbbox.Urx = pathBbox.X + pathBbox.Width\n\tbbox.Ury = pathBbox.Y + pathBbox.Height\n\n\treturn cc.Bytes(), bbox, nil\n}", "title": "" }, { "docid": "145692dc2ec8afc9599b366bae6ad014", "score": "0.5469227", "text": "func AddBorder(welcomeMsg string, numStarsPerLine int) string {\n\tstars := strings.Repeat(\"*\", numStarsPerLine)\n\tmessage := stars + \"\\n\" + welcomeMsg + \"\\n\" + stars\n\treturn message\n}", "title": "" }, { "docid": "53616d067beaf7d3158b8c4b0f717e82", "score": "0.5468885", "text": "func (n *Names) Draw(r *mondrian.Region) {\n\tr.Xbase = 8 // time\n\tncol := (r.Width - r.Xbase) / n.MaxWidth\n\tif ncol == 0 {\n\t\tncol = 1\n\t}\n\tnrow := len(n.Names)/ncol + 1\n\tif len(n.Names)%ncol == 0 {\n\t\tnrow--\n\t}\n\n\tdrawRow := func(start int) {\n\t\tdrawTime(r, n.ToA)\n\t\tfor i := 0; start+i*nrow < len(n.Names); i++ {\n\t\t\tr.Cx = 8 + i*n.MaxWidth\n\t\t\tr.Attr(termbox.ColorDefault|termbox.AttrBold, termbox.ColorDefault)\n\t\t\tr.LPrintf(\"[\")\n\t\t\tr.AttrDefault()\n\t\t\tr.LPrintf(\"%s\", n.Names[start+i*nrow])\n\t\t\tr.Attr(termbox.ColorDefault|termbox.AttrBold, termbox.ColorDefault)\n\t\t\tr.Cx = 8 + (i+1)*n.MaxWidth - 1\n\t\t\tr.LPrintf(\"]\")\n\t\t\tr.AttrDefault()\n\t\t}\n\t}\n\n\tfor j := 0; j < nrow; j++ {\n\t\tr.Xbase = 0\n\t\tr.Cx = 0\n\t\tdrawRow(j)\n\t\tr.Cy++\n\t}\n\tr.Cy--\n}", "title": "" }, { "docid": "6dbe0c34d4ea051a6aa52ffca2fff428", "score": "0.54563767", "text": "func (h *Handler) draw() {\n\th.window.Clear(colornames.Black)\n\n\timd := imdraw.New(nil)\n\timd.Color = pixel.RGB(0.14, 0.8, 0.26)\n\n\tscrW := h.window.Bounds().W()\n\tscrH := h.window.Bounds().H()\n\n\t// Calculate the screen ratio.\n\trW, rH := scrW/64, scrH/32\n\n\tfor x := 0; x < 64; x++ {\n\t\tfor y := 0; y < 32; y++ {\n\t\t\tif !h.vm.PixelSet((31-y)*64 + x) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Scale the pixel co-ords.\n\t\t\tsX := rW * float64(x)\n\t\t\tsY := rH * float64(y)\n\n\t\t\timd.Push(pixel.V(sX, sY))\n\t\t\timd.Push(pixel.V(sX+rW, sY+rH))\n\t\t\timd.Rectangle(0)\n\t\t}\n\t}\n\n\timd.Draw(h.window)\n\th.window.Update()\n}", "title": "" }, { "docid": "973b457f5baba27595bf3cd24e979f54", "score": "0.5452298", "text": "func (s *Menu) Draw(screen *ebiten.Image) {\n\tscreen.Fill(colorBackground)\n\n\t// op := &ebiten.DrawImageOptions{}\n\n\tfor _, d := range s.widgets {\n\t\td.Draw(screen)\n\t}\n}", "title": "" }, { "docid": "58a323697d9e3a37bdaeb8ee6179ff37", "score": "0.54419", "text": "func (t *Tomb) Draw(s *tl.Screen) {\n\toffsetx := -1\n\toffsety := -2\n\tfor i := 0; i < len(*t.canvas); i++ {\n\t\tfor j := 0; j < len((*t.canvas)[0]); j++ {\n\t\t\ts.RenderCell(int(t.body.Position.X)+i+offsetx, int(t.body.Position.Y)+j+offsety, &(*t.canvas)[i][j])\n\t\t}\n\t}\n}", "title": "" }, { "docid": "31e2d23924f7ef68a075036e3fea211c", "score": "0.5436003", "text": "func (t *TitleScreen) Draw(renderer *sdl.Renderer) {\n\n\t// Draw the background\n\tt.Background.Draw(renderer)\n\n\t// Draw the blocks\n\tfor i := range t.Blocks {\n\t\tt.Blocks[i].Draw(renderer)\n\t}\n\n\t// Draw the text\n\tt.TitleText.Draw(renderer)\n\n\t// Draw the buttons\n\tt.StartButton.Draw(renderer)\n\tt.OptionsButton.Draw(renderer)\n\tt.QuitButton.Draw(renderer)\n}", "title": "" }, { "docid": "88826f0a31ef570b5ef5e3e7ce963bb0", "score": "0.542841", "text": "func (b *Bug) Draw() {\n\tfor i, _ := range b.shapes {\n\t\tb.shapes[i].Draw()\n\t}\n}", "title": "" }, { "docid": "5d85ca453d86d81f067260bd7558822e", "score": "0.5422259", "text": "func (t *Table) Draw(buf *ui.Buffer) {\n\tt.Block.Draw(buf)\n\n\tif t.ShowLocation {\n\t\tt.drawLocation(buf)\n\t}\n\n\tt.ColResizer()\n\n\t// Finds exact column starting position.\n\tcolXPos := []int{}\n\tcur := 1 + t.PadLeft\n\tfor _, w := range t.ColWidths {\n\t\tcolXPos = append(colXPos, cur)\n\t\tcur += w\n\t\tcur += t.ColGap\n\t}\n\n\t// Prints the header.\n\tfor i, h := range t.Header {\n\t\twidth := t.ColWidths[i]\n\t\tif width == 0 {\n\t\t\tcontinue\n\t\t}\n\t\t// Do not render column if it does not fit in the widget.\n\t\tif width > (t.Inner.Dx()-colXPos[i])+1 {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Render the background of the header.\n\t\tbuf.SetString(\n\t\t\tstrings.Repeat(\" \", t.Inner.Dx()),\n\t\t\tui.NewStyle(ui.ColorBlack, ui.ColorGreen),\n\t\t\timage.Pt(t.Inner.Min.X+colXPos[i]-1, t.Inner.Min.Y),\n\t\t)\n\n\t\tbuf.SetString(\n\t\t\th,\n\t\t\tui.NewStyle(ui.ColorBlack, ui.ColorGreen),\n\t\t\timage.Pt(t.Inner.Min.X+colXPos[i]-1, t.Inner.Min.Y),\n\t\t)\n\t}\n\n\tif t.TopRow < 0 {\n\t\treturn\n\t}\n\n\t// Print each row.\n\tfor rowNum := t.TopRow; rowNum < t.TopRow+t.Inner.Dy()-1 && rowNum < len(t.Rows); rowNum++ {\n\t\trow := t.Rows[rowNum]\n\t\ty := (rowNum + 2) - t.TopRow\n\n\t\t// Print the cursor / selected row.\n\t\tstyle := ui.NewStyle(ui.ColorClear)\n\t\tif t.ShowCursor {\n\t\t\tif (t.SelectedItem == \"\" && rowNum == t.SelectedRow) || (t.SelectedItem != \"\" && t.SelectedItem == row[t.UniqueCol]) {\n\t\t\t\tstyle.Fg = ui.ColorBlack\n\t\t\t\tstyle.Bg = ui.ColorCyan\n\t\t\t\tfor _, width := range t.ColWidths {\n\t\t\t\t\tif width == 0 {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tbuf.SetString(\n\t\t\t\t\t\tstrings.Repeat(\" \", t.Inner.Dx()),\n\t\t\t\t\t\tstyle,\n\t\t\t\t\t\timage.Pt(t.Inner.Min.X+1, t.Inner.Min.Y+y-1),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tt.SelectedItem = row[t.UniqueCol]\n\t\t\t\tt.SelectedRow = rowNum\n\t\t\t}\n\t\t}\n\n\t\t// Print each column of the row.\n\t\tfor i, width := range t.ColWidths {\n\t\t\tif width == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Do not render column if width is greater than distance to end of the widget.\n\t\t\tif width > (t.Inner.Dx()-colXPos[i])+1 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tr := ui.TrimString(row[i], width)\n\t\t\tbuf.SetString(\n\t\t\t\tr,\n\t\t\t\tstyle,\n\t\t\t\timage.Pt(t.Inner.Min.X+colXPos[i]-1, t.Inner.Min.Y+y-1),\n\t\t\t)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3b9db22b91f0f0f40e4be400b796d2d2", "score": "0.54167217", "text": "func ThickBorder() Border {\n\treturn thickBorder\n}", "title": "" }, { "docid": "9d507d89bb57f1e9a37848c33ddeb781", "score": "0.5414425", "text": "func (w *Window) SetBorderBottom(v int) { w.onSetBorderBotom.Handle(w, &w.borderBottom, v) }", "title": "" }, { "docid": "7e8afde906950e7dd282622fac730cf3", "score": "0.5401738", "text": "func (c *cumulus) draw() {\n\tfmt.Printf(\"[C] %+v\\n\", *c)\n}", "title": "" }, { "docid": "4cedf11ff4d1873c81b17f512fa72aab", "score": "0.5374553", "text": "func (c *Capsule) Draw(screen *ebiten.Image) {\n\n\top := &ebiten.DrawImageOptions{}\n\top.ColorM.Scale(0.5, 0.5, 0.5, 1)\n\top.GeoM.Translate(c.start.X-c.radius, c.start.Y-c.radius)\n\tscreen.DrawImage(c.image, op)\n\top.GeoM.Reset()\n\top.GeoM.Translate(c.end.X-c.radius, c.end.Y-c.radius)\n\tscreen.DrawImage(c.image, op)\n\n\tdrawLine(c.start, c.end, c.radius*2.0, screen, colorful.Hsl(0, 0, 0.5), 1.0)\n}", "title": "" }, { "docid": "fbc80bead9d9d0def5abecec32b6b508", "score": "0.5373074", "text": "func (w Window) Draw() {\n\tw.UpdateBufBody()\n\tw.Buf.PushBufToUndoRedoBuffer()\n}", "title": "" }, { "docid": "33ad0d9707b7fd2be377f5bcb226eb46", "score": "0.5372664", "text": "func (c *ChangeIntervalDurationTable) Draw(buf *ui.Buffer) {\n\tc.Table.Draw(buf)\n}", "title": "" }, { "docid": "a948d201d70250753e66ba5d57ac0274", "score": "0.53703576", "text": "func Draw() {\n\t// Don't draw if not expecting input\n\tif !isActive {\n\t\treturn\n\t}\n\n\tconsts.ImdLayer.Color = backgroundColour\n\tconsts.ImdLayer.Push(backgroundBounds.Min, backgroundBounds.Max)\n\tconsts.ImdLayer.Rectangle(0)\n\n\tinpText.Clear()\n\t// Print to screen the typed value followed by an underscore. This is\n\t// indicate the user should type\n\t_, _ = fmt.Fprintf(inpText, \"%s_\", typed)\n\tinpText.Draw(consts.TextLayer, pixel.IM.Scaled(inpText.Orig, 7))\n}", "title": "" }, { "docid": "4960240824f5905b9cf214229a341bd4", "score": "0.53672665", "text": "func (ep *EditPane) Draw() {\n\tep.editarea.Draw(area.Area{\n\t\tStart: ep.area.Start,\n\t\tEnd: area.Point{X: ep.area.End.X, Y: ep.area.End.Y},\n\t})\n\tep.statusbar.Draw(\n\t\tep.editarea,\n\t\tarea.Area{\n\t\t\tStart: area.Point{X: ep.area.Start.X, Y: ep.area.End.Y},\n\t\t\tEnd: ep.area.End,\n\t\t},\n\t)\n}", "title": "" }, { "docid": "03a88fff2144fd4016643a9ec45c7a83", "score": "0.53667784", "text": "func (i *InputField) Draw(screen tcell.Screen) {\n\ti.Box.DrawForSubclass(screen, i)\n\n\t// Prepare\n\tx, y, width, height := i.GetInnerRect()\n\trightLimit := x + width\n\tif height < 1 || rightLimit <= x {\n\t\treturn\n\t}\n\n\t// Draw label.\n\tif i.labelWidth > 0 {\n\t\tlabelWidth := i.labelWidth\n\t\tif labelWidth > rightLimit-x {\n\t\t\tlabelWidth = rightLimit - x\n\t\t}\n\t\tPrint(screen, i.label, x, y, labelWidth, AlignLeft, i.labelColor)\n\t\tx += labelWidth\n\t} else {\n\t\t_, drawnWidth := Print(screen, i.label, x, y, rightLimit-x, AlignLeft, i.labelColor)\n\t\tx += drawnWidth\n\t}\n\n\t// Draw input area.\n\ti.fieldX = x\n\tfieldWidth := i.fieldWidth\n\tif fieldWidth == 0 {\n\t\tfieldWidth = math.MaxInt32\n\t}\n\tif rightLimit-x < fieldWidth {\n\t\tfieldWidth = rightLimit - x\n\t}\n\tfieldStyle := tcell.StyleDefault.Background(i.fieldBackgroundColor)\n\tfor index := 0; index < fieldWidth; index++ {\n\t\tscreen.SetContent(x+index, y, ' ', nil, fieldStyle)\n\t}\n\n\t// Text.\n\tvar cursorScreenPos int\n\ttext := i.text\n\tif text == \"\" && i.placeholder != \"\" {\n\t\t// Draw placeholder text.\n\t\tPrint(screen, Escape(i.placeholder), x, y, fieldWidth, AlignLeft, i.placeholderTextColor)\n\t\ti.offset = 0\n\t} else {\n\t\t// Draw entered text.\n\t\tif i.maskCharacter > 0 {\n\t\t\ttext = strings.Repeat(string(i.maskCharacter), utf8.RuneCountInString(i.text))\n\t\t}\n\t\tif fieldWidth >= stringWidth(text) {\n\t\t\t// We have enough space for the full text.\n\t\t\tPrint(screen, Escape(text), x, y, fieldWidth, AlignLeft, i.fieldTextColor)\n\t\t\ti.offset = 0\n\t\t\titerateString(text, func(main rune, comb []rune, textPos, textWidth, screenPos, screenWidth int) bool {\n\t\t\t\tif textPos >= i.cursorPos {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tcursorScreenPos += screenWidth\n\t\t\t\treturn false\n\t\t\t})\n\t\t} else {\n\t\t\t// The text doesn't fit. Where is the cursor?\n\t\t\tif i.cursorPos < 0 {\n\t\t\t\ti.cursorPos = 0\n\t\t\t} else if i.cursorPos > len(text) {\n\t\t\t\ti.cursorPos = len(text)\n\t\t\t}\n\t\t\t// Shift the text so the cursor is inside the field.\n\t\t\tvar shiftLeft int\n\t\t\tif i.offset > i.cursorPos {\n\t\t\t\ti.offset = i.cursorPos\n\t\t\t} else if subWidth := stringWidth(text[i.offset:i.cursorPos]); subWidth > fieldWidth-1 {\n\t\t\t\tshiftLeft = subWidth - fieldWidth + 1\n\t\t\t}\n\t\t\tcurrentOffset := i.offset\n\t\t\titerateString(text, func(main rune, comb []rune, textPos, textWidth, screenPos, screenWidth int) bool {\n\t\t\t\tif textPos >= currentOffset {\n\t\t\t\t\tif shiftLeft > 0 {\n\t\t\t\t\t\ti.offset = textPos + textWidth\n\t\t\t\t\t\tshiftLeft -= screenWidth\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif textPos+textWidth > i.cursorPos {\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcursorScreenPos += screenWidth\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn false\n\t\t\t})\n\t\t\tPrint(screen, Escape(text[i.offset:]), x, y, fieldWidth, AlignLeft, i.fieldTextColor)\n\t\t}\n\t}\n\n\t// Draw autocomplete list.\n\ti.autocompleteListMutex.Lock()\n\tdefer i.autocompleteListMutex.Unlock()\n\tif i.autocompleteList != nil {\n\t\t// How much space do we need?\n\t\tlheight := i.autocompleteList.GetItemCount()\n\t\tlwidth := 0\n\t\tfor index := 0; index < lheight; index++ {\n\t\t\tentry, _ := i.autocompleteList.GetItemText(index)\n\t\t\twidth := TaggedStringWidth(entry)\n\t\t\tif width > lwidth {\n\t\t\t\tlwidth = width\n\t\t\t}\n\t\t}\n\n\t\t// We prefer to drop down but if there is no space, maybe drop up?\n\t\tlx := x\n\t\tly := y + 1\n\t\t_, sheight := screen.Size()\n\t\tif ly+lheight >= sheight && ly-2 > lheight-ly {\n\t\t\tly = y - lheight\n\t\t\tif ly < 0 {\n\t\t\t\tly = 0\n\t\t\t}\n\t\t}\n\t\tif ly+lheight >= sheight {\n\t\t\tlheight = sheight - ly\n\t\t}\n\t\ti.autocompleteList.SetRect(lx, ly, lwidth, lheight)\n\t\ti.autocompleteList.Draw(screen)\n\t}\n\n\t// Set cursor.\n\tif i.HasFocus() {\n\t\tscreen.ShowCursor(x+cursorScreenPos, y)\n\t}\n}", "title": "" }, { "docid": "e0ac58859b6f5e59f55b6e2ec4932c36", "score": "0.5361105", "text": "func (p TextRender) Draw(target *ebiten.Image, x, y int, clr color.Color, mode int) {\n\tp.Render.Draw(target, fixed.I(x), fixed.I(y), clr, mode)\n}", "title": "" }, { "docid": "39d91c14377f20935f2a6d490ae0db79", "score": "0.53419024", "text": "func (e *AppElement) DrawButton() {\n\tf := e.frame\n\tstyle := e.style\n\tlabel := []rune(\" \" + e.label + \" \")\n\tif e.valueType == \"cancel\" {\n\t\tstyle = e.style.Background(tcell.ColorDarkRed).Foreground(tcell.ColorWhite).Bold(true)\n\t} else if e.valueType == \"ok\" {\n\t\tstyle = e.style.Background(tcell.ColorDarkGreen).Foreground(tcell.ColorWhite).Bold(true)\n\t}\n\tfor x := 0; x < len(label); x++ {\n\t\te.microapp.screen.SetContent(e.pos.X+x+f.left, e.pos.Y+f.top, label[x], nil, style)\n\t}\n}", "title": "" }, { "docid": "394d562883a3ee080474e3b0341915d6", "score": "0.534189", "text": "func (w *Window) RemoveOnPaintBorderRight() { RemoveOnPaintHandler(&w.onPaintBorderRight) }", "title": "" }, { "docid": "c6218f9829be20c08ba86f8e69e48971", "score": "0.5337686", "text": "func wb_drawa(wb_c4go_postfix []wb, c int32, h1 int32, v1 int32, h2 int32, v2 int32) {\n\twb_flush(wb_c4go_postfix)\n\tsbuf_printf((*[10000]sbuf)(unsafe.Pointer(&wb_c4go_postfix[0].sbuf))[:], []byte(\"%cD'%c %du %du %du %du'\\x00\"), c_ec, c, h1, v1, h2, v2)\n\twb_c4go_postfix[0].h += h1 + h2\n\twb_c4go_postfix[0].v += v1 + v2\n\twb_stsb(wb_c4go_postfix)\n}", "title": "" }, { "docid": "e0f79ff7a00d32c33aee5f3207b066be", "score": "0.53288877", "text": "func (f *File) Draw(builder *strings.Builder, o *DrawingOptions, depth int, seen *map[string]struct{}) {\n\tconnector := connectorT\n\tif o.LastItem {\n\t\tconnector = connectorL\n\t}\n\tfmt.Fprintf(builder, treeLines(o, depth, connector)+\"%s (%s)\\n\", f.SPDXID(), f.Name)\n}", "title": "" }, { "docid": "cd585afb82399fd20dc0e0816196312a", "score": "0.53237396", "text": "func (l *light) draw(d *render.Draw) {\n\td.SetFloats(\"lp\", float32(l.wx), float32(l.wy), float32(l.wz)) // position\n\td.SetFloats(\"lc\", float32(l.r), float32(l.g), float32(l.b)) // color\n}", "title": "" }, { "docid": "25ce0c1bbb0eb9ac487fafc4cf7369d2", "score": "0.53127486", "text": "func draw() {\n\n}", "title": "" }, { "docid": "3fcb13fa098386fc8300c49320778355", "score": "0.52977645", "text": "func (b Board) Draw() {\n\t// The index is manipulated this way in order to get a representation such as this:\n\t//\n\t// 8 [56][57][58][59][60][61][62][63]\n\t// 7 [48][49][50][51][52][53][54][55]\n\t// 6 [40][41][42][43][44][45][46][47]\n\t// 5 [32][33][34][35][36][37][38][39]\n\t// 4 [24][25][26][27][28][29][30][31]\n\t// 3 [16][17][18][19][20][21][22][23]\n\t// 2 [ 8][ 9][10][11][12][13][14][15]\n\t// 1 [ 0][ 1][ 2][ 3][ 4][ 5][ 6][ 7]\n\t// a b c d e f g h\n\n\ti := 64\n\tfor rank := 8; rank > 0; rank-- {\n\t\ti -= 8\n\t\tfmt.Printf(\"%d \", rank)\n\t\tfor file := 0; file < 8; file++ {\n\t\t\tp := NewPiece(b.Square[i])\n\t\t\tfmt.Printf(\"%s\", squareRepresentation(rank, file, *p))\n\t\t\ti++\n\t\t}\n\t\ti -= 8\n\t\tprintln()\n\t}\n\tprint(\" \")\n\tfor file := 0; file < 8; file++ {\n\t\tfmt.Printf(\" %s \", fileNotation[file])\n\t}\n\tprintln()\n}", "title": "" }, { "docid": "b832ff4e405d00d11e0c73602c6394dc", "score": "0.5295777", "text": "func Base(doc gfx.Layer) Rect {\n\torigin := XY{.5, .1}\n\twh := rand.XYRange(.2, .4)\n\tshape := Rect{\n\t\tA: XY{\n\t\t\tX: origin.X - wh.X,\n\t\t\tY: origin.Y,\n\t\t},\n\t\tB: XY{\n\t\t\tX: origin.X + wh.X,\n\t\t\tY: origin.Y + wh.Y,\n\t\t},\n\t}\n\n\tgfx.Stroke{\n\t\tShape: shape,\n\t\tColor: color.Black,\n\t}.Draw(doc)\n\treturn shape\n}", "title": "" }, { "docid": "07226053ac94ba6936351f22d60151e9", "score": "0.5289934", "text": "func (jbobject *GraphicsTextLayout) Draw(a GraphicsGCInterface, b int, c int) {\n\tconv_a := javabind.NewGoToJavaCallable()\n\tif err := conv_a.Convert(a); err != nil {\n\t\tpanic(err)\n\t}\n\t_, err := jbobject.CallMethod(javabind.GetEnv(), \"draw\", javabind.Void, conv_a.Value().Cast(\"org/eclipse/swt/graphics/GC\"), b, c)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tconv_a.CleanUp()\n\n}", "title": "" }, { "docid": "3a0f96a6d86c2b38ed276db7c9927132", "score": "0.5274607", "text": "func setupField(win *gc.Window) *gc.Window {\n\twin.Color(2)\n\twin.Erase()\n\t// func (w *Window) Border(ls, rs, ts, bs, tl, tr, bl, br Char) error\n\twin.Border(gc.ACS_VLINE, gc.ACS_VLINE, ' ', ' ', gc.ACS_VLINE, gc.ACS_VLINE, gc.ACS_VLINE, gc.ACS_VLINE)\n\ty, x := win.MaxYX()\n\tgameBoard := win.Derived(y, x-2, 0, 1)\n\tgameBoard.SetBackground(gc.ColorPair(2) | gc.A_BOLD)\n\tgameBoard.Touch()\n\tgameBoard.Sync(gc.SYNC_DOWN)\n\treturn gameBoard\n}", "title": "" }, { "docid": "3d9c1aaee5f66280141103e7323988a6", "score": "0.5264834", "text": "func (e *Editor) Draw() {\n\n\t// The screen's height and width should be updated on each render to account\n\t// for the user resizing the window.\n\te.Width, e.Height = termbox.Size()\n\te.ScrollView()\n\n\terr := termbox.Clear(termbox.ColorDefault, termbox.ColorDefault)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\te.DrawTitleBar()\n\te.DrawBuffer()\n\te.DrawStatusBar()\n\n\tif e.PromptIsActive {\n\t\ttermbox.SetCursor(e.FB().CursorX, e.Height)\n\t} else {\n\t\ttermbox.SetCursor(e.FB().CursorDX-e.FB().OffsetX, e.FB().CursorY-e.FB().OffsetY)\n\t}\n\n\terr = termbox.Flush()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "1b025eba10b7bcf88b662465bf64c89a", "score": "0.5261743", "text": "func (b *Ball) Draw(screen *ebiten.Image) {\n\t// draw ball\n\top := &ebiten.DrawImageOptions{}\n\top.GeoM.Translate(float64(b.position.X), float64(b.position.Y))\n\tvector.DrawFilledRect(screen, float32(b.position.X), float32(b.position.Y), float32(b.position.Width), float32(b.position.Height), color.White)\n}", "title": "" }, { "docid": "5d9f1a2336ff41bd4c6acce10b8dd2c0", "score": "0.52486223", "text": "func (w *Window) OnClickBorder(h OnMouseHandler, finalize func()) {\n\tAddOnMouseHandler(&w.onClickBorder, h, finalize)\n}", "title": "" }, { "docid": "b0e299f4e5c810f3a80a64f71d08bd01", "score": "0.5243891", "text": "func wb_drawxend(wb_c4go_postfix []wb) {\n\tsbuf_printf((*[10000]sbuf)(unsafe.Pointer(&wb_c4go_postfix[0].sbuf))[:], []byte(\"'\\x00\"))\n}", "title": "" }, { "docid": "d773863b2c017168eea310f46f13af96", "score": "0.52408326", "text": "func DrawWall(x1, y1, x2, y2 int, cursorData *cursor.Data, term *term.Data) {\n\trow := y1\n\tcol := x1\n\tfor {\n\t\tterm.Screen.SetContent(col, row, term.Wall, nil, term.Style)\n\t\tcol++\n\t\tif col >= x2 {\n\t\t\trow++\n\t\t\tcol = x1\n\t\t}\n\t\tif row > y2 {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "838644aba1e98208d1b3ff8036f25acc", "score": "0.52294356", "text": "func (r *RootInteractor) Draw() {\n\tradius := 9\n\n\tx := insetAmount\n\ty := insetAmount\n\tw := r.Width() - insetAmount\n\th := r.Height() - insetAmount\n\n\tr.c.Save()\n\tr.c.SetFillColor(r.fillColor)\n\tjs.Global.Call(\"roundRect\", r.c.(*canvasImpl).Context(), x, y, w, h,\n\t\tradius, true, false)\n\n\t//setup the clipping rectangle to be the same path as our drawn rounded\n\t//rectangle so children can't be badly behaved\n\tr.c.BeginPath()\n\tjs.Global.Call(\"roundRect\", r.c.(*canvasImpl).Context(), x, y, w, h,\n\t\tradius, false, false)\n\tr.c.Clip()\n\n\t//setup our own coordinate system\n\tr.c.Translate(x, y)\n\tchildren := r.Children()\n\tif len(children) > 0 {\n\t\td, ok := children[0].(tropical.DrawsSelf)\n\t\tif !ok {\n\t\t\tDefault.DrawSelf(children[0], r.c)\n\t\t} else {\n\t\t\td.DrawSelf(r.c)\n\t\t}\n\t}\n\n\tr.c.Restore()\n}", "title": "" }, { "docid": "757928e3b4cb46b056bf9654aba031dd", "score": "0.52289766", "text": "func (renderer *GridRenderer) Draw(container RenderTileContainer) Render {\n\n\trender := Render{\n\t\tTextBelowCanvas: \"\",\n\t\tStartX: renderer.StartX,\n\t\tStartY: renderer.StartY,\n\t\tTileWidth: renderer.TileWidth,\n\t\tTileHeight: renderer.TileHeight,\n\t}\n\n\trender.Grid = make([][]*RenderTile, renderer.Width)\n\n\tfor i := 0; i < renderer.Width; i++ {\n\t\trender.Grid[i] = make([]*RenderTile, renderer.Height)\n\n\t\tfor j := 0; j < renderer.Height; j++ {\n\t\t\trenderTile := RenderTile{}\n\t\t\trender.Grid[i][j] = &renderTile\n\t\t}\n\t}\n\n\tstartX := renderer.StartX\n\tstartY := renderer.StartY\n\n\tfor y := startY; y < startY+renderer.Height; y++ {\n\t\tfor x := startX; x < startX+renderer.Width; x++ {\n\t\t\trender.Grid[x-startX][y-startY].RGBA = container.RenderTile(x, y)\n\t\t}\n\t}\n\n\treturn render\n}", "title": "" }, { "docid": "cbd799954fdff0559c0e8937da6b0427", "score": "0.5226101", "text": "func (u *UI) Box() {\n\tw, h := u.s.Size()\n\n\t// Find dimensions of text\n\tboxWidth := 10\n\tfor _, s := range u.boxText {\n\t\tif len(s) > boxWidth && len(s) < w-4 {\n\t\t\tboxWidth = len(s)\n\t\t}\n\t}\n\tboxHeight := len(u.boxText)\n\n\t// position\n\tx := (w - boxWidth) / 2\n\ty := (h - boxHeight) / 2\n\txmax := x + boxWidth\n\tif len(u.boxMenu) != 0 {\n\t\tcount := lineOptionLength(u.boxMenu)\n\t\tif x+boxWidth > x+count {\n\t\t\txmax = x + boxWidth\n\t\t} else {\n\t\t\txmax = x + count\n\t\t}\n\t}\n\tymax := y + len(u.boxText)\n\n\t// draw text\n\tstyle := tcell.StyleDefault.Background(tcell.ColorRed).Reverse(true)\n\tfor i, s := range u.boxText {\n\t\tu.Line(x, y+i, xmax, style, ' ', s)\n\t\tstyle = tcell.StyleDefault.Reverse(true)\n\t}\n\n\tif len(u.boxMenu) != 0 {\n\t\tu.LineOptions(x, ymax, xmax, style, u.boxMenu, u.boxMenuButton)\n\t\tymax++\n\t}\n\n\t// draw top border\n\tfor i := y; i < ymax; i++ {\n\t\tu.s.SetContent(x-1, i, tcell.RuneVLine, nil, style)\n\t\tu.s.SetContent(xmax, i, tcell.RuneVLine, nil, style)\n\t}\n\tfor j := x; j < xmax; j++ {\n\t\tu.s.SetContent(j, y-1, tcell.RuneHLine, nil, style)\n\t\tu.s.SetContent(j, ymax, tcell.RuneHLine, nil, style)\n\t}\n\n\tu.s.SetContent(x-1, y-1, tcell.RuneULCorner, nil, style)\n\tu.s.SetContent(xmax, y-1, tcell.RuneURCorner, nil, style)\n\tu.s.SetContent(x-1, ymax, tcell.RuneLLCorner, nil, style)\n\tu.s.SetContent(xmax, ymax, tcell.RuneLRCorner, nil, style)\n}", "title": "" }, { "docid": "81abb320c4bb706d43741b16cbc2d2f0", "score": "0.5218457", "text": "func (c *Cell) Draw(surface *sdl.Surface) {\n\tif c.golCell.Alive {\n\t\tc.screenCell.SetColour(aliveColour[0], aliveColour[1], aliveColour[2])\n\t} else {\n\t\tc.screenCell.SetColour(deadColour[0], deadColour[1], deadColour[2])\n\t}\n\tc.screenCell.Draw(surface)\n}", "title": "" }, { "docid": "886ea11d6c0a9fb267b01aaaddc97b30", "score": "0.52152205", "text": "func (w *Window) BorderRight() int { return w.borderRight }", "title": "" }, { "docid": "0087c8e4bc72fe980110f677038abd8e", "score": "0.5214703", "text": "func (s Square) Draw() {\n\tfmt.Println(\"Drawing square...\")\n}", "title": "" }, { "docid": "f15ddee2244e275fe1718f7df3c699f8", "score": "0.52112716", "text": "func (r *CollRec) Draw(s *tl.Screen) { r.r.Draw(s) }", "title": "" }, { "docid": "96b95d2749d1cb7af52ad8a19f3981ca", "score": "0.52061474", "text": "func wb_drawc(wb_c4go_postfix []wb, c int32, r int32) {\n\twb_flush(wb_c4go_postfix)\n\tsbuf_printf((*[10000]sbuf)(unsafe.Pointer(&wb_c4go_postfix[0].sbuf))[:], []byte(\"%cD'%c %du'\\x00\"), c_ec, c, r)\n\twb_c4go_postfix[0].h += r\n}", "title": "" }, { "docid": "1186a9c2d1aa253e10cfbdea671f1bbb", "score": "0.5205131", "text": "func (l *List) Draw(p *Painter) {\n\tif len(l.items) == 0 {\n\t\treturn\n\t}\n\n\tsz := l.Size()\n\n\tstart := clip(l.pos, 0, len(l.items)-1)\n\tend := clip(l.pos+l.numRows, start, len(l.items))\n\n\tfor i, item := range l.items[start:end] {\n\t\ttsel := l.selected - l.pos\n\n\t\tstyle := \"list.item\"\n\t\tif i == tsel {\n\t\t\tstyle += \".selected\"\n\t\t}\n\n\t\tp.WithStyledBrush(style, func(p *Painter) {\n\t\t\tp.FillRect(0, tsel, sz.X-2, 1)\n\t\t\tp.DrawText(0, i, item)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "d31a94f845971229cb9d83173dc21776", "score": "0.51924795", "text": "func (geo Geometry) Draw(buffer *SoftFrameBuffer) {\n\n\t// Draw the lines formws by the points of the geometry\n\n\tfor i := 0; i < len(geo.vertices)-1; i++ {\n\t\tline := &Line{\n\t\t\ta: geo.vertices[i],\n\t\t\tb: geo.vertices[i+1]}\n\n\t\t//fmt.Printf(\"%s\\n\", geo.vertices[i].String())\n\t\tline.Draw(buffer)\n\t}\n\n\t// TODO adapt for 3D\n\t// Fill the geometry with black\n\t//geo.scanFill(buffer, RGBColor{0, 0, 0})\n\n}", "title": "" }, { "docid": "a13ade1f4f6d9d4fbc4fbce7b473c9dc", "score": "0.51891816", "text": "func (i *InputField) Draw(screen tcell.Screen) {\n\ti.Box.Draw(screen)\n\n\tfieldBackgroundColor := i.fieldBackgroundColor\n\tfieldTextColor := i.fieldTextColor\n\n\tif i.disable {\n\t\tfieldBackgroundColor = i.fieldDisableBackgroundColor\n\t\tfieldTextColor = i.fieldDisableTextColor\n\t}\n\n\t// Prepare\n\tx, y, width, height := i.GetInnerRect()\n\trightLimit := x + width\n\tif height < 1 || rightLimit <= x {\n\t\treturn\n\t}\n\n\t//fmt.Println(\"-\", i.label, i.labelWidth, i.fieldWidth)\n\n\t// Draw label.\n\tvar labels = []struct {\n\t\ttext string\n\t\tcolor tcell.Color\n\t}{{\n\t\ttext: i.subLabel,\n\t\tcolor: i.subLabelColor,\n\t}, {\n\t\ttext: i.label,\n\t\tcolor: i.labelColor,\n\t}}\n\n\tif len(labels) > 0 {\n\t\tlabelWidth := i.labelWidth\n\t\tif labelWidth > rightLimit-x {\n\t\t\tlabelWidth = rightLimit - x\n\t\t}\n\n\t\taddCount := labelWidth - i.GetLabelWidth()\n\n\t\tfor _, label := range labels {\n\t\t\tif addCount > 0 && strings.Contains(label.text, \"%s\") {\n\t\t\t\tlabel.text = fmt.Sprintf(label.text, strings.Repeat(i.labelFiller, addCount))\n\t\t\t\taddCount = 0\n\t\t\t} else {\n\t\t\t\tlabel.text = strings.Replace(label.text, \"%s\", \"\", -1)\n\t\t\t}\n\n\t\t\tlabelWidth = StringWidth(label.text)\n\t\t\tPrint(screen, label.text, x, y, labelWidth, AlignLeft, label.color)\n\t\t\tx += labelWidth\n\t\t}\n\t\tx++\n\t}\n\n\ttext := i.text\n\ttextWidth := runewidth.StringWidth(text)\n\tif i.maskCharacter > 0 {\n\t\ttext = strings.Repeat(string(i.maskCharacter), utf8.RuneCountInString(i.text))\n\t}\n\tif i.cursorPosition < 0 {\n\t\ti.cursorPosition = 0\n\t}\n\tif i.cursorPosition > textWidth {\n\t\ti.cursorPosition = textWidth\n\t}\n\n\t// Draw input area.\n\tfieldWidth := i.fieldWidth\n\tif fieldWidth == 0 {\n\t\tfieldWidth = math.MaxInt32\n\t}\n\tif rightLimit-x < fieldWidth {\n\t\tfieldWidth = rightLimit - x\n\t}\n\tfieldStyle := tcell.StyleDefault.Background(fieldBackgroundColor)\n\tfor index := 0; index < fieldWidth; index++ {\n\t\tif index == i.cursorPosition && !i.disable && i.focus.HasFocus() {\n\t\t\tcontinue\n\t\t}\n\t\tscreen.SetContent(x+index, y, ' ', nil, fieldStyle)\n\t}\n\n\t// Draw placeholder text.\n\tif text == \"\" && i.placeholder != \"\" {\n\t\tPrint(screen, i.placeholder, x, y, fieldWidth, AlignLeft, i.placeholderTextColor)\n\t}\n\n\tfieldWidth-- // We need one cell for the cursor.\n\t// Draw entered text.\n\tif fieldWidth < textWidth {\n\t\trunes := []rune(text)\n\t\tp := len(runes)\n\t\tif i.cursorPosition-1 < textWidth-fieldWidth {\n\t\t\tp = i.cursorPosition + fieldWidth\n\t\t}\n\t\tfor pos := p - 1; pos >= 0; pos-- {\n\t\t\tch := runes[pos]\n\t\t\tw := runewidth.RuneWidth(ch)\n\t\t\tif fieldWidth-w < 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t_, _, style, _ := screen.GetContent(x+fieldWidth-w, y)\n\t\t\tstyle = style.Foreground(fieldTextColor)\n\t\t\tfor w > 0 {\n\t\t\t\tfieldWidth--\n\t\t\t\tscreen.SetContent(x+fieldWidth, y, ch, nil, style)\n\t\t\t\tw--\n\t\t\t}\n\t\t}\n\t} else {\n\t\tpos := 0\n\t\tfor _, ch := range text {\n\t\t\tw := runewidth.RuneWidth(ch)\n\t\t\t_, _, style, _ := screen.GetContent(x+pos, y)\n\t\t\tstyle = style.Foreground(fieldTextColor)\n\t\t\tfor w > 0 {\n\t\t\t\tscreen.SetContent(x+pos, y, ch, nil, style)\n\t\t\t\tpos++\n\t\t\t\tw--\n\t\t\t}\n\t\t}\n\t}\n\n\t// Set cursor.\n\tif !i.disable && i.focus.HasFocus() {\n\t\ti.setCursor(screen)\n\t}\n}", "title": "" }, { "docid": "282c77121aa5ef9a3ef660de7fc5fb6c", "score": "0.5182705", "text": "func (v *debugView) Draw(s *tl.Screen) {\n\tif v.hidden {\n\t\treturn\n\t}\n\n\t// starting x position of debug text lines\n\tx := 0\n\tif v.showPallette {\n\t\tDrawPallette(s, -1)\n\t\tx += 6\n\t}\n\n\t// show line with fps\n\tv.fpsCaption.SetPosition(x, 0)\n\tv.fpsCaption.Draw(s)\n\tv.fpsText.SetPosition(x+5, 0)\n\tv.fpsText.Draw(s)\n\n\t// show last 10 logs with new log always at the bottom\n\tfor i, l := range v.d.lastNLogs(10) {\n\t\ttl.NewText(x, i+1, l, tl.ColorBlack, tl.ColorDefault).Draw(s)\n\t}\n}", "title": "" }, { "docid": "edbd8da85c3b9f8f0fa90613631bdec9", "score": "0.5177426", "text": "func (fr *Frame) FrameStdRender() {\n\tst := &fr.Sty\n\trs := &fr.Viewport.Render\n\tpc := &rs.Paint\n\t// first draw a background rectangle in our full area\n\n\tpos := fr.LayData.AllocPos\n\tsz := fr.LayData.AllocSize\n\tpc.FillBox(rs, pos, sz, &st.Font.BgColor)\n\n\trad := st.Border.Radius.Dots\n\tpos = pos.AddVal(st.Layout.Margin.Dots).SubVal(0.5 * st.Border.Width.Dots)\n\tsz = sz.SubVal(2.0 * st.Layout.Margin.Dots).AddVal(st.Border.Width.Dots)\n\n\t// then any shadow -- todo: optimize!\n\tif st.BoxShadow.HasShadow() {\n\t\tspos := pos.Add(Vec2D{st.BoxShadow.HOffset.Dots, st.BoxShadow.VOffset.Dots})\n\t\tpc.StrokeStyle.SetColor(nil)\n\t\tpc.FillStyle.SetColor(&st.BoxShadow.Color)\n\t\tif rad == 0.0 {\n\t\t\tpc.DrawRectangle(rs, spos.X, spos.Y, sz.X, sz.Y)\n\t\t} else {\n\t\t\tpc.DrawRoundedRectangle(rs, spos.X, spos.Y, sz.X, sz.Y, rad)\n\t\t}\n\t\tpc.FillStrokeClear(rs)\n\t}\n\n\tif fr.Lay == LayoutGrid && fr.Stripes != NoStripes {\n\t\tfr.RenderStripes()\n\t}\n\n\tpc.FillStyle.SetColor(nil)\n\tpc.StrokeStyle.SetColor(&st.Border.Color)\n\tpc.StrokeStyle.Width = st.Border.Width\n\tif rad == 0.0 {\n\t\tpc.DrawRectangle(rs, pos.X, pos.Y, sz.X, sz.Y)\n\t} else {\n\t\tpc.DrawRoundedRectangle(rs, pos.X, pos.Y, sz.X, sz.Y, rad)\n\t}\n\tpc.FillStrokeClear(rs)\n}", "title": "" }, { "docid": "4874569be56f3c6974d16ca88739c1dc", "score": "0.5174547", "text": "func (paddle *paddle) draw(pixels []byte) {\n\tstartX := int(paddle.x - paddle.w/2)\n\tstartY := int(paddle.y - paddle.h/2)\n\n\tfor y := 0; y < int(paddle.h); y++ {\n\t\tfor x := 0; x < int(paddle.w); x++ {\n\t\t\tsetPixel(startX+x, startY+y, paddle.color, pixels)\n\t\t}\n\t}\n\t//\n\tnumX := lerp(paddle.x, getCenter().x, 0.4)\n\tdrawNumber(pos{numX, 35}, paddle.color, 10, paddle.score, pixels)\n}", "title": "" }, { "docid": "6f6d1a995d07c68ed56b691e77e815c8", "score": "0.5162183", "text": "func Draw(r spec.Reader, s spec.Surface) {\n\ts = spec.NewOffsetSurface(r, s)\n\tview := r.View()\n\tif view == nil {\n\t\tview = views.RectangleView\n\t}\n\tview(s, r)\n\n\tfor _, child := range r.Children() {\n\t\tDraw(child, s)\n\t}\n}", "title": "" }, { "docid": "2b02a58650010a18f20c8fccde117cac", "score": "0.51590633", "text": "func (r Roster) Draw(screen tcell.Screen) {\n\tr.flex.Draw(screen)\n}", "title": "" } ]
dac1b5b52437225dc51a833c059f95db
Insert: Inserts a new user role. profileId: User profile ID associated with this request.
[ { "docid": "b6b0631fa106dab4940f7cd968dfee55", "score": "0.7315799", "text": "func (r *UserRolesService) Insert(profileId int64, userrole *UserRole) *UserRolesInsertCall {\n\tc := &UserRolesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.userrole = userrole\n\treturn c\n}", "title": "" } ]
[ { "docid": "6ab7ff95870bd3acb5b678ec9778e3ec", "score": "0.5587729", "text": "func (r *AccountUserProfilesService) Insert(profileId int64, accountuserprofile *AccountUserProfile) *AccountUserProfilesInsertCall {\n\tc := &AccountUserProfilesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.accountuserprofile = accountuserprofile\n\treturn c\n}", "title": "" }, { "docid": "8d967bacedcbcb96087b7922d4676445", "score": "0.5411442", "text": "func (u *User) Save(roleID uint) error {\n\ttx := DB.Begin()\n\tur := UserRole{}\n\tur.RoleID = roleID\n\n\tif err := tx.Create(u).Error; err != nil {\n\t\ttx.Rollback()\n\t\treturn err\n\t}\n\n\tur.UserID = u.ID\n\n\tif err := tx.Create(&ur).Error; err != nil {\n\t\ttx.Rollback()\n\t\treturn err\n\t}\n\tif err := tx.Commit().Error; err != nil {\n\t\ttx.Rollback()\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "09c58d41fac590067eee93f307b38ee4", "score": "0.53295714", "text": "func (r *UserRolesService) Update(profileId int64, userrole *UserRole) *UserRolesUpdateCall {\n\tc := &UserRolesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.userrole = userrole\n\treturn c\n}", "title": "" }, { "docid": "e649a00fc3cb7db28e411f6fcb087c69", "score": "0.526255", "text": "func InsertRole(db *sql.DB, name, intro string) error {\n\tresult, err := db.Exec(roleSQLString[mysqlRoleInsert], name, intro, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif rows, _ := result.RowsAffected(); rows == 0 {\n\t\treturn errInvalidMysql\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8c4fc4923292e95691010e40aa12b36a", "score": "0.509266", "text": "func RoleCreate(user_id int64, level_id uint8) (sql.Result, error) {\n\tres, err := database.DB.Exec(\"INSERT INTO role (user_id, level_id) VALUES (?,?)\", user_id, level_id)\n\treturn res, err\n}", "title": "" }, { "docid": "b4a7211c788e110341f561b2edd4738d", "score": "0.5055972", "text": "func (a *App) CreateProfile(w http.ResponseWriter, r *http.Request) {\n\thandler.CreateProfile(a.DB, w, r)\n}", "title": "" }, { "docid": "1105026b1302d42937363cd550a65440", "score": "0.49606454", "text": "func (p *ProfilesRepo) Insert(taskID, profileID gocql.UUID) error {\n\tquery := `INSERT INTO profile_ids (\n\t\t\t\ttask_id,\n\t\t\t\tprofile_id\n\t\t\t) VALUES (?, ?)`\n\tif err := p.conn.Query(query, taskID, profileID).Exec(); err != nil {\n\t\treturn fmt.Errorf(\"can't insert profile: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "97b30876351a7116a10e00fe7a51dcb9", "score": "0.49428663", "text": "func (m *UserMutation) AddRole(i int) {\n\tif m.addrole != nil {\n\t\t*m.addrole += i\n\t} else {\n\t\tm.addrole = &i\n\t}\n}", "title": "" }, { "docid": "7089adc45ad035b089fd4ad9ad6b777e", "score": "0.49293366", "text": "func (r *UserRolesService) Delete(profileId int64, id int64) *UserRolesDeleteCall {\n\tc := &UserRolesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.id = id\n\treturn c\n}", "title": "" }, { "docid": "c7e4d33242563fab9c3ce69b20388509", "score": "0.49254888", "text": "func (a *App) CreateUserProfile(w http.ResponseWriter, r *http.Request) {\n\thandler.CreateUserProfile(a.DB, w, r)\n}", "title": "" }, { "docid": "09982137c44fc2891d3b5739dacd72ca", "score": "0.49143577", "text": "func AddProfile(ctx context.Context, profile *ProfileModel) error {\n\tcollection := db.Database(DatabaseTypers).Collection(CollectionProfiles)\n\n\tid, err := addDocumentToCollection(ctx, collection, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprofile.ID = id\n\treturn nil\n}", "title": "" }, { "docid": "963cfece1ef1d0bc778f0129f82fdbf3", "score": "0.49094856", "text": "func CreateUserRole(w http.ResponseWriter, r *http.Request) {\n\tfLog := userMgmtLogger.WithField(\"func\", \"CreateUserRole\").WithField(\"RequestID\", r.Context().Value(constants.RequestID)).WithField(\"path\", r.URL.Path).WithField(\"method\", r.Method)\n\n\tiauthctx := r.Context().Value(constants.HansipAuthentication)\n\tif iauthctx == nil {\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusUnauthorized, \"You are not authorized to access this resource\", nil, nil)\n\t\treturn\n\t}\n\n\tparams, err := helper.ParsePathParams(fmt.Sprintf(\"%s/management/user/{userRecId}/role/{roleRecId}\", apiPrefix), r.URL.Path)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\trole, err := RoleRepo.GetRoleByRecID(r.Context(), params[\"roleRecId\"])\n\tif err != nil {\n\t\tfLog.Errorf(\"RoleRepo.GetRoleByRecID got %s\", err.Error())\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusInternalServerError, err.Error(), nil, nil)\n\t\treturn\n\t}\n\tif role == nil {\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusNotFound, fmt.Sprintf(\"Role recid %s not found\", params[\"roleRecId\"]), nil, nil)\n\t\treturn\n\t}\n\n\tauthCtx := iauthctx.(*hansipcontext.AuthenticationContext)\n\tif !authCtx.IsAdminOfDomain(role.RoleDomain) {\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusForbidden, \"You don't have the right to access role with the specified domain\", nil, nil)\n\t\treturn\n\t}\n\n\tuser, err := UserRepo.GetUserByRecID(r.Context(), params[\"userRecId\"])\n\tif err != nil {\n\t\tfLog.Errorf(\"UserRepo.GetUserByRecID got %s\", err.Error())\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusInternalServerError, err.Error(), nil, nil)\n\t\treturn\n\t}\n\tif user == nil {\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusNotFound, fmt.Sprintf(\"User recid %s not found\", params[\"userRecId\"]), nil, nil)\n\t\treturn\n\t}\n\n\t_, err = UserRoleRepo.CreateUserRole(r.Context(), user, role)\n\tif err != nil {\n\t\tfLog.Errorf(\"UserRoleRepo.CreateUserRole got %s\", err.Error())\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusBadRequest, err.Error(), nil, nil)\n\t\treturn\n\t}\n\tRevocationRepo.Revoke(r.Context(), user.Email)\n\thelper.WriteHTTPResponse(r.Context(), w, http.StatusOK, \"User-Role created\", nil, nil)\n}", "title": "" }, { "docid": "13be96aee86952861a4aa420a2922092", "score": "0.49080774", "text": "func (svc *roleService) Add(ctx context.Context, in *permissionpb.RoleRequest, out *commons.Status) error {\n\treturn xbasiswrapper.ContextToAuthorize(ctx, out, func(auth *xbasiswrapper.WrapperUser) *commons.State {\n\t\trepo := svc.GetRepo()\n\t\tdefer repo.Close()\n\n\t\t_, err := repo.FindByName(in.Name, in.AppId)\n\t\tif err != nil && err == mgo.ErrNotFound {\n\t\t\terr = repo.Save(in.Name, in.AppId, auth.User)\n\t\t\tif err != nil {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn errstate.Success\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn errstate.ErrRoleAlreadyExists\n\t\t}\n\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "918d058ecf5cf32c510cfffb67d015e7", "score": "0.48608583", "text": "func Add(courseID, userID, role string) error {\n\tif !roles.IsValid(role) {\n\t\treturn errors.New(\"did not attempt to write to database, \" + role + \" is not a valid role.\")\n\t}\n\tvar sql = \"INSERT INTO enrollments (`course_id`, `user_id`, `role`, `section_id`, `status`)\" +\n\t\t\"VALUES(?, ?, ?, '', 'active')\"\n\tvar _, err = global.DB.Exec(sql, courseID, userID, role)\n\treturn err\n\n}", "title": "" }, { "docid": "852b2117f6eeb8f6d2b105c84d500bdd", "score": "0.4854988", "text": "func (db *MySQLDB) CreateUserRole(ctx context.Context, user *User, role *Role) (*UserRole, error) {\n\tfLog := mysqlLog.WithField(\"func\", \"CreateUserRole\").WithField(\"RequestID\", ctx.Value(constants.RequestID))\n\tq := \"INSERT INTO HANSIP_USER_ROLE(USER_REC_ID, ROLE_REC_ID) VALUES (?,?)\"\n\t_, err := db.instance.ExecContext(ctx, q, user.RecID, role.RecID)\n\tif err != nil {\n\t\tfLog.Errorf(\"db.instance.ExecContext got %s. SQL = %s\", err.Error(), q)\n\t\treturn nil, &ErrDBExecuteError{\n\t\t\tWrapped: err,\n\t\t\tMessage: \"Error CreateUserRole\",\n\t\t\tSQL: q,\n\t\t}\n\t}\n\treturn &UserRole{\n\t\tUserRecID: user.RecID,\n\t\tRoleRecID: role.RecID,\n\t}, nil\n}", "title": "" }, { "docid": "2275711fd9dc1d602a59fab6fc85ca1a", "score": "0.4848231", "text": "func (svc *inmemService) PostProfile(ctx context.Context, p Profile) error {\n\t// Get the lock from the inmemService struct\n\tsvc.mtx.Lock()\n\n\t// Immediately set up a lock release to occur when the function finishes\n\tdefer svc.mtx.Unlock()\n\n\t// Check to see if the profile already exists\n\tif _, ok := svc.profiles[p.ID]; ok {\n\n\t\t// If it does return an error which informs the caller that profile already exists\n\t\treturn ErrAlreadyExists\n\t}\n\n\t// Insert the profile to our datastore\n\tsvc.profiles[p.ID] = p\n\n\t// Return a nil error\n\treturn nil\n}", "title": "" }, { "docid": "2efdc9c99c3406e69ae4c09f7ecbe2f3", "score": "0.48283517", "text": "func (s *Store) CreateRole(ctx context.Context, role *Role) (*Role, error) {\n\terr := role.Validate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult, err := sqlx.NamedExecContext(\n\t\tctx,\n\t\ts.db,\n\t\t\"INSERT INTO roles (name) VALUES (:name)\",\n\t\t&role)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, errors.ErrorUnknown, \"\")\n\t}\n\n\tid, err := result.LastInsertId()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, errors.ErrorUnknown, \"\")\n\t}\n\treturn s.FindRoleByID(ctx, id)\n}", "title": "" }, { "docid": "80198a1419cdfa56b78447c665d2cb95", "score": "0.48235995", "text": "func (p *ProfilesExperiences) Insert(qu Queryer) (lastInsertID int64, err error) {\n\tconst stmt = \"INSERT INTO `profiles__experiences__` (`profile_id`, `start`, `end`, `role`, `tag_line`, `description`) VALUES (?, ?, ?, ?, ?, ?)\"\n\tres, err := qu.Exec(stmt, p.ProfileID, p.Start, p.End, p.Role, p.TagLine, p.Description)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn res.LastInsertId()\n}", "title": "" }, { "docid": "21a6761ce89b18f5a01c9a4ef40b8058", "score": "0.47946453", "text": "func (m *GormIdentityRoleRepository) Create(ctx context.Context, u *IdentityRole) error {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"identity_role\", \"create\"}, time.Now())\n\tif u.IdentityRoleID == uuid.Nil {\n\t\tu.IdentityRoleID = uuid.NewV4()\n\t}\n\terr := m.db.Create(u).Error\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"identity_role_id\": u.IdentityRoleID,\n\t\t\t\"err\": err,\n\t\t}, \"unable to create the identity role\")\n\t\tif gormsupport.IsUniqueViolation(err, \"uq_identity_role_identity_role_resource\") {\n\t\t\treturn errs.WithStack(errors.NewDataConflictError(err.Error()))\n\t\t}\n\t\tif gormsupport.IsForeignKeyViolation(err, \"identity_role_identity_id_fkey\") {\n\t\t\treturn errs.WithStack(errors.NewNotFoundError(\"identity\", u.IdentityID.String()))\n\t\t}\n\t\tif gormsupport.IsForeignKeyViolation(err, \"identity_role_resource_id_fkey\") {\n\t\t\treturn errs.WithStack(errors.NewNotFoundError(\"resource\", u.ResourceID))\n\t\t}\n\t\tif gormsupport.IsForeignKeyViolation(err, \"identity_role_role_id_fkey\") {\n\t\t\treturn errs.WithStack(errors.NewNotFoundError(\"role\", u.RoleID.String()))\n\t\t}\n\t\treturn errs.WithStack(err)\n\t}\n\tlog.Debug(ctx, map[string]interface{}{\n\t\t\"identity_role_id\": u.IdentityRoleID,\n\t}, \"Identity Role created!\")\n\treturn nil\n}", "title": "" }, { "docid": "bb82e50c368ab9bf2b42141d96726070", "score": "0.47023934", "text": "func (c *client) CreateProfile(jwt string, prof *Profile) (*Profile, error) {\n\tb, err := json.Marshal(prof)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"CreateProfile: failed to marshal profile: %s\", err)\n\t}\n\n\treq, err := http.NewRequest(\"POST\", c.profURL.String(), bytes.NewBuffer(b))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"CreateProfile: failed to create request: %s\", err)\n\t}\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", jwt))\n\n\tresp, err := c.c.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\t// look for `200` or `201`\n\tif resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {\n\t\treturn nil, fmt.Errorf(\"CreateProfile: Code: %d Status: %s\", resp.StatusCode, resp.Status)\n\t}\n\n\tvar p *Profile\n\terr = json.NewDecoder(resp.Body).Decode(&p)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"CreateProfile: failed to decode resp body: %s\", resp.Body)\n\t}\n\n\treturn p, nil\n}", "title": "" }, { "docid": "0ee31c1a26a62b8d8d29f57214267736", "score": "0.4685166", "text": "func (r *SitesService) Insert(profileId int64, site *Site) *SitesInsertCall {\n\tc := &SitesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.site = site\n\treturn c\n}", "title": "" }, { "docid": "2d27c8717523be632839c3e275175832", "score": "0.46713734", "text": "func (svc *inmemService) PutProfile(ctx context.Context, id string, profile Profile) error {\n\n\t// Check if the id provided by caller fails to match the ID on the Profile value passed in\n\tif id != profile.ID {\n\t\t// Return a canned error message for mismatched IDs\n\t\treturn ErrInconsistentIDs\n\t}\n\n\t// Get a Lock on the svc for atomic access to the datastore\n\tsvc.mtx.Lock()\n\n\t// Immediately set up an unlock to occur when function exits\n\tdefer svc.mtx.Unlock()\n\n\t// Create or replace the profile in our datastore\n\tsvc.profiles[id] = profile\n\n\t// Return a nil value for the error\n\treturn nil\n}", "title": "" }, { "docid": "0d27b407f7a8df20efe6d0ef2c44fefb", "score": "0.46674043", "text": "func (ur *UserRepository) Create(ctx context.Context, u *user.User) error {\n\tq := `\n\tINSERT INTO users (user_name, role)\n\tVALUES ($1, $2)\n\tRETURNING id;\n\t`\n\tstmt, err := ur.Data.DB.PrepareContext(ctx, q)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer stmt.Close()\n\n\trow := stmt.QueryRowContext(ctx, u.UserName, u.Role)\n\n\terr = row.Scan(&u.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0a78eb8aab7b34a25c4e1787d640bb26", "score": "0.46591848", "text": "func (r *UserRolesService) Get(profileId int64, id int64) *UserRolesGetCall {\n\tc := &UserRolesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.id = id\n\treturn c\n}", "title": "" }, { "docid": "66569cb3d3a99e8dbdec966cd5c233c7", "score": "0.46588942", "text": "func CreateRole(c *gin.Context) {\n\tnewRole := model.Role{}\n\tc.BindJSON(&newRole)\n\n\terr := service.CreateRole(newRole)\n\n\tif err != nil {\n\t\terror := service.GetGormErrorCode(err.Error())\n\t\tc.JSON(500, error)\n\t} else {\n\t\tc.String(200, \"ok\")\n\t}\n}", "title": "" }, { "docid": "3b11beff437a47b20d79220bf9471d84", "score": "0.46570703", "text": "func (s *Sql) AddUserProfile(userID, displayName string) error {\n\tstmt, err := s.Db.Prepare(\"INSERT INTO user_profiles(userId, displayName, timestamp) VALUES(?, ?, ?)\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer stmt.Close()\n\t_, err = stmt.Exec(userID, displayName, int32(time.Now().UTC().Unix()))\n\n\tif err != nil {\n\t\tif mysqlErr := err.(*mysql.MySQLError); mysqlErr.Number == 1062 {\n\t\t\t// ignore duplicate entry errors for profiles\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1ae60f6e92d848bf349d23ef43ecd418", "score": "0.46555406", "text": "func CreateRole(c RoleCreated) (int, error) {\n\tq := `INSERT INTO roles(name, parent_id) \n\t\t VALUES($1, $2) RETURNING id`\n\tdb := GetConnection()\n\n\tdefer db.Close()\n\tvar id int = 0\n\terr := db.QueryRow(q, c.Name, c.ParentId).Scan(&id)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn id, nil\n}", "title": "" }, { "docid": "41d736d050c717095eccef3744e910f7", "score": "0.46496364", "text": "func Create(s *store.Store) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tuser := r.Context().Value(\"user\").(*store.User)\n\t\tdata := &CreateRequest{}\n\t\tif err := render.Bind(r, data); err != nil {\n\t\t\trender.Render(w, r, api.ErrValidation(err))\n\t\t\treturn\n\t\t}\n\n\t\tprofile, err := s.ProfileService.Profile(user.ID)\n\t\t{\n\t\t\tif err != nil {\n\t\t\t\trender.Render(w, r, api.ErrInternal(err))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif profile != nil {\n\t\t\t\trender.Render(w, r, api.ErrInvalidRequest(errors.New(\"profile already created\")))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tprofile = &store.Profile{\n\t\t\tUserID: user.ID,\n\t\t\tLastName: data.LastName,\n\t\t\tFirstName: data.FirstName,\n\t\t\tBirthdate: data.Birthdate,\n\t\t\tGender: data.Gender,\n\t\t\tAttraction: data.Attraction,\n\t\t\tBio: data.Bio,\n\t\t}\n\t\tif err := s.ProfileService.Add(profile); err != nil {\n\t\t\trender.Render(w, r, api.ErrInternal(err))\n\t\t\treturn\n\t\t}\n\t\trender.Render(w, r, api.DefaultResponse(http.StatusCreated, profile))\n\t}\n}", "title": "" }, { "docid": "6a7385149456273f1602f7cdea80f55c", "score": "0.46391866", "text": "func ModifyProfile(w http.ResponseWriter, r *http.Request) {\n\tvar user models.User\n\n\terr := json.NewDecoder(r.Body).Decode(&user)\n\tif err != nil {\n\t\thttp.Error(w, \"Incorrect data \"+err.Error(), 400)\n\t\treturn\n\t}\n\n\tvar status bool\n\tstatus, err = db.ModifyRegister(user, IDUser)\n\tif err != nil {\n\t\thttp.Error(w, \"An error occurred while modifying the profile, try again \"+err.Error(), 400)\n\t\treturn\n\t}\n\n\tif status == false {\n\t\thttp.Error(w, \"The user registry has not been modified\", 400)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusCreated)\n}", "title": "" }, { "docid": "4658333a66d5f3be6bba488293940ab9", "score": "0.4626201", "text": "func (s *AdmAccountStore) Create(a *pwdless.Account) error {\n\tcount, _ := s.db.Model(a).\n\t\tWhere(\"email = ?email\").\n\t\tCount()\n\n\tif count != 0 {\n\t\treturn ErrUniqueEmailConstraint\n\t}\n\n\terr := s.db.RunInTransaction(func(tx *pg.Tx) error {\n\t\terr := tx.Insert(a)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tp := &models.Profile{\n\t\t\tAccountID: a.ID,\n\t\t}\n\t\treturn tx.Insert(p)\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "b9ffbb6f396c311bba5400474a8fde85", "score": "0.46069342", "text": "func (a *Authorizer) AddRole(name string, description string, parents ...string) error {\n\n\t// Make sure parents exists first\n\tif len(parents) > 0 {\n\t\tfor _, p := range parents {\n\t\t\t_r := role{}\n\t\t\tif err := a.db.One(\"Name\", p, &_r); err != nil {\n\t\t\t\treturn fmt.Errorf(\"Parent %s doesnt exist\", p)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Look for a role that exists\n\tvar r role\n\tif err := a.db.One(\"Name\", name, &r); err == nil {\n\t\t// Update fields\n\t\tr.Description = description\n\t\tr.Parents = parents\n\t} else {\n\t\t// New role\n\t\tr = role{\n\t\t\tName: name,\n\t\t\tDescription: description,\n\t\t\tPermissions: []permission{},\n\t\t\tParents: parents,\n\t\t}\n\t}\n\n\tif err := a.db.Save(&r); err != nil {\n\t\treturn err\n\t}\n\n\treturn a.load()\n}", "title": "" }, { "docid": "00f7cdda7589db0fefbe975013a36621", "score": "0.45969617", "text": "func Put(ctx context.Context, rt *RoleType) (*RoleType, error) {\n\tk := datastore.NewKey(ctx, \"RoleType\", rt.ID, 0, nil)\n\tvar err error\n\trt.Created = time.Now()\n\tk, err = datastore.Put(ctx, k, rt)\n\treturn rt, err\n}", "title": "" }, { "docid": "94cfc11bb297e51bd61e12163068901f", "score": "0.45871714", "text": "func (c LoginController) Create(ctx *fasthttp.RequestCtx) {\n\tvar loginRequest model.LoginRequest\n\n\tc.JSONBody(ctx, &loginRequest)\n\tif errs, err := database.ValidateStruct(loginRequest); err != nil {\n\t\tc.JSONResponse(ctx, model.ResponseError{\n\t\t\tErrors: errs,\n\t\t\tDetail: fasthttp.StatusMessage(fasthttp.StatusUnprocessableEntity),\n\t\t}, fasthttp.StatusUnprocessableEntity)\n\t\treturn\n\t}\n\n\troleAssignment := new(model2.UserRoleAssignment)\n\tuserModel := new(model2.User)\n\tuserState := new(model2.UserState)\n\tc.GetDB().QueryRowWithModel(fmt.Sprintf(\n\t\t\"SELECT u.* FROM %s AS u \"+\n\t\t\t\"INNER JOIN %s AS ra ON u.id = ra.user_id \"+\n\t\t\t\"LEFT OUTER JOIN %s AS ra2 ON ra.user_id = ra2.user_id and ra.id < ra2.id \"+\n\t\t\t\"INNER JOIN %s AS us ON u.id = us.user_id \"+\n\t\t\t\"LEFT OUTER JOIN %s AS us2 ON us.user_id = us2.user_id and us.id < us2.id \"+\n\t\t\t\"WHERE ra2.id IS NULL and us2.id IS NULL and us.state = $1 and u.username = $2 OR u.email = $2\",\n\t\tuserModel.TableName(),\n\t\troleAssignment.TableName(),\n\t\troleAssignment.TableName(),\n\t\tuserState.TableName(),\n\t\tuserState.TableName(),\n\t), userModel, database.Active, loginRequest.ID).Force()\n\n\tif err := utils.ComparePassword([]byte(userModel.PasswordDigest.String), []byte(loginRequest.Password)); err != nil {\n\t\tc.JSONResponse(ctx, model.ResponseError{\n\t\t\tDetail: \"authentication failed\",\n\t\t}, fasthttp.StatusUnauthorized)\n\t\treturn\n\t}\n\n\tuserPassphrase := new(model2.UserPassphrase)\n\tuserPassphraseModel := model2.NewUserPassphrase(userModel.ID)\n\tc.GetDB().Insert(userPassphrase,\n\t\tuserPassphraseModel, \"id\", \"inserted_at\")\n\n\tc.JSONResponse(ctx, model.ResponseSuccessOne{\n\t\tData: model.LoginResponse{\n\t\t\tPassphraseID: userPassphraseModel.ID,\n\t\t\tUserID: userModel.ID,\n\t\t\tPassphrase: userPassphraseModel.Passphrase,\n\t\t},\n\t}, fasthttp.StatusCreated)\n}", "title": "" }, { "docid": "964f02ce32a6f4cdcc27316038e37056", "score": "0.458521", "text": "func (r *OrganizationsRolesService) Create(parent string, createrolerequest *CreateRoleRequest) *OrganizationsRolesCreateCall {\n\tc := &OrganizationsRolesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\tc.createrolerequest = createrolerequest\n\treturn c\n}", "title": "" }, { "docid": "eccf169f3c5f99a98714a730c32e9db4", "score": "0.45718387", "text": "func (r *UserRolesService) Patch(profileId int64, id int64, userrole *UserRole) *UserRolesPatchCall {\n\tc := &UserRolesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.urlParams_.Set(\"id\", fmt.Sprint(id))\n\tc.userrole = userrole\n\treturn c\n}", "title": "" }, { "docid": "bda07865b43b803e4275f54d1ff27958", "score": "0.45666263", "text": "func (m *GormIdentityRoleRepository) Save(ctx context.Context, model *IdentityRole) error {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"identity_role\", \"save\"}, time.Now())\n\n\tobj, err := m.Load(ctx, model.IdentityRoleID)\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"identity_role_id\": model.IdentityRoleID,\n\t\t\t\"err\": err,\n\t\t}, \"unable to update identity role\")\n\t\treturn errs.WithStack(err)\n\t}\n\terr = m.db.Model(obj).Updates(model).Error\n\tif err != nil {\n\t\treturn errs.WithStack(err)\n\t}\n\n\tlog.Debug(ctx, map[string]interface{}{\n\t\t\"identity_role_id\": model.IdentityRoleID,\n\t}, \"Identity Role saved!\")\n\treturn nil\n}", "title": "" }, { "docid": "af615d3484a2ec550d0f942df6899358", "score": "0.45617014", "text": "func (s *UserRoleService) Add(userRole *UserRole) (*UserRole, error) {\n\tif IsNil(userRole) {\n\t\treturn nil, internal.CreateInvalidParameterError(constants.OperationAdd, constants.ParameterUserRole)\n\t}\n\n\tpath, err := services.GetAddPath(s, userRole)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := services.ApiAdd(s.GetClient(), userRole, new(UserRole), path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp.(*UserRole), nil\n}", "title": "" }, { "docid": "d2d48d32ca87be8356966219f04a100d", "score": "0.45614806", "text": "func createProfile(w http.ResponseWriter, r *http.Request) {\n\n\tw.Header().Set(\"Content-Type\", \"application/json\") // for adding Content-type\n\n\tvar person user\n\terr := json.NewDecoder(r.Body).Decode(&person) // storing in person variable of type user\n\tif err != nil {\n\t\tfmt.Print(err)\n\t}\n\tinsertResult, err := userCollection.InsertOne(context.TODO(), person)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Println(\"Inserted a single document: \", insertResult)\n\tjson.NewEncoder(w).Encode(insertResult.InsertedID) // return the mongodb ID of generated document\n\n}", "title": "" }, { "docid": "0a2acb1885651e8ce3636550cf58875b", "score": "0.4550575", "text": "func CreateProfile(ctx *router.Context) {\n\tuin, _ := ctx.Keys[middleware.ComerUinContextKey].(uint64)\n\trequest := &model.CreateProfileRequest{}\n\terr := ctx.BindJSON(request)\n\tif err != nil {\n\t\tctx.ERROR(\n\t\t\trouter.ErrParametersInvaild,\n\t\t\t\"wrong metamask login parameter\",\n\t\t)\n\t\treturn\n\t}\n\terr = service.CreateComerProfile(uin, request)\n\tif err != nil {\n\t\tctx.ERROR(\n\t\t\trouter.ErrBuisnessError,\n\t\t\t\"wrong metamask login parameter\",\n\t\t)\n\t\treturn\n\t}\n\n\tctx.OK(nil)\n}", "title": "" }, { "docid": "958afadd27bd7070f9f07474ab09bb7a", "score": "0.45394492", "text": "func (u UserRepo) Create(user model.User) (int, error) {\n\tvar id int\n\trows, err := u.db.Query(\"INSERT INTO users (login , password,roleID) VALUES ($1,$2,$3) RETURNING id \", user.Login, user.Password, dto.USER)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif rows.Next() {\n\t\terr = rows.Scan(&id)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\treturn id, rows.Err()\n}", "title": "" }, { "docid": "be84a43ab453a5fb085657b8c68689c4", "score": "0.45357093", "text": "func (r *DirectorySitesService) Insert(profileId int64, directorysite *DirectorySite) *DirectorySitesInsertCall {\n\tc := &DirectorySitesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.directorysite = directorysite\n\treturn c\n}", "title": "" }, { "docid": "cb8ce69da7a6a4992df51f42d3758d2e", "score": "0.45262894", "text": "func (db *MySQLDB) CreateRole(ctx context.Context, roleName, roleDomain, description string) (*Role, error) {\n\tfLog := mysqlLog.WithField(\"func\", \"CreateRole\").WithField(\"RequestID\", ctx.Value(constants.RequestID))\n\tr := &Role{\n\t\tRecID: helper.MakeRandomString(10, true, true, true, false),\n\t\tRoleName: roleName,\n\t\tRoleDomain: roleDomain,\n\t\tDescription: description,\n\t}\n\tq := \"INSERT INTO HANSIP_ROLE(REC_ID, ROLE_NAME,ROLE_DOMAIN, DESCRIPTION) VALUES (?,?,?,?)\"\n\t_, err := db.instance.ExecContext(ctx, q, r.RecID, roleName, roleDomain, description)\n\tif err != nil {\n\t\tfLog.Errorf(\"db.instance.ExecContext got %s. SQL = %s\", err.Error(), q)\n\t\treturn nil, &ErrDBExecuteError{\n\t\t\tWrapped: err,\n\t\t\tMessage: \"Error CreateRole\",\n\t\t\tSQL: q,\n\t\t}\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "8cefc7fb37ec7ef9456d4d68aebf2ff2", "score": "0.45261097", "text": "func (a *api) h_POST_orgs_orgId_userRoles(c *gin.Context) {\n\torgId, err := parseInt64Param(c, \"orgId\")\n\ta.logger.Debug(\"POST /orgs/\", orgId, \"/userRoles\")\n\tif a.errorResponse(c, err) {\n\t\treturn\n\t}\n\n\taCtx := a.getAuthContext(c)\n\tif a.errorResponse(c, aCtx.AuthZOrgAdmin(orgId)) {\n\t\treturn\n\t}\n\n\tvar ur UserRole\n\tif a.errorResponse(c, bindAppJson(c, &ur)) {\n\t\treturn\n\t}\n\tmur := a.userRole2muserRole(&ur)\n\tif a.errorResponse(c, a.Dc.InsertUserRole(aCtx, orgId, mur)) {\n\t\treturn\n\t}\n\tc.Status(http.StatusNoContent)\n}", "title": "" }, { "docid": "b87c5688ea3cb04b917eed033b0cfa1a", "score": "0.44780093", "text": "func EditProfile(w http.ResponseWriter, r *http.Request) {\n\tvar t models.User\n\n\terr := json.NewDecoder(r.Body).Decode(&t)\n\tif err != nil {\n\t\thttp.Error(w, \"the data is invalid\"+err.Error(), 400)\n\t\treturn\n\t}\n\n\tvar status bool\n\tstatus, err = db.EditRegister(t, IDUser)\n\tif err != nil {\n\t\thttp.Error(w, \"An error occurred when trying to modify the register. Please try again\"+err.Error(), 400)\n\t\treturn\n\t}\n\tif !status {\n\t\thttp.Error(w, \"It was not possible to modify the user's register in the db\"+err.Error(), 400)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusCreated)\n}", "title": "" }, { "docid": "b40e0d1f18c3e7475513203cdba5ff48", "score": "0.44374683", "text": "func (r *CreativesService) Insert(profileId int64, creative *Creative) *CreativesInsertCall {\n\tc := &CreativesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.creative = creative\n\treturn c\n}", "title": "" }, { "docid": "96c0399889c8675a94eb930c080c7ceb", "score": "0.44032994", "text": "func RoleCreate(r *models.Role) error {\n\tif r == nil {\n\t\tlog.Error(r)\n\t}\n\n\tif r.Name != \"\" {\n\t\t// Check if role already exists\n\t\tvar count uint\n\t\tbootstrap.Db().Where(\"name = ?\", r.Name).Find(&models.Role{}).Count(&count)\n\n\t\tif count == 0 {\n\t\t\terr := bootstrap.Db().Create(&r).Error\n\t\t\tif err != nil {\n\t\t\t\treturn errors.New(err.Error())\n\t\t\t}\n\t\t}\n\t} else {\n\t\treturn errors.New(\"role with empty name if forbidden\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "79e45999f37dc0ea193577568681ddfe", "score": "0.43947056", "text": "func (role *Role) Create() error {\n\tvar funcIDs []string\n\tfor _, fun := range role.Func {\n\t\tfuncIDs = append(funcIDs, fun.FuncID)\n\t}\n\tfuncs := []Func{}\n\tif errFunc := db.Where(\"func_id in (?)\", funcIDs).Find(&funcs).Error; errFunc != nil {\n\t\tlogger.Error(\"Failed to find role related system functions\", errFunc)\n\t\treturn errFunc\n\t}\n\trole.RoleID = util.GUID()\n\trole.Func = funcs\n\tif err := db.Create(&role).Association(\"Func\").Append(funcs).Error; err != nil {\n\t\tlogger.Error(\"Failed to create new role\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "63dcb2e6f4f44a50a1ff7ca2a2460e6c", "score": "0.43872628", "text": "func CreateRole(tstCtx diagnostics.TestContext, id string, action string) (*RoleInfo, error) {\n\troleInfo := RoleInfo{}\n\terr := MustJSONDecodeSuccess(\n\t\ttstCtx.DoLBRequest(\n\t\t\t\"/apis/iam/v2/roles\",\n\t\t\tlbrequest.WithMethod(\"POST\"),\n\t\t\tlbrequest.WithJSONStringTemplateBody(createRoleTemplate, struct {\n\t\t\t\tID string\n\t\t\t\tAction string\n\t\t\t}{\n\t\t\t\tID: id,\n\t\t\t\tAction: action,\n\t\t\t}),\n\t\t)).WithValue(&roleInfo)\n\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Could not create role\")\n\t}\n\n\treturn &roleInfo, nil\n}", "title": "" }, { "docid": "1a432cff219d4ea794755994926a3266", "score": "0.43707895", "text": "func (a *Api) addProfile(ctx context.Context, conf *models.Confirmation) error {\n\tif conf.CreatorId != \"\" {\n\t\tdoc, err := a.seagull.GetCollections(ctx, conf.CreatorId, []string{\"profile\"}, a.sl.TokenProvide())\n\t\tif err != nil {\n\t\t\tlog.Printf(\"error getting the creators profile [%v] \", err)\n\t\t\treturn err\n\t\t}\n\t\tif doc.Profile == nil {\n\t\t\terr := errors.New(\"profile is empty\")\n\t\t\tlog.Printf(\"error getting the creators profile [%v] \", err)\n\t\t\treturn err\n\t\t}\n\t\tconf.Creator.Profile = &models.Profile{FullName: doc.Profile.FullName}\n\t\tconf.Creator.UserId = conf.CreatorId\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b7c033bd7d4f3319ff34d405bfdbefd2", "score": "0.4368499", "text": "func (_PermInterface *PermInterfaceSession) AddNewRole(_roleId string, _orgId string, _access *big.Int, _voter bool, _admin bool) (*types.Transaction, error) {\n\treturn _PermInterface.Contract.AddNewRole(&_PermInterface.TransactOpts, _roleId, _orgId, _access, _voter, _admin)\n}", "title": "" }, { "docid": "f1a1ea88f5b48585f6634db168064e6e", "score": "0.43650588", "text": "func (_PermInterface *PermInterfaceTransactorSession) AddNewRole(_roleId string, _orgId string, _access *big.Int, _voter bool, _admin bool) (*types.Transaction, error) {\n\treturn _PermInterface.Contract.AddNewRole(&_PermInterface.TransactOpts, _roleId, _orgId, _access, _voter, _admin)\n}", "title": "" }, { "docid": "ceb8a6aff48883ed923133b58bad2ad0", "score": "0.43436804", "text": "func ModProfile(w http.ResponseWriter, r *http.Request) {\n\tvar (\n\t\tt models.User\n\t\tstatus bool\n\t)\n\n\terr := json.NewDecoder(r.Body).Decode(&t)\n\tif err != nil {\n\t\thttp.Error(w, \"Data Wrong \"+err.Error(), 400)\n\t\treturn\n\t}\n\n\tstatus, err = db.ModRe(t, IDUsuario)\n\tif err != nil {\n\t\thttp.Error(w, \"Error modifying user \"+err.Error(), 400)\n\t\treturn\n\t}\n\n\tif !status {\n\t\thttp.Error(w, \"An attempt to modify the user failed \", 400)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusCreated)\n}", "title": "" }, { "docid": "f5f92a929bfde483d23e340084b86b0f", "score": "0.4336111", "text": "func (r *AdsService) Insert(profileId int64, ad *Ad) *AdsInsertCall {\n\tc := &AdsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.ad = ad\n\treturn c\n}", "title": "" }, { "docid": "a6a38c6c5f27bcaab3df6a3b38f37842", "score": "0.4327273", "text": "func (mpRepo *ManageProfileRepository) StoreProfile(user *entity.Profile) (*entity.Profile, []error) {\n\tprf := user\n\terrs := mpRepo.conn.Create(prf).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn prf, errs\n}", "title": "" }, { "docid": "64c3c0e6e039204828161f86a0fd08fe", "score": "0.43255818", "text": "func (a *api) h_POST_profiles(c *gin.Context) {\n\ta.logger.Info(\"POST /profiles\")\n\n\tvar p Profile\n\tif a.errorResponse(c, bindAppJson(c, &p)) {\n\t\treturn\n\t}\n\n\tprf, err := a.profile2mprofile(&p)\n\tif a.errorResponse(c, err) {\n\t\treturn\n\t}\n\n\taCtx := a.getAuthContext(c)\n\tif a.errorResponse(c, aCtx.AuthZHasOrgLevel(prf.OrgId, auth.AUTHZ_LEVEL_OU)) {\n\t\treturn\n\t}\n\n\tpid, err := a.Dc.InsertProfile(prf)\n\tif a.errorResponse(c, err) {\n\t\treturn\n\t}\n\n\tw := c.Writer\n\turi := composeURI(c.Request, strconv.FormatInt(pid, 10))\n\ta.logger.Debug(\"New profile with location \", uri, \" has been just created\")\n\tw.Header().Set(\"Location\", uri)\n\tc.Status(http.StatusCreated)\n}", "title": "" }, { "docid": "3dd3e755f85b3e28b12c60b5e831b775", "score": "0.43157458", "text": "func (c *UserStore) Add(ctx context.Context, u *chronograf.User) (*chronograf.User, error) {\n\tif err := c.Ctrl.CreateUser(ctx, u.Name, u.Passwd); err != nil {\n\t\treturn nil, err\n\t}\n\tperms := ToEnterprise(u.Permissions)\n\n\tif err := c.Ctrl.SetUserPerms(ctx, u.Name, perms); err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, role := range u.Roles {\n\t\tif err := c.Ctrl.AddRoleUsers(ctx, role.Name, []string{u.Name}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn c.Get(ctx, chronograf.UserQuery{Name: &u.Name})\n}", "title": "" }, { "docid": "b9208105c1cf5c366de8506091a6fff3", "score": "0.43155992", "text": "func (treeNode *TreeNode) insertRole(role Role) {\n\tif treeNode.Role.Id == role.Parent {\n\t\tnewNode := NewTreeNode(role)\n\t\ttreeNode.Subordinates = append(treeNode.Subordinates, newNode)\n\t} else {\n\t\tfor idx := range treeNode.Subordinates {\n\t\t\tsubordinate := treeNode.Subordinates[idx]\n\t\t\tsubordinate.insertRole(role)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0549eaaf0eb26a945ab06c439880584e", "score": "0.4314327", "text": "func (r *ProjectsRolesService) Create(parent string, createrolerequest *CreateRoleRequest) *ProjectsRolesCreateCall {\n\tc := &ProjectsRolesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\tc.createrolerequest = createrolerequest\n\treturn c\n}", "title": "" }, { "docid": "6996bb0be4e7855e00c8fd2d8db54750", "score": "0.43095094", "text": "func (a *Client) CreateRole(params *CreateRoleParams) error {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewCreateRoleParams()\n\t}\n\n\t_, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"createRole\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/roles\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &CreateRoleReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n\n}", "title": "" }, { "docid": "e89b688f7f762089446399dcc121df91", "score": "0.43024176", "text": "func (cli *Service) CreateRolePri(req *restful.Request, resp *restful.Response) {\n\n\tlanguage := util.GetActionLanguage(req)\n\townerID := util.GetOwnerID(req.Request.Header)\n\tdefErr := cli.Core.CCErr.CreateDefaultCCErrorIf(language)\n\tctx := util.GetDBContext(context.Background(), req.Request.Header)\n\tdb := cli.Instance.Clone()\n\n\tpathParams := req.PathParameters()\n\tobjID := pathParams[\"bk_obj_id\"]\n\tpropertyID := pathParams[\"bk_property_id\"]\n\tvalue, err := ioutil.ReadAll(req.Request.Body)\n\tif err != nil {\n\t\tblog.Error(\"read json data error :%v\", err)\n\t\tresp.WriteError(http.StatusBadRequest, &meta.RespError{Msg: defErr.New(common.CCErrCommHTTPReadBodyFailed, err.Error())})\n\t\treturn\n\t}\n\tvar roleJSON []string\n\terr = json.Unmarshal([]byte(value), &roleJSON)\n\tif err != nil {\n\t\tblog.Error(\"read json data error :%v\", err)\n\t\tresp.WriteError(http.StatusBadRequest, &meta.RespError{Msg: defErr.New(common.CCErrCommJSONUnmarshalFailed, err.Error())})\n\t\treturn\n\t}\n\tinput := make(map[string]interface{})\n\tinput[common.BKOwnerIDField] = ownerID\n\tinput[common.BKObjIDField] = objID\n\tinput[common.BKPropertyIDField] = propertyID\n\tinput[common.BKPrivilegeField] = roleJSON\n\tinput = util.SetModOwner(input, ownerID)\n\n\terr = db.Table(common.BKTableNamePrivilege).Insert(ctx, input)\n\tif nil != err {\n\t\tblog.Error(\"create role privilege error :%v\", err)\n\t\tresp.WriteError(http.StatusBadRequest, &meta.RespError{Msg: defErr.New(common.CCErrObjectDBOpErrno, err.Error())})\n\t\treturn\n\t}\n\n\tresp.WriteEntity(meta.Response{BaseResp: meta.SuccessBaseResp})\n}", "title": "" }, { "docid": "2f11e30f4893ed6e4521612b78a77952", "score": "0.42989784", "text": "func (s *Server) CreateRole(ctx context.Context, params *authorization.Role) (*authorization.Role, error) {\n\treturn &authorization.Role{}, nil\n}", "title": "" }, { "docid": "b4202787e2c34926f46e6619d35ad83d", "score": "0.4295981", "text": "func (pg *PGUser) Add(in *user.User) (err error) {\n\tfmt.Printf(\"\\nPGUser in: %+v\\n\", in)\n\tif err := pg.DB.Create(in).Scan(&in); err != nil {\n\t\treturn oops.Err(err.Error)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "31c2989b46072854d10676dec34ad5c7", "score": "0.42958215", "text": "func (u *User) Create(ctx context.Context, log *log.Logger, w http.ResponseWriter, r *http.Request, params map[string]string) error {\n\tvar newU NewUser\n\n\tif err := web.Unmarshal(r.Body, &newU); err != nil {\n\t\treturn errors.Wrap(err, \"\")\n\t}\n\n\tid, err := uuid.NewV4()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tuserDetails := UserDetails{\n\t\tUserName: newU.UserName,\n\t\tEmail: newU.Email,\n\t\tID: id.String(),\n\t}\n\n\tencodedData, err := json.Marshal(userDetails)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdbConn := u.MasterDB\n\n\t// Save User by ID\n\tfID := func(db *leveldb.DB) error {\n\t\t// TODO: while inserting validate if email already exists by checking with email index\n\t\treturn db.Put([]byte(userDetails.ID), encodedData, nil)\n\t}\n\n\t// Save User by Email\n\tfEmail := func(db *leveldb.DB) error {\n\t\t// TODO: while inserting validate if already exists or not\n\t\treturn db.Put([]byte(userDetails.Email), []byte(userDetails.ID), nil)\n\t}\n\n\tif err := dbConn.Execute(fID); err != nil {\n\t\treturn errors.Wrap(err, \"\")\n\t}\n\n\tif err := dbConn.Execute(fEmail); err != nil {\n\t\t// TODO: if error remove the data from ID as well and throw error\n\t\treturn errors.Wrap(err, \"\")\n\t}\n\n\tstatus := struct {\n\t\tID string `json:\"id\"`\n\t}{\n\t\tID: userDetails.ID,\n\t}\n\tweb.Respond(ctx, log, w, status, http.StatusCreated)\n\treturn nil\n}", "title": "" }, { "docid": "2b5847a6843ee3b3473a577c201c56cf", "score": "0.42817613", "text": "func (c *UsersController) Add(ctx *app.AddUsersContext) error {\n\t// UsersController_Add: start_implement\n\n\t// Put your logic here\n\tat := time.Now()\n\thashed, err := bcrypt.GenerateFromPassword([]byte(ctx.Payload.Password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn ctx.InternalServerError(goa.ErrInternal(err))\n\t}\n\tuser := &models.User{\n\t\tScreenName: ctx.Payload.ScreenName,\n\t\tPassword: string(hashed),\n\t\tPrivilegeID: uint64(ctx.Payload.PrivilegeID),\n\t\tCreatedAt: at,\n\t\tUpdatedAt: at,\n\t}\n\n\terr = user.Insert(c.db)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn ctx.InternalServerError(goa.ErrInternal(ErrInternalServerError))\n\t}\n\n\tres := &app.User{\n\t\tID: user.ID,\n\t\tScreenName: user.ScreenName,\n\t\tCreatedAt: at.Unix(),\n\t\tUpdatedAt: at.Unix(),\n\t}\n\n\treturn ctx.Created(res)\n\t// UsersController_Add: end_implement\n}", "title": "" }, { "docid": "7628b27a830e781a23373eb59e954bc1", "score": "0.42764124", "text": "func (c *Controller) CreateMembership(w http.ResponseWriter, req *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\n\t//connect to database\n\tdb, err := c.Session.Connect()\n\tif err != nil {\n\t\terror := models.RespError{Error: \"Failed to connect, cannot reach database\"}\n\t\tresp, _ := json.Marshal(error)\n\t\thttp.Error(w, string(resp), 400)\n\t\tc.Logger.Logging(req, 400)\n\t\treturn\n\t}\n\tdefer db.Close()\n\n\tauth := models.Authentication{Decoded: context.Get(req, \"decoded\")}\n\tok, err := auth.Authorize(db, 3)\n\tif err != nil {\n\t\terror := models.RespError{Error: \"Failed to authorize, error during authorization\"}\n\t\tresp, _ := json.Marshal(error)\n\t\thttp.Error(w, string(resp), 400)\n\t\tc.Logger.Logging(req, 400)\n\t\treturn\n\t}\n\tif !ok {\n\t\terror := models.RespError{Error: \"Failed to authorize, error during authorization. Make sure you have permissions to use this route.\"}\n\t\tresp, _ := json.Marshal(error)\n\t\thttp.Error(w, string(resp), 401)\n\t\tc.Logger.Logging(req, 401)\n\t\treturn\n\t}\n\n\tparams := mux.Vars(req)\n\tid, err := strconv.Atoi(params[\"id\"])\n\tif err != nil {\n\t\terror := models.RespError{Error: \"Id is required in route\"}\n\t\tresp, _ := json.Marshal(error)\n\t\thttp.Error(w, string(resp), 400)\n\t\tc.Logger.Logging(req, 400)\n\t\treturn\n\t}\n\n\ttranstype := req.URL.Query().Get(\"type\")\n\tif transtype == \"\" {\n\t\ttranstype = \"Unknown\"\n\t}\n\n\tvar membership models.Membership\n\terr = json.NewDecoder(req.Body).Decode(&membership)\n\tif err != nil {\n\t\terror := models.RespError{Error: \"Failed to parse request. Please make sure request is valid format\"}\n\t\tresp, _ := json.Marshal(error)\n\t\thttp.Error(w, string(resp), 404)\n\t\tc.Logger.Logging(req, 404)\n\t\treturn\n\t}\n\n\tplayer := models.Player{Id: id}\n\terr = player.GetPlayer(db)\n\tif err != nil {\n\t\terror := models.RespError{Error: \"Failed to find player\"}\n\t\tresp, _ := json.Marshal(error)\n\t\thttp.Error(w, string(resp), 404)\n\t\tc.Logger.Logging(req, 404)\n\t\treturn\n\t}\n\tmembership.EmployeeID = auth.EmployeeID\n\tmembership.PlayerID = player.Id\n\tmembership.PlayTime = (membership.Amount / 10) * 3600\n\tmembership.ActiveDate = time.Now().Format(time.RFC3339)\n\tmembership.DeactiveDate = time.Now().AddDate(20, 0, 0).Format(time.RFC3339)\n\tmembership.Active = true\n\n\terr = membership.CreateMembership(db, transtype)\n\tif err != nil {\n\t\terror := models.RespError{Error: \"Failed to create membership for player\"}\n\t\tresp, _ := json.Marshal(error)\n\t\thttp.Error(w, string(resp), 404)\n\t\tc.Logger.Logging(req, 404)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tc.Logger.Logging(req, 200)\n\tjson.NewEncoder(w).Encode(membership)\n\treturn\n}", "title": "" }, { "docid": "3c7751a810b429b25e2b587d95bf82eb", "score": "0.42751163", "text": "func (auup *AuthUserUserPermission) Insert(ctx context.Context, db DB) error {\n\tswitch {\n\tcase auup._exists: // already exists\n\t\treturn logerror(&ErrInsertFailed{ErrAlreadyExists})\n\tcase auup._deleted: // deleted\n\t\treturn logerror(&ErrInsertFailed{ErrMarkedForDeletion})\n\t}\n\t// insert (primary key generated and returned by database)\n\tconst sqlstr = `INSERT INTO django.auth_user_user_permissions (` +\n\t\t`user_id, permission_id` +\n\t\t`) VALUES (` +\n\t\t`:1, :2` +\n\t\t`) RETURNING id INTO :3`\n\t// run\n\tlogf(sqlstr, auup.UserID, auup.PermissionID)\n\tvar id int64\n\tif _, err := db.ExecContext(ctx, sqlstr, auup.UserID, auup.PermissionID, sql.Out{Dest: &id}); err != nil {\n\t\treturn logerror(err)\n\t} // set primary key\n\tauup.ID = int64(id)\n\t// set exists\n\tauup._exists = true\n\treturn nil\n}", "title": "" }, { "docid": "6f5fc2a7b358270e64aca3eb69f013b8", "score": "0.4268666", "text": "func (r *OAuthProfileResource) Create(item OAuthProfileConfig) error {\n\tif err := r.c.ModQuery(\"POST\", BasePath+OAuthProfileEndpoint, item); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "85950c204ad8034da3816111901b6442", "score": "0.42619866", "text": "func (db *RoleDB) AddRole(role models.Role) error {\n\t_, err := db.collection.\n\t\tInsertOne(timeoutContext(), role)\n\treturn err\n}", "title": "" }, { "docid": "607cc5223b52771a89ea6b9ef361d8d1", "score": "0.4261774", "text": "func (c *UsersController) Create(ctx *app.CreateUsersContext) error {\n\t// UsersController_Create: start_implement\n\n\t// Put your logic here\n\t// initialize new user struct object\n\tuser := &types.User{\n\t\tCognitoAuthUserID: ctx.Payload.CognitoAuthUserID,\n\t\tWallet: &types.Wallet{},\n\t}\n\n\t// insert the AWS cognito user ID into the coindrop_auth table\n\terr := c.db.AddUserID(user.CognitoAuthUserID)\n\tif err != nil {\n\t\tlog.Errorf(\"[controller/user] %v\", err)\n\t\treturn ctx.BadRequest(&app.StandardError{\n\t\t\tCode: 400,\n\t\t\tMessage: \"could not insert user to db\",\n\t\t})\n\t}\n\n\tlog.Printf(\"[controller/user] successfully added coindrop user: %v\\n\", user.CognitoAuthUserID)\n\n\tres := &app.User{\n\t\tID: \"\",\n\t\tCognitoAuthUserID: &user.CognitoAuthUserID,\n\t\tWalletAddress: &user.Wallet.Address,\n\t}\n\n\treturn ctx.OK(res)\n\t// UsersController_Create: end_implement\n}", "title": "" }, { "docid": "88dc33fe73ad5ba580941540043e96b8", "score": "0.42505905", "text": "func addProfile(ctx context.Context, args []string) error {\n\tm, err := cmdutils.LoadManager(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(args) < 1 {\n\t\treturn errors.New(\"argument missing: id\")\n\t}\n\n\tprofileId := args[0]\n\tprofilePath := \"\"\n\tif len(args) > 1 {\n\t\tprofilePath = args[1]\n\t}\n\n\tvar profile *v1.Profile\n\tif profilePath != \"\" {\n\t\tif p, err := manager.LoadProfile(m.Fs(), profilePath); err != nil {\n\t\t\treturn err\n\t\t} else {\n\t\t\tprofile = p\n\t\t}\n\t} else {\n\t\tprofile = v1.NewProfile(profileId)\n\t}\n\n\tif err := m.AddProfile(profile); err != nil {\n\t\tfmt.Printf(\"error saving profile: %v\\n\", err)\n\t\tfmt.Printf(\"Could not save to: %s\\n\", profilePath)\n\t\treturn nil\n\t}\n\n\tfmt.Printf(\"[%s] created at: %s\\n\", profile.Id, profilePath)\n\treturn nil\n}", "title": "" }, { "docid": "42f89f52226201a1c7efaee20e8cab54", "score": "0.42495453", "text": "func (z *User) AddRole(role string) {\n\tif !z.HasRole(role) {\n\t\tz.Roles = append(z.Roles, role)\n\t}\n}", "title": "" }, { "docid": "c51b55d1e408740a5eb9e3e761245ca3", "score": "0.42422566", "text": "func (r *SubaccountsService) Insert(profileId int64, subaccount *Subaccount) *SubaccountsInsertCall {\n\tc := &SubaccountsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.subaccount = subaccount\n\treturn c\n}", "title": "" }, { "docid": "353b32c949ad1ae7d1d9a95e1cbc6a59", "score": "0.42347237", "text": "func Put(r *http.Request) (*datastore.Key, error) {\n\tctx := appengine.NewContext(r)\n\trole := new(Role)\n\tif r.PostFormValue(\"roleLang\") == \"en_us\" {\n\t\trole.ID = r.PostFormValue(\"roleValue\")\n\t\tkey := datastore.NewKey(ctx, \"Roles\", role.ID, 0, nil)\n\t}\n\trole.Values[r.PostFormValue(\"roleLang\")] =\n\t\tr.PostFormValue(r.PostFormValue(roleValue))\n\t_, err := datastore.Put(ctx, key, role)\n\treturn err\n}", "title": "" }, { "docid": "47a3dc9f40d56d07fb27327f51728cff", "score": "0.4232325", "text": "func (r *AccountUserProfilesService) Update(profileId int64, accountuserprofile *AccountUserProfile) *AccountUserProfilesUpdateCall {\n\tc := &AccountUserProfilesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.accountuserprofile = accountuserprofile\n\treturn c\n}", "title": "" }, { "docid": "2e88315a696d93e41d351c88de5660e0", "score": "0.42279473", "text": "func ModifiedProfile(w http.ResponseWriter, r *http.Request) {\n\tvar t *models.User\n\n\terr := json.NewDecoder(r.Body).Decode(&t)\n\tif err != nil {\n\t\thttp.Error(w, \"Incorrects fields \"+err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tvar status bool\n\n\tstatus, err = db.ModifiedRegister(t, UserID)\n\tif err != nil {\n\t\thttp.Error(w, \"Error to modified the user register \"+err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif !status {\n\t\thttp.Error(w, \"Don't modified the user register \"+err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusCreated)\n}", "title": "" }, { "docid": "d778e116a0227212713611b88dce67d1", "score": "0.42219403", "text": "func Add(ctx context.Context, gql *graphql.GraphQL, nu NewUser, now time.Time) (User, error) {\n\thash, err := bcrypt.GenerateFromPassword([]byte(nu.Password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn User{}, errors.Wrap(err, \"generating password hash\")\n\t}\n\n\tu := User{\n\t\tName: nu.Name,\n\t\tEmail: nu.Email,\n\t\tRole: nu.Role,\n\t\tPasswordHash: string(hash),\n\t\tDateCreated: now,\n\t\tDateUpdated: now,\n\t}\n\n\tu, err = add(ctx, gql, u)\n\tif err != nil {\n\t\treturn User{}, errors.Wrap(err, \"adding user to database\")\n\t}\n\n\treturn u, nil\n}", "title": "" }, { "docid": "dc338fd3e8d49c08bb9b0110340bcca2", "score": "0.42187503", "text": "func (usr *User) Insert() error {\n\tif _, err := orm.NewOrm().Insert(usr); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "229bb01f753a9a7fe21aac21a301d460", "score": "0.4213449", "text": "func NewPostUserRole(ctx *middleware.Context, handler PostUserRoleHandler) *PostUserRole {\n\treturn &PostUserRole{Context: ctx, Handler: handler}\n}", "title": "" }, { "docid": "fa95f1afe51bc5ba885380887cdc1e4d", "score": "0.42128944", "text": "func Add(a Account) User {\n\tsalt := random.GetSecureBytes(32)\n\thashedPassword := argon2.IDKey([]byte(a.Password), salt, 4, 32*1024, 4, 32)\n\tvar args []interface{}\n\targs = append(args, a.Email, a.Username, hashedPassword, salt, a.Avatar)\n\trows, err := database.Query(\"INSERT INTO Account (email, username, password, salt, avatar) Values (?, ?, ?, ?, ?);\", args)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tdefer rows.Close()\n\treturn User{Username: a.Username, Email: a.Email, Avatar: a.Avatar}\n}", "title": "" }, { "docid": "bd2c4f7d48686649d140ac0b8c44d0b4", "score": "0.42091206", "text": "func AddUserProjectRole(userID int, projectID int64, roleID int) error {\n\n\to := orm.NewOrm()\n\n\tvar pr []models.ProjectRole\n\n\tvar prID int\n\n\tsql := `select pr.pr_id, pr.project_id, pr.role_id from project_role pr where pr.project_id = ? and pr.role_id = ?`\n\tn, err := o.Raw(sql, projectID, roleID).QueryRows(&pr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif n == 0 { //project role not found, insert a pr record\n\t\tp, err := o.Raw(\"insert into project_role (project_id, role_id) values (?, ?)\").Prepare()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer p.Close()\n\t\tr, err := p.Exec(projectID, roleID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tid, err := r.LastInsertId()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tprID = int(id)\n\t} else if n > 0 {\n\t\tprID = pr[0].PrID\n\t}\n\tp, err := o.Raw(\"insert into user_project_role (user_id, pr_id) values (?, ?)\").Prepare()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer p.Close()\n\t_, err = p.Exec(userID, prID)\n\treturn err\n}", "title": "" }, { "docid": "ec31ad2b34ef61bdca7b5b4252e681a8", "score": "0.4208402", "text": "func (c *Store) AddProfile(msg *messages.JSONProfile, refresh profileFunc) {\n\tc.ProfileLock.Lock()\n\tdefer c.ProfileLock.Unlock()\n\n\taddr := msg.Fingerprint\n\tif msg.Fingerprint == \"\" {\n\t\taddr = msg.Alias\n\t}\n\n\tretrieved := time.Now()\n\texpiry := retrieved.Add(profileExpiryFrequency)\n\n\tc.Profiles[addr] = &ProfileRecord{\n\t\tJSONProfile: msg,\n\t\tUpdater: refresh,\n\t\trecord: record{\n\t\t\tRetrieved: retrieved,\n\t\t\tExpires: expiry,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "db5f497f9b440ee94f4f277436e6f4e3", "score": "0.42023924", "text": "func (m *Manager) insertCookieProfile(key string, ip net.IP) (*CookieProfile, error) {\n\thash := utils.Hash(fmt.Sprintf(\"a_new_cookie_%s\", key))\n\tipNullString := toNullString(ip.String())\n\tdate := toNullInt64(time.Now().Unix())\n\tco := &CookieProfile{\n\t\tKey: key,\n\t\tIP: ipNullString,\n\t\tDate: date,\n\t}\n\tco.ID = randInt64()\n\t_ = store(hash, co, 3*24*time.Hour)\n\n\treturn co, nil\n}", "title": "" }, { "docid": "16e59005fc9304693201e984f970f925", "score": "0.41969723", "text": "func AddRole(id string, role models.Role) error {\n\tuser_role_modification := models.UserRoleModification{ID: id, Role: role}\n\n\tstatus, err := apirequest.Put(config.AUTH_SERVICE+\"/auth/roles/add/\", &user_role_modification, nil)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif status != http.StatusOK {\n\t\treturn errors.New(\"Auth service failed to update roles.\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "776736cd51cd9dd2db0d72f0fb542308", "score": "0.41925395", "text": "func (r *mutationResolver) CreateRole(ctx context.Context, input *models.CreateRoleInput) (*user.Role, error) {\n\tpanic(\"not implemented\")\n}", "title": "" }, { "docid": "aef2fed8a4b158889ee314c7cc546eb1", "score": "0.41916555", "text": "func (r *CreativeFieldsService) Insert(profileId int64, creativefield *CreativeField) *CreativeFieldsInsertCall {\n\tc := &CreativeFieldsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.creativefield = creativefield\n\treturn c\n}", "title": "" }, { "docid": "8b75d1946ef38726c29b68cabeaf69dd", "score": "0.4190953", "text": "func (m *GormRoleMappingRepository) Create(ctx context.Context, u *RoleMapping) error {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"role_mapping\", \"create\"}, time.Now())\n\tif u.RoleMappingID == uuid.Nil {\n\t\tu.RoleMappingID = uuid.NewV4()\n\t}\n\terr := m.db.Create(u).Error\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"role_mapping_id\": u.RoleMappingID,\n\t\t\t\"err\": err,\n\t\t}, \"unable to create the role mapping\")\n\t\treturn errs.WithStack(err)\n\t}\n\tlog.Debug(ctx, map[string]interface{}{\n\t\t\"role_mapping_id\": u.RoleMappingID,\n\t}, \"Role mapping created!\")\n\treturn nil\n}", "title": "" }, { "docid": "3060075559d8ae12684e831d9670c36f", "score": "0.41863197", "text": "func (s *profileStructData) Add(options map[string]interface{}) (riminderResponse.ProfileJSONAddElem, error) {\n\tresp := riminderResponse.ProfileJSONAddContainer{}\n\n\terr := s.client.Post(\"profile/json\", options, &resp)\n\tif err != nil {\n\t\treturn riminderResponse.ProfileJSONAddElem{}, err\n\t}\n\treturn resp.Data, nil\n}", "title": "" }, { "docid": "fa332f9229a88af16cf066d0bf531bbd", "score": "0.41799682", "text": "func (r *CreativeGroupsService) Insert(profileId int64, creativegroup *CreativeGroup) *CreativeGroupsInsertCall {\n\tc := &CreativeGroupsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.creativegroup = creativegroup\n\treturn c\n}", "title": "" }, { "docid": "e1bbb90cfacbd007c2e9bc948873260b", "score": "0.41792887", "text": "func (_PermInterface *PermInterfaceTransactor) AddNewRole(opts *bind.TransactOpts, _roleId string, _orgId string, _access *big.Int, _voter bool, _admin bool) (*types.Transaction, error) {\n\treturn _PermInterface.contract.Transact(opts, \"addNewRole\", _roleId, _orgId, _access, _voter, _admin)\n}", "title": "" }, { "docid": "4c1d213e9c17112ca9e0905680eb64b9", "score": "0.41735908", "text": "func (r *CampaignsService) Insert(profileId int64, campaign *Campaign) *CampaignsInsertCall {\n\tc := &CampaignsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.campaign = campaign\n\treturn c\n}", "title": "" }, { "docid": "434d0ddb577ec866ff7dbe0a81150d46", "score": "0.4165651", "text": "func (m *LDAPRoleMap) Add(group, roleID string) error {\n\tenv := GetEnvironment()\n\tctx, cancel := env.Context()\n\tdefer cancel()\n\tcoll := env.DB().Collection(ConfigCollection)\n\ts := &Settings{}\n\n\tres, err := coll.UpdateOne(\n\t\tctx,\n\t\tbyId(s.SectionId()),\n\t\tbson.M{\n\t\t\t\"$set\": bson.M{\n\t\t\t\tbsonutil.GetDottedKeyName(ldapRoleMapKey, \"$[elem]\", ldapRoleMappingRoleIDKey): roleID,\n\t\t\t},\n\t\t},\n\t\toptions.Update().SetArrayFilters(options.ArrayFilters{\n\t\t\tFilters: []interface{}{\n\t\t\t\tbson.M{\n\t\t\t\t\tbsonutil.GetDottedKeyName(\"elem\", ldapRoleMappingLDAPGroupKey): bson.M{\"$eq\": group},\n\t\t\t\t},\n\t\t\t},\n\t\t}),\n\t)\n\n\tif err != nil || res.MatchedCount > 0 {\n\t\treturn errors.Wrapf(err, \"adding '%s:%s' to the LDAP-role map\", group, roleID)\n\t}\n\n\t_, err = coll.UpdateOne(ctx, byId(s.SectionId()), bson.M{\n\t\t\"$push\": bson.M{\n\t\t\tldapRoleMapKey: bson.M{\n\t\t\t\tldapRoleMappingLDAPGroupKey: group,\n\t\t\t\tldapRoleMappingRoleIDKey: roleID,\n\t\t\t},\n\t\t},\n\t}, options.Update().SetUpsert(true))\n\n\treturn errors.Wrapf(err, \"adding '%s:%s' to the LDAP-role map\", group, roleID)\n}", "title": "" }, { "docid": "75abee123f7746999e398775b81b82e4", "score": "0.4154625", "text": "func (r User) Insert() error {\n\tr.ID = bson.NewObjectId()\n\terr := db.C(\"user\").Insert(&r)\n\treturn err\n}", "title": "" }, { "docid": "9342aefcf210df8fec3e9c05d5fd6444", "score": "0.4149765", "text": "func CreateNewUserProfile(path string) error {\n\tnewProfile := &Profile{\n\t\tROOT: struct {\n\t\t\tId string `json:\"id\"`\n\t\t\tDir bool `json:\"dir\"`\n\t\t\tName string `json:\"name\"`\n\t\t\tLevel int `json:\"level\"`\n\t\t\tChildren []string `json:\"children\"`\n\t\t\tParent string `json:\"parent\"`\n\t\t}(struct {\n\t\t\tId string\n\t\t\tDir bool\n\t\t\tName string\n\t\t\tLevel int\n\t\t\tChildren []string\n\t\t\tParent string\n\t\t}{Id: \"ROOT\", Dir: true, Name: \"ROOT\", Level: 0, Children: make([]string, 0), Parent: \"NONE\"}),\n\t}\n\tbyteVal, err := json.Marshal(newProfile)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = ioutil.WriteFile(path, byteVal, 0644)\n\treturn err\n}", "title": "" }, { "docid": "7beed18957b323eefb9eadcd1a3a5a9e", "score": "0.41432253", "text": "func AddUserRole(client *gophercloud.ServiceClient, tenantID, userID, roleID string) UserRoleResult {\n\tvar result UserRoleResult\n\t_, result.Err = client.Put(userRoleURL(client, tenantID, userID, roleID), nil, nil, nil)\n\treturn result\n}", "title": "" }, { "docid": "58c471a2f1658ff89ff3ec87a4226d82", "score": "0.41376644", "text": "func AddSecUser(m *SecUser) (id int64, err error) {\n\to := orm.NewOrm()\n\tid, err = o.Insert(m)\n\treturn\n}", "title": "" }, { "docid": "57b0dfe5b52aeba667139adcd1fa7bdf", "score": "0.41296068", "text": "func (s *Store) AssignRole(ctx context.Context, roleUser *RoleUser) error {\n\terr := roleUser.Validate()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = s.FindRoleByID(ctx, roleUser.RoleID)\n\tif err != nil {\n\t\treturn errors.Wrap(err, errors.ErrorNotFound, \"\")\n\t}\n\n\tselectedRoleUser := &RoleUser{}\n\terr = s.db.QueryRowxContext(\n\t\tctx,\n\t\t\"SELECT * FROM roles_users WHERE role_id = ? AND user_id = ? FOR UPDATE\",\n\t\troleUser.RoleID, roleUser.UserID,\n\t).StructScan(selectedRoleUser)\n\tif err != nil && err != sql.ErrNoRows {\n\t\treturn errors.Wrap(err, errors.ErrorUnknown, \"\")\n\t}\n\tif err == nil {\n\t\treturn errors.New(errors.ErrorAlreadyExists, \"\")\n\t}\n\n\t_, err = sqlx.NamedExecContext(\n\t\tctx,\n\t\ts.db,\n\t\t\"INSERT INTO roles_users (role_id, user_id) VALUES (:role_id, :user_id)\",\n\t\t&roleUser)\n\tif err != nil {\n\t\treturn errors.Wrap(err, errors.ErrorUnknown, \"\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6abb1e57f8dd00a720661ddc6ea1ab5e", "score": "0.41242522", "text": "func NewRole(f *RolePostForm, t time.Time) *Role {\n\trole := Role{\n\t\tID: f.ID,\n\t\tName: f.Name,\n\t\tPassword: f.Password,\n\t\tRegDate: t}\n\n\treturn &role\n}", "title": "" }, { "docid": "767bee8b8811f56f691f1f1d6d474238", "score": "0.41177517", "text": "func (r *SSHProfileResource) Create(item SSHProfileConfig) error {\n\tif err := r.c.ModQuery(\"POST\", BasePath+SSHProfileEndpoint, item); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0a37ce64f619348303005f38068a3944", "score": "0.41071218", "text": "func (r *mutationResolver) CreateUserRoleRelationship(ctx context.Context, userID string, roleID string) (*user.User, error) {\n\tpanic(\"not implemented\")\n}", "title": "" }, { "docid": "6e130e7587ff2ad9b3f986915652bb1c", "score": "0.41065896", "text": "func (store *Store) AddRole(role *graylog.Role) error {\n\tstore.imutex.Lock()\n\tdefer store.imutex.Unlock()\n\tstore.roles[role.Name] = *role\n\treturn nil\n}", "title": "" } ]
6586eeb0e940bf99bc4713dfb30ba8ce
prepareRequest creates an HTTP request for an RPC. Initializes GetBody, so that the request can be resent multiple times when retrying.
[ { "docid": "dc9c8e3f87af37b5061871860f61729b", "score": "0.7016856", "text": "func (c *Client) prepareRequest(options *Options, md metadata.MD, requestMessage []byte) (*http.Request, error) {\n\t// Convert metadata into HTTP headers in canonical form (i.e. Title-Case).\n\t// Extract Host header, it is special and must be passed via\n\t// http.Request.Host. Preallocate 5 more slots (for 4 headers below and for\n\t// the RPC deadline header).\n\theaders := make(http.Header, len(md)+5)\n\tif err := metaIntoHeaders(md, headers); err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"prpc: headers: %s\", err)\n\t}\n\thostHdr := headers.Get(\"Host\")\n\theaders.Del(\"Host\")\n\n\t// Add protocol-related headers.\n\theaders.Set(\"Content-Type\", options.inFormat.MediaType())\n\theaders.Set(\"Accept\", options.outFormat.MediaType())\n\theaders.Set(\"User-Agent\", options.UserAgent)\n\n\tbody := requestMessage\n\tif c.EnableRequestCompression && len(requestMessage) > gzipThreshold {\n\t\theaders.Set(\"Content-Encoding\", \"gzip\")\n\t\tvar err error\n\t\tif body, err = compressBlob(requestMessage); err != nil {\n\t\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t\t}\n\n\t\t// Do not add \"Accept-Encoding: gzip\". The http package does this\n\t\t// automatically, and also decompresses the response.\n\t}\n\n\theaders.Set(\"Content-Length\", strconv.Itoa(len(body)))\n\n\tscheme := \"https\"\n\tif options.Insecure {\n\t\tscheme = \"http\"\n\t}\n\n\tpathPrefix := c.PathPrefix\n\tif c.PathPrefix == \"\" {\n\t\tpathPrefix = \"/prpc\"\n\t}\n\treturn &http.Request{\n\t\tMethod: \"POST\",\n\t\tURL: &url.URL{\n\t\t\tScheme: scheme,\n\t\t\tHost: options.host,\n\t\t\tPath: fmt.Sprintf(\"%s/%s/%s\", pathPrefix, options.serviceName, options.methodName),\n\t\t},\n\t\tHost: hostHdr,\n\t\tHeader: headers,\n\t\tContentLength: int64(len(body)),\n\t\tGetBody: func() (io.ReadCloser, error) {\n\t\t\treturn io.NopCloser(bytes.NewReader(body)), nil\n\t\t},\n\t}, nil\n}", "title": "" } ]
[ { "docid": "34054678f3e48a35b63c7ce6f732dbb4", "score": "0.7201337", "text": "func (d *DigitalOcean) prepareRequest(method, url string, body io.Reader) (*http.Request, error) {\n\treq, errNR := http.NewRequest(method, url, body)\n\tif errNR != nil {\n\t\treturn nil, errNR\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", d.token))\n\n\treturn req, nil\n}", "title": "" }, { "docid": "f3aa2d4f8d19fcd2b1fc34bcd6c948bf", "score": "0.6608039", "text": "func prepareApiRequest(_ context.Context, r *http.Request, request interface{}) error {\n\tvar buf bytes.Buffer\n\tif err := json.NewEncoder(&buf).Encode(request); err != nil {\n\t\treturn err\n\t}\n\tr.Body = ioutil.NopCloser(&buf)\n\treturn nil\n}", "title": "" }, { "docid": "8197939dd980e6c92ae1513dbddc01e6", "score": "0.6471887", "text": "func (f *filler) prepareRequest(test bool) (r *http.Request, err error) {\n\tform := f.form\n\tswitch form.Method {\n\tcase http.MethodPost:\n\t\tif !f.isMultipart {\n\t\t\tbody, err := f.BuildPost()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tr, err = f.createRequest(test, \"POST\", form.URL, bytes.NewReader(body))\n\t\t\tif err != nil {\n\t\t\t\terr = fmt.Errorf(\"Error creating post request: %w\", err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tr.Header.Add(\"Content-Type\", form.ContentType)\n\t\t} else {\n\t\t\tboundary, body, err := f.BuildMultipart()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tr, err = f.createRequest(test, \"POST\", form.URL, bytes.NewReader(body))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"Error creating multipart request: %w\", err)\n\n\t\t\t}\n\t\t\tr.Header.Add(\"Content-Type\",\n\t\t\t\tfmt.Sprintf(\"%s; boundary=%s\", ContentTypeMultipart, boundary))\n\t\t}\n\tdefault:\n\t\tquery, err := f.BuildGet()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\turl := fmt.Sprintf(\"%s?%s\", form.URL, query)\n\t\tr, err = f.createRequest(test, \"GET\", url, nil)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error creating get request: %w\", err)\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "9cfba31bb5052b77a5d528f18a5e873f", "score": "0.6453516", "text": "func prepareRequest(obj Service, url, method string) (*http.Request, error) {\n\tdata, err := json.Marshal(obj)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error marshalling Frontend\")\n\t}\n\tbuf := bytes.NewBuffer(data)\n\n\treq, err := http.NewRequest(method, url, buf)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error creatign http.Request\")\n\t}\n\treq.Header.Set(\"Content-Type\", jsonContent)\n\treturn req, nil\n}", "title": "" }, { "docid": "f59dca5e1af4a73edaa8a803a7807115", "score": "0.64445794", "text": "func (c *caller) prepareRequest(method, urlStr string, params *Parameters) (*http.Request, error) {\n\tif params == nil {\n\t\tparams = &Parameters{}\n\t}\n\tvar request *http.Request\n\tvar err error\n\tif method == \"GET\" || method == \"HEAD\" {\n\t\t// These allow only URL encoded.\n\t\trequest, err = http.NewRequest(method, urlStr, nil)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Annotate(err, ErrCannotPrepareRequest, errorMessages)\n\t\t}\n\t\tvalues, err := params.values()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trequest.URL.RawQuery = values.Encode()\n\t\trequest.Header.Set(\"Content-Type\", rest.ContentTypeURLEncoded)\n\t} else {\n\t\t// Here use the body for content.\n\t\tbody, err := params.body()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trequest, err = http.NewRequest(method, urlStr, body)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Annotate(err, ErrCannotPrepareRequest, errorMessages)\n\t\t}\n\t\trequest.Header.Set(\"Content-Type\", params.ContentType)\n\t}\n\tif params.Version != nil {\n\t\trequest.Header.Set(\"Version\", params.Version.String())\n\t}\n\tif params.Token != nil {\n\t\trequest = jwt.AddToRequest(request, params.Token)\n\t}\n\tif params.Accept == \"\" {\n\t\tparams.Accept = params.ContentType\n\t}\n\tif params.Accept != \"\" {\n\t\trequest.Header.Set(\"Accept\", params.Accept)\n\t}\n\treturn request, nil\n}", "title": "" }, { "docid": "60f67d9886e3b117e67dd7f58432bf19", "score": "0.63836473", "text": "func (request *ReadRequest) prepareRequest(descriptorRead bool) (adabasRequest *adatypes.Request, err error) {\n\tif request.definition == nil {\n\t\tadatypes.Central.Log.Debugf(\"Prepare request creating definition\")\n\t\terr = request.loadDefinition()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tif request.dynamic != nil {\n\t\t\tq := request.dynamic.CreateQueryFields()\n\t\t\terr = request.QueryFields(q)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\tparameter := &adatypes.AdabasRequestParameter{Store: false,\n\t\tDescriptorRead: descriptorRead, SecondCall: 0,\n\t\tMainframe: request.adabas.status.platform.IsMainframe(),\n\t\tBlockSize: request.BlockSize, PartialRead: request.PartialRead}\n\tadatypes.Central.Log.Debugf(\"Prepare request creating Adabas request\")\n\tadabasRequest, err = request.definition.CreateAdabasRequest(parameter)\n\tif err != nil {\n\t\treturn\n\t}\n\tadatypes.Central.Log.Debugf(\"Prepare decriptor read %v\", descriptorRead)\n\tadabasRequest.Definition = request.definition\n\tadabasRequest.PartialLobSize = request.BlockSize\n\tadabasRequest.RecordBufferShift = request.RecordBufferShift\n\tadatypes.Central.Log.Debugf(\"Partial LOB size: %d\", adabasRequest.PartialLobSize)\n\tadatypes.Central.Log.Debugf(\"Record shift set to: %d\", adabasRequest.RecordBufferShift)\n\tadabasRequest.HoldRecords = request.HoldRecords\n\tadabasRequest.Multifetch = request.Multifetch\n\tif request.Limit != 0 && request.Limit < uint64(request.Multifetch) {\n\t\tadabasRequest.Multifetch = uint32(request.Limit)\n\t}\n\tadatypes.Central.Log.Debugf(\"Got dynamic part: %v\", request.dynamic)\n\tif request.dynamic != nil {\n\t\tadabasRequest.DataType = request.dynamic\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "bfdc5d4d2fe5eacec3dd58cc7602c160", "score": "0.63402265", "text": "func (c *APIClient) prepareRequest(\n\tctx context.Context,\n\tpath string, method string,\n\tpostBody interface{},\n\theaderParams map[string]string,\n\tqueryParams url.Values,\n\tformParams url.Values,\n\tformFileName string,\n\tfileName string,\n\tfileBytes []byte) (localVarRequest *http.Request, err error) {\n\n\tvar body *bytes.Buffer\n\n\t// Detect postBody type and post.\n\tif postBody != nil {\n\t\tcontentType := headerParams[\"Content-Type\"]\n\t\tif contentType == \"\" {\n\t\t\tcontentType = detectContentType(postBody)\n\t\t\theaderParams[\"Content-Type\"] = contentType\n\t\t}\n\n\t\tbody, err = setBody(postBody, contentType)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// add form parameters and file if available.\n\tif strings.HasPrefix(headerParams[\"Content-Type\"], \"multipart/form-data\") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != \"\") {\n\t\tif body != nil {\n\t\t\treturn nil, errors.New(\"Cannot specify postBody and multipart form at the same time.\")\n\t\t}\n\t\tbody = &bytes.Buffer{}\n\t\tw := multipart.NewWriter(body)\n\n\t\tfor k, v := range formParams {\n\t\t\tfor _, iv := range v {\n\t\t\t\tif strings.HasPrefix(k, \"@\") { // file\n\t\t\t\t\terr = addFile(w, k[1:], iv)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t} else { // form value\n\t\t\t\t\tw.WriteField(k, iv)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif len(fileBytes) > 0 && fileName != \"\" {\n\t\t\tw.Boundary()\n\t\t\t//_, fileNm := filepath.Split(fileName)\n\t\t\tpart, err := w.CreateFormFile(formFileName, filepath.Base(fileName))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\t_, err = part.Write(fileBytes)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\t// Set the Boundary in the Content-Type\n\t\theaderParams[\"Content-Type\"] = w.FormDataContentType()\n\n\t\t// Set Content-Length\n\t\theaderParams[\"Content-Length\"] = fmt.Sprintf(\"%d\", body.Len())\n\t\tw.Close()\n\t}\n\n\tif strings.HasPrefix(headerParams[\"Content-Type\"], \"application/x-www-form-urlencoded\") && len(formParams) > 0 {\n\t\tif body != nil {\n\t\t\treturn nil, errors.New(\"Cannot specify postBody and x-www-form-urlencoded form at the same time.\")\n\t\t}\n\t\tbody = &bytes.Buffer{}\n\t\tbody.WriteString(formParams.Encode())\n\t\t// Set Content-Length\n\t\theaderParams[\"Content-Length\"] = fmt.Sprintf(\"%d\", body.Len())\n\t}\n\n\t// Setup path and query parameters\n\turl, err := url.Parse(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Override request host, if applicable\n\tif c.cfg.Host != \"\" {\n\t\turl.Host = c.cfg.Host\n\t}\n\n\t// Override request scheme, if applicable\n\tif c.cfg.Scheme != \"\" {\n\t\turl.Scheme = c.cfg.Scheme\n\t}\n\n\t// Adding Query Param\n\tquery := url.Query()\n\tfor k, v := range queryParams {\n\t\tfor _, iv := range v {\n\t\t\tquery.Add(k, iv)\n\t\t}\n\t}\n\n\t// Encode the parameters.\n\turl.RawQuery = query.Encode()\n\n\t// Generate a new request\n\tif body != nil {\n\t\tlocalVarRequest, err = http.NewRequest(method, url.String(), body)\n\t} else {\n\t\tlocalVarRequest, err = http.NewRequest(method, url.String(), nil)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// add header parameters, if any\n\tif len(headerParams) > 0 {\n\t\theaders := http.Header{}\n\t\tfor h, v := range headerParams {\n\t\t\theaders.Set(h, v)\n\t\t}\n\t\tlocalVarRequest.Header = headers\n\t}\n\n\t// Add the user agent to the request.\n\tlocalVarRequest.Header.Add(\"User-Agent\", c.cfg.UserAgent)\n\n\tif ctx != nil {\n\t\t// add context to the request\n\t\tlocalVarRequest = localVarRequest.WithContext(ctx)\n\n\t\t// Walk through any authentication.\n\n\t\t// OAuth2 authentication\n\t\tif tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok {\n\t\t\t// We were able to grab an oauth2 token from the context\n\t\t\tvar latestToken *oauth2.Token\n\t\t\tif latestToken, err = tok.Token(); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tlatestToken.SetAuthHeader(localVarRequest)\n\t\t}\n\n\t\t// Basic HTTP Authentication\n\t\tif auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok {\n\t\t\tlocalVarRequest.SetBasicAuth(auth.UserName, auth.Password)\n\t\t}\n\n\t\t// AccessToken Authentication\n\t\tif auth, ok := ctx.Value(ContextAccessToken).(string); ok {\n\t\t\tlocalVarRequest.Header.Add(\"Authorization\", \"Bearer \"+auth)\n\t\t}\n\n\t}\n\n\tfor header, value := range c.cfg.DefaultHeader {\n\t\tlocalVarRequest.Header.Add(header, value)\n\t}\n\treturn localVarRequest, nil\n}", "title": "" }, { "docid": "f5c6ca71ef893f18257d2786178b78d3", "score": "0.63402265", "text": "func (c *APIClient) prepareRequest(\n\tctx context.Context,\n\tpath string, method string,\n\tpostBody interface{},\n\theaderParams map[string]string,\n\tqueryParams url.Values,\n\tformParams url.Values,\n\tformFileName string,\n\tfileName string,\n\tfileBytes []byte) (localVarRequest *http.Request, err error) {\n\n\tvar body *bytes.Buffer\n\n\t// Detect postBody type and post.\n\tif postBody != nil {\n\t\tcontentType := headerParams[\"Content-Type\"]\n\t\tif contentType == \"\" {\n\t\t\tcontentType = detectContentType(postBody)\n\t\t\theaderParams[\"Content-Type\"] = contentType\n\t\t}\n\n\t\tbody, err = setBody(postBody, contentType)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// add form parameters and file if available.\n\tif strings.HasPrefix(headerParams[\"Content-Type\"], \"multipart/form-data\") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != \"\") {\n\t\tif body != nil {\n\t\t\treturn nil, errors.New(\"Cannot specify postBody and multipart form at the same time.\")\n\t\t}\n\t\tbody = &bytes.Buffer{}\n\t\tw := multipart.NewWriter(body)\n\n\t\tfor k, v := range formParams {\n\t\t\tfor _, iv := range v {\n\t\t\t\tif strings.HasPrefix(k, \"@\") { // file\n\t\t\t\t\terr = addFile(w, k[1:], iv)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t} else { // form value\n\t\t\t\t\tw.WriteField(k, iv)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif len(fileBytes) > 0 && fileName != \"\" {\n\t\t\tw.Boundary()\n\t\t\t//_, fileNm := filepath.Split(fileName)\n\t\t\tpart, err := w.CreateFormFile(formFileName, filepath.Base(fileName))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\t_, err = part.Write(fileBytes)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\t// Set the Boundary in the Content-Type\n\t\theaderParams[\"Content-Type\"] = w.FormDataContentType()\n\n\t\t// Set Content-Length\n\t\theaderParams[\"Content-Length\"] = fmt.Sprintf(\"%d\", body.Len())\n\t\tw.Close()\n\t}\n\n\tif strings.HasPrefix(headerParams[\"Content-Type\"], \"application/x-www-form-urlencoded\") && len(formParams) > 0 {\n\t\tif body != nil {\n\t\t\treturn nil, errors.New(\"Cannot specify postBody and x-www-form-urlencoded form at the same time.\")\n\t\t}\n\t\tbody = &bytes.Buffer{}\n\t\tbody.WriteString(formParams.Encode())\n\t\t// Set Content-Length\n\t\theaderParams[\"Content-Length\"] = fmt.Sprintf(\"%d\", body.Len())\n\t}\n\n\t// Setup path and query parameters\n\turl, err := url.Parse(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Adding Query Param\n\tquery := url.Query()\n\tfor k, v := range queryParams {\n\t\tfor _, iv := range v {\n\t\t\tquery.Add(k, iv)\n\t\t}\n\t}\n\n\t// Encode the parameters.\n\turl.RawQuery = query.Encode()\n\n\t// Generate a new request\n\tif body != nil {\n\t\tlocalVarRequest, err = http.NewRequest(method, url.String(), body)\n\t} else {\n\t\tlocalVarRequest, err = http.NewRequest(method, url.String(), nil)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// add header parameters, if any\n\tif len(headerParams) > 0 {\n\t\theaders := http.Header{}\n\t\tfor h, v := range headerParams {\n\t\t\theaders.Set(h, v)\n\t\t}\n\t\tlocalVarRequest.Header = headers\n\t}\n\n\t// Override request host, if applicable\n\tif c.cfg.Host != \"\" {\n\t\tlocalVarRequest.Host = c.cfg.Host\n\t}\n\n\t// Add the user agent to the request.\n\tlocalVarRequest.Header.Add(\"User-Agent\", c.cfg.UserAgent)\n\n\tif ctx != nil {\n\t\t// add context to the request\n\t\tlocalVarRequest = localVarRequest.WithContext(ctx)\n\n\t\t// Walk through any authentication.\n\n\t\t// OAuth2 authentication\n\t\tif tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok {\n\t\t\t// We were able to grab an oauth2 token from the context\n\t\t\tvar latestToken *oauth2.Token\n\t\t\tif latestToken, err = tok.Token(); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tlatestToken.SetAuthHeader(localVarRequest)\n\t\t}\n\n\t\t// Basic HTTP Authentication\n\t\tif auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok {\n\t\t\tlocalVarRequest.SetBasicAuth(auth.UserName, auth.Password)\n\t\t}\n\n\t\t// AccessToken Authentication\n\t\tif auth, ok := ctx.Value(ContextAccessToken).(string); ok {\n\t\t\tlocalVarRequest.Header.Add(\"Authorization\", \"Bearer \"+auth)\n\t\t}\n\t}\n\n\tfor header, value := range c.cfg.DefaultHeader {\n\t\tlocalVarRequest.Header.Add(header, value)\n\t}\n\n\treturn localVarRequest, nil\n}", "title": "" }, { "docid": "7b76e4553275b44b1f0f1781edf20a57", "score": "0.6317392", "text": "func (client Client) prepareRequest(req *http.Request) {\n\treq.Header.Add(\"Accept\", \"application/vnd.github.inertia-preview.full+json\")\n\treq.Header.Add(\"User-Agent\", \"uthark/github-cli\")\n\n\tclient.setAuthorization(req)\n}", "title": "" }, { "docid": "422a290115f35797aee9760d5038a599", "score": "0.62907517", "text": "func (api *API) prepareRequest(values *url.Values) (*http.Request, error) {\n\n\trequestString := values.Encode()\n\n\tsign := hmac.New(sha512.New, []byte(settings.Secret))\n\tsign.Write([]byte(requestString))\n\n\treq, err := http.NewRequest(\"POST\", settings.TradeApiLink, strings.NewReader(requestString))\n\tsettings.Check(\"Trade API.prepareRequest() Creating request\", err)\n\treq.Header.Add(\"Key\", settings.Key)\n\treq.Header.Add(\"Sign\", hex.EncodeToString(sign.Sum(nil)))\n\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\treturn req, err\n}", "title": "" }, { "docid": "12907686e98252cefb2c787a983f8431", "score": "0.6247648", "text": "func prepareRequest(u *url.URL, req *models.ChannelLink) error {\n\trootId, err := request.GetURIInt64(u, \"rootId\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tleafId, err := request.GetURIInt64(u, \"leafId\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq.RootId = rootId\n\treq.LeafId = leafId\n\n\treturn nil\n}", "title": "" }, { "docid": "d38e71b87bbc73144f2dbb44a1711e43", "score": "0.6192194", "text": "func (c *APIClient) prepareRequest (\n path string, method string,\n postBody interface{},\n headerParams map[string]string,\n queryParams url.Values,\n formParams url.Values,\n fileName string,\n fileBytes []byte) (localVarRequest *http.Request, err error) {\n\n var body *bytes.Buffer\n \n // set custom header\n headerParams[\"x-aspose-client\"] = \"go sdk\"\n headerParams[\"x-aspose-client-version\"] = \"23.8.0\"\n\n // Detect postBody type and post.\n if postBody != nil {\n contentType := headerParams[\"Content-Type\"]\n if contentType == \"\" {\n contentType = detectContentType(postBody)\n headerParams[\"Content-Type\"] = contentType\n }\n\n body, err = setBody(postBody, contentType)\n if err != nil {\n return nil, err\n }\n }\n\n // add form parameters and file if available.\n if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != \"\") {\n if body != nil {\n return nil, errors.New(\"cannot specify postBody and multipart form at the same time\")\n }\n body = &bytes.Buffer{}\n w := multipart.NewWriter(body)\n\n for k, v := range formParams {\n for _, iv := range v {\n if strings.HasPrefix(k, \"@\") { // file\n err = addFile(w, k[1:], iv)\n if err != nil {\n return nil, err\n }\n } else { // form value\n w.WriteField(k, iv)\n }\n }\n }\n if len(fileBytes) > 0 && fileName != \"\" {\n body = bytes.NewBuffer(fileBytes)\n \n // Set the Boundary in the Content-Type\n headerParams[\"Content-Type\"] = \"application/octet-stream\"\n }\n \n // Set Content-Length\n headerParams[\"Content-Length\"] = fmt.Sprintf(\"%d\", body.Len())\n w.Close()\n }\n\n // Setup path and query parameters\n url, err := url.Parse(path)\n if err != nil {\n return nil, err\n }\n\n // Adding Query Param\n query := url.Query()\n for k, v := range queryParams {\n for _, iv := range v {\n query.Add(k, iv)\n }\n }\n\n // Encode the parameters.\n url.RawQuery = query.Encode()\n\n // Generate a new request\n if body != nil {\n localVarRequest, err = http.NewRequest(method, url.String(), body)\n } else {\n localVarRequest, err = http.NewRequest(method, url.String(), nil)\n }\n if err != nil {\n return nil, err\n }\n\n // add header parameters, if any\n if len(headerParams) > 0 {\n headers := http.Header{}\n for h, v := range headerParams {\n headers.Set(h, v)\n }\n localVarRequest.Header = headers\n }\n\n // Override request host, if applicable\n if c.cfg.Host != \"\" {\n localVarRequest.Host = c.cfg.Host\n }\n \n // Add the user agent to the request.\n localVarRequest.Header.Add(\"User-Agent\", c.cfg.UserAgent)\n \n // Add auth\n err = c.addAuth(localVarRequest)\n if err != nil {\n return nil, err\n }\n\n for header, value := range c.cfg.DefaultHeader {\n localVarRequest.Header.Add(header, value)\n }\n \n return localVarRequest, nil\n}", "title": "" }, { "docid": "bfe70117a1deaa6065ae3423626ae45d", "score": "0.617547", "text": "func requestPrepare(url string, data string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, bytes.NewBufferString(data))\n\treq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\tUUID := [16]byte(uuid.New())\n\treq.Header[\"X-DBX-REQ-ID\"] = []string{hex.EncodeToString(UUID[:])}\n\treq.Header[\"X-Dropbox-User-Agent\"] = []string{\"DropboxDesktopClient/34.4.22 (Linux; 4.12.9-200.fc25.x86_64; x64; en_US)\"}\n\treq.Header[\"User-Agent\"] = []string{\"DropboxDesktopClient/34.4.22 (Linux; 4.12.9-200.fc25.x86_64; x64; en_US)\"}\n\treq.Header[\"X-DBX-RETRY\"] = []string{\"1\"}\n\treq.Header[\"X-Dropbox-Locale\"] = []string{\"en_US\"}\n\n\treturn req, err\n}", "title": "" }, { "docid": "74175b56903a7c98fd629f45d127cb89", "score": "0.61566937", "text": "func (r *gsRequest) prepareHTTPRequest(ctx context.Context, cfg *Config) (*http.Request, error) {\n\turl := cfg.apiURL + r.uri\n\tlogger.Debugf(\"Preparing %v request sent to URL: %v\", r.method, url)\n\n\t// Convert the body of the request to json.\n\tjsonBody := new(bytes.Buffer)\n\tif r.body != nil {\n\t\terr := json.NewEncoder(jsonBody).Encode(r.body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Add authentication headers and content type.\n\trequest, err := http.NewRequest(r.method, url, jsonBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trequest = request.WithContext(ctx)\n\trequest.Header.Set(\"User-Agent\", cfg.userAgent)\n\trequest.Header.Set(\"Content-Type\", bodyType)\n\n\t// Omit X-Auth-UserID when cfg.userUUID is empty.\n\tif cfg.userUUID != \"\" {\n\t\trequest.Header.Set(authUserIDHeaderKey, cfg.userUUID)\n\t}\n\t// Omit X-Auth-Token when cfg.apiToken is empty.\n\tif cfg.apiToken != \"\" {\n\t\trequest.Header.Set(authTokenHeaderKey, cfg.apiToken)\n\t}\n\n\t// Set headers based on a given list of custom headers.\n\t// Use Header.Set() instead of Header.Add() because we want to\n\t// override the headers' values if they are already set.\n\tfor k, v := range cfg.httpHeaders {\n\t\trequest.Header.Set(k, v)\n\t}\n\n\t// Set query parameters if there are any of them.\n\tquery := request.URL.Query()\n\tfor k, v := range r.queryParameters {\n\t\tquery.Add(k, v)\n\t}\n\trequest.URL.RawQuery = query.Encode()\n\tlogger.Debugf(\"Finished Preparing %v request sent to URL: %v://%v%v\", request.Method, request.URL.Scheme, request.URL.Host, request.URL.RequestURI())\n\treturn request, nil\n}", "title": "" }, { "docid": "eda0c6c68afabdee952a7fb850647f09", "score": "0.60139465", "text": "func NewRequest(conf *PlatformConfig, method, apiURL string, headers map[string]string, query interface{}, body map[string]interface{}) *RawRequest {\n\t//GET token from oAuthClient\n\ttoken := conf.GetAccessToken()\n\tif headers == nil {\n\t\theaders = make(map[string]string)\n\t}\n\theaders[\"authorization\"] = \"Bearer \" + token\n\treturn &RawRequest{\n\t\tBaseURL: conf.Domain,\n\t\tAPIURL: apiURL,\n\t\tMethod: strings.ToUpper(method),\n\t\tHeaders: headers,\n\t\tQueryParams: query,\n\t\tBody: body,\n\t\tEncodeData: false,\n\t}\n}", "title": "" }, { "docid": "f0ce6fff506e68e57d5e947ddcc39e00", "score": "0.6007568", "text": "func (m *Macaroon) PrepareForRequest(discharge *Macaroon) (*Macaroon, error) {\n\tvar err C.enum_macaroon_returncode\n\tprepared := C.macaroon_prepare_for_request(m.m, discharge.m, &err)\n\tif prepared == nil {\n\t\treturn nil, macaroonError(err)\n\t}\n\treturn &Macaroon{prepared}, nil\n}", "title": "" }, { "docid": "b8750c75f51e9222c0d86705a33e7219", "score": "0.5941005", "text": "func NewRequestPrepare(query string) *Request {\n\treturn newRequest(&RequestPrepare{Query: query})\n}", "title": "" }, { "docid": "c0dbd09f0b02d14387de5cda898a9600", "score": "0.5911654", "text": "func PrepareRequest(\n\tctx context.Context,\n\tcfg Configuration,\n\tpath string, method string,\n\tpostBody interface{},\n\theaderParams map[string]string,\n\tqueryParams url.Values,\n\tformParams url.Values,\n\tformFileName string,\n\tfileName string,\n\tfileBytes []byte) (localVarRequest *http.Request, err error) {\n\n\tvar body *bytes.Buffer\n\n\t// Detect postBody type and post.\n\tif postBody != nil {\n\n\t\tcontentType := headerParams[\"Content-Type\"]\n\t\tif contentType == \"\" {\n\t\t\tcontentType = detectContentType(postBody)\n\t\t\theaderParams[\"Content-Type\"] = contentType\n\t\t}\n\n\t\tif strings.HasPrefix(headerParams[\"Content-Type\"], \"multipart/related\") {\n\n\t\t\tbody = &bytes.Buffer{}\n\t\t\tcontentType, err = MultipartEncode(postBody, body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\theaderParams[\"Content-Type\"] = contentType\n\n\t\t} else {\n\t\t\tbody, err = setBody(postBody, contentType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\t// add form parameters and file if available.\n\tif strings.HasPrefix(headerParams[\"Content-Type\"], \"multipart/form-data\") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != \"\") {\n\t\tif body != nil {\n\t\t\treturn nil, errors.New(\"Cannot specify postBody and multipart form at the same time.\")\n\t\t}\n\t\tbody = &bytes.Buffer{}\n\t\tw := multipart.NewWriter(body)\n\n\t\tfor k, v := range formParams {\n\t\t\tfor _, iv := range v {\n\t\t\t\tif strings.HasPrefix(k, \"@\") { // file\n\t\t\t\t\terr = addFile(w, k[1:], iv)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t} else { // form value\n\t\t\t\t\tw.WriteField(k, iv)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif len(fileBytes) > 0 && fileName != \"\" {\n\t\t\tw.Boundary()\n\t\t\t//_, fileNm := filepath.Split(fileName)\n\t\t\tpart, err := w.CreateFormFile(formFileName, filepath.Base(fileName))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\t_, err = part.Write(fileBytes)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\t// Set the Boundary in the Content-Type\n\t\t\theaderParams[\"Content-Type\"] = w.FormDataContentType()\n\t\t}\n\n\t\t// Set Content-Length\n\t\theaderParams[\"Content-Length\"] = fmt.Sprintf(\"%d\", body.Len())\n\t\tw.Close()\n\t}\n\n\tif strings.HasPrefix(headerParams[\"Content-Type\"], \"application/x-www-form-urlencoded\") && len(formParams) > 0 {\n\t\tif body != nil {\n\t\t\treturn nil, errors.New(\"Cannot specify postBody and x-www-form-urlencoded form at the same time.\")\n\t\t}\n\t\tbody = &bytes.Buffer{}\n\t\tbody.WriteString(formParams.Encode())\n\t\t// Set Content-Length\n\t\theaderParams[\"Content-Length\"] = fmt.Sprintf(\"%d\", body.Len())\n\t}\n\n\t// Setup path and query parameters\n\turl, err := url.Parse(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Adding Query Param\n\tquery := url.Query()\n\tfor k, v := range queryParams {\n\t\tfor _, iv := range v {\n\t\t\tquery.Add(k, iv)\n\t\t}\n\t}\n\n\t// Encode the parameters.\n\turl.RawQuery = query.Encode()\n\n\t// Generate a new request\n\tif body != nil {\n\t\tlocalVarRequest, err = http.NewRequest(method, url.String(), body)\n\t} else {\n\t\tlocalVarRequest, err = http.NewRequest(method, url.String(), nil)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// add header parameters, if any\n\tif len(headerParams) > 0 {\n\t\theaders := http.Header{}\n\t\tfor h, v := range headerParams {\n\t\t\theaders.Set(h, v)\n\t\t}\n\t\tlocalVarRequest.Header = headers\n\t}\n\n\t// Override request host, if applicable\n\tif cfg.Host() != \"\" {\n\t\tlocalVarRequest.Host = cfg.Host()\n\t}\n\n\t// Add the user agent to the request.\n\tlocalVarRequest.Header.Add(\"User-Agent\", cfg.UserAgent())\n\n\tif ctx != nil {\n\t\t// add context to the request\n\t\tlocalVarRequest = localVarRequest.WithContext(ctx)\n\n\t\t// Walk through any authentication.\n\n\t\t// OAuth2 authentication\n\t\tif tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok {\n\t\t\t// We were able to grab an oauth2 token from the context\n\t\t\tvar latestToken *oauth2.Token\n\t\t\tif latestToken, err = tok.Token(); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tlatestToken.SetAuthHeader(localVarRequest)\n\t\t}\n\n\t\t// Basic HTTP Authentication\n\t\tif auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok {\n\t\t\tlocalVarRequest.SetBasicAuth(auth.UserName, auth.Password)\n\t\t}\n\n\t\t// AccessToken Authentication\n\t\tif auth, ok := ctx.Value(ContextAccessToken).(string); ok {\n\t\t\tlocalVarRequest.Header.Add(\"Authorization\", \"Bearer \"+auth)\n\t\t}\n\t}\n\n\tfor header, value := range cfg.DefaultHeader() {\n\t\tlocalVarRequest.Header.Add(header, value)\n\t}\n\n\treturn localVarRequest, nil\n}", "title": "" }, { "docid": "7dc0cea5ab1dfd9d751850da2fba8769", "score": "0.58044314", "text": "func createRequest(raw *http.Request) *Request {\n\n\t// Create the Request type.\n\tthis := &Request{\n\t\tRequest: raw,\n\t\tUrl: raw.URL.RequestURI(),\n\t\tOriginalUrl: raw.URL.RequestURI(),\n\t}\n\n\t// A map for storing general key/values over the lifetime of the request.\n\tif this.Map == nil {\n\t\tthis.Map = map[string]interface{}{}\n\t}\n\n\treturn this\n}", "title": "" }, { "docid": "e01cda8d894b0c5bd81511eeaecb937c", "score": "0.58039683", "text": "func GetBodyRequest(account string, args []interface{}) ([]byte, error) {\n\trequestBodyStruct := requestBody{}\n\tif args != nil {\n\t\t//add args to struct slice\n\t\tfor _, elem := range args {\n\t\t\trequestBodyStruct.Args = append(requestBodyStruct.Args, elem)\n\t\t}\n\t}\n\n\trequestBodyStruct.Account = account\n\n\t//parse struct to JSON\n\trequestBody, err := json.Marshal(requestBodyStruct)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error while creating request body: %v\", err)\n\t}\n\treturn requestBody, nil\n}", "title": "" }, { "docid": "b275ff83915472912aa678172d8d4030", "score": "0.5799586", "text": "func NewRequest(ctx context.Context, method, url string, body interface{}) Request {\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\thttpReq, err := http.NewRequest(method, url, nil)\n\treq := Request{\n\t\tContext: ctx,\n\t\terr: err}\n\tif httpReq != nil {\n\t\thttpReq.ContentLength = 0\n\t\thttpReq.Body = &bufCloser{}\n\t\treq.Request = *httpReq\n\n\t\t// Attach any metadata in the context to the request as headers.\n\t\tmeta := MetadataFromContext(ctx)\n\t\tfor k, v := range meta {\n\t\t\treq.Header[strings.ToLower(k)] = v\n\t\t}\n\t}\n\tif body != nil && err == nil {\n\t\treq.EncodeAsJSON(body)\n\t}\n\treturn req\n}", "title": "" }, { "docid": "ca9a1391fd103f386b1f8e4d099e9f7b", "score": "0.5791596", "text": "func (r rpc) createRequest(method string, endpoint string, body []byte) (*http.Request, error) {\n\tu := r.auth.getBaseUrl().String() + endpoint\n\treq, err := http.NewRequest(method, u, bytes.NewBuffer(body))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Authenticate the request\n\tr.auth.authenticate(req, method, endpoint, body)\n\n\treq.Header.Set(\"User-Agent\", \"CoinbaseGo/v2\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\treturn req, nil\n}", "title": "" }, { "docid": "44be33aa6eabe5b1ce41e9ce8ba084d6", "score": "0.5785695", "text": "func (h *HttpRequestHelper) GetRequestBodyApi(requestType string, requetUrl *url.URL, dataBody []byte, header map[string][]string) *http.Request {\n var he map[string][]string\n if header != nil {\n he = header\n } else {\n he = map[string][]string{\n \"authorization\": {\"Basic \" + h.GetBasicAuthString()},\n \"Content-type\": {\"application/json\"},\n }\n }\n return &http.Request{\n Method: requestType,\n URL: requetUrl,\n Body: ioutil.NopCloser(strings.NewReader(string(dataBody))),\n Header: he,\n }\n}", "title": "" }, { "docid": "a74989923306aa6a2524f7031f0c6ef1", "score": "0.57553566", "text": "func (c Client) NewRequest(method, rawurl string, body io.Reader) (*http.Request, error) {\n\treq, err := http.NewRequest(strings.ToUpper(method), rawurl, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tSignRequest(req, c)\n\n\treq.URL = c.RootURL.ResolveReference(req.URL)\n\tc.out.Write([]byte(\"REQUEST: \" + req.Method + \" \" + req.URL.String() + \"\\n\"))\n\treturn req, nil\n}", "title": "" }, { "docid": "aed7d836afeefcef099a406e2065a8b1", "score": "0.57222795", "text": "func (api CachetAPI) NewRequest(requestType, url string, reqBody []byte) (*http.Response, CachetResponse, error) {\n\treq, err := http.NewRequest(requestType, api.URL+url, bytes.NewBuffer(reqBody))\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"X-Cachet-Token\", api.Token)\n\n\ttransport := http.DefaultTransport.(*http.Transport)\n\ttransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: api.Insecure}\n\tclient := &http.Client{\n\t\tTransport: transport,\n\t}\n\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, CachetResponse{}, err\n\t}\n\n\tvar body struct {\n\t\tData json.RawMessage `json:\"data\"`\n\t}\n\terr = json.NewDecoder(res.Body).Decode(&body)\n\n\treturn res, body, err\n}", "title": "" }, { "docid": "7c09a38841ac19a9fda0e4ca93621f31", "score": "0.57107896", "text": "func (c *Client) NewRPCRequest(method, urlStr string, body interface{}) (*RPCRequest, error) {\n\treq, err := c.newRequest(method, urlStr, func(w io.Writer) error {\n\t\treturn json.NewEncoder(w).Encode(body)\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Add(\"Accept\", \"application/json; charset=utf-8\")\n\treq.Header.Add(\"Content-Type\", \"application/json; charset=utf-8\")\n\treturn (*RPCRequest)(req), nil\n}", "title": "" }, { "docid": "7c870cde146689747f46fe1d0cee56a6", "score": "0.5685271", "text": "func PreprocessRequest(req *http.Request) (*Params, error) {\n\tbody, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"[ PreprocessRequest ] Can't read body. So strange\")\n\t}\n\tif len(body) == 0 {\n\t\treturn nil, errors.New(\"[ PreprocessRequest ] Empty body\")\n\t}\n\n\tvar params Params\n\terr = json.Unmarshal(body, &params)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"[ PreprocessRequest ] Can't parse input params\")\n\t}\n\n\tif len(params.QID) == 0 {\n\t\tqid, err := uuid.NewV1()\n\t\tif err == nil {\n\t\t\tparams.QID = qid.String()\n\t\t}\n\t}\n\n\tlog.Infof(\"[QID=%s] Query: %s. Url: %s\\n\", params.QID, string(body), req.URL)\n\n\treturn &params, nil\n}", "title": "" }, { "docid": "acc794c6bfb39f45b0418445561edd01", "score": "0.5643587", "text": "func (a *DefaultAdapter) Prepare(req *Request) error {\n\treq.URL = \"\"\n\treq.Body = []byte(fmt.Sprintf(\"%s\\r\\n\", req.Query))\n\treturn nil\n}", "title": "" }, { "docid": "f8ffbd6c77cf54b379c9f96df0ea884b", "score": "0.56374943", "text": "func (r *internalRequest) mkHTTPRequest(body io.Reader) (req *http.Request, err error) {\n\treq, err = http.NewRequest(r.method, r.url.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Close = true\n\treq.Header.Add(\"User-Agent\", \"bytemark-client-\"+Version)\n\n\tif r.endpoint == SPPEndpoint {\n\t\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\t} else {\n\t\treq.Header.Add(\"Accept\", \"application/json\")\n\t\treq.Header.Add(\"Content-Type\", \"application/json\")\n\t}\n\tif r.authenticate {\n\t\tif r.client.GetSessionToken() == \"\" {\n\t\t\treturn nil, NilAuthError{}\n\t\t}\n\t\t// if we could settle on a single standard\n\t\t// rather than two basically-identical ones that'd be cool\n\t\tswitch TokenType(r.endpoint) {\n\t\tcase \"token\":\n\t\t\treq.Header.Add(\"Authorization\", \"Token token=\"+r.client.GetSessionToken())\n\t\tcase \"bearer\":\n\t\t\treq.Header.Add(\"Authorization\", \"Bearer \"+r.client.GetSessionToken())\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "ca983ec77deb6420b2d8fd21cfcb7af2", "score": "0.5631505", "text": "func (r *remoteImpl) makeRequest(ctx context.Context, path, method string, request, response interface{}) error {\n\tvar body []byte\n\tif request != nil {\n\t\tb, err := json.Marshal(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbody = b\n\t}\n\n\t// Logs warning is context is not canceled yet.\n\tlogWarning := func(msg string, args ...interface{}) {\n\t\tif err := ctx.Err(); err == nil {\n\t\t\tlogging.Warningf(ctx, msg, args...)\n\t\t}\n\t}\n\n\turl := fmt.Sprintf(\"%s/_ah/api/%s\", r.serviceURL, path)\n\tlogging.Debugf(ctx, \"cipd: %s %s\", method, url)\n\tfor attempt := 0; attempt < remoteMaxRetries; attempt++ {\n\t\tif attempt != 0 {\n\t\t\tlogWarning(\"cipd: retrying request to %s\", url)\n\t\t\tclock.Sleep(ctx, 2*time.Second)\n\t\t}\n\n\t\t// Context canceled?\n\t\tif err := ctx.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Prepare request.\n\t\tvar bodyReader io.Reader\n\t\tif body != nil {\n\t\t\tbodyReader = bytes.NewReader(body)\n\t\t}\n\t\treq, err := http.NewRequest(method, url, bodyReader)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif body != nil {\n\t\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t\t}\n\t\treq.Header.Set(\"User-Agent\", r.userAgent)\n\n\t\t// Connect, read response.\n\t\tresp, err := ctxhttp.Do(ctx, r.client, req)\n\t\tif err != nil {\n\t\t\tif isTemporaryNetError(err) {\n\t\t\t\tlogWarning(\"cipd: connectivity error (%s)\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tresponseBody, err := ioutil.ReadAll(resp.Body)\n\t\tresp.Body.Close()\n\t\tif err != nil {\n\t\t\tif isTemporaryNetError(err) {\n\t\t\t\tlogWarning(\"cipd: temporary error when reading response (%s)\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tif isTemporaryHTTPError(resp.StatusCode) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Success?\n\t\tif resp.StatusCode < 300 {\n\t\t\treturn json.Unmarshal(responseBody, response)\n\t\t}\n\n\t\t// Fatal error?\n\t\tif resp.StatusCode == 403 || resp.StatusCode == 401 {\n\t\t\treturn ErrAccessDenined\n\t\t}\n\t\treturn fmt.Errorf(\"unexpected reply (HTTP %d):\\n%s\", resp.StatusCode, string(responseBody))\n\t}\n\n\treturn ErrBackendInaccessible\n}", "title": "" }, { "docid": "582495e6bea6ea4a85d0e452b4d2eeee", "score": "0.5631082", "text": "func InitRequest(baseID ID, action Action, msg []byte, ids []*Identity, sigs [][]byte) Request {\n\tinner := innerRequest{\n\t\tBaseID: baseID,\n\t\tAction: action,\n\t\tMsg: msg,\n\t\tIdentities: ids,\n\t}\n\treturn Request{\n\t\tinner,\n\t\tsigs,\n\t}\n}", "title": "" }, { "docid": "5529d1c90917794c1160bd9ab21f6a62", "score": "0.5613668", "text": "func (r rpc) Request(method string, endpoint string, params interface{}, holder interface{}) error {\n\n\tbody := []byte{}\n\t// nil slice encodes as the null JSON value, so don't end up with body of \"null\"\n\tif params != nil {\n\t\tvar err error\n\t\tbody, err = json.Marshal(params)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\trequest, err := r.createRequest(method, endpoint, body)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"request: %v\", request)\n\n\tvar data []byte\n\tif r.mock == true { // Mock mode: Replace actual request with expected JSON from file\n\t\tdata, err = r.simulateRequest(endpoint, method)\n\t} else {\n\t\tdata, err = r.executeRequest(request)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := json.Unmarshal(data, &holder); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "124af3dc04838da6c76cf2e13c8c39e2", "score": "0.56019175", "text": "func NewRequest(method string, url string, body io.Reader, headers map[string]string) (response string, statusCode int, err error) {\n\n\tprovider := auth.NewProvider()\n\ttoken := provider.GetToken()\n\n\tclient := provider.Config.Client(provider.Ctx, &token)\n\n\trequest, err := http.NewRequest(method, url, body)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\t// Add the xero-tenant-id to all requests - required by Xero\n\trequest.Header.Add(\"xero-tenant-id\", os.Getenv(\"UK_TENANT_ID\"))\n\n\t// Add in custom headers if supplied\n\tif headers != nil {\n\t\tfor header, value := range headers {\n\t\t\trequest.Header.Add(header, value)\n\t\t}\n\t}\n\n\tresp, err := client.Do(request)\n\n\tif err != nil {\n\t\treturn \"\", resp.StatusCode, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tvar bodyString string\n\tif resp.StatusCode == http.StatusOK {\n\t\tbodyBytes, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tbodyString := string(bodyBytes)\n\t\tfmt.Println(bodyString)\n\t}\n\n\treturn bodyString, resp.StatusCode, nil\n\n}", "title": "" }, { "docid": "84449329b8f2a9bed29727d513396fd5", "score": "0.55888945", "text": "func (c *Client) newRequest(ctx context.Context, method, path string, body io.Reader, queryParams map[string]string) (*http.Request, error) {\n\treq, err := http.NewRequestWithContext(ctx, method, fmt.Sprintf(\"%s/%s\", c.baseURL, path), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Add Authorization header to request.\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Token %s\", c.apiToken))\n\n\t// Add any query parameters to request.\n\tq := req.URL.Query()\n\tfor key, value := range queryParams {\n\t\tq.Add(key, value)\n\t}\n\treq.URL.RawQuery = q.Encode()\n\n\treturn req, nil\n}", "title": "" }, { "docid": "0db1638bb6b132db053ae34075740e06", "score": "0.5587505", "text": "func NewRequest(method, url string, body io.Reader) (*Request, error) {}", "title": "" }, { "docid": "e40a44dea9a7e74cf8bbc2fcca59e967", "score": "0.5586775", "text": "func newRequest(ctx context.Context, method, url string, body io.Reader, userAuthToken, serviceAuthToken string) (*http.Request, error) {\n\treq, err := http.NewRequestWithContext(ctx, method, url, body)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to create request\")\n\t}\n\n\tif err := headers.SetAuthToken(req, userAuthToken); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to set auth token header\")\n\t}\n\n\tif err := headers.SetServiceAuthToken(req, serviceAuthToken); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to set service token header\")\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "e470db41d978955b58a86202e515797d", "score": "0.55782604", "text": "func (r *requestGenerator) generateRawRequest(ctx context.Context, rawRequest string, baseURL *urlutil.URL, finalVars, generatorValues map[string]interface{}) (*generatedRequest, error) {\n\trawRequestData, err := raw.Parse(rawRequest, baseURL, r.request.Unsafe)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Unsafe option uses rawhttp library\n\tif r.request.Unsafe {\n\t\tif len(r.options.Options.CustomHeaders) > 0 {\n\t\t\t_ = rawRequestData.TryFillCustomHeaders(r.options.Options.CustomHeaders)\n\t\t}\n\t\tunsafeReq := &generatedRequest{rawRequest: rawRequestData, meta: generatorValues, original: r.request, interactshURLs: r.interactshURLs}\n\t\treturn unsafeReq, nil\n\t}\n\n\tvar body io.ReadCloser\n\tbody = io.NopCloser(strings.NewReader(rawRequestData.Data))\n\tif r.request.Race {\n\t\t// More or less this ensures that all requests hit the endpoint at the same approximated time\n\t\t// Todo: sync internally upon writing latest request byte\n\t\tbody = race.NewOpenGateWithTimeout(body, time.Duration(2)*time.Second)\n\t}\n\turlx, err := urlutil.ParseURL(rawRequestData.FullURL, true)\n\tif err != nil {\n\t\treturn nil, errorutil.NewWithErr(err).Msgf(\"failed to create request with url %v got %v\", rawRequestData.FullURL, err).WithTag(\"raw\")\n\t}\n\treq, err := retryablehttp.NewRequestFromURLWithContext(ctx, rawRequestData.Method, urlx, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor key, value := range rawRequestData.Headers {\n\t\tif key == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\treq.Header[key] = []string{value}\n\t\tif key == \"Host\" {\n\t\t\treq.Host = value\n\t\t}\n\t}\n\trequest, err := r.fillRequest(req, finalVars)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgeneratedRequest := &generatedRequest{\n\t\trequest: request,\n\t\tmeta: generatorValues,\n\t\toriginal: r.request,\n\t\tdynamicValues: finalVars,\n\t\tinteractshURLs: r.interactshURLs,\n\t}\n\n\tif reqWithOverrides, hasAnnotations := r.request.parseAnnotations(rawRequest, req); hasAnnotations {\n\t\tgeneratedRequest.request = reqWithOverrides.request\n\t\tgeneratedRequest.customCancelFunction = reqWithOverrides.cancelFunc\n\t\tgeneratedRequest.interactshURLs = append(generatedRequest.interactshURLs, reqWithOverrides.interactshURLs...)\n\t}\n\n\treturn generatedRequest, nil\n}", "title": "" }, { "docid": "fa520a00c2667c3a57b2bcad35a610b7", "score": "0.5566281", "text": "func (c *Client) newRequest(body []byte) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", c.addr, bytes.NewBuffer(body))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Authorization\", fmt.Sprintf(\"Basic %s\", c.auth))\n\treturn req, nil\n}", "title": "" }, { "docid": "052531a1c3330d6696b54c35567a6165", "score": "0.55459225", "text": "func NewRequest(httpRequest *http.Request, routeParts []string) (request, error) {\n\tif httpRequest == nil {\n\t\tpanic(\"httpRequest can not be nil\")\n\t}\n\tif routeParts == nil {\n\t\tpanic(\"routeParts can not be nil\")\n\t}\n\n\tpathParams := getPathParameters(httpRequest.URL.Path, routeParts)\n\n\tqueryParams, err := convertQueryToMap(httpRequest.URL.RawQuery)\n\n\tif err != nil {\n\t\treturn DefaultRequest(), err\n\t}\n\n\tbodyBuffer, err := ioutil.ReadAll(httpRequest.Body)\n\n\tif err != nil {\n\t\treturn DefaultRequest(), err\n\t}\n\n\t// Remove byte order mark\n\t// Reference: https://stackoverflow.com/questions/31398044/got-error-invalid-character-%C3%AF-looking-for-beginning-of-value-from-json-unmar\n\tbodyBuffer = bytes.TrimPrefix(bodyBuffer, []byte(\"\\xef\\xbb\\xbf\"))\n\tbody, err := utils.ConvertBytesToMap(bodyBuffer)\n\n\tif err != nil {\n\t\treturn DefaultRequest(), err\n\t}\n\n\treturn request{httpRequest.URL.Path, httpRequest.Method, pathParams, queryParams, body}, nil\n}", "title": "" }, { "docid": "75bd8a66c5259acc101c36e4811a6e52", "score": "0.5539861", "text": "func (c *Client) newRequest(method, urlStr string, body io.Reader) (*http.Request, error) {\n\treq, err := http.NewRequest(method, urlStr, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Accept\", \"application/json\")\n\tif c.apiName != \"\" {\n\t\treq.Header.Set(\"api-name\", c.apiName)\n\t}\n\tif c.apiKey != \"\" {\n\t\treq.Header.Set(\"api-key\", c.apiKey)\n\t}\n\tif c.userHeader != \"\" && c.user != \"\" {\n\t\treq.Header.Set(c.userHeader, c.user)\n\t}\n\tif c.userAgent != \"\" {\n\t\treq.Header.Set(\"User-Agent\", c.userAgent)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "04b28f1b946dc18fc09f3785957a1d2c", "score": "0.5538859", "text": "func NewRequest(r *http.Request) (req *Request) {\n\treq = &Request{\n\t\tRaw: r,\n\t\tRole: RoleResponder,\n\t\tParams: make(map[string]string),\n\t}\n\n\t// if no http request, return here\n\tif r == nil {\n\t\treturn\n\t}\n\n\t// pass body (io.ReadCloser) to stdio\n\treq.Stdin = r.Body\n\treturn\n}", "title": "" }, { "docid": "7ff6ca12cd351229acce0c202bb25a91", "score": "0.5531335", "text": "func (c *Client) NewRequest(method, urlStr string, body io.Reader) (*http.Request, error) {\n\treq, err := http.NewRequest(method, urlStr, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Add(\"Authorization\", fmt.Sprintf(\"Token %s\", c.apiKey))\n\treq.Header.Set(\"User-Agent\", \"ralph-cli\")\n\treturn req, nil\n}", "title": "" }, { "docid": "17c37a4d3256e4718f2156885bec1f98", "score": "0.5529482", "text": "func (c *Client) NewRequest(body interface{}) (*http.Request, error) {\n\tif body == nil {\n\t\treturn nil, errors.New(\"newrequest requires a valid API request\")\n\t}\n\n\txmlBody, err := xml.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treader := bytes.NewReader([]byte(xml.Header + string(xmlBody)))\n\n\treq, err := http.NewRequest(\"POST\", c.ServiceURL.String(), reader)\n\n\tif c.Token != \"\" {\n\t\treq.SetBasicAuth(c.Token, \"X\")\n\t}\n\treq.Header.Add(\"User-Agent\", c.UserAgent)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "dc59b7cd2cdd58b7aa83a01501328e3a", "score": "0.552593", "text": "func (c *Client) NewRequest(method string, url string, body io.Reader) (*http.Request, error) {\n\tr, err := http.NewRequest(method, url, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// if we have an auth token, add header\n\tif c.auth != \"\" {\n\t\tr.Header[\"authorization\"] = []string{c.auth}\n\t}\n\t// Not using the Set here to preserve header case\n\tr.Header[\"x-ibm-client-id\"] = []string{c.IbmID}\n\tr.Header[\"x-ibm-client-secret\"] = []string{c.IbmSecret}\n\n\tr.Header.Set(\"User-Agent\", \"Kære danskebank, her er DanskeBankGauge, læs mere https://github.com/fasmide/DanskeBankGauge\")\n\n\t// the endpoint does not seem to care about these\n\t// r.Header[\"x-app-version\"] = []string{\"MobileBank android DK 1201367\"}\n\t// r.Header[\"referer\"] = []string{\"MobileBanking3 DK\"}\n\t// r.Header[\"x-app-culture\"] = []string{\"da-DK\"}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "5e05344da57c4077b628d420984e4791", "score": "0.55227137", "text": "func newRequest(method, host, path, query string, body interface{}) (*http.Request, error) {\n\tvar buf bytes.Buffer\n\n\tif body != nil {\n\t\tif err := json.NewEncoder(&buf).Encode(body); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\turl := fmt.Sprintf(\"%s/v1/%s?%s\", host, path, query)\n\n\t// Create HTTP request\n\treq, err := http.NewRequest(method, url, &buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\treturn req, nil\n}", "title": "" }, { "docid": "865cd62dbe93c1232f4f3b559e7786e8", "score": "0.5518669", "text": "func (c *Client) RawRequest(method string, params interface{}) (response RPCResponse, err error) {\n\t// Method may not be empty.\n\tif method == \"\" {\n\t\treturn\n\t}\n\t// Marshal parameters as \"[]\" instead of \"null\" when no parameters are passed.\n\tif params == nil {\n\t\tparams = []json.RawMessage{}\n\t}\n\n\tprotocol := \"http\"\n\n\trpcR := rpcRequest{\n\t\t\"1.0\",\n\t\ttime.Now().UnixNano(),\n\t\tmethod,\n\t\tparams}\n\n\tpayloadBuffer := &bytes.Buffer{}\n\tjsonEncoder := json.NewEncoder(payloadBuffer)\n\terr = jsonEncoder.Encode(rpcR)\n\tif err != nil {\n\t\treturn\n\t}\n\n\thttpReq, err := http.NewRequest(\"POST\", protocol + \"://\"+c.config.Host, payloadBuffer)\n\tif err != nil {\n\t\treturn\n\t}\n\n\thttpReq.Header.Add(\"Content-Type\", \"application/json;charset=utf-8\")\n\n\t// Auth ?\n\tif len(c.config.User) > 0 || len(c.config.Pass) > 0 {\n\t\thttpReq.SetBasicAuth(c.config.User, c.config.Pass)\n\t}\n\n\tresp, err := c.httpClient.Do(httpReq)\n\tif err != nil {\n\t\tlog.Printf(\"RawRequest: httpClient %#v\", err)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tdata, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(data, &response)\n\treturn\n}", "title": "" }, { "docid": "5b6ed441ad2113399dd65249a9b0a06b", "score": "0.55116326", "text": "func (s *BackendImplementation) NewRequest(method, path string, body io.Reader) (*http.Request, error) {\n\tif !strings.HasPrefix(path, \"/\") {\n\t\tpath = \"/\" + path\n\t}\n\n\turl := s.URLAuthority + path\n\n\treq, err := http.NewRequest(method, url, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"api-token\", s.APIToken)\n\t// TODO: workaround for gateway proxy\n\treq.Header.Add(\"Accept-Encoding\", \"*\")\n\treq.Header.Add(\"User-Agent\", fmt.Sprintf(\"%s, %s, %s\", \"bitmark-sdk-go\", runtime.GOOS, runtime.Version()))\n\n\treturn req, nil\n}", "title": "" }, { "docid": "b727cb6bdad9fa7f18578b2af69c1a66", "score": "0.5510208", "text": "func (c *Script) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "51cc334dc305f5234387c5fa88f0b581", "score": "0.55016845", "text": "func (a *defaultAdapter) Prepare(req *Request) error {\n\tif req.URL != \"\" {\n\t\treturn ErrURLNotSupported\n\t}\n\treq.Body = []byte(fmt.Sprintf(\"%s\\r\\n\", req.Query))\n\treturn nil\n}", "title": "" }, { "docid": "5613123f0b6ca1470d3b49d9c0e0648a", "score": "0.54996985", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v5.3.0\")\n\treturn req, nil\n}", "title": "" }, { "docid": "5613123f0b6ca1470d3b49d9c0e0648a", "score": "0.54996985", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v5.3.0\")\n\treturn req, nil\n}", "title": "" }, { "docid": "5613123f0b6ca1470d3b49d9c0e0648a", "score": "0.54996985", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v5.3.0\")\n\treturn req, nil\n}", "title": "" }, { "docid": "e758d65d0e5a1a3cfeeed95f20feb0ef", "score": "0.5496985", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v5.11.0\")\n\treturn req, nil\n}", "title": "" }, { "docid": "c455770f766f05e309219a3ead73fc8d", "score": "0.54941934", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v5.8.0\")\n\treturn req, nil\n}", "title": "" }, { "docid": "e28e7738c92b686ffe223dfd1fac8d65", "score": "0.54933465", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v5.4.1\")\n\treturn req, nil\n}", "title": "" }, { "docid": "8244008f1e29e2947233a2680fac3766", "score": "0.54901165", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v8.1.0\")\n\treturn req, nil\n}", "title": "" }, { "docid": "34823e0472520d3ce6a9e885275b1979", "score": "0.54843026", "text": "func (c BaseClient) makeRequest(method string, request interface{}, result interface{}) (interface{}, error) {\n\turl, err := c.makeUrl(method)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqBody, err := toJson(request)\n\tcontentType := \"application/json\"\n\tret, err := c.doPostRequest(url, contentType, reqBody, result)\n\treturn ret, err\n}", "title": "" }, { "docid": "66657d2d11e50a697e3014b15c42c424", "score": "0.54802704", "text": "func (c *backend) newRequest(params backendClientParams) (*http.Request, error) {\n\t// Not supported in previous versions og go 1.13\n\t// req, err := http.NewRequestWithContext(params.ctx, params.method, params.url, params.body)\n\treq, err := http.NewRequest(params.method, params.url, params.body)\n\treq = req.WithContext(params.ctx)\n\n\tif err != nil {\n\t\treturn nil, errors.New(\"Error creating New Request\")\n\t}\n\n\treq.Header.Add(\"Authorization\", params.authorization)\n\treq.Header.Add(\"User-Agent\", getUserAgent())\n\tif params.body != nil {\n\t\treq.Header.Add(\"Content-Type\", getBodyType(params.body))\n\t}\n\tif params.requestParams.UnitSystem != \"\" {\n\t\treq.Header.Add(\"SC-Unit-System\", string(params.requestParams.UnitSystem))\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "0b38575de2268958abf83a761735936f", "score": "0.5479363", "text": "func (client *Client) makeRequest(ctx context.Context, method string, path string,\n\tqueryParams interface{}, inputData interface{}, resultData interface{}) error {\n\n\t// Check if rate limit is exceeded\n\tif client.rateLimit != nil && client.rateLimit.isExceeded() {\n\t\treturn fmt.Errorf(errExceedRateLimt, time.Unix(client.rateLimit.Reset, 0))\n\t}\n\n\t// Read input data\n\tvar body io.Reader\n\tvar bodyStr string\n\tif inputData != nil {\n\t\tjsonData, err := json.Marshal(inputData)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"error marshalling params to JSON\")\n\t\t}\n\n\t\tbodyStr = string(jsonData)\n\t\tbody = bytes.NewBuffer(jsonData)\n\t}\n\n\treq, err := http.NewRequestWithContext(ctx, method, client.Config.BaseURL+path, body)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"HTTP request creation failed\")\n\t}\n\n\t// Add headers\n\tcontentType := \"application/json\"\n\treq.Header.Add(\"Content-Type\", contentType)\n\treq.Header.Add(\"request-id\", uuid.New().String())\n\treq.Header.Add(\"User-Agent\", fmt.Sprintf(\"%s/%s\", client.Config.UserAgentPrefix, VERSION))\n\treq.Header.Add(\"aftership-agent\", fmt.Sprintf(\"go-sdk-%s\", VERSION))\n\n\tif queryParams != nil {\n\t\tqueryStringObj, err := query.Values(queryParams)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"error parsing query params\")\n\t\t}\n\t\treq.URL.RawQuery = queryStringObj.Encode()\n\t}\n\n\tauthenticationType := client.Config.AuthenticationType\n\tapiKey := client.Config.APIKey\n\n\t// set signature\n\tif authenticationType == AES {\n\t\treq.Header.Add(\"as-api-key\", apiKey)\n\n\t\tasHeaders := make(map[string]string)\n\t\tfor key, value := range req.Header {\n\t\t\tasHeaders[key] = value[0]\n\t\t}\n\n\t\tdate := time.Now().UTC().Format(http.TimeFormat)\n\t\tsignatureHeader, signature, err := GetSignature(\n\t\t\tauthenticationType, []byte(client.Config.APISecret), asHeaders,\n\t\t\tcontentType, req.URL.RequestURI(), req.Method, date, bodyStr)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"generate signature error\")\n\t\t}\n\n\t\treq.Header.Add(\"date\", date)\n\t\treq.Header.Add(signatureHeader, signature)\n\t} else {\n\t\treq.Header.Add(\"aftership-api-key\", apiKey)\n\t}\n\n\t// Send request\n\tresp, err := client.httpClient.Do(req)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"HTTP request failed\")\n\t}\n\n\tdefer resp.Body.Close()\n\tcontents, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not read response body\")\n\t}\n\n\t// Rate Limit\n\tsetRateLimit(client.rateLimit, resp)\n\n\tresult := &Response{\n\t\tMeta: Meta{},\n\t\tData: resultData,\n\t}\n\t// Unmarshal response object\n\terr = json.Unmarshal(contents, result)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error unmarshalling the JSON response\")\n\t}\n\n\tif resp.StatusCode >= http.StatusOK && resp.StatusCode < http.StatusMultipleChoices {\n\t\t// The 2xx range indicate success\n\t\treturn nil\n\t}\n\n\tapiError := APIError{\n\t\tType: result.Meta.Type,\n\t\tCode: result.Meta.Code,\n\t\tMessage: result.Meta.Message,\n\t\tPath: path,\n\t}\n\n\t// Too many requests error\n\tif resp.StatusCode == http.StatusTooManyRequests {\n\t\treturn &TooManyRequestsError{\n\t\t\tAPIError: apiError,\n\t\t\tRateLimit: client.rateLimit,\n\t\t}\n\t}\n\n\t// API error\n\treturn &apiError\n}", "title": "" }, { "docid": "437aedf896988a2bd05344f496a54f5f", "score": "0.54709214", "text": "func (c *Client) newRequest(method, path string, body io.Reader) (r *http.Request, err error) {\n\tu := c.BaseURL.ResolveReference(&url.URL{\n\t\tPath: strings.TrimPrefix(path, \"/\"), // trim leading separator as path is relative.\n\t})\n\n\tr, err = http.NewRequest(method, u.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.setRequestHeaders(r.Header)\n\n\treturn r, nil\n}", "title": "" }, { "docid": "fad61d125c3f7a2739ea9797c78e6113", "score": "0.5465135", "text": "func newRequest(t *testing.T, method, path string, body io.ReadCloser) *http.Request {\n\tif !strings.HasPrefix(path, \"/\") {\n\t\tpath = \"/\" + path\n\t}\n\tu := fmt.Sprintf(\"http://localhost:5555%s\", path)\n\treq, err := http.NewRequestWithContext(\n\t\tcontext.Background(),\n\t\tmethod, u,\n\t\tbody,\n\t)\n\trequire.NoError(t, err)\n\n\treq.Header.Set(RequestIDHeader, \"12345\")\n\tif body == nil {\n\t\treturn req\n\t}\n\n\treq.GetBody = func() (io.ReadCloser, error) {\n\t\treturn body, nil\n\t}\n\treturn req\n}", "title": "" }, { "docid": "09f1a08754598cf6553a9b9b0856faa9", "score": "0.546291", "text": "func makeRequest(method string, url string, headers map[string]string, body interface{}) (*http.Request, error) {\n\tjson, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing body: %v\", err)\n\t}\n\n\treq, err := http.NewRequest(method, url, bytes.NewBuffer(json))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"making HTTP request: %v\", err)\n\t}\n\n\tfor k, v := range headers {\n\t\treq.Header.Set(k, v)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "150dfcc3a8134fb9cccccc3170b79a22", "score": "0.5462319", "text": "func (c *Client) newRequest(ctx context.Context, method, path string, body io.Reader) *http.Request {\n\tu := url.URL{\n\t\tScheme: \"https\",\n\t\tHost: c.Host,\n\t\tPath: path,\n\t}\n\tr, err := http.NewRequest(method, u.String(), body)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tr = r.WithContext(ctx)\n\tif c.AuthInfo.Login != \"\" && c.AuthInfo.APIKey != \"\" {\n\t\tr.SetBasicAuth(c.AuthInfo.Login, c.AuthInfo.APIKey)\n\t}\n\tif b, ok := body.(contentTyper); ok {\n\t\tr.Header.Set(\"Content-Type\", b.ContentType())\n\t}\n\treturn r\n}", "title": "" }, { "docid": "df06913ff476607b244c5c5da53e434a", "score": "0.54615027", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v7.1.0\")\n\treturn req, nil\n}", "title": "" }, { "docid": "1e9166d80b805e91d90b80f3a98c1877", "score": "0.54608345", "text": "func beginRequest(id uint32, rawHeaders string) error {\n\treq := getRequest(id)\n\tif req == nil {\n\t\treturn fmt.Errorf(\"Unknown request: %d\", id)\n\t}\n\n\treturn req.begin(rawHeaders)\n}", "title": "" }, { "docid": "d73b7a5e7bf27afea4078bbb658d808e", "score": "0.5457112", "text": "func (c *client) NewRequest(operation *Operation) *Request {\n\theaders := http.Header{}\n\theaders.Set(\"Accept\", \"application/json\")\n\theaders.Set(\"User-Agent\", models.UserAgent)\n\tif c.contextID != \"\" {\n\t\theaders.Set(\"X-Request-ID\", c.contextID)\n\t\theaders.Set(\"X-Transaction-ID\", c.contextID) // To avoid IKS cloudflare overriding X-Request-ID\n\t}\n\n\tif c.resourceGroup != \"\" {\n\t\theaders.Set(\"X-Auth-Resource-Group-ID\", c.resourceGroup)\n\t}\n\n\t// Copy the query values to a new map\n\tqv := url.Values{}\n\tfor k, v := range c.queryValues {\n\t\tqv[k] = v\n\t}\n\n\treturn &Request{\n\t\thttpClient: c.httpClient,\n\t\tcontext: c.context,\n\t\tbaseURL: c.baseURL,\n\t\toperation: operation,\n\t\tpathParams: c.pathParams.Copy(),\n\t\tauthenHandler: c.authenHandler,\n\t\theaders: headers,\n\t\tdebugWriter: c.debugWriter,\n\t\tresourceGroup: c.resourceGroup,\n\t\tqueryValues: qv,\n\t}\n}", "title": "" }, { "docid": "2ae5305f31978df89907e856ffacfbae", "score": "0.5447035", "text": "func (d *dispatcher) newRequest(url, contentType string, body io.Reader) (*http.Request, error) {\n\trequest, err := http.NewRequest(d.method, url, body)\n\tif err == nil {\n\t\trequest.Header.Set(\"Content-Type\", contentType)\n\n\t\t// TODO: Need to work out how to handle authorization better, without basic auth\n\t\tif len(d.authorizationKeys) > 0 {\n\t\t\trequest.Header.Set(\"Authorization\", \"Basic \"+d.authorizationKeys[0])\n\t\t}\n\t}\n\n\treturn request, err\n}", "title": "" }, { "docid": "599534f5ea99e7d1dc02396104f7dbac", "score": "0.54410684", "text": "func (c *Client) NewRequest(method, urlString string, body interface{}) (*http.Request, error) {\n\n\turl, err := url.Parse(urlString)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !url.IsAbs() {\n\t\turl = c.baseURL.ResolveReference(url)\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\terr := json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, url.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif c.credentials != nil {\n\t\treq.SetBasicAuth(c.credentials.Username, c.credentials.Password)\n\t}\n\n\tfor k, v := range c.headers {\n\t\treq.Header.Set(k, v)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "21a83780280106cd9ee1069902a94498", "score": "0.5433605", "text": "func (c *Rdb) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "7b39562fd263bbaa07c96ee08513650f", "score": "0.543179", "text": "func TestApiClient_prepareGetRequest(t *testing.T) {\n\tconf := configuration.Configuration{}\n\tconf.CertificatePath = \"test_cert.pem\"\n\tconf.ApiKeysFilePath = \"test_api.keys\"\n\ttestee, err := CreateClient(conf)\n\tassert.Nil(t, err)\n\n\turl := \"testUrl/test\"\n\treq, err := testee.buildGetRequest(url)\n\tassert.Nil(t, err)\n\tassert.Equal(t, \"GET\", req.Method, \"The request method should be set to GET\")\n\n\tassert.Equal(t, int64(0), req.ContentLength, \"The payload should be empty\")\n\n\tapikeySet := false\n\tcookies := req.Cookies()\n\tfor _, cookie := range cookies {\n\t\tif strings.ToLower(cookie.Name) == strings.ToLower(shared.AuthenticationCookieName) {\n\t\t\tapiKey := cookie.Value\n\t\t\tif apiKey == testee.receivingApiKey {\n\t\t\t\tapikeySet = true\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t}\n\t}\n\tassert.True(t, apikeySet, \"The api key must be set\")\n}", "title": "" }, { "docid": "bfa2533029bfbf40c6bfa305ba50c6d5", "score": "0.5420931", "text": "func NewRawRequest(method, url, contenttype string, cancel <-chan bool) *RawRequest {\n\treturn &RawRequest{\n\t\tMethod: method,\n\t\tUrl: url,\n\t\tContentType: contenttype,\n\t\tCancel: cancel,\n\t}\n}", "title": "" }, { "docid": "6557078a4a37ebdafba54e7ab579e95a", "score": "0.5419682", "text": "func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error) {\n\trel, err := url.Parse(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trequestURL := c.baseURL.ResolveReference(rel)\n\n\tvar buffer io.ReadWriter\n\n\tif body != nil {\n\t\tbuffer = &bytes.Buffer{}\n\t\tencodeErr := json.NewEncoder(buffer).Encode(body)\n\t\tif encodeErr != nil {\n\t\t\tlog.Println(encodeErr)\n\t\t}\n\t}\n\treq, err := http.NewRequest(method, requestURL.String(), buffer)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.SetBasicAuth(\"token\", c.token)\n\treq.Header.Set(\"Accept\", defaultMediaType)\n\treq.Header.Set(\"Content-Type\", defaultMediaType)\n\treq.Header.Set(\"User-Agent\", c.completeUserAgentString())\n\n\treturn req, nil\n}", "title": "" }, { "docid": "a47c30bf461fe737582442c56eb1e3ae", "score": "0.5416853", "text": "func (b *BitcoinClient) createRequest(nodeReq *models.NodeRequest) (*http.Request, error) {\n\tbody, err := b.createBody(nodeReq.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", nodeReq.Headers.Address, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.SetBasicAuth(nodeReq.Headers.Username, nodeReq.Headers.Password)\n\n\treturn req, nil\n}", "title": "" }, { "docid": "d604b246fc38448c9efb4e995162cf16", "score": "0.5416589", "text": "func (deps *endpointDeps) parseRequest(httpRequest *http.Request) (req *openrtb.BidRequest, ctx context.Context, cancel func(), errs []error) {\n\treq = &openrtb.BidRequest{}\n\tctx = context.Background()\n\tcancel = func() {}\n\terrs = nil\n\n\t// Pull the request body into a buffer, so we have it for later usage.\n\tlr := &io.LimitedReader{\n\t\tR: httpRequest.Body,\n\t\tN: deps.cfg.MaxRequestSize,\n\t}\n\trawRequest, err := ioutil.ReadAll(lr)\n\tif err != nil {\n\t\terrs = []error{err}\n\t\treturn\n\t}\n\t// If the request size was too large, read through the rest of the request body so that the connection can be reused.\n\tif lr.N <= 0 {\n\t\tif written, err := io.Copy(ioutil.Discard, httpRequest.Body); written > 0 || err != nil {\n\t\t\terrs = []error{fmt.Errorf(\"Request size exceeded max size of %d bytes.\", deps.cfg.MaxRequestSize)}\n\t\t\treturn\n\t\t}\n\t}\n\n\tif err := json.Unmarshal(rawRequest, req); err != nil {\n\t\terrs = []error{err}\n\t\treturn\n\t}\n\n\tif req.TMax > 0 {\n\t\tctx, cancel = context.WithTimeout(ctx, time.Duration(req.TMax)*time.Millisecond)\n\t}\n\n\t// Process any stored request directives in the impression objects.\n\tif errL := deps.processStoredRequests(ctx, req, rawRequest); len(errL) > 0 {\n\t\terrs = errL\n\t\treturn\n\t}\n\n\tdeps.setFieldsImplicitly(httpRequest, req)\n\n\tif err := deps.validateRequest(req); err != nil {\n\t\terrs = []error{err}\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d20f9f69d4587745918f35e6b9c5c728", "score": "0.54165006", "text": "func newRequestFromHttpRequest(req *http.Request) *Request {\n\tr := &Request{}\n\tr.Token = req.FormValue(\"token\")\n\tr.TeamId = req.FormValue(\"team_id\")\n\tr.TeamDomain = req.FormValue(\"team_domain\")\n\tr.ChannelId = req.FormValue(\"channel_id\")\n\tr.ChannelName = req.FormValue(\"channel_name\")\n\tr.UserId = req.FormValue(\"user_id\")\n\tr.UserName = req.FormValue(\"user_name\")\n\tr.Command = req.FormValue(\"command\")\n\tr.Text = req.FormValue(\"text\")\n\tr.ResponseUrl = req.FormValue(\"response_url\")\n\treturn r\n}", "title": "" }, { "docid": "ec77591a0aef96f5330d83f74a9c742f", "score": "0.5413316", "text": "func NewRequest(ctx context.Context, url, command string, args ...string) *Request {\n\treturn rpc.NewRequest(ctx, url, command, args...)\n}", "title": "" }, { "docid": "aab2853f1294b8ac9173bd2d6ef2f8b9", "score": "0.54115534", "text": "func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\tif headers, ok := HTTPRequestHeaders(ctx); ok {\n\t\tfor k := range headers {\n\t\t\tfor _, v := range headers[k] {\n\t\t\t\treq.Header.Add(k, v)\n\t\t\t}\n\t\t}\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "a0698809a6728dfa825040df3acd6c07", "score": "0.5411118", "text": "func Request(\n\tmethod, path, body string,\n\tparams, query, headers map[string][]string,\n) (\n\tstatus int,\n\trespBody []byte,\n\trespHeaders map[string][]string,\n\terr error,\n) {\n\n\tif reqPointer == nil {\n\t\treturn 500, nil, nil, errors.New(\"Init must be called before Request\")\n\t}\n\n\t// this is lazy and slow. room for improvement here for sure\n\truntime.LockOSThread()\n\tdefer runtime.UnlockOSThread()\n\n\tstate := C.PyGILState_Ensure()\n\tdefer C.PyGILState_Release(state)\n\n\targs := pythonTuple([]*C.PyObject{\n\t\tpythonString(method),\n\t\tpythonString(path),\n\t\tmapToPyDict(params),\n\t\tmapToPyDict(query),\n\t\tmapToPyDict(headers),\n\t\tpythonString(body),\n\t})\n\n\tout, err := callPy(reqPointer, args, nil)\n\n\tif err != nil {\n\t\tstatus = 500\n\t\terr = fmt.Errorf(\"python exception: %+v\", err)\n\t} else {\n\t\tstatus = int(C.PyLong_AsLong(C.PyTuple_GetItem(out, 0)))\n\t\trespBody = []byte(goString(C.PyTuple_GetItem(out, 1)))\n\t\trespHeaders = pyDictToMap(C.PyTuple_GetItem(out, 2))\n\t}\n\n\tC.Py_DecRef(out)\n\n\treturn status, respBody, respHeaders, err\n}", "title": "" }, { "docid": "53dab9099a1def84b37be0265d8e8c34", "score": "0.5408844", "text": "func (c *Client) NewRequest(method, urlString string, body interface{}) (*http.Request, error) {\n\tif strings.HasPrefix(urlString, \"/\") {\n\t\turlString = weiboApiVersion + urlString\n\t} else {\n\t\turlString = weiboApiVersion + \"/\" + urlString\n\t}\n\n\trel, err := url.Parse(urlString)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := c.BaseURL.ResolveReference(rel)\n\n\tvar buf io.Reader\n\tif body != nil {\n\t\tqs, err := query.Values(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbuf = strings.NewReader(qs.Encode())\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded; param=value\")\n\treq.Header.Add(\"User-Agent\", c.UserAgent)\n\treq.Header.Add(\"Authorization\", \"OAuth2 \"+c.accessToken)\n\treturn req, nil\n}", "title": "" }, { "docid": "9e00505318836ec167845be4f85c41a0", "score": "0.5404105", "text": "func (s *backendImplementation) newRequest(method, path, key, contentType string, params ParamsContainer) (*http.Request, error) {\n\tif !strings.HasPrefix(path, \"/\") {\n\t\tpath = \"/\" + path\n\t}\n\n\tpath = s.URL + path\n\treq, err := http.NewRequest(method, path, nil)\n\tif err != nil {\n\t\ts.leveledLogger.Errorf(\"Cannot create request: %v\", err)\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treq.Header.Add(\"User-Agent\", encodedUserAgent)\n\n\t// add trakt specific headers.\n\treq.Header.Add(\"trakt-api-version\", APIVersion)\n\treq.Header.Add(\"trakt-api-key\", key)\n\n\t// add oauth token if supplied.\n\ttoken := params.oauth()\n\n\tif token != \"\" {\n\t\tauthorization := \"Bearer \" + token\n\t\treq.Header.Add(\"Authorization\", authorization)\n\t}\n\n\treq = req.WithContext(params.context())\n\n\tfor k, v := range params.headers() {\n\t\tfor _, line := range v {\n\t\t\t// Use Set to override the default value possibly set before\n\t\t\treq.Header.Set(k, line)\n\t\t}\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "77e4cd82714bb1479c35196f08e46823", "score": "0.5400722", "text": "func (r *Rattle) GetRequest() (*http.Request, error) {\n reqURL, err := url.Parse(r.rawURL)\n if err != nil {\n return nil, err\n }\n\n err = genQuery(reqURL, r.parameters)\n if err != nil {\n return nil, err\n }\n\n var body io.Reader\n var reqContentType string\n if r.bodyProvider != nil {\n body, reqContentType, err = r.bodyProvider.GetBody()\n if err != nil {\n return nil, err\n }\n }\n req, err := http.NewRequest(r.method, reqURL.String(), body)\n if err != nil {\n return nil, err\n }\n if !r.config.ReUseTCP {\n req.Close = true\n }\n setHeaders(req, r.header)\n if req.Header.Get(\"User-Agent\") == \"\" {\n req.Header.Set(\"User-Agent\", \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36\")\n }\n\n if reqContentType != \"\" {\n req.Header.Set(contentType, reqContentType)\n } else {\n req.Header.Del(contentType)\n }\n\n return req, err\n}", "title": "" }, { "docid": "659e8efb403ea9261bc01e328320b7d8", "score": "0.5399801", "text": "func (c *Client) createRequest(\n\tctx context.Context,\n\tmethod string,\n\turi *url.URL,\n\tparams url.Values,\n\tbody io.Reader,\n\theader http.Header) (*http.Request, error) {\n\n\tparams = c.ensureRequestParams(params)\n\turi.RawQuery = params.Encode()\n\n\treq, err := http.NewRequest(method, uri.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif header != nil {\n\t\treq.Header = header\n\t}\n\n\tif ctx != nil {\n\t\treq = req.WithContext(ctx)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "b29a98820fe917f5009f33dac14e4988", "score": "0.5399127", "text": "func (r *requestGenerator) fillRequest(req *retryablehttp.Request, values map[string]interface{}) (*retryablehttp.Request, error) {\n\t// Set the header values requested\n\tfor header, value := range r.request.Headers {\n\t\tif r.options.Interactsh != nil {\n\t\t\tvalue, r.interactshURLs = r.options.Interactsh.Replace(value, r.interactshURLs)\n\t\t}\n\t\tvalue, err := expressions.Evaluate(value, values)\n\t\tif err != nil {\n\t\t\treturn nil, ErrEvalExpression.Wrap(err).Msgf(\"failed to evaluate while adding headers to request\")\n\t\t}\n\t\treq.Header[header] = []string{value}\n\t\tif header == \"Host\" {\n\t\t\treq.Host = value\n\t\t}\n\t}\n\n\t// In case of multiple threads the underlying connection should remain open to allow reuse\n\tif r.request.Threads <= 0 && req.Header.Get(\"Connection\") == \"\" {\n\t\treq.Close = true\n\t}\n\n\t// Check if the user requested a request body\n\tif r.request.Body != \"\" {\n\t\tbody := r.request.Body\n\t\tif r.options.Interactsh != nil {\n\t\t\tbody, r.interactshURLs = r.options.Interactsh.Replace(r.request.Body, r.interactshURLs)\n\t\t}\n\t\tbody, err := expressions.Evaluate(body, values)\n\t\tif err != nil {\n\t\t\treturn nil, ErrEvalExpression.Wrap(err)\n\t\t}\n\t\tbodyReader, err := readerutil.NewReusableReadCloser([]byte(body))\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to create reusable reader for request body\")\n\t\t}\n\t\treq.Body = bodyReader\n\t}\n\tif !r.request.Unsafe {\n\t\tutils.SetHeader(req, \"User-Agent\", uarand.GetRandom())\n\t}\n\n\t// Only set these headers on non-raw requests\n\tif len(r.request.Raw) == 0 && !r.request.Unsafe {\n\t\tutils.SetHeader(req, \"Accept\", \"*/*\")\n\t\tutils.SetHeader(req, \"Accept-Language\", \"en\")\n\t}\n\n\tif !LeaveDefaultPorts {\n\t\tswitch {\n\t\tcase req.URL.Scheme == \"http\" && strings.HasSuffix(req.Host, \":80\"):\n\t\t\treq.Host = strings.TrimSuffix(req.Host, \":80\")\n\t\tcase req.URL.Scheme == \"https\" && strings.HasSuffix(req.Host, \":443\"):\n\t\t\treq.Host = strings.TrimSuffix(req.Host, \":443\")\n\t\t}\n\t}\n\n\tif r.request.DigestAuthUsername != \"\" {\n\t\treq.Auth = &retryablehttp.Auth{\n\t\t\tType: retryablehttp.DigestAuth,\n\t\t\tUsername: r.request.DigestAuthUsername,\n\t\t\tPassword: r.request.DigestAuthPassword,\n\t\t}\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "907f5983262bdd4e882ee78b7a4a4256", "score": "0.5398059", "text": "func LocalRequest(cr *ClientRequest) (*Request, *Response) {\n\tresponse := NewResponse()\n\tclient := NewClient()\n\tif rawReq, err := client.NewHttpRequest(cr); err != nil {\n\t\tpanic(err)\n\t} else {\n\t\trequest := NewRequest(rawReq, NewRequestContext(), cr.Definition)\n\t\trequest.Body = cr.Body\n\t\trequest.Args = cr.args\n\t\treturn request, response\n\t}\n}", "title": "" }, { "docid": "c23d6342b7aed4fc852d9270f48c76a1", "score": "0.5394995", "text": "func NewRequest(method, target string, body io.Reader) *http.Request {}", "title": "" }, { "docid": "d3ae4517dea11cf9fc6b4415bf160eb7", "score": "0.53879255", "text": "func buildRequest(url, body string, httpHeaders http.Header) *http.Request {\n\treq, err := http.NewRequest(\"GET\", fmt.Sprintf(\"http://localhost:42%s\", url),\n\t\tioutil.NopCloser(bytes.NewBufferString(body)))\n\tif err != nil {\n\t\tglog.Fatal(err.Error())\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tif httpHeaders != nil {\n\t\tfor key, value := range httpHeaders {\n\t\t\treq.Header.Set(key, value[0])\n\t\t}\n\t}\n\treturn req\n}", "title": "" }, { "docid": "a29a09aa669cf286d935ad6973b00dfd", "score": "0.538545", "text": "func (t *transportES) createRequest(ctx context.Context, method string, addr *addresspool.Address, url string, body io.Reader) (*http.Request, error) {\n\tvar scheme string\n\tif t.config.transport == TransportESHTTPS {\n\t\tscheme = \"https\"\n\t} else {\n\t\tscheme = \"http\"\n\t}\n\n\trequest, err := http.NewRequestWithContext(ctx, method, fmt.Sprintf(\"%s://%s%s\", scheme, addr.Addr().String(), url), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif t.config.Username != \"\" && t.config.Password != \"\" {\n\t\trequest.SetBasicAuth(t.config.Username, t.config.Password)\n\t}\n\n\treturn request, nil\n}", "title": "" }, { "docid": "7e129a74678c4245d8816e2d4acb34b2", "score": "0.537963", "text": "func (accessInfo *AccessInfo) createRequest(method, requestPath, body string) (*http.Request, error) {\n\t// https://docs.gdax.com/#signing-a-message\n\n\t// get ISO 8601 formatted timestamp.\n\ttimestamp := strconv.FormatInt(time.Now().Unix(), 10)\n\n\tfullRequestPath := EndPoint + requestPath\n\t// create prehash string\n\tprehash := timestamp + method + requestPath + body\n\tprivateKeyDecoded, err := base64.StdEncoding.DecodeString(accessInfo.PrivateKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmac := hmac.New(sha256.New, privateKeyDecoded)\n\tmac.Write([]byte(prehash))\n\thashSum := mac.Sum(nil)\n\taccessSign := base64.StdEncoding.EncodeToString(hashSum)\n\n\treq, err := http.NewRequest(method, fullRequestPath, strings.NewReader(body))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"CB-ACCESS-KEY\", accessInfo.PublicKey)\n\treq.Header.Set(\"CB-ACCESS-SIGN\", accessSign)\n\treq.Header.Set(\"CB-ACCESS-TIMESTAMP\", timestamp)\n\treq.Header.Set(\"CB-ACCESS-PASSPHRASE\", accessInfo.Passphrase)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Method = method\n\turl, err := url.Parse(fullRequestPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.URL = url\n\tlog.Printf(\"req: %+v\\n\", req)\n\treturn req, nil\n}", "title": "" }, { "docid": "c47e39564bd10c5460a025ff4250b39f", "score": "0.53727007", "text": "func NewRequest(client *Client, before *cliware.Chain, after *cliware.Chain) *Request {\n\treturn &Request{\n\t\tClient: client,\n\t\tbefore: before,\n\t\tafter: after,\n\t\tcontext: nil,\n\t}\n}", "title": "" }, { "docid": "89289924cfe33df1ec994d1d33de547e", "score": "0.5372491", "text": "func NewRequest(baseURL, method, path string) (*http.Request, error) {\n\turl := fmt.Sprintf(\"%s%s\", baseURL, path)\n\n\treq, err := http.NewRequest(method, url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\treturn req, nil\n}", "title": "" }, { "docid": "2b82f233e3d8f31db7418131bde62cd7", "score": "0.5371928", "text": "func (c *DataPipeline) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "42b03a2c498f77982adc81d569310000", "score": "0.5371138", "text": "func (c *Client) newRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\trel, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\turl := c.Controller.BaseURL.ResolveReference(rel)\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\terr := json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tc.log.Debugf(\"Creating request %s %s\", method, url.String())\n\treq, err := http.NewRequest(method, url.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.SetBasicAuth(c.Controller.User, c.Controller.Password)\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "3fab3b11ac7d307226a5092f12961aac", "score": "0.5363979", "text": "func (c *Client) RawRequest(ctx context.Context, endpoint string, params interface{}, response interface{}) error {\n\taddress := *c.address\n\taddress.Path = endpoint\n\n\tvar body io.Reader\n\n\tif params != nil {\n\t\tb, err := json.Marshal(params)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"marshal: %w\", err)\n\t\t}\n\n\t\tbody = bytes.NewReader(b)\n\t}\n\n\treq, err := http.NewRequestWithContext(ctx, \"GET\", address.String(), body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"new req '%s': %w\", address.String(), err)\n\t}\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tif err := c.submitRequest(req, response); err != nil {\n\t\treturn fmt.Errorf(\"submit request: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2b75456c17a6aa59c9b3f4189581b4da", "score": "0.5363634", "text": "func buildPreRoutedRequest(verb string, body []byte, headers http.Header, vars map[string]string, ctx relayenv.EnvContext) *http.Request {\n\treq := st.BuildRequest(verb, \"\", body, headers)\n\treq = mux.SetURLVars(req, vars)\n\treq = req.WithContext(middleware.WithEnvContextInfo(req.Context(), middleware.EnvContextInfo{\n\t\tEnv: ctx,\n\t}))\n\treturn req\n}", "title": "" }, { "docid": "01bd5655c07f8b238eb80b0daae92128", "score": "0.53604716", "text": "func (c *CodeBuild) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "47dc5429922a29f992c1eaee8cb5820c", "score": "0.53603274", "text": "func (ac *APIClient) BuildRequest(method string, body interface{}) (apiReq *http.Request, err error) {\n\t// JSON encode request body\n\tjsonReqBody, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Initialize the request\n\tapiReq, err = http.NewRequest(method, ac.URL, bytes.NewBuffer(jsonReqBody))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Set request headers\n\tfor hKey, hVal := range ac.Headers {\n\t\tapiReq.Header.Set(hKey, hVal)\n\t}\n\n\treturn apiReq, nil\n}", "title": "" }, { "docid": "35e4c889420c9412cf87e5f21c55ddc8", "score": "0.5352415", "text": "func readRequest(buf *bufio.Reader) (*Request, error) {\n\treq := Request{\n\t\tHeaders: make(map[string]string),\n\t}\n\n\t// Read the HTTP request line (first line).\n\tif ln0, err := readHTTPLine(buf); err == nil {\n\t\tvar ok bool\n\t\tif req.Method, req.URI, req.Proto, ok = parseRequestLine(ln0); !ok {\n\t\t\treturn nil, fmt.Errorf(\"malformed request line: %q\", ln0)\n\t\t}\n\t}\n\n\t// Read each subsequent header.\n\tfor {\n\t\tln, err := readHTTPLine(buf)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif len(ln) == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tif key, val, ok := parseHeaderLine(ln); ok {\n\t\t\treq.Headers[key] = val\n\t\t}\n\t}\n\n\t// Limit the body to the number of bytes specified by Content-Length.\n\tvar cl int64\n\tif str, ok := req.Headers[\"content-length\"]; ok {\n\t\tvar err error\n\t\tif cl, err = strconv.ParseInt(str, 10, 64); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treq.Body = &io.LimitedReader{R: buf, N: cl}\n\n\treturn &req, nil\n}", "title": "" }, { "docid": "17b3907d0fec39d9dea615aa0dfc3827", "score": "0.5350234", "text": "func (c *Client) NewRequest(method string, url string, body interface{}) (*http.Request, error) {\n\tu, err := c.BaseURL.Parse(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = &bytes.Buffer{}\n\t\tif err := json.NewEncoder(buf).Encode(body); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Accept\", mediaTypeJSON)\n\treq.Header.Set(\"Xero-tenant-id\", string(c.TenantID))\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", mediaTypeJSON)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "8010d3bf7f415255153b2fffb767c1a7", "score": "0.5348592", "text": "func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {\n\trel, err := url.Parse(addParamQuery(urlStr, \"api_key\", c.keyLol))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := c.BaseURL.ResolveReference(rel)\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\terr := json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\tif c.UserAgent != \"\" {\n\t\treq.Header.Set(\"User-Agent\", c.UserAgent)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "d319dbeb1836b2ab0b217f29818873f6", "score": "0.53464645", "text": "func (c *Client) newRequest(method, path string, body interface{}) (*http.Request, error) {\n\tc.iterations = 0\n\n\trel, err := url.Parse(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := c.EndPoint.ResolveReference(rel)\n\n\tvar buf io.ReadWriter\n\tif body != nil {\n\t\tbuf = new(bytes.Buffer)\n\t\terr = json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, u.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"User-Agent\", c.UserAgent)\n\n\tif c.token != \"\" {\n\t\treq.Header.Add(\"Authorization\", c.token)\n\t}\n\n\treturn req, nil\n}", "title": "" } ]
0799d3471ca741fa346eea3c8c1625e7
TESTS TestTypeAsIdentifierPart tests the creation of identifiers based on types.
[ { "docid": "227971f42d6a9dda4a9537d45261c635", "score": "0.8378152", "text": "func TestTypeAsIdentifierPart(t *testing.T) {\n\tassert := asserts.NewTesting(t, asserts.FailStop)\n\n\t// Type as identifier.\n\tvar tai TypeToSplitForIdentifier\n\n\tid := identifier.TypeAsIdentifierPart(tai)\n\tassert.Equal(id, \"type-to-split-for-identifier\")\n\n\tid = identifier.TypeAsIdentifierPart(identifier.NewUUID())\n\tassert.Equal(id, \"u-u-i-d\")\n}", "title": "" } ]
[ { "docid": "c386ca04a12437c38da59026846cbe96", "score": "0.70514816", "text": "func ( rti *rtInit ) addIdentifierPathTests() {\n dm := builtin.MakeDefMap()\n idPathStruct := func( parts ...interface{} ) *mg.Struct {\n return parser.MustStruct( mg.QnameIdentifierPath, \"parts\", parts )\n }\n rti.addSucc(\n idPathStruct(\n \"id1\", \n []byte{ 0 },\n parser.MustStruct( mg.QnameIdentifier,\n \"parts\", mg.MustList( \"id2\" ),\n ),\n int32( 1 ), \n int64( 2 ),\n uint32( 3 ),\n uint64( 4 ),\n ),\n idPathStruct(\n \"id1\", \n []byte{ 0 },\n parser.MustStruct( mg.QnameIdentifier,\n \"parts\", mg.MustList( \"id2\" ),\n ),\n uint64( 1 ), \n uint64( 2 ), \n uint64( 3 ), \n uint64( 4 ), \n ),\n mg.TypeIdentifierPath,\n dm,\n )\n partsPath := objpath.RootedAt( mkId( \"parts\" ) )\n rti.addError( \n idPathStruct(),\n mg.TypeIdentifierPath,\n newVcErr( partsPath, \"empty list\" ),\n dm,\n )\n rti.addError(\n idPathStruct( true ),\n mg.TypeIdentifierPath,\n newTcErr( \n mg.TypeIdentifierPathPart,\n mg.TypeBoolean,\n partsPath.StartList(),\n ),\n dm,\n )\n rti.addError(\n idPathStruct( float32( 1 ) ),\n mg.TypeIdentifierPath,\n newTcErr( \n mg.TypeIdentifierPathPart,\n mg.TypeFloat32,\n partsPath.StartList(),\n ),\n dm,\n )\n rti.addError(\n idPathStruct( float64( 1 ) ),\n mg.TypeIdentifierPath,\n newTcErr(\n mg.TypeIdentifierPathPart,\n mg.TypeFloat64,\n partsPath.StartList(),\n ),\n dm,\n )\n rti.addError(\n idPathStruct( int32( -1 ) ),\n mg.TypeIdentifierPath,\n newVcErr( partsPath.StartList(), \"value out of range: -1\" ),\n dm,\n )\n}", "title": "" }, { "docid": "ea06639c4cb64e4ca351c81374739904", "score": "0.65022504", "text": "func TestIdentifier(t *testing.T) {\n\tassert := asserts.NewTesting(t, asserts.FailStop)\n\n\t// Identifier.\n\tid := identifier.Identifier(\"One\", 2, \"three four\")\n\tassert.Equal(id, \"one:2:three-four\")\n\n\tid = identifier.Identifier(2011, 6, 22, \"One, two, or three things.\")\n\tassert.Equal(id, \"2011:6:22:one-two-or-three-things\")\n}", "title": "" }, { "docid": "779b75b6fd7e83b665c8816c70ee1910", "score": "0.5602148", "text": "func testIssueTypeByID(t *testing.T) {\n\targ := 1 // issue type id in test data\n\tgot, err := issue.TypeByID(ds, arg)\n\tif err != nil {\n\t\tt.Fatalf(\"issueTypeByID(%d) err = %s\", arg, err)\n\t}\n\n\t// This is what we expect in return\n\twant := issue.Type{\n\t\tID: 1,\n\t\tName: \"Invoice Raised\",\n\t\tDescription: \"A new invoice has been raised and is pending payment.\",\n\t\tAction: \"Members can pay online or by alternate methods specified on the invoice.\",\n\t\tCategory: issue.Category{\n\t\t\tID: 4,\n\t\t\tName: \"Finance\",\n\t\t\tDescription: \"Issues relating to Subscriptions, Invoicing and Payments.\",\n\t\t},\n\t}\n\n\tif !reflect.DeepEqual(got, want) {\n\t\tt.Errorf(\"issue.TypeByID(%d) got !DeepEqual want\", arg)\n\t}\n}", "title": "" }, { "docid": "bc780218a1befa8dee2bc165501dfac6", "score": "0.5352746", "text": "func decodeTypeId(slice []byte) (id TypeId) {\n\tvar idAsUint32 = binary.BigEndian.Uint32(slice)\n\tid = TypeId(idAsUint32)\n\treturn id\n}", "title": "" }, { "docid": "a372e2f307047ea6146d3aad4dcbafe5", "score": "0.5246843", "text": "func TestParseClientIdentifier(t *testing.T) {\n\ttestCases := []struct {\n\t\tname string\n\t\tclientID string\n\t\tclientType string\n\t\texpSeq uint64\n\t\texpPass bool\n\t}{\n\t\t{\"valid 0\", \"tendermint-0\", \"tendermint\", 0, true},\n\t\t{\"valid 1\", \"tendermint-1\", \"tendermint\", 1, true},\n\t\t{\"valid solemachine\", \"solomachine-v1-1\", \"solomachine-v1\", 1, true},\n\t\t{\"valid large sequence\", types.FormatClientIdentifier(\"tendermint\", math.MaxUint64), \"tendermint\", math.MaxUint64, true},\n\t\t{\"valid short client type\", \"t-0\", \"t\", 0, true},\n\t\t// one above uint64 max\n\t\t{\"invalid uint64\", \"tendermint-18446744073709551616\", \"tendermint\", 0, false},\n\t\t// uint64 == 20 characters\n\t\t{\"invalid large sequence\", \"tendermint-2345682193567182931243\", \"tendermint\", 0, false},\n\t\t{\"missing dash\", \"tendermint0\", \"tendermint\", 0, false},\n\t\t{\"blank id\", \" \", \" \", 0, false},\n\t\t{\"empty id\", \"\", \"\", 0, false},\n\t\t{\"negative sequence\", \"tendermint--1\", \"tendermint\", 0, false},\n\t\t{\"invalid format\", \"tendermint-tm\", \"tendermint\", 0, false},\n\t\t{\"empty clientype\", \" -100\", \"tendermint\", 0, false},\n\t}\n\n\tfor _, tc := range testCases {\n\n\t\tclientType, seq, err := types.ParseClientIdentifier(tc.clientID)\n\t\tvalid := types.IsValidClientID(tc.clientID)\n\t\trequire.Equal(t, tc.expSeq, seq, tc.clientID)\n\n\t\tif tc.expPass {\n\t\t\trequire.NoError(t, err, tc.name)\n\t\t\trequire.True(t, valid)\n\t\t\trequire.Equal(t, tc.clientType, clientType)\n\t\t} else {\n\t\t\trequire.Error(t, err, tc.name, tc.clientID)\n\t\t\trequire.False(t, valid)\n\t\t\trequire.Equal(t, \"\", clientType)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1f9a8df620e74d9937e191a632ee3d62", "score": "0.5198557", "text": "func (id ID) ImplementsGraphQLType(name string) bool {\n\treturn name == \"Identifier\"\n}", "title": "" }, { "docid": "e03a833550d5ffc3f0d24e80b8d07d03", "score": "0.5127326", "text": "func testOrganisationByTypeID(t *testing.T) {\n\tcases := []struct {\n\t\targ int // type id\n\t\twant int // count\n\t}{\n\t\t{arg: 1, want: 2},\n\t\t{arg: 2, want: 1},\n\t\t{arg: 4, want: 1},\n\t}\n\n\tfor _, c := range cases {\n\t\txo, err := organisation.ByTypeID(ds, c.arg)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"organisation.ByTypeID(%d) err = %s\", c.arg, err)\n\t\t}\n\t\tgot := len(xo)\n\t\tif got != c.want {\n\t\t\tt.Errorf(\"organisation.ByTypeID(%d) count = %d, want %d\", c.arg, got, c.want)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7583b2647589184d22dd5a70c8ffb96a", "score": "0.50866395", "text": "func testValidJsonPath(tests []jsonexpectations, t *testing.T) {\n\tfor _, test := range tests {\n\t\tfor i, json := range test.json {\n\t\t\tt.Run(fmt.Sprint(test.name, \"_\", i), func(t *testing.T) {\n\t\t\t\tif test.ignore {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tpath := filepath.Join(\"testdata\", \"identifier\", json)\n\t\t\t\tassert.FileExistsf(t, path, \"Datafile Missing: {path}\")\n\t\t\t\tsource, err := os.ReadFile(path)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatal(\"error reading source file:\", err)\n\t\t\t\t}\n\n\t\t\t\tresult, err := GetIdentifierByPath(test.IdentifierPaths, string(source))\n\t\t\t\tvalStr := fmt.Sprint(result)\n\t\t\t\tassert.Equal(t, test.expected, valStr)\n\t\t\t\tassert.Nil(t, err)\n\t\t\t})\n\t\t}\n\t}\n\n\t//t.Run(\"@id\", func(t *testing.T) {\n\t//\n\t//\tresult, err := GetIdentifierByPath(sources[0].IdentifierPath, jsonId)\n\t//\tvalStr := fmt.Sprint(result)\n\t//\tassert.Equal(t, \"[idenfitier]\", valStr)\n\t//\tassert.Nil(t, err)\n\t//})\n\t//t.Run(\".idenfitier\", func(t *testing.T) {\n\t//\n\t//\tresult, err := GetIdentifierByPath(sources[1].IdentifierPath, jsonId)\n\t//\tvalStr := fmt.Sprint(result)\n\t//\tassert.Equal(t, \"[doi:10.1575/1912/bco-dmo.2343.1]\", valStr)\n\t//\tassert.Nil(t, err)\n\t//})\n\t//t.Run(\"$.idenfitier\", func(t *testing.T) {\n\t//\n\t//\tresult, err := GetIdentifierByPath(sources[2].IdentifierPath, jsonId)\n\t//\tvalStr := fmt.Sprint(result)\n\t//\tassert.Equal(t, \"[doi:10.1575/1912/bco-dmo.2343.1]\", valStr)\n\t//\tassert.Nil(t, err)\n\t//})\n\t// to do: test for valid JSON but invalid RDF triples\n}", "title": "" }, { "docid": "6ccab007f85219ed1ca83da218178a02", "score": "0.50744575", "text": "func (d *decompiler) typeIdent(name string) *ast.Ident {\n\tif isID(name) {\n\t\tname = \"_\" + name\n\t}\n\treturn ident(name)\n}", "title": "" }, { "docid": "5eed4d9dccc22c9ed16102fe682d13c6", "score": "0.5060331", "text": "func TestClaimsIdentifier(t *testing.T) {\n\tassert := asserts.NewTesting(t, asserts.FailStop)\n\tassert.Logf(\"testing claim \\\"jti\\\"\")\n\tidentifier := \"foo\"\n\tc := token.NewClaims()\n\tjti, ok := c.Identifier()\n\tassert.False(ok)\n\tassert.Empty(jti)\n\tnone := c.SetIdentifier(identifier)\n\tassert.Equal(none, \"\")\n\tjti, ok = c.Identifier()\n\tassert.Equal(jti, identifier)\n\tassert.True(ok)\n\told := c.DeleteIdentifier()\n\tassert.Equal(old, jti)\n\t_, ok = c.Identifier()\n\tassert.False(ok)\n}", "title": "" }, { "docid": "bfbb2603e98088e2b3f305d844524d0e", "score": "0.50564253", "text": "func TypeNameId(obj *types.TypeName,) string", "title": "" }, { "docid": "885d388a7b7c81fce7265048b38ebbb4", "score": "0.4996092", "text": "func TypeIDFromBytes(slice []byte) (id TypeID) {\n\t// TODO: panic if len(slice) > 8 ???\n\tcopy(id[:], slice)\n\treturn id\n}", "title": "" }, { "docid": "fdf11d9685edc65372834ce106d015a8", "score": "0.49691254", "text": "func (*FilePart) TypeID() uint32 {\n\treturn FilePartTypeID\n}", "title": "" }, { "docid": "abef336e7c6cd5b9a12c75ff97c92f67", "score": "0.49690327", "text": "func isID(name string) bool {\n\tfor _, r := range name {\n\t\tif strings.IndexRune(\"0123456789\", r) == -1 {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn len(name) > 0\n}", "title": "" }, { "docid": "d9bfa073ae1380e8e547827dbba0506c", "score": "0.49466234", "text": "func Id(stem string, parts ...interface{}) string {\n\tiparts := make([]string, len(parts)+1)\n\tiparts[0] = stem\n\tfor i, p := range parts {\n\t\tswitch pv := p.(type) {\n\t\tcase string:\n\t\t\tiparts[i+1] = pv\n\t\tdefault:\n\t\t\tiparts[i+1] = fmt.Sprintf(\"%v\", pv)\n\t\t}\n\t}\n\treturn strings.Join(iparts, \"/\")\n}", "title": "" }, { "docid": "f0b2300631581dc79b7a2cb373f83d29", "score": "0.4945739", "text": "func TestSepIdentifier(t *testing.T) {\n\tassert := asserts.NewTesting(t, asserts.FailStop)\n\n\tid := identifier.SepIdentifier(\"+\", 1, \"oNe\", 2, \"TWO\", \"3\", \"ÄÖÜ\")\n\tassert.Equal(id, \"1+one+2+two+3\")\n\n\tid = identifier.LimitedSepIdentifier(\"+\", false, 1, \"oNe\", 2, \"TWO\", \"3\", \"ÄÖÜ\")\n\tassert.Equal(id, \"1+one+2+two+3+äöü\")\n\n\tid = identifier.LimitedSepIdentifier(\"+\", true, \" \", 1, \"oNe\", 2, \"TWO\", \"3\", \"ÄÖÜ\", \"Four\", \"+#-:,\")\n\tassert.Equal(id, \"1+one+2+two+3+four\")\n}", "title": "" }, { "docid": "5da083fd7d7af8b92ce615090342f7e1", "score": "0.49317092", "text": "func typeDescIdent(p *types.Package, t types.Type) (string, error) {\n\tswitch t := t.(type) {\n\tcase *types.Basic:\n\t\treturn exported(t.Name()), nil\n\tcase *types.Pointer:\n\t\tnamed, ok := t.Elem().(*types.Named)\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\ts := exported(named.Obj().Name())\n\t\tif named.Obj().Pkg().Path() == p.Path() {\n\t\t\treturn s, nil\n\t\t} else {\n\t\t\treturn exported(named.Obj().Pkg().Name()) + s, nil\n\t\t}\n\tcase *types.Slice:\n\t\tbasic, ok := t.Elem().(*types.Basic)\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\treturn \"SliceOf\" + exported(basic.Name()), nil\n\t}\n\treturn \"\", fmt.Errorf(\"cannot convert %v to a local name\", t)\n}", "title": "" }, { "docid": "81895ea3843d872b1980e5c6e7b67ccf", "score": "0.48966956", "text": "func testDF17Ident(t *testing.T) {\n\ttc := &testCase{\n\t\tMsg: \"8dacf84e23101332cf3ca037ef13\",\n\n\t\tDF: 17,\n\t\tCA: 5,\n\t\tFS: -1,\n\t\tVS: -1,\n\n\t\tTC: 4,\n\t\tSS: -1,\n\t\tCat: \"A3\",\n\n\t\tCPR: false,\n\n\t\tICAO: 0xacf84e,\n\t\tAlt: 0,\n\t\tSqk: []byte{},\n\t\tCall: \"DAL2332\",\n\t}\n\n\ttestDecode(t, tc)\n}", "title": "" }, { "docid": "de9568a15fca7143d84b3032b7ab92fb", "score": "0.48879135", "text": "func isID(s string) bool {\n\tfor _, r := range s {\n\t\tif !strings.ContainsRune(\"0123456789\", r) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "65cd717a5289cfca32752dbd95a33694", "score": "0.4885626", "text": "func TestParser_ParseIdent(t *testing.T) {\n\ttests := []struct {\n\t\tstr string\n\t\tobj *ast.Identifier\n\t\terr string\n\t}{\n\t\t{str: \"x\", obj: &ast.Identifier{Token: token.IDENT, Position: testPos, Name: \"x\"}},\n\t\t{str: \"mylabel\", obj: &ast.Identifier{Token: token.IDENT, Position: testPos, Name: \"mylabel\"}},\n\t\t{str: \":x\", err: `1:1: found \":\", expected IDENTIFIER`},\n\t\t{str: \"123\", err: `1:1: found INTEGER \"123\", expected IDENTIFIER`},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.str, func(t *testing.T) {\n\t\t\tident, err := New(strings.NewReader(tt.str)).parseIdent()\n\t\t\tif tt.err == \"\" {\n\t\t\t\tok(t, err)\n\t\t\t\tequals(t, ident, tt.obj)\n\t\t\t} else {\n\t\t\t\tequals(t, err.Error(), tt.err)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "9433091b63f590d0ec3077adebb1dfcc", "score": "0.48657456", "text": "func TestNounParts(t *testing.T) {\n\tif asm, e := newAssemblyTest(t, testdb.Memory); e != nil {\n\t\tt.Fatal(e)\n\t} else {\n\t\tdefer asm.db.Close()\n\t\t//\n\t\tif e := AddTestHierarchy(asm.assembler,\n\t\t\t\"Ts\", \"\",\n\t\t); e != nil {\n\t\t\tt.Fatal(e)\n\t\t} else if e := addNounEphemera(asm.rec,\n\t\t\t\"collection of words\", \"T\",\n\t\t); e != nil {\n\t\t\tt.Fatal(e)\n\t\t} else if e := AssembleNouns(asm.assembler); e != nil {\n\t\t\tt.Fatal(e)\n\t\t} else if e := matchNouns(asm.db, []modeledNoun{\n\t\t\t{\"collection of words\", \"Ts\", 0},\n\t\t\t{\"collection_of_words\", \"Ts\", 1},\n\t\t\t{\"words\", \"Ts\", 2},\n\t\t\t{\"of\", \"Ts\", 3},\n\t\t\t{\"collection\", \"Ts\", 4},\n\t\t}); e != nil {\n\t\t\tt.Fatal(e)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7349450be04772b4f18d9110b0d707c4", "score": "0.4865605", "text": "func TypeStringToPhysicalID(tp string) int {\n\tswitch tp {\n\tcase TypeSel:\n\t\treturn typeSelID\n\tcase TypeSet:\n\t\treturn typeSetID\n\tcase TypeProj:\n\t\treturn typeProjID\n\tcase TypeAgg:\n\t\treturn typeAggID\n\tcase TypeStreamAgg:\n\t\treturn typeStreamAggID\n\tcase TypeHashAgg:\n\t\treturn typeHashAggID\n\tcase TypeShow:\n\t\treturn typeShowID\n\tcase TypeJoin:\n\t\treturn typeJoinID\n\tcase TypeUnion:\n\t\treturn typeUnionID\n\tcase TypePartitionUnion:\n\t\treturn typePartitionUnionID\n\tcase TypeTableScan:\n\t\treturn typeTableScanID\n\tcase TypeMemTableScan:\n\t\treturn typeMemTableScanID\n\tcase TypeUnionScan:\n\t\treturn typeUnionScanID\n\tcase TypeIdxScan:\n\t\treturn typeIdxScanID\n\tcase TypeSort:\n\t\treturn typeSortID\n\tcase TypeTopN:\n\t\treturn typeTopNID\n\tcase TypeLimit:\n\t\treturn typeLimitID\n\tcase TypeHashJoin:\n\t\treturn typeHashJoinID\n\tcase TypeMergeJoin:\n\t\treturn typeMergeJoinID\n\tcase TypeIndexJoin:\n\t\treturn typeIndexJoinID\n\tcase TypeIndexMergeJoin:\n\t\treturn typeIndexMergeJoinID\n\tcase TypeIndexHashJoin:\n\t\treturn typeIndexHashJoinID\n\tcase TypeApply:\n\t\treturn typeApplyID\n\tcase TypeMaxOneRow:\n\t\treturn typeMaxOneRowID\n\tcase TypeExists:\n\t\treturn typeExistsID\n\tcase TypeDual:\n\t\treturn typeDualID\n\tcase TypeLock:\n\t\treturn typeLockID\n\tcase TypeInsert:\n\t\treturn typeInsertID\n\tcase TypeUpdate:\n\t\treturn typeUpdateID\n\tcase TypeDelete:\n\t\treturn typeDeleteID\n\tcase TypeIndexLookUp:\n\t\treturn typeIndexLookUpID\n\tcase TypeTableReader:\n\t\treturn typeTableReaderID\n\tcase TypeIndexReader:\n\t\treturn typeIndexReaderID\n\tcase TypeWindow:\n\t\treturn typeWindowID\n\tcase TypeShuffle:\n\t\treturn typeShuffleID\n\tcase TypeShuffleReceiver:\n\t\treturn typeShuffleReceiverID\n\tcase TypeTiKVSingleGather:\n\t\treturn typeTiKVSingleGatherID\n\tcase TypeIndexMerge:\n\t\treturn typeIndexMergeID\n\tcase TypePointGet:\n\t\treturn typePointGet\n\tcase TypeShowDDLJobs:\n\t\treturn typeShowDDLJobs\n\tcase TypeBatchPointGet:\n\t\treturn typeBatchPointGet\n\tcase TypeClusterMemTableReader:\n\t\treturn typeClusterMemTableReader\n\tcase TypeDataSource:\n\t\treturn typeDataSourceID\n\tcase TypeLoadData:\n\t\treturn typeLoadDataID\n\tcase TypeTableSample:\n\t\treturn typeTableSampleID\n\tcase TypeTableFullScan:\n\t\treturn typeTableFullScanID\n\tcase TypeTableRangeScan:\n\t\treturn typeTableRangeScanID\n\tcase TypeTableRowIDScan:\n\t\treturn typeTableRowIDScanID\n\tcase TypeIndexFullScan:\n\t\treturn typeIndexFullScanID\n\tcase TypeIndexRangeScan:\n\t\treturn typeIndexRangeScanID\n\tcase TypeExchangeReceiver:\n\t\treturn typeExchangeReceiverID\n\tcase TypeExchangeSender:\n\t\treturn typeExchangeSenderID\n\tcase TypeCTE:\n\t\treturn typeCTEID\n\tcase TypeCTEDefinition:\n\t\treturn typeCTEDefinitionID\n\tcase TypeCTETable:\n\t\treturn typeCTETableID\n\tcase TypeForeignKeyCheck:\n\t\treturn typeForeignKeyCheck\n\tcase TypeForeignKeyCascade:\n\t\treturn typeForeignKeyCascade\n\tcase TypeExpand:\n\t\treturn typeExpandID\n\tcase TypeImportInto:\n\t\treturn typeImportIntoID\n\tcase TypeScalarSubQuery:\n\t\treturn TypeScalarSubQueryID\n\t}\n\t// Should never reach here.\n\treturn 0\n}", "title": "" }, { "docid": "606ebb9d0423994b14c8debcbdbad1c0", "score": "0.4781523", "text": "func (t *apiType) typeId() string {\n\tt = t.deref()\n\treturn t.Name.String()\n}", "title": "" }, { "docid": "9f7588b50743f3a1254d4df7fee450bb", "score": "0.47698984", "text": "func NewTypeIdent(name string) goast.Expr {\n\treturn typeToExpr(name)\n}", "title": "" }, { "docid": "5265e293bf4451e2782b25767196aea9", "score": "0.47693646", "text": "func (i ThirdpartyIdentifier) Type() string {\n\treturn \"m.id.thirdparty\"\n}", "title": "" }, { "docid": "82ad431122fa35fc927032e97b2e168a", "score": "0.47407162", "text": "func MustBeAnIdentifier(value string) func(context.Context) error {\n\treturn func(ctx context.Context) error {\n\t\treturn validation.Validate(value, helpers.IDValidationRules...)\n\t}\n}", "title": "" }, { "docid": "402c2b32ebf63bcb6cbf153ee18853b0", "score": "0.473949", "text": "func GetTypeIdentifier(name string) ([]string, error) {\n\tschema, err := GetTypeSchema(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif schema == \"\" {\n\t\treturn nil, errors.New(\"schema is empty\")\n\t}\n\n\tvar result map[string]any\n\tjson.Unmarshal([]byte(schema), &result)\n\n\tconfig.Debugf(\"GetTypeIdentifier schema for %s: %v\", name, result)\n\n\tpiNode, exists := result[\"primaryIdentifier\"]\n\tif !exists {\n\t\t// The schema does not have a primary identifier.\n\t\t// TODO\n\t\tconfig.Debugf(\"GetTypeIdentifier %v does not have a primaryIdentifier\", name)\n\t\treturn nil, errors.New(\"no primary identifier\")\n\t} else {\n\t\tpi := piNode.([]interface{})\n\t\tretval := make([]string, 0)\n\t\tfor _, pid := range pi {\n\t\t\tretval = append(retval, strings.Replace(fmt.Sprintf(\"%v\", pid), \"/properties/\", \"\", 1))\n\t\t}\n\t\tconfig.Debugf(\"GetTypeIdentifier for %v: %v\", name, retval)\n\t\treturn retval, nil\n\t}\n}", "title": "" }, { "docid": "d1b551d28e96a7f28746e20ceb6c64ad", "score": "0.4726946", "text": "func TestCreateItem(t *testing.T) {\n\texpected := \"flowingrobes\"\n\ttestItem := createItem(expected)\n\n\tactual := getXidName(testItem)\n\tif actual != expected {\n\t\tt.Errorf(\"got a name mismatch: got %v wanted %v\",\n\t\t\tactual, expected)\n\t\tfmt.Printf(\"%+v\\n\", testItem)\n\t}\n}", "title": "" }, { "docid": "bc14165db57ff1f73795c085c8a41170", "score": "0.4700443", "text": "func ident(s string) (id string, ok bool) {\n\t// Scan [\\pL_][\\pL_0-9]*\n\tn := 0\n\tfor n < len(s) {\n\t\tif c := s[n]; c < utf8.RuneSelf {\n\t\t\tif isIdentASCII(c) && (n > 0 || c < '0' || c > '9') {\n\t\t\t\tn++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tr, nr := utf8.DecodeRuneInString(s[n:])\n\t\tif unicode.IsLetter(r) {\n\t\t\tn += nr\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\treturn s[:n], n > 0\n}", "title": "" }, { "docid": "927b51211162557fb6ba37874beb2094", "score": "0.47000816", "text": "func Identifier(t testing.TB) string {\n\ts := t.Name()\n\ts = strings.ReplaceAll(s, \" \", \"_\")\n\ts = strings.ReplaceAll(s, \"/\", \"-\")\n\ts = strings.ToLower(s)\n\ts = \"nerdctl-\" + s\n\tif len(s) > 76 {\n\t\ts = \"nerdctl-\" + digest.SHA256.FromString(t.Name()).Encoded()\n\t}\n\treturn s\n}", "title": "" }, { "docid": "5446794204301011ff0b0bb3cc34da5b", "score": "0.46849522", "text": "func (s *BaseScssParserListener) EnterIdentifierPart(ctx *IdentifierPartContext) {}", "title": "" }, { "docid": "979d2b970f769d2083a0522bbf5f80b3", "score": "0.46765837", "text": "func Identify(s string) (string, error) {\n\tif len(prefix) == 0 {\n\t\treturn prefix, fmt.Errorf(\"id: Init() not called or failed to initialize\")\n\t}\n\n\ts = bracket.ReplaceAllString(s, \"\")\n\ts = invalid.ReplaceAllString(s, \"-\")\n\n\tif len(s) == 0 {\n\t\treturn prefix, nil\n\t}\n\n\ts = strings.ToLower(s)\n\tif s[0] < 'a' || s[0] > 'z' {\n\t\ts = prefix + \"-\" + s\n\t}\n\n\ts = repeat.ReplaceAllString(s, \"-\") // handle duplicate '-'\n\n\tl := len(s)\n\tif l > 1 && s[l-1] == '-' { // handle '-' at the end of the ID\n\t\ts = s[:l-1]\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "751de54c103e7c64e31e85acff52945d", "score": "0.46618733", "text": "func IsIdentifier(name string) bool {\n\tfor i, c := range name {\n\t\tif !unicode.IsLetter(c) && c != '_' && (i == 0 || !unicode.IsDigit(c)) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn name != \"\" && !IsKeyword(name)\n}", "title": "" }, { "docid": "a25b99a6874c775601bbcfd91af08a89", "score": "0.4657727", "text": "func (i PhoneIdentifier) Type() string {\n\treturn \"m.id.phone\"\n}", "title": "" }, { "docid": "d7dbff9f683eed3f9c458c34f70c7a56", "score": "0.4652646", "text": "func (s *BaseIDLListener) EnterSimple_type_spec(ctx *Simple_type_specContext) {}", "title": "" }, { "docid": "5664ef10c73dd9a30eb6472a73da6c91", "score": "0.4651985", "text": "func testValidJsonPaths(tests []jsonexpectations, t *testing.T) {\n\tfor _, test := range tests {\n\t\tfor i, json := range test.json {\n\t\t\tt.Run(fmt.Sprint(test.name, \"_\", i), func(t *testing.T) {\n\t\t\t\tif test.ignore {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tpath := filepath.Join(\"testdata\", \"identifier\", json)\n\t\t\t\tassert.FileExistsf(t, path, \"Datafile Missing: {path}\")\n\t\t\t\tsource, err := os.ReadFile(path)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatal(\"error reading source file:\", err)\n\t\t\t\t}\n\t\t\t\tpaths := strings.Split(test.IdentifierPaths, \",\")\n\t\t\t\tresult, foundPath, err := GetIdentiferByPaths(paths, string(source))\n\t\t\t\tvalStr := fmt.Sprint(result)\n\t\t\t\tassert.Equal(t, test.expected, valStr, \"expected Failed\")\n\t\t\t\tassert.Equal(t, test.expectedPath, foundPath, \"matched Path Failed\")\n\t\t\t\tassert.Nil(t, err)\n\t\t\t})\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "7dfd65c62eb8976fa7302572541cd6f0", "score": "0.46366477", "text": "func (t Type) ID() string {\n return TypeToID[t]\n}", "title": "" }, { "docid": "7699961556a3ac78be5eb5b42ceea013", "score": "0.46340314", "text": "func (s *BaseIDLListener) EnterType_spec(ctx *Type_specContext) {}", "title": "" }, { "docid": "a6111b6eddcf45c7ed9341dc2c4b9264", "score": "0.46191153", "text": "func isIdentifier(s string) bool {\n\tif s == \"\" {\n\t\treturn false\n\t}\n\tfor i, r := range s {\n\t\tif r != '_' && !unicode.IsLetter(r) && (i == 0 || !unicode.IsDigit(r)) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn !isGoKeyword(s)\n}", "title": "" }, { "docid": "0feb24b217b23701e397993e5bf89a15", "score": "0.46168238", "text": "func testValidateEDRecordType(t testing.TB) {\n\ted := mockEntryDetail()\n\ted.recordType = \"2\"\n\terr := ed.Validate()\n\tif !base.Match(err, NewErrRecordType(6)) {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n}", "title": "" }, { "docid": "dda57b20fdd784f25454522156f65ce9", "score": "0.4614273", "text": "func GetIdentifier(ident string) Type {\n\tif t, ok := keywords[ident]; ok {\n\t\treturn t\n\t}\n\treturn IDENTIFIER\n}", "title": "" }, { "docid": "7c97d61d89fdd89ddc3b7e58efed4879", "score": "0.46024972", "text": "func NewTestId() string {\n\tnewId := []byte(model.NewId())\n\n\tfor i := 1; i < len(newId); i = i + 2 {\n\t\tnewId[i] = 48 + newId[i-1]%10\n\t}\n\n\treturn string(newId)\n}", "title": "" }, { "docid": "a66654bbdaa9bbc38e337d8d09e35a16", "score": "0.46015674", "text": "func TestValidateID(t *testing.T) {\n\tfmt.Println(\"\\n>> ctmUtils_test : TestValidateID\")\n\tctmUtils := ctmutils.New()\n\n\tvar testsValues = []struct {\n\t\tword string // input\n\t\texpected bool // expected result\n\t}{\n\t\t{\"85JT-F69X-GLPB-VL4\", true},\n\t\t{\"85JT-F69X-GLPB-VL0\", false},\n\t\t{\"85JT-F69X-GLPB-VL1\", false},\n\t\t{\"85JT-F69X-GLPB-VL2\", false},\n\t\t{\"85JT-F69X-GLPB-VL3\", false},\n\t\t{\"85JT-F69X-GLPB-VL5\", false},\n\t\t{\"85JT-F69X-GLPB-VL6\", false},\n\t\t{\"85JT-F69X-GLPB-VL7\", false},\n\t\t{\"85JT-F69X-GLPB-VL8\", false},\n\t\t{\"85JT-F69X-GLPB-VL9\", false},\n\t\t{\"85JTF69XGLPBVL4\", true},\n\t\t{\"85JTF69XGLPBVL0\", false},\n\t\t{\"A1B20\", false},\n\t\t{\"A1B2-FE0\", false},\n\t}\n\tfor _, tt := range testsValues {\n\t\tactual := ctmUtils.ValidateID(tt.word)\n\t\tif actual != tt.expected {\n\t\t\tt.Errorf(\" - Debug :: ValidateID(%v): expected %t, actual %t\", tt.word, tt.expected, actual)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2143c9792eaed1418cd079bd23eac538", "score": "0.45948166", "text": "func TestMsgCreateIdentityType(t *testing.T) {\n\tmsg := NewMsgCreateIdentity(testID, &testPubKeySM2Info, testCertificate, testCredentials, testOwner)\n\n\trequire.Equal(t, \"create_identity\", msg.Type())\n}", "title": "" }, { "docid": "40731c7e21e83d0874b3254f15575043", "score": "0.45924923", "text": "func (p *pass) setPassTypeIdentifier() error {\n\n\t//get the correct pass type id\n\tswitch p.PassType {\n\tcase \"boardingPass\":\n\t\tp.KeyDoc.PassTypeIdentifier = \"pass.ninja.pass.boardingpass\"\n\tcase \"coupon\":\n\t\tp.KeyDoc.PassTypeIdentifier = \"pass.ninja.pass.coupon\"\n\tcase \"eventTicket\":\n\t\tp.KeyDoc.PassTypeIdentifier = \"pass.ninja.pass.eventticket\"\n\tcase \"generic\":\n\t\tp.KeyDoc.PassTypeIdentifier = \"pass.ninja.pass.generic\"\n\tcase \"storeCard\":\n\t\tp.KeyDoc.PassTypeIdentifier = \"pass.ninja.pass.storecard\"\n\tdefault:\n\t\tlog.Printf(\"[WARN] Pass type %s not found\", p.PassType)\n\t\treturn fmt.Errorf(\"the submitted data is malformed\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "840a422cd40b34313cf7e7d74e7da7ec", "score": "0.45908576", "text": "func TestSubTypeCodeValid(t *testing.T) {\n\ttst := mockTypeSubType()\n\ttst.SubTypeCode = \"ZZ\"\n\tif err := tst.Validate(); err != nil {\n\t\tif !base.Match(err, ErrSubTypeCode) {\n\t\t\tt.Errorf(\"%T: %s\", err, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bd49d315f711a6bdf92129c0b6b3816c", "score": "0.4585263", "text": "func testEDFieldInclusionRecordType(t testing.TB) {\n\tentry := mockEntryDetail()\n\tentry.recordType = \"\"\n\terr := entry.Validate()\n\tif !base.Match(err, ErrConstructor) {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n}", "title": "" }, { "docid": "c4d833419e8535b1c16d6ea040e6c7a1", "score": "0.45845163", "text": "func isValidIDType(id interface{}) bool {\n\tswitch id.(type) {\n\tcase int, int8, int16, int32, int64,\n\tuint, uint8, uint16, uint32, uint64,\n\tfloat32, float64, string, nil:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "0abd7b3d7fce2dbbeb3506c611ed9a97", "score": "0.45828775", "text": "func ParseIdentifier(s string) (Identifier, error) {\n\tfields := strings.Split(s, \"/\")\n\tif len(fields) != 3 {\n\t\treturn Identifier{}, fmt.Errorf(\"not a valid identifier: %q\", s)\n\t}\n\n\tid := Identifier{\n\t\tHost: fields[0],\n\t\tPlugin: fields[1],\n\t\tType: fields[2],\n\t}\n\n\tif i := strings.Index(id.Plugin, \"-\"); i != -1 {\n\t\tid.PluginInstance = id.Plugin[i+1:]\n\t\tid.Plugin = id.Plugin[:i]\n\t}\n\n\tif i := strings.Index(id.Type, \"-\"); i != -1 {\n\t\tid.TypeInstance = id.Type[i+1:]\n\t\tid.Type = id.Type[:i]\n\t}\n\n\treturn id, nil\n}", "title": "" }, { "docid": "0abd7b3d7fce2dbbeb3506c611ed9a97", "score": "0.45828775", "text": "func ParseIdentifier(s string) (Identifier, error) {\n\tfields := strings.Split(s, \"/\")\n\tif len(fields) != 3 {\n\t\treturn Identifier{}, fmt.Errorf(\"not a valid identifier: %q\", s)\n\t}\n\n\tid := Identifier{\n\t\tHost: fields[0],\n\t\tPlugin: fields[1],\n\t\tType: fields[2],\n\t}\n\n\tif i := strings.Index(id.Plugin, \"-\"); i != -1 {\n\t\tid.PluginInstance = id.Plugin[i+1:]\n\t\tid.Plugin = id.Plugin[:i]\n\t}\n\n\tif i := strings.Index(id.Type, \"-\"); i != -1 {\n\t\tid.TypeInstance = id.Type[i+1:]\n\t\tid.Type = id.Type[:i]\n\t}\n\n\treturn id, nil\n}", "title": "" }, { "docid": "867d8d871c1cbcce9f82bd3cf2ba75bf", "score": "0.45763928", "text": "func TestTypeResolutionManyToOne(t *testing.T) {\n\ttests := []struct {\n\t\tname string // name is the test identifier.\n\t\t// inLeaves is the set of yang.Entry pointers that are to have types generated\n\t\t// for them.\n\t\tinLeaves []*yang.Entry\n\t\t// inCompressOCPaths enables or disables \"CompressOCPaths\" for the YANGCodeGenerator\n\t\t// instance used for the test.\n\t\tinCompressOCPaths bool\n\t\t// wantTypes is a map, keyed by the path of the yang.Entry within inLeaves and\n\t\t// describing the mappedType that is expected to be output.\n\t\twantTypes map[string]*mappedType\n\t}{{\n\t\tname: \"identity with multiple identityref leaves\",\n\t\tinLeaves: []*yang.Entry{{\n\t\t\tName: \"leaf-one\",\n\t\t\tType: &yang.YangType{\n\t\t\t\tName: \"identityref\",\n\t\t\t\tKind: yang.Yidentityref,\n\t\t\t\tIdentityBase: &yang.Identity{\n\t\t\t\t\tName: \"base-identity\",\n\t\t\t\t\tParent: &yang.Module{\n\t\t\t\t\t\tName: \"test-module\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tParent: &yang.Entry{Name: \"test-module\"},\n\t\t\tNode: &yang.Leaf{\n\t\t\t\tParent: &yang.Module{\n\t\t\t\t\tName: \"test-module\",\n\t\t\t\t},\n\t\t\t},\n\t\t}, {\n\t\t\tName: \"leaf-two\",\n\t\t\tType: &yang.YangType{\n\t\t\t\tName: \"identityref\",\n\t\t\t\tKind: yang.Yidentityref,\n\t\t\t\tIdentityBase: &yang.Identity{\n\t\t\t\t\tName: \"base-identity\",\n\t\t\t\t\tParent: &yang.Module{\n\t\t\t\t\t\tName: \"test-module\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tParent: &yang.Entry{Name: \"test-module\"},\n\t\t\tNode: &yang.Leaf{\n\t\t\t\tParent: &yang.Module{\n\t\t\t\t\tName: \"test-module\",\n\t\t\t\t},\n\t\t\t},\n\t\t}},\n\t\twantTypes: map[string]*mappedType{\n\t\t\t\"/test-module/leaf-one\": {nativeType: \"E_TestModule_BaseIdentity\", isEnumeratedValue: true},\n\t\t\t\"/test-module/leaf-two\": {nativeType: \"E_TestModule_BaseIdentity\", isEnumeratedValue: true},\n\t\t},\n\t}, {\n\t\tname: \"typedef with multiple references\",\n\t\tinLeaves: []*yang.Entry{{\n\t\t\tName: \"leaf-one\",\n\t\t\tParent: &yang.Entry{\n\t\t\t\tName: \"base-module\",\n\t\t\t},\n\t\t\tType: &yang.YangType{\n\t\t\t\tName: \"definedType\",\n\t\t\t\tKind: yang.Yenum,\n\t\t\t\tEnum: &yang.EnumType{},\n\t\t\t},\n\t\t\tNode: &yang.Enum{\n\t\t\t\tParent: &yang.Module{\n\t\t\t\t\tName: \"base-module\",\n\t\t\t\t},\n\t\t\t},\n\t\t}, {\n\t\t\tName: \"leaf-two\",\n\t\t\tParent: &yang.Entry{\n\t\t\t\tName: \"base-module\",\n\t\t\t},\n\t\t\tType: &yang.YangType{\n\t\t\t\tName: \"definedType\",\n\t\t\t\tKind: yang.Yenum,\n\t\t\t\tEnum: &yang.EnumType{},\n\t\t\t},\n\t\t\tNode: &yang.Enum{\n\t\t\t\tParent: &yang.Module{\n\t\t\t\t\tName: \"base-module\",\n\t\t\t\t},\n\t\t\t},\n\t\t}},\n\t\twantTypes: map[string]*mappedType{\n\t\t\t\"/base-module/leaf-one\": {nativeType: \"E_BaseModule_DefinedType\", isEnumeratedValue: true},\n\t\t\t\"/base-module/leaf-two\": {nativeType: \"E_BaseModule_DefinedType\", isEnumeratedValue: true},\n\t\t},\n\t}}\n\n\tfor _, tt := range tests {\n\t\ts := newGenState()\n\t\tgotTypes := make(map[string]*mappedType)\n\t\tfor _, leaf := range tt.inLeaves {\n\t\t\tmtype, err := s.yangTypeToGoType(resolveTypeArgs{yangType: leaf.Type, contextEntry: leaf}, tt.inCompressOCPaths)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"%s: yangTypeToGoType(%v, %v): got unexpected err: %v, want: nil\", tt.name, leaf.Type, leaf, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tgotTypes[leaf.Path()] = mtype\n\t\t}\n\n\t\tif diff := pretty.Compare(gotTypes, tt.wantTypes); diff != \"\" {\n\t\t\tt.Errorf(\"%s: yangTypesToGoTypes(...): incorrect output returned, diff (-got,+want):\\n%s\",\n\t\t\t\ttt.name, diff)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3494894fed5f11ede3aed733c1e7cc5c", "score": "0.45707333", "text": "func TestJobId(t *testing.T) {\n\tsetup()\n\n\ttests := []struct {\n\t\tin string\n\t\texpected jobIdentifier\n\t}{\n\t\t{\"\", 0},\n\t\t{\"x\", 0},\n\t\t{\"12345\", 0},\n\t\t{\"1234\", 0x1234},\n\t\t{\"c0de\", 0xc0de},\n\t}\n\n\tfor i, test := range tests {\n\n\t\tjobId := stringToJobId(test.in)\n\t\tif test.expected != jobId {\n\t\t\tt.Errorf(\"%d: convert: %q actual: %s expected: %s\", i, test.in, jobId, test.expected)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "11dfab23b2b4cbc8867a9ae76c8bfa3d", "score": "0.45657885", "text": "func getTestName(s string) (name string, idx int) {\r\n\tall := strings.Split(s, \":\")\r\n\tif len(all) > 0 {\r\n\t\tname = all[0]\r\n\t}\r\n\tidx = -1\r\n\tif len(all) > 1 {\r\n\t\ti2, err := strconv.ParseInt(all[1], 10, 32)\r\n\t\tif err == nil {\r\n\t\t\tidx = int(i2)\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "title": "" }, { "docid": "d02cca37bb05a3ba2c597b7b30883a6a", "score": "0.45652", "text": "func IsIdentifier(name string) bool {\n\tfor i, c := range name {\n\t\tif !unicode.IsLetter(c) && (i == 0 || !unicode.IsDigit(c) && c != '_') {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn name != \"\" && !IsKeyword(name)\n}", "title": "" }, { "docid": "3b097f7e8406010f38d9f8a82260abbe", "score": "0.45603898", "text": "func (s *workItemTypeSuite) TestCreateWorkItemType() {\n\tdefer cleaner.DeleteCreatedEntities(s.DB)()\n\n\t_, wit := s.createWorkItemTypeAnimal()\n\trequire.NotNil(s.T(), wit)\n\trequire.Equal(s.T(), \"animal\", wit.Name)\n\n\t_, wit = s.createWorkItemTypePerson()\n\trequire.NotNil(s.T(), wit)\n\trequire.Equal(s.T(), \"person\", wit.Name)\n}", "title": "" }, { "docid": "ed9eec9ef0c1a981430153bcec20fb18", "score": "0.45587385", "text": "func TestHandler_URLMappingItemFailCreateVarNameMore45(t *testing.T) {\n\tname := common.RandomStr(7)\n\tname2 := common.RandomStr(46)\n\tname3 := common.RandomStr(7)\n\t// dummy\n\tfakePriceType1 := model.DummyPricingType()\n\tfakePriceType2 := model.DummyPricingType()\n\tfakePriceType3 := model.DummyPricingType()\n\tfakePriceType4 := model.DummyPricingType()\n\tcategory := model.DummyItemCategory()\n\tcategory.IsDeleted = int8(0)\n\tcategory.Save()\n\tmeasure := model.DummyMeasurement()\n\tmeasure.IsDeleted = int8(0)\n\tmeasure.Save()\n\n\t// melakukan proses login\n\tuser := model.DummyUserPriviledgeWithUsergroup(1)\n\tsd, _ := auth.Login(user)\n\ttoken := \"Bearer \" + sd.Token\n\n\t// setting body\n\tscenario := tester.D{\n\t\t\"item_type\": \"product\",\n\t\t\"item_name\": name,\n\t\t\"category_id\": common.Encrypt(category.ID),\n\t\t\"measurement_id\": common.Encrypt(measure.ID),\n\t\t\"note\": \"note\",\n\t\t\"has_variant\": int8(1),\n\t\t\"item_variants\": []tester.D{\n\t\t\t{\n\t\t\t\t\"external_name\": name2,\n\t\t\t\t\"variant_name\": name2,\n\t\t\t\t\"minimum_stock\": float32(10),\n\t\t\t\t\"base_price\": float64(1000),\n\t\t\t\t\"note\": \"note var\",\n\t\t\t\t\"image\": \"image\",\n\t\t\t\t\"item_variant_prices\": []tester.D{\n\t\t\t\t\t{\n\t\t\t\t\t\t\"pricing_type_id\": common.Encrypt(fakePriceType1.ID),\n\t\t\t\t\t\t\"unit_price\": float64(2000),\n\t\t\t\t\t\t\"note\": \"note var price\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"pricing_type_id\": common.Encrypt(fakePriceType2.ID),\n\t\t\t\t\t\t\"unit_price\": float64(2000),\n\t\t\t\t\t\t\"note\": \"note var price\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"external_name\": name3,\n\t\t\t\t\"variant_name\": name3,\n\t\t\t\t\"minimum_stock\": float32(10),\n\t\t\t\t\"base_price\": float64(1000),\n\t\t\t\t\"note\": \"note var\",\n\t\t\t\t\"image\": \"image\",\n\t\t\t\t\"item_variant_prices\": []tester.D{\n\t\t\t\t\t{\n\t\t\t\t\t\t\"pricing_type_id\": common.Encrypt(fakePriceType3.ID),\n\t\t\t\t\t\t\"unit_price\": float64(2000),\n\t\t\t\t\t\t\"note\": \"note var price\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"pricing_type_id\": common.Encrypt(fakePriceType4.ID),\n\t\t\t\t\t\t\"unit_price\": float64(2000),\n\t\t\t\t\t\t\"note\": \"note var price\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tng := tester.New()\n\tng.SetHeader(tester.H{\"Authorization\": token})\n\tng.POST(\"/v1/inventory/item\").SetJSON(scenario).Run(test.Router(), func(res tester.HTTPResponse, req tester.HTTPRequest) {\n\t\tassert.Equal(t, int(422), res.Code, fmt.Sprintf(\"\\nreason: Validation Not Matched,\\ndata: %v , \\nresponse: %v\", scenario, res.Body.String()))\n\t})\n}", "title": "" }, { "docid": "e584cf2f95345725e49517f0ae44e997", "score": "0.45577663", "text": "func IsSQLiteIdentifier(s string) bool {\n\n\t// generally unknown...\n\t// - cannot start with a number\n\t// - alpha and underscore are okay\n\t// - cannot contain dashes\n\n\t// Just guessing:\n\tconst firstIdentChars = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_\"\n\tconst identChars = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_\"\n\n\tchr := strings.Split(s, \"\")\n\tfor i := 0; i < len(chr); i++ {\n\n\t\tif i == 0 {\n\t\t\tmatches := strings.Contains(firstIdentChars, chr[i])\n\t\t\tif !matches {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t} else {\n\t\t\tmatches := strings.Contains(identChars, chr[i])\n\t\t\tif !matches && chr[i] != \".\" {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "ac048d777e922d633a42fe9dec5e8c71", "score": "0.45566693", "text": "func IDParts(id string) (string, string, error) {\n\tparts := strings.Split(id, \"/\")\n\tif len(parts) != 2 {\n\t\terr := fmt.Errorf(\"unexpected ID format (%q) expected %q\", id, \"namespace/name\")\n\t\treturn \"\", \"\", err\n\t}\n\n\treturn parts[0], parts[1], nil\n}", "title": "" }, { "docid": "949cb02f38723f842c387991a3249107", "score": "0.45517525", "text": "func ParseIdentifier(input string) Type {\n\tif val, ok := keywords[input]; ok {\n\t\treturn val\n\t}\n\n\treturn Identifier\n}", "title": "" }, { "docid": "cd6135bc87da4be6b78ae7c79162c5fd", "score": "0.4544416", "text": "func generateID(idType string) int{\n\n\tid := 100000 + rand.Intn(999999-100000)\n\t\n\tswitch(idType){\n\t\tcase \"quote\":\n\t\t\tif _, ok:= quoteIDs[id]; ok { \n\t\t\t\tid = generateID(idType)\n\t\t\t}\n\t\tcase \"tx\":\n\t\t\tif _, ok:= txIDs[id]; ok { \n\t\t\t\tid = generateID(idType)\n\t\t\t}\n\t}\n\treturn id\n}", "title": "" }, { "docid": "5e9b53af056871a9a94f99de9e33dc3a", "score": "0.45385054", "text": "func (t *TypeName) Identical(other Type) bool {\n\ts, ok := other.(*TypeName)\n\treturn ok && t.Identifier.decl == s.Identifier.decl\n}", "title": "" }, { "docid": "a90e3f3550c8b2fca226452122545c74", "score": "0.45206615", "text": "func (t *Token) TypeID() string {\n return t.Type().ID()\n}", "title": "" }, { "docid": "92191d3fdc19cd4bf8ffbfa8c5b3eb14", "score": "0.4501159", "text": "func (s *BaseIDLListener) EnterType_id_decl(ctx *Type_id_declContext) {}", "title": "" }, { "docid": "57c2b03b5a74907251836332b91a569f", "score": "0.44936946", "text": "func Test_int_string(t *testing.T) {\n\n}", "title": "" }, { "docid": "22b2627c9afc39fad79a9840abd6c4bd", "score": "0.44901603", "text": "func (i UserIdentifier) Type() string {\n\treturn \"m.id.user\"\n}", "title": "" }, { "docid": "4461c282b0f49f5d9d62bc00fbde1657", "score": "0.44867107", "text": "func TestHandler_URLMappingItemFailCreatePricingTypeIDWrong(t *testing.T) {\n\tname := common.RandomStr(7)\n\tname2 := common.RandomStr(7)\n\tname3 := common.RandomStr(7)\n\t// dummy\n\tfakePriceType1 := model.DummyPricingType()\n\tfakePriceType2 := model.DummyPricingType()\n\tfakePriceType3 := model.DummyPricingType()\n\tcategory := model.DummyItemCategory()\n\tcategory.IsDeleted = int8(0)\n\tcategory.Save()\n\tmeasure := model.DummyMeasurement()\n\tmeasure.IsDeleted = int8(0)\n\tmeasure.Save()\n\n\t// melakukan proses login\n\tuser := model.DummyUserPriviledgeWithUsergroup(1)\n\tsd, _ := auth.Login(user)\n\ttoken := \"Bearer \" + sd.Token\n\n\t// setting body\n\tscenario := tester.D{\n\t\t\"item_type\": \"product\",\n\t\t\"item_name\": name,\n\t\t\"category_id\": common.Encrypt(category.ID),\n\t\t\"measurement_id\": common.Encrypt(measure.ID),\n\t\t\"note\": \"note\",\n\t\t\"has_variant\": int8(1),\n\t\t\"item_variants\": []tester.D{\n\t\t\t{\n\t\t\t\t\"external_name\": name2,\n\t\t\t\t\"variant_name\": name2,\n\t\t\t\t\"minimum_stock\": float32(10),\n\t\t\t\t\"base_price\": float64(1000),\n\t\t\t\t\"note\": \"note var\",\n\t\t\t\t\"image\": \"image\",\n\t\t\t\t\"item_variant_prices\": []tester.D{\n\t\t\t\t\t{\n\t\t\t\t\t\t\"pricing_type_id\": common.Encrypt(fakePriceType1.ID),\n\t\t\t\t\t\t\"unit_price\": float64(2000),\n\t\t\t\t\t\t\"note\": \"note var price\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"pricing_type_id\": common.Encrypt(fakePriceType2.ID),\n\t\t\t\t\t\t\"unit_price\": float64(2000),\n\t\t\t\t\t\t\"note\": \"note var price\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"external_name\": name3,\n\t\t\t\t\"variant_name\": name3,\n\t\t\t\t\"minimum_stock\": float32(10),\n\t\t\t\t\"base_price\": float64(1000),\n\t\t\t\t\"note\": \"note var\",\n\t\t\t\t\"image\": \"image\",\n\t\t\t\t\"item_variant_prices\": []tester.D{\n\t\t\t\t\t{\n\t\t\t\t\t\t\"pricing_type_id\": common.Encrypt(fakePriceType3.ID),\n\t\t\t\t\t\t\"unit_price\": float64(2000),\n\t\t\t\t\t\t\"note\": \"note var price\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"pricing_type_id\": \"999999\",\n\t\t\t\t\t\t\"unit_price\": float64(2000),\n\t\t\t\t\t\t\"note\": \"note var price\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tng := tester.New()\n\tng.SetHeader(tester.H{\"Authorization\": token})\n\tng.POST(\"/v1/inventory/item\").SetJSON(scenario).Run(test.Router(), func(res tester.HTTPResponse, req tester.HTTPRequest) {\n\t\tassert.Equal(t, int(422), res.Code, fmt.Sprintf(\"\\nreason: Validation Not Matched,\\ndata: %v , \\nresponse: %v\", scenario, res.Body.String()))\n\t})\n}", "title": "" }, { "docid": "7a2990fdfebf282a00e94ae137ad02e1", "score": "0.44846737", "text": "func TestShortId(t *testing.T) {\n\tdataAndExpected := map[string]string{\"abcdef\": \"abc\", \"\": \"<nil>\", \"ab\": \"ab\"}\n\tfor data, expected := range dataAndExpected {\n\t\tv := shortID(data, 3)\n\t\tif v != expected {\n\t\t\tt.Logf(\"Failed, expected %s got %s\\n\", expected, v)\n\t\t\tt.Fail()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "92c78dba96b3e904178b5b6057ba5848", "score": "0.44828165", "text": "func TestEDIdentificationNumberAlphaNumeric(t *testing.T) {\n\ttestEDIdentificationNumberAlphaNumeric(t)\n}", "title": "" }, { "docid": "a5e9ffe8baf0b6119763fff65a434434", "score": "0.4477299", "text": "func Is(s string) bool {\n\treturn strings.Contains(s, identifier)\n}", "title": "" }, { "docid": "4d7ddbc3710ac8e4c1aadc05062bc759", "score": "0.44771641", "text": "func TestHandler_URLMappingItemCreateErrorPricingTypeIDNotSameInList(t *testing.T) {\n\ttest.DataCleanUp(\"pricing_type\")\n\tname := common.RandomStr(7)\n\tname2 := common.RandomStr(7)\n\tname3 := common.RandomStr(7)\n\tvarx := model.DummyItemVariant()\n\t// dummy\n\tfakePriceType1 := model.DummyPricingType()\n\tfakePriceType2 := model.DummyPricingType()\n\tfakePriceType3 := model.DummyPricingType()\n\tfakePriceType4 := model.DummyPricingType()\n\tcategory := model.DummyItemCategory()\n\tcategory.IsDeleted = int8(0)\n\tcategory.Save()\n\tmeasure := model.DummyMeasurement()\n\tmeasure.IsDeleted = int8(0)\n\tmeasure.Save()\n\n\t// melakukan proses login\n\tuser := model.DummyUserPriviledgeWithUsergroup(1)\n\tsd, _ := auth.Login(user)\n\ttoken := \"Bearer \" + sd.Token\n\n\t// setting body\n\tscenario := tester.D{\n\t\t\"item_type\": \"product\",\n\t\t\"item_name\": name,\n\t\t\"category_id\": common.Encrypt(category.ID),\n\t\t\"measurement_id\": common.Encrypt(measure.ID),\n\t\t\"note\": \"note\",\n\t\t\"has_variant\": int8(1),\n\t\t\"item_variants\": []tester.D{\n\t\t\t{\n\t\t\t\t\"external_name\": name2,\n\t\t\t\t\"variant_name\": name3,\n\t\t\t\t\"minimum_stock\": float32(10),\n\t\t\t\t\"base_price\": float64(1000),\n\t\t\t\t\"note\": \"note var\",\n\t\t\t\t\"image\": \"image\",\n\t\t\t\t\"item_variant_prices\": []tester.D{\n\t\t\t\t\t{\n\t\t\t\t\t\t\"pricing_type_id\": common.Encrypt(fakePriceType1.ID),\n\t\t\t\t\t\t\"unit_price\": float64(2000),\n\t\t\t\t\t\t\"note\": \"note var price\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"pricing_type_id\": common.Encrypt(fakePriceType1.ID),\n\t\t\t\t\t\t\"unit_price\": float64(2000),\n\t\t\t\t\t\t\"note\": \"note var price\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"pricing_type_id\": common.Encrypt(fakePriceType3.ID),\n\t\t\t\t\t\t\"unit_price\": float64(2000),\n\t\t\t\t\t\t\"note\": \"note var price\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"pricing_type_id\": common.Encrypt(fakePriceType4.ID),\n\t\t\t\t\t\t\"unit_price\": float64(2000),\n\t\t\t\t\t\t\"note\": \"note var price\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"external_name\": name3,\n\t\t\t\t\"variant_name\": varx.VariantName,\n\t\t\t\t\"minimum_stock\": float32(10),\n\t\t\t\t\"base_price\": float64(1000),\n\t\t\t\t\"note\": \"note var\",\n\t\t\t\t\"image\": \"image\",\n\t\t\t\t\"item_variant_prices\": []tester.D{\n\t\t\t\t\t{\n\t\t\t\t\t\t\"pricing_type_id\": common.Encrypt(fakePriceType1.ID),\n\t\t\t\t\t\t\"unit_price\": float64(2000),\n\t\t\t\t\t\t\"note\": \"note var price\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"pricing_type_id\": common.Encrypt(fakePriceType2.ID),\n\t\t\t\t\t\t\"unit_price\": float64(2000),\n\t\t\t\t\t\t\"note\": \"note var price\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"pricing_type_id\": common.Encrypt(fakePriceType3.ID),\n\t\t\t\t\t\t\"unit_price\": float64(2000),\n\t\t\t\t\t\t\"note\": \"note var price\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"pricing_type_id\": common.Encrypt(fakePriceType4.ID),\n\t\t\t\t\t\t\"unit_price\": float64(2000),\n\t\t\t\t\t\t\"note\": \"note var price\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tng := tester.New()\n\tng.SetHeader(tester.H{\"Authorization\": token})\n\tng.POST(\"/v1/inventory/item\").SetJSON(scenario).Run(test.Router(), func(res tester.HTTPResponse, req tester.HTTPRequest) {\n\t\tassert.Equal(t, http.StatusUnprocessableEntity, res.Code, fmt.Sprintf(\"\\nreason: Validation Not Matched,\\ndata: %v , \\nresponse: %v\", scenario, res.Body.String()))\n\t})\n}", "title": "" }, { "docid": "e8bc12b1fa41147d9b0d9c9677043e46", "score": "0.44719407", "text": "func IsIdentRune(ch rune, i int, runes []rune) bool {\n\tif unicode.IsLetter(ch) {\n\t\treturn true\n\t}\n\n\tif ch == '_' {\n\t\treturn true\n\t}\n\n\tif unicode.IsPunct(ch) {\n\t\treturn false\n\t}\n\n\tif i > 0 && unicode.IsDigit(ch) {\n\t\treturn true\n\t}\n\n\tif unicode.IsMark(ch) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "887014c8a8c3d297da04ec20710d860a", "score": "0.44655722", "text": "func parseIdent(s string) fidlgen.CompoundIdentifier {\n\treturn fidlgen.EncodedCompoundIdentifier(s).Parse()\n}", "title": "" }, { "docid": "517c8d8e9f87a9b4250096c6273cc935", "score": "0.44641715", "text": "func NewIdentifier(identifier interface{}) Identifier {\n\treturn Identifier{\n\t\tIdentifier: identifier,\n\t}\n}", "title": "" }, { "docid": "3f2e2f7278ad26d83198bbf67d97826a", "score": "0.44584057", "text": "func TestValidJsonPathInput(t *testing.T) {\n\n\tvar tests = []jsonexpectations{\n\t\t// default\n\t\t{\n\t\t\tname: \"@id\",\n\t\t\tjson: map[string]string{\"jsonID\": \"jsonId.json\"},\n\t\t\terrorExpected: false,\n\n\t\t\tIdentifierPaths: `$['@id']`,\n\t\t\texpected: \"[idenfitier]\",\n\t\t\texpectedPath: \"$['@id']\",\n\t\t\tignore: false,\n\t\t},\n\t\t//https://raw.githubusercontent.com/earthcube/GeoCODES-Metadata/main/metadata/Dataset/actualdata/earthchem2.json\n\t\t{\n\t\t\tname: \"@.identifier\",\n\t\t\tjson: map[string]string{\"jsonID\": \"jsonId.json\"},\n\t\t\terrorExpected: false,\n\t\t\tIdentifierPaths: \"@.identifier\",\n\t\t\texpected: \"[doi:10.1575/1912/bco-dmo.2343.1]\",\n\t\t\texpectedPath: \"@.identifier\",\n\t\t\tignore: false,\n\t\t},\n\t\t//https://raw.githubusercontent.com/earthcube/GeoCODES-Metadata/main/metadata/Dataset/actualdata/earthchem2.json\n\t\t{\n\t\t\tname: \"$.identifier\",\n\t\t\tjson: map[string]string{\"jsonID\": \"jsonId.json\"},\n\t\t\terrorExpected: false,\n\t\t\tIdentifierPaths: \"$.identifier\",\n\t\t\texpected: \"[doi:10.1575/1912/bco-dmo.2343.1]\",\n\t\t\texpectedPath: \"$.identifier\",\n\t\t\tignore: false,\n\t\t},\n\t\t// argo example: https://raw.githubusercontent.com/earthcube/GeoCODES-Metadata/main/metadata/Dataset/actualdata/argo.json\n\t\t{\n\t\t\tname: \"identifiers Array \",\n\t\t\tjson: map[string]string{\"jsonID\": \"jsonId.json\"},\n\t\t\terrorExpected: false,\n\t\t\tIdentifierPaths: \"$.identifierSArray[?(@.propertyID=='https://registry.identifiers.org/registry/doi')].value\",\n\t\t\texpected: \"[doi:10.1575/1912/bco-dmo.2343.1 doi:10.1575/1912/bco-dmo.2343.1N]\",\n\t\t\texpectedPath: \"$.identifierSArray[?(@.propertyID=='https://registry.identifiers.org/registry/doi')].value\",\n\t\t\tignore: false,\n\t\t},\n\t\t{\n\t\t\tname: \"identifier_obj\",\n\t\t\tjson: map[string]string{\"jsonID\": \"jsonId.json\"},\n\t\t\terrorExpected: false,\n\t\t\t//\tIdentifierPath: \"$.identifierObj[?(@.propertyID=='https://registry.identifiers.org/registry/doi')].value\",\n\t\t\t//IdentifierPath: \"$.identifierObj.propertyID[@=='https://registry.identifiers.org/registry/doi')]\",\n\t\t\tIdentifierPaths: \"$.identifierObj.value\",\n\t\t\texpected: \"[doi:10.1575/1912/bco-dmo.2343.1]\",\n\t\t\texpectedPath: \"$.identifierObj.value\",\n\t\t\tignore: false,\n\t\t},\n\t\t//https://raw.githubusercontent.com/earthcube/GeoCODES-Metadata/main/metadata/Dataset/actualdata/earthchem2.json\n\t\t// this will not work since the || does not work\n\t\t{\n\t\t\tname: \" identifier or id\",\n\t\t\tjson: map[string]string{\"jsonID\": \"jsonId.json\"},\n\t\t\terrorExpected: false,\n\t\t\tIdentifierPaths: \"[ $.identifiers[?(@.propertyID=='https://registry.identifiers.org/registry/doi')].value || $.['@id'] ]\",\n\t\t\texpected: \"[doi:10.1575/1912/bco-dmo.2343.1]\",\n\t\t\texpectedPath: \"[ $.identifiers[?(@.propertyID=='https://registry.identifiers.org/registry/doi')].value || $.['@id'] ]\",\n\t\t\tignore: true,\n\t\t},\n\t\t// identifier as array: https://github.com/earthcube/GeoCODES-Metadata/blob/main/metadata/Dataset/allgood/bcodmo1.json\n\t\t/* needs work\n\t\t\"identifier\": [\n\n\t\t {\n\t\t \"@type\": \"PropertyValue\",\n\t\t \"@id\": \"https://doi.org/10.1575/1912/bco-dmo.2343.1\",\n\t\t \"propertyID\": \"https://registry.identifiers.org/registry/doi\",\n\t\t \"value\": \"doi:10.1575/1912/bco-dmo.2343.1\",\n\t\t \"url\": \"https://doi.org/10.1575/1912/bco-dmo.2343.1\"\n\t\t }\n\t\t ],\n\t\t*/\n\t\t// this does not work fancy array index issues. Would be nice\n\t\t{\n\t\t\tname: \"identifierSArray slice\",\n\t\t\tjson: map[string]string{\"jsonID\": \"jsonId.json\"},\n\t\t\terrorExpected: false,\n\t\t\t//IdentifierPath: \"$.identifierSArray[?(@.propertyID=='https://registry.identifiers.org/registry/doi')].value[-1:]\",\n\t\t\t//IdentifierPaths: []string{\"$.identifierSArray[?(@.propertyID=='https://registry.identifiers.org/registry/doi')].value.[-1:]\"},\n\t\t\tIdentifierPaths: \"$.identifierSArray[?(@.propertyID=='https://registry.identifiers.org/registry/doi')].value[0]\",\n\t\t\texpected: \"[doi:10.1575/1912/bco-dmo.2343.1]\",\n\t\t\texpectedPath: \"$.identifierSArray[?(@.propertyID=='https://registry.identifiers.org/registry/doi')].value.[0]\",\n\t\t\tignore: true,\n\t\t},\n\t}\n\n\ttestValidJsonPath(tests, t)\n}", "title": "" }, { "docid": "2f39a2d80f7e35cadf67ee3fa51fd94b", "score": "0.4457389", "text": "func VerifyTypeContainsFold(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldVerifyType), v))\n\t})\n}", "title": "" }, { "docid": "0d711e13242a24d9b68d2157770c86e5", "score": "0.445647", "text": "func testEDIdentificationNumberAlphaNumeric(t testing.TB) {\n\ted := mockEntryDetail()\n\ted.IdentificationNumber = \"®\"\n\terr := ed.Validate()\n\tif !base.Match(err, ErrNonAlphanumeric) {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n}", "title": "" }, { "docid": "c5c962015c46147717cb277764c492a2", "score": "0.44538578", "text": "func IsValidIdentifier(str string) bool {\n\tif len(str) == 0 {\n\t\treturn false\n\t}\n\tfor i, r := range str {\n\t\tif i == 0 {\n\t\t\tif !isIdentifierFirst(r) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} else {\n\t\t\tif !isIdentifier(r) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn getTokenKindFromID(str) == tokenIdentifier\n}", "title": "" }, { "docid": "eb80edc3c9516ac7be951004354d4c65", "score": "0.44497025", "text": "func TestTypeCodeValid(t *testing.T) {\n\ttst := mockTypeSubType()\n\ttst.TypeCode = \"ZZ\"\n\tif err := tst.Validate(); err != nil {\n\t\tif !base.Match(err, ErrTypeCode) {\n\t\t\tt.Errorf(\"%T: %s\", err, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "207e341d246c87c78f8567b8f18bac5f", "score": "0.44478384", "text": "func LookupIdentifier(ident string) Type {\n\tif tok, ok := keywords[ident]; ok {\n\t\treturn tok\n\t}\n\treturn IDENT\n}", "title": "" }, { "docid": "f59fbe9c4d3eb041f972c54c25ad8cc4", "score": "0.44428587", "text": "func TestParseIATEntryDetail(t *testing.T) {\n\ttestParseIATEntryDetail(t)\n}", "title": "" }, { "docid": "22bcb68841d8238e2afab1cecd9bb985", "score": "0.4439188", "text": "func LookupTypeIdent(ident string) TokenType {\n\tif tok, ok := keywords[ident]; ok {\n\t\treturn tok\n\t}\n\treturn IDENT\n}", "title": "" }, { "docid": "2ddf465c182ff97973da680ceffe8461", "score": "0.4430755", "text": "func (cmd *Command) identifier(s string) core.Identifier {\n\tif len(s) < 2 {\n\t\tcmd.Fatalf(\"%s: invalid identifier\", s)\n\t}\n\n\tn := strings.IndexFunc(s, func(ch rune) bool { return '0' <= ch && ch <= '9' })\n\tif n == -1 {\n\t\tcmd.Fatalf(\"%s: invalid identifier\", s)\n\t}\n\n\tord, err := strconv.Atoi(s[n:])\n\tif err != nil {\n\t\tcmd.Fatalf(\"%s: invalid identifier: %v\", s, err)\n\t}\n\tid := core.Identifier{Ordinal: ord}\n\n\tswitch pre := s[:n]; pre {\n\tcase \"v\":\n\t\tid.Kind = manga.Volume\n\tcase \"c\":\n\t\tid.Kind = manga.Chapter\n\tcase \"cd\":\n\t\tid.Kind = manga.DramaCD\n\tdefault:\n\t\tcmd.Fatalf(\"%s: invalid kind specifier '%s' in identifier\", s, pre)\n\t}\n\n\treturn id\n}", "title": "" }, { "docid": "dd7062d4c69efd05d185392cd0f779f4", "score": "0.4427095", "text": "func (ecc *EquipmentCategoryCreate) AddTypeIDs(ids ...string) *EquipmentCategoryCreate {\n\tif ecc.types == nil {\n\t\tecc.types = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\tecc.types[ids[i]] = struct{}{}\n\t}\n\treturn ecc\n}", "title": "" }, { "docid": "7108c03e84290ffef4678ae77f6cfb18", "score": "0.44122517", "text": "func TestCustomUuid(t *testing.T) {\n\tcipherKey := \"\"\n\ttestName := \"CustomUuid\"\n\tcustomUuid := \"customuuid\"\n\tHereNow(t, cipherKey, customUuid, testName)\n}", "title": "" }, { "docid": "c55cca64e0aacc7a395af1f108ebe2db", "score": "0.44120714", "text": "func ID(parts ...string) string {\n\treturn path.Join(parts...)\n}", "title": "" }, { "docid": "851e114c7e2404cc6e19799d091182a8", "score": "0.44119582", "text": "func isIdentifierChar(b byte) bool {\n\treturn (b >= '0' && b <= '9') || // 0-9\n\t\t(b >= 'A' && b <= 'Z') || // A-Z\n\t\t(b >= 'a' && b <= 'z') || // a-z\n\t\tb == '-' || // hyphens are allowed according to K8s spec\n\t\tb == '_' // underscores are allowed because of Prometheus sanitization\n}", "title": "" }, { "docid": "c0b12394f8d403f74238681fdaaaafc0", "score": "0.4411135", "text": "func validIdentifier(v string) bool {\n\tif v == \"\" {\n\t\treturn false\n\t}\n\n\t// Loop through the string as byte slice as we only care about ASCII characters\n\tb := []byte(v)\n\tfor i := 0; i < len(b); i++ {\n\t\tif (b[i] >= '0' && b[i] <= '9') ||\n\t\t\t(b[i] >= 'a' && b[i] <= 'z') ||\n\t\t\t(b[i] >= 'A' && b[i] <= 'Z') ||\n\t\t\tb[i] == '_' {\n\t\t\tcontinue\n\t\t}\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "92754442d12a4c2a08ba277d43923daa", "score": "0.4407324", "text": "func TestAddWithID(t *testing.T) {\n\tsetup()\n\tdefer teardown()\n\n\t// testing happy path\n\terr := AddWithId(\"testing\", \"testId\", map[string]interface{}{})\n\n\tassert.Nil(t, err)\n\n\tty, err := getEntityType(\"testId\")\n\n\tassert.Nil(t, err)\n\tassert.Equal(t, \"testing\", ty)\n\n\t// testing that an error is thrown if the entity type is not registered\n\terr = AddWithId(\"notRegistered\", \"testId\", map[string]interface{}{})\n\n\tassert.NotNil(t, err)\n\n\t// testing that an error is thrown if the id is already in use\n\terr = AddWithId(\"testing\", \"testId\", map[string]interface{}{})\n\n\tassert.NotNil(t, err)\n\tteardown()\n}", "title": "" }, { "docid": "02adbb097595b1c189235124e27518e1", "score": "0.4404393", "text": "func TestType(t *testing.T) {\n\tm := map[string]interface{}{\n\t\t\"bios\": GetBIOSInformation(),\n\t\t\"system\": GetSystemInformation(),\n\t\t\"baseboard\": GetBaseboardInformation(),\n\t\t\"chassis\": GetChassisInformation(),\n\t\t\"processor\": GetProcessorInformation(),\n\t\t\"memory\": GetMemoryDevice(),\n\t\t\"cache\": GetCacheInformation(),\n\t\t\"connector\": GetPortInformation(),\n\t\t\"slot\": GetSystemSlot(),\n\t}\n\tfor k, v := range m {\n\t\tdv := dmidecode_t(k)\n\t\tvv := reflect.ValueOf(v)\n\t\tif vv.IsNil() {\n\t\t\tif len(dv) == 0 {\n\t\t\t\tt.Logf(\"%s: dmidecode and godmi has no data\", k)\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tt.Errorf(\"%s:\\n[godmi]: nil\\n[dmidecode]: %s\\n\", k, dv)\n\t\t\t}\n\t\t}\n\t\tgv := fmt.Sprintf(\"%s\", v)\n\t\tif gv != dv {\n\t\t\tt.Errorf(\"%s:\\n[godmi]:\\n%s\\n[dmidecode]:\\n%s\\n\", k, gv, dv)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "00882136cd96d37414c4728032b4740a", "score": "0.4404344", "text": "func TYPEDEATAILContainsFold(v string) predicate.Roomtype {\n\treturn predicate.Roomtype(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldTYPEDEATAIL), v))\n\t})\n}", "title": "" }, { "docid": "b17c72646c65956249a89c4c9d7c0843", "score": "0.4404231", "text": "func Test_getEntity(t *testing.T) {\n\tentity, err := newEntity(qwertPub)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t_, ok := entity.Identities[\"qwert <qwert@mail.xy>\"]\n\tassert.Equal(t, ok, true)\n\n\tentity, err = newEntity(qwertPrivate)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t_, ok = entity.Identities[\"qwert <qwert@mail.xy>\"]\n\tassert.Equal(t, ok, true)\n}", "title": "" }, { "docid": "141fbb71c8903d5dd5b3475af8ae8aec", "score": "0.4397871", "text": "func TestUnmaskID(t *testing.T) {\n\tfmt.Println(\"\\n>> ctmUtils_test : TestUnmaskID\")\n\tctmUtils := ctmutils.New()\n\n\tvar testsValues = []struct {\n\t\tword string // input\n\t\texpected string // expected result\n\t}{\n\t\t{\"A123-B456-C789-D0X\", \"A123B456C789D0X\"},\n\t\t{\"A123B456C789D0X\", \"A123B456C789D0X\"},\n\t}\n\tfor _, tt := range testsValues {\n\t\tactual := ctmUtils.UnmaskID(tt.word)\n\t\tif actual != tt.expected {\n\t\t\tt.Errorf(\" - Debug :: UnmaskID(%s): expected %s, actual %s\", tt.word, tt.expected, actual)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "25227ebdd9e5c5254070caeb58818d48", "score": "0.43897676", "text": "func (s *BaseargusListener) EnterType_spec(ctx *Type_specContext) {}", "title": "" }, { "docid": "3a9d50893c2a1188168d5d7dd165c5a3", "score": "0.43890804", "text": "func TestInstructingFIIdentifierAlphaNumeric(t *testing.T) {\n\tbfi := mockInstructingFI()\n\tbfi.FinancialInstitution.Identifier = \"®\"\n\n\terr := bfi.Validate()\n\n\trequire.EqualError(t, err, fieldError(\"Identifier\", ErrNonAlphanumeric, bfi.FinancialInstitution.Identifier).Error())\n}", "title": "" }, { "docid": "06265cc83903f8bde2c1c0010fc1eb0d", "score": "0.43796316", "text": "func TestValidateEDRecordType(t *testing.T) {\n\ttestValidateEDRecordType(t)\n}", "title": "" }, { "docid": "9de5a71a908328922e75a5c770441d1d", "score": "0.43774608", "text": "func (s *BaseAnzerListener) EnterTypeId(ctx *TypeIdContext) {}", "title": "" }, { "docid": "7db3d212703d4d4ba979d4f361ab477e", "score": "0.4374447", "text": "func (s *BaseIDLListener) EnterTemplate_type_spec(ctx *Template_type_specContext) {}", "title": "" }, { "docid": "62e87dbbb74491b5ddf1da7837da44f2", "score": "0.43743834", "text": "func (s *BaseSOQLListener) EnterTypeof_spec(ctx *Typeof_specContext) {}", "title": "" }, { "docid": "24d8be162351c5e587c37ba578b0dcef", "score": "0.4374285", "text": "func TestEDFieldInclusionRecordType(t *testing.T) {\n\ttestEDFieldInclusionRecordType(t)\n}", "title": "" }, { "docid": "a876aebdf4c18aed7794de765eec6841", "score": "0.43726704", "text": "func TestContentionOnIdentifier(t *testing.T) {\n\ttaskMaster:= CreateTaskMaster()\n\tid:= id.UniqueIdentifier()\n\tflag:= \"\"\n\tstart:= time.Now()\n\t\n\tif !IsDependentTask(DELETE, DELETE){ t.Errorf(\"a delete may not proceed until other deletes of the same id are completed\"); return }\n\t\n\tfuture1:= taskMaster.Submit(DELETE, id, func() interface{} {\n\t\tflag= \"1\"\n\t\tt.Logf(\"flag = 1\\n\")\n\t\ttime.Sleep(time.Second)\n\t\tif flag != \"1\" {\n\t\t\tmsg:= \"looks like the 2nd func ran before the first func finished\"\n\t\t\tt.Errorf(msg)\n\t\t\tpanic (msg)\n\t\t}\t\t\n\t\tflag= \"1.1\"\n\t\tt.Logf(\"flag = 1.1\\n\")\n\t\treturn nil\n\t})\n\t\n\tdependentTasks:= taskMaster.findPendingTasks(DELETE, id)\n\tif (len(dependentTasks) <= 0) { t.Errorf(\"Failed to find dependent tasks\"); return }\n\t\n\tfuture2:= taskMaster.Submit(DELETE, id, func() interface{} {\n\t\tif flag != \"1.1\" {\n\t\t\tmsg:= \"looks like the 2nd func ran before the first func finished\"\n\t\t\tt.Errorf(msg)\n\t\t\tpanic (msg)\n\t\t}\t\t\n\t\tflag= \"2\"\n\t\tt.Logf(\"flag = 2\\n\")\n\t\treturn nil\n\t})\n\tfuture2.Join()\n\tif (!future1.Done()) { t.Errorf(\"the 2nd function somehow completed before the first function\"); return }\n\tif (!future1.Success()) { t.Error(future1.Error()); return}\n\tif (!future2.Success()) { t.Error(future2.Error()); return}\n\tif (flag != \"2\") { t.Errorf(\"looks like the 2nd function has not finished yet\"); return}\n\t\n\tif time.Since(start) < time.Second {\n\t\tt.Errorf(\"Since the first func waits for a second it should take at least a second to run this test\")\n\t\treturn \n\t}\n}", "title": "" } ]
468ae034b56654988d679670eaf26c35
Unwrap unwraps the entity that was returned from a transaction after it was closed, so that all next queries will be executed through the driver which created the transaction.
[ { "docid": "c3f5658e5edf878eebec7e3690e50305", "score": "0.6819952", "text": "func (d *Diagnose) Unwrap() *Diagnose {\n\ttx, ok := d.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Diagnose is not a transactional entity\")\n\t}\n\td.config.driver = tx.drv\n\treturn d\n}", "title": "" } ]
[ { "docid": "3240711748b6750c9d76f65e8881fc7c", "score": "0.7557739", "text": "func (d *Dispense) Unwrap() *Dispense {\n\ttx, ok := d.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Dispense is not a transactional entity\")\n\t}\n\td.config.driver = tx.drv\n\treturn d\n}", "title": "" }, { "docid": "27e9a9d437a7a604f4a3d4cdba52aed2", "score": "0.7294138", "text": "func (ir *ImageRepo) Unwrap() *ImageRepo {\n\ttx, ok := ir.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: ImageRepo is not a transactional entity\")\n\t}\n\tir.config.driver = tx.drv\n\treturn ir\n}", "title": "" }, { "docid": "3f392446889601e12bab226b409f6296", "score": "0.72932625", "text": "func (m *Medicine) Unwrap() *Medicine {\n\ttx, ok := m.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Medicine is not a transactional entity\")\n\t}\n\tm.config.driver = tx.drv\n\treturn m\n}", "title": "" }, { "docid": "b6e9837ebea30b959b7665d29181cc14", "score": "0.72453845", "text": "func (e *Extradoctor) Unwrap() *Extradoctor {\n\ttx, ok := e.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Extradoctor is not a transactional entity\")\n\t}\n\te.config.driver = tx.drv\n\treturn e\n}", "title": "" }, { "docid": "b1e001df7d16b84f23a88caae590dd2a", "score": "0.7242063", "text": "func (r *Recordinsurance) Unwrap() *Recordinsurance {\n\ttx, ok := r.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Recordinsurance is not a transactional entity\")\n\t}\n\tr.config.driver = tx.drv\n\treturn r\n}", "title": "" }, { "docid": "7b3dadc746a3373e71cb079ea329bd58", "score": "0.7223251", "text": "func (s *Spaciality) Unwrap() *Spaciality {\n\ttx, ok := s.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Spaciality is not a transactional entity\")\n\t}\n\ts.config.driver = tx.drv\n\treturn s\n}", "title": "" }, { "docid": "922e7be2ddd0132c1f8561dce75f8a93", "score": "0.72186095", "text": "func (f *Furniture) Unwrap() *Furniture {\n\ttx, ok := f.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Furniture is not a transactional entity\")\n\t}\n\tf.config.driver = tx.drv\n\treturn f\n}", "title": "" }, { "docid": "f0a3e15b955b2c63930683372ad92a8c", "score": "0.7218488", "text": "func (r *Recordfood) Unwrap() *Recordfood {\n\ttx, ok := r.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Recordfood is not a transactional entity\")\n\t}\n\tr.config.driver = tx.drv\n\treturn r\n}", "title": "" }, { "docid": "685b17aed522930a98b3e8215af3186f", "score": "0.7185882", "text": "func (i *Invitee) Unwrap() *Invitee {\n\ttx, ok := i.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Invitee is not a transactional entity\")\n\t}\n\ti.config.driver = tx.drv\n\treturn i\n}", "title": "" }, { "docid": "29c1e3740e617f0a31fa5438c619a126", "score": "0.718553", "text": "func (r *Resource) Unwrap() *Resource {\n\ttx, ok := r.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Resource is not a transactional entity\")\n\t}\n\tr.config.driver = tx.drv\n\treturn r\n}", "title": "" }, { "docid": "3ae9284c01dd1a90960453309fa3976c", "score": "0.7174638", "text": "func (c *Comic) Unwrap() *Comic {\n\ttx, ok := c.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Comic is not a transactional entity\")\n\t}\n\tc.config.driver = tx.drv\n\treturn c\n}", "title": "" }, { "docid": "84e481669244efd9a23778bac393fb55", "score": "0.71462655", "text": "func (fd *FurnitureDetail) Unwrap() *FurnitureDetail {\n\ttx, ok := fd.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: FurnitureDetail is not a transactional entity\")\n\t}\n\tfd.config.driver = tx.drv\n\treturn fd\n}", "title": "" }, { "docid": "722c7838cf1c06c568661fb7fb2c455f", "score": "0.7127505", "text": "func (tl *TweetLike) Unwrap() *TweetLike {\n\t_tx, ok := tl.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: TweetLike is not a transactional entity\")\n\t}\n\ttl.config.driver = _tx.drv\n\treturn tl\n}", "title": "" }, { "docid": "1b0d8497c3a1092d3b371297ff2c262c", "score": "0.7115413", "text": "func (d *Dentist) Unwrap() *Dentist {\n\ttx, ok := d.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Dentist is not a transactional entity\")\n\t}\n\td.config.driver = tx.drv\n\treturn d\n}", "title": "" }, { "docid": "da139953c2d57f0a4d91a7f2775c7513", "score": "0.71014005", "text": "func (b *Bankdetail) Unwrap() *Bankdetail {\n\ttx, ok := b.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Bankdetail is not a transactional entity\")\n\t}\n\tb.config.driver = tx.drv\n\treturn b\n}", "title": "" }, { "docid": "9c0a1ee72a2a5101ab701911f31d0a7e", "score": "0.7100709", "text": "func (td *TransactionDetail) Unwrap() *TransactionDetail {\n\t_tx, ok := td.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: TransactionDetail is not a transactional entity\")\n\t}\n\ttd.config.driver = _tx.drv\n\treturn td\n}", "title": "" }, { "docid": "9cfa06efbdf9181816253c9a617450c1", "score": "0.7092942", "text": "func (ri *RepairInvoice) Unwrap() *RepairInvoice {\n\ttx, ok := ri.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: RepairInvoice is not a transactional entity\")\n\t}\n\tri.config.driver = tx.drv\n\treturn ri\n}", "title": "" }, { "docid": "08e16820b009f3ea1b1ded8a95a09c0c", "score": "0.706165", "text": "func (t *Todo) Unwrap() *Todo {\n\ttx, ok := t.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Todo is not a transactional entity\")\n\t}\n\tt.config.driver = tx.drv\n\treturn t\n}", "title": "" }, { "docid": "2f3e7814d9d18f010a926c21e9cc8d63", "score": "0.70444405", "text": "func (v *Veterinarian) Unwrap() *Veterinarian {\n\ttx, ok := v.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Veterinarian is not a transactional entity\")\n\t}\n\tv.config.driver = tx.drv\n\treturn v\n}", "title": "" }, { "docid": "3e7b0d0d855a4c9294f5ea5aa1cf532d", "score": "0.70444316", "text": "func (i *Item) Unwrap() *Item {\n\ttx, ok := i.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Item is not a transactional entity\")\n\t}\n\ti.config.driver = tx.drv\n\treturn i\n}", "title": "" }, { "docid": "9270fbe02824882288b2cc9ee8b77cd6", "score": "0.70411354", "text": "func (qed *QccEnterpriseData) Unwrap() *QccEnterpriseData {\n\ttx, ok := qed.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: QccEnterpriseData is not a transactional entity\")\n\t}\n\tqed.config.driver = tx.drv\n\treturn qed\n}", "title": "" }, { "docid": "53bfc9667eaea6a0244a24c65ddd8e21", "score": "0.7032885", "text": "func (e *Entry) Unwrap() *Entry {\n\ttx, ok := e.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Entry is not a transactional entity\")\n\t}\n\te.config.driver = tx.drv\n\treturn e\n}", "title": "" }, { "docid": "453735d6a9344f4914ce19448e569006", "score": "0.7025532", "text": "func (e *Employee) Unwrap() *Employee {\n\ttx, ok := e.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Employee is not a transactional entity\")\n\t}\n\te.config.driver = tx.drv\n\treturn e\n}", "title": "" }, { "docid": "453735d6a9344f4914ce19448e569006", "score": "0.7025532", "text": "func (e *Employee) Unwrap() *Employee {\n\ttx, ok := e.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Employee is not a transactional entity\")\n\t}\n\te.config.driver = tx.drv\n\treturn e\n}", "title": "" }, { "docid": "8d4a5c566ca3ffb5c7e9e27c66bd5b21", "score": "0.7025384", "text": "func (pe *Pet) Unwrap() *Pet {\n\ttx, ok := pe.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Pet is not a transactional entity\")\n\t}\n\tpe.config.driver = tx.drv\n\treturn pe\n}", "title": "" }, { "docid": "2adaaddfa533398a403989e8fce6e3eb", "score": "0.69917613", "text": "func (f *Fix) Unwrap() *Fix {\n\ttx, ok := f.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Fix is not a transactional entity\")\n\t}\n\tf.config.driver = tx.drv\n\treturn f\n}", "title": "" }, { "docid": "d53e010a8e6f447ad57294a46ba2ccd2", "score": "0.6986261", "text": "func (b *Blob) Unwrap() *Blob {\n\ttx, ok := b.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Blob is not a transactional entity\")\n\t}\n\tb.config.driver = tx.drv\n\treturn b\n}", "title": "" }, { "docid": "4fa9b2a1aa2755d87871596b249c4578", "score": "0.69725066", "text": "func (q *Question) Unwrap() *Question {\n\ttx, ok := q.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Question is not a transactional entity\")\n\t}\n\tq.config.driver = tx.drv\n\treturn q\n}", "title": "" }, { "docid": "d65211d9fcd6c80e333ff614bf481761", "score": "0.69468933", "text": "func (m *Model) Unwrap() *Model {\n\t_tx, ok := m.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Model is not a transactional entity\")\n\t}\n\tm.config.driver = _tx.drv\n\treturn m\n}", "title": "" }, { "docid": "436a64430d63dc9ae41f94637d6c7483", "score": "0.6935055", "text": "func (pr *Problem) Unwrap() *Problem {\n\ttx, ok := pr.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Problem is not a transactional entity\")\n\t}\n\tpr.config.driver = tx.drv\n\treturn pr\n}", "title": "" }, { "docid": "c278d888a7fbee3491df6ea6c1fbb1b9", "score": "0.6911693", "text": "func (pr *Product) Unwrap() *Product {\n\ttx, ok := pr.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Product is not a transactional entity\")\n\t}\n\tpr.config.driver = tx.drv\n\treturn pr\n}", "title": "" }, { "docid": "c278d888a7fbee3491df6ea6c1fbb1b9", "score": "0.6911693", "text": "func (pr *Product) Unwrap() *Product {\n\ttx, ok := pr.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Product is not a transactional entity\")\n\t}\n\tpr.config.driver = tx.drv\n\treturn pr\n}", "title": "" }, { "docid": "8cb5c2a899dd377dd3611a93f5dc87f6", "score": "0.6908298", "text": "func (pa *Participation) Unwrap() *Participation {\n\ttx, ok := pa.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Participation is not a transactional entity\")\n\t}\n\tpa.config.driver = tx.drv\n\treturn pa\n}", "title": "" }, { "docid": "03451a214ff0a895815e3447b5f22b9f", "score": "0.687956", "text": "func (vc *VehicleClass) Unwrap() *VehicleClass {\n\ttx, ok := vc.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: VehicleClass is not a transactional entity\")\n\t}\n\tvc.config.driver = tx.drv\n\treturn vc\n}", "title": "" }, { "docid": "ab6f1ec0ebd857efe8d4352f8b971d67", "score": "0.68739206", "text": "func (u *User) Unwrap() *User {\n\ttx, ok := u.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: User is not a transactional entity\")\n\t}\n\tu.config.driver = tx.drv\n\treturn u\n}", "title": "" }, { "docid": "ab6f1ec0ebd857efe8d4352f8b971d67", "score": "0.68739206", "text": "func (u *User) Unwrap() *User {\n\ttx, ok := u.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: User is not a transactional entity\")\n\t}\n\tu.config.driver = tx.drv\n\treturn u\n}", "title": "" }, { "docid": "ab6f1ec0ebd857efe8d4352f8b971d67", "score": "0.68739206", "text": "func (u *User) Unwrap() *User {\n\ttx, ok := u.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: User is not a transactional entity\")\n\t}\n\tu.config.driver = tx.drv\n\treturn u\n}", "title": "" }, { "docid": "ab6f1ec0ebd857efe8d4352f8b971d67", "score": "0.68739206", "text": "func (u *User) Unwrap() *User {\n\ttx, ok := u.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: User is not a transactional entity\")\n\t}\n\tu.config.driver = tx.drv\n\treturn u\n}", "title": "" }, { "docid": "ab6f1ec0ebd857efe8d4352f8b971d67", "score": "0.68739206", "text": "func (u *User) Unwrap() *User {\n\ttx, ok := u.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: User is not a transactional entity\")\n\t}\n\tu.config.driver = tx.drv\n\treturn u\n}", "title": "" }, { "docid": "ab6f1ec0ebd857efe8d4352f8b971d67", "score": "0.68739206", "text": "func (u *User) Unwrap() *User {\n\ttx, ok := u.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: User is not a transactional entity\")\n\t}\n\tu.config.driver = tx.drv\n\treturn u\n}", "title": "" }, { "docid": "ab6f1ec0ebd857efe8d4352f8b971d67", "score": "0.68739206", "text": "func (u *User) Unwrap() *User {\n\ttx, ok := u.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: User is not a transactional entity\")\n\t}\n\tu.config.driver = tx.drv\n\treturn u\n}", "title": "" }, { "docid": "ab6f1ec0ebd857efe8d4352f8b971d67", "score": "0.68739206", "text": "func (u *User) Unwrap() *User {\n\ttx, ok := u.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: User is not a transactional entity\")\n\t}\n\tu.config.driver = tx.drv\n\treturn u\n}", "title": "" }, { "docid": "5c08c18a698d0cceabc61feae769052c", "score": "0.6871383", "text": "func (u *Unit) Unwrap() *Unit {\n\ttx, ok := u.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Unit is not a transactional entity\")\n\t}\n\tu.config.driver = tx.drv\n\treturn u\n}", "title": "" }, { "docid": "626d9e2627117af8c9e651c1c36c66b1", "score": "0.6868809", "text": "func (s *Surgeryappointment) Unwrap() *Surgeryappointment {\n\ttx, ok := s.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Surgeryappointment is not a transactional entity\")\n\t}\n\ts.config.driver = tx.drv\n\treturn s\n}", "title": "" }, { "docid": "2eb1d0bd3fbf8a7633b57d25b53cb267", "score": "0.68655413", "text": "func (uc *UseCase) Unwrap() *UseCase {\n\ttx, ok := uc.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"models: UseCase is not a transactional entity\")\n\t}\n\tuc.config.driver = tx.drv\n\treturn uc\n}", "title": "" }, { "docid": "b0b19b005cf1893dde5f4f77949db19c", "score": "0.68553287", "text": "func (c *Connectivity) Unwrap() *Connectivity {\n\ttx, ok := c.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Connectivity is not a transactional entity\")\n\t}\n\tc.config.driver = tx.drv\n\treturn c\n}", "title": "" }, { "docid": "10b2fe9c25f6937b07b2c8df22d8f323", "score": "0.6850523", "text": "func (u *User) Unwrap() *User {\n\t_tx, ok := u.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: User is not a transactional entity\")\n\t}\n\tu.config.driver = _tx.drv\n\treturn u\n}", "title": "" }, { "docid": "10b2fe9c25f6937b07b2c8df22d8f323", "score": "0.6850523", "text": "func (u *User) Unwrap() *User {\n\t_tx, ok := u.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: User is not a transactional entity\")\n\t}\n\tu.config.driver = _tx.drv\n\treturn u\n}", "title": "" }, { "docid": "d3fda6c6520d0cf9c90338aa9cdf6d90", "score": "0.68445075", "text": "func (k *Kqi) Unwrap() *Kqi {\n\ttx, ok := k.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Kqi is not a transactional entity\")\n\t}\n\tk.config.driver = tx.drv\n\treturn k\n}", "title": "" }, { "docid": "1689cd05558eb55f9d2128ab9a1af2bc", "score": "0.6840038", "text": "func (e *Event) Unwrap() *Event {\n\ttx, ok := e.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Event is not a transactional entity\")\n\t}\n\te.config.driver = tx.drv\n\treturn e\n}", "title": "" }, { "docid": "1689cd05558eb55f9d2128ab9a1af2bc", "score": "0.6840038", "text": "func (e *Event) Unwrap() *Event {\n\ttx, ok := e.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Event is not a transactional entity\")\n\t}\n\te.config.driver = tx.drv\n\treturn e\n}", "title": "" }, { "docid": "3a1dc715a61bf63b7a21cbb6e40e01e6", "score": "0.6832437", "text": "func (pa *Page) Unwrap() *Page {\n\t_tx, ok := pa.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Page is not a transactional entity\")\n\t}\n\tpa.config.driver = _tx.drv\n\treturn pa\n}", "title": "" }, { "docid": "a1193d3c40362097d5f98a421c1b04a4", "score": "0.6829867", "text": "func (b *Bouncer) Unwrap() *Bouncer {\n\ttx, ok := b.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Bouncer is not a transactional entity\")\n\t}\n\tb.config.driver = tx.drv\n\treturn b\n}", "title": "" }, { "docid": "32aa436011c3ac83147c7b5650d1c681", "score": "0.68266344", "text": "func (pr *Prescription) Unwrap() *Prescription {\n\ttx, ok := pr.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Prescription is not a transactional entity\")\n\t}\n\tpr.config.driver = tx.drv\n\treturn pr\n}", "title": "" }, { "docid": "7a0583a42d4cd78f88f0fd951e700b90", "score": "0.6811452", "text": "func (o *Order) Unwrap() *Order {\n\ttx, ok := o.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Order is not a transactional entity\")\n\t}\n\to.config.driver = tx.drv\n\treturn o\n}", "title": "" }, { "docid": "1e21b0a5dd0e0b53932a720c6f4f1537", "score": "0.6806655", "text": "func (m *Media) Unwrap() *Media {\n\ttx, ok := m.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"entv2: Media is not a transactional entity\")\n\t}\n\tm.config.driver = tx.drv\n\treturn m\n}", "title": "" }, { "docid": "df9f7aff462cf7f703d1976bba7dc294", "score": "0.6801157", "text": "func (h *Hospital) Unwrap() *Hospital {\n\ttx, ok := h.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Hospital is not a transactional entity\")\n\t}\n\th.config.driver = tx.drv\n\treturn h\n}", "title": "" }, { "docid": "428c1c6acfbf43e2d9482754085aed19", "score": "0.67948097", "text": "func (d *Doctor) Unwrap() *Doctor {\n\ttx, ok := d.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Doctor is not a transactional entity\")\n\t}\n\td.config.driver = tx.drv\n\treturn d\n}", "title": "" }, { "docid": "997f3a6384006e91eebc8f95eb91a2d0", "score": "0.67888725", "text": "func (o *Office) Unwrap() *Office {\n\ttx, ok := o.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Office is not a transactional entity\")\n\t}\n\to.config.driver = tx.drv\n\treturn o\n}", "title": "" }, { "docid": "7af63c9e61cbafdf09e075aa690a7a7e", "score": "0.6773903", "text": "func (b *Booking) Unwrap() *Booking {\n\ttx, ok := b.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Booking is not a transactional entity\")\n\t}\n\tb.config.driver = tx.drv\n\treturn b\n}", "title": "" }, { "docid": "4024c23a16b0632cf4bcc99d8676f5ef", "score": "0.6771672", "text": "func (r *Role) Unwrap() *Role {\n\ttx, ok := r.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Role is not a transactional entity\")\n\t}\n\tr.config.driver = tx.drv\n\treturn r\n}", "title": "" }, { "docid": "93236b6f40818c37d7ebf951ab6073f1", "score": "0.6769728", "text": "func (upv *UnsavedPostVideo) Unwrap() *UnsavedPostVideo {\n\ttx, ok := upv.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: UnsavedPostVideo is not a transactional entity\")\n\t}\n\tupv.config.driver = tx.drv\n\treturn upv\n}", "title": "" }, { "docid": "f81d20611e78e3fc98c8f6aef9fe0adb", "score": "0.67695445", "text": "func (lb *LoadBalance) Unwrap() *LoadBalance {\n\ttx, ok := lb.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: LoadBalance is not a transactional entity\")\n\t}\n\tlb.config.driver = tx.drv\n\treturn lb\n}", "title": "" }, { "docid": "843f6ad79ffac070b2a50d537760fda2", "score": "0.6768227", "text": "func (stq *SurveyTemplateQuestion) Unwrap() *SurveyTemplateQuestion {\n\ttx, ok := stq.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: SurveyTemplateQuestion is not a transactional entity\")\n\t}\n\tstq.config.driver = tx.drv\n\treturn stq\n}", "title": "" }, { "docid": "a8651400fbfe58565ec660ac240eaa50", "score": "0.6759892", "text": "func (m *Machine) Unwrap() *Machine {\n\t_tx, ok := m.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Machine is not a transactional entity\")\n\t}\n\tm.config.driver = _tx.drv\n\treturn m\n}", "title": "" }, { "docid": "29d0e1b5007fe8b78eef527c394fd827", "score": "0.6722227", "text": "func (c *Customer) Unwrap() *Customer {\n\ttx, ok := c.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Customer is not a transactional entity\")\n\t}\n\tc.config.driver = tx.drv\n\treturn c\n}", "title": "" }, { "docid": "4d7a5d0d6bbdefa48c4fc69db481070f", "score": "0.67113805", "text": "func (a *Auth) Unwrap() *Auth {\n\ttx, ok := a.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Auth is not a transactional entity\")\n\t}\n\ta.config.driver = tx.drv\n\treturn a\n}", "title": "" }, { "docid": "4d7a5d0d6bbdefa48c4fc69db481070f", "score": "0.67113805", "text": "func (a *Auth) Unwrap() *Auth {\n\ttx, ok := a.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Auth is not a transactional entity\")\n\t}\n\ta.config.driver = tx.drv\n\treturn a\n}", "title": "" }, { "docid": "b621dbe004c6918a0712fc7b56987655", "score": "0.6709857", "text": "func (b *Babystatus) Unwrap() *Babystatus {\n\ttx, ok := b.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Babystatus is not a transactional entity\")\n\t}\n\tb.config.driver = tx.drv\n\treturn b\n}", "title": "" }, { "docid": "fcbeb52c28308aa2fcbc358c1894444f", "score": "0.670158", "text": "func (a *Alert) Unwrap() *Alert {\n\ttx, ok := a.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Alert is not a transactional entity\")\n\t}\n\ta.config.driver = tx.drv\n\treturn a\n}", "title": "" }, { "docid": "46eb4d2f71acb99326bc13d53c962f12", "score": "0.6686922", "text": "func (ct *ClubType) Unwrap() *ClubType {\n\ttx, ok := ct.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: ClubType is not a transactional entity\")\n\t}\n\tct.config.driver = tx.drv\n\treturn ct\n}", "title": "" }, { "docid": "17f92e3fe42c17dab1cb22722ff4a1a2", "score": "0.6681808", "text": "func (e *EntityStateWrapper) Unwrap() (corev3.Resource, error) {\n\tstate := new(corev3.EntityState)\n\treturn state, e.unwrapIntoEntityState(state)\n}", "title": "" }, { "docid": "db1b0548859fb22493b468ffae2e89fe", "score": "0.6658129", "text": "func (al *AuditLog) Unwrap() *AuditLog {\n\ttx, ok := al.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: AuditLog is not a transactional entity\")\n\t}\n\tal.config.driver = tx.drv\n\treturn al\n}", "title": "" }, { "docid": "0866b87cdbfca4317c7bede66c9088da", "score": "0.6656227", "text": "func (pt *PostThumbnail) Unwrap() *PostThumbnail {\n\ttx, ok := pt.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: PostThumbnail is not a transactional entity\")\n\t}\n\tpt.config.driver = tx.drv\n\treturn pt\n}", "title": "" }, { "docid": "ffef3923ea21caf8fdfbb59514cd592f", "score": "0.66479135", "text": "func (a *Agent) Unwrap() *Agent {\n\ttx, ok := a.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Agent is not a transactional entity\")\n\t}\n\ta.config.driver = tx.drv\n\treturn a\n}", "title": "" }, { "docid": "3edfb5a0c805f81f139a2f456985096c", "score": "0.66472083", "text": "func (d *Drug) Unwrap() *Drug {\n\ttx, ok := d.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Drug is not a transactional entity\")\n\t}\n\td.config.driver = tx.drv\n\treturn d\n}", "title": "" }, { "docid": "68ea9b445cc4835d005ed3d568157afb", "score": "0.66409415", "text": "func (t *Task) Unwrap() *Task {\n\ttx, ok := t.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Task is not a transactional entity\")\n\t}\n\tt.config.driver = tx.drv\n\treturn t\n}", "title": "" }, { "docid": "3cc2460da77b89304f4993d15f08221a", "score": "0.6635091", "text": "func (t *Task) Unwrap() *Task {\n\ttx, ok := t.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"models: Task is not a transactional entity\")\n\t}\n\tt.config.driver = tx.drv\n\treturn t\n}", "title": "" }, { "docid": "a43b05c260dd291f161af2d1f1c1cc02", "score": "0.6630418", "text": "func (s *Severity) Unwrap() *Severity {\n\ttx, ok := s.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Severity is not a transactional entity\")\n\t}\n\ts.config.driver = tx.drv\n\treturn s\n}", "title": "" }, { "docid": "1d6886f8a924d133ea52702d0658e4d3", "score": "0.6610113", "text": "func (a *Abilitypatientrights) Unwrap() *Abilitypatientrights {\n\ttx, ok := a.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Abilitypatientrights is not a transactional entity\")\n\t}\n\ta.config.driver = tx.drv\n\treturn a\n}", "title": "" }, { "docid": "8c0d0d793d35a4ef325011dcf5420699", "score": "0.66095465", "text": "func (kt *KqiTarget) Unwrap() *KqiTarget {\n\ttx, ok := kt.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: KqiTarget is not a transactional entity\")\n\t}\n\tkt.config.driver = tx.drv\n\treturn kt\n}", "title": "" }, { "docid": "d4ac6f822507d671eca7bc9ba593def9", "score": "0.66083366", "text": "func (ri *RoomInfo) Unwrap() *RoomInfo {\n\ttx, ok := ri.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: RoomInfo is not a transactional entity\")\n\t}\n\tri.config.driver = tx.drv\n\treturn ri\n}", "title": "" }, { "docid": "27db5d2ce1ead734e44025743cc9b508", "score": "0.66009164", "text": "func (t *Titlename) Unwrap() *Titlename {\n\ttx, ok := t.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Titlename is not a transactional entity\")\n\t}\n\tt.config.driver = tx.drv\n\treturn t\n}", "title": "" }, { "docid": "e89abe129b1990768acf4ed7a680d18f", "score": "0.6597766", "text": "func (f *Fileinsert) Unwrap() *Fileinsert {\n\ttx, ok := f.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Fileinsert is not a transactional entity\")\n\t}\n\tf.config.driver = tx.drv\n\treturn f\n}", "title": "" }, { "docid": "50e66caed10d36df5445ea23829a881e", "score": "0.6589858", "text": "func (t *Token) Unwrap() *Token {\n\ttx, ok := t.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Token is not a transactional entity\")\n\t}\n\tt.config.driver = tx.drv\n\treturn t\n}", "title": "" }, { "docid": "c0c7e36ebe49c031919ea6ebc9a9bcbb", "score": "0.65777993", "text": "func (d *Doctorordersheet) Unwrap() *Doctorordersheet {\n\ttx, ok := d.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Doctorordersheet is not a transactional entity\")\n\t}\n\td.config.driver = tx.drv\n\treturn d\n}", "title": "" }, { "docid": "fff336ff8e28ffaa87d20307e5585a47", "score": "0.6563455", "text": "func (c *Category) Unwrap() *Category {\n\ttx, ok := c.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Category is not a transactional entity\")\n\t}\n\tc.config.driver = tx.drv\n\treturn c\n}", "title": "" }, { "docid": "fb0408bab4cd88d7be22a8ffbf66652e", "score": "0.6562815", "text": "func (d *DUser) Unwrap() *DUser {\n\ttx, ok := d.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: DUser is not a transactional entity\")\n\t}\n\td.config.driver = tx.drv\n\treturn d\n}", "title": "" }, { "docid": "bbe70b996aacdaca33a2940c76c77c8c", "score": "0.6543176", "text": "func (kn *K8sNode) Unwrap() *K8sNode {\n\ttx, ok := kn.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: K8sNode is not a transactional entity\")\n\t}\n\tkn.config.driver = tx.drv\n\treturn kn\n}", "title": "" }, { "docid": "18687231be7e2a3feadc4bf627dea578", "score": "0.6526834", "text": "func (fm *FlowMilestone) Unwrap() *FlowMilestone {\n\ttx, ok := fm.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"models: FlowMilestone is not a transactional entity\")\n\t}\n\tfm.config.driver = tx.drv\n\treturn fm\n}", "title": "" }, { "docid": "3a2703b8bcbe02fd66af806238320d1a", "score": "0.6518014", "text": "func (a *Admin) Unwrap() *Admin {\n\ttx, ok := a.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Admin is not a transactional entity\")\n\t}\n\ta.config.driver = tx.drv\n\treturn a\n}", "title": "" }, { "docid": "bb4857fe9f80a97df20adaeb6e4fc449", "score": "0.65022033", "text": "func (f *File) Unwrap() *File {\n\t_tx, ok := f.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: File is not a transactional entity\")\n\t}\n\tf.config.driver = _tx.drv\n\treturn f\n}", "title": "" }, { "docid": "912db691ad7188bf0971a1853fd810ba", "score": "0.6491331", "text": "func (o *Officer) Unwrap() *Officer {\n\ttx, ok := o.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Officer is not a transactional entity\")\n\t}\n\to.config.driver = tx.drv\n\treturn o\n}", "title": "" }, { "docid": "35b268ab80d4fe82bdacb72773301b7d", "score": "0.6489335", "text": "func (b *Billingstatus) Unwrap() *Billingstatus {\n\ttx, ok := b.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Billingstatus is not a transactional entity\")\n\t}\n\tb.config.driver = tx.drv\n\treturn b\n}", "title": "" }, { "docid": "abe5f012256e1433baff3ae4fb491805", "score": "0.648866", "text": "func (kn *K8sNamespace) Unwrap() *K8sNamespace {\n\ttx, ok := kn.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: K8sNamespace is not a transactional entity\")\n\t}\n\tkn.config.driver = tx.drv\n\treturn kn\n}", "title": "" }, { "docid": "ea1d356893d193894f86cb1367088fce", "score": "0.64868474", "text": "func (pr *Professorship) Unwrap() *Professorship {\n\ttx, ok := pr.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Professorship is not a transactional entity\")\n\t}\n\tpr.config.driver = tx.drv\n\treturn pr\n}", "title": "" }, { "docid": "edb28ca4839d36fa5a54da320a91d7ed", "score": "0.6480124", "text": "func (bi *BagItem) Unwrap() *BagItem {\n\ttx, ok := bi.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: BagItem is not a transactional entity\")\n\t}\n\tbi.config.driver = tx.drv\n\treturn bi\n}", "title": "" }, { "docid": "af0e7055f559ebfde00d90225c1ad9da", "score": "0.6436517", "text": "func (c *Consumer) Unwrap() *Consumer {\n\ttx, ok := c.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Consumer is not a transactional entity\")\n\t}\n\tc.config.driver = tx.drv\n\treturn c\n}", "title": "" }, { "docid": "9c91ce6a897c4fff51f1b8f01234c9ae", "score": "0.6418779", "text": "func (stc *SurveyTemplateCategory) Unwrap() *SurveyTemplateCategory {\n\ttx, ok := stc.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: SurveyTemplateCategory is not a transactional entity\")\n\t}\n\tstc.config.driver = tx.drv\n\treturn stc\n}", "title": "" }, { "docid": "1bf767e6c55d5e965627e4c35d0de3f6", "score": "0.64180326", "text": "func (kc *K8sContainer) Unwrap() *K8sContainer {\n\ttx, ok := kc.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: K8sContainer is not a transactional entity\")\n\t}\n\tkc.config.driver = tx.drv\n\treturn kc\n}", "title": "" } ]
9647b873210526979d097a3177472b54
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
[ { "docid": "3f8cb2f033697ba59d1b0b1ee422293b", "score": "0.0", "text": "func (in *HighAvailabilityPolicyRollingUpdate) DeepCopyInto(out *HighAvailabilityPolicyRollingUpdate) {\n\t*out = *in\n\tout.MinSurge = in.MinSurge\n\tout.MaxSurge = in.MaxSurge\n\treturn\n}", "title": "" } ]
[ { "docid": "af1158730de2f0e70ad56fca78135468", "score": "0.8215289", "text": "func (r *RunInfo) DeepCopyInto(out *RunInfo) {\n\t*out = *r\n}", "title": "" }, { "docid": "cf52e209065280c6fd5fa28ba55d00fb", "score": "0.81280124", "text": "func (in *Base) DeepCopyInto(out *Base) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "8f44d51096d32fdfe374fc95976e42e3", "score": "0.81039286", "text": "func (in *ForkObject) DeepCopyInto(out *ForkObject) {\n\t*out = *in\n}", "title": "" }, { "docid": "3bb218cf07f9cbcca9c1cc1e4f90557a", "score": "0.80862963", "text": "func (in *TargetObjectInfo) DeepCopyInto(out *TargetObjectInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "7b89e3d0936cf89677cab2ae359aa48f", "score": "0.8083811", "text": "func (in *DebugObjectInfo) DeepCopyInto(out *DebugObjectInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "21a4dc0bd810e7ad7e5a1989d07e436c", "score": "0.80673146", "text": "func (in *Input) DeepCopyInto(out *Input) {\n\t*out = *in\n}", "title": "" }, { "docid": "4aa05aeda5796a540bd75503655e4335", "score": "0.8064545", "text": "func (u *SSN) DeepCopyInto(out *SSN) {\n\t*out = *u\n}", "title": "" }, { "docid": "150dc262c7e80c0c5efc198e717bb672", "score": "0.8026454", "text": "func (in *ExistPvc) DeepCopyInto(out *ExistPvc) {\n\t*out = *in\n}", "title": "" }, { "docid": "c067d81aecf1209d2e46c570f838150f", "score": "0.8012046", "text": "func (in *DockerStep) DeepCopyInto(out *DockerStep) {\n\t*out = *in\n\tif in.Inline != nil {\n\t\tin, out := &in.Inline, &out.Inline\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tout.Auth = in.Auth\n\treturn\n}", "title": "" }, { "docid": "fcd73bcfed9455cd87601682e4ad29c0", "score": "0.7996313", "text": "func (in *Container) DeepCopyInto(out *Container) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.Command != nil {\n\t\tin, out := &in.Command, &out.Command\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.LifeCycleScript != nil {\n\t\tin, out := &in.LifeCycleScript, &out.LifeCycleScript\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "710da614f56a1fb0eca6a6128897b83b", "score": "0.799204", "text": "func (in *RuntimeRef) DeepCopyInto(out *RuntimeRef) {\n\t*out = *in\n}", "title": "" }, { "docid": "5b0ae3bc7e3bd108e7859ef8990e0473", "score": "0.79887754", "text": "func (in *Ibft2) DeepCopyInto(out *Ibft2) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "943731dcc5b0dd132eeb06116f982bdd", "score": "0.7987097", "text": "func (in *TestResult) DeepCopyInto(out *TestResult) {\n\t*out = *in\n}", "title": "" }, { "docid": "87cf7c6678a506b2791e1c30d1d4540c", "score": "0.7986994", "text": "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "87cf7c6678a506b2791e1c30d1d4540c", "score": "0.7986994", "text": "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "75f3168b26f729025d12f8916352eeec", "score": "0.79854053", "text": "func (in *Haproxy) DeepCopyInto(out *Haproxy) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "885731d95003e6f9b658d976bd38dfdc", "score": "0.7975989", "text": "func (in *SSH) DeepCopyInto(out *SSH) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f02ca9d2b982235afe15ba0d467caec5", "score": "0.7972486", "text": "func (in *Runtime) DeepCopyInto(out *Runtime) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "dc25f670b9ab6635efd1a7f707841646", "score": "0.79695636", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "dc25f670b9ab6635efd1a7f707841646", "score": "0.79695636", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "dc25f670b9ab6635efd1a7f707841646", "score": "0.79695636", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "7f7effc920f92688054d1b82f5296237", "score": "0.7967528", "text": "func (b *Base64) DeepCopyInto(out *Base64) {\n\t*out = *b\n}", "title": "" }, { "docid": "9821b63fb0f1d90e082fd6d5c30e67f5", "score": "0.79624444", "text": "func (in *EventDependencyTransformer) DeepCopyInto(out *EventDependencyTransformer) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "879dcea77d509081e8fcedbe90f595e8", "score": "0.7961954", "text": "func (in *StageOutput) DeepCopyInto(out *StageOutput) {\n\t*out = *in\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.7945754", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.7945754", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3bca37b1bd60a60d3b9082d9dcfdc522", "score": "0.7944541", "text": "func (in *Dependent) DeepCopyInto(out *Dependent) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "39267c08938a4911205ad5cc84e6dd7a", "score": "0.79428566", "text": "func (in *GitFileGeneratorItem) DeepCopyInto(out *GitFileGeneratorItem) {\n\t*out = *in\n}", "title": "" }, { "docid": "92bd0f9f52c488e2823218fc03f28117", "score": "0.7942668", "text": "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "92bd0f9f52c488e2823218fc03f28117", "score": "0.7942668", "text": "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "bf51554e15947a4b199f2bc289c3d6ac", "score": "0.7940451", "text": "func (in *AnsibleStep) DeepCopyInto(out *AnsibleStep) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "dac9107221cae585112f952b85a6eae2", "score": "0.793851", "text": "func (in *Forks) DeepCopyInto(out *Forks) {\n\t*out = *in\n\tif in.DAO != nil {\n\t\tin, out := &in.DAO, &out.DAO\n\t\t*out = new(uint)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "f254b9a7e0b67c245be45d8e4adaf4be", "score": "0.7936731", "text": "func (in *ContainerPort) DeepCopyInto(out *ContainerPort) {\n\t*out = *in\n}", "title": "" }, { "docid": "971bb082bf27f56370b25e2f49552a78", "score": "0.79294837", "text": "func (in *General) DeepCopyInto(out *General) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "4e012cd4b271b374007162be15072ad7", "score": "0.79252166", "text": "func (in *IsoContainer) DeepCopyInto(out *IsoContainer) {\n\t*out = *in\n}", "title": "" }, { "docid": "055aae38d2d7fc9fbd9c9cf0639142fe", "score": "0.7915377", "text": "func (in *Git) DeepCopyInto(out *Git) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "9cebf74d08091032bbd51670d93f0a45", "score": "0.7911627", "text": "func (in *ConfigFile) DeepCopyInto(out *ConfigFile) {\n\t*out = *in\n}", "title": "" }, { "docid": "ca040e37b75301894d4e020357c94217", "score": "0.7911138", "text": "func (in *BackupProgress) DeepCopyInto(out *BackupProgress) {\n\t*out = *in\n}", "title": "" }, { "docid": "7a8e749b7a0b9845bb67a5f72049e1a5", "score": "0.7909384", "text": "func (in *DataDisk) DeepCopyInto(out *DataDisk) {\n\t*out = *in\n}", "title": "" }, { "docid": "9b532d431b3f33589b5f4ac91d132785", "score": "0.790913", "text": "func (in *PhaseStep) DeepCopyInto(out *PhaseStep) {\n\t*out = *in\n}", "title": "" }, { "docid": "278b0099578018f680c5c5cde2a932e4", "score": "0.7908773", "text": "func (u *MAC) DeepCopyInto(out *MAC) {\n\t*out = *u\n}", "title": "" }, { "docid": "eae9a043ce1412b2407a7ae6b28a5fa1", "score": "0.7905649", "text": "func (in *Variable) DeepCopyInto(out *Variable) {\n\t*out = *in\n}", "title": "" }, { "docid": "663b7984e667455eca13bb2ce6cbc6d8", "score": "0.79050326", "text": "func (in *RestoreProgress) DeepCopyInto(out *RestoreProgress) {\n\t*out = *in\n}", "title": "" }, { "docid": "a7e5ae0f85566c0ffe05723461bfe630", "score": "0.7904594", "text": "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "a7e5ae0f85566c0ffe05723461bfe630", "score": "0.7904594", "text": "func (in *DataExportObjectReference) DeepCopyInto(out *DataExportObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f1b3ceb3a73df082502370d4536f56b3", "score": "0.7904235", "text": "func (in *NamespacedObjectReference) DeepCopyInto(out *NamespacedObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "bcf09a71293c9cee0c34c2fa367e656b", "score": "0.79036915", "text": "func (in *Path) DeepCopyInto(out *Path) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "ba66606acf4d3e4d73f3b8aa0a57fc16", "score": "0.79020816", "text": "func (in *GitDirectoryGeneratorItem) DeepCopyInto(out *GitDirectoryGeneratorItem) {\n\t*out = *in\n}", "title": "" }, { "docid": "af60d5ec0544d11ee9690f7efa32afaf", "score": "0.78988886", "text": "func (in *NamePath) DeepCopyInto(out *NamePath) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "1278f408cf2921c5a1408827ba5b2974", "score": "0.78977424", "text": "func (in *ConsoleCreateObj) DeepCopyInto(out *ConsoleCreateObj) {\n\t*out = *in\n}", "title": "" }, { "docid": "cc6567d23ec26fe179a078bfd443ef2c", "score": "0.7891376", "text": "func (in *UsedPipelineRun) DeepCopyInto(out *UsedPipelineRun) {\n\t*out = *in\n}", "title": "" }, { "docid": "8e6cd44cf22a86e44d327b252c26a32d", "score": "0.7891024", "text": "func (in *BuildTemplate) DeepCopyInto(out *BuildTemplate) {\n\t*out = *in\n\tif in.Cmd != nil {\n\t\tin, out := &in.Cmd, &out.Cmd\n\t\t*out = make([]BuildTemplateStep, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "dddf435977ebcd6bfaf0b4c062ea8042", "score": "0.7889831", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "title": "" }, { "docid": "32b00888211ff9ca3596125ceec6d7e7", "score": "0.78890276", "text": "func (in *ObjectInfo) DeepCopyInto(out *ObjectInfo) {\n\t*out = *in\n\tout.GroupVersionKind = in.GroupVersionKind\n\treturn\n}", "title": "" }, { "docid": "10dec41dc58994e25d9453a1d8f7ad21", "score": "0.7887135", "text": "func (in *Files) DeepCopyInto(out *Files) {\n\t*out = *in\n}", "title": "" }, { "docid": "2b0be71ab1164e9fb2820db9379c9305", "score": "0.788637", "text": "func (in *Source) DeepCopyInto(out *Source) {\n\t*out = *in\n\tif in.Dependencies != nil {\n\t\tin, out := &in.Dependencies, &out.Dependencies\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MavenRepositories != nil {\n\t\tin, out := &in.MavenRepositories, &out.MavenRepositories\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "23db226639df1ec5bfce6ed220d55ed3", "score": "0.7885264", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "title": "" }, { "docid": "23db226639df1ec5bfce6ed220d55ed3", "score": "0.7885264", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "title": "" }, { "docid": "62c7419d1ac578ace62f5fa642ecc043", "score": "0.7884786", "text": "func (in *StackBuild) DeepCopyInto(out *StackBuild) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "9dab74e557d1dbb5849857f762204168", "score": "0.7880785", "text": "func (in *BuildTaskRef) DeepCopyInto(out *BuildTaskRef) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "dfd9b82d38c6fee08dd3cf0209bd1133", "score": "0.78745943", "text": "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "title": "" }, { "docid": "dfd9b82d38c6fee08dd3cf0209bd1133", "score": "0.78745943", "text": "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "title": "" }, { "docid": "fb1b1c23f90c3d83aa17368189a6a96c", "score": "0.78745407", "text": "func (in *PathInfo) DeepCopyInto(out *PathInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "6b8cc9ad5b8dc818b672eb6bf4bd944b", "score": "0.78734446", "text": "func (in *PoA) DeepCopyInto(out *PoA) {\n\t*out = *in\n}", "title": "" }, { "docid": "7c07976250a3e9b2c296a4afca67fd21", "score": "0.78724426", "text": "func (in *Section) DeepCopyInto(out *Section) {\n\t*out = *in\n\tif in.SecretRefs != nil {\n\t\tin, out := &in.SecretRefs, &out.SecretRefs\n\t\t*out = make([]SecretReference, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Files != nil {\n\t\tin, out := &in.Files, &out.Files\n\t\t*out = make([]FileMount, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "title": "" }, { "docid": "d04effc735adc59932f839adb9a5fcca", "score": "0.78713626", "text": "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n}", "title": "" }, { "docid": "d02c4e245665db42aa7f449aedbc0217", "score": "0.78713554", "text": "func (in *DNSSelection) DeepCopyInto(out *DNSSelection) {\n\t*out = *in\n\tif in.Include != nil {\n\t\tin, out := &in.Include, &out.Include\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Exclude != nil {\n\t\tin, out := &in.Exclude, &out.Exclude\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "cb984c73c4431bec89a8afbdfc556e69", "score": "0.78652424", "text": "func (in *ReleaseVersion) DeepCopyInto(out *ReleaseVersion) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5186b8d1bfd3abf2fb983694f27e4aed", "score": "0.7863321", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5186b8d1bfd3abf2fb983694f27e4aed", "score": "0.7863321", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5186b8d1bfd3abf2fb983694f27e4aed", "score": "0.7863321", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "10baca6dfd622c5e40e8b794a851d6d3", "score": "0.7863293", "text": "func (in *Command) DeepCopyInto(out *Command) {\n\t*out = *in\n\tif in.Flags != nil {\n\t\tin, out := &in.Flags, &out.Flags\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Value != nil {\n\t\tin, out := &in.Value, &out.Value\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "65bb38f2dccf641027ebb99f4474f90d", "score": "0.7862628", "text": "func (in *PathRule) DeepCopyInto(out *PathRule) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "525a3c863697171a703a729224eaef7f", "score": "0.7860664", "text": "func (in *DockerLifecycleData) DeepCopyInto(out *DockerLifecycleData) {\n\t*out = *in\n}", "title": "" }, { "docid": "0fa3808d8d54265b095b04724cea6249", "score": "0.7858556", "text": "func (in *RunScriptStepConfig) DeepCopyInto(out *RunScriptStepConfig) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "29e02c97b127087f995d6b0457b82abc", "score": "0.785785", "text": "func (in *Checksum) DeepCopyInto(out *Checksum) {\n\t*out = *in\n}", "title": "" }, { "docid": "ce176c865d104baf77ca7c4291fc9f09", "score": "0.78571486", "text": "func (in *DomainNameOutput) DeepCopyInto(out *DomainNameOutput) {\n\t*out = *in\n}", "title": "" }, { "docid": "600681b5dce498f6a946514743145f67", "score": "0.7851332", "text": "func (in *InterfaceStruct) DeepCopyInto(out *InterfaceStruct) {\n\t*out = *in\n\tif in.val != nil {\n\t\tin, out := &in.val, &out.val\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "title": "" }, { "docid": "db1289a37e521177d35543e93aaa430a", "score": "0.78453225", "text": "func (in *Ref) DeepCopyInto(out *Ref) {\n\t*out = *in\n}", "title": "" }, { "docid": "edd6c658e1a3b086682f942a63ac775e", "score": "0.78448987", "text": "func (in *MemorySpec) DeepCopyInto(out *MemorySpec) {\n\t*out = *in\n}", "title": "" }, { "docid": "e0d1dd39451b67a1f11ed52a331af2ed", "score": "0.78415996", "text": "func (in *BuildJenkinsInfo) DeepCopyInto(out *BuildJenkinsInfo) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "bd6157875cabfee84055615db9040fad", "score": "0.7837483", "text": "func (in *VirtualDatabaseBuildObject) DeepCopyInto(out *VirtualDatabaseBuildObject) {\n\t*out = *in\n\tif in.Incremental != nil {\n\t\tin, out := &in.Incremental, &out.Incremental\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]v1.EnvVar, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tout.Git = in.Git\n\tin.Source.DeepCopyInto(&out.Source)\n\tif in.Webhooks != nil {\n\t\tin, out := &in.Webhooks, &out.Webhooks\n\t\t*out = make([]WebhookSecret, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "5696f71281f2bb9ad8b29e927ae7eab1", "score": "0.7837037", "text": "func (in *MaintenanceInfo) DeepCopyInto(out *MaintenanceInfo) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "a2e56fc0b4ad6ad31d7c15f058860708", "score": "0.7836443", "text": "func (in *KopsNode) DeepCopyInto(out *KopsNode) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "99ddb33db709798f629620e68a898683", "score": "0.78351796", "text": "func (in *FalconAPI) DeepCopyInto(out *FalconAPI) {\n\t*out = *in\n}", "title": "" }, { "docid": "bca37ffe0db98d0566f42347e84e664c", "score": "0.78329664", "text": "func (in *EBS) DeepCopyInto(out *EBS) {\n\t*out = *in\n}", "title": "" }, { "docid": "66d2580ffb856b04e5d00a44ee008ce0", "score": "0.7831094", "text": "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5be1425525b35b26aef12a26b2011c4c", "score": "0.7829445", "text": "func (in *Empty) DeepCopyInto(out *Empty) {\n\t*out = *in\n\tout.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral\n\tif in.XXX_unrecognized != nil {\n\t\tin, out := &in.XXX_unrecognized, &out.XXX_unrecognized\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "b04ae4761dcd0ef9878904a00e3dd8d0", "score": "0.7826582", "text": "func (in *ComponentDistGit) DeepCopyInto(out *ComponentDistGit) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "860706dd62a6169f37c407ae9e941366", "score": "0.7824499", "text": "func (in *Memory) DeepCopyInto(out *Memory) {\n\t*out = *in\n\tout.Required = in.Required.DeepCopy()\n}", "title": "" }, { "docid": "02fd4be53bdac24eb957e6384d4abd1d", "score": "0.78242797", "text": "func (in *Persistence) DeepCopyInto(out *Persistence) {\n\t*out = *in\n\tout.Size = in.Size.DeepCopy()\n\treturn\n}", "title": "" }, { "docid": "45b81ab5647ffc92a79777654a796ae7", "score": "0.78227437", "text": "func (in *ManagedDisk) DeepCopyInto(out *ManagedDisk) {\n\t*out = *in\n}", "title": "" }, { "docid": "ffab4debbb09338a2ccf02c14685c7bf", "score": "0.78192484", "text": "func (e *Email) DeepCopyInto(out *Email) {\n\t*out = *e\n}", "title": "" }, { "docid": "9701e8b6fac54b671a6f2c7568ba4725", "score": "0.7818843", "text": "func (in *ImageInfo) DeepCopyInto(out *ImageInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "1739ff65106bd91c3ff55f1dcf9372ba", "score": "0.78128535", "text": "func (in *ShootRef) DeepCopyInto(out *ShootRef) {\n\t*out = *in\n}", "title": "" }, { "docid": "6eff9c92ecd03b757d482820e5efaf3a", "score": "0.7812535", "text": "func (in *N3000Fpga) DeepCopyInto(out *N3000Fpga) {\n\t*out = *in\n}", "title": "" }, { "docid": "b4192aeae1c67719d8866db63b4cc639", "score": "0.78111476", "text": "func (in *NetflowType) DeepCopyInto(out *NetflowType) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "95b78244325c626f34c61e7aac9fbad6", "score": "0.78111106", "text": "func (in *BuiltInAdapter) DeepCopyInto(out *BuiltInAdapter) {\n\t*out = *in\n}", "title": "" }, { "docid": "5b1d1d53678b95e477d0ab43c5ee92ef", "score": "0.781107", "text": "func (in *Node) DeepCopyInto(out *Node) {\n\t*out = *in\n\tif in.FailStatus != nil {\n\t\tin, out := &in.FailStatus, &out.FailStatus\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MigratingSlots != nil {\n\t\tin, out := &in.MigratingSlots, &out.MigratingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.ImportingSlots != nil {\n\t\tin, out := &in.ImportingSlots, &out.ImportingSlots\n\t\t*out = make(map[string]string, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9a301aab0199bd7435142cc791905e48", "score": "0.78093034", "text": "func (in *CPUSpec) DeepCopyInto(out *CPUSpec) {\n\t*out = *in\n}", "title": "" }, { "docid": "0d141177e260c52daba3cc6c490e1548", "score": "0.7808775", "text": "func (in *LoopState) DeepCopyInto(out *LoopState) {\n\t*out = *in\n}", "title": "" } ]
63ebacc9deb14c657b496d12e17f464e
NewInlineObject9 instantiates a new InlineObject9 object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed
[ { "docid": "1e6f81fee1d8bc7400cc19e1172caffb", "score": "0.7515584", "text": "func NewInlineObject9(appId int32, deviceId int32, stateToken string) *InlineObject9 {\n\tthis := InlineObject9{}\n\tthis.AppId = appId\n\tthis.DeviceId = deviceId\n\tthis.StateToken = stateToken\n\tvar doNotNotify bool = false\n\tthis.DoNotNotify = &doNotNotify\n\treturn &this\n}", "title": "" } ]
[ { "docid": "e6d8f371f8dbea0f830a3a5b36ef6fc1", "score": "0.73715615", "text": "func NewInlineObject9WithDefaults() *InlineObject9 {\n\tthis := InlineObject9{}\n\tvar doNotNotify bool = false\n\tthis.DoNotNotify = &doNotNotify\n\treturn &this\n}", "title": "" }, { "docid": "6afad2b73a940a147a3927c58fa962a9", "score": "0.5803641", "text": "func NewInlineObject90() *InlineObject90 {\n\tthis := InlineObject90{}\n\treturn &this\n}", "title": "" }, { "docid": "695e4d7e4bc7dc659d7e14c819cf86a0", "score": "0.57204425", "text": "func NewInlineObject90WithDefaults() *InlineObject90 {\n\tthis := InlineObject90{}\n\treturn &this\n}", "title": "" }, { "docid": "e6f547f14713e3eed2c27d01df0fcf69", "score": "0.5658912", "text": "func NewInlineObject10(factorId int32, displayName string, number string) *InlineObject10 {\n\tthis := InlineObject10{}\n\tthis.FactorId = factorId\n\tthis.DisplayName = displayName\n\tthis.Number = number\n\treturn &this\n}", "title": "" }, { "docid": "b213dd2f5f6ad6a00444b870bcaec3ac", "score": "0.5599207", "text": "func NewInlineObject77WithDefaults() *InlineObject77 {\n\tthis := InlineObject77{}\n\treturn &this\n}", "title": "" }, { "docid": "573ac18fd5562f50717bfa244b87b3e2", "score": "0.5549915", "text": "func NewInlineObject(state int32) *InlineObject {\n\tthis := InlineObject{}\n\tthis.State = state\n\treturn &this\n}", "title": "" }, { "docid": "d14eb913d1d44b22c23e80c0eaab7ce2", "score": "0.5547974", "text": "func NewInlineObject77() *InlineObject77 {\n\tthis := InlineObject77{}\n\treturn &this\n}", "title": "" }, { "docid": "f5d5b2acf29dedd1e33b0ca5eab23207", "score": "0.55465186", "text": "func NewInlineObject10WithDefaults() *InlineObject10 {\n\tthis := InlineObject10{}\n\treturn &this\n}", "title": "" }, { "docid": "bc031e7dd2a39026790bf126e407e489", "score": "0.5524701", "text": "func NewInlineObject41() *InlineObject41 {\n\tthis := InlineObject41{}\n\treturn &this\n}", "title": "" }, { "docid": "a1a663808d0b10d527efd5eadc5c7f07", "score": "0.5491149", "text": "func NewInlineObject107() *InlineObject107 {\n\tthis := InlineObject107{}\n\treturn &this\n}", "title": "" }, { "docid": "e5666339497f9987d077e06ce2e6d00f", "score": "0.548003", "text": "func NewInlineObject41WithDefaults() *InlineObject41 {\n\tthis := InlineObject41{}\n\treturn &this\n}", "title": "" }, { "docid": "22895eac7e1e2cac6a9720fd42b4cdfa", "score": "0.5411806", "text": "func NewInlineObject107WithDefaults() *InlineObject107 {\n\tthis := InlineObject107{}\n\treturn &this\n}", "title": "" }, { "docid": "33c29bf274e7e96eb45de0cb202c3d81", "score": "0.5357796", "text": "func NewInlineObject3(file *os.File, ) *InlineObject3 {\n\tthis := InlineObject3{}\n\tthis.File = file\n\treturn &this\n}", "title": "" }, { "docid": "257bb2f8534d4776c3e5d504478f8754", "score": "0.53519017", "text": "func NewInlineObject22() *InlineObject22 {\n\tthis := InlineObject22{}\n\treturn &this\n}", "title": "" }, { "docid": "a564817ee17fca841d20f9eb19423ed5", "score": "0.53500414", "text": "func NewInlineObject() *InlineObject {\n\tthis := InlineObject{}\n\treturn &this\n}", "title": "" }, { "docid": "0309db8342ad7c7355e7cca5d6e46594", "score": "0.53448564", "text": "func NewInlineObject22WithDefaults() *InlineObject22 {\n\tthis := InlineObject22{}\n\treturn &this\n}", "title": "" }, { "docid": "d76046f3710567f71668c7bc833c3c75", "score": "0.53137183", "text": "func NewInlineObject12() *InlineObject12 {\n\tthis := InlineObject12{}\n\treturn &this\n}", "title": "" }, { "docid": "aa3edb293fdda820f683e1ccccdaf404", "score": "0.52966315", "text": "func NewInlineObject12WithDefaults() *InlineObject12 {\n\tthis := InlineObject12{}\n\treturn &this\n}", "title": "" }, { "docid": "e35d4406d8f92efb2cb0dbe10b8f77fe", "score": "0.5290683", "text": "func NewInlineObject3WithDefaults() *InlineObject3 {\n\tthis := InlineObject3{}\n\treturn &this\n}", "title": "" }, { "docid": "57442f0dc9a374bd0d2f106bc6c85283", "score": "0.5254275", "text": "func NewInlineObjectWithDefaults() *InlineObject {\n\tthis := InlineObject{}\n\treturn &this\n}", "title": "" }, { "docid": "57442f0dc9a374bd0d2f106bc6c85283", "score": "0.5254275", "text": "func NewInlineObjectWithDefaults() *InlineObject {\n\tthis := InlineObject{}\n\treturn &this\n}", "title": "" }, { "docid": "92b310269a05ab5ff8fd47641852da35", "score": "0.5028513", "text": "func (o *Object) New(args ...interface{}) *Object { return o.object.New(args...) }", "title": "" }, { "docid": "91d9d8c34cb4f73a2d3446a5152dc966", "score": "0.49988586", "text": "func NewInlineObject15() *InlineObject15 {\n\tthis := InlineObject15{}\n\treturn &this\n}", "title": "" }, { "docid": "a6ccdabdc5d18e340c97f6feaa2dc841", "score": "0.49748963", "text": "func NewInlineObject15WithDefaults() *InlineObject15 {\n\tthis := InlineObject15{}\n\treturn &this\n}", "title": "" }, { "docid": "1704d4e76e7ef1dbb14194561a7a525c", "score": "0.48531207", "text": "func NewInlineObject75WithDefaults() *InlineObject75 {\n\tthis := InlineObject75{}\n\treturn &this\n}", "title": "" }, { "docid": "cfa048dde1d0e635ceb986009270b36e", "score": "0.48181215", "text": "func newObjectWithDefaults(typ tftypes.Object, defaultValue func(tftypes.Type) tftypes.Value) tftypes.Value {\n\tattrs := map[string]tftypes.Value{}\n\tfor attrName, attrTy := range typ.AttributeTypes {\n\t\tattrs[attrName] = defaultValue(attrTy)\n\t}\n\treturn tftypes.NewValue(typ, attrs)\n}", "title": "" }, { "docid": "3bf79238375c3a3d4d7e4d6832169200", "score": "0.4817042", "text": "func NewInlineObject75() *InlineObject75 {\n\tthis := InlineObject75{}\n\treturn &this\n}", "title": "" }, { "docid": "ff4350c5e6c09dda0fb6749de8ea7197", "score": "0.4759514", "text": "func NewInlineElements(elements ...interface{}) (InlineElements, error) {\n\tresult := mergeElements(elements...)\n\treturn result, nil\n}", "title": "" }, { "docid": "71f63752392d948ccbbdec9d146e4834", "score": "0.47560716", "text": "func NewInlineObject2(file *os.File, ) *InlineObject2 {\n\tthis := InlineObject2{}\n\tthis.File = file\n\treturn &this\n}", "title": "" }, { "docid": "9f819b6a6108eb43d8d66de434a97603", "score": "0.46687487", "text": "func (o InlineObject991) MarshalJSON() ([]byte, error) {\n\ttoSerialize := map[string]interface{}{}\n\tif o.Settlement == nil {\n\t\tif o.isExplicitNullSettlement {\n\t\t\ttoSerialize[\"settlement\"] = o.Settlement\n\t\t}\n\t} else {\n\t\ttoSerialize[\"settlement\"] = o.Settlement\n\t}\n\tif o.Maturity == nil {\n\t\tif o.isExplicitNullMaturity {\n\t\t\ttoSerialize[\"maturity\"] = o.Maturity\n\t\t}\n\t} else {\n\t\ttoSerialize[\"maturity\"] = o.Maturity\n\t}\n\tif o.Issue == nil {\n\t\tif o.isExplicitNullIssue {\n\t\t\ttoSerialize[\"issue\"] = o.Issue\n\t\t}\n\t} else {\n\t\ttoSerialize[\"issue\"] = o.Issue\n\t}\n\tif o.FirstCoupon == nil {\n\t\tif o.isExplicitNullFirstCoupon {\n\t\t\ttoSerialize[\"firstCoupon\"] = o.FirstCoupon\n\t\t}\n\t} else {\n\t\ttoSerialize[\"firstCoupon\"] = o.FirstCoupon\n\t}\n\tif o.Rate == nil {\n\t\tif o.isExplicitNullRate {\n\t\t\ttoSerialize[\"rate\"] = o.Rate\n\t\t}\n\t} else {\n\t\ttoSerialize[\"rate\"] = o.Rate\n\t}\n\tif o.Yld == nil {\n\t\tif o.isExplicitNullYld {\n\t\t\ttoSerialize[\"yld\"] = o.Yld\n\t\t}\n\t} else {\n\t\ttoSerialize[\"yld\"] = o.Yld\n\t}\n\tif o.Redemption == nil {\n\t\tif o.isExplicitNullRedemption {\n\t\t\ttoSerialize[\"redemption\"] = o.Redemption\n\t\t}\n\t} else {\n\t\ttoSerialize[\"redemption\"] = o.Redemption\n\t}\n\tif o.Frequency == nil {\n\t\tif o.isExplicitNullFrequency {\n\t\t\ttoSerialize[\"frequency\"] = o.Frequency\n\t\t}\n\t} else {\n\t\ttoSerialize[\"frequency\"] = o.Frequency\n\t}\n\tif o.Basis == nil {\n\t\tif o.isExplicitNullBasis {\n\t\t\ttoSerialize[\"basis\"] = o.Basis\n\t\t}\n\t} else {\n\t\ttoSerialize[\"basis\"] = o.Basis\n\t}\n\treturn json.Marshal(toSerialize)\n}", "title": "" }, { "docid": "f253a5656019696975cfecb02819c841", "score": "0.46577865", "text": "func NewInlineObject2WithDefaults() *InlineObject2 {\n\tthis := InlineObject2{}\n\treturn &this\n}", "title": "" }, { "docid": "03468cd02e4d7a7640cb31f0a3fc2456", "score": "0.4653407", "text": "func New(font Font, s string) (*Object, error) {\n\to := &Object{\n\t\tgfx.NewObject(),\n\t\tfont,\n\t\ts,\n\t}\n\to.Object.AlphaMode = gfx.AlphaToCoverage\n\to.Object.FaceCulling = gfx.NoFaceCulling // FIXME: remove\n\to.Object.Shader = nil // FIXME: add default\n\to.Object.Meshes = []*gfx.Mesh{gfx.NewMesh()}\n\terr := o.build()\n\treturn o, err\n}", "title": "" }, { "docid": "6a9c74a01c78c59253a20c52e63cc771", "score": "0.45950586", "text": "func NewObject() (Object) {\n m := make(map[Message] Method)\n return &BasicObject{m}\n}", "title": "" }, { "docid": "c12118700fd432dcf2f9def47916574d", "score": "0.45621145", "text": "func NewObject(class *Class) *Object {\n\tif class.IsArray() {\n\t\t// TODO\n\t\tpanic(\"wrong API\")\n\t}\n\treturn &Object{\n\t\tclass: class,\n\t\tdata: NewVars(class.InsSlotNum()),\n\t}\n}", "title": "" }, { "docid": "96514b2677ecb11c45a7260a4f4deeac", "score": "0.45418632", "text": "func newExampleObject(lc hive.Lifecycle, cfg ExampleConfig, p *privateObject, log logrus.FieldLogger) *ExampleObject {\n\tobj := &ExampleObject{cfg: cfg, log: log}\n\tlc.Append(hive.Hook{OnStart: obj.onStart, OnStop: obj.onStop})\n\tlog.Info(\"ExampleObject constructed\")\n\treturn obj\n}", "title": "" }, { "docid": "9918d526ffe5e346a718f235c2ee7853", "score": "0.45308802", "text": "func (s Zjob) NewArgs(n int32) (capnp.TextList, error) {\n\tl, err := capnp.NewTextList(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn capnp.TextList{}, err\n\t}\n\terr = s.Struct.SetPtr(1, l.List.ToPtr())\n\treturn l, err\n}", "title": "" }, { "docid": "9918d526ffe5e346a718f235c2ee7853", "score": "0.45308802", "text": "func (s Zjob) NewArgs(n int32) (capnp.TextList, error) {\n\tl, err := capnp.NewTextList(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn capnp.TextList{}, err\n\t}\n\terr = s.Struct.SetPtr(1, l.List.ToPtr())\n\treturn l, err\n}", "title": "" }, { "docid": "f2afdae8f0d94f7d809c6f24b74d0d98", "score": "0.4518239", "text": "func NewInlineLink(url string, attributes ElementAttributes) (InlineLink, error) {\n\t// init attributes with empty 'text' attribute\n\tif attributes == nil {\n\t\tattributes = map[string]interface{}{\n\t\t\tAttrInlineLinkText: \"\",\n\t\t}\n\t}\n\treturn InlineLink{\n\t\tURL: url,\n\t\tAttributes: attributes,\n\t}, nil\n}", "title": "" }, { "docid": "7c23110f135e2bbaf1427f50f0b6788e", "score": "0.45103526", "text": "func New() *Object {\n\treturn &Object{}\n}", "title": "" }, { "docid": "7c23110f135e2bbaf1427f50f0b6788e", "score": "0.45103526", "text": "func New() *Object {\n\treturn &Object{}\n}", "title": "" }, { "docid": "7c23110f135e2bbaf1427f50f0b6788e", "score": "0.45103526", "text": "func New() *Object {\n\treturn &Object{}\n}", "title": "" }, { "docid": "cca589bd65427a41701990ac6bc2f571", "score": "0.44882393", "text": "func NewBasicObject(x, y float64, w, h int) *BasicObject {\n\tobj := &BasicObject{\n\t\tID: xid.New(),\n\t\tWidth: w,\n\t\tHeight: h,\n\t\tWidthF: float64(w),\n\t\tHeightF: float64(h),\n\t\tisCentered: true,\n\t\tVelocity: &Vector2d{},\n\t\tPosition: &Vector2d{X: x, Y: y},\n\t}\n\n\treturn obj\n}", "title": "" }, { "docid": "2bfcabeb855627bec67f5dcf7f2aed2d", "score": "0.44781113", "text": "func (o *JS) New(args []interface{}) internal.Object {\n\to.calls = append(o.calls, Call{\"New\", []interface{}{args}})\n\treturn o\n}", "title": "" }, { "docid": "30ccce2ce31fab2581600b91464acf9b", "score": "0.44595733", "text": "func NewInlineLinkAttributes(text interface{}, otherAttrs []interface{}) (ElementAttributes, error) {\n\tresult := ElementAttributes{}\n\tvar textStr string\n\tif text, ok := text.(string); ok {\n\t\ttextStr = apply(text, strings.TrimSpace)\n\t}\n\tresult[AttrInlineLinkText] = textStr\n\tfor _, otherAttr := range otherAttrs {\n\t\tif otherAttr, ok := otherAttr.(ElementAttributes); ok {\n\t\t\tfor k, v := range otherAttr {\n\t\t\t\tresult[k] = v\n\t\t\t}\n\t\t}\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "b8cf325bde3e71fd2d32cb3eec456899", "score": "0.44490662", "text": "func NewInlineObject47WithDefaults() *InlineObject47 {\n\tthis := InlineObject47{}\n\treturn &this\n}", "title": "" }, { "docid": "f15422b57ec61854dd3656b86a123e71", "score": "0.44395912", "text": "func Inline(object ObjectMarshaller) Field {\n\treturn Field(zap.Inline(object))\n}", "title": "" }, { "docid": "6e81d79b9a70b11dd7f0abda7c42b7bb", "score": "0.4395324", "text": "func newObject(obj C.jobject) *Object {\n\treturn &Object{obj}\n}", "title": "" }, { "docid": "19d9c2bd01503a75d2b0645e6b3ef1d9", "score": "0.4372148", "text": "func NewLineI(args ...interface{}) *Line {\n return &Line{js.Global.Get(\"Phaser\").Get(\"Line\").New(args)}\n}", "title": "" }, { "docid": "55004dc379e9d63e46f619dac4ca1bd1", "score": "0.43587348", "text": "func main() {\n\t//vert := vertex{1.0, 2.0}\n\t//smiles := smile{3.5}\n\n\t//mainChar := gameCharacter {\n\t//\tvertex:vert,\n\t//\tlife : 10,\n\t//\tsmile:smiles}\n\n\tmainChar := gameCharacter{\n\t\tvertex:vertex{1.0, 2.0},\n\t\tlife: 10,\n\t\tsmile:smile{3.5},\n}\n\t//fmt.Println(vert, mainChar)\n\tfmt.Println(mainChar)\n\n\n\n\n\n\n\t/*\n\ttype smile struct {\n\t\tx float64\n\t}\n\n\ttype vertex struct {\n\t\tx, y float64\n\t}\n\n\ttype gameCharacter struct{\n\t\tvertex\n\t\tlife int\n\t\tsmile\n\t}\n\n\tfunc main() {\n\t\tvert := vertex{1.0, 2.0}\n\t\tvar mainChar gameCharacter\n\t\tmainChar.life = 10\n\t\tmainChar.vertex.x = 1.0\n\t\tmainChar.vertex.y = 2.0\n\t\tmainChar.smile.x = 9.0\n\t\tfmt.Println(vert, mainChar)\n\n\t*/\n}", "title": "" }, { "docid": "7795e73869d59f0a24b522abceeaacd2", "score": "0.4352046", "text": "func New(v interface{}) Builder {\n\treturn Builder{v}\n}", "title": "" }, { "docid": "dc879b5f2d73c05f4552579b3f067064", "score": "0.4339417", "text": "func NewPhysicsNinjaTileI(args ...interface{}) *PhysicsNinjaTile {\n return &PhysicsNinjaTile{js.Global.Get(\"Phaser\").Get(\"Physics\").Get(\"Ninja\").Get(\"Tile\").New(args)}\n}", "title": "" }, { "docid": "7897e73be6ca2b5a6900790eb0391877", "score": "0.43201765", "text": "func InitObject(name string, vertices entity.Vertices, triangles []entity.Triangle, normals []utils.Vector, color []float64, specularDecay, ambientReflection, diffuseReflection, specularReflection, transReflection, roughNess float64) Object {\n\tobj := Object{Name: name, Vertices: vertices, Triangles: triangles, Normals: normals, Color: color, SpecularDecay: specularDecay, AmbientReflection: ambientReflection, DiffuseReflection: diffuseReflection, SpecularReflection: specularReflection, TransReflection: transReflection, RoughNess: roughNess}\n\tobj.CheckIntegrity()\n\treturn obj\n}", "title": "" }, { "docid": "0be6a5a86bc436c2f6b7e76fadd8087b", "score": "0.43120405", "text": "func (p PageBlockVoiceNote) construct() PageBlockClass { return &p }", "title": "" }, { "docid": "9529fb11b03f1e39cb64001f21d419a0", "score": "0.43112475", "text": "func (o InlineObject1089) MarshalJSON() ([]byte, error) {\n\ttoSerialize := map[string]interface{}{}\n\tif o.LookupValue == nil {\n\t\tif o.isExplicitNullLookupValue {\n\t\t\ttoSerialize[\"lookupValue\"] = o.LookupValue\n\t\t}\n\t} else {\n\t\ttoSerialize[\"lookupValue\"] = o.LookupValue\n\t}\n\tif o.TableArray == nil {\n\t\tif o.isExplicitNullTableArray {\n\t\t\ttoSerialize[\"tableArray\"] = o.TableArray\n\t\t}\n\t} else {\n\t\ttoSerialize[\"tableArray\"] = o.TableArray\n\t}\n\tif o.ColIndexNum == nil {\n\t\tif o.isExplicitNullColIndexNum {\n\t\t\ttoSerialize[\"colIndexNum\"] = o.ColIndexNum\n\t\t}\n\t} else {\n\t\ttoSerialize[\"colIndexNum\"] = o.ColIndexNum\n\t}\n\tif o.RangeLookup == nil {\n\t\tif o.isExplicitNullRangeLookup {\n\t\t\ttoSerialize[\"rangeLookup\"] = o.RangeLookup\n\t\t}\n\t} else {\n\t\ttoSerialize[\"rangeLookup\"] = o.RangeLookup\n\t}\n\treturn json.Marshal(toSerialize)\n}", "title": "" }, { "docid": "8a08b537e6ab8d0c7897e804ad975051", "score": "0.42990336", "text": "func New(testObj testing.TB) TB {\n\treturn &tb{tb: testObj}\n}", "title": "" }, { "docid": "022486908a390e566d5d5167a0c213f3", "score": "0.4290425", "text": "func NewArguments() *Arguments {\n return &Arguments{\n Headers: http.Header{},\n }\n}", "title": "" }, { "docid": "373c43c46f753d4a262bc807e1f99689", "score": "0.4289163", "text": "func ObjectBuildWithCapacity(capacity int) *ObjectBuilder {\n\treturn &ObjectBuilder{ValueMapBuilder{output: make(map[string]Value, capacity)}}\n}", "title": "" }, { "docid": "3c831eb97a53c91e9f600bcd96ee908b", "score": "0.42824173", "text": "func New(config *conf.Configuration) Objecter {\n\tobjs := &Objects{objs: make(map[string]TextObjecter)}\n\tobjs.loadDefaults()\n\treturn objs\n}", "title": "" }, { "docid": "8ae3b0d544b341d2ee1be579d1d06e31", "score": "0.4277061", "text": "func (x *fastReflection_BIP44Params) New() protoreflect.Message {\n\treturn new(fastReflection_BIP44Params)\n}", "title": "" }, { "docid": "e02e82175d8e4a5762b7adc14594a22a", "score": "0.4271561", "text": "func New9() *Board { return New(9) }", "title": "" }, { "docid": "b51694edb6b15d8886c3edee8a59c2dd", "score": "0.4260891", "text": "func (d DocumentAttributeVideo66) construct() DocumentAttributeClass { return &d }", "title": "" }, { "docid": "937935f3d19b7bc6a7ea2f44c2ba1d15", "score": "0.42580488", "text": "func NewObject(scene *Scene, e *Element) *Object {\n\to := &Object{\n\t\tscene: scene,\n\t\telement: e,\n\t}\n\tif prop := e.getProperty(1); prop != nil {\n\t\to.name = prop.value.String()\n\t}\n\treturn o\n}", "title": "" }, { "docid": "3817f9a72516863e0f1ec3f9306c7ef1", "score": "0.42374676", "text": "func Sqlitetest9_Init(tls *libc.TLS, interp uintptr) int32 { /* test9.c:188:5: */\n\tvar i int32\n\tfor i = 0; uint64(i) < (uint64(unsafe.Sizeof(aObjCmd3)) / uint64(unsafe.Sizeof(struct {\n\t\tFzName uintptr\n\t\tFxProc uintptr\n\t\tFclientData uintptr\n\t}{}))); i++ {\n\t\ttcl.XTcl_CreateObjCommand(tls, interp, aObjCmd3[i].FzName,\n\t\t\taObjCmd3[i].FxProc, aObjCmd3[i].FclientData, uintptr(0))\n\t}\n\treturn TCL_OK\n}", "title": "" }, { "docid": "6fcf11f26dd7d9ca0ef11e7c9d8c4174", "score": "0.42339075", "text": "func New(mimetype string, data []byte) *Object {\n\tsum := md5.New()\n\tsum.Write(data)\n\toid := objectid.New(sum)\n\n\tmd := metadata.New(int64(len(data)), mimetype, oid)\n\treturn &Object{\n\t\tMetadata: *md,\n\t\tData: data,\n\t}\n}", "title": "" }, { "docid": "30d0ba0b418f554b787b3e7a6d30beb3", "score": "0.42333058", "text": "func newJobConfigObject(\n\tid *peloton.JobID,\n\tversion uint64,\n\tconfig *job.JobConfig,\n\tconfigAddOn *models.ConfigAddOn,\n\tspec *stateless.JobSpec,\n) (*JobConfigObject, error) {\n\tvar specBuffer, configBuffer []byte\n\tvar err error\n\n\tobj := &JobConfigObject{\n\t\tJobID: id.GetValue(),\n\t\tApiVersion: common.V0Api,\n\t}\n\n\tconfigBuffer, err = proto.Marshal(config)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Failed to marshal jobConfig\")\n\t}\n\n\tconfigBuffer, err = compress(configBuffer)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Failed to compress jobConfig\")\n\t}\n\n\tif spec != nil {\n\t\tspecBuffer, err = proto.Marshal(spec)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"Failed to marshal jobSpec\")\n\t\t}\n\t\tspecBuffer, err = compress(specBuffer)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"Failed to compress jobSpec\")\n\t\t}\n\t\tobj.Spec = specBuffer\n\t\tobj.ApiVersion = common.V1AlphaApi\n\t}\n\n\taddOnBuffer, err := proto.Marshal(configAddOn)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Failed to marshal configAddOn\")\n\t}\n\tobj.Version = version\n\tobj.Config = configBuffer\n\tobj.ConfigAddOn = addOnBuffer\n\tobj.CreationTime = time.Now().UTC()\n\treturn obj, nil\n}", "title": "" }, { "docid": "a14615ba651feba406f7a81996982e35", "score": "0.4226334", "text": "func New(a, b complex128, isNormalized bool) Qubit {\n return NewWith(ket.New(a, b, isNormalized))\n}", "title": "" }, { "docid": "73fc4c65ccb8f5fc34044c70b81bcd00", "score": "0.4224523", "text": "func NewVertex(label string, properties ...interface{}) Vertex {\n\tvar v = Vertex{\n\t\tType: \"g:Vertex\",\n\t\tValue: VertexValue{\n\t\t\tProperties: make(PropertyMap),\n\t\t\tLabel: label,\n\t\t},\n\t}\n\n\tif len(properties)%2 != 0 {\n\t\treturn v\n\t}\n\n\tfor i := 0; i < len(properties); i += 2 {\n\t\tv.Value.Properties[properties[i].(string)] = []Property{\n\t\t\tNewProperty(properties[i].(string), properties[i+1]),\n\t\t}\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "b422ce4503e904481c6eca64c2377ba9", "score": "0.4213027", "text": "func (p PageBlockEmbedded) construct() PageBlockClass { return &p }", "title": "" }, { "docid": "8d9281143b3def0744d1db6e3a56536a", "score": "0.41844514", "text": "func (o InlineObject886) MarshalJSON() ([]byte, error) {\n\ttoSerialize := map[string]interface{}{}\n\tif o.Probability == nil {\n\t\tif o.isExplicitNullProbability {\n\t\t\ttoSerialize[\"probability\"] = o.Probability\n\t\t}\n\t} else {\n\t\ttoSerialize[\"probability\"] = o.Probability\n\t}\n\tif o.Alpha == nil {\n\t\tif o.isExplicitNullAlpha {\n\t\t\ttoSerialize[\"alpha\"] = o.Alpha\n\t\t}\n\t} else {\n\t\ttoSerialize[\"alpha\"] = o.Alpha\n\t}\n\tif o.Beta == nil {\n\t\tif o.isExplicitNullBeta {\n\t\t\ttoSerialize[\"beta\"] = o.Beta\n\t\t}\n\t} else {\n\t\ttoSerialize[\"beta\"] = o.Beta\n\t}\n\treturn json.Marshal(toSerialize)\n}", "title": "" }, { "docid": "acf60c7ede69b74b724fa65dcfb19ffe", "score": "0.41822216", "text": "func newConfigV10() *configV10 {\n\tcfg := new(configV10)\n\tcfg.Version = globalMCConfigVersion\n\tcfg.Aliases = make(map[string]aliasConfigV10)\n\treturn cfg\n}", "title": "" }, { "docid": "056ff6709879b7c024dbcd4f27f10c26", "score": "0.41681644", "text": "func NewPreviewPostRequestBody()(*PreviewPostRequestBody) {\n m := &PreviewPostRequestBody{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "title": "" }, { "docid": "2f27078105d639b16e2537dd4dcb3b46", "score": "0.41655454", "text": "func newFoo(bar *barv1alpha1.Bar) *samplev1alpha1.Foo {\n\treturn &samplev1alpha1.Foo{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: bar.Spec.FooName,\n\t\t\tNamespace: bar.Namespace,\n\t\t\tOwnerReferences: []metav1.OwnerReference{\n\t\t\t\t*metav1.NewControllerRef(bar, barv1alpha1.SchemeGroupVersion.WithKind(\"Bar\")),\n\t\t\t},\n\t\t},\n\t\tSpec: samplev1alpha1.FooSpec{\n\t\t\tDeploymentName: bar.Spec.FooName,\n\t\t\tReplicas: bar.Spec.Replicas,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "31bbf0b1a4183ecff268030f593ab07a", "score": "0.41608983", "text": "func main() {\n\tvar x Football\n\t// fb := Football{Ball{Radius: 5, Material: \"leather\"}}\n\n\tx.Radius = 1\n\tx.Material = \"MaterialX\"\n\tfmt.Println(x)\n\n\tx.Ball.Radius = 2\n\tx.Ball.Material = \"MaterialY\"\n\tfmt.Println(x)\n}", "title": "" }, { "docid": "6cefcf397f339a2fcb128a4c3503e49c", "score": "0.41574153", "text": "func newJSONBody(v interface{}) jsonBody {\n\td, err := json.Marshal(v)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn jsonBody{bytes.NewReader(d)}\n}", "title": "" }, { "docid": "c8806efcf653af7d52deac72b6b87acf", "score": "0.41573375", "text": "func newEntry() entry {\n\tvar b []byte\n\treturn entry{\n\t\tPrincipal: newPrincipal(),\n\t\tTimestamp: time.Time{},\n\t\tKVNO8: 0,\n\t\tKey: types.EncryptionKey{\n\t\t\tKeyType: 0,\n\t\t\tKeyValue: b,\n\t\t},\n\t\tKVNO: 0,\n\t}\n}", "title": "" }, { "docid": "51238928ddbe23c195c77ce4557a4b9e", "score": "0.41502714", "text": "func newStorageObjectPrefix(bucket *storage.BucketHandle,\n\tname, prefix string, attrs *storage.ObjectAttrs) *storageObjectPrefix {\n\tpre := &storageObjectPrefix{\n\t\tEntryBase: plugin.NewEntry(name),\n\t\tbucket: bucket,\n\t\tprefix: prefix,\n\t}\n\tif attrs != nil {\n\t\tpre.SetPartialMetadata(attrs).\n\t\t\tAttributes().\n\t\t\tSetCrtime(attrs.Created).\n\t\t\tSetCtime(attrs.Updated).\n\t\t\tSetMtime(attrs.Updated).\n\t\t\tSetSize(uint64(attrs.Size))\n\t}\n\treturn pre\n}", "title": "" }, { "docid": "b5f34b40f3318b3b3028bfa5d3050502", "score": "0.41487333", "text": "func New(args interface{}) Ms {\n\treturn Ms{args}\n}", "title": "" }, { "docid": "bfc788ff85282c10d725ff2cb574aa5c", "score": "0.4144922", "text": "func (target *QueueMemberAttrs) Init(source map[string]interface{}) {\n}", "title": "" }, { "docid": "59325c9d55d23dad28865f19990ded3b", "score": "0.41448447", "text": "func (s *InstantiateREST) New() runtime.Object {\n\treturn &buildapi.BuildRequest{}\n}", "title": "" }, { "docid": "32b996027576087e0cb3a01965faa880", "score": "0.41412288", "text": "func (self *Input) SetPointer9A(member *Pointer) {\n self.Object.Set(\"pointer9\", member)\n}", "title": "" }, { "docid": "9f81009ae2bd74dc14005a94e4154043", "score": "0.4136885", "text": "func (Easy) New(obj interface{}) (err error) {\n\tctx, cancel := context.WithTimeout(context.Background(), txnTimeout)\n\tdefer cancel()\n\ttxn := ndgo.NewTxn(ctx, dg.NewTxn())\n\tdefer txn.Discard()\n\n\terr = Simple{}.New(txn, obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn txn.Commit()\n}", "title": "" }, { "docid": "2d5ea502f5d075953cb94071d051b0f2", "score": "0.41352472", "text": "func (api *Api) NewCommand(name string, parameters map[string]string, mapping interface{}) (*ApiCommand) {\n\n\tcommand := api.offset(name)\n\trequestUrl, parameters := api.url(&command, parameters)\n\n\tdata := &url.Values{}\n\n\tfor name, parameter := range parameters {\n\t\tdata.Set(name, parameter)\n\t}\n\n\treq, err := http.NewRequest(command.Method, requestUrl, bytes.NewBufferString(data.Encode()))\n\n\tif err != nil {\n\t\tlog.Panicf(\"Bad request\", err.Error())\n\t}\n\n\treturn &ApiCommand{\n\t\tname,\n\t\tparameters,\n\t\tmapping,\n\t\tapi,\n\t\tcommand,\n\t\treq,\n\t\t&http.Response{},\n\t}\n}", "title": "" }, { "docid": "c53024641b86f137cffcb9b12b180934", "score": "0.413289", "text": "func (p PageBlockEmbeddedPost) construct() PageBlockClass { return &p }", "title": "" }, { "docid": "7fb02d4f20160ea37cf5f893b7dd9d05", "score": "0.41283438", "text": "func NewInliningBase(old *PosBase, inlTreeIndex int) *PosBase {\n\tif old == nil {\n\t\tbase := &PosBase{line: 1, col: 1, inl: inlTreeIndex}\n\t\tbase.pos = MakePos(base, 1, 1)\n\t\treturn base\n\t}\n\tcopy := *old\n\tbase := &copy\n\tbase.inl = inlTreeIndex\n\tif old == old.pos.base {\n\t\tbase.pos.base = base\n\t}\n\treturn base\n}", "title": "" }, { "docid": "2fa45f92b874ba2ffd8f7c7292060ae9", "score": "0.41217226", "text": "func NewObject(iface *api.IADs) *Object {\n\tcomshim.Add(1)\n\treturn &Object{object{iface: iface}}\n}", "title": "" }, { "docid": "279d9b4a41399068bb06610ad0ff81c2", "score": "0.4119884", "text": "func New(id, name string, fifo bool, i Initium) *Builder {\n\treturn &Builder{\n\t\tx: i.convert(id, name, fifo, nil),\n\t}\n}", "title": "" }, { "docid": "bc7d3d1939b016f788afaa77fb9c4ba0", "score": "0.41157463", "text": "func definitionObj(bytes []byte) (*apiObject, error) {\n\tobj := apiObject{bytes: bytes}\n\treturn &obj, yaml.Unmarshal(bytes, &obj)\n}", "title": "" }, { "docid": "81f1fcd59b8a54e8a03e86d807ed64bd", "score": "0.40981215", "text": "func (p PageBlockEmbed) construct() PageBlockClass { return &p }", "title": "" }, { "docid": "2e7d5176dbff7e4767c2bdb25ce9a274", "score": "0.4095017", "text": "func constructJobWithCustomAttributes(companyName string, jobTitle string) *talent.Job {\n\t// requisitionID shoud be the unique ID in your system\n\trequisitionID := fmt.Sprintf(\"job-with-custom-attribute-%d\", time.Now().UnixNano())\n\n\tjob := &talent.Job{\n\t\tRequisitionId: requisitionID,\n\t\tTitle: jobTitle,\n\t\tCompanyName: companyName,\n\t\tApplicationInfo: &talent.ApplicationInfo{\n\t\t\tUris: []string{\"https://googlesample.com/career\"},\n\t\t},\n\t\tDescription: \"Design, devolop, test, deploy, maintain and improve software.\",\n\t\tCustomAttributes: map[string]talent.CustomAttribute{\n\t\t\t\"someFieldString\": {\n\t\t\t\tFilterable: true,\n\t\t\t\tStringValues: []string{\"someStrVal\"},\n\t\t\t},\n\t\t\t\"someFieldLong\": {\n\t\t\t\tFilterable: true,\n\t\t\t\tLongValues: []int64{900},\n\t\t\t},\n\t\t},\n\t}\n\treturn job\n}", "title": "" }, { "docid": "a27adaba1dc05cdf84d9de2d3fb5bcdd", "score": "0.40839124", "text": "func (p PageBlockUnsupported) construct() PageBlockClass { return &p }", "title": "" }, { "docid": "49da0374079b5f864ccccbb072e9e5a1", "score": "0.40819505", "text": "func New() (newObject JSON) {\n\tm := make(map[string]interface{})\n\tnewObject.jmap = m\n\treturn newObject\n}", "title": "" }, { "docid": "370766861ca9fb7a8ff6d2ae0b1d9d46", "score": "0.40652195", "text": "func (m *MockHostServiceIface) NewEnableOutOfBandManagementForHostParams(hostid string) *EnableOutOfBandManagementForHostParams {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NewEnableOutOfBandManagementForHostParams\", hostid)\n\tret0, _ := ret[0].(*EnableOutOfBandManagementForHostParams)\n\treturn ret0\n}", "title": "" }, { "docid": "a733a5e017b719e66ed5dad1dba1340d", "score": "0.4063147", "text": "func NewCreateI(args ...interface{}) *Create {\n return &Create{js.Global.Get(\"Phaser\").Get(\"Create\").New(args)}\n}", "title": "" }, { "docid": "c95f38545959bcc9a11030c4ab9528ca", "score": "0.40558976", "text": "func NewLine3O(x1 int, y1 int, x2 int) *Line {\n return &Line{js.Global.Get(\"Phaser\").Get(\"Line\").New(x1, y1, x2)}\n}", "title": "" }, { "docid": "deeb3f08b1ebaa0c5178c5e808d0823f", "score": "0.40534517", "text": "func createDefaultObject() IConfig {\n\treturn &protoObject{\n\t\tparam: \"default\",\n\t}\n}", "title": "" }, { "docid": "3498dfc4c9105a19b4f732a722059b98", "score": "0.4052537", "text": "func (s *CloneREST) New() runtime.Object {\n\treturn &buildapi.BuildRequest{}\n}", "title": "" }, { "docid": "6aeff2d8dd1a4470bdd718d973b203b3", "score": "0.40524772", "text": "func (s *SimpleChaincode) Init(APIstub shim.ChaincodeStubInterface) sc.Response {\n\t_, args := APIstub.GetFunctionAndParameters()\n if len(args) != 5 {\n return shim.Error(\"Incorrect number of arguments. Expecting 6\")\n }\n loc, _ := time.LoadLocation(\"America/Los_Angeles\")\n current_time := time.Now().In(loc)\n currTime := current_time.Format(\"2006-01-02 15:04:05\")\n amount, err := strconv.Atoi(args[3])\n if err != nil {\n return shim.Error(\"3r argument must be a numeric string\")\n }\n\n var car = Trade{TradeId: args[0], FromParty: args[1], ToParty: args[2], Amount: amount, Status: args[4], Ctime: currTime}\n\n carAsBytes, _ := json.Marshal(car)\n APIstub.PutState(args[0], carAsBytes)\n\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "5eed57173e63ce7fbbb9524b33ec82b1", "score": "0.4049872", "text": "func newOptions(parent *options) *options {\n\topts := &options{\n\t\tinherited: inherited{\n\t\t\tfocusedColor: cell.ColorYellow,\n\t\t},\n\t\thAlign: align.HorizontalCenter,\n\t\tvAlign: align.VerticalMiddle,\n\t\tsplitPercent: DefaultSplitPercent,\n\t}\n\tif parent != nil {\n\t\topts.inherited = parent.inherited\n\t}\n\treturn opts\n}", "title": "" }, { "docid": "b3dcf171d9c0edad2e50d109a8a00157", "score": "0.40428805", "text": "func (i InputInvoiceSlug) construct() InputInvoiceClass { return &i }", "title": "" }, { "docid": "652eb9fd6822723af4809b49bb78d199", "score": "0.404158", "text": "func (p *jsonNode) New(attr string) outputNode {\n\treturn &jsonNode{make(map[string]interface{})}\n}", "title": "" } ]
a50f873d491067b63fba76bd7d8f85c1
GenConnId generates ConnectionId by concat local and remote address, so the ConnectionId is unique for each active connection. UUID is better for unique but is much worse for selfdescribing
[ { "docid": "e353484f0449051481f990db48b076dd", "score": "0.8217087", "text": "func GenConnId(goraConn *goraws.Conn) ConnectionId {\n\tif goraConn == nil {\n\t\treturn ConnectionId(fmt.Sprintf(\"[ws|nil]\"))\n\t}\n\tlocalAddr := goraConn.LocalAddr().String()\n\tcolon := strings.Index(localAddr, \":\")\n\tif colon != -1 {\n\t\t// localAddr is only \"port\" instead of \"ip:port\"\n\t\tlocalAddr = localAddr[colon:]\n\t}\n\treturn ConnectionId(fmt.Sprintf(\"[ws|%v|%v]\",\n\t\tlocalAddr, goraConn.RemoteAddr()))\n}", "title": "" } ]
[ { "docid": "5ffb64b6ee166fee9a49d2298a709da6", "score": "0.6830123", "text": "func GenConnectionAddrStr(prefix string, ip net.IP, port int) string {\n\tif ip.To4() != nil {\n\t\treturn fmt.Sprintf(\"%v%v:%v\", prefix, ip, port)\n\t}\n\treturn fmt.Sprintf(\"%v[%v]:%v\", prefix, ip, port)\n}", "title": "" }, { "docid": "b40570a63028cdaf08d7c0c62329915f", "score": "0.65005106", "text": "func (s *Socket) newConnID(remoteAddr resolvedAddrStr) (id uint16) {\n\t// Rather than use math.Rand, which requires generating all the IDs up\n\t// front and allocating a slice, we do it on the stack, generating the IDs\n\t// only as required. To do this, we use the fact that the array is\n\t// default-initialized. IDs that are 0, are actually their index in the\n\t// array. IDs that are non-zero, are +1 from their intended ID.\n\tvar idsBack [0x10000]int\n\tids := idsBack[:]\n\tfor len(ids) != 0 {\n\t\t// Pick the next ID from the untried ids.\n\t\ti := rand.Intn(len(ids))\n\t\tid = uint16(ids[i])\n\t\t// If it's zero, then treat it as though the index i was the ID.\n\t\t// Otherwise the value we get is the ID+1.\n\t\tif id == 0 {\n\t\t\tid = uint16(i)\n\t\t} else {\n\t\t\tid--\n\t\t}\n\t\t// Check there's no connection using this ID for its recv_id...\n\t\t_, ok1 := s.conns[connKey{remoteAddr, id}]\n\t\t// and if we're connecting to our own Socket, that there isn't a Conn\n\t\t// already receiving on what will correspond to our send_id. Note that\n\t\t// we just assume that we could be connecting to our own Socket. This\n\t\t// will halve the available connection IDs to each distinct remote\n\t\t// address. Presumably that's ~0x8000, down from ~0x10000.\n\t\t_, ok2 := s.conns[connKey{remoteAddr, id + 1}]\n\t\t_, ok4 := s.conns[connKey{remoteAddr, id - 1}]\n\t\tif !ok1 && !ok2 && !ok4 {\n\t\t\treturn\n\t\t}\n\t\t// The set of possible IDs is shrinking. The highest one will be lost, so\n\t\t// it's moved to the location of the one we just tried.\n\t\tids[i] = len(ids) // Conveniently already +1.\n\t\t// And shrink.\n\t\tids = ids[:len(ids)-1]\n\t}\n\treturn\n}", "title": "" }, { "docid": "6c1d2f0e990440b7a7e599ce3c08b9c7", "score": "0.6430566", "text": "func NewConnectionID(ip net.IP, now time.Time, key string) []byte {\n\tbuf := make([]byte, 8)\n\tbinary.BigEndian.PutUint32(buf, uint32(now.Unix()))\n\n\tmac := hmac.New(sha256.New, []byte(key))\n\tmac.Write(buf[:4])\n\tmac.Write(ip)\n\tmacBytes := mac.Sum(nil)[:4]\n\tcopy(buf[4:], macBytes)\n\n\treturn buf\n}", "title": "" }, { "docid": "f28c8dbeb9042b653e329a1825b16890", "score": "0.63217217", "text": "func generateChatId(db *sql.DB) uuid.UUID {\n\tuniqueId, _ := uuid.NewUUID()\n\tfor uuidExists(db, uniqueId) {\n\t\tuniqueId, _ = uuid.NewUUID()\n\t}\n\n\treturn uniqueId\n}", "title": "" }, { "docid": "8af24887830767ef2f3184d32bfb836f", "score": "0.6222652", "text": "func (holder *SockUIDHolder) CreateConnUID(conn net.Conn) string {\n\tuid, ok := holder.socket2uid[conn]\n\tif !ok {\n\t\tt := time.Now().UTC()\n\t\tentropy := rand.New(rand.NewSource(t.UnixNano()))\n\t\tid := ulid.MustNew(ulid.Timestamp(t), entropy)\n\t\tuid = fmt.Sprintf(\"%s-{%s}\", conn.RemoteAddr(), id)\n\t\tholder.SetConnUID(conn, uid)\n\t}\n\treturn uid\n}", "title": "" }, { "docid": "5be1b64d2db56f8d9dbf5f2c04f0e471", "score": "0.601156", "text": "func (ConnectionID) String() string { return \"connection_id()\" }", "title": "" }, { "docid": "e73969301b17be5ccac44c3d3e71da1c", "score": "0.5922876", "text": "func genNodeId() string {\n\tnodeId, err := exec.Command(\"uuidgen\").Output()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn string(nodeId)\n}", "title": "" }, { "docid": "8819cdd11b36a6a47016d0daed0d5fb2", "score": "0.58678854", "text": "func (c *Coordinator) genID() (string, error) {\n\tid, err := uuid.NewRandom()\n\treturn id.String(), err\n}", "title": "" }, { "docid": "b3578fd88117b024d6f7f992147e811a", "score": "0.5866713", "text": "func GenAddr(id uint) string{\n\t// algorithm is simple, we using 2-9 + a-z + A-Z as 60 decimal\n\t// 8 length Address\n\t// 23 -> usr8fugkitU\n\tresultStr := \"\"\n\tfor id / 60 > 0{\n\t\ttmpMod := id % 60\n\t\tresultStr += allChars[tmpMod]\n\t\tid /= 60\n\t}\n\tresultStr += randomStr(10 - len(resultStr))\n\treturn resultStr\n}", "title": "" }, { "docid": "5e5eb22fb58b34789327125fc34aa697", "score": "0.58523893", "text": "func (g *GlobalAllocator) NextID() uint64 {\n\tglobalConnID := g.Allocate()\n\treturn globalConnID.ToConnID()\n}", "title": "" }, { "docid": "ea51435763e86b32b4c34507a4f86731", "score": "0.5794764", "text": "func GenSessionID(identity, protocol string) string {\n\treturn GenSessionIDOpt(identity, protocol, strconv.FormatUint(uint64(rand.Uint32()), 16))\n}", "title": "" }, { "docid": "5b9783767f2943f7e5772f94e126b04f", "score": "0.57779413", "text": "func (g *GCID) ToConnID() uint64 {\n\tvar id uint64\n\tif g.Is64bits {\n\t\tif g.LocalConnID > MaxLocalConnID64 {\n\t\t\tpanic(fmt.Sprintf(\"unexpected localConnID %d exceeds %d\", g.LocalConnID, MaxLocalConnID64))\n\t\t}\n\t\tif g.ServerID > MaxServerID64 {\n\t\t\tpanic(fmt.Sprintf(\"unexpected serverID %d exceeds %d\", g.ServerID, MaxServerID64))\n\t\t}\n\n\t\tid |= 0x1\n\t\tid |= g.LocalConnID << 1 // 40 bits local connID.\n\t\tid |= g.ServerID << 41 // 22 bits serverID.\n\t} else {\n\t\tif g.LocalConnID > MaxLocalConnID32 {\n\t\t\tpanic(fmt.Sprintf(\"unexpected localConnID %d exceeds %d\", g.LocalConnID, MaxLocalConnID32))\n\t\t}\n\t\tif g.ServerID > MaxServerID32 {\n\t\t\tpanic(fmt.Sprintf(\"unexpected serverID %d exceeds %d\", g.ServerID, MaxServerID32))\n\t\t}\n\n\t\tid |= g.LocalConnID << 1 // 20 bits local connID.\n\t\tid |= g.ServerID << 21 // 11 bits serverID.\n\t}\n\treturn id\n}", "title": "" }, { "docid": "d101d1e270c3aea11aa0bd342fde85f6", "score": "0.57731825", "text": "func (o ConnectionOutput) ConnectionId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Connection) pulumi.StringOutput { return v.ConnectionId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a89b3cf929b631ef61b37f0298f19f72", "score": "0.5749609", "text": "func (nc *NexusConn) Id() string {\n\treturn nc.connId\n}", "title": "" }, { "docid": "9bcc28616737ce58daae33b77f318bd2", "score": "0.5724672", "text": "func AllocateId() (ConnId, chan Message) {\n a := <-cidCh\n router.Lock()\n router.m[a.cid] = a.ch\n router.Unlock()\n return a.cid,a.ch\n}", "title": "" }, { "docid": "1b09c2799469236e4f617db16fff8237", "score": "0.5690954", "text": "func generateID() (id string, err error) {\n\tb := new(bytes.Buffer)\n\n\t// hostname\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tb.Write([]byte(hostname)) //Lookup IP instead?\n\n\t// time\n\tnow := time.Now()\n\tnowAsGob, err := now.GobEncode()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tb.Write(nowAsGob)\n\n\t// random bits\n\trb := make([]byte, randbits/8)\n\tn, err := io.ReadFull(rand.Reader, rb)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif n != len(rb) {\n\t\treturn \"\", errors.New(\"random bits length mismatch\")\n\t}\n\tb.Write(rb)\n\n\thasher := sha1.New()\n\thasher.Write(b.Bytes())\n\tid = base64.StdEncoding.EncodeToString(hasher.Sum(nil))\n\n\treturn id, nil\n}", "title": "" }, { "docid": "69a060900f1672237e232efd552caa8e", "score": "0.56733644", "text": "func genMessageID(name string) string {\n return fmt.Sprintf(\"<%s%d@%s>\", randStr(5), timeNow(), name)\n}", "title": "" }, { "docid": "cee54106a93009611cbc242e92f4aa6a", "score": "0.5671064", "text": "func (c MQTTClient) genClientID() (string, error) {\n\tr, err := CRAND.Int(CRAND.Reader, new(big.Int).SetInt64(100000))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn \"client\" + r.String(), nil\n}", "title": "" }, { "docid": "4941b85a50a70884e8257a5e2778b8ff", "score": "0.56597966", "text": "func genId() string {\n now := time.Now()\n h := sha256.New()\n h.Write([]byte(now.Format(time.RFC3339Nano)))\n return hex.EncodeToString(h.Sum(nil))\n}", "title": "" }, { "docid": "8c395312afda9131ae31a5c39a37eec7", "score": "0.56593615", "text": "func (o ActionGroupItsmReceiverOutput) ConnectionId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ActionGroupItsmReceiver) string { return v.ConnectionId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "82b7af19baed6445999fc37d5b297a05", "score": "0.5657148", "text": "func (client *DiameterClientConfig) GenSessionID(protocol string) string {\n\treturn client.GenSessionIDOpt(protocol, strconv.FormatUint(uint64(rand.Uint32()), 16))\n}", "title": "" }, { "docid": "b036f2fc40bc4ed9713a2ba7c9aaa2dc", "score": "0.56445336", "text": "func setUniqueId(ch chan string, conn net.Conn) string {\n\n\tvar who string\n\tfor{\n\t\tretry := false\n\t\tch <- \"\\nPor favor, introduce un Nickname:\"\n\t\tscanner := bufio.NewScanner(conn)\n\t\tscanner.Scan()\n\t\twho= scanner.Text()\n\t\tfor cli := range clients{\n\t\t\tif(cli.id == who){\n\t\t\t\tch <- \"El nick [\" + who + \"] ya está ocupado, por favor elija otro...\"\n\t\t\t\tretry = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif(!retry){\n\t\t\tbreak\n\t\t}\n\t}\n\tch <- \"\\nTu nickname es \" + who\n\tmessages <- \"\\n\" + who + \" se ha conectado\"\n\treturn who\n\n}", "title": "" }, { "docid": "55bdd302921550ed24d99324d07a168f", "score": "0.5638452", "text": "func GenerateCommunityID(srcIP string, srcPort uint16, dstIP string, dstPort uint16, protocol uint8) string {\n\t// Convert IP address strings to net format\n\tsrcIPNet := net.ParseIP(srcIP)\n\tdstIPNet := net.ParseIP(dstIP)\n\n\t// Get instance for version 1, seed 0\n\tcid, _ := gommunityid.GetCommunityIDByVersion(1, 0)\n\n\t// Obtain flow tuple. This can be done any way you like.\n\tft := gommunityid.MakeFlowTuple(srcIPNet, dstIPNet, srcPort, dstPort, protocol)\n\n\t// Calculate Base64-encoded value\n\tcommunityid := cid.CalcBase64(ft)\n\n\treturn communityid\n}", "title": "" }, { "docid": "2564c906d2ae7b336f4fbc5750b84a9d", "score": "0.5631588", "text": "func testLocalConnID(seq int64) []byte {\n\tcid := make([]byte, connIDLen)\n\tcopy(cid, []byte{0xc0, 0xff, 0xee})\n\tcid[len(cid)-1] = byte(seq)\n\treturn cid\n}", "title": "" }, { "docid": "9bab22cbf51d2409448187b001b1feaf", "score": "0.5604167", "text": "func GenId() string {\n\treturn fmt.Sprintf(\"%04d\", gen.Get())\n}", "title": "" }, { "docid": "52b81c63cf993bc671d52fcb204cbc15", "score": "0.5555246", "text": "func (wm *websocketManager) getSocketId(ctx *Context) string {\n var buffer bytes.Buffer\n buffer.WriteString(ctx.Fields[\"username\"])\n buffer.WriteString(\"/\")\n buffer.WriteString(ctx.Fields[\"stationName\"])\n return base64.URLEncoding.EncodeToString(buffer.Bytes())\n}", "title": "" }, { "docid": "90ba57140c8a8d3965ace72fb2e939b9", "score": "0.5529278", "text": "func genMessageID(name string) string {\n\treturn fmt.Sprintf(\"<%s%d@%s>\", randStr(5), timeNow(), name)\n}", "title": "" }, { "docid": "7f87804b5416a00014662dfca2bfe9a0", "score": "0.55246377", "text": "func newClientID() string {\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\tip, err := getIP()\n\t\tif err != nil {\n\t\t\tbuffer := make([]byte, 8)\n\t\t\t_, _ = rand.Read(buffer)\n\t\t\thostname = fmt.Sprintf(\"%X\", buffer)\n\n\t\t} else {\n\t\t\thostname = ip.String()\n\t\t}\n\t}\n\ttimestamp := time.Now().UTC().Format(time.RFC3339)\n\t// sarama validation regexp for the client ID doesn't allow ':' characters\n\ttimestamp = strings.Replace(timestamp, \":\", \".\", -1)\n\treturn fmt.Sprintf(\"pixy_%s_%s_%d\", hostname, timestamp, os.Getpid())\n}", "title": "" }, { "docid": "7c4dc3d2c9734438d36f8109a1376fc6", "score": "0.55198646", "text": "func generateNewId(custom string) string {\n\thash := fmt.Sprintf(\"%s %s %n %n\", custom, time.Now(), rand.Uint32(), rand.Uint32())\n\tbuf := bytes.NewBuffer(nil)\n\tsum := md5.Sum([]byte(hash))\n\tencoder := base64.NewEncoder(base64.URLEncoding, buf)\n\tencoder.Write(sum[:])\n\tencoder.Close()\n\treturn buf.String()[:20]\n}", "title": "" }, { "docid": "39a30fb40394069d10892dc1e8fca2ef", "score": "0.5512746", "text": "func generatedIP() string {\n\tvar arr [4]int\n\tfor i := 0; i < 4; i++ {\n\t\trand.Seed(time.Now().UnixNano())\n\t\tarr[i] = rand.Intn(256)\n\t}\n\tid = fmt.Sprintf(\"http://%d.%d.%d.%d\", arr[0], arr[1], arr[2], arr[3])\n\treturn id\n}", "title": "" }, { "docid": "950218d2e299ba8a45cc1d2459b9c031", "score": "0.55072194", "text": "func (n *Network) generateClientID() ClientID {\n\tn.seq++\n\treturn n.seq\n}", "title": "" }, { "docid": "9760cfe3ce502a0323f59e99164f3389", "score": "0.55039805", "text": "func CtxConnID(ctx context.Context) string {\n\treturn ctx.Value(ConnIDKey).(string)\n}", "title": "" }, { "docid": "5bb5629b5d110a8a1be8462975bad453", "score": "0.5495644", "text": "func (conn *wsConn) NextID() uint64 {\n\treturn atomic.AddUint64(&conn.rID, 1)\n}", "title": "" }, { "docid": "0ea9f4328f1b91974f84b6f0a3681ba6", "score": "0.549279", "text": "func generateRequestID() string {\n\tcfg.LastRequest++\n\tSaveConfig()\n\tid := fmt.Sprintf(\"%s%d\", programName, cfg.LastRequest)\n\th := sha1.New()\n\tio.WriteString(h, id)\n\tid = fmt.Sprintf(\"%x\", h.Sum(nil))\n\treturn id\n}", "title": "" }, { "docid": "a5a1b78607aa47e79a082f8f446186af", "score": "0.546048", "text": "func GenAddr(ID, publicKey string) string {\n\tfHash := sha256.Sum256([]byte(publicKey))\n\tlHash := sha256.Sum256(fHash[:])\n\tstrHash := hex.EncodeToString(lHash[:])\n\treturn fmt.Sprintf(\"%s:%s\", ID, strHash)\n}", "title": "" }, { "docid": "0fbc25bb78687633753dbaebdc275379", "score": "0.54299957", "text": "func NewConnectionID() sql.Expression {\n\treturn ConnectionID{}\n}", "title": "" }, { "docid": "615efa523f043489d5d349fdd013b772", "score": "0.5428823", "text": "func generateURL(comicID int) string {\n\treturn fmt.Sprintf(baseXkcdURL, comicID)\n}", "title": "" }, { "docid": "f69e55e57ed75c7037b22161b2efb9bf", "score": "0.5423943", "text": "func (o GetActionGroupItsmReceiverOutput) ConnectionId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetActionGroupItsmReceiver) string { return v.ConnectionId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "fde3eb001fb57b32cfad24f98582ef62", "score": "0.54180336", "text": "func generateConnectionConfigFile(context *clusterd.Context, config *Config, pathRoot, keyringPath string) (string, error) {\n\t// public_bind_addr is set from the pod IP which can only be known at runtime, so set this\n\t// at config init int the Ceph config file.\n\t// See pkg/operator/ceph/cluster/mon/spec.go - makeMonDaemonContainer() comment notes for more\n\tprivateAddr := net.JoinHostPort(context.NetworkInfo.ClusterAddr, fmt.Sprintf(\"%d\", config.Port))\n\tsettings := map[string]string{\n\t\t\"public bind addr\": privateAddr,\n\t}\n\n\t// The user is \"mon.<mon-name>\" for mon config items\n\tclientUser := fmt.Sprintf(\"mon.%s\", config.Name)\n\n\treturn cephconfig.GenerateConfigFile(\n\t\tcontext,\n\t\tconfig.Cluster,\n\t\tpathRoot, clientUser, keyringPath,\n\t\tnil,\n\t\tsettings,\n\t)\n}", "title": "" }, { "docid": "73813592298c21631231778b24e7829e", "score": "0.5402016", "text": "func generateUniqueID() int {\n\tglobalID++\n\treturn globalID\n}", "title": "" }, { "docid": "1e60febfa31ed93e3fbdfff6693d3a98", "score": "0.5390384", "text": "func (this *Actions) generateUid(config *Config, hostname string) string{\n uuidNew := uuid.NewV5(uuid.NewV1(), hostname).String()\n uuid_path := config.Uuid.Path\n log.Info(\"The new uuid is : \" + uuidNew)\n file, error := os.OpenFile(uuid_path, os.O_RDWR|os.O_CREATE, 0622)\n if error != nil {\n log.Error(\"Open uuid file in \"+ uuid_path +\" failed.\" + error.Error())\n }\n _,err := file.WriteString(uuidNew)\n if err != nil {\n log.Error(\"Save uuid file in \"+ uuid_path +\" failed.\" + err.Error())\n }\n file.Close()\n return uuidNew\n}", "title": "" }, { "docid": "886bafa65e22373099b673562cf9f039", "score": "0.5377117", "text": "func GenerateCallID() string {\n\tlol := randomBytes(15)\n\tdigs := hex.EncodeToString(lol)\n\tuuid4 := digs[0:8] +\n\t\t\"-\" + digs[8:12] +\n\t\t\"-4\" + digs[12:15] +\n\t\t\"-a\" + digs[15:18] +\n\t\t\"-\" + digs[18:]\n\treturn uuid4\n}", "title": "" }, { "docid": "ab9e1766b91736bdf7e769d8bbcd8113", "score": "0.5373852", "text": "func generateMessageID() (string, error) {\n\tt := time.Now().UnixNano()\n\tpid := os.Getpid()\n\trint, err := rand.Int(rand.Reader, maxBigInt)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\th, err := os.Hostname()\n\t// If we can't get the hostname, we'll use localhost\n\tif err != nil {\n\t\th = \"localhost.localdomain\"\n\t}\n\tmsgid := fmt.Sprintf(\"<%d.%d.%d@%s>\", t, pid, rint, h)\n\treturn msgid, nil\n}", "title": "" }, { "docid": "ab9e1766b91736bdf7e769d8bbcd8113", "score": "0.5373852", "text": "func generateMessageID() (string, error) {\n\tt := time.Now().UnixNano()\n\tpid := os.Getpid()\n\trint, err := rand.Int(rand.Reader, maxBigInt)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\th, err := os.Hostname()\n\t// If we can't get the hostname, we'll use localhost\n\tif err != nil {\n\t\th = \"localhost.localdomain\"\n\t}\n\tmsgid := fmt.Sprintf(\"<%d.%d.%d@%s>\", t, pid, rint, h)\n\treturn msgid, nil\n}", "title": "" }, { "docid": "9a6adf545bb9d77b52a50df7145d9dec", "score": "0.5370403", "text": "func generateInfraID(base string, maxLen int) string {\n\tmaxBaseLen := maxLen - (randomLen + 1)\n\n\t// replace all characters that are not `alphanum` or `-` with `-`\n\tre := regexp.MustCompile(\"[^A-Za-z0-9-]\")\n\tbase = re.ReplaceAllString(base, \"-\")\n\n\t// replace all multiple dashes in a sequence with single one.\n\tre = regexp.MustCompile(`-{2,}`)\n\tbase = re.ReplaceAllString(base, \"-\")\n\n\t// truncate to maxBaseLen\n\tif len(base) > maxBaseLen {\n\t\tbase = base[:maxBaseLen]\n\t}\n\tbase = strings.TrimRight(base, \"-\")\n\n\t// add random chars to the end to randomize\n\treturn fmt.Sprintf(\"%s-%s\", base, utilrand.String(randomLen))\n}", "title": "" }, { "docid": "9c61eec68de8652abeb9e34a0d3bffde", "score": "0.53595924", "text": "func makeID(length int) string {\n\tid := \"\"\n\tpossible := \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\"\n\trand.Seed(time.Now().UnixNano())\n\n\tfor i := 0; i < length; i++ {\n\t\tid += string(possible[rand.Intn(len(possible)-1)])\n\t}\n\n\treturn id\n}", "title": "" }, { "docid": "cc9fd0088d163b875887e7201811b239", "score": "0.5350683", "text": "func getmsgID(clientIP string, port uint16) []byte {\n\tipArr := strings.Split(clientIP, \".\")\n\tipBytes := make([]byte, 5)\n\tfor i, s := range ipArr {\n\t\tval, _ := strconv.Atoi(s)\n\t\tbinary.LittleEndian.PutUint16(ipBytes[i:], uint16(val))\n\t}\n\tipBytes = ipBytes[0:4]\n\tportBytes := make([]byte, 2)\n\tbinary.LittleEndian.PutUint16(portBytes, port)\n\trandBytes := make([]byte, 2)\n\trand.Read(randBytes)\n\ttimeBytes := make([]byte, 8)\n\tbinary.LittleEndian.PutUint64(timeBytes, uint64(time.Now().UnixNano()))\n\tid := append(append(append(ipBytes, portBytes...), randBytes...), timeBytes...)\n\treturn id\n}", "title": "" }, { "docid": "708b497ebecbecd1578309ce3e036a5b", "score": "0.53370464", "text": "func (cc CCID) ConnID() uint32 {\n\treturn uint32(cc & 0x00000000FFFFFFFF)\n}", "title": "" }, { "docid": "c1b878db000320e7a07cc617e9f966f6", "score": "0.5336446", "text": "func generateCarveSessionID() string {\n\tid := ksuid.New()\n\treturn id.String()\n}", "title": "" }, { "docid": "d74c1aa00ada054a3a8813f936004f24", "score": "0.53246135", "text": "func dataSourceIBMVPNGatewayConnectionsID(d *schema.ResourceData) string {\n\treturn time.Now().UTC().String()\n}", "title": "" }, { "docid": "928b1e8df2b5abb8e93f92bfef13fc58", "score": "0.53244513", "text": "func genServerAddr(i int) string {\n\tsrv := \"localhost:\"\n\tsrv += strconv.Itoa(portList[i])\n\treturn srv\n}", "title": "" }, { "docid": "79069a857c9ca66626acaac8cb4dae93", "score": "0.53200036", "text": "func (server *Server) generateMessageID() string {\n\treturn fmt.Sprintf(\"%s-%s\", strconv.FormatInt(time.Now().UTC().UnixNano(), 10), strconv.FormatInt(rand.Int63(), 10))\n}", "title": "" }, { "docid": "3ea73446059514419e073d3b6b07d3c0", "score": "0.5310141", "text": "func NewUUIDClient(uuidServers ...string) UUIDClient {\n\tmaxIdle := time.Duration(120 * time.Second)\n\tmaxWait := time.Duration(time.Millisecond * 200)\n\tpool := network.NewMultiConnectionPool(network.Options{\n\t\tMaxActiveConnections: 1024,\n\t\tMaxIdleConnections: 1024,\n\t\tMaxIdleTime: &maxIdle,\n\t\tConnectionTimeout: time.Duration(1 * time.Second),\n\t\tReadTimeout: time.Duration(2 * time.Second),\n\t\tMaxWaitTime: &maxWait,\n\t})\n\n\tfor _, server := range uuidServers {\n\t\tpool.Register(tcp, server)\n\t}\n\n\treturn UUIDClient{\n\t\tpool: pool,\n\t\tservers: uuidServers,\n\t\tserverCount: len(uuidServers),\n\t}\n}", "title": "" }, { "docid": "917a04875f690e358e9fe7c88090e333", "score": "0.53017825", "text": "func GetUniqueID(instance fargo.Instance) string {\n\treturn instance.HostName + \"_\" + strconv.Itoa(instance.Port)\n}", "title": "" }, { "docid": "1aa264ef0fa6360f484f51beeff8deeb", "score": "0.5296989", "text": "func (c *Connection) setID(id ...string) {\n\tif len(id) == 1 {\n\t\tidElems := strings.Split(id[0], \"-\")\n\t\tl := 2\n\t\tif len(idElems) < 2 {\n\t\t\tl = len(idElems)\n\t\t}\n\t\tprefix := strings.Join(idElems[0:l], \"-\")\n\t\tbody := randx.String(6)\n\n\t\tc.ID = fmt.Sprintf(\"%s-%s\", prefix, body)\n\t} else {\n\t\tprefix := \"conn\"\n\t\tbody := rand.Int()\n\n\t\tif c.TX != nil {\n\t\t\tprefix = \"tx\"\n\t\t\tbody = c.TX.ID\n\t\t}\n\n\t\tc.ID = fmt.Sprintf(\"%s-%d\", prefix, body)\n\t}\n}", "title": "" }, { "docid": "770adb06af1e4701d6de7d6ed488c567", "score": "0.52962905", "text": "func NextGlobalID() string {\n\tval := atomic.AddUint64(&idCount, uint64(1))\n\treturn strconv.FormatUint(val, 36)\n}", "title": "" }, { "docid": "d79f24ed4a9ce6d23148f9d8ccec7258", "score": "0.5295106", "text": "func (pool *ConnectionPool) GetWithId() (net.Conn, int, string) {\n\t//rand.Seed(time.Now().Unix())\n\tconnectionId := rand.Intn(len(pool.list))\n\tpool.mutex.RLock()\n\tconnection := pool.list[connectionId]\n\tsession := pool.session[connectionId]\n\tpool.mutex.RUnlock()\n\treturn connection, connectionId, session\n}", "title": "" }, { "docid": "ef1db9c46d26395c7c44480271161aa0", "score": "0.52934986", "text": "func (rc *Client) GenGlobalID(ctx context.Context) (int64, error) {\n\tvar id int64\n\tstorage := rc.GetDomain().Store()\n\n\tctx = kv.WithInternalSourceType(ctx, kv.InternalTxnBR)\n\terr := kv.RunInNewTxn(\n\t\tctx,\n\t\tstorage,\n\t\ttrue,\n\t\tfunc(ctx context.Context, txn kv.Transaction) error {\n\t\t\tvar e error\n\t\t\tt := meta.NewMeta(txn)\n\t\t\tid, e = t.GenGlobalID()\n\t\t\treturn e\n\t\t})\n\n\treturn id, err\n}", "title": "" }, { "docid": "7da33c9ec1ed8635895261fc93bf36eb", "score": "0.52831274", "text": "func GenerateProjectID() string {\n\tuuid := uuidTool.NewV4()\n\tbuf := make([]byte, 32)\n\thex.Encode(buf[:], uuid[:])\n\treturn string(buf[:])\n}", "title": "" }, { "docid": "d0f5d289f48c8cb969768ca376fd1600", "score": "0.52817047", "text": "func (c *RedisConnect) GenRedisConnURL(component string) string {\n\tswitch c.Schema {\n\tcase RedisSentinelSchema:\n\t\treturn c.genRedisSentinelConnURL(component)\n\tcase RedisServerSchema:\n\t\treturn c.genRedisServerConnURL(component)\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "07e1ebcd8d41cce3b37a186fc88683c6", "score": "0.5276051", "text": "func generateRandomId() string {\n\ttimeInt := time.Now().Unix()\n\ttimeString := strconv.FormatInt(timeInt, 36)\n\trandomString := uniuri.NewLen(16)\n\treturn randomString + timeString\n}", "title": "" }, { "docid": "1a37bff3c2c1919eb4d6a32d3d44c219", "score": "0.52684", "text": "func generateMessageID(ctx context.Context) string {\n\tvar blob [20]byte\n\tif _, err := mathrand.Read(ctx, blob[:]); err != nil {\n\t\tpanic(err)\n\t}\n\treturn hex.EncodeToString(blob[:])\n}", "title": "" }, { "docid": "70635154a376f34af3939498083eab3e", "score": "0.52610964", "text": "func generateID() string {\n\th := md5.New()\n\tio.WriteString(h, time.Now().String())\n\tid := fmt.Sprintf(\"%x\", h.Sum(nil))\n\treturn id\n}", "title": "" }, { "docid": "022a14a6cceaaa13688ca1ed497ddcd4", "score": "0.52476144", "text": "func makeID(n int) (string, error) {\n\tconst letters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\"\n\tbytes, err := generateRandomBytes(n)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tfor i, b := range bytes {\n\t\tbytes[i] = letters[b%byte(len(letters))]\n\t}\n\treturn string(bytes), nil\n}", "title": "" }, { "docid": "15e8e251dd49b168f1165611212ff6c0", "score": "0.5247227", "text": "func generate_channel_id() (rand_num int64){\n\tdefer map_lock.Unlock()\n\trand_num = 0\n\tif len(network) == number_of_network_nodes {\n\t\tmap_lock.Lock()\n\t\t//cant generate a unique id\n\t\tlog.Println(\"GENERATE_RANDOM_CHANNEL:Failed to generate a random channel id that is not already in the network\")\n\t\treturn -1\n\t}\n\n\tlog.Println(\"GENERATE_RANDOM_CHANNEL:About to generate a random channel not already in network\")\n\tmap_lock.Lock()\n\tfor(true){\n\t\trand_num := rand.Intn(number_of_network_nodes)\n\t\t//If we generated a channel id that is not in use\n\t\t//, return True\n\t\tif val, ok := network[int64(rand_num)]; ok != true {\n\t\t\t_ = val\n\t\t\treturn int64(rand_num)\n\t\t}\n\t}\n\tlog.Println(\"GENERATE_RANDOM_CHANNEL:Finished generating a random channel successfully\")\n\treturn int64(rand_num)\n}", "title": "" }, { "docid": "56278f7467e18d82552a7dd7615cb69a", "score": "0.5242248", "text": "func (d *Dispatcher) getNewID(genFn func() (uuid.UUID, error)) (uuid.UUID, error) {\n\tif d == nil {\n\t\treturn uuid.Nil, errDispatcherNotInitialized\n\t}\n\n\tif genFn == nil {\n\t\treturn uuid.Nil, errUUIDGeneratorFunctionIsNil\n\t}\n\n\t// Continue to allow the generation, input and return of UUIDs even if\n\t// service is not currently enabled.\n\n\td.m.RLock()\n\tdefer d.m.RUnlock()\n\n\t// Generate new uuid\n\tnewID, err := genFn()\n\tif err != nil {\n\t\treturn uuid.Nil, err\n\t}\n\n\td.rMtx.Lock()\n\tdefer d.rMtx.Unlock()\n\t// Check to see if it already exists\n\tif _, ok := d.routes[newID]; ok {\n\t\treturn uuid.Nil, errUUIDCollision\n\t}\n\t// Write the key into system\n\td.routes[newID] = nil\n\treturn newID, nil\n}", "title": "" }, { "docid": "8f47711ebffcaabd690ce079200595df", "score": "0.5241518", "text": "func generateDeviceID() (string, error) {\n\tb := make([]byte, deviceIDByteLength)\n\t_, err := rand.Read(b)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// url-safe no padding\n\treturn base64.RawURLEncoding.EncodeToString(b), nil\n}", "title": "" }, { "docid": "16d0a7bc618a5cee0a9f457aeacb0ec0", "score": "0.5229537", "text": "func GenUUID() string {\n\tid := ksuid.New()\n\treturn id.String()\n}", "title": "" }, { "docid": "2fbc34d65242115536454fcd8c3f770c", "score": "0.52203536", "text": "func GeneratePeerID() string {\n\tpeerId := make([]byte, 20)\n\trand.Read(peerId)\n\treturn string(peerId)\n}", "title": "" }, { "docid": "f1200c53a5483ae2f4e51b9a70711a40", "score": "0.5208196", "text": "func GenUUID() string {\n\tb := make([]byte, 16)\n\t_, _ = rand.Read(b)\n\tr := hex.EncodeToString(b)\n\treturn r\n}", "title": "" }, { "docid": "41f4d63a6dd7c0838a99b3f98787e928", "score": "0.51969206", "text": "func generateChangefeedSessionID() string {\n\t// We read exactly 8 random bytes. 8 bytes should be enough because:\n\t// Consider that each new session for a changefeed job can occur at the\n\t// same highWater timestamp for its catch up scan. This session ID is\n\t// used to ensure that a session emitting files with the same timestamp\n\t// as the session before doesn't clobber existing files. Let's assume that\n\t// each of these runs for 0 seconds. Our node liveness duration is currently\n\t// 9 seconds, but let's go with a conservative duration of 1 second.\n\t// With 8 bytes using the rough approximation for the birthday problem\n\t// https://en.wikipedia.org/wiki/Birthday_problem#Square_approximation, we\n\t// will have a 50% chance of a single collision after sqrt(2^64) = 2^32\n\t// sessions. So if we start a new job every second, we get a coin flip chance of\n\t// single collision after 136 years. With this same approximation, we get\n\t// something like 220 days to have a 0.001% chance of a collision. In practice,\n\t// jobs are likely to run for longer and it's likely to take longer for\n\t// job adoption, so we should be good with 8 bytes. Similarly, it's clear that\n\t// 16 would be way overkill. 4 bytes gives us a 50% chance of collision after\n\t// 65K sessions at the same timestamp.\n\tconst size = 8\n\tp := make([]byte, size)\n\tbuf := make([]byte, hex.EncodedLen(size))\n\trand.Read(p)\n\thex.Encode(buf, p)\n\treturn string(buf)\n}", "title": "" }, { "docid": "afa88772d0d45139e053e36cd30fa4c4", "score": "0.51929903", "text": "func generatePortNo() string {\n\trand.Seed(time.Now().Unix())\n\treturn strconv.Itoa(rand.Intn(5000) + 5000) //generate a valid port\n}", "title": "" }, { "docid": "dfe58264e16a01fa7597e20cfd1c5ae4", "score": "0.5185754", "text": "func (pconn *Connection) Id() int {\n\treturn pconn.myId\n}", "title": "" }, { "docid": "ec52f99180686227d867aa27f491fe2f", "score": "0.5183023", "text": "func GenerateRandomID() string {\r\n\tfor {\r\n\t\tid := make([]byte, 32)\r\n\t\tif _, err := io.ReadFull(rand.Reader, id); err != nil {\r\n\t\t\tpanic(err) // This shouldn't happen\r\n\t\t}\r\n\t\tvalue := hex.EncodeToString(id)\r\n\t\t// if we try to parse the truncated for as an int and we don't have\r\n\t\t// an error then the value is all numberic and causes issues when\r\n\t\t// used as a hostname. ref #3869\r\n\t\tif _, err := strconv.ParseInt(TruncateID(value), 10, 64); err == nil {\r\n\t\t\tcontinue\r\n\t\t}\r\n\t\treturn value\r\n\t}\r\n}", "title": "" }, { "docid": "6671b66095a59178904335a056c23e81", "score": "0.51764065", "text": "func (o ApplicationGatewayPrivateEndpointConnectionOutput) Id() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ApplicationGatewayPrivateEndpointConnection) *string { return v.Id }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "fa6a33df753ee8fb8ed1872d49fd38cf", "score": "0.51738864", "text": "func GenUUID() string {\n\treturn uuid.NewV4().String()\n}", "title": "" }, { "docid": "bcfe1783b4013e8ee9cbabc2166c5b0b", "score": "0.5171231", "text": "func uniqueID() {\n\trand.Seed(time.Now().UnixNano())\n\tfinal := strconv.FormatInt(time.Now().Unix(), 10) + \".\" + strconv.Itoa(rand.Intn(9999-1)+1)\n\tuniqueIDVar = final\n}", "title": "" }, { "docid": "7faf78c7788dfdc3c8d98ca01e4c63d3", "score": "0.5158375", "text": "func getRandomClientId(clientName string, maxClientIdLen uint8) string {\n\tconst alphaNum = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\"\n\tvar bytes = make([]byte, maxClientIdLen)\n\t_, _ = rand.Read(bytes)\n\tfor i, b := range bytes {\n\t\tbytes[i] = alphaNum[b%byte(len(alphaNum))]\n\t}\n\treturn clientName + \"-pump-pipe-\" + string(bytes)\n}", "title": "" }, { "docid": "0d5beae7578bf888e0c7cdc412aca5ba", "score": "0.51551366", "text": "func (this *SessionMap) newUUID() *msgtypes.UUID {\n\tfor {\n\t\tif uuid, err := msgtypes.UUID4(); err == nil {\n\t\t\t_, exists_machine := this.map_uuid2machine[*uuid]\n\t\t\t_, exists_planner := this.map_uuid2planner[*uuid]\n\t\t\tif !exists_machine && !exists_planner {\n\t\t\t\treturn uuid\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a79ea1e43d874e0edc4a720f67e21e70", "score": "0.5142818", "text": "func GenerateSessionID() uint64 {\n\tnextSession++\n\treturn uint64(nextSession)\n}", "title": "" }, { "docid": "69f163b5e997fddcd9b5fa655f9ce638", "score": "0.5137929", "text": "func NextID() string {\n\treturn xid.New().String()\n}", "title": "" }, { "docid": "8202ea8b202f05afdd600bab8ec758a1", "score": "0.51372373", "text": "func newid() (string, error) {\n\tu := make([]byte, 16)\n\t_, err := rand.Read(u)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tu[8] = (u[8] | 0x80) & 0xBF\n\tu[6] = (u[6] | 0x40) & 0x4F\n\n\treturn hex.EncodeToString(u), nil\n}", "title": "" }, { "docid": "81b84a4253241d48019f04f57ceafe0a", "score": "0.51348907", "text": "func newID() string {\n\tu2, err := uuid.NewRandom()\n\tif err != nil {\n\t\tfmt.Printf(\"Something went wrong: %s\", err)\n\t\treturn \"\"\n\t}\n\treturn u2.String()\n}", "title": "" }, { "docid": "5bde2f1c8841e47274c6da7af3fa5347", "score": "0.51335025", "text": "func generateConnections() map[int]int {\n\tvar ordered [alphabetSize]int\n\tfor i := 0; i < alphabetSize; i++ {\n\t\tordered[i] = i\n\t}\n\n\trand.Shuffle(\n\t\talphabetSize,\n\t\tfunc(i, j int) {\n\t\t\tordered[i], ordered[j] = ordered[j], ordered[i]\n\t\t},\n\t)\n\n\tconnections := make(map[int]int)\n\tfor i := 0; i < alphabetSize/2; i++ {\n\t\tconnections[ordered[i]], connections[ordered[i+13]] = ordered[i+13], ordered[i]\n\t}\n\treturn connections\n}", "title": "" }, { "docid": "ba6a8cb5765639da1e57a38b6636d780", "score": "0.5132727", "text": "func generateId(prev int, padd string) string{\n\tnow := time.Now()\n\tyearday:= time.Now().YearDay()\n\tyear:= now.Year()\n\tautoInt := prev + 1;\n\tretVal := padd + strconv.Itoa(year) + strconv.Itoa(yearday) + strconv.Itoa(autoInt)\n\treturn retVal\n}", "title": "" }, { "docid": "4d2fffc380cbfe26096b991e91e907ec", "score": "0.5126399", "text": "func genID() string {\r\n\r\n\tfor {\r\n\t\tid := strconv.Itoa(rand.Intn(MAX_GEN_SIZE))\r\n\t\tif _, ok := DATA[id]; !ok {\r\n\t\t\treturn id\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "aba0736a50a8a2212ccf45fb83324864", "score": "0.51257825", "text": "func NewId() string {\n\tvar b bytes.Buffer\n\tencoder := base32.NewEncoder(encoding, &b)\n\tencoder.Write(uuid.NewRandom())\n\tencoder.Close()\n\tb.Truncate(26) // removes the '==' padding\n\treturn b.String()\n}", "title": "" }, { "docid": "aba0736a50a8a2212ccf45fb83324864", "score": "0.51257825", "text": "func NewId() string {\n\tvar b bytes.Buffer\n\tencoder := base32.NewEncoder(encoding, &b)\n\tencoder.Write(uuid.NewRandom())\n\tencoder.Close()\n\tb.Truncate(26) // removes the '==' padding\n\treturn b.String()\n}", "title": "" }, { "docid": "03e25b4c453e7a67584bb096fe6d1b04", "score": "0.5118192", "text": "func generateID(fn string) string {\n\th := md5.New()\n\tio.WriteString(h, fn)\n\treturn hex.EncodeToString(h.Sum(nil))\n}", "title": "" }, { "docid": "5d61ea10aebca9330eb87b6a5677b5cb", "score": "0.510496", "text": "func newID() string {\n\tvar b [8]byte\n\t_, err := rand.Read(b[:])\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn fmt.Sprintf(\"%x\", b[:])\n}", "title": "" }, { "docid": "fb73b299e432b8378c7ec398549cf4fc", "score": "0.5101554", "text": "func generateSesssionID() (string, error) {\n\t// For more on collisions:\n\t// https://en.wikipedia.org/wiki/Birthday_problem\n\t// http://www.wolframalpha.com/input/?i=1-e%5E(-1000000000*(1000000000-1)%2F(2*2%5E128))\n\tb := make([]byte, 16)\n\tif _, err := rand.Read(b); err != nil {\n\t\treturn \"\", fmt.Errorf(\"Could not generate session ID: %s\", err)\n\t}\n\treturn base64.StdEncoding.EncodeToString(b), nil\n}", "title": "" }, { "docid": "051a02e3693e059658ce5ecea0e67d7f", "score": "0.51007146", "text": "func deploymentGenerateID(fingerprint string) string {\n\t// Extract last 10 chars of fingerprint\n\treturn fingerprint[len(fingerprint)-10:]\n\t//return randomString()\n}", "title": "" }, { "docid": "60528684abe93c23a7c7aa1260cb22c4", "score": "0.5098963", "text": "func generateID() string {\n\tlog.Debugf(\"Calling .generateID()\")\n\trb := make([]byte, 10)\n\t_, err := rand.Read(rb)\n\tif err != nil {\n\t\tlog.Warnf(\"Unable to generate id: %s\", err)\n\t}\n\n\th := md5.New()\n\tio.WriteString(h, string(rb))\n\treturn fmt.Sprintf(\"%x\", h.Sum(nil))\n}", "title": "" }, { "docid": "ef27dc3131e58f350c60243c489ba0e3", "score": "0.5091183", "text": "func generateObjectID() (string, error) {\n\trandomBytes := make([]byte, 16)\n\t_, err := rand.Read(randomBytes)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn hex.EncodeToString(randomBytes), nil\n}", "title": "" }, { "docid": "c87574b7b2e5df3fab49540f84f3dbba", "score": "0.5087199", "text": "func (cli *Client) generatePacketID() (uint16, error) {\n\t// Define a Packet Identifier.\n\tid := minPacketID\n\n\tfor {\n\t\t// Find a Packet Identifier which does not used.\n\t\tif _, exist := cli.sess.sendingPackets[id]; !exist {\n\t\t\t// Return the Packet Identifier.\n\t\t\treturn id, nil\n\t\t}\n\n\t\tif id == maxPacketID {\n\t\t\tbreak\n\t\t}\n\n\t\tid++\n\t}\n\n\t// Return an error if available ids are not found.\n\treturn 0, ErrPacketIDExhaused\n}", "title": "" }, { "docid": "7ef6fd65c4dfb6b8b84f20e49f9c965b", "score": "0.5086122", "text": "func GenUUIDWithHyphen() string {\n\tid := GenUUID()\n\tif len(id) != 32 { // just to be safe\n\t\treturn \"\"\n\t}\n\ttimeLow := id[:8]\n\ttimeMid := id[8:12]\n\ttimeHiAndVersion := id[12:16]\n\tclockSeq := id[16:20]\n\tnode := id[20:]\n\treturn fmt.Sprintf(\"%v-%v-%v-%v-%v\",\n\t\ttimeLow, timeMid, timeHiAndVersion, clockSeq, node)\n}", "title": "" }, { "docid": "eae0c12623e4557cc5e7c9bb91bb050f", "score": "0.50853497", "text": "func genUUID(userData string) string {\n\tnum := binary.BigEndian.Uint64([]byte(userData))\n\ts1 := rand.NewSource(int64(num))\n\tr1 := rand.New(s1)\n\n\tuuidArr := make([]byte, 16)\n\tr1.Read(uuidArr)\n\n\t//UUID v4 has specific bits in the byte array that must be set in order\n\t//to be a v4 UUID. Google Analytics looks for these bits and won't accept\n\t//UUIDs without them\n\tuuidArr[8] = uuidArr[8]&^0xc0 | 0x80\n\tuuidArr[6] = uuidArr[6]&^0xf0 | 0x40\n\n\tuuid := fmt.Sprintf(\"%x-%x-%x-%x-%x\", uuidArr[0:4], uuidArr[4:6], uuidArr[6:8], uuidArr[8:10], uuidArr[10:])\n\n\treturn uuid\n}", "title": "" }, { "docid": "32a6de9298e90426784b06ecc026059c", "score": "0.508091", "text": "func GenerateID(l int, logger *logrus.Entry) string {\n\tconst (\n\t\t// ensures we backoff for less than 450ms total. Use the following to\n\t\t// select new value, in units of 10ms:\n\t\t// \tn*(n+1)/2 = d -> n^2 + n - 2d -> n = (sqrt(8d + 1) - 1)/2\n\t\tmaxretries = 9\n\t\tbackoff = time.Millisecond * 10\n\t)\n\n\tvar (\n\t\ttotalBackoff time.Duration\n\t\tcount int\n\t\tretries int\n\t\tsize = (l*5 + 7) / 8\n\t\tu = make([]byte, size)\n\t)\n\t// TODO: Include time component, counter component, random component\n\n\tfor {\n\t\t// This should never block but the read may fail. Because of this,\n\t\t// we just try to read the random number generator until we get\n\t\t// something. This is a very rare condition but may happen.\n\t\tb := time.Duration(retries) * backoff\n\t\ttime.Sleep(b)\n\t\ttotalBackoff += b\n\n\t\tn, err := io.ReadFull(rand.Reader, u[count:])\n\t\tif err != nil {\n\t\t\tif retryOnError(err) && retries < maxretries {\n\t\t\t\tcount += n\n\t\t\t\tretries++\n\t\t\t\tlogger.Errorf(\"error generating version 4 uuid, retrying: %v\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Any other errors represent a system problem. What did someone\n\t\t\t// do to /dev/urandom?\n\t\t\tpanic(fmt.Errorf(\"error reading random number generator, retried for %v: %v\", totalBackoff.String(), err))\n\t\t}\n\n\t\tbreak\n\t}\n\n\ts := base32.StdEncoding.EncodeToString(u)\n\n\treturn s[:l]\n}", "title": "" }, { "docid": "42507ecea4b9f8f70f601270a3787588", "score": "0.50714666", "text": "func createModelID() modelID {\n\tconst chars = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\"\n\n\tnewID := make([]byte, 8)\n\tfor i := range newID {\n\t\tnewID[i] = chars[rand.Int63()%int64(len(chars))]\n\t}\n\n\treturn modelID(newID)\n}", "title": "" }, { "docid": "28f0a98fc14c31a6ba768ed6030afa4c", "score": "0.50634414", "text": "func (holder *SockUIDHolder) GetConnUID(conn net.Conn) string {\n\treturn holder.socket2uid[conn]\n}", "title": "" } ]
bf0638aae86f928705d7ad73a3e5a136
Get preferred outbound ip of this machine
[ { "docid": "659d9d7eb52e7bf47ea194c223e14818", "score": "0.70481503", "text": "func GetOutboundIP() string {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\treturn localAddr.IP.String()\n}", "title": "" } ]
[ { "docid": "30aec024b44b9c8ce2178a5572137c5e", "score": "0.7458478", "text": "func GetOutboundIP() string {\n\tlocalAddrs,_ := net.InterfaceAddrs()\n\taddress := \"0.0.0.0\"\n\tfor _,addr := range localAddrs{\n\t\tidx := strings.LastIndex(addr.String(), \"/\")\n\t\taddrStr := addr.String()[0:idx]\n\t\tif strings.HasPrefix(addrStr, \"169\"){\n\t\t\taddress = addrStr\n\t\t}\n\t}\n\treturn address\n}", "title": "" }, { "docid": "9bb49b674f3af49adf35878b7ccbf4fa", "score": "0.7278875", "text": "func GetOutboundIP() string {\r\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\r\n\tif err != nil {\r\n\t\tlog.Printf(\"Dial errors:%v in GetOutboundIP\", err)\r\n\t\treturn \"127.0.0.1\"\r\n\t}\r\n\tdefer conn.Close()\r\n\r\n\tlocalAddr := conn.LocalAddr().String()\r\n\tidx := strings.LastIndex(localAddr, \":\")\r\n\r\n\treturn localAddr[0:idx]\r\n}", "title": "" }, { "docid": "3434a4339c8cee9b92eac19eea16eb10", "score": "0.7232754", "text": "func GetOutboundIP() (address string) {\n\taddress = \"127.0.0.1\"\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Error().Err(err).Send()\n\t\treturn\n\t}\n\tdefer conn.Close()\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\taddress = fmt.Sprintf(\"%s\", localAddr.IP)\n\treturn\n}", "title": "" }, { "docid": "3c1d37307237fd1821793291e8e6a9db", "score": "0.71956843", "text": "func getOutboundIP() net.IP {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Println(\"No network adapter detected; Using Loopback only\")\n\t\treturn net.IPv4(127, 0, 0, 1)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP\n}", "title": "" }, { "docid": "00336e66098dad6ed7825c39ce463457", "score": "0.7135489", "text": "func GetOutboundIP() string {\n conn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n if err != nil {\n return \"127.0.0.1\"\n }\n defer conn.Close()\n\n localAddr := conn.LocalAddr().(*net.UDPAddr)\n\n return localAddr.IP.String()\n}", "title": "" }, { "docid": "758a6feb43e4206ea10d82a3cd874fe4", "score": "0.7117023", "text": "func GetOutboundIP() (address string) {\n\taddress = \"127.0.0.1\"\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Error().Err(err).Msgf(\"Failed to get outbound IP\")\n\t\treturn\n\t}\n\tdefer conn.Close()\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\taddress = fmt.Sprintf(\"%s\", localAddr.IP)\n\treturn\n}", "title": "" }, { "docid": "f10443d5c4feea6149743d687ca7d53d", "score": "0.70594484", "text": "func getOutboundIP() net.IP {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP\n}", "title": "" }, { "docid": "f10443d5c4feea6149743d687ca7d53d", "score": "0.70594484", "text": "func getOutboundIP() net.IP {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP\n}", "title": "" }, { "docid": "8f8c27ed3ae0c1df0ecfc76748147035", "score": "0.7055053", "text": "func GetOutboundIP() string {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:53\")\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn strings.Split(localAddr.String(), \":\")[0]\n}", "title": "" }, { "docid": "563a2412314871e45b32ba2845c49c60", "score": "0.7029566", "text": "func GetOutboundIP(env *Env) net.IP {\n\tip := env.Vconfig.GetString(\"multihost.ip\")\n\tif ip != \"\" {\n\t\trealIP := net.ParseIP(ip)\n\t\tif realIP != nil {\n\t\t\treturn serverIP\n\t\t}\n\t}\n\n\tif serverIP == nil {\n\t\tipMu.Lock()\n\t\tdefer ipMu.Unlock()\n\n\t\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tdefer conn.Close()\n\n\t\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\t\tserverIP = localAddr.IP\n\t}\n\n\treturn serverIP\n}", "title": "" }, { "docid": "63d83b721ac92b83b4d0604294f76732", "score": "0.7010697", "text": "func GetOutboundIP() string {\n conn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n HandleError(\"net.Dial: \",err)\n defer conn.Close()\n localAddr := conn.LocalAddr().String()\n idx := strings.LastIndex(localAddr, \":\")\n return localAddr[0:idx]\n}", "title": "" }, { "docid": "3196f750a043d0f453e40085d01aec43", "score": "0.7010497", "text": "func GetOutboundIP(target string) net.IP {\n\tproto := domain.IPProtocol(target)\n\n\tvar testTarget string\n\tvar targetProto string\n\n\tswitch proto {\n\tcase 4:\n\t\ttestTarget = \"8.8.8.8\"\n\t\ttargetProto = \"ip4:icmp\"\n\tcase 6:\n\t\ttestTarget = \"[2001:4860:4860:0:0:0:0:8888]:80\"\n\t\ttargetProto = \"udp\"\n\tdefault:\n\t\tpanic(fmt.Errorf(\"unknown ip protocol %d\", proto))\n\t}\n\tfmt.Println(\"Test target:\", testTarget)\n\n\tconn, err := net.Dial(targetProto, testTarget)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer conn.Close()\n\n\n\tvar localAddr net.IP\n\tswitch proto {\n\tcase 4:\n\t\tlocalAddr = conn.LocalAddr().(*net.IPAddr).IP\n\tcase 6:\n\t\tlocalAddr = conn.LocalAddr().(*net.UDPAddr).IP\n\t}\n\n\treturn localAddr\n}", "title": "" }, { "docid": "23f6fa452a328a177a299607181c4f9d", "score": "0.7005065", "text": "func GetOutboundIP() string {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlogger := zerolog.Logger{}\n\t\tlogger.Fatal().Msgf(\"%s\", err)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP.String()\n}", "title": "" }, { "docid": "c2f83312732a2797657a77af64d2dce4", "score": "0.69826305", "text": "func GetOutboundIP() net.IP {\n conn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n if err != nil {\n log.Fatal(err)\n }\n defer conn.Close()\n localAddr := conn.LocalAddr().(*net.UDPAddr)\n return localAddr.IP\n}", "title": "" }, { "docid": "7e41364bd63df1ca6fbcad81067a0cd3", "score": "0.695819", "text": "func GetOutboundIP() string {\r\n\r\n\r\n\t\r\n conn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\r\n\tif err != nil {\r\n\t\t\t\tlog.Fatal(err)\r\n\t\t}\r\n\t\t\r\n\tlocalAddr := conn.LocalAddr().String()\r\n\tidx := strings.LastIndex(localAddr, \":\")\r\n\tfmt.Printf(\"outer IP: \" + localAddr[0:idx] );\r\n return localAddr[0:idx]\r\n\r\n\t/*\r\n\tYS: get real external IP\r\n\t\r\n\trsp, err := http.Get(\"http://checkip.amazonaws.com\")\r\n if err != nil {\r\n return \"Get External IP Error 001\"\r\n }\r\n defer rsp.Body.Close()\r\n buf, err := ioutil.ReadAll(rsp.Body)\r\n if err != nil {\r\n return \"Get External IP Error 002\"\r\n }\r\n return string(bytes.TrimSpace(buf))\r\n\t*/\r\n}", "title": "" }, { "docid": "008c18c20e36ac228e1405d9309e54bc", "score": "0.6956797", "text": "func GetOutboundIPKvm() string {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\tfmt.Printf(\"Address %v\\n\", localAddr.IP.String())\n\treturn localAddr.IP.String()\n}", "title": "" }, { "docid": "d813503c08e71f56443220af820bc8be", "score": "0.694505", "text": "func GetOutboundIP() string {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\tfmt.Println(localAddr.String())\n\treturn localAddr.IP.String()\n}", "title": "" }, { "docid": "abcef8bbbde4b28eefcbbf1caf4f71c6", "score": "0.6936904", "text": "func GetOutboundIP() (string, error) {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\treturn \"\", jerrors.Trace(err)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP.String(), nil\n}", "title": "" }, { "docid": "0936ae7c52d08e8625798bf5b9ccf39f", "score": "0.6891661", "text": "func GetOutboundIP() net.IP {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP\n}", "title": "" }, { "docid": "51ed853fc07ed8ea4293af4c38517f31", "score": "0.6882159", "text": "func GetOutboundIP() net.IP {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\treturn localAddr.IP\n}", "title": "" }, { "docid": "51ed853fc07ed8ea4293af4c38517f31", "score": "0.6882159", "text": "func GetOutboundIP() net.IP {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\treturn localAddr.IP\n}", "title": "" }, { "docid": "10ff007e4fbff09e640eec41249d0e23", "score": "0.68767333", "text": "func GetOutboundIP() net.IP {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP\n}", "title": "" }, { "docid": "10ff007e4fbff09e640eec41249d0e23", "score": "0.68767333", "text": "func GetOutboundIP() net.IP {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP\n}", "title": "" }, { "docid": "10ff007e4fbff09e640eec41249d0e23", "score": "0.68767333", "text": "func GetOutboundIP() net.IP {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP\n}", "title": "" }, { "docid": "10ff007e4fbff09e640eec41249d0e23", "score": "0.68767333", "text": "func GetOutboundIP() net.IP {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP\n}", "title": "" }, { "docid": "10ff007e4fbff09e640eec41249d0e23", "score": "0.68767333", "text": "func GetOutboundIP() net.IP {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP\n}", "title": "" }, { "docid": "b23bdf96c82d3e19e01986618c156d64", "score": "0.68510336", "text": "func GetOutboundIP() net.IP {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Logger.Fatal(err)\n\t}\n\tdefer conn.Close()\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\treturn localAddr.IP\n}", "title": "" }, { "docid": "47a005c911e24255e9e4f09c6da5ee5a", "score": "0.6850616", "text": "func OutboundIP() (ip string, err error) {\n\tconn, err := net.Dial(\"ip:icmp\", \"google.com\")\n\tif err != nil {\n\t\tconn, err = net.Dial(\"udp\", \"8.8.8.8:80\")\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\tip = conn.LocalAddr().String()\n\tconn.Close()\n\ta := strings.Split(ip, \":\")\n\tip = a[0]\n\treturn\n}", "title": "" }, { "docid": "f14c876c90397b8e5c3f86a552f3ed48", "score": "0.6830268", "text": "func getOutboundIP(endpoint string, fs fs.Interface) (net.IP, error) {\n\tconn, err := fs.NetDial(endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer conn.Close() // #nosec G307\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP, nil\n}", "title": "" }, { "docid": "0610523178da4e940a8614b7b963941e", "score": "0.67895764", "text": "func OutboundIP() (net.IP, error) {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:443\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() { _ = conn.Close() }()\n\n\treturn conn.LocalAddr().(*net.UDPAddr).IP, nil\n}", "title": "" }, { "docid": "a47f96648394a3475866845070e14d20", "score": "0.678797", "text": "func getOutboundIP(pingIP string) net.IP {\n\t//conn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tconn, err := net.Dial(\"udp\", pingIP)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP\n}", "title": "" }, { "docid": "0819972ff2667587c2172d7b7e77ed3e", "score": "0.67832917", "text": "func getOutboundIP(ip string) net.IP {\n\tconn, err := net.Dial(\"udp\", ip+\":80\")\n\tif err != nil {\n\t\treturn nil\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP\n}", "title": "" }, { "docid": "353424c6557caf159dc66da290f6acdd", "score": "0.6756998", "text": "func GetOutboundIP() (net.IP, int) {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP, localAddr.Port\n}", "title": "" }, { "docid": "fd451e038e1b512a57fd138f504111fc", "score": "0.6707637", "text": "func OutboundIP(typ string) net.IP {\n\thost, _ := os.Hostname()\n\taddrs, _ := net.LookupIP(host)\n\tfor _, addr := range addrs {\n\t\tif ipv4 := addr.To4(); typ == \"IPv4\" && ipv4 != nil {\n\t\t\treturn ipv4\n\t\t}\n\t\tif ipv6 := addr.To16(); typ == \"IPv6\" && ipv6 != nil {\n\t\t\treturn ipv6\n\t\t}\n\t}\n\tlog.Fatal(\"getoutboundIP: type must be IPv4 or IPv6\")\n\treturn nil\n}", "title": "" }, { "docid": "9063ef50032c16ba50d7029f29d723ae", "score": "0.6668876", "text": "func GetOutboundIP() (ipString string, err error) {\n\tout, err := exec.Command(\"curl\", \"-s\", \"http://checkip.amazonaws.com\").Output()\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tresult := fmt.Sprintf(\"%s\", out)\n\treturn strings.TrimSpace(result), nil\n}", "title": "" }, { "docid": "ca7ab8d6104ca6b5e1bb6f14237e5943", "score": "0.6593717", "text": "func GetOutboundIP() (net.IP, bool) {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP, true\n}", "title": "" }, { "docid": "ae36bfd5b0f8baf6ee33ec8e2e3acb27", "score": "0.65776354", "text": "func GetOutboundIP() string {\n\tresp, err := http.Get(\"http://ipv4.myexternalip.com/raw\")\n\tif err != nil {\n\t\tfmt.Println(\"GetOutboundIP error,\", err)\n\t\treturn \"[::]\"\n\t}\n\tdefer resp.Body.Close()\n\tbuf := make([]byte, 256)\n\tn, _ := resp.Body.Read(buf)\n\t// if err != nil {\n\t// \tfmt.Println(\"GetOutboundIP error 2,\", err)\n\t// \treturn \"[::]\"\n\t// }\n\treturn string(buf[:n-1])\n\t//fmt.Println(\"GetOutboundIP is\", resp.Body)\n}", "title": "" }, { "docid": "92174a86bbe162c3e576bd8942bfe99a", "score": "0.6492818", "text": "func GetIP() string{\r\n addrs, err := net.InterfaceAddrs()\r\n if err != nil{\r\n panic(err)\r\n }\r\n\r\n return addrs[1].String()\r\n}", "title": "" }, { "docid": "33162bc99e7552af8d9b6878fd3dd61a", "score": "0.64534044", "text": "func getDefaultIp() string {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:53\")\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn \"<unknown>\"\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP.String()\n}", "title": "" }, { "docid": "ecaea5b4a6531b3bf04f995e8bbd01bd", "score": "0.62336504", "text": "func (d *Driver) GetIP() (string, error) {\n\tlog.Debugf(\"Calling .GetIP()\")\n\tif d.UsePrivateIP {\n\t\tlog.Info(d.SSHHostSubnetAddress)\n\t\treturn d.SSHHostSubnetAddress, nil\n\t}\n\tlog.Info(d.SSHHostAddress.HostAndPort.Host)\n\treturn d.SSHHostAddress.GetSSHHostname()\n}", "title": "" }, { "docid": "52cac7958201579d183120972a8bfe80", "score": "0.62135243", "text": "func (o ResolverRuleTargetAddressOutput) Ip() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ResolverRuleTargetAddress) *string { return v.Ip }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "6f4e002fcdabbc5cf19158fc88c11c98", "score": "0.6211809", "text": "func (m *AirPrintDestination) GetIpAddress()(*string) {\n val, err := m.GetBackingStore().Get(\"ipAddress\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "ac8981afb2cf94135c4bea0b3b973d74", "score": "0.6198662", "text": "func (m *NetworkInfo) GetIpAddress()(*string) {\n return m.ipAddress\n}", "title": "" }, { "docid": "b0ffdf38b7d37786d976047d29b3573d", "score": "0.61040163", "text": "func getIp() string {\n\taddrs, err := net.InterfaceAddrs()\n\tif err != nil {\n\t\tos.Stderr.WriteString(\"Error: \" + err.Error() + \"\\n\")\n\t\tos.Exit(1)\n\t}\n\n\tfor _, a := range addrs {\n\t\tif ipnet, ok := a.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {\n\t\t\tif ipnet.IP.To4() != nil {\n\t\t\t\treturn ipnet.IP.String()\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "b713464f406565a61e8772e9911c312a", "score": "0.6082132", "text": "func (c *Container) GetIPAddress(ctx context.Context) (string, error) {\n\tinspect, err := inspectContainer(ctx, c)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn inspect.NetworkSettings.IPAddress, nil\n}", "title": "" }, { "docid": "3dfce69fe9ac3227f44b9e10f364ed05", "score": "0.6031084", "text": "func GetOutboundAddress(bind string) (string, error) {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\tport := strings.Split(bind, \":\")[1]\n\treturn fmt.Sprintf(\"%s:%s\", localAddr.IP, port), nil\n}", "title": "" }, { "docid": "98bbf412f0e063872277bb75489a25ca", "score": "0.59854007", "text": "func getIPAddrFromOutGoingConnection() (ip string, err error) {\n\taddr, err := net.ResolveUDPAddr(\"udp4\", \"8.8.8.8:53\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tconn, err := net.DialUDP(\"udp4\", nil, addr)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tlocalAddr := conn.LocalAddr()\n\tparts := strings.Split(localAddr.String(), \":\")\n\treturn parts[0], nil\n}", "title": "" }, { "docid": "7ed2439faaa6e2868f47c00dc81a6ee5", "score": "0.5981253", "text": "func (d *Driver) GetIP() (string, error) {\n\n\tc, err := d.getHarvesterClient()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvmi, err := c.VirtualMachineInstance(d.Namespace).Get(d.VMName, &k8smetav1.GetOptions{})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn vmi.Status.Interfaces[0].IP, err\n}", "title": "" }, { "docid": "ad6c143243ca84b0e934955d7e4f33fa", "score": "0.5972843", "text": "func InternalIP() (ip string) {\n\taddrs, err := net.InterfaceAddrs()\n\tif err != nil {\n\t\tpanic(\"Oops: \" + err.Error())\n\t}\n\n\tfor _, a := range addrs {\n\t\tif ipNet, ok := a.(*net.IPNet); ok && !ipNet.IP.IsLoopback() {\n\t\t\tif ipNet.IP.To4() != nil {\n\t\t\t\t// os.Stdout.WriteString(ipNet.IP.String() + \"\\n\")\n\t\t\t\tip = ipNet.IP.String()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\t// os.Exit(0)\n\treturn\n}", "title": "" }, { "docid": "4665d2a815c6c744ac9d2cbaf8b41afd", "score": "0.59539115", "text": "func GetIPAddress() string {\n\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\n\tdefer conn.Close()\n\tif err != nil {\n\t\tlog.Printf(\"UTILS: failed to get ip addrres\")\n\t\treturn \"\"\n\t}\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\treturn localAddr.IP.String()\n}", "title": "" }, { "docid": "7886fbd5228969948c52a95b6a55579c", "score": "0.5934559", "text": "func GetIP() string {\n\tifaces, err := net.Interfaces()\n\tif err != nil {\n\t\tlogger.Error(\"fail to list ifaces\", err)\n\t\treturn \"\"\n\t}\n\n\tfor _, i := range ifaces {\n\t\taddrs, err := i.Addrs()\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif i.Name == \"lo\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, addr := range addrs {\n\t\t\tvar ip net.IP\n\t\t\tswitch v := addr.(type) {\n\t\t\tcase *net.IPNet:\n\t\t\t\tip = v.IP\n\t\t\tcase *net.IPAddr:\n\t\t\t\tip = v.IP\n\t\t\t}\n\t\t\treturn ip.String()\n\t\t}\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "c3c2d0faea267b5f76c30e2ad21d5fc9", "score": "0.5934125", "text": "func GetOutboundIP() []string {\n\tvar interfaces []string\n\taddrs, err := net.InterfaceAddrs()\n\tif err != nil {\n\t\tpanic(ErrShouldHaveIPAddress.Error())\n\t}\n\tfor _, address := range addrs {\n\t\t// check the address type and if it is not a loopback the display it\n\t\tif ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {\n\t\t\tif ipnet.IP.To4() != nil {\n\t\t\t\tinterfaces = append(interfaces, ipnet.IP.String())\n\t\t\t}\n\t\t}\n\t}\n\treturn interfaces\n}", "title": "" }, { "docid": "1390b6d1916811b7735fa1c50fe8b272", "score": "0.5931766", "text": "func getPeerGatewayIP(spec mcv1alpha1.ClusterInfo) net.IP {\n\tif len(spec.GatewayInfos) == 0 {\n\t\treturn nil\n\t}\n\treturn net.ParseIP(spec.GatewayInfos[0].GatewayIP)\n}", "title": "" }, { "docid": "3ad29ae1de245c4d8bf4aba8375d2e18", "score": "0.5925595", "text": "func (d *Driver) GetIP() (string, error) {\n\tif !d.mainIpIsSet() {\n\t\treturn \"\", fmt.Errorf(\"IP address is not set\")\n\t}\n\n\treturn d.IPAddress, nil\n}", "title": "" }, { "docid": "5a2baff277dc0d99f8f12406ceb86905", "score": "0.59208214", "text": "func InternalIP() (string, error) {\n\treturn getTrimmed(\"instance/network-interfaces/0/ip\")\n}", "title": "" }, { "docid": "37f8248f5266089a5671fb82e481c7bb", "score": "0.59145385", "text": "func (vm *VM) IP() (string, bool) {\n\treturn vm.internalIP, true\n}", "title": "" }, { "docid": "b79bd005f8c3d2239eafc4f33e47557d", "score": "0.5884444", "text": "func (b *BaseController) IP() (string, error) {\n\tcheckError(nil, fmt.Sprintf(\"Retrieving IP from %s with virtual eth0\", b.NetworkInterface()))\n\n\t// ips, ex := b.bcontainer.IPAddresses()\n\tips, ex := b.bcontainer.IPAddress(\"eth0\")\n\n\tcheckError(ex, fmt.Sprintf(\"Retrieving IP from %s from ips %s\", b.Name(), ips))\n\n\tif len(ips) <= 0 {\n\t\treturn \"\", ErrBadIP\n\t}\n\n\treturn ips[0], ex\n}", "title": "" }, { "docid": "b39036136899a758c9ac120ab3eef853", "score": "0.58764917", "text": "func (d *Driver) GetIP() (string, error) {\n\tinstance, err := d.getClient().InstanceGet(d.MachineName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif instance.Status.IP == \"\" {\n\t\treturn \"\", fmt.Errorf(\"IP address is not set\")\n\t}\n\td.IPAddress = instance.Status.IP\n\treturn instance.Status.IP, nil\n}", "title": "" }, { "docid": "d6687c4b82ce8b0378cbab4cd6ff3d38", "score": "0.585241", "text": "func GetIpAddress() string {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err == nil {\n\t\tdefer conn.Close()\n\t\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\t\treturn localAddr.IP.String()\n\t}\n\t// TODO: if the above errors, what other ways can we do this?\n\treturn \"\"\n}", "title": "" }, { "docid": "eb5b383136ae4b47440eb65a4c2c6559", "score": "0.5849585", "text": "func getIP() string {\n\tconn, error := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif error != nil {\n\t\tfmt.Println(error)\n\t}\n\n\tdefer conn.Close()\n\tipAddress := conn.LocalAddr().(*net.UDPAddr)\n\treturn ipAddress.IP.String()\n}", "title": "" }, { "docid": "8a544a865a37550b5cf7b8a37950740b", "score": "0.5842036", "text": "func (d *Driver) GetIP() (string, error) {\n\tif d.IPAddress != \"\" {\n\t\treturn d.IPAddress, nil\n\t}\n\n\treturn d.getClient().GetIP(d.ID)\n}", "title": "" }, { "docid": "0f41c173c7d101c5651383c756903ccf", "score": "0.58412886", "text": "func GetIpAddr() string {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\toutput := conn.LocalAddr().String()\n\toutput = strings.Split(output, \":\")[0]\n\treturn output\n}", "title": "" }, { "docid": "0f41c173c7d101c5651383c756903ccf", "score": "0.58412886", "text": "func GetIpAddr() string {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\toutput := conn.LocalAddr().String()\n\toutput = strings.Split(output, \":\")[0]\n\treturn output\n}", "title": "" }, { "docid": "0f41c173c7d101c5651383c756903ccf", "score": "0.58412886", "text": "func GetIpAddr() string {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\toutput := conn.LocalAddr().String()\n\toutput = strings.Split(output, \":\")[0]\n\treturn output\n}", "title": "" }, { "docid": "d7f13e3e78fbab935224096951157a8a", "score": "0.58230484", "text": "func (vm *instance) getIpAddr() (string, error) {\n\tif vm.vmConfig.IpAddr != \"\" {\n\t\treturn vm.vmConfig.IpAddr, nil\n\t}\n\treturn vm.getIpAddrFromVmtools()\n}", "title": "" }, { "docid": "c7cc9a5f79ca4710bace7a53f047b02b", "score": "0.5815411", "text": "func getRealIP(name string) string {\n if len(name) > 0 {\n ip , err := net.ResolveIPAddr(\"ip\", name)\n if err == nil {\n if ip.IP.IsGlobalUnicast() {\n return ip.IP.String()\n }\n }\n }\n return \"\"\n}", "title": "" }, { "docid": "35cb317d87eafa2163f58de28fe9af4b", "score": "0.5809202", "text": "func (e *Environment) GetPublicIP() string {\n\tif e.outboundIP == nil {\n\t\treturn \"\"\n\t}\n\treturn e.outboundIP.String()\n}", "title": "" }, { "docid": "0f97be85866ed92b3c8aafe414024ec7", "score": "0.57787955", "text": "func GetMyIP() net.IP {\n conn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n if err != nil {\n log.Fatal(err)\n }\n defer conn.Close()\n\n localAddr := conn.LocalAddr().(*net.UDPAddr)\n\n return localAddr.IP\n}", "title": "" }, { "docid": "ed7315db15cc105cd01c6c667a0998b1", "score": "0.57766604", "text": "func getInternalIPAddress(addresses []core.NodeAddress) (string, error) {\n\t// Get the IP address associated with the Windows machine, if not error out to requeue again\n\tif len(addresses) == 0 {\n\t\treturn \"\", fmt.Errorf(\"no IP addresses defined\")\n\t}\n\tfor _, address := range addresses {\n\t\t// Only return the IPv4 address\n\t\tif address.Type == core.NodeInternalIP && net.ParseIP(address.Address).To4() != nil {\n\t\t\treturn address.Address, nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"no internal IP address associated\")\n}", "title": "" }, { "docid": "bf68b813ae10cb914c3c09c3458a6992", "score": "0.57710004", "text": "func (a *addr) GetIP() string {\n\taddrs, err := net.InterfaceAddrs()\n\tif err != nil {\n\t\treturn \"error\"\n\t}\n\n\tfor _, address := range addrs {\n\t\t// check the address type and if it is not a loopback the display it\n\t\tif ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {\n\t\t\tif ipnet.IP.To4() != nil {\n\t\t\t\treturn ipnet.IP.String()\n\t\t\t}\n\t\t}\n\t}\n\treturn \"127.0.0.1\"\n\n\tpanic(\"Unable to determine local IP address (non loopback). Exiting.\")\n}", "title": "" }, { "docid": "aa24c01a0c4e50ebb4e16306b30b491e", "score": "0.575221", "text": "func External() net.IP {\n\treturn external\n}", "title": "" }, { "docid": "b107788d427e3dccc47cc21c279ffdcf", "score": "0.5750957", "text": "func (o VmwareHostIpOutput) Ip() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v VmwareHostIp) *string { return v.Ip }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "35acee19395a3ae9cd390579cc12d898", "score": "0.57477295", "text": "func determineExternalIP() (string, error) {\n\t// Create a new consensus with the default configuration.\n\tc := externalip.NewConsensus(externalip.DefaultConsensusConfig(), nil)\n\t// Add sources known to correctly return an IPV4\n\tif err := c.AddVoter(externalip.NewHTTPSource(\"https://ipinfo.io/ip\"), 1); err != nil {\n\t\treturn \"\", err\n\t}\n\tif err := c.AddVoter(externalip.NewHTTPSource(\"https://myexternalip.com/raw\"), 1); err != nil {\n\t\treturn \"\", err\n\t}\n\tif err := c.AddVoter(externalip.NewHTTPSource(\"https://checkip.amazonaws.com\"), 1); err != nil {\n\t\treturn \"\", err\n\t}\n\t// Try to determine the external IP.\n\ti, err := c.ExternalIP()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn i.String(), nil\n}", "title": "" }, { "docid": "14edd5b1a07ea1d599bc4481de6516c4", "score": "0.57428074", "text": "func myIpAddress() otto.Value {\n\thostname, err := os.Hostname()\n\n\tif err != nil {\n\t\treturn otto.UndefinedValue()\n\t}\n\n\taddress := dnsResolve(hostname)\n\n\tif value, err := otto.ToValue(address); err == nil {\n\t\treturn value\n\t}\n\n\treturn otto.UndefinedValue()\n}", "title": "" }, { "docid": "da1f241f751449b92f5654748e985a46", "score": "0.573255", "text": "func determineExternalIP() (string, error) {\n\t// Create a new consensus with the default configuration.\n\tc := externalip.NewConsensus(externalip.DefaultConsensusConfig(), nil)\n\t// Add sources known to correctly return an IPV4\n\tif err := c.AddVoter(externalip.NewHTTPSource(\"https://ipinfo.io/ip\"), 1); err != nil {\n\t\treturn \"\", err\n\t}\n\tif err := c.AddVoter(externalip.NewHTTPSource(\"https://myexternalip.com/raw\"), 1); err != nil {\n\t\treturn \"\", err\n\t}\n\tif err := c.AddVoter(externalip.NewHTTPSource(\"https://checkip.amazonaws.com\"), 1); err != nil {\n\t\treturn \"\", err\n\t}\n\t// Try to determine the external IP.\n\ti, err := c.ExternalIP()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// Log the result and return.\n\tlog.Debugf(\"reported external ip: %s\", i.String())\n\treturn i.String(), nil\n}", "title": "" }, { "docid": "be40eda2df53ee99458172854d90ec7e", "score": "0.57290477", "text": "func GetCurrentIP() string {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\treturn \"127.0.0.1\"\n\t}\n\tdefer conn.Close()\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\tip4 := localAddr.IP.To4()\n\tif ip4 == nil {\n\t\treturn \"127.0.0.1\"\n\t}\n\treturn ip4.String()\n}", "title": "" }, { "docid": "13babdc7121c26485ed4b3753aaea45e", "score": "0.57274234", "text": "func getIp(w http.ResponseWriter, r *http.Request) {\n // tested the first if on the command line\n // curl --header \"X-Forwarded-For: 192.168.0.2\" http://localhost:8080\n message := \"Current Ip: \"\n ipAddress := r.Header.Get(\"X-Real-Ip\")\n if ipAddress == \"\" {\n ipAddress = r.Header.Get(\"X-Forwarded-For\")\n }\n if ipAddress == \"\" {\n ipAddress = r.RemoteAddr\n }\n w.Write([]byte(message + ipAddress))\n}", "title": "" }, { "docid": "8882c25ac203c1fc529d753cae883cbc", "score": "0.5720912", "text": "func (info *BaseEndpointInfo) IP() string {\n\treturn utilproxy.IPPart(info.Endpoint)\n}", "title": "" }, { "docid": "8882c25ac203c1fc529d753cae883cbc", "score": "0.5720912", "text": "func (info *BaseEndpointInfo) IP() string {\n\treturn utilproxy.IPPart(info.Endpoint)\n}", "title": "" }, { "docid": "45d008ead59199e3f38cc1eb2e165ad7", "score": "0.5718512", "text": "func GetIP() string {\n\tif IsDevEnv() {\n\t\treturn \"127.0.0.1\"\n\t}\n\n\tval, isSet := os.LookupEnv(constants.IPEnvVar)\n\tif !isSet {\n\t\treturn \"\"\n\t}\n\n\treturn val\n}", "title": "" }, { "docid": "7deeecfd7e055c4de22422f4c2ebe46a", "score": "0.57086575", "text": "func (m *NetworkInfo) GetReflexiveIPAddress()(*string) {\n return m.reflexiveIPAddress\n}", "title": "" }, { "docid": "c2a45d5d1e0e6fa931ea57c2ee787eb1", "score": "0.5704677", "text": "func (o GatewayVpnAttachmentOutput) InternetIp() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *GatewayVpnAttachment) pulumi.StringOutput { return v.InternetIp }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "24dbf98b6f8dbb022eace1ec30930ead", "score": "0.57032603", "text": "func GetIP(name string) string {\n\taddrs, err := net.LookupHost(name)\n\tif err != nil {\n\t\tos.Stderr.WriteString(\"Oops: \" + err.Error() + \"\\n\")\n\t\tos.Exit(1)\n\t}\n\t//log.Println(\"My ip address is: \", addrs[0])\n\treturn addrs[0]\n}", "title": "" }, { "docid": "2bfe1a478c1ccd101ef0ee17b4b52d8d", "score": "0.57012457", "text": "func (ifconf *ifConfig) GetIP() (string, error) {\n\treq, err := http.NewRequest(http.MethodGet, config.IF().URL, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tclnt := http.Client{}\n\tresp, err := clnt.Do(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\n\tbuf := make([]byte, 3*4+3) // 144.144.144.144\n\t_, err = resp.Body.Read(buf)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(buf), err\n}", "title": "" }, { "docid": "c07ffd08b24cc08d6dec93a2086d5f34", "score": "0.5691928", "text": "func (c *DockerContainer) GetIPAddress(ctx context.Context) (string, error) {\n\treturn c.Host(ctx)\n}", "title": "" }, { "docid": "9f86c990ce19b4b1abee7057d5530de7", "score": "0.5689828", "text": "func GetIP() net.IP {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\tif err != nil {\n\t\treturn nil\n\t}\n\tdefer conn.Close()\n\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\n\treturn localAddr.IP\n}", "title": "" }, { "docid": "396229d44adf190bbdc6985cf34f169c", "score": "0.5688199", "text": "func (m *CloudAppSecurityState) GetDestinationServiceIp()(*string) {\n return m.destinationServiceIp\n}", "title": "" }, { "docid": "5b67f3167a4a804e585dba3392be5e98", "score": "0.56875515", "text": "func (b *baseNode) IP() string {\n\tif len(b.node.Status.Addresses) == 0 {\n\t\treturn \"N/A\"\n\t}\n\taddress := b.node.Status.Addresses[0]\n\treturn address.Address\n}", "title": "" }, { "docid": "19ed35b8d61eeffeaba7f856fb2842cd", "score": "0.56818193", "text": "func (o *HyperflexHypervisorVirtualMachine) GetIp() NetworkHyperFlexNetworkAddress {\n\tif o == nil || o.Ip.Get() == nil {\n\t\tvar ret NetworkHyperFlexNetworkAddress\n\t\treturn ret\n\t}\n\treturn *o.Ip.Get()\n}", "title": "" }, { "docid": "6a1c1d8eb6850c08327b5469a1c4d63e", "score": "0.5679728", "text": "func (o SubnetOutput) GatewayIp() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Subnet) pulumi.StringOutput { return v.GatewayIp }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ef10ab0d0bcda57be1b54c366f5743d8", "score": "0.5676968", "text": "func GetMyIP() string {\n\tconn, err := net.Dial(\"udp\", \"8.8.8.8:53\")\n\tif err != nil {\n\t\tfmt.Println(\"Error getting ip address\")\n\t\treturn \"\"\n\t}\n\tdefer conn.Close()\n\tlocalAddr := conn.LocalAddr().(*net.UDPAddr)\n\treturn localAddr.IP.String()\n}", "title": "" }, { "docid": "937afc063a3aac390149b9844d42d73e", "score": "0.5673019", "text": "func (m *Machine) GetPrivateIPAddress() string {\n\n\td, ok := m.HostConfig.Driver.(*rpcdriver.RPCClientDriver)\n\tif !ok {\n\t\treturn \"/* failed to type cast to RPCClientDriver */\"\n\t}\n\n\tb, err := d.GetConfigRaw()\n\tif err != nil {\n\t\treturn fmt.Sprintf(\"/* failed to get raw config of this driver: %v */\", err)\n\t}\n\tdest := map[string]interface{}{}\n\tif err := json.Unmarshal(b, &dest); err != nil {\n\t\treturn fmt.Sprintf(\"/* failed to decode raw config to map: %v */\", err)\n\t}\n\t// TODO: Store and reuse this configuration, which is fetched above.\n\n\tswitch m.HostConfig.DriverName {\n\tcase \"amazonec2\":\n\t\t// FIXME: hard coding... ;(\n\t\treturn fmt.Sprintf(\"%v\", dest[\"PrivateIPAddress\"])\n\tcase \"google\":\n\t\t// https://github.com/otiai10/awsub/issues/84\n\t\treturn m.GCEInternalNetworkIPAddress\n\tdefault:\n\t\treturn fmt.Sprintf(\"/* TODO: dkmachine: Private IP Address for %v is not implemented yet */\", m.HostConfig.DriverName)\n\t}\n}", "title": "" }, { "docid": "8e874017137a342c787a4edb1f19aefd", "score": "0.56728894", "text": "func (s *Core) GetMyExternalIP() string {\n\tdebugVal := os.Getenv(\"DEBUG_LOCAL_IP\")\n\tif debugVal != \"\" {\n\t\treturn \"127.0.0.1\"\n\t}\n\n\tifaces, _ := net.Interfaces()\n\tfor _, iface := range ifaces {\n\t\taddrs, _ := iface.Addrs()\n\t\tfor _, addr := range addrs {\n\t\t\ttmp := addr.String()\n\t\t\tif strings.Count(tmp, \".\") == 3 && !strings.HasPrefix(tmp, \"127.0.0.1\") {\n\t\t\t\treturn strings.Split(tmp, \"/\")[0]\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\"\n\n}", "title": "" }, { "docid": "d9393be89216fff913c893893fb634ba", "score": "0.5666974", "text": "func (m *NetworkInfo) GetRelayIPAddress()(*string) {\n return m.relayIPAddress\n}", "title": "" }, { "docid": "e28279fbe29c5e6317c59b506721889f", "score": "0.56645966", "text": "func GetBroadcastIP(n *net.IPNet) net.IP {\n\tvar broadcast net.IP\n\tif len(n.IP) == 4 {\n\t\tbroadcast = net.ParseIP(\"0.0.0.0\").To4()\n\t} else {\n\t\tbroadcast = net.ParseIP(\"::\")\n\t}\n\tfor i := 0; i < len(n.IP); i++ {\n\t\tbroadcast[i] = n.IP[i] | ^n.Mask[i]\n\t}\n\treturn broadcast\n}", "title": "" }, { "docid": "42e1cd7349babe2279da0a1a50cd9415", "score": "0.5662773", "text": "func (c *Action) IP() string {\n\tips := c.Proxy()\n\tif len(ips) > 0 && ips[0] != \"\" {\n\t\treturn ips[0]\n\t}\n\tip := strings.Split(c.Request.RemoteAddr, \":\")\n\tif len(ip) > 0 {\n\t\tif ip[0] != \"[\" {\n\t\t\treturn ip[0]\n\t\t}\n\t}\n\treturn \"127.0.0.1\"\n}", "title": "" }, { "docid": "128002d1c56678b7cbc6639babf99cef", "score": "0.56537956", "text": "func (*Actuator) GetIP(cluster *clusterv1.Cluster, machine *clusterv1.Machine) (string, error) {\n\tklog.V(1).Infof(\"Getting IP of the machine %v for cluster %v.\", machine.Name, cluster.Name)\n\n\tannotations := machine.GetAnnotations()\n\tif annotations == nil {\n\t\treturn \"\", errors.New(\"could not get the annotations\")\n\t}\n\n\tip, ok := annotations[exoscalev1.ExoscaleIPAnnotationKey]\n\tif !ok {\n\t\treturn \"\", errors.New(\"could not get IP from the annotations\")\n\t}\n\treturn ip, nil\n}", "title": "" }, { "docid": "2b3a5620b1fda27d002af2576bea0726", "score": "0.5652747", "text": "func getIP(r *http.Request) string {\n\tforwarded := r.Header.Get(\"X-FORWARDED-FOR\")\n\tif forwarded != \"\" {\n\t\t// see https://en.wikipedia.org/wiki/X-Forwarded-For#Format\n\t\tips := strings.Split(forwarded, \", \")\n\t\treturn ips[0]\n\t}\n\n\thosts := strings.Split(r.RemoteAddr, \":\")\n\treturn hosts[0]\n}", "title": "" }, { "docid": "c542f56d556ca45a62f5cd6938bd5be5", "score": "0.5650938", "text": "func GetGlobalIp() string {\r\n\tip := \"\"\r\n\tresolvers := []string{\r\n\t\t\"https://api.ipify.org?format=text\",\r\n\t\t\"http://myexternalip.com/raw\",\r\n\t\t\"http://ident.me\",\r\n\t\t\"https://ifconfig.me\",\r\n\t\t\"https://bot.whatismyipaddress.com/\",\r\n\t\t\"https://ifconfig.co\",\r\n\t}\r\n\r\n\tfor {\r\n\t\turl := RandomSelectStr(resolvers)\r\n\t\tresp, err := http.Get(url)\r\n\t\tif err != nil {\r\n\t\t\tlog.Printf(\"%v\\n\", err)\r\n\t\t}\r\n\t\tdefer resp.Body.Close()\r\n\r\n\t\ti, _ := ioutil.ReadAll(resp.Body)\r\n\t\tip = string(i)\r\n\r\n\t\tif resp.StatusCode == 200 {\r\n\t\t\tbreak\r\n\t\t}\r\n\t}\r\n\r\n\treturn ip\r\n}", "title": "" }, { "docid": "68b77e4caca6b8cd98ab411c8bfe2e86", "score": "0.5649398", "text": "func (c *Channel) Ip() string {\n\tforward := c.RequestHeader().Get(HeaderForward)\n\tif forward != \"\" {\n\t\treturn forward\n\t}\n\treturn c.ip\n}", "title": "" } ]
0aa76feba38d35f07b2a9e9e50f46d18
SendSignal sends a Windows message to all windows handles that belongs to a given process.
[ { "docid": "fe2df2b51ba75aa5c122641bdce1abf8", "score": "0.771594", "text": "func SendSignal(pid uint32, msg WindowsMessage) error {\r\n\r\n\tvar handlePid uint32\r\n\tvar handles []HWND\r\n\tvar callback uintptr\r\n\tcallback = windows.NewCallback(func(hwnd HWND, lParam LPARAM) uintptr {\r\n\t\tgetWindowThreadProcessId(hwnd, LPDWORD(&handlePid))\r\n\t\tif pid == handlePid {\r\n\t\t\thandles = append(handles, hwnd)\r\n\t\t}\r\n\t\tenumChildWindows(hwnd, callback, 0)\r\n\t\treturn 1\r\n\t})\r\n\r\n\tenumWindows(callback, 0)\r\n\r\n\tif len(handles) == 0 {\r\n\t\treturn ErrNoWndHandle\r\n\t}\r\n\r\n\tfor _, h := range handles {\r\n\t\tif err := postMessage(HWND(h), UINT(msg), 0, 0); err != nil {\r\n\t\t\treturn fmt.Errorf(\"failed to send signal %v: %w\", msg, err)\r\n\t\t}\r\n\t}\r\n\r\n\treturn nil\r\n}", "title": "" } ]
[ { "docid": "7700e92e41abfa4962e9f997fa3ba13f", "score": "0.61888677", "text": "func SendSignal(s Signal) {\n\tsigC <- s\n}", "title": "" }, { "docid": "1d865cfa99c27b8dbbc5fc70afc39ba6", "score": "0.61451423", "text": "func SendSignal(sig os.Signal) {\n\tgetInstance().SigEventChannel <- sig\n}", "title": "" }, { "docid": "92f1bb7a0fc726879540b62b64ed13d5", "score": "0.5944206", "text": "func SendUserSignal(pname string) {\n\tif !IsPlatformWindows() {\n\t\tcmd := fmt.Sprintf(\"pidof %s | xargs kill -USR1 > /dev/null 2>&1\", pname)\n\t\tOCTSystem(cmd)\n\t}\n}", "title": "" }, { "docid": "5a927d385ffe3ed2b8d4c19b6145ae4c", "score": "0.5796576", "text": "func NotifySignals() chan os.Signal { return notifySignals() }", "title": "" }, { "docid": "08b87ceec0a5e615e95061858e023ad0", "score": "0.5664529", "text": "func (l *LogModule) SendSignal() {\n\tl.signalReopenChan <- 0\n}", "title": "" }, { "docid": "7d29101e04b05bdfc5c849417a70462d", "score": "0.561962", "text": "func (m *ProcessManager) Signal(sig os.Signal) {\n\tm.signals <- sig\n}", "title": "" }, { "docid": "6579114580ed17bf3f57b6ac11e74cb4", "score": "0.5612852", "text": "func NotifySignal(c chan<- Signal, sig ...Signal) error {\n\tif c == nil {\n\t\treturn fmt.Errorf(\"NotifySignal using nil channel\")\n\t}\n\n\tif len(sig) == 0 {\n\t\treturn fmt.Errorf(\"NotifySignal must notify at least 1 signal\")\n\t}\n\n\tch := make(chan os.Signal, cap(c))\n\n\tsigs := make([]os.Signal, 0, len(sig))\n\tfor _, s := range sig {\n\t\toss, ok := signalToOsMap[s]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"NotifySignal unsupported signal %v\", s)\n\t\t}\n\t\tsigs = append(sigs, oss)\n\t}\n\n\tsignal.Notify(ch, sigs...)\n\n\tgo func() {\n\t\tfor s := range ch {\n\t\t\tc <- signalFromOsMap[s]\n\t\t}\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "c90073feed10d75d474b996026ef9fe5", "score": "0.55808085", "text": "func (s *Sandbox) SignalProcess(containerID, processID string, signal syscall.Signal, all bool) error {\n\treturn nil\n}", "title": "" }, { "docid": "76ef3cc7bd07b99b8e3644c048ff081d", "score": "0.55361634", "text": "func (s *Sandbox) SignalProcess(ctx context.Context, containerID, processID string, signal syscall.Signal, all bool) error {\n\tif s.state.State != types.StateRunning {\n\t\treturn errSandboxNotRunning\n\t}\n\n\tc, err := s.findContainer(containerID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.signalProcess(ctx, processID, signal, all)\n}", "title": "" }, { "docid": "0e58264467e9209e448b4ec9e5e97d0d", "score": "0.52582127", "text": "func (p *ProcessWrap) Signal(sig os.Signal) error {\n\treturn p.process.Signal(sig)\n}", "title": "" }, { "docid": "c8b51160c7d371c9ab082b39eb9d684a", "score": "0.5255131", "text": "func send(pid int, sig syscall.Signal) {\n\tfmt.Fprintf(noise, \"[sending %s to hosted program]\\n\", sigName(sig))\n\tsyscall.Kill(pid, sig)\n}", "title": "" }, { "docid": "bde5fe587ea7103381bcd28c408d7f80", "score": "0.52290887", "text": "func (p *Process) Signal(signal int64) error {\n\tpr, _ := os.FindProcess(int(p.pid))\n\terr := pr.Signal(syscall.Signal(0))\n\tif err == nil {\n\t\terr = pr.Signal(syscall.Signal(signal))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Could not signal process: %s\", err)\n\t\t}\n\t\treturn nil\n\t} else if err == syscall.ESRCH { //ESRCH error is if process could not be found\n\t\treturn fmt.Errorf(\"Process is not running. Could not signal process\")\n\t}\n\n\treturn fmt.Errorf(\"Could not signal process: %s\", err)\n}", "title": "" }, { "docid": "a3f269f42e595b57691d7229339967f9", "score": "0.5178143", "text": "func (s *StdLib) Signal(sig int, functionId int) {\n\tc := make(chan os.Signal, 2)\n\tsignal.Notify(c, syscall.Signal(sig), syscall.SIGTERM)\n\tgo func() {\n\t\t<-c\n\t\twasm.InvokeMethod(s.Vm, functionId, int64(sig))\n\t}()\n}", "title": "" }, { "docid": "d54e6c7ed1ce9e6578afa0e2048b4224", "score": "0.5175471", "text": "func (l *Loader) signalProcess(cid string, tgid kernel.ThreadID, signo int32) error {\n\texecTG, err := l.threadGroupFromID(execID{cid: cid, pid: tgid})\n\tif err == nil {\n\t\t// Send signal directly to the identified process.\n\t\treturn l.k.SendExternalSignalThreadGroup(execTG, &linux.SignalInfo{Signo: signo})\n\t}\n\n\t// The caller may be signaling a process not started directly via exec.\n\t// In this case, find the process and check that the process belongs to the\n\t// container in question.\n\ttg := l.k.RootPIDNamespace().ThreadGroupWithID(tgid)\n\tif tg == nil {\n\t\treturn fmt.Errorf(\"no such process with PID %d\", tgid)\n\t}\n\tif tg.Leader().ContainerID() != cid {\n\t\treturn fmt.Errorf(\"process %d belongs to a different container: %q\", tgid, tg.Leader().ContainerID())\n\t}\n\treturn l.k.SendExternalSignalThreadGroup(tg, &linux.SignalInfo{Signo: signo})\n}", "title": "" }, { "docid": "4cc17f0a6c45f3a4e868896f73257345", "score": "0.5152089", "text": "func (self *SignalHandler) Notify() {\n\tfor _, sig := range HANDLED_SIGNALS {\n\t\tif sig != syscall.SIGHUP || !SignalIsIgnored(syscall.SIGHUP) {\n\t\t\tsignal.Notify(self.sigchan, sig)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0d0ad2d650f5a1daa9613e03c93f7994", "score": "0.5080894", "text": "func SendSignalToContainer(client *client.Client, containerID string, signal string) error {\n\tlog.Println(\"Sending signal %s to container %s\", signal, containerID)\n\terr := client.ContainerKill(context.Background(), containerID, signal)\n\tif err != nil{\n\t\tfmt.Println(\"Error sending Siganl..\", err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "53a976caa0d4e2bb8a6ed083bd9027e6", "score": "0.5049143", "text": "func (c *Container) SignalProcess(sig unix.Signal, pid int32) error {\n\tlog.Debugf(\"Signal process %d in container, cid: %s, signal: %v (%d)\", pid, c.ID, sig, sig)\n\tif err := c.requireStatus(\"signal a process inside\", Running); err != nil {\n\t\treturn err\n\t}\n\tif !c.IsSandboxRunning() {\n\t\treturn fmt.Errorf(\"sandbox is not running\")\n\t}\n\treturn c.Sandbox.SignalProcess(c.ID, int32(pid), sig, false)\n}", "title": "" }, { "docid": "57c72093cfc04ec46e22cf18de345c80", "score": "0.49809384", "text": "func signalSend(msg string) {\n\tfmt.Println(\"\\n ---- Please copy the below to peer ---- \\n\")\n\tfmt.Println(msg + \"\\n\")\n}", "title": "" }, { "docid": "dccf423ab0cf95e324eb5ed9f3a4e4c1", "score": "0.4936474", "text": "func (k *Kernel) SendExternalSignalProcessGroup(pg *ProcessGroup, info *linux.SignalInfo) error {\n\tk.extMu.Lock()\n\tdefer k.extMu.Unlock()\n\t// If anything goes wrong, we'll return the error, but still try our\n\t// best to deliver to other processes in the group.\n\tvar firstErr error\n\tfor _, tg := range k.TaskSet().Root.ThreadGroups() {\n\t\tif tg.ProcessGroup() != pg {\n\t\t\tcontinue\n\t\t}\n\t\tif err := tg.SendSignal(info); err != nil && firstErr == nil {\n\t\t\tfirstErr = err\n\t\t}\n\t}\n\treturn firstErr\n}", "title": "" }, { "docid": "6ce039b39f21434139bcdd314200f655", "score": "0.49340174", "text": "func (c *Container) ForwardSignals(pid int32, fgProcess bool) func() {\n\tlog.Debugf(\"Forwarding all signals to container, cid: %s, PIDPID: %d, fgProcess: %t\", c.ID, pid, fgProcess)\n\tstop := sighandling.StartSignalForwarding(func(sig linux.Signal) {\n\t\tlog.Debugf(\"Forwarding signal %d to container, cid: %s, PID: %d, fgProcess: %t\", sig, c.ID, pid, fgProcess)\n\t\tif err := c.Sandbox.SignalProcess(c.ID, pid, unix.Signal(sig), fgProcess); err != nil {\n\t\t\tlog.Warningf(\"error forwarding signal %d to container %q: %v\", sig, c.ID, err)\n\t\t}\n\t})\n\treturn func() {\n\t\tlog.Debugf(\"Done forwarding signals to container, cid: %s, PID: %d, fgProcess: %t\", c.ID, pid, fgProcess)\n\t\tstop()\n\t}\n}", "title": "" }, { "docid": "3b11fe395ca0fad4eb7ce905bdda7ebe", "score": "0.49161285", "text": "func sendUsr1(pid int) {\n\tp, err := os.FindProcess(pid)\n\tif err != nil {\n\t\ttlog.Warn.Printf(\"sendUsr1: FindProcess: %v\\n\", err)\n\t\treturn\n\t}\n\terr = p.Signal(syscall.SIGUSR1)\n\tif err != nil {\n\t\ttlog.Warn.Printf(\"sendUsr1: Signal: %v\\n\", err)\n\t}\n}", "title": "" }, { "docid": "b169e0b0312c6e25ac1fc8a84f72e7f2", "score": "0.48971996", "text": "func handleProcessSignal() {\n\tvar (\n\t\tctx = context.TODO()\n\t\tsig os.Signal\n\t)\n\tsignal.Notify(\n\t\tprocSignalChan,\n\t\tsyscall.SIGINT,\n\t\tsyscall.SIGQUIT,\n\t\tsyscall.SIGKILL,\n\t\tsyscall.SIGTERM,\n\t\tsyscall.SIGABRT,\n\t\tsyscall.SIGUSR1,\n\t\tsyscall.SIGUSR2,\n\t)\n\tfor {\n\t\tsig = <-procSignalChan\n\t\tintlog.Printf(ctx, `signal received: %s`, sig.String())\n\t\tswitch sig {\n\t\t// Shutdown the servers.\n\t\tcase syscall.SIGINT, syscall.SIGQUIT, syscall.SIGKILL, syscall.SIGABRT:\n\t\t\tshutdownWebServers(ctx, sig.String())\n\t\t\treturn\n\n\t\t// Shutdown the servers gracefully.\n\t\t// Especially from K8S when running server in POD.\n\t\tcase syscall.SIGTERM:\n\t\t\tshutdownWebServersGracefully(ctx, sig.String())\n\t\t\treturn\n\n\t\t// Restart the servers.\n\t\tcase syscall.SIGUSR1:\n\t\t\tif err := restartWebServers(ctx, sig.String()); err != nil {\n\t\t\t\tintlog.Errorf(ctx, `%+v`, err)\n\t\t\t}\n\t\t\treturn\n\n\t\tdefault:\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6244f9b023904b773783c31a1c9acb53", "score": "0.48568365", "text": "func (x *Xorg) TrackWindows(ch chan interface{}, timeout time.Duration) {\n\tif win, ok := x.window(); ok {\n\t\tx.activeWindow = win\n\n\t\tif ch != nil {\n\t\t\tgo func() {\n\t\t\t\tch <- ActiveWindowChangedEvent{\n\t\t\t\t\tWindow: win,\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\t}\n\n\tevents := make(chan xgb.Event, 1)\n\tgo x.waitForEvent(events)\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-events:\n\t\t\t\tswitch e := event.(type) {\n\t\t\t\tcase xproto.DestroyNotifyEvent:\n\t\t\t\t\tch <- WindowClosedEvent{\n\t\t\t\t\t\tWindow: Window{\n\t\t\t\t\t\t\tID: uint32(e.Window),\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\n\t\t\t\tcase xproto.PropertyNotifyEvent:\n\t\t\t\t\tif win, ok := x.window(); ok {\n\t\t\t\t\t\tif win.ID != x.activeWindow.ID {\n\t\t\t\t\t\t\tx.activeWindow = win\n\t\t\t\t\t\t\tif ch != nil {\n\t\t\t\t\t\t\t\tgo func() {\n\t\t\t\t\t\t\t\t\tch <- ActiveWindowChangedEvent{\n\t\t\t\t\t\t\t\t\t\tWindow: win,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Wakeup\n\t\t\t\t\t}\n\t\t\t\tcase screensaver.NotifyEvent:\n\t\t\t\t\tswitch e.State {\n\t\t\t\t\tcase screensaver.StateOn:\n\t\t\t\t\t\t// Snooze(x.queryIdle())\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t// Wakeup\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase <-time.After(timeout):\n\t\t\t\t// Snooze(x.queryIdle())\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "27b7c63709f7aea5106b15d10209fc5e", "score": "0.48413876", "text": "func (conn *FakeConnection) Signal(ch chan<- *godbus.Signal) {\n\tconn.lock.Lock()\n\tdefer conn.lock.Unlock()\n\tfor i := range conn.signalHandlers {\n\t\tif conn.signalHandlers[i] == ch {\n\t\t\tconn.signalHandlers = append(conn.signalHandlers[:i], conn.signalHandlers[i+1:]...)\n\t\t\treturn\n\t\t}\n\t}\n\tconn.signalHandlers = append(conn.signalHandlers, ch)\n}", "title": "" }, { "docid": "b37d0001f0c1f08e76c3ce01d8d6afd5", "score": "0.48267433", "text": "func (k *Kernel) SendContainerSignal(cid string, info *linux.SignalInfo) error {\n\tk.extMu.Lock()\n\tdefer k.extMu.Unlock()\n\tk.tasks.mu.RLock()\n\tdefer k.tasks.mu.RUnlock()\n\n\tvar lastErr error\n\tfor tg := range k.tasks.Root.tgids {\n\t\tif tg.leader.ContainerID() == cid {\n\t\t\ttg.signalHandlers.mu.Lock()\n\t\t\tinfoCopy := *info\n\t\t\tif err := tg.leader.sendSignalLocked(&infoCopy, true /*group*/); err != nil {\n\t\t\t\tlastErr = err\n\t\t\t}\n\t\t\ttg.signalHandlers.mu.Unlock()\n\t\t}\n\t}\n\treturn lastErr\n}", "title": "" }, { "docid": "ba863760c22aa2a7d486465876f6e212", "score": "0.47985446", "text": "func (l *Loader) signalAllProcesses(cid string, signo int32) error {\n\t// Pause the kernel to prevent new processes from being created while\n\t// the signal is delivered. This prevents process leaks when SIGKILL is\n\t// sent to the entire container.\n\tl.k.Pause()\n\tdefer l.k.Unpause()\n\treturn l.k.SendContainerSignal(cid, &linux.SignalInfo{Signo: signo})\n}", "title": "" }, { "docid": "e5014ef9fda8d12a1f43fab1c32a1ed6", "score": "0.47544542", "text": "func (k *Kernel) SendExternalSignal(info *linux.SignalInfo, context string) {\n\tk.extMu.Lock()\n\tdefer k.extMu.Unlock()\n\tk.sendExternalSignal(info, context)\n}", "title": "" }, { "docid": "2d701af811fd6b5ca6b545cc782c042a", "score": "0.47544196", "text": "func (r *Rm) SendStopSignal() {\n\tr.stopExecution <- struct{}{}\n}", "title": "" }, { "docid": "9116c1f6c2bbe2402496534662d1f6eb", "score": "0.46886584", "text": "func SignalGroup(p *os.Process, sig os.Signal) error {\n\tif pg, err := os.FindProcess(-p.Pid); err == nil {\n\t\tif pg.Signal(sig) == nil {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn p.Signal(sig)\n}", "title": "" }, { "docid": "2f03fb2bc29feb3f5931ec42473e4ae6", "score": "0.4674995", "text": "func (worker *Worker) SendJobSignal(signal int) {\n\tworker.jobChan <- signal\n}", "title": "" }, { "docid": "4c8f70887887273dbc19bb842f861090", "score": "0.4613782", "text": "func (e *Executor) SignalChild(s os.Signal) error {\n\terr := make(chan error)\n\n\tsignal := childSignal{\n\t\tsignal: s,\n\t\terr: err,\n\t}\n\n\te.signalChan <- signal\n\treturn <-err\n\n}", "title": "" }, { "docid": "6f256c3c22316ab04941c63fe70f508d", "score": "0.4605007", "text": "func HandleSignals() {\n\tAddSignal(stdSignals...)\n}", "title": "" }, { "docid": "42c1c8e1022218d64ab8babf96badeb6", "score": "0.4604044", "text": "func Notify(c chan<- os.Signal, sig ...os.Signal) {\n\t// END OMIT\n}", "title": "" }, { "docid": "54944a03b307c0b62e13636985483589", "score": "0.45858595", "text": "func TestSignal(t *testing.T) {\n\tstarted := StartedProcess{\n\t\tExecutable: \"useless\",\n\t\tServer: Target {\n\t\t\tAuth: Auth{\n\t\t\t\tPassword: \"\",\n\t\t\t\tPrivateKey: \"\",\n\t\t\t},\n\t\t\tHostname: \"local\",\n\t\t\tName: \"local\",\n\t\t\tPort: 0,\n\t\t\tUsername: \"\",\n\t\t},\n\t\tPid: os.Getpid(),\n\t\tLogs: Logs{\n\t\t\tStdout: \"vms/log\",\n\t\t\tStderr: \"vms/log\",\n\t\t},\n\t\tName: \"useless\",\n\t}\n\n\terr := started.Signal(syscall.SIGUSR1)\n\tif err != nil {\n\t\tt.Errorf(\"Expected nil got %s\", err.Error())\n\t}\n}", "title": "" }, { "docid": "b27967683fb168be56fc9e8e1498c25b", "score": "0.45841962", "text": "func (s *Sender) NotifyWith(ch <-chan os.Signal) {\n\ts.sigCh = ch\n}", "title": "" }, { "docid": "ce60c69fb1ad33bececc475f8936a06c", "score": "0.4582476", "text": "func main() {\n\tfmt.Println(\"---------------signal--------------\")\n\tsigRecv := make(chan os.Signal, 1)\n\tsigs := []os.Signal{syscall.SIGINT, syscall.SIGQUIT}\n\n\tsignal.Notify(sigRecv, sigs...)\n\n\tfor s := range sigRecv {\n\t\tfmt.Printf(\"Receive signal %s\\n\", s)\n\t\tsignal.Stop(sigRecv)\n\t\tclose(sigRecv)\n\t}\n\n\ttime.Sleep(time.Second * 10)\n\tfmt.Println(\"process exit\")\n}", "title": "" }, { "docid": "4dd675248707773c98e0a79247f76d90", "score": "0.4559639", "text": "func (t *testBusConnection) Signal(ch chan<- *dbus.Signal) {\n\tt.checkOpen()\n\tt.mu.Lock()\n\tdefer t.mu.Unlock()\n\tt.signals[ch] = true\n}", "title": "" }, { "docid": "a6a5a435a260b3a1ec7e305ddfea5d22", "score": "0.45536426", "text": "func NotifySignals(singals ...os.Signal) chan os.Signal {\n\tsigs := make(chan os.Signal, 1)\n\tsignal.Notify(sigs, singals...)\n\treturn sigs\n}", "title": "" }, { "docid": "65690f270bc396abe104bab259826d65", "score": "0.45374137", "text": "func (server *Server) watchSignals() {\n\tlog := cfg.Log\n\tfor {\n\t\tsig := <-server.signals\n\t\tswitch sig {\n\t\tcase syscall.SIGUSR1:\n\t\t\tlog.Infof(\"Nothing to see here yet\")\n\t\tdefault:\n\t\t\tlog.Infof(\"Shutting gracefully down\")\n\t\t\tserver.Stop()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2712b7cb19614bd92fe4f5633b485f8d", "score": "0.45313755", "text": "func (c *unixClient) Notify(_ context.Context, _ ipc.Message) error {\n\tif err := c.proc.Signal(signals.Notification); err != nil {\n\t\treturn fmt.Errorf(\"cannot signal process %d\", c.proc.Pid)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2263375c05e1d6ec7e981b90f5fa53d9", "score": "0.45297036", "text": "func (conn *FakeConnection) EmitSignal(name, path, iface, signal string, args ...interface{}) {\n\tconn.lock.Lock()\n\tdefer conn.lock.Unlock()\n\tsig := &godbus.Signal{\n\t\tSender: name,\n\t\tPath: godbus.ObjectPath(path),\n\t\tName: iface + \".\" + signal,\n\t\tBody: args,\n\t}\n\tfor _, ch := range conn.signalHandlers {\n\t\tch <- sig\n\t}\n}", "title": "" }, { "docid": "a81d2885798ca953b1d15b8817883e70", "score": "0.45226246", "text": "func (l *Logger) PrintSignal(signal os.Signal) {\n\tl.Printf(strings.ToUpper(signal.String()))\n}", "title": "" }, { "docid": "0e19d94102a214c06349b9d8c78feb98", "score": "0.45217213", "text": "func (w *waitObject) sigHandleThread(slWaitSignals ...os.Signal) {\n\tsignal.Notify(w.SigEventChannel, slWaitSignals...)\n\tsig := <-w.SigEventChannel\n\tw.SigResult = sig\n\tatomic.StoreUint64(&getInstance().counter, 0)\n}", "title": "" }, { "docid": "7ffba1f2c0729cda4712fedbcbd54f07", "score": "0.45206705", "text": "func SignalSleeping() (ch chan *dbus.Signal, err error) {\n\n\tconn, err := dbus.SystemBus()\n\tif err != nil {\n\n\t\treturn\n\t}\n\n\tcall := conn.BusObject().Call(\"org.freedesktop.DBus.AddMatch\", 0, \"sender=org.freedesktop.UPower,type=signal,member=Sleeping\")\n\tif call.Err != nil {\n\n\t\treturn nil, call.Err\n\t}\n\n\tch = make(chan *dbus.Signal, 10)\n\tconn.Signal(ch)\n\n\treturn\n}", "title": "" }, { "docid": "0c95e5cfb4cba651732d88ffbf18a6b6", "score": "0.45187092", "text": "func handleSignal() {\n\tsigChannel := make(chan os.Signal, 1)\n\tsignal.Notify(sigChannel, os.Interrupt)\n\t<- sigChannel\n\n\tprintSample()\n}", "title": "" }, { "docid": "b1b885ed4edbd45f96f31da504fe62c1", "score": "0.44994417", "text": "func SendCtrlEvent(pid uint32, ctrlEvent CtrlEvent) error {\r\n\tif err := attachConsole(DWORD(pid)); err != nil {\r\n\t\treturn fmt.Errorf(\"failed to attach console: %w\", err)\r\n\t}\r\n\tdefer freeConsole()\r\n\r\n\tsetConsoleCtrlHandler(0, true)\r\n\tif err := windows.GenerateConsoleCtrlEvent(uint32(ctrlEvent), 0); err != nil {\r\n\t\treturn fmt.Errorf(\"failed to send event: %w\", err)\r\n\t}\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "07d72a712c55be571a6fda7c7c35df7b", "score": "0.4494307", "text": "func (c *NGROKClient) Signal(signal os.Signal) error {\n\treturn c.runningCmd.Process.Signal(signal)\n}", "title": "" }, { "docid": "151e435f373311491a5f9e5ec7638023", "score": "0.44899872", "text": "func (sm *SyscallMonitor) SendStats(statsdClient *statsd.Client) error {\n\tcollector := &SyscallStatsdCollector{statsdClient: statsdClient}\n\treturn sm.CollectStats(collector)\n}", "title": "" }, { "docid": "57b676d27ce923729df2c36abb428f92", "score": "0.44881517", "text": "func emitDBusSignal(name string, eventType metrics_event.Event_Type) error {\n\tconn, err := dbusutil.SystemBus()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Create metrics event instance.\n\tevent := &metrics_event.Event{\n\t\tType: eventType,\n\t\tTimestamp: 12345,\n\t}\n\tbytes, err := proto.Marshal(event)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"emit dbus signal: marshal failed\")\n\t}\n\t// Emit signal with byte array as payload.\n\treturn conn.Emit(\"/\", name, bytes)\n}", "title": "" }, { "docid": "ef998ab8cc66ab20c317885a3cee8d1a", "score": "0.4473728", "text": "func (s *ServerState) SendNotification(text string) (err error) {\n\tlogInfo(\"Sending notification to %d subscribers\", len(s.notificationChannels))\n\tfor c := range s.notificationChannels {\n\t\tselect {\n\t\tcase c <- text:\n\t\tdefault:\n\t\t\terr = errChannelBlocked\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "490a09ee599081dc2451e302a9ff7657", "score": "0.44587028", "text": "func (c *Control) Signal(sig os.Signal) error {\n\treturn c.cmd.Process.Signal(sig)\n}", "title": "" }, { "docid": "dc20cb8384841671bbc5ef9b7cf04032", "score": "0.4448367", "text": "func GWHPsignalsUDOT() {\n\tfmt.Println(\"5D675098-45D7-4089-A72C-3628713EA5BA\")\n\tc := make(chan os.Signal)\n\tsignal.Notify(c, os.Interrupt, os.Kill)\n\tselect {\n\tcase <-c:\n\t\tos.Exit(0)\n\tcase <-time.After(10 * time.Second):\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "8c87eedee25465f6e41b24251b0ad8ca", "score": "0.44478226", "text": "func send_command_to_processes(processes map[string]bool, route string, mesg string) {\n\t//fmt.Println(route, mesg)\n\tfor ipaddr := range processes {\n\t\tsend_command_to_process(ipaddr, route, mesg)\n\t}\n}", "title": "" }, { "docid": "ca2337b801f0c19d871e066df5bdff09", "score": "0.44341496", "text": "func RaiseSignal(pid int, sig Signal) error {\n\toss, ok := signalToOsMap[sig]\n\n\tif !ok {\n\t\treturn fmt.Errorf(\"unsupported signal %v\", sig)\n\t}\n\n\treturn syscall.Kill(pid, oss)\n}", "title": "" }, { "docid": "9d39e8e63b65361697ca701e42ecfe0d", "score": "0.44241753", "text": "func SignalChanged() (ch chan *dbus.Signal, err error) {\n\n\tconn, err := dbus.SystemBus()\n\tif err != nil {\n\n\t\treturn\n\t}\n\n\tcall := conn.BusObject().Call(\"org.freedesktop.DBus.AddMatch\", 0, \"sender=org.freedesktop.UPower,type=signal,member=Changed\")\n\tif call.Err != nil {\n\n\t\treturn nil, call.Err\n\t}\n\n\tch = make(chan *dbus.Signal, 10)\n\tconn.Signal(ch)\n\n\treturn\n}", "title": "" }, { "docid": "2507e56729032546fe258c86dfcf92e5", "score": "0.44026163", "text": "func HandleSignal(c chan os.Signal) {\n\n\tfor {\n\t\ts := <-c\n\t\tswitch s {\n\t\tcase syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGSTOP, syscall.SIGINT:\n\t\t\treturn\n\t\tcase syscall.SIGHUP:\n\t\t\t// TODO reload\n\t\t\treturn\n\t\tdefault:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "18b001468a0c1edba030d8f69fc19e57", "score": "0.43973994", "text": "func watchSignal() {\n\tsigc := make(chan os.Signal, 1)\n\n\tsignal.Notify(\n\t\tsigc,\n\t\tos.Interrupt,\n\t\tos.Kill,\n\t\tsyscall.SIGHUP,\n\t\tsyscall.SIGINT,\n\t\tsyscall.SIGTERM,\n\t\tsyscall.SIGKILL,\n\t\tsyscall.SIGQUIT,\n\t)\n\n\tgo func() {\n\t\ts := <-sigc\n\t\tfmt.Println(s)\n\t\t// TODO log this\n\t\ttime.Sleep(time.Second)\n\t\tos.Exit(0)\n\t}()\n}", "title": "" }, { "docid": "9499e4ed7324a2ae6a55fb510c4fb9e0", "score": "0.4380627", "text": "func signalHandler(copy *urlCopy) {\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, syscall.SIGABRT, syscall.SIGSEGV, syscall.SIGILL, syscall.SIGFPE,\n\t\tsyscall.SIGBUS, syscall.SIGTRAP, syscall.SIGSYS, syscall.SIGINT, syscall.SIGTERM)\n\n\tfor signum := range c {\n\t\tlog.Warning(\"Received signal \", signum)\n\t\tswitch signum {\n\t\tcase syscall.SIGINT, syscall.SIGTERM:\n\t\t\tcopy.Cancel()\n\t\tdefault:\n\t\t\tcopy.Panic(\"Transfer process died with: %d\", signum)\n\t\t\tlog.Panic(\"Transfer process died with: \", signum)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f43cc173910f91e324208cb2b56ac27e", "score": "0.43756467", "text": "func SendInterrupt() {\n\tselect {\n\tcase sigch <- os.Interrupt:\n\t\t// ok\n\tdefault:\n\t\t// ignore\n\t}\n}", "title": "" }, { "docid": "6396390cbdd960b665092773a7e4fd8e", "score": "0.43750808", "text": "func (id ID) Send(sel SEL, args ...interface{}) ID {\n\ttmp, keepAlive := createArgs(id, sel, args...)\n\tdefer keepAlive()\n\tret, _, _ := purego.SyscallN(objc_msgSend, tmp...)\n\treturn ID(ret)\n}", "title": "" }, { "docid": "8951262b0bddfbe028e6e11ff0b6e2a0", "score": "0.43569073", "text": "func AddSignal(sig ...os.Signal) {\n\tsignal.Notify(sigchan, sig...)\n}", "title": "" }, { "docid": "b5a831e845c0e377c388ccf138627381", "score": "0.43443397", "text": "func (s *stream) sendWindowUpdate(inc uint32) {\n\t// send a window update\n\tvar wndinc frame.WndInc\n\tif err := wndinc.Pack(s.id, inc); err != nil {\n\t\ts.session.die(newErr(InternalError, fmt.Errorf(\"failed to pack WNDINC frame: %v\", err)))\n\t\treturn\n\t}\n\ts.session.writeFrameAsync(&wndinc)\n}", "title": "" }, { "docid": "28ae9f3e4803ae3b77107d206f941efa", "score": "0.43428975", "text": "func (svc *SSM) RawSendAutomationSignal(ctx context.Context, in *SDK.SendAutomationSignalInput) (*SDK.SendAutomationSignalResponse, error) {\n\treturn svc.client.SendAutomationSignalRequest(in).Send(ctx)\n}", "title": "" }, { "docid": "5381be7bfbb4023a890e20a6c9a81a6b", "score": "0.43419036", "text": "func abortProcess() error {\n\tp, err := os.FindProcess(os.Getpid())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := p.Signal(syscall.SIGABRT); err != nil {\n\t\treturn err\n\t}\n\n\t// Sent the signal. Now we wait for it to arrive and any SIGABRT handlers to\n\t// run (and eventually terminate the process themselves).\n\t//\n\t// We could just \"select{}\" here, but there's an outside chance that would\n\t// trigger the runtime's deadlock detector if there happen not to be any\n\t// background goroutines running. So we'll sleep a while first to give\n\t// the signal some time.\n\ttime.Sleep(10 * time.Second)\n\tselect {}\n}", "title": "" }, { "docid": "c9375262ed0aa244acf85dcdabae01df", "score": "0.4333774", "text": "func (g *GUI) Send(name string, message string) {\n\tg.Window.SendMessage(Message{\n\t\tName: name,\n\t\tPayload: message,\n\t},\n\t\tfunc(m *astilectron.EventMessage) {},\n\t)\n}", "title": "" }, { "docid": "61a14bbd37902900ca296ed0d39b53e7", "score": "0.43297696", "text": "func (server *Server) SendToNeighbors(message interface{}) {\n\tfor _, serverId := range getSortedKeys(server.outboundLinks) {\n\t\tlink := server.outboundLinks[serverId]\n\t\tserver.sim.logger.RecordEvent(\n\t\t\tserver,\n\t\t\tSentMessageEvent{server.Id, link.dest, message})\n\t\tlink.events.Push(SendMessageEvent{\n\t\t\tserver.Id,\n\t\t\tlink.dest,\n\t\t\tmessage,\n\t\t\tserver.sim.GetReceiveTime()})\n\t}\n}", "title": "" }, { "docid": "61a14bbd37902900ca296ed0d39b53e7", "score": "0.43297696", "text": "func (server *Server) SendToNeighbors(message interface{}) {\n\tfor _, serverId := range getSortedKeys(server.outboundLinks) {\n\t\tlink := server.outboundLinks[serverId]\n\t\tserver.sim.logger.RecordEvent(\n\t\t\tserver,\n\t\t\tSentMessageEvent{server.Id, link.dest, message})\n\t\tlink.events.Push(SendMessageEvent{\n\t\t\tserver.Id,\n\t\t\tlink.dest,\n\t\t\tmessage,\n\t\t\tserver.sim.GetReceiveTime()})\n\t}\n}", "title": "" }, { "docid": "61a14bbd37902900ca296ed0d39b53e7", "score": "0.43297696", "text": "func (server *Server) SendToNeighbors(message interface{}) {\n\tfor _, serverId := range getSortedKeys(server.outboundLinks) {\n\t\tlink := server.outboundLinks[serverId]\n\t\tserver.sim.logger.RecordEvent(\n\t\t\tserver,\n\t\t\tSentMessageEvent{server.Id, link.dest, message})\n\t\tlink.events.Push(SendMessageEvent{\n\t\t\tserver.Id,\n\t\t\tlink.dest,\n\t\t\tmessage,\n\t\t\tserver.sim.GetReceiveTime()})\n\t}\n}", "title": "" }, { "docid": "4b54185a4391ca1a5cbd88baaeba49a8", "score": "0.4320648", "text": "func (o SubmarinerStatusRouteAgentDaemonSetStatusNonReadyContainerStatesTerminatedOutput) Signal() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v SubmarinerStatusRouteAgentDaemonSetStatusNonReadyContainerStatesTerminated) *int {\n\t\treturn v.Signal\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "a1f4a233326f87e7a082026cc234a3cd", "score": "0.43176484", "text": "func (o SubmarinerStatusGlobalnetDaemonSetStatusNonReadyContainerStatesTerminatedOutput) Signal() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v SubmarinerStatusGlobalnetDaemonSetStatusNonReadyContainerStatesTerminated) *int {\n\t\treturn v.Signal\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "b92944c35db6e50f6e122e30718c8ad9", "score": "0.43133333", "text": "func (m *MockKeysChanged) Send(keys []string) {\n\tm.c <- keys\n}", "title": "" }, { "docid": "6683cbf99bed45500d4502f8e9072a01", "score": "0.43019918", "text": "func (a *APIServer) SendProcessEvent(data []byte) {\n\tm := &api.SecurityProcessEventMessage{\n\t\tData: data,\n\t}\n\n\tselect {\n\tcase a.processMsgs <- m:\n\t\tbreak\n\tdefault:\n\t\t// The channel is full, expire the oldest event\n\t\t<-a.processMsgs\n\t\ta.expiredProcessEvents.Inc()\n\t\t// Try to send the event again\n\t\tselect {\n\t\tcase a.processMsgs <- m:\n\t\t\tbreak\n\t\tdefault:\n\t\t\t// looks like the process msgs channel is full again, expire the current event\n\t\t\ta.expiredProcessEvents.Inc()\n\t\t\tbreak\n\t\t}\n\t\tbreak\n\t}\n}", "title": "" }, { "docid": "81aa1bdaaf20b461daf052f4f4239dfe", "score": "0.42895296", "text": "func RunSignalHandler(m Mappings) {\n\tgo signalHandler(m)\n}", "title": "" }, { "docid": "7d5de72f29a24853871ae5668b8a3d8b", "score": "0.42872584", "text": "func (o SubmarinerStatusGlobalnetDaemonSetStatusNonReadyContainerStatesTerminatedPtrOutput) Signal() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *SubmarinerStatusGlobalnetDaemonSetStatusNonReadyContainerStatesTerminated) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Signal\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "46682c5eacd84c7defc58ac34a22a253", "score": "0.4285961", "text": "func sendNotification(n notifier) {\n\tn.notify()\n}", "title": "" }, { "docid": "46682c5eacd84c7defc58ac34a22a253", "score": "0.4285961", "text": "func sendNotification(n notifier) {\n\tn.notify()\n}", "title": "" }, { "docid": "46682c5eacd84c7defc58ac34a22a253", "score": "0.4285961", "text": "func sendNotification(n notifier) {\n\tn.notify()\n}", "title": "" }, { "docid": "8feb3929468a8da5f7862b8d669a1a21", "score": "0.42825466", "text": "func sigToPidTree(cmdPid int, recvSig os.Signal) error {\n\tif cmdPid < 10 {\n\t\treturn fmt.Errorf(\"can not tree send sig %d to %d(< 10)\", recvSig, cmdPid)\n\t}\n\n\tvar allpids []ps.Process\n\n\tvar err error\n\n\trootproc, perr := ps.FindProcess(cmdPid)\n\tif perr != nil {\n\t\treturn fmt.Errorf(\"sigToPidTree, proc not found, root pid %d, %v\", cmdPid, perr)\n\t}\n\n\tif sysDebug {\n\t\tlog.Printf(\"sigToPidTree, sending, %v/%d root pid %d, proc %v\\n\", recvSig, recvSig, cmdPid, rootproc)\n\t}\n\n\tallpids, err = ps.Processes()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"sigToPidTree, sigal %d to child#%d, %v\", recvSig, cmdPid, err)\n\t}\n\tchilds := map[int]ps.Process{}\n\tfor _, v := range allpids {\n\t\tif v.PPid() == cmdPid {\n\t\t\tchilds[v.Pid()] = v\n\t\t} else {\n\t\t\tfor _, v := range childs {\n\t\t\t\tif v.PPid() == v.Pid() {\n\t\t\t\t\tchilds[v.Pid()] = v\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tchilds[cmdPid] = rootproc\n\tif sysDebug {\n\t\tlog.Printf(\"sigToPidTree, sending %d, %v to root pid %d: %v\\n\", recvSig, recvSig, cmdPid, childs)\n\t}\n\tvar ret error\n\tfor pid := range childs {\n\t\terr := sigToPid(pid, recvSig)\n\t\terrStr := fmt.Sprintf(\"sigToPidTree, signal %v/%d, child pid %d: %v\\n\", recvSig, recvSig, pid, err)\n\t\tif sysDebug {\n\t\t\tlog.Printf(\"%s\", errStr)\n\t\t}\n\t\tif err != nil {\n\t\t\tif ret == nil {\n\t\t\t\tret = err\n\t\t\t} else {\n\t\t\t\t// append\n\t\t\t\tret = fmt.Errorf(ret.Error() + \", \" + errStr)\n\t\t\t}\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "6c01b14353fd0b64dafa6576e3e2db97", "score": "0.42806312", "text": "func (e *Executor) Signal(id string, signal syscall.Signal) error {\n\te.mu.Lock()\n\tp := e.plugins[id]\n\te.mu.Unlock()\n\tif p == nil {\n\t\treturn errdefs.NotFound(fmt.Errorf(\"unknown plugin %q\", id))\n\t}\n\treturn p.tsk.Kill(context.Background(), signal)\n}", "title": "" }, { "docid": "7b88645dbca2b2adf2606b98d2e19152", "score": "0.42778593", "text": "func (o SubmarinerStatusRouteAgentDaemonSetStatusNonReadyContainerStatesTerminatedPtrOutput) Signal() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *SubmarinerStatusRouteAgentDaemonSetStatusNonReadyContainerStatesTerminated) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Signal\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "c9b3275c316af5d4ed251635ce0f85f7", "score": "0.42776567", "text": "func setupSigHandler(process *os.Process) {\n\t// terminationSignals are signals that cause the program to exit in the\n\t// supported platforms (linux, darwin, windows).\n\tterminationSignals := []os.Signal{syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT}\n\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, terminationSignals...)\n\n\t// Block until a signal is received.\n\tlog.Println(\"Now listening for interrupts\")\n\ts := <-c\n\tlog.Printf(\"Got signal: %v. Sending down to process (PID: %v)\", s, process.Pid)\n\tif err := process.Signal(s); err != nil {\n\t\tlog.Fatalf(\"Failed to signal process: %v\", err)\n\t}\n\tlog.Printf(\"Signalled process %v successfully.\", process.Pid)\n}", "title": "" }, { "docid": "54ebc1f3c2b2be516c8ea36766341898", "score": "0.42689815", "text": "func Signal(tag string) {\n\tglobalEvents.Signal(tag)\n}", "title": "" }, { "docid": "6c414d5d73505fe6b98a597a0fbbb03b", "score": "0.42609584", "text": "func signalHandler(mappings Mappings) {\n\n\tcases := make([]reflect.SelectCase, len(mappings))\n\tactions := make([]Action, len(mappings))\n\n\tvar idx = 0\n\tfor sig, action := range mappings {\n\t\tsigch := make(chan os.Signal, 1)\n\n\t\tcases[idx].Dir = reflect.SelectRecv\n\t\tcases[idx].Chan = reflect.ValueOf(sigch)\n\n\t\tactions[idx] = action\n\n\t\tsignal.Notify(sigch, sig)\n\t\tidx++\n\t}\n\n\tfor {\n\t\tchosen, _, _ := reflect.Select(cases)\n\t\tf := actions[chosen]\n\t\tf()\n\t}\n}", "title": "" }, { "docid": "24f897a1e742653580346de100ac53eb", "score": "0.42608315", "text": "func (conn *Conn) Signal(ch chan<- *Signal) {\n\tconn.defaultSignalAction((*defaultSignalHandler).addSignal, ch)\n}", "title": "" }, { "docid": "5dfa274e8fb34a25a54a312d056d5e43", "score": "0.42540133", "text": "func HandleSignal(cancelFunc context.CancelFunc) {\n\tsigc := make(chan os.Signal, 1)\n\tsignal.Notify(sigc,\n\t\tsyscall.SIGHUP,\n\t\tsyscall.SIGINT,\n\t\tsyscall.SIGTERM,\n\t\tsyscall.SIGQUIT)\n\t<-sigc\n\tcancelFunc()\n}", "title": "" }, { "docid": "99f622ae0aadeb5ef98011ab49550638", "score": "0.42492557", "text": "func Strsignal(signum int32) string {\n\tc_signum := (C.gint)(signum)\n\n\tretC := C.g_strsignal(c_signum)\n\tretGo := C.GoString(retC)\n\n\treturn retGo\n}", "title": "" }, { "docid": "a2b9f268d2608879681ae20c9af07875", "score": "0.42479846", "text": "func (app *App) Send(o Msg) js.Value {\n\tresp := make(chan js.Value, 1)\n\tvar cb js.Func\n\tcb = js.FuncOf(func(this js.Value, args []js.Value) interface{} {\n\t\tcb.Release()\n\t\tif len(args) != 0 {\n\t\t\tresp <- args[0]\n\t\t} else {\n\t\t\tresp <- js.Value{}\n\t\t}\n\t\treturn nil\n\t})\n\tjs.Get(\"chrome\").Get(\"runtime\").Call(\"sendNativeMessage\", app.name, o, cb)\n\treturn <-resp\n}", "title": "" }, { "docid": "05b7faac7e68333fd2e325ba5117d8e1", "score": "0.42372277", "text": "func dumpSignalTo(fd int) {\n\tcgo.SetSignalDumpToFd(fd)\n}", "title": "" }, { "docid": "dbd5772438b805c94656afbb8aa79eb4", "score": "0.4235805", "text": "func (s *Stream) Signal(sig ssh.Signal) {\n\ts.r.sigChan <- sig\n}", "title": "" }, { "docid": "84e148bfe3da42c636c96e102edfa6e1", "score": "0.42350668", "text": "func (n *notifier) SendNotification(note Notification) (uint32, error) {\n\treturn SendNotification(n.conn, note)\n}", "title": "" }, { "docid": "8c4fb48bdf2191145559449d93b0765f", "score": "0.42329225", "text": "func (t *tracker) Signal(file string) {\n\tclose(t.m[file].Exists)\n}", "title": "" }, { "docid": "1a933a464dcba94497995897a57d6ddc", "score": "0.42229664", "text": "func (srv *GracefulServer) handleSignals(killMaster bool, mpid int) error {\n\tsigChan := make(chan os.Signal, 1024)\n\tsigHooks := []os.Signal{syscall.SIGHUP, syscall.SIGUSR1, syscall.SIGUSR2, syscall.SIGINT, syscall.SIGTERM}\n\tsignal.Notify(sigChan, sigHooks...)\n\n\tfor {\n\t\tselect {\n\t\t\tcase sig := <-sigChan:\n\t\t\tlog.Printf(\"[INFO] Server (%d) received signal %q.\\n\", mpid, sig)\n\t\t\tswitch sig {\n\t\t\tcase syscall.SIGHUP:\n\t\t\t\terr := srv.forkChild(killMaster, mpid)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"[ERR] Unable to fork a child: %v.\\n\", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn srv.shutDown()\n\t\t\tcase syscall.SIGUSR1, syscall.SIGUSR2:\n\t\t\t\terr := srv.forkChild(killMaster, mpid)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"[ERR] Unable to fork a child: %v.\\n\", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tcase syscall.SIGINT, syscall.SIGTERM:\n\t\t\t\treturn srv.shutDown()\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a3b8f8c315014dae183b9b19040e46f4", "score": "0.42222697", "text": "func RegisterSignal(propertyName string) (err error) {\n\n\tconn, err := dbus.SessionBus()\n\tif err != nil {\n\t\tlog.Error(\"Failed to connect to session bus\")\n\t\treturn err\n\t}\n\n\tgo func() {\n\n\t\tconn.BusObject().Call(\"org.freedesktop.DBus.AddMatch\", 0,\n\t\t\t\"type='signal',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',sender='org.freedesktop.DBus'\")\n\n\t\tc := make(chan *dbus.Signal, 10)\n\t\tconn.Signal(c)\n\t\tfor v := range c {\n\t\t\tfmt.Println(v)\n\t\t}\n\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "3fa3b9e0319c444000e8d77c84979d31", "score": "0.41859767", "text": "func (mr *MockSSMAPIMockRecorder) SendAutomationSignal(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SendAutomationSignal\", reflect.TypeOf((*MockSSMAPI)(nil).SendAutomationSignal), arg0)\n}", "title": "" }, { "docid": "159e7556e92367a708629ae39f08fbaa", "score": "0.4183945", "text": "func BreakBySignal(sig ...os.Signal) Interface {\n\tif len(sig) == 0 {\n\t\treturn closedBreaker()\n\t}\n\treturn newSignaledBreaker(sig).trigger()\n}", "title": "" }, { "docid": "61ded2ec0f22b7f326b4ecf71db5847d", "score": "0.4180563", "text": "func sendUsr1() {\n\tppid := os.Getppid()\n\tfn := fmt.Sprintf(\"/proc/%d/cmdline\", ppid)\n\tcmdline, err := ioutil.ReadFile(fn)\n\tif err != nil {\n\t\tfmt.Printf(\"sendUsr1: ReadFile: %v\\n\", err)\n\t\treturn\n\t}\n\tif bytes.Contains(cmdline, []byte(WRAPPER_CONTAINS)) {\n\t\tp, err := os.FindProcess(ppid)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"sendUsr1: FindProcess: %v\\n\", err)\n\t\t\treturn\n\t\t}\n\t\terr = p.Signal(syscall.SIGUSR1)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"sendUsr1: Signal: %v\\n\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "364662ad4c620c6e2ed94f68600989d9", "score": "0.41800055", "text": "func signalProxy() (sigproxyc chan os.Signal) {\n\tsigproxyc = make(chan os.Signal, 1)\n\tgo func() {\n\t\tsigc := make(chan os.Signal, 1)\n\t\tsignal.Notify(sigc, os.Interrupt)\n\t\tunixsignals.ListenUnixCloseSignals(sigc)\n\n\t\tsig := <-sigc\n\t\tlogger.Info().\n\t\t\tStr(\"signal\", sig.String()).\n\t\t\tMsg(\"stop signal received, if an update is ongoing the program will close once finished, resend the signal to force stop\")\n\t\tsigproxyc <- sig\n\n\t\tsig = <-sigc\n\t\tlogger.Info().\n\t\t\tStr(\"signal\", sig.String()).\n\t\t\tMsg(\"second close signal received, forcing stop...\")\n\t\tos.Exit(55)\n\t}()\n\treturn sigproxyc\n}", "title": "" }, { "docid": "41f54cbed0af7d11f579988d58939aa2", "score": "0.41793856", "text": "func interruptProcess(p *os.Process) {\n\tif err := p.Signal(os.Interrupt); err != nil {\n\t\t// Per https://golang.org/pkg/os/#Signal, “Interrupt is not implemented on\n\t\t// Windows; using it with os.Process.Signal will return an error.”\n\t\t// Fall back to Kill instead.\n\t\tp.Kill()\n\t}\n}", "title": "" }, { "docid": "41f54cbed0af7d11f579988d58939aa2", "score": "0.41793856", "text": "func interruptProcess(p *os.Process) {\n\tif err := p.Signal(os.Interrupt); err != nil {\n\t\t// Per https://golang.org/pkg/os/#Signal, “Interrupt is not implemented on\n\t\t// Windows; using it with os.Process.Signal will return an error.”\n\t\t// Fall back to Kill instead.\n\t\tp.Kill()\n\t}\n}", "title": "" }, { "docid": "0ce7ec4f19bdf3e90c19e05f3b85f09a", "score": "0.4176051", "text": "func main() {\n\t// First, Create a context to cancel all goroutines.\n\tcancelctx := sigctx.WithCancelSignals(context.Background(), syscall.SIGHUP)\n\t// Second, Wrap the cancel signal context to notify all goroutines.\n\tsignalctx := sigctx.WithSignals(cancelctx, syscall.SIGINT, syscall.SIGTERM)\n\n\tvar wg sync.WaitGroup\n\tfor i := 0; i < 10; i++ {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\t// You do not have to think anything!!\n\t\t\t\t// Let's use the `signalctx` for everything.\n\t\t\t\tcase <-sigctx.Recv(signalctx):\n\t\t\t\t\tsignal, err := sigctx.Signal(signalctx)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Println(err.Error())\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Println(signal.String())\n\t\t\t\t\t}\n\t\t\t\tcase <-signalctx.Done():\n\t\t\t\t\tfmt.Println(signalctx.Err())\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\twg.Wait()\n}", "title": "" } ]
1dab691f1311c4e656e1ecbf69c84ed8
String returns the string representation
[ { "docid": "7856e9076b3e07e3038186d6bd5ef759", "score": "0.0", "text": "func (s RebootInstanceInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
[ { "docid": "8ca704abaf1733dd5a773aca676914e6", "score": "0.72190577", "text": "func (o *Integrationexport) String() string {\n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "c83a5bd12162ec99d9b1a53614b442ab", "score": "0.71656793", "text": "func (s CreateSipRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c6884f72d81d4ab5d4bd62eb1fd1fd76", "score": "0.7113713", "text": "func (o *Networkconnectivity) String() string {\n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "b1ab7200deceeb2f5dd65427566b37e0", "score": "0.71119636", "text": "func (s CreateTrailOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "93f624eaa82a9f6afcc20f13342ccee8", "score": "0.70832914", "text": "func (s RedactRoomMessageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "baf6752d7bd26ffb2b5216b1ee61bb54", "score": "0.7063186", "text": "func (s *Store) String() string {\n\tres := new(bytes.Buffer)\n\tprintChilds(res, 0, s.root)\n\treturn res.String()\n}", "title": "" }, { "docid": "b7856da3ea388e7fcc526b1c9bb93dde", "score": "0.7039794", "text": "func (c Courses) String() string {\n\tb, _ := json.Marshal(c)\n\treturn string(b)\n}", "title": "" }, { "docid": "0b0adf2a2f3bb903a762c6aa17af1f15", "score": "0.70175666", "text": "func (s RecordOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "995736a9fb852edc5fdafc003b31a9eb", "score": "0.7008581", "text": "func (p Prospects) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "e455b5a79713377d7ce29159d9f11dec", "score": "0.70078254", "text": "func (temp *OutPut) String() string {\n\tb, err := json.Marshal(temp)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "4c2d7d98f3636c79ca4e86316309eb7e", "score": "0.7005279", "text": "func (p Prospect) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "162d004f000200612ffacb606ccb69bf", "score": "0.7001563", "text": "func (crs *ReferenceSystem) String ( ) string {\n return toString(crs)\n}", "title": "" }, { "docid": "51dd6026fdd2edf9e8d42d59a79637f3", "score": "0.7000387", "text": "func (s CreateAssessmentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f567f4d9cc26fe5a2b4c893f59399681", "score": "0.69932973", "text": "func (s OutputSerialization) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "870dd6da3203c39446479c9b3c22a1be", "score": "0.69884366", "text": "func (e EpgProgramme) String() string {\n\tje, _ := json.Marshal(e)\n\treturn string(je)\n}", "title": "" }, { "docid": "a980ea84e6b5527c94c8b0c65a993d75", "score": "0.69862556", "text": "func (i Info) String() string {\n\ts, _ := i.toJSON()\n\treturn s\n}", "title": "" }, { "docid": "e301db8f26600062f9111ca88a01b3d4", "score": "0.6969803", "text": "func (o *Nludomainversionqualityreport) String() string {\n \n o.ConfusionMatrix = []Nluconfusionmatrixrow{{}} \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "4fefd1a0342c49b8decc367733846b69", "score": "0.69678056", "text": "func (a Algorithm) String() string {\n\treturn string(a)\n}", "title": "" }, { "docid": "0db46e4d413d7ef3e68390fe7046ed48", "score": "0.69593966", "text": "func (s RedactChannelMessageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "460e5a4576d914b89901ea7ede7bef58", "score": "0.69544554", "text": "func (r *StringConcator) String() string {\n\treturn string(r.raw)\n}", "title": "" }, { "docid": "15f5c157186d6024cc5a55401038dd93", "score": "0.6953907", "text": "func (s OtaaV11) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "62139d383a9352c35a1017272ea215eb", "score": "0.69460964", "text": "func (s CreateRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "40c44e1a0b655c7f4b6ee96616440151", "score": "0.69410115", "text": "func (r *Chain) String() string {\n\treturn TreerString(r)\n}", "title": "" }, { "docid": "53da424ddfd66edc586c234353fdb946", "score": "0.6939724", "text": "func (s CreateStackOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2407e9d59a60df678cefb91d039039af", "score": "0.693922", "text": "func (s GetSipRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a045a0d91e29711ee995269805cd98e4", "score": "0.69391936", "text": "func (s NiftyCreateRouterOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e2ac89e02abe75fd8179ac1f7b6620d1", "score": "0.69383335", "text": "func (o *Conversationroutingdata) String() string {\n \n \n \n o.Skills = []Addressableentityref{{}} \n o.ScoredAgents = []Scoredagent{{}} \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "a258768e1ec89dce6e5ff4b9c4665e8e", "score": "0.6935911", "text": "func (s DescribeFeatureTransformationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5a497d0feef8d13612c33ce7fd694cbc", "score": "0.69336706", "text": "func (n *Node) String() string {\n\treturn fmt.Sprintf(\"[%d, %d, %d, m: %d]\", n.X, n.Y, n.Z, n.Mass)\n}", "title": "" }, { "docid": "675dfe1879e75f81580272934d86e3a2", "score": "0.6926727", "text": "func (e Explorations) String() string {\n\tje, _ := json.Marshal(e)\n\treturn string(je)\n}", "title": "" }, { "docid": "c08b366f5053eeb695ffc3761516d064", "score": "0.6926391", "text": "func (s ArchiveCreationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "676d847c9385b35ff0dfafcfeafe44ff", "score": "0.6925812", "text": "func (s *Spec) String() string {\n\treturn string(must.Bytes(json.MarshalIndent(s, \"\", \" \")))\n}", "title": "" }, { "docid": "6c6cc36e980634a06a1293177ab03e14", "score": "0.69209343", "text": "func (s LayerVersionContentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4289cc8455f8f6094a3a56497d8bc17e", "score": "0.69181406", "text": "func (s CreateRoomOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4289cc8455f8f6094a3a56497d8bc17e", "score": "0.69181406", "text": "func (s CreateRoomOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e738071a72a05d21ec5c7f8c4a16313a", "score": "0.6913111", "text": "func (b *BinaryFormat) String() string {\n\treturn string(*b)\n}", "title": "" }, { "docid": "e2ac7d9d92bc54915b25ee0305f6cfbe", "score": "0.69130194", "text": "func (s PublishLayerVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e2ac7d9d92bc54915b25ee0305f6cfbe", "score": "0.69130194", "text": "func (s PublishLayerVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ee1c82439f428593804e7d41e67a88bb", "score": "0.6911058", "text": "func (s DeleteAlgorithmOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a3c064fb3b6b75132d448029d897bbaf", "score": "0.69058084", "text": "func (r Backend) String() string {\n\treturn fmt.Sprintf(\"path: %s, type: %s\", r.Path, r.Type)\n}", "title": "" }, { "docid": "52813ac5ae2108fcca313f381f978567", "score": "0.6904322", "text": "func (c ClassMemberships) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "1c9949fa0b52e39bee22f09947570358", "score": "0.6903197", "text": "func (s *stack) String() string {\n\treturn fmt.Sprintf(\"%v\", s.a)\n}", "title": "" }, { "docid": "4885cf08e9c364b48c7f2d49c8df9678", "score": "0.6898203", "text": "func (x *Rat) String() string", "title": "" }, { "docid": "cd201c7df0c686bf45793679f1c0379c", "score": "0.6895976", "text": "func (p *Person) String() string {\n\treturn fmt.Sprintf(\"id:%d age:%d sex:%c\", p.ID(), p.Age(), p.Sex())\n}", "title": "" }, { "docid": "c1e61dcc3f2c005835b59fad0a71e8da", "score": "0.6894107", "text": "func (s CreateResolverRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "923ae1ffbd0a1132f28ed2315a249287", "score": "0.6893277", "text": "func (t *ToBase64) String() string {\n\treturn fmt.Sprintf(\"%s(%s)\", t.FunctionName(), t.Child)\n}", "title": "" }, { "docid": "3cc64037e831dc747b21f738c72394ea", "score": "0.6892793", "text": "func (a Articles) String() string {\n\tja, _ := json.Marshal(a)\n\treturn string(ja)\n}", "title": "" }, { "docid": "03a4267d679e666456e77c59c2ee2e95", "score": "0.6889573", "text": "func (s NetworkPathComponentDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3aad9005760fdaf03c048b7b9e45b6f4", "score": "0.68866765", "text": "func (s CreateFlowOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f331030a5b0680ab70b1dceaaf772854", "score": "0.68864965", "text": "func (s RNA) String() string {\n\treturn string(s)\n}", "title": "" }, { "docid": "343aacf8e9d1cc4e1f5ac20e26b14746", "score": "0.6882691", "text": "func (s DeleteTrailOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7bd0ba85d597faf35a61a5813c2f4458", "score": "0.68822736", "text": "func (d *Details) String() string {\n\ts, err := json.Marshal(d)\n\tif err != nil {\n\t\treturn \"error found.\"\n\t}\n\treturn string(s)\n}", "title": "" }, { "docid": "82a2c53617cc65d4b34d71970dcee911", "score": "0.68765706", "text": "func (f Feedback) String() string {\n\tjf, _ := json.Marshal(f)\n\treturn string(jf)\n}", "title": "" }, { "docid": "05bdc6f426e4f8fabea1d52bb2df508f", "score": "0.68743235", "text": "func (s GetRecordOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2a7b0653f02558bf377ae5244405dfea", "score": "0.6872822", "text": "func (s RunAssessmentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3035d06dfe8d01239abdaa36bc88b188", "score": "0.68684965", "text": "func (s CreateBotOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d0215beb45b524075b7ad2982760b5b4", "score": "0.68677104", "text": "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d0215beb45b524075b7ad2982760b5b4", "score": "0.68677104", "text": "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d0215beb45b524075b7ad2982760b5b4", "score": "0.68677104", "text": "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d0215beb45b524075b7ad2982760b5b4", "score": "0.68677104", "text": "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "18625dbe58141956ecac9ce806bf1757", "score": "0.6867259", "text": "func String() string {\r\n\tinput := getString()\r\n\treturn input\r\n}", "title": "" }, { "docid": "6bd53f307d46f82cb70fa2bd0bf2edaf", "score": "0.68668526", "text": "func (s SendVoiceMessageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4820dd99e098f570cd36b8f3acf246e", "score": "0.6866392", "text": "func (s ConformancePackDetail) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3c9370e0af3107eeca3650b7fdb7e995", "score": "0.6863733", "text": "func String() string {\n\tver := Get()\n\treturn StringFromInfo(ver)\n}", "title": "" }, { "docid": "7a1e0b154efc78b76df149d7aac1d3bb", "score": "0.68627125", "text": "func (s CreateDetectorModelOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "50fb4d1a34c4cb9fc78432fda446e6f6", "score": "0.68622065", "text": "func (i ID) String() string {\n\treturn encoding.EncodeToString(i.b)\n}", "title": "" }, { "docid": "339b4b6dc2688019e2d2260d64cae2ad", "score": "0.6861979", "text": "func (s EnableRadiusOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d1952d75279d1eb8bb9ed10bdb16de40", "score": "0.68594325", "text": "func (s ResetResourceLogLevelOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1de0a0050abd651a5177b6fb5eb076a7", "score": "0.68585664", "text": "func (t Tests) String() string {\n\tjt, _ := json.Marshal(t)\n\treturn string(jt)\n}", "title": "" }, { "docid": "0d25840bac7dcf9f42e8056a5226e603", "score": "0.6857295", "text": "func (e Exploration) String() string {\n\tje, _ := json.Marshal(e)\n\treturn string(je)\n}", "title": "" }, { "docid": "a5f875ca3b517a87fe914456f86d2264", "score": "0.6856631", "text": "func (o *Outcome) String() string {\n \n \n \n \n \n \n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "7f838d63ebbdcee1149656dd4d04824c", "score": "0.68560296", "text": "func (self *Node) String() (string, error) {\n if err := self.checkRaw(); err != nil {\n return \"\", err\n }\n switch self.t {\n case _V_NUMBER : return toNumber(self).String(), nil\n case types.V_NULL : return \"null\" , nil\n case types.V_TRUE : return \"true\" , nil\n case types.V_FALSE : return \"false\", nil\n case types.V_STRING : return addr2str(self.p, self.v), nil\n default : return \"\" , ErrUnsupportType\n }\n}", "title": "" }, { "docid": "db37e8c6e9597d37d0f6ad6cb88281d4", "score": "0.6853771", "text": "func (s NiftyCreateAlarmOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ef0c28a72957161788af43997558123e", "score": "0.68532306", "text": "func (o *Trusteebillingoverview) String() string {\n\tj, _ := json.Marshal(o)\n\tstr, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n\treturn str\n}", "title": "" }, { "docid": "3f1a632e93310c4f56222960d6eedb1c", "score": "0.6851581", "text": "func (s CreatePatchBaselineOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5dc089462e482236fbb04cff87906e3a", "score": "0.68498755", "text": "func (o *Edgemetricssubsystem) String() string {\n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "6f97479d956fbf7445e1aabe90358ece", "score": "0.68481404", "text": "func (t *Trace) String() string {\n\treturn fmt.Sprintf(\"Keys: %#v, Options: %#v, Digests: %q\", t.keys, t.options, t.Digests)\n}", "title": "" }, { "docid": "1772f826323e9406147bb68644da384a", "score": "0.6846798", "text": "func (o *Faxsendrequest) String() string {\n \n o.Addresses = []string{\"\"} \n \n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "cf256ea3577277acd7debf4a573e376f", "score": "0.68453395", "text": "func (t *FromBase64) String() string {\n\treturn fmt.Sprintf(\"%s(%s)\", t.FunctionName(), t.Child)\n}", "title": "" }, { "docid": "36d3d72bb4f64e98624592666b35d512", "score": "0.6844965", "text": "func (s UpdateRelationalDatabaseOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0e2531d1217c5e58b94a035ab312937f", "score": "0.6844765", "text": "func (m *multiprotocol) String() string {\n\ts, err := bytesToString(m.bytes)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"multiprotocol failed to convert back to string. corrupted? %s\", err))\n\t}\n\treturn s\n}", "title": "" }, { "docid": "2dce016c3492718d27fc3f5767f356a0", "score": "0.6843859", "text": "func (s LifeCycleLastTestInitiated) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "838c508d9a31ba4b7bb753312db1c300", "score": "0.68427885", "text": "func (s CreateFindingAggregatorOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ade613480a4d21e19bbe2808b702aeda", "score": "0.68419415", "text": "func (s HumanLoopActivationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "37cf0f1f58fcd6e8d2c60985d6599a77", "score": "0.68416274", "text": "func (s LifeCycleLastTestReverted) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d52ed1985ba49c77b04fd6e879cb71c7", "score": "0.68414885", "text": "func (s CreateVoiceConnectorOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "af7e83b226664a10979cb02f117182c4", "score": "0.684033", "text": "func (s CreateDocumentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "af7e83b226664a10979cb02f117182c4", "score": "0.684033", "text": "func (s CreateDocumentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d9cd354e06a05d90ae642c539e1e4382", "score": "0.6835914", "text": "func (s PayloadOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "91003fa6638e2c97dbe9fcc3c9cac8ce", "score": "0.6832916", "text": "func (o *Patchwebmessagingofferfields) String() string {\n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "d3577e98f1cb557f9b5c6bf9519c9a29", "score": "0.68326443", "text": "func (s CreateAutomationRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ccdd9176cdbb40bac0c48b046d21b3c2", "score": "0.68316406", "text": "func (s CreateAssessmentTemplateOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d12bad6abea20a3c94ed5aceb777edc6", "score": "0.6830739", "text": "func (s StartResourceEvaluationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a2f662a18633b1aa0051cae052d35e3f", "score": "0.68295026", "text": "func (s TestIdentityProviderOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "75941dac2946d552c995f667194f1000", "score": "0.6829349", "text": "func (s RedactConversationMessageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f80c16ca6394def1ae3befcf5c5214f9", "score": "0.682701", "text": "func (f Feedbacks) String() string {\n\tjf, _ := json.Marshal(f)\n\treturn string(jf)\n}", "title": "" }, { "docid": "daeda53d3394136b0b0686a9671382ae", "score": "0.68261486", "text": "func String(s string) string {\n\treturn fmt.Sprintf(\"%o\", ValueOf(s))\n}", "title": "" }, { "docid": "fb049264ec2bbd41a7a18add20efd1ec", "score": "0.68237686", "text": "func (s *sequence) String() string {\n\treturn fmt.Sprintf(\"sequence:{leader:%d,seq:%d}\", s.leader, s.seq)\n}", "title": "" }, { "docid": "0d6281dc4dbab50863ba732f6ea402c6", "score": "0.68234265", "text": "func (info *Info) String() string {\n\tdata, err := info.ToJSON()\n\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\treturn string(data[:])\n}", "title": "" }, { "docid": "b93d539563744c04dd85937ea7443fd0", "score": "0.6821734", "text": "func (slf *Connect) String() string {\n\tb, _ := json.Marshal(slf)\n\treturn string(b)\n}", "title": "" }, { "docid": "25c9cf068e0491fa615062323f2942b1", "score": "0.68204916", "text": "func (s SignedObject) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
65b6f6133732f099e46aa1b9678068dc
CompressPubkey encodes a public key to 33byte compressed format.
[ { "docid": "963f4f874bdccab52366e5b664e3e57d", "score": "0.7402377", "text": "func CompressPubkey(x, y *big.Int) []byte {\n\tvar (\n\t\tpubkey = S256().Marshal(x, y)\n\t\tpubkeydata = (*C.uchar)(unsafe.Pointer(&pubkey[0]))\n\t\tpubkeylen = C.size_t(len(pubkey))\n\t\tout = make([]byte, 33)\n\t\toutdata = (*C.uchar)(unsafe.Pointer(&out[0]))\n\t\toutlen = C.size_t(len(out))\n\t)\n\tif C.secp256k1_ext_reencode_pubkey(context, outdata, outlen, pubkeydata, pubkeylen) == 0 {\n\t\tpanic(\"libsecp256k1 error\")\n\t}\n\treturn out\n}", "title": "" } ]
[ { "docid": "b1a0041d18bf8bbbbe7da24f7aac1450", "score": "0.6689041", "text": "func (pub *PublicKey) Compress() ([]byte, error) {\n\tbuf := make([]byte, PublicKeyCompressedLen)\n\n\t// 1st byte tells the sign of Y\n\tbuf[0] = pubKeyCompressed\n\tif misc.IsOdd(pub.Y) {\n\t\tbuf[0] |= 0x01 // make it 3 for an odd Y\n\t}\n\tmisc.ReverseCopy(buf[1:], pub.X.Bytes())\n\n\treturn buf, nil\n}", "title": "" }, { "docid": "8174563dad0de2e95d5b519ffead2284", "score": "0.662404", "text": "func serializeCompressed(pub ecdsa.PublicKey) []byte {\n\tvar prefix byte\n\tif isOdd(pub.Y) {\n\t\tprefix = PubKeyCompressedOddPrefix\n\t} else {\n\t\tprefix = PubKeyCompressedEvenPrefix\n\t}\n\tx := pub.X.Bytes()\n\n\tif len(x) < BitcoinPrivKeyBytesLen {\n\t\tx = paddedPrepend(BitcoinPrivKeyBytesLen, x)\n\t}\n\n\treturn append([]byte{prefix}, x...)\n}", "title": "" }, { "docid": "aa23364657135fedd4aa9fee9c2c1140", "score": "0.6542481", "text": "func PrivKeyToPubKeyCompressed(privKey []byte) []byte {\n\t_, pubKeyObject := btcec.PrivKeyFromBytes(S256(), privKey[:])\n\treturn pubKeyObject.SerializeCompressed()\n}", "title": "" }, { "docid": "f2d841a1511705cb0ccfc87bb1c62fb2", "score": "0.63766533", "text": "func (p *PublicKey) Serialize(w io.Writer) error {\n\treturn binary.Write(w, binary.LittleEndian, p.EncodeCompression())\n}", "title": "" }, { "docid": "6b5c398384e80b643b3c9e18621dec76", "score": "0.6347018", "text": "func newCompressedPublicKey(spk types.SiaPublicKey) (cpk compressedPublicKey, _ error) {\n\tif len(spk.Key) != len(cpk.Key) {\n\t\treturn cpk, errors.New(\"newCompressedPublicKey: unsupported key length\")\n\t}\n\tif spk.Algorithm != types.SignatureEd25519 {\n\t\treturn cpk, errors.New(\"newCompressedPublicKey: unsupported signature algo\")\n\t}\n\tcopy(cpk.Key[:], spk.Key)\n\tcpk.Algorithm = signatureEd25519\n\treturn\n}", "title": "" }, { "docid": "73bf108f1c9bf7d253d38ffbd26d0bda", "score": "0.6233077", "text": "func (key *Key) ExportPubKey() ([]byte, error) {\n\tk := new(Key)\n\tk.pk = key.pk\n\tk.sk = nil\n\treturn k.GobEncoder()\n}", "title": "" }, { "docid": "3d66f76fe40e28089f6029ae767ce6d4", "score": "0.6222543", "text": "func MarshalPublicKey(r *bytes.Buffer, f *PublicKey) error {\n\tif err := common.MarshalJubJubCompressed(r, f.AG); err != nil {\n\t\treturn err\n\t}\n\n\treturn common.MarshalJubJubCompressed(r, f.BG)\n}", "title": "" }, { "docid": "2e735c4cdcb80d3b1b0d6284f1b9c379", "score": "0.62061375", "text": "func marshalPublicKey(k ic.PubKey) ([]byte, error) {\n\tpbmes := new(pb.PublicKey)\n\tpbmes.Type = k.Type()\n\tdata, err := ic.RawFull(k)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbmes.Data = data\n\n\treturn proto.Marshal(pbmes)\n}", "title": "" }, { "docid": "360c8373c34701b8afa56c7b0da8c131", "score": "0.615685", "text": "func pubKeyBytes(k *ExtendedKey) []byte {\n\t// Just return the key if it's already an extended public key.\n\tif !k.isPrivate {\n\t\treturn k.key\n\t}\n\n\t// This is a private extended key, so calculate and memoize the public\n\t// key if needed.\n\tif len(k.pubKey) == 0 {\n\t\tpkx, pky := btcec.S256().ScalarBaseMult(k.key)\n\t\tpubKey := btcec.PublicKey{Curve: btcec.S256(), X: pkx, Y: pky}\n\t\tk.pubKey = pubKey.SerializeCompressed()\n\t}\n\n\treturn k.pubKey\n}", "title": "" }, { "docid": "21dd64d35b6a80705b66b603bab6353e", "score": "0.6093872", "text": "func SerializePublicKey(key PublicKey) []byte {\n\tvar buf bytes.Buffer\n\tswitch t := key.(type) {\n\tcase *ec.PublicKey:\n\t\tswitch t.Algorithm {\n\t\tcase ec.ECDSA:\n\t\t\t// Take P-256 as a special case\n\t\t\tif t.Params().Name == elliptic.P256().Params().Name {\n\t\t\t\treturn ec.EncodePublicKey(t.PublicKey, true)\n\t\t\t}\n\t\t\tbuf.WriteByte(byte(PK_ECDSA))\n\t\tcase ec.SM2:\n\t\t\tbuf.WriteByte(byte(PK_SM2))\n\t\t}\n\t\tlabel, err := GetCurveLabel(t.Curve)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tbuf.WriteByte(label)\n\t\tbuf.Write(ec.EncodePublicKey(t.PublicKey, true))\n\tcase ed25519.PublicKey:\n\t\tbuf.WriteByte(byte(PK_EDDSA))\n\t\tbuf.WriteByte(ED25519)\n\t\tbuf.Write([]byte(t))\n\tdefault:\n\t\tpanic(\"unknown public key type\")\n\t}\n\n\treturn buf.Bytes()\n}", "title": "" }, { "docid": "afb9d87d9e25132ee594be75691113a8", "score": "0.60664636", "text": "func EncodePublicKey(pub crypto.PublicKey) (res string, err error) {\n\tprefix, _, payload, err := serializePublicKey(pub)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn encodeBase58(prefix, payload)\n}", "title": "" }, { "docid": "98840ad6dd58d1df6137a7ca6ccbb536", "score": "0.6033222", "text": "func SerializePubKey(pub *btcec.PublicKey) []byte {\n\tpBytes := pub.SerializeCompressed()\n\treturn pBytes[1:]\n}", "title": "" }, { "docid": "ec414fa719785799284d3662b09ea902", "score": "0.60233146", "text": "func (p *PublicKey) EncodeCompression() []byte {\n\tif p.isInfinity() {\n\t\treturn []byte{0x00}\n\t}\n\n\tvar (\n\t\tx = p.X.Bytes()\n\t\tpaddedX = append(bytes.Repeat([]byte{0x00}, 32-len(x)), x...)\n\t\tprefix = byte(0x03)\n\t)\n\n\tif p.Y.Bit(0) == 0 {\n\t\tprefix = byte(0x02)\n\t}\n\n\treturn append([]byte{prefix}, paddedX...)\n}", "title": "" }, { "docid": "f59a041c5bbb65be450cccb9559da53f", "score": "0.602325", "text": "func (k kuKEM) updatePublicKey(pk, ad []byte) ([]byte, error) {\n\tvar p kuKEMPublicKey\n\tif err := binary.Unmarshal(pk, &p); err != nil {\n\t\treturn nil, err\n\t}\n\n\tp.A = append(p.A, ad)\n\treturn binary.Marshal(&p)\n}", "title": "" }, { "docid": "16d966c822b7be8a4293550ef93ad703", "score": "0.59801185", "text": "func MarshalPublicKey(pub *PublicKey) []byte {\n\n\tspec := specPublicKey{\n\t\tN: pub.N,\n\t\tG: pub.G,\n\t}\n\n\tb, _ := asn1.Marshal(spec)\n\treturn b\n}", "title": "" }, { "docid": "295245771ee69cdc58f8fa2b6e287ae9", "score": "0.5941287", "text": "func (akp *KeyPair) PubKeyJSON() []byte {\n\tbase64N := Base64URLEncode(akp.Public.N.Bytes())\n\n\tserializable := serializablePubKey{\n\t\tN: base64N,\n\t\tE: akp.Public.E,\n\t\tKID: akp.KID,\n\t}\n\n\tjson, _ := json.Marshal(serializable)\n\n\treturn json\n}", "title": "" }, { "docid": "ca1387513555edc9488b21d573cbed39", "score": "0.59282815", "text": "func (pub *PublicKey) UncompressedEncode() ([]byte, error) {\n\tbuf := make([]byte, PublicKeyUncompressedLen)\n\tbuf[0] = pubKeyUncompressed\n\n\tell := (PublicKeyUncompressedLen - 1) / 2\n\n\toffset := 1\n\tmisc.ReverseCopy(buf[offset:(offset+ell)], pub.X.Bytes())\n\toffset += ell\n\tmisc.ReverseCopy(buf[offset:(offset+ell)], pub.Y.Bytes())\n\n\treturn buf, nil\n}", "title": "" }, { "docid": "47ef1e9c27df4102d0bb8f4c90a93324", "score": "0.5860194", "text": "func EncodePublicKey(publicKey *ecdsa.PublicKey) string {\n\tx509EncodedPub, _ := x509.MarshalPKIXPublicKey(publicKey)\n\tpemEncodedPub := pem.EncodeToMemory(&pem.Block{Type: \"PUBLIC KEY\", Bytes: x509EncodedPub})\n\treturn string(pemEncodedPub)\n}", "title": "" }, { "docid": "d785b5f896baa087ec9ed81178b7905e", "score": "0.58260435", "text": "func (cs *cs3a) pubKeyStr() string {\n\treturn base64.StdEncoding.EncodeToString(cs.publicKey[:])\n}", "title": "" }, { "docid": "b63b793c98aef16142b0a181efcfe1ee", "score": "0.5814289", "text": "func (cs *cs3a) pubKey() *[32]byte {\n\treturn &cs.publicKey\n}", "title": "" }, { "docid": "d19bb0ea216e339816de628ceab58cf4", "score": "0.5784452", "text": "func MarshalPublicKey(key crypto.PublicKey) ([]byte, error) {\n\treturn keyRegistrar.MarshalPublicKey(key)\n}", "title": "" }, { "docid": "bafa7e21979489f5dbb81fd0bef71c02", "score": "0.5767214", "text": "func (s SignatureWithPublicKey) Encode() ([]byte, error) {\n\treturn s.Bytes(), nil\n}", "title": "" }, { "docid": "f7e96b73cd2a84591ba65ab7cabe90db", "score": "0.5741794", "text": "func EncryptWithPublicKey(msg []byte, pub *rsa.PublicKey) (string, error) {\n\tlabel := []byte(Label)\n\trng := rand.Reader\n\tcipherText, err := rsa.EncryptOAEP(sha256.New(), rng, pub, []byte(msg), label)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Error from encryption: %s\\n\", err)\n\t\treturn \"\", err\n\t}\n\treturn base64.StdEncoding.EncodeToString(cipherText), nil\n}", "title": "" }, { "docid": "3d0166c067100d34e3e244c031f25d49", "score": "0.5736062", "text": "func EncodePublicKeyHash(pub crypto.PublicKey) (hash string, err error) {\n\t_, prefix, payload, err := serializePublicKey(pub)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdigest, err := blake2b.New(20, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdigest.Write(payload)\n\th := digest.Sum(nil)\n\n\treturn encodeBase58(prefix, h)\n}", "title": "" }, { "docid": "0d3b8d6253efce50ed462402faa4bbaf", "score": "0.572381", "text": "func (pubKey PubKey) MarshalJSON() ([]byte, error) {\n\tbuf := make([]byte, SizeHintPubKey)\n\tif _, _, err := pubKey.Marshal(buf, surge.MaxBytes); err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(base64.RawURLEncoding.EncodeToString(buf))\n}", "title": "" }, { "docid": "3139e6c072863e8d4994c43e5aa38ecd", "score": "0.56937224", "text": "func (k *KeyPair) EncodedPublicKey() ([]byte, error) {\n\tswitch k.keyType {\n\tcase RSA:\n\t\tkey, err := k.GetRsaPrivateKey()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn x509.MarshalPKIXPublicKey(&key.PublicKey)\n\tcase ECDSA:\n\t\tkey, _ := k.GetEcdsaPrivateKey()\n\t\treturn x509.MarshalPKIXPublicKey(&key.PublicKey)\n\t}\n\n\treturn nil, fmt.Errorf(\"cannot decode the public key of %s\", k.keyType)\n}", "title": "" }, { "docid": "10cb53746545ef20021416cdc97e6411", "score": "0.5689424", "text": "func (pk *PublicKey) MarshalJSON() ([]byte, error) {\n\ttype Alias PublicKey\n\tenc, err := ResolvePublicKeyEncoding(int(pk.Encoding))\n\tb, _ := json.Marshal(&struct {\n\t\tEncoding string `json:\"encoding\"`\n\t\t*Alias\n\t}{\n\t\tEncoding: enc,\n\t\tAlias: (*Alias)(pk),\n\t})\n\treturn b, err\n}", "title": "" }, { "docid": "26871446bda7de281bc7d434ec1238f7", "score": "0.56851363", "text": "func pubkeyToHex(key *btcec.PublicKey) string {\n\treturn hex.EncodeToString(key.SerializeCompressed())\n}", "title": "" }, { "docid": "79b57361ccbeef7e38d7fd14e9a568ef", "score": "0.5682862", "text": "func ExportPubKeyAsPEMStr(pubkey *rsa.PublicKey) string {\n\tpubKeyPEM := string(pem.EncodeToMemory(\n\t\t&pem.Block{\n\t\t\tType: \"RSA PUBLIC KEY\",\n\t\t\tBytes: x509.MarshalPKCS1PublicKey(pubkey),\n\t\t},\n\t))\n\treturn pubKeyPEM\n}", "title": "" }, { "docid": "c77d6e560d4695726c55cac15cffc0c1", "score": "0.5666367", "text": "func exportPubKeyAsPEMStr(pubkey *rsa.PublicKey) string {\n\tpubKeyPem := string(pem.EncodeToMemory(\n\t\t&pem.Block{\n\t\t\tType: \"RSA PUBLIC KEY\",\n\t\t\tBytes: x509.MarshalPKCS1PublicKey(pubkey),\n\t\t},\n\t))\n\treturn pubKeyPem\n}", "title": "" }, { "docid": "2408b8ac089a32c23d8e1f20de15fb71", "score": "0.56346864", "text": "func EncodePubKey(pk *ecdsa.PublicKey) (pubKey string, err error) {\n\tif pk == nil {\n\t\treturn \"\", InvalidPublicKey\n\t}\n\treturn hexutil.Encode(crypto.FromECDSAPub(pk)), nil\n}", "title": "" }, { "docid": "19032d14165e7e855ee6ced9d440fe73", "score": "0.5608518", "text": "func (key *PubKey) Marshal() ([]byte, error) {\n\tif err := validatePubKey(key); err != nil {\n\t\treturn nil, err\n\t}\n\n\tstr := C.paillier_pubkey_to_hex(key.Key)\n\tdefer C.free(unsafe.Pointer(str))\n\tgoStr := C.GoString(str)\n\treturn []byte(goStr), nil\n}", "title": "" }, { "docid": "7ae21bc259b57376d3b60858b46f39f9", "score": "0.5606235", "text": "func (c BasicClient) PsaExportPublicKey(keyName string) ([]byte, error) {\n\tif !c.implicitProvider.HasCrypto() {\n\t\treturn nil, fmt.Errorf(\"provider does not support crypto operation\")\n\t}\n\treturn c.opclient.PsaExportPublicKey(requests.ProviderID(c.implicitProvider), c.auth.toNativeAuthenticator(), keyName)\n}", "title": "" }, { "docid": "fe10b470066802ab4920ae3f858c974e", "score": "0.56007135", "text": "func savePublicPEMKey(fileName string, pubkey rsa.PublicKey) { \r\n\tasn1Bytes, err := asn1.Marshal(pubkey) \r\n if err != nil { \r\n fmt.Println(\"Fatal error \", err.Error()) \r\n os.Exit(1) \r\n } \r\n var pemkey = &pem.Block{ \r\n Type: \"PUBLIC KEY\", \r\n Bytes: asn1Bytes, \r\n } \r\n \r\n pemfile, err := os.Create(fileName) \r\n if err != nil { \r\n fmt.Println(\"Fatal error \", err.Error()) \r\n os.Exit(1) \r\n } \r\n defer pemfile.Close() \r\n err = pem.Encode(pemfile, pemkey) \r\n if err != nil { \r\n fmt.Println(\"Fatal error \", err.Error()) \r\n os.Exit(1) \r\n } \r\n}", "title": "" }, { "docid": "9a5f98d13ee570b283ba5bdd66d06331", "score": "0.5585553", "text": "func MarshalPublic(pub *PublicKey) ([]byte, error) {\n\tif !pub.Valid() {\n\t\treturn nil, ErrCorruptPublicKey\n\t}\n\n\tvar buf = new(bytes.Buffer)\n\tbuf.Write(pub.E[:])\n\tbuf.Write(pub.V[:])\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "93c9f1b972f1d41449c3e02932702a37", "score": "0.558384", "text": "func DecompressPubkey(pubkey []byte) (x, y *big.Int) {\n\tif len(pubkey) != 33 {\n\t\treturn nil, nil\n\t}\n\tvar (\n\t\tpubkeydata = (*C.uchar)(unsafe.Pointer(&pubkey[0]))\n\t\tpubkeylen = C.size_t(len(pubkey))\n\t\tout = make([]byte, 65)\n\t\toutdata = (*C.uchar)(unsafe.Pointer(&out[0]))\n\t\toutlen = C.size_t(len(out))\n\t)\n\tif C.secp256k1_ext_reencode_pubkey(context, outdata, outlen, pubkeydata, pubkeylen) == 0 {\n\t\treturn nil, nil\n\t}\n\treturn new(big.Int).SetBytes(out[1:33]), new(big.Int).SetBytes(out[33:])\n}", "title": "" }, { "docid": "93c9f1b972f1d41449c3e02932702a37", "score": "0.558384", "text": "func DecompressPubkey(pubkey []byte) (x, y *big.Int) {\n\tif len(pubkey) != 33 {\n\t\treturn nil, nil\n\t}\n\tvar (\n\t\tpubkeydata = (*C.uchar)(unsafe.Pointer(&pubkey[0]))\n\t\tpubkeylen = C.size_t(len(pubkey))\n\t\tout = make([]byte, 65)\n\t\toutdata = (*C.uchar)(unsafe.Pointer(&out[0]))\n\t\toutlen = C.size_t(len(out))\n\t)\n\tif C.secp256k1_ext_reencode_pubkey(context, outdata, outlen, pubkeydata, pubkeylen) == 0 {\n\t\treturn nil, nil\n\t}\n\treturn new(big.Int).SetBytes(out[1:33]), new(big.Int).SetBytes(out[33:])\n}", "title": "" }, { "docid": "95e63ed7c9592f209a8b1efeab34d0e6", "score": "0.5578628", "text": "func convertPubKey(pk crypto.PublicKey) (*pubKey, error) {\n\tpkRSA, ok := pk.(*rsa.PublicKey)\n\tif !ok {\n\t\treturn nil, errors.New(\"the provided Privacy CA public key was not an RSA key\")\n\t}\n\tif pkRSA.N.BitLen() != 2048 {\n\t\treturn nil, errors.New(\"The provided Privacy CA RSA public key was not a 2048-bit key\")\n\t}\n\n\trsakp := rsaKeyParams{\n\t\tKeyLength: 2048,\n\t\tNumPrimes: 2,\n\t\tExponent: big.NewInt(int64(pkRSA.E)).Bytes(),\n\t}\n\trsakpb, err := tpmutil.Pack(rsakp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tkp := keyParams{\n\t\tAlgID: AlgRSA,\n\t\tEncScheme: esNone,\n\t\tSigScheme: ssRSASaPKCS1v15SHA1,\n\t\tParams: rsakpb,\n\t}\n\tpubKey := pubKey{\n\t\tAlgorithmParams: kp,\n\t\tKey: pkRSA.N.Bytes(),\n\t}\n\n\treturn &pubKey, nil\n}", "title": "" }, { "docid": "4d0147d693cd5eeba6ba5ee7678fbf77", "score": "0.5565346", "text": "func PublicKeyToBytes(pub *rsa.PublicKey) []byte {\n\tpubASN1, err := x509.MarshalPKIXPublicKey(pub)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tpubBytes := pem.EncodeToMemory(&pem.Block{\n\t\tType: \"RSA PUBLIC KEY\",\n\t\tBytes: pubASN1,\n\t})\n\n\treturn pubBytes\n}", "title": "" }, { "docid": "dcf34882ac47d3d7ddb9a38230f484fc", "score": "0.55641043", "text": "func PemEncodePublic(key crypto.PublicKey) ([]byte, error) {\n\tder, err := x509.MarshalPKIXPublicKey(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar t string\n\tswitch key.(type) {\n\tcase *rsa.PublicKey:\n\t\tt = \"RSA PUBLIC KEY\"\n\tcase *ecdsa.PublicKey:\n\t\tt = \"EC PUBLIC KEY\"\n\tdefault:\n\t\treturn nil, errors.New(\"Unsupported public key type\")\n\t}\n\n\tb := &pem.Block{Type: t, Bytes: der}\n\treturn pem.EncodeToMemory(b), nil\n}", "title": "" }, { "docid": "7d64fe5c227f63da8a49e80d143ad777", "score": "0.555811", "text": "func PrivKeyToPub1(priv []byte) (pub []byte, err error) {\n if len(priv) != 32 {\n //to judge the length of the input, the default is 32\n //fmt.Println(\"the length of the imported private key is wrong, please check the import\")\n return nil, errors.New(\"the length of the imported private key is wrong, please check the import\")\n }\n privKey, _ := btcec.PrivKeyFromBytes(btcec.S256(), priv)//to get the data of private key by the function from btcec\n pubKeySerial := privKey.PubKey().SerializeCompressed()//to get the compressed public key with the type of []byte, and the length is 33, the first byte is the symbol byte \n return pubKeySerial, nil\n}", "title": "" }, { "docid": "fdf07eda41f724f1a5d4548e1d7f9b64", "score": "0.5537373", "text": "func (_DnsResolverContract *DnsResolverContractSession) Pubkey(node [32]byte) (struct {\n\tX [32]byte\n\tY [32]byte\n}, error) {\n\treturn _DnsResolverContract.Contract.Pubkey(&_DnsResolverContract.CallOpts, node)\n}", "title": "" }, { "docid": "3240c348c56f056965ccef6469494596", "score": "0.55352473", "text": "func (cs *cs2a) pubKeyStr() string {\n\treturn base64.StdEncoding.EncodeToString(cs.publicKey[:])\n}", "title": "" }, { "docid": "d8e7de5f648744a8a64cb2adcccf59a5", "score": "0.5530044", "text": "func (pk PublicKey) MarshalJSON() ([]byte, error) {\n return json.Marshal(pk[:])\n}", "title": "" }, { "docid": "56139e5fe57b13056168f5d7f43d82f3", "score": "0.5526372", "text": "func (k *ExtendedKey) pubKeyBytes() ([]byte, error) {\n\t// Just return the key if it's already an extended public key.\n\tif !k.IsPrivate {\n\t\treturn k.Key, nil\n\t}\n\n\t// This is a private extended key, so calculate and memorize the public\n\t// key if needed.\n\tif len(k.PubKey) == 0 {\n\t\t//\t\tcurve := elliptic.P256()\n\t\tcurve := sm2.P256Sm2()\n\t\tswitch k.Cryptography {\n\t\tcase config.Nist: // NIST\n\t\t\treturn nil, ErrCryptographyNotSupported\n\t\tcase config.Gm: // 国密\n\t\t\t//\t\t\tcurve = sm2.P256Sm2()\n\t\tdefault: // 不支持的密码学类型\n\t\t\treturn nil, ErrCryptographyNotSupported\n\t\t}\n\n\t\tpkx, pky := curve.ScalarBaseMult(k.Key)\n\t\tpubKey := ecdsa.PublicKey{Curve: curve, X: pkx, Y: pky}\n\t\tstrPubKey, err := serializeUncompressed(&pubKey)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tk.PubKey = []byte(strPubKey)\n\t}\n\n\treturn k.PubKey, nil\n}", "title": "" }, { "docid": "eda96f57394d314303069dc369109b94", "score": "0.5523995", "text": "func EncryptWithPublicKey(msg []byte, pub *rsa.PublicKey) []byte {\n\tciphertext, err := rsa.EncryptPKCS1v15(rand.Reader, pub, msg)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\treturn ciphertext\n}", "title": "" }, { "docid": "abca8c49ad4db523a9031c6ad008d52e", "score": "0.5522555", "text": "func (_DnsResolverContract *DnsResolverContractCallerSession) Pubkey(node [32]byte) (struct {\n\tX [32]byte\n\tY [32]byte\n}, error) {\n\treturn _DnsResolverContract.Contract.Pubkey(&_DnsResolverContract.CallOpts, node)\n}", "title": "" }, { "docid": "5786012e281f9f294707a3ea5b335f13", "score": "0.552068", "text": "func (_DnsResolverContract *DnsResolverContractCaller) Pubkey(opts *bind.CallOpts, node [32]byte) (struct {\n\tX [32]byte\n\tY [32]byte\n}, error) {\n\tret := new(struct {\n\t\tX [32]byte\n\t\tY [32]byte\n\t})\n\tout := ret\n\terr := _DnsResolverContract.contract.Call(opts, out, \"pubkey\", node)\n\treturn *ret, err\n}", "title": "" }, { "docid": "147fd17eb67ee8b22eeac71569694fdf", "score": "0.5512439", "text": "func CoinbaseTxScriptPubKey(pubKey []byte) []byte {\n if len(pubKey) > MaxDataLen {\n panic(\"coinbase pubkey too long\")\n }\n buf := new(bytes.Buffer)\n // pubkey to stack\n binary.Write(buf, binary.LittleEndian, uint8(len(pubKey)))\n binary.Write(buf, nil, pubKey)\n // checksig\n binary.Write(buf, binary.LittleEndian, uint8(OpChecksig))\n\n return buf.Bytes()\n}", "title": "" }, { "docid": "41b3adc5696a5436918c1a9de11e4320", "score": "0.55049074", "text": "func (pk *PublicKeyV3) SerializeSignaturePrefix(w io.Writer) {\n\tvar pLength uint16\n\tswitch pk.PubKeyAlgo {\n\tcase PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly:\n\t\tpLength += 2 + uint16(len(pk.n.bytes))\n\t\tpLength += 2 + uint16(len(pk.e.bytes))\n\tdefault:\n\t\tpanic(\"unknown public key algorithm\")\n\t}\n\tpLength += 6\n\tw.Write([]byte{0x99, byte(pLength >> 8), byte(pLength)})\n\treturn\n}", "title": "" }, { "docid": "ac878f8a4f538c88206d81a12bc22fb9", "score": "0.55002916", "text": "func (cs *cs2a) pubKey() *[32]byte {\n\treturn &cs.publicKey\n}", "title": "" }, { "docid": "be151cd789f978788b7e14cc4c89fda9", "score": "0.54922813", "text": "func hashPublicKey(pk *rsa.PublicKey) string {\n\treturn fmt.Sprintf(\"%x\", sha1.Sum([]byte(fmt.Sprintf(\"%v%v\", pk.N, pk.E))))\n}", "title": "" }, { "docid": "7313c6a7f3ba58cf422024f3963de60a", "score": "0.54909045", "text": "func PrependPubkey(message []byte, pubkey PublicKey) []byte {\n\treturn append(pubkey.Bytes(), message...)\n}", "title": "" }, { "docid": "bdc948ce563ef2be39720ffbccbe4947", "score": "0.5480466", "text": "func toPublic(this js.Value, args []js.Value) interface{} {\n\tgo func(args []js.Value) {\n\t\tlogDebug(\"toPublic\")\n\t\t// clean args\n\t\tcallback, remainder, err := handleArgs(args, 1, \"toPublic\")\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\tpub, err := k.ToPublic()\n\t\tif err != nil {\n\t\t\tjsLogReject(callback, \"error converting to public key: %s\", err)\n\t\t\treturn\n\t\t}\n\n\t\t// return result\n\t\tcallback.Invoke(nil, pub.Key)\n\n\t\treturn\n\t}(args)\n\n\treturn nil\n}", "title": "" }, { "docid": "1dafef4bb66c0d60f52adfcc8148697a", "score": "0.54737806", "text": "func (pub PublicKey) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(i10rjson.HexBytes(pub))\n}", "title": "" }, { "docid": "f6d706c52409c045ff92c3f7474581c0", "score": "0.54586715", "text": "func (k *Key) SigningKeyPublic() {}", "title": "" }, { "docid": "5943cb57987380c3710a8be36c4b3705", "score": "0.5451891", "text": "func JavaPublicKey(env jutil.Env, key security.PublicKey) (jutil.Object, error) {\n\tif key == nil {\n\t\treturn jutil.NullObject, nil\n\t}\n\tder, err := key.MarshalBinary()\n\tif err != nil {\n\t\treturn jutil.NullObject, err\n\t}\n\treturn JavaPublicKeyFromDER(env, der)\n}", "title": "" }, { "docid": "0e9a9498006d5dfbd66fc1fe90d3921e", "score": "0.54302377", "text": "func NewPublicKeyValue(\n\tinterpreter *Interpreter,\n\tlocationRange LocationRange,\n\tpublicKey *ArrayValue,\n\tsignAlgo Value,\n\tvalidatePublicKey PublicKeyValidationHandlerFunc,\n\tpublicKeyVerifySignatureFunction FunctionValue,\n\tpublicKeyVerifyPoPFunction FunctionValue,\n) *CompositeValue {\n\n\tfields := []CompositeField{\n\t\t{\n\t\t\tName: sema.PublicKeyTypeSignAlgoFieldName,\n\t\t\tValue: signAlgo,\n\t\t},\n\t}\n\n\t// TODO: refactor to SimpleCompositeValue\n\tpublicKeyValue := NewCompositeValue(\n\t\tinterpreter,\n\t\tlocationRange,\n\t\tsema.PublicKeyType.Location,\n\t\tsema.PublicKeyType.QualifiedIdentifier(),\n\t\tsema.PublicKeyType.Kind,\n\t\tfields,\n\t\tcommon.ZeroAddress,\n\t)\n\n\tpublicKeyValue.ComputedFields = map[string]ComputedField{\n\t\tsema.PublicKeyTypePublicKeyFieldName: func(interpreter *Interpreter, locationRange LocationRange) Value {\n\t\t\treturn publicKey.Transfer(\n\t\t\t\tinterpreter,\n\t\t\t\tlocationRange,\n\t\t\t\tatree.Address{},\n\t\t\t\tfalse,\n\t\t\t\tnil,\n\t\t\t\tnil,\n\t\t\t)\n\t\t},\n\t}\n\tpublicKeyValue.Functions = map[string]FunctionValue{\n\t\tsema.PublicKeyTypeVerifyFunctionName: publicKeyVerifySignatureFunction,\n\t\tsema.PublicKeyTypeVerifyPoPFunctionName: publicKeyVerifyPoPFunction,\n\t}\n\n\terr := validatePublicKey(interpreter, locationRange, publicKeyValue)\n\tif err != nil {\n\t\tpanic(InvalidPublicKeyError{\n\t\t\tPublicKey: publicKey,\n\t\t\tErr: err,\n\t\t\tLocationRange: locationRange,\n\t\t})\n\t}\n\n\t// Public key value to string should include the key even though it is a computed field\n\tpublicKeyValue.Stringer = func(\n\t\tmemoryGauge common.MemoryGauge,\n\t\tpublicKeyValue *CompositeValue,\n\t\tseenReferences SeenReferences,\n\t) string {\n\n\t\tstringerFields := []CompositeField{\n\t\t\t{\n\t\t\t\tName: sema.PublicKeyTypePublicKeyFieldName,\n\t\t\t\tValue: publicKey,\n\t\t\t},\n\t\t\t{\n\t\t\t\tName: sema.PublicKeyTypeSignAlgoFieldName,\n\t\t\t\t// TODO: provide proper location range\n\t\t\t\tValue: publicKeyValue.GetField(interpreter, EmptyLocationRange, sema.PublicKeyTypeSignAlgoFieldName),\n\t\t\t},\n\t\t}\n\n\t\treturn formatComposite(\n\t\t\tmemoryGauge,\n\t\t\tstring(publicKeyValue.TypeID()),\n\t\t\tstringerFields,\n\t\t\tseenReferences,\n\t\t)\n\t}\n\n\treturn publicKeyValue\n}", "title": "" }, { "docid": "afae3e41217d7bb00a500875ae1a8a16", "score": "0.5414982", "text": "func (okp OctetKeyPairBase) PublicKey() []byte { return okp.publicKey }", "title": "" }, { "docid": "de239c31ae30aea94ca8e76a00dac086", "score": "0.5408818", "text": "func pubKeyHash(pubKey []byte) ([]byte, error) {\n\tpubHash := sha256.Sum256(pubKey)\n\n\thasher := ripemd160.New()\n\tif _, err := hasher.Write(pubHash[:]); err != nil {\n\t\treturn nil, fmt.Errorf(\"PubKeyHash: %s\", err)\n\t}\n\treturn hasher.Sum(nil), nil\n}", "title": "" }, { "docid": "9776e5ca175cb62880c759644aac3fc5", "score": "0.5407788", "text": "func SavePublicPEMKey(fileName string, pubkey *rsa.PublicKey) {\n\tpubASN1, err := x509.MarshalPKIXPublicKey(pubkey)\n\tcheckError(err)\n\n\tvar pemkey = &pem.Block{\n\t\tType: \"RSA PUBLIC KEY\",\n\t\tBytes: pubASN1,\n\t}\n\n\tpemfile, err := os.Create(fileName)\n\tcheckError(err)\n\tdefer pemfile.Close()\n\n\terr = pem.Encode(pemfile, pemkey)\n\tcheckError(err)\n}", "title": "" }, { "docid": "d7edab01f593360702642ca157efb54a", "score": "0.5407711", "text": "func MarshalPublic(pub *PublicKey) ([]byte, error) {\n\tsubj, err := marshalSubjectPublicKeyInfo(pub)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn asn1.Marshal(subj)\n}", "title": "" }, { "docid": "56391368c93a793598cbcca9b7713c13", "score": "0.54009247", "text": "func BenchmarkParseCompressedPubKey(b *testing.B) {\n\trawPk, _ := hex.DecodeString(\"0234f9460f0e4f08393d192b3c5133a6ba099aa0ad9fd54ebccfacdfa239ff49c6\")\n\n\tvar (\n\t\tpk *PublicKey\n\t\terr error\n\t)\n\n\tb.ReportAllocs()\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tpk, err = ParsePubKey(rawPk)\n\t}\n\t_ = pk\n\t_ = err\n}", "title": "" }, { "docid": "88ce8ecc9f963e63860c8297a3375642", "score": "0.53960043", "text": "func (p *PublicKey) String() string {\n\treturn helper.BytesToHex(p.EncodeCompression())\n}", "title": "" }, { "docid": "fe3aeffaee5e5d1f1b7dcb58982eb276", "score": "0.53801036", "text": "func (ke *KeyEntry) PublicKey32() *[32]byte {\n\tif !ke.publicKeySet {\n\t\tpubKey, err := base64.Decode(ke.PUBKEY)\n\t\tif err != nil {\n\t\t\tpanic(log.Critical(err))\n\t\t}\n\t\tswitch ke.FUNCTION {\n\t\tcase \"ECDHE25519\":\n\t\t\tif ke.curve25519Key == nil {\n\t\t\t\tke.curve25519Key = new(cipher.Curve25519Key)\n\t\t\t}\n\t\t\tke.curve25519Key.SetPublicKey(pubKey)\n\t\tcase \"ED25519\":\n\t\t\tif ke.ed25519Key == nil {\n\t\t\t\tke.ed25519Key = new(cipher.Ed25519Key)\n\t\t\t}\n\t\t\tke.ed25519Key.SetPublicKey(pubKey)\n\t\t}\n\t\tke.publicKeySet = true\n\t}\n\tswitch ke.FUNCTION {\n\tcase \"ECDHE25519\":\n\t\treturn ke.curve25519Key.PublicKey()\n\tcase \"ED25519\":\n\t\treturn ke.ed25519Key.PublicKey()\n\tdefault:\n\t\tpanic(log.Critical(\"uid: should not happen\"))\n\t}\n}", "title": "" }, { "docid": "b1fa44d72ff616ac28b116ce3799d6e1", "score": "0.5375167", "text": "func (o *Host) SetPubkey(v string) {\n\to.Pubkey = &v\n}", "title": "" }, { "docid": "09d4a6d36faf5768b4eb7c676f83552a", "score": "0.53501695", "text": "func PublicKey() string {\n\treturn archaius.GetString(pubContentKey, \"\")\n}", "title": "" }, { "docid": "23b6e4aa7944ba1f6bce596e09833496", "score": "0.53479844", "text": "func HexToPubkey(s string) (PublicKey, error) {\n\tvar p PublicKey\n\n\texpectedLength := 256 * 2 * 64 // 256 blocks long, 2 rows, 64 hex char per block\n\n\t// first, make sure hex string is of correct length\n\tif len(s) != expectedLength {\n\t\treturn p, fmt.Errorf(\n\t\t\t\"Pubkey string %d characters, expect %d\", expectedLength)\n\t}\n\n\t// decode from hex to a byte slice\n\tbts, err := hex.DecodeString(s)\n\tif err != nil {\n\t\treturn p, err\n\t}\n\t// we already checked the length of the hex string so don't need to re-check\n\tbuf := bytes.NewBuffer(bts)\n\n\tfor i, _ := range p.ZeroHash {\n\t\tp.ZeroHash[i] = BlockFromByteSlice(buf.Next(32))\n\t}\n\tfor i, _ := range p.OneHash {\n\t\tp.OneHash[i] = BlockFromByteSlice(buf.Next(32))\n\t}\n\n\treturn p, nil\n}", "title": "" }, { "docid": "7f9c6d23bd2c6a591299791599ea1624", "score": "0.53408986", "text": "func (w Wallet) GetPublicKeyEncoded() string {\n\treturn hex.EncodeToString(w.PublicKey)\n}", "title": "" }, { "docid": "6338db3fd13b9d6c9c33306f01d7a057", "score": "0.5334898", "text": "func (pk *KexKey) SetPubkey(pubkey []byte) error {\n\tif len(pubkey) == 32 {\n\t\tpk.pubkey = new([32]byte)\n\t\tcopy(pk.pubkey[:], pubkey)\n\n\t\t// XXX TODO: handle error here...\n\t\tPubFP, _ := icutl.HashSHA3Data(pubkey)\n\n\t\t// copy and store the public fingerprint..\n\t\tcopy(pk.PubFP[:], PubFP)\n\t\treturn nil\n\t}\n\n\treturn &icutl.AcError{Value: -1, Msg: \"SetPubkeys(weird size): \", Err: nil}\n}", "title": "" }, { "docid": "b33ef66f182b7d3353c3d4852e0f8ac2", "score": "0.53334343", "text": "func PrivKeyToPubKey(privKey []byte) []byte {\n\t_, pubKeyObject := btcec.PrivKeyFromBytes(S256(), privKey[:])\n\treturn pubKeyObject.SerializeUncompressed()\n}", "title": "" }, { "docid": "da9c32057dd8771f84723e6a85af5b21", "score": "0.5331439", "text": "func PubKeyToPEM(pub crypto.PublicKey) ([]byte, error) {\n\tp, ok := pub.(*rsa.PublicKey)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unsupported public key type %T\", pub)\n\t}\n\tder := x509.MarshalPKCS1PublicKey(p)\n\treturn pem.EncodeToMemory(&pem.Block{Type: \"RSA PUBLIC KEY\", Bytes: der}), nil\n}", "title": "" }, { "docid": "75f890e9ba847c4854c0c1f611b76b10", "score": "0.5330452", "text": "func (pk PublicKey) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif pk.PublicKeyProperties != nil {\n\t\tobjectMap[\"properties\"] = pk.PublicKeyProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "8c7d3a1778aed98db1032f8c732e104b", "score": "0.5329747", "text": "func TestUncompressedPubkey(t *testing.T) {\n\tpubX, _ := UncompressedPubkeyOpenssl(\"0x0329ea23368f4c13815781ffd6259f16adf00cb5712014f7ebdf9faf7acd1bf9d4\")\n\tt.Log(pubX)\n\n\tpri, _ := GetPriKeyFromHex(common.Hex2Bytes(\"362bf3fbd7308925f075bf3ab5396c931d9f89ec68b3585e3f6541015b33706a\"))\n\tpub2 := GetPubKeyFromPri(pri)\n\tt.Log(pub2[33:])\n}", "title": "" }, { "docid": "cb31cd4b36ae926ee1fe5b11e2074368", "score": "0.53279126", "text": "func exportRSAPublicKey(session *pkcs11Session, pubHandle pkcs11.ObjectHandle) (crypto.PublicKey, error) {\n\ttemplate := []*pkcs11.Attribute{\n\t\tpkcs11.NewAttribute(pkcs11.CKA_MODULUS, nil),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_PUBLIC_EXPONENT, nil),\n\t}\n\texported, err := session.ctx.GetAttributeValue(session.handle, pubHandle, template)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar modulus = new(big.Int)\n\tmodulus.SetBytes(exported[0].Value)\n\tvar bigExponent = new(big.Int)\n\tbigExponent.SetBytes(exported[1].Value)\n\tif bigExponent.BitLen() > 32 {\n\t\treturn nil, errMalformedRSAPublicKey\n\t}\n\tif bigExponent.Sign() < 1 {\n\t\treturn nil, errMalformedRSAPublicKey\n\t}\n\texponent := int(bigExponent.Uint64())\n\tresult := rsa.PublicKey{\n\t\tN: modulus,\n\t\tE: exponent,\n\t}\n\tif result.E < 2 {\n\t\treturn nil, errMalformedRSAPublicKey\n\t}\n\treturn &result, nil\n}", "title": "" }, { "docid": "121dc85a263e0d3b31ba30dde857a0e1", "score": "0.53248346", "text": "func genPubkey(pubkey string) []byte {\n\n\t// \"EOS\" prefix remove\n\tdata := strings.TrimPrefix(pubkey, \"EOS\")\n\n\t// base58.decode\n\tbs := base58.Decode(data)\n\n\t// return after last 4bit remove\n\treturn bs[0 : len(bs)-4]\n}", "title": "" }, { "docid": "f23bbcf2716f07bf160dfde195bb09bb", "score": "0.53226084", "text": "func RSAPublicKeyToEncodedPEM(key *rsa.PrivateKey) []byte {\n\tPubASN1, err := x509.MarshalPKIXPublicKey(&key.PublicKey)\n\tif err != nil {\n\t\tvar empty []byte\n\t\treturn empty\n\t}\n\n\tpemdata := pem.EncodeToMemory(\n\t\t&pem.Block{\n\t\t\tType: \"RSA PUBLIC KEY\",\n\t\t\tBytes: PubASN1,\n\t\t},\n\t)\n\treturn pemdata\n}", "title": "" }, { "docid": "3281059ea2e4e21824d765df66814219", "score": "0.5318709", "text": "func (key *KeyPair) Serialize() []byte {\n\tpubkey, _ := key.ECPubKey()\n\treturn pubkey.SerializeCompressed()\n}", "title": "" }, { "docid": "8ac76c88cb1fba9007cf68caa8abcbab", "score": "0.5313983", "text": "func generatePublicKey(privatekey *rsa.PublicKey) ([]byte, error) {\n\tpublicRsaKey, err := ssh.NewPublicKey(privatekey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpubKeyBytes := ssh.MarshalAuthorizedKey(publicRsaKey)\n\n\treturn pubKeyBytes, nil\n}", "title": "" }, { "docid": "8ac76c88cb1fba9007cf68caa8abcbab", "score": "0.5313983", "text": "func generatePublicKey(privatekey *rsa.PublicKey) ([]byte, error) {\n\tpublicRsaKey, err := ssh.NewPublicKey(privatekey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpubKeyBytes := ssh.MarshalAuthorizedKey(publicRsaKey)\n\n\treturn pubKeyBytes, nil\n}", "title": "" }, { "docid": "0038d233cf8c7ae2cc052eb31e2295de", "score": "0.53105617", "text": "func importPublicKey(pubKey []byte) (*ecies.PublicKey, error) {\n\tvar pubKey65 []byte\n\tswitch len(pubKey) {\n\tcase 64:\n\t\t// add 'uncompressed key' flag\n\t\tpubKey65 = append([]byte{0x04}, pubKey...)\n\tcase 65:\n\t\tpubKey65 = pubKey\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid public key length %v (expect 64/65)\", len(pubKey))\n\t}\n\t// TODO: fewer pointless conversions\n\tpub := crypto.ToECDSAPub(pubKey65)\n\tif pub.X == nil {\n\t\treturn nil, fmt.Errorf(\"invalid public key\")\n\t}\n\treturn ecies.ImportECDSAPublic(pub), nil\n}", "title": "" }, { "docid": "47165cd159963098ff11543a3bfec9fc", "score": "0.5259063", "text": "func KeyForPublicKey(id peer.ID) string {\n\treturn \"/pk/\" + string(id)\n}", "title": "" }, { "docid": "7828baf1ec7e1efcf667bddb6a9e7c2b", "score": "0.5258177", "text": "func MarshalPKIXPublicKeyToPEM(key interface{}) ([]byte, error) {\n\tpkix, err := x509.MarshalPKIXPublicKey(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn pem.EncodeToMemory(\n\t\t&pem.Block{\n\t\t\tType: \"PUBLIC KEY\",\n\t\t\tBytes: pkix,\n\t\t},\n\t), nil\n}", "title": "" }, { "docid": "9860fa3ea2bbb1e9976a3a006295882c", "score": "0.5256797", "text": "func (p *PublicKey) ToProtobuf(key *rsa.PublicKey) {\n\tp.N = key.N.Text(62)\n\tp.E = int64(key.E)\n}", "title": "" }, { "docid": "336a44e57004400d779ccaec733a1e8a", "score": "0.52558", "text": "func AggregatePublicKeys(pubs [][]byte) (PublicKey, error) {\n\treturn currImplementation.AggregatePublicKeys(pubs)\n}", "title": "" }, { "docid": "c6c86a4d939b2b743b9a6c3b6a5ccfdf", "score": "0.5255043", "text": "func (p PublicKey) MarshalBinary() ([]byte, error) {\n\tb58prefix, b58decoded, err := Base58CheckDecode(string(p))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbuf := bytes.Buffer{}\n\n\t// write the tag byte\n\tvar expectedPkLength int\n\tswitch b58prefix {\n\tcase PrefixEd25519PublicKey:\n\t\texpectedPkLength = PubKeyLenEd25519\n\t\tbuf.WriteByte(byte(PubKeyTagEd25519))\n\tcase PrefixSecp256k1PublicKey:\n\t\texpectedPkLength = PubKeyLenSecp256k1\n\t\tbuf.WriteByte(byte(PubKeyTagSecp256k1))\n\tcase PrefixP256PublicKey:\n\t\texpectedPkLength = PubKeyLenP256\n\t\tbuf.WriteByte(byte(PubKeyTagP256))\n\tdefault:\n\t\treturn nil, xerrors.Errorf(\"unexpected base58check prefix: %s\", p)\n\t}\n\n\t// write the public key\n\tif len(b58decoded) != expectedPkLength {\n\t\treturn nil, xerrors.Errorf(\"expected public key for addr %s to be %d bytes long, saw %d\", p, expectedPkLength, len(b58decoded))\n\t}\n\tbuf.Write(b58decoded)\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "754129128ed2fb220b9171689d6bac4c", "score": "0.5253839", "text": "func (app *adapter) ToBytes(key Key) []byte {\n\tpubKey := key.Key()\n\treturn x509.MarshalPKCS1PublicKey(&pubKey)\n}", "title": "" }, { "docid": "9054ffdf4277e56d352c54cce8e4b5df", "score": "0.5250313", "text": "func CredulousEncode(plaintext string, salter Salter, pubkey ssh.PublicKey) (cipher string, salt string, err error) {\n\tsalt, err = salter.GenerateSalt()\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\ts := reflect.ValueOf(pubkey).Elem()\n\trsaKey := rsa.PublicKey{\n\t\tN: s.Field(0).Interface().(*big.Int),\n\t\tE: s.Field(1).Interface().(int),\n\t}\n\tout, err := rsa.EncryptOAEP(sha1.New(), rand.Reader, &rsaKey, []byte(salt+plaintext), []byte(\"Credulous\"))\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tcipher = base64.StdEncoding.EncodeToString(out)\n\treturn cipher, salt, nil\n}", "title": "" }, { "docid": "3ec61b3c9c0b2605b54938d7231c0b65", "score": "0.5244969", "text": "func EncryptDataWithPublicKey(data []byte) ([]byte, error) {\n\treturn rsa.EncryptOAEP(sha256.New(), rand.Reader, rsaPublic, data, nil)\n}", "title": "" }, { "docid": "6da64246eada0864434ac26797e8a1f1", "score": "0.524247", "text": "func (o *JsonNodeInfo) SetPublicKey(v string) {\n\to.PublicKey = &v\n}", "title": "" }, { "docid": "5683e1e63e0e2a394b3222532bfbd51e", "score": "0.52337915", "text": "func PublicKey(ab, p *big.Int, g int64) *big.Int {\n\treturn _0.Exp(big.NewInt(g), ab, p)\n}", "title": "" }, { "docid": "baa00515cb598d2217747fcc2973c8e0", "score": "0.523279", "text": "func isStrictPubKeyEncoding(pubKey []byte) bool {\n\tif len(pubKey) == 33 && (pubKey[0] == 0x02 || pubKey[0] == 0x03) {\n\t\t// Compressed\n\t\treturn true\n\t}\n\tif len(pubKey) == 65 {\n\t\tswitch pubKey[0] {\n\t\tcase 0x04:\n\t\t\t// Uncompressed\n\t\t\treturn true\n\n\t\tcase 0x06, 0x07:\n\t\t\t// Hybrid\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a17828bceee3b215727bad33754f100e", "score": "0.52253836", "text": "func serializeUncompressed(pub ecdsa.PublicKey) []byte {\n\tx := pub.X.Bytes()\n\ty := pub.Y.Bytes()\n\tif len(x) < BitcoinPrivKeyBytesLen {\n\t\tx = paddedPrepend(BitcoinPrivKeyBytesLen, x)\n\t}\n\tif len(y) < BitcoinPrivKeyBytesLen {\n\t\ty = paddedPrepend(BitcoinPrivKeyBytesLen, y)\n\t}\n\n\tresult := append([]byte{PubKeyUncompressedVPrefix}, x...)\n\tresult = append(result, y...)\n\treturn result\n}", "title": "" }, { "docid": "c1a497e896a375a68bc4b8c362974b51", "score": "0.5221836", "text": "func PublicKey(private, p *big.Int, g int64) *big.Int {\n\tz := big.NewInt(1)\n\treturn z.Exp(big.NewInt(g), private, p)\n}", "title": "" }, { "docid": "a0878d8bd50e0ba1f4301bc9748ffd29", "score": "0.5219388", "text": "func generatePublicKey(privatekey *rsa.PublicKey) ([]byte, error) {\n publicRsaKey, err := ssh.NewPublicKey(privatekey)\n if err != nil {\n return nil, err\n }\n\n pubKeyBytes := ssh.MarshalAuthorizedKey(publicRsaKey)\n\n log.Println(\"Public key generated\")\n return pubKeyBytes, nil\n}", "title": "" }, { "docid": "e83bf74004f1302983b2e60c62029469", "score": "0.52156985", "text": "func (rh *rsa_helper) EncryptByPublicKey(publicKey string, plainText string) (string, error) {\n\treturn rh.encrypt(true, publicKey, plainText)\n}", "title": "" }, { "docid": "9b5d9a18df3959c3ba069e18009c9be0", "score": "0.52140695", "text": "func (privKey PrivKey) PubKey() crypto.PubKey {\n\t_, pubkeyObject := secp256k1.PrivKeyFromBytes(secp256k1.S256(), privKey)\n\n\tpk := pubkeyObject.SerializeCompressed()\n\n\treturn PubKey(pk)\n}", "title": "" }, { "docid": "51363b157b9ba24f8468ec74a0c58953", "score": "0.52042407", "text": "func PublicKeyToAddress(bytes []byte, network byte) string {\n\tencode := []byte{network}\n\tencode = append(encode, bytes...)\n\thasher, err := blake2b.New(64, nil)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\t_, err = hasher.Write(append(ss58Prefix, encode...))\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\tchecksum := hasher.Sum(nil)\n\tencode = append(encode, checksum[:2]...)\n\treturn base58.Encode(encode)\n}", "title": "" }, { "docid": "66695fcc728877f3cab1f85fba2ed5db", "score": "0.5200112", "text": "func GetPubKeyIdentityKey(pubKey *PubKeyInfo) []byte {\n\talgoBz := make([]byte, 4)\n\tbinary.BigEndian.PutUint32(algoBz, uint32(pubKey.Algorithm))\n\n\treturn append(append(PubKeyIdentityKey, algoBz...), pubKey.PubKey...)\n}", "title": "" } ]
6663603b68c00ea21ca1b6ca44f9057e
GetIsAisSupportedOk returns a tuple with the IsAisSupported field value and a boolean to check if the value has been set.
[ { "docid": "1ef707acf0f4c0fba9579d09d2410c42", "score": "0.8083715", "text": "func (o *BankInterface) GetIsAisSupportedOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.IsAisSupported, true\n}", "title": "" } ]
[ { "docid": "a2435162851917705258f3096d67fa8e", "score": "0.7586849", "text": "func (o *BankInterface) GetIsAisSupported() bool {\n\tif o == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\n\treturn o.IsAisSupported\n}", "title": "" }, { "docid": "00cae23ba8ccbd9103149db0b3ff59bd", "score": "0.7521604", "text": "func (o *BankInterface) SetIsAisSupported(v bool) {\n\to.IsAisSupported = v\n}", "title": "" }, { "docid": "e73a93fa4a0b9a185fc6263ac170e0f6", "score": "0.61975867", "text": "func (o *CapabilitySwitchCapability) GetFcUplinkPortsAutoNegotiationSupportedOk() (*bool, bool) {\n\tif o == nil || o.FcUplinkPortsAutoNegotiationSupported == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FcUplinkPortsAutoNegotiationSupported, true\n}", "title": "" }, { "docid": "64153e55dd1da368dda08848e19f89cc", "score": "0.5961575", "text": "func (o *GetSupportedFeaturesOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "d8c133270362871acf4b16b296162bbd", "score": "0.5960534", "text": "func (o *ProcessorUnitAllOf) GetIsPlatformSupportedOk() (*bool, bool) {\n\tif o == nil || o.IsPlatformSupported == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsPlatformSupported, true\n}", "title": "" }, { "docid": "76f0c8a67a8814f0db7badd826955477", "score": "0.57036316", "text": "func (o *WorkflowTemplateFunctionMetaAllOf) GetIsGuidedModeSupportedOk() (*bool, bool) {\n\tif o == nil || o.IsGuidedModeSupported == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsGuidedModeSupported, true\n}", "title": "" }, { "docid": "f735dda3de4e1c531f1ba17bb4b0658a", "score": "0.56579137", "text": "func (o *CapabilitySwitchCapability) GetLocatorBeaconSupportedOk() (*bool, bool) {\n\tif o == nil || o.LocatorBeaconSupported == nil {\n\t\treturn nil, false\n\t}\n\treturn o.LocatorBeaconSupported, true\n}", "title": "" }, { "docid": "4634cc302645f2abce6fd0c648565608", "score": "0.5636042", "text": "func (o *SoftwarerepositoryCategoryMapperModelAllOf) GetIsNfsUpgradeSupportedOk() (*bool, bool) {\n\tif o == nil || o.IsNfsUpgradeSupported == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsNfsUpgradeSupported, true\n}", "title": "" }, { "docid": "757123fbb14f4e141d8448d6577e88e5", "score": "0.5609021", "text": "func (o *BankInterface) GetIsMoneyTransferSupportedOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.IsMoneyTransferSupported, true\n}", "title": "" }, { "docid": "c66e0d048d0def596a59ac5798930520", "score": "0.5604721", "text": "func (o *CapabilitySwitchCapability) GetSerenoNetflowSupportedOk() (*bool, bool) {\n\tif o == nil || o.SerenoNetflowSupported == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SerenoNetflowSupported, true\n}", "title": "" }, { "docid": "c63ee34d918f3dd2bec04afd9fc6dd71", "score": "0.5523292", "text": "func (o *CloudSkuRegionRateCardsAllOf) GetIsUserDefinedOk() (*bool, bool) {\n\tif o == nil || o.IsUserDefined == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsUserDefined, true\n}", "title": "" }, { "docid": "34f8d172ec5db9f4907e5e0800dc6b32", "score": "0.5497462", "text": "func (o *GetSupportedFeaturesNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "d34abaeaa1510524f136a76042f196e8", "score": "0.54839796", "text": "func (o *NiatelemetryNiaInventoryDcnm) GetIsSmartLicenseEnabledOk() (*bool, bool) {\n\tif o == nil || o.IsSmartLicenseEnabled == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsSmartLicenseEnabled, true\n}", "title": "" }, { "docid": "9126f27ce1c1ef175f7b2fad43c2aad3", "score": "0.54817724", "text": "func (o *HyperflexCapabilityAllOf) GetIscsiSupportedOk() (*bool, bool) {\n\tif o == nil || o.IscsiSupported == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IscsiSupported, true\n}", "title": "" }, { "docid": "fd54b5f5241b40e8492f109a78564f4e", "score": "0.5466146", "text": "func (o *NiatelemetryNiaInventoryFabricAllOf) GetIsEnableNxapiHttpOk() (*bool, bool) {\n\tif o == nil || o.IsEnableNxapiHttp == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsEnableNxapiHttp, true\n}", "title": "" }, { "docid": "407637124946c2554a39330ca76f65f8", "score": "0.54582304", "text": "func (o *CapabilitySwitchCapability) GetFanModulesSupportedOk() (*bool, bool) {\n\tif o == nil || o.FanModulesSupported == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FanModulesSupported, true\n}", "title": "" }, { "docid": "a71c9414e44e5a86ee6f5b0a7f349a86", "score": "0.54547256", "text": "func (_Contract *ContractCaller) SupportsInterface(opts *bind.CallOpts, interfaceID [4]byte) (bool, error) {\n\tvar out []interface{}\n\terr := _Contract.contract.Call(opts, &out, \"supportsInterface\", interfaceID)\n\n\tif err != nil {\n\t\treturn *new(bool), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(bool)).(*bool)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "245e70609c718dd61e009ede969edb08", "score": "0.54172355", "text": "func (o *PropertyDescriptorDTO) GetSupportsElOk() (*bool, bool) {\n\tif o == nil || o.SupportsEl == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SupportsEl, true\n}", "title": "" }, { "docid": "01ed4b25efe2a30686b18d14e49cf2d2", "score": "0.5413515", "text": "func (o *AuthMetadata) GetSupportedMethodsOk() (*AuthSupportedMethods, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SupportedMethods.Get(), o.SupportedMethods.IsSet()\n}", "title": "" }, { "docid": "3992ce8d3778915b31a404588422333c", "score": "0.54061514", "text": "func (o *NiatelemetryNiaLicenseState) GetFeatureActivatedOk() (*string, bool) {\n\tif o == nil || o.FeatureActivated == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FeatureActivated, true\n}", "title": "" }, { "docid": "49b209b266e09f4ac10ca2791884ddc4", "score": "0.54043263", "text": "func (o *OpenMessage) Is4BytesASCapable() (int32, bool) {\n\tv, ok := o.Capabilities[65]\n\tif !ok {\n\t\treturn 0, false\n\t}\n\n\treturn int32(binary.BigEndian.Uint32(v[0].Value)), true\n}", "title": "" }, { "docid": "34f2ff56591447368bbcbdec8c9912f0", "score": "0.5394682", "text": "func (o *GetSupportedFeaturesUnauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "c3f6bc6875b5b4ca3d8d7847a77bc736", "score": "0.5392956", "text": "func (_ERC1155 *ERC1155Caller) SupportsInterface(opts *bind.CallOpts, _interfaceId [4]byte) (bool, error) {\n\tvar out []interface{}\n\terr := _ERC1155.contract.Call(opts, &out, \"supportsInterface\", _interfaceId)\n\n\tif err != nil {\n\t\treturn *new(bool), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(bool)).(*bool)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "25900c5bad7367211a7cdeb31a3bcb28", "score": "0.53754205", "text": "func (o *GetSupportedFeaturesBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "5010a44c2377fe5b9da1add3f9fdd2e4", "score": "0.5361611", "text": "func (o *GetClusterSupportedPlatformsOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "c8207519084b26265ecb6b9984209571", "score": "0.5353965", "text": "func (o *CapabilitySwitchCapability) HasFcUplinkPortsAutoNegotiationSupported() bool {\n\tif o != nil && o.FcUplinkPortsAutoNegotiationSupported != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "483fccb3b6539b916400ab84e59ab47e", "score": "0.53478634", "text": "func (v VhdHeaderVersion) IsSupported() bool {\n\treturn v == VhdHeaderSupportedVersion\n}", "title": "" }, { "docid": "a957e787224bc536cb3bc991de8d1357", "score": "0.5322549", "text": "func (o *HyperflexCapabilityAllOf) GetEncryptionSupportedOk() (*bool, bool) {\n\tif o == nil || o.EncryptionSupported == nil {\n\t\treturn nil, false\n\t}\n\treturn o.EncryptionSupported, true\n}", "title": "" }, { "docid": "43313f74302efb2c214ead77faaea01a", "score": "0.53103423", "text": "func (o *PolicyExportModel) GetIsEnabledOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.IsEnabled, true\n}", "title": "" }, { "docid": "4a8ed25e0bc4d11a9318a2493b8d6f76", "score": "0.53061885", "text": "func (o *EnumeratePrivateImagesVSphereAccepted) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "1eb4580822fa84462cc37938e8b5c66a", "score": "0.53042483", "text": "func (o *V2ListSupportedOpenshiftVersionsOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "814ed260460219238be751f38282bd95", "score": "0.5278367", "text": "func (o *NiatelemetryNiaInventoryDcnm) GetIsIsnConfiguredOk() (*bool, bool) {\n\tif o == nil || o.IsIsnConfigured == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsIsnConfigured, true\n}", "title": "" }, { "docid": "31a2aea13d82af48e0c4a124add996cd", "score": "0.5267605", "text": "func (_ERC1155SwapAgent *ERC1155SwapAgentCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) {\n\tvar out []interface{}\n\terr := _ERC1155SwapAgent.contract.Call(opts, &out, \"supportsInterface\", interfaceId)\n\n\tif err != nil {\n\t\treturn *new(bool), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(bool)).(*bool)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "ca83617b64a0e2bf55e514905dcfff48", "score": "0.5256188", "text": "func (o *LaunchpadPresetTheme) GetIsActiveOk() (*bool, bool) {\n\tif o == nil || o.IsActive == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsActive, true\n}", "title": "" }, { "docid": "b8198680c0fe82793f7c893771e36b44", "score": "0.52489054", "text": "func (o *CapabilitySwitchCapability) GetFcUplinkPortsAutoNegotiationSupported() bool {\n\tif o == nil || o.FcUplinkPortsAutoNegotiationSupported == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.FcUplinkPortsAutoNegotiationSupported\n}", "title": "" }, { "docid": "465a2d3e24a7b5425242dd010a435bf7", "score": "0.5242767", "text": "func (o *HyperflexCapabilityAllOf) GetReplicationSupportedOk() (*bool, bool) {\n\tif o == nil || o.ReplicationSupported == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ReplicationSupported, true\n}", "title": "" }, { "docid": "37a79d09399dbde87374bbdbe9ed8f14", "score": "0.5242207", "text": "func (o *WorkflowPropertiesAllOf) GetSupportStatusOk() (*string, bool) {\n\tif o == nil || o.SupportStatus == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SupportStatus, true\n}", "title": "" }, { "docid": "314153aedafb16f44491bc440a7ddc44", "score": "0.523204", "text": "func (o *License) GetIsActiveOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.IsActive, true\n}", "title": "" }, { "docid": "c3504bf36c624d92992d8cf4d0cfdafe", "score": "0.52049214", "text": "func (o *CloudSkuVolumeType) GetIsBootableOk() (*bool, bool) {\n\tif o == nil || o.IsBootable == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsBootable, true\n}", "title": "" }, { "docid": "6ab2cf8cdac9cc55fe08f652dd2e1885", "score": "0.5198376", "text": "func (_ThreeAffinityDuelResolver *ThreeAffinityDuelResolverCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _ThreeAffinityDuelResolver.contract.Call(opts, out, \"supportsInterface\", interfaceId)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "be20ba1ec39bccf44cbd4d9a28534d87", "score": "0.51979494", "text": "func (o *GetSupportedFeaturesForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "10ef9fbf1de2bd6fda90ce4ef8037378", "score": "0.5195479", "text": "func (o *V2ListSupportedOperatorsOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "41a6ba709e88be43cfb9090b3947bad8", "score": "0.5187859", "text": "func (o *ProcessorUnitAllOf) GetIsPlatformSupported() bool {\n\tif o == nil || o.IsPlatformSupported == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.IsPlatformSupported\n}", "title": "" }, { "docid": "6c1af1883c0495e476c7d228bb8090b5", "score": "0.517623", "text": "func (o *GetSupportedFeaturesServiceUnavailable) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "781fe2516184d5781c6a00dcabd15611", "score": "0.5169214", "text": "func (_JobManager *JobManagerCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) {\n\tvar out []interface{}\n\terr := _JobManager.contract.Call(opts, &out, \"supportsInterface\", interfaceId)\n\n\tif err != nil {\n\t\treturn *new(bool), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(bool)).(*bool)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "ca9167d2705afe1124e5ff380119cde0", "score": "0.5155389", "text": "func (o *OverloadedStorageDetectionConfig) GetEnabledOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Enabled, true\n}", "title": "" }, { "docid": "ae95478582bd2d781ff1347aa9f7cca6", "score": "0.51420873", "text": "func VipsIsTypeSupported(t ImageType) bool {\n\tif t == JPEG {\n\t\treturn int(C.vips_type_find_bridge(C.JPEG)) != 0\n\t}\n\tif t == WEBP {\n\t\treturn int(C.vips_type_find_bridge(C.WEBP)) != 0\n\t}\n\tif t == PNG {\n\t\treturn int(C.vips_type_find_bridge(C.PNG)) != 0\n\t}\n\tif t == GIF {\n\t\treturn int(C.vips_type_find_bridge(C.GIF)) != 0\n\t}\n\tif t == PDF {\n\t\treturn int(C.vips_type_find_bridge(C.PDF)) != 0\n\t}\n\tif t == SVG {\n\t\treturn int(C.vips_type_find_bridge(C.SVG)) != 0\n\t}\n\tif t == TIFF {\n\t\treturn int(C.vips_type_find_bridge(C.TIFF)) != 0\n\t}\n\tif t == MAGICK {\n\t\treturn int(C.vips_type_find_bridge(C.MAGICK)) != 0\n\t}\n\tif t == HEIF {\n\t\treturn int(C.vips_type_find_bridge(C.HEIF)) != 0\n\t}\n\tif t == AVIF {\n\t\treturn int(C.vips_type_find_bridge(C.HEIF)) != 0\n\t}\n\treturn false\n}", "title": "" }, { "docid": "28bd6dc953a9fcccfc956a544cf68313", "score": "0.5121269", "text": "func (o *NiatelemetryEpg) GetIsAttrBasedOk() (*string, bool) {\n\tif o == nil || o.IsAttrBased == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsAttrBased, true\n}", "title": "" }, { "docid": "34c9676ad9474ec052b72c5434b82522", "score": "0.51185554", "text": "func (o *LaunchpadButton) GetIsActiveOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.IsActive, true\n}", "title": "" }, { "docid": "6aa5658a9053dc66af6216c6a6355645", "score": "0.51152986", "text": "func (o *CapabilitySwitchCapability) GetDynamicVifsSupportedOk() (*bool, bool) {\n\tif o == nil || o.DynamicVifsSupported == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DynamicVifsSupported, true\n}", "title": "" }, { "docid": "0d10736b48091cc88945f8ade3eeb64f", "score": "0.51127636", "text": "func Supported() bool {\n\t// Strict mode requires that flags be set to 0, but we are sending 1 so\n\t// this will return EINVAL if the syscall exists and is allowed.\n\tif err := seccomp(seccompSetModeStrict, 1, nil); err == syscall.EINVAL {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fdf6cb50263ec10b84100868544305b6", "score": "0.510741", "text": "func (o *CloudSkuVolumeType) GetIsDefaultOk() (*bool, bool) {\n\tif o == nil || o.IsDefault == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsDefault, true\n}", "title": "" }, { "docid": "13820640946f617094184b092a0384b2", "score": "0.5094071", "text": "func (o *ModelsVersion) GetEnabledOk() (*bool, bool) {\n\tif o == nil || o.Enabled == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Enabled, true\n}", "title": "" }, { "docid": "ec4c2812115696c8feaefc03c48a8fc7", "score": "0.50814563", "text": "func (o *Ec2CandidateCpuSaturationDetectionConfig) GetEnabledOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Enabled, true\n}", "title": "" }, { "docid": "ca71c6c3552c6b65f217ced4121c456a", "score": "0.5058132", "text": "func (o *GetPlatformsOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "7285e6ff47655b157422d9b322d644ca", "score": "0.50559974", "text": "func (o *NiatelemetryNiaInventoryFabricAllOf) GetIsScheduledBackUpEnabledOk() (*bool, bool) {\n\tif o == nil || o.IsScheduledBackUpEnabled == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsScheduledBackUpEnabled, true\n}", "title": "" }, { "docid": "ac94c401bff029c859a98d326b0279ee", "score": "0.50393677", "text": "func (o *MicrosoftGraphSignIn) GetIsInteractiveOk() (bool, bool) {\n\tif o == nil || o.IsInteractive == nil {\n\t\tvar ret bool\n\t\treturn ret, false\n\t}\n\treturn *o.IsInteractive, true\n}", "title": "" }, { "docid": "93bd4b2ef19fd9ab5aa05af436524a4d", "score": "0.5039348", "text": "func (o *FcSwitchCollectionGetOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "a44ba968c1fa37d082a3b081e6f6c48a", "score": "0.503684", "text": "func (p Protocol) Supported() bool {\n\treturn !p.Unknown()\n}", "title": "" }, { "docid": "508adf1ff65088725fabb1e0e386ca34", "score": "0.5033817", "text": "func (o *CapabilitySwitchCapability) GetLocatorBeaconSupported() bool {\n\tif o == nil || o.LocatorBeaconSupported == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.LocatorBeaconSupported\n}", "title": "" }, { "docid": "0909a518714a3d35e63fbf520e1d93f2", "score": "0.50299287", "text": "func siadFlagSupported(siadPath, flag string) (bool, error) {\n\tsiadHelpCommand := fmt.Sprintf(\"%v -h\", siadPath)\n\thelpCmd := exec.Command(\"sh\", \"-c\", siadHelpCommand) //nolint:gosec\n\toutput, err := helpCmd.Output()\n\tif err != nil {\n\t\treturn false, errors.AddContext(err, \"unable to determine siad flag support\")\n\t}\n\toutputStr := string(output)\n\tif strings.Contains(outputStr, flag) {\n\t\treturn true, nil\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "d0e51d3cb5f9b729f29e01b0ae906389", "score": "0.50208837", "text": "func (o *SnaplockFingerprintOperationCreateAccepted) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "4628f8499e608dc4fad780a4368b1489", "score": "0.50204074", "text": "func (o *NiatelemetryNiaInventoryDcnm) GetHaEnabledOk() (*bool, bool) {\n\tif o == nil || o.HaEnabled == nil {\n\t\treturn nil, false\n\t}\n\treturn o.HaEnabled, true\n}", "title": "" }, { "docid": "9d006c116d6d89d8362b9eb0b0fdc573", "score": "0.50138885", "text": "func (o *NiatelemetryNiaInventoryFabricAllOf) GetIsBgwPresentOk() (*bool, bool) {\n\tif o == nil || o.IsBgwPresent == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsBgwPresent, true\n}", "title": "" }, { "docid": "0c30d2ca602b437aa11716989b897243", "score": "0.5003914", "text": "func (o *WorkflowTemplateFunctionMetaAllOf) GetIsGuidedModeSupported() bool {\n\tif o == nil || o.IsGuidedModeSupported == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.IsGuidedModeSupported\n}", "title": "" }, { "docid": "0c2b6247d5041d71054756edfbac73ac", "score": "0.49967903", "text": "func (o *GroupProperties) GetCreateInternetAccessOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CreateInternetAccess, true\n}", "title": "" }, { "docid": "96912659369df84430495a2c0affe82c", "score": "0.4991783", "text": "func (o *DocumentAnalysis) GetImageQualityOk() (*ImageQuality, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ImageQuality, true\n}", "title": "" }, { "docid": "4f159e3c80f44bc1a25194fdce6d8546", "score": "0.49843994", "text": "func (o *GetMetaOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "a7735275e51bb17c7ba28584f67c44b8", "score": "0.4978082", "text": "func (km *EcdsaVerifyKeyManager) DoesSupport(typeURL string) bool {\r\n\treturn typeURL == EcdsaVerifyTypeURL\r\n}", "title": "" }, { "docid": "52863c6397dc069d9a123e567a37df19", "score": "0.49712834", "text": "func (o *RemotePluginEndpoint) GetEnabledOk() (*bool, bool) {\n\tif o == nil || o.Enabled == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Enabled, true\n}", "title": "" }, { "docid": "8db279525426ec6938fc028576d4384e", "score": "0.49644497", "text": "func (o *DnsServerDataData) GetServerGuardianSupportedOk() (*string, bool) {\n\tif o == nil || o.ServerGuardianSupported == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ServerGuardianSupported, true\n}", "title": "" }, { "docid": "db23834fc1c06861bc34f6ff1c64836f", "score": "0.4959442", "text": "func (o *VerifyAWSAccountAccessOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "a923ac2e5d9700a41866f703c211db09", "score": "0.49593583", "text": "func (o *NiatelemetryNiaLicenseState) GetLicenseActivatedOk() (*string, bool) {\n\tif o == nil || o.LicenseActivated == nil {\n\t\treturn nil, false\n\t}\n\treturn o.LicenseActivated, true\n}", "title": "" }, { "docid": "657795981f5b6f4ff7ecc382b623db91", "score": "0.4957427", "text": "func (o *BankSearchParams) SetIsAutoPaySupported(isAutoPaySupported *bool) {\n\to.IsAutoPaySupported = isAutoPaySupported\n}", "title": "" }, { "docid": "0390177e65eca5bf2525623214c02cc0", "score": "0.49549156", "text": "func (_Contract *ContractCallerSession) SupportsInterface(interfaceID [4]byte) (bool, error) {\n\treturn _Contract.Contract.SupportsInterface(&_Contract.CallOpts, interfaceID)\n}", "title": "" }, { "docid": "9de1d3e17a9bccf21749cfd8e0eb8ae4", "score": "0.49527246", "text": "func (o *SyntheticsTestRequest) GetAllowInsecureOk() (*bool, bool) {\n\tif o == nil || o.AllowInsecure == nil {\n\t\treturn nil, false\n\t}\n\treturn o.AllowInsecure, true\n}", "title": "" }, { "docid": "287f38428e779835902e2f5ff95ec1fc", "score": "0.4948067", "text": "func (o *CapabilitySwitchCapability) HasLocatorBeaconSupported() bool {\n\tif o != nil && o.LocatorBeaconSupported != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "95524b1d5acbccada5c4e3c336bff4e0", "score": "0.49313647", "text": "func (o LookupAmiResultOutput) EnaSupport() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v LookupAmiResult) bool { return v.EnaSupport }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "86c48d93bc38195afc4035c66e25d9eb", "score": "0.49231538", "text": "func (_ThreeAffinityDuelResolver *ThreeAffinityDuelResolverCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) {\n\treturn _ThreeAffinityDuelResolver.Contract.SupportsInterface(&_ThreeAffinityDuelResolver.CallOpts, interfaceId)\n}", "title": "" }, { "docid": "fb708842689374244065710f1e61a058", "score": "0.49211144", "text": "func Supported() bool {\n\treturn true\n}", "title": "" }, { "docid": "fb708842689374244065710f1e61a058", "score": "0.49211144", "text": "func Supported() bool {\n\treturn true\n}", "title": "" }, { "docid": "fb708842689374244065710f1e61a058", "score": "0.49211144", "text": "func Supported() bool {\n\treturn true\n}", "title": "" }, { "docid": "90eb77ea60d2f026c087de8da26c93c0", "score": "0.4921048", "text": "func (o *PaymentAccountModel) GetIsActiveOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.IsActive, true\n}", "title": "" }, { "docid": "ca8c7d1fb30952f2a955d572ffa74446", "score": "0.49196476", "text": "func (_ERC1155SwapAgent *ERC1155SwapAgentCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) {\n\treturn _ERC1155SwapAgent.Contract.SupportsInterface(&_ERC1155SwapAgent.CallOpts, interfaceId)\n}", "title": "" }, { "docid": "a7b2352ef93d23e06adf0371cdf05042", "score": "0.49128607", "text": "func GetSpecVersionSupported() version.PluginInfo {\n\treturn specVersionSupported\n}", "title": "" }, { "docid": "4ac5f1b348f5fc2e1ac4290668b5bcb4", "score": "0.4910264", "text": "func (o *GetIntegrationOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "f6cdbfd73667a9cddf2f4d83bd6da347", "score": "0.49087042", "text": "func (o *DefaultFrontEndCacheOptions) GetEnableOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Enable, true\n}", "title": "" }, { "docid": "ee3dda6d40c49d85024b90e16a31f1c3", "score": "0.4905315", "text": "func (p *Prober) IsOk() error {\n\tp.statusMtx.Lock()\n\tdefer p.statusMtx.Unlock()\n\treturn p.status\n}", "title": "" }, { "docid": "de6b8154400365dccbabb3a596ab3865", "score": "0.49007967", "text": "func (o *EmsFilterGetOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "057b8f8fa4141d2787c01a11bf4bc97a", "score": "0.48970994", "text": "func (o *SecurityMonitoringRuleUpdatePayload) GetEnabledOk() (*bool, bool) {\n\tif o == nil || o.Enabled == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Enabled, true\n}", "title": "" }, { "docid": "bdaf12d91cf9c156847687448c713c04", "score": "0.4893966", "text": "func CompressionIsSupported(f compress.Format) bool {\n\tswitch f {\n\tcase compress.LZ4:\n\t\treturn true\n\tcase compress.GZip:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "e1db96725784b514d374d55fe4217202", "score": "0.48927876", "text": "func (E_SrlNokiaIsis_IsisProtocolsSupported) IsYANGGoEnum() {}", "title": "" }, { "docid": "20bb8396bfa736df5f9d94c34447e262", "score": "0.4885841", "text": "func (o *EquipmentIoCardAllOf) GetDcSupportedOk() (*bool, bool) {\n\tif o == nil || o.DcSupported == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DcSupported, true\n}", "title": "" }, { "docid": "51707f3d2d9de676e7692e34fc96cb7a", "score": "0.48769212", "text": "func (o *FileDirectorySecurityCreateAccepted) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "36b86542b1cc6ebc0bef8884542bcba0", "score": "0.4876461", "text": "func (o *GetVersionByIDUsingGET2OK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "ab828b44d96be67508b4c868c2abff6b", "score": "0.487601", "text": "func (i *Image) IsSupported(kubeAPIServerVersionStr string) error {\n\tkubeAPIServerVersion, err := versionutil.ParseSemantic(\n\t\tkubeAPIServerVersionStr,\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to parse kube-apiserver version: %w\", err)\n\t}\n\n\t// kubelet must not be newer than kube-apiserver\n\tif kubeAPIServerVersion.Minor() < i.KubeletVersion.Minor() {\n\t\treturn ErrInvalidImageKubeletNew\n\t}\n\t// ... and may be up to two minor versions older.\n\tif kubeAPIServerVersion.Minor()-i.KubeletVersion.Minor() > 2 {\n\t\treturn ErrInvalidImageKubeletOld\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "40203bea497ef9fc8ac3abb89cc336f2", "score": "0.48758364", "text": "func (o *AdvancedJavaScriptTagSettings) GetInstrumentUnsupportedAjaxFrameworksOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.InstrumentUnsupportedAjaxFrameworks, true\n}", "title": "" }, { "docid": "a9fbb27981ae0d945fc43bd200b5b047", "score": "0.48728603", "text": "func (o *GetClusterSupportedPlatformsNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "8a53189963c24992f48134fe85f708ca", "score": "0.48718256", "text": "func (o *DnsServerDataData) GetServerGuardianGuiManagementSupportedOk() (*string, bool) {\n\tif o == nil || o.ServerGuardianGuiManagementSupported == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ServerGuardianGuiManagementSupported, true\n}", "title": "" }, { "docid": "8f202197c8ee7f8b3fa45dc4b056b3c3", "score": "0.4867389", "text": "func (o *VvolBindingGetOK) IsSuccess() bool {\n\treturn true\n}", "title": "" } ]
5e75414f440010c1d3e566dc18b4f234
GetNSHandler returns a NSHandler with given name
[ { "docid": "27710f1b0ef8b14882f480caa018809f", "score": "0.82881415", "text": "func (m *Multiplexer) GetNSHandler(name string) (NSHandler, error) {\n\tif hdr, ok := (*m.nshandlers)[name]; ok {\n\t\treturn hdr, nil\n\t}\n\treturn nil, fmt.Errorf(\"nshandler with name '%s' not registered\", name)\n}", "title": "" } ]
[ { "docid": "d635a966d6b9161b33e66b1e62a22691", "score": "0.5953683", "text": "func (m *Multiplexer) RegisterNSHandler(name string, hdr NSHandler) error {\n\tif _, ok := (*m.nshandlers)[name]; ok {\n\t\treturn fmt.Errorf(\"nshandler with name '%s' already registered\", name)\n\t}\n\t(*m.nshandlers)[name] = hdr\n\treturn nil\n}", "title": "" }, { "docid": "bf5a46551bc5cef9b98336181f9e8dc9", "score": "0.49471653", "text": "func GetHandler(p int) string {\n\treturn portConf.Ports[p]\n}", "title": "" }, { "docid": "4e6efa8ae60de98b145a14302422589c", "score": "0.49194184", "text": "func (m *Multiplexer) GetHandler(name string) (Handler, error) {\n\tif hdr, ok := (*m.handlers)[name]; ok {\n\t\treturn hdr, nil\n\t}\n\treturn nil, fmt.Errorf(\"handler with name '%s' not registered\", name)\n}", "title": "" }, { "docid": "d39984d9e835be7fb4625ba72837b53c", "score": "0.49038574", "text": "func NewDNSHandler() dnsutils.Handler {\n\treturn new(checkMsgHandler)\n}", "title": "" }, { "docid": "8986f49f84ba4354f8a4d38ff5a93efe", "score": "0.48912066", "text": "func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {\n\t_, e1 := callgetsockname(fd, uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))\n\tif e1 != 0 {\n\t\terr = errnoErr(e1)\n\t}\n\treturn\n}", "title": "" }, { "docid": "3b214b638bae5701371a1fb4986290c5", "score": "0.48850203", "text": "func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {\n\t_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&libc_getsockname)), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)\n\tif e1 != 0 {\n\t\terr = errnoErr(e1)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f917f4304adb2075fd3a1cfbf9d74b8f", "score": "0.48424044", "text": "func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {\n\tr0, er := C.getsockname(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(rsa))), C.uintptr_t(uintptr(unsafe.Pointer(addrlen))))\n\tif r0 == -1 && er != nil {\n\t\terr = er\n\t}\n\treturn\n}", "title": "" }, { "docid": "4ebcc8a7f1456c036b5d1d66e1e2a880", "score": "0.46687368", "text": "func NHandler() *Handler {\n\treturn &Handler{\n\t\tcallbacks: map[reflect.Type][]func(interface{}){},\n\t}\n}", "title": "" }, { "docid": "a634b627ab14aef18fbdea30ca347f11", "score": "0.4532163", "text": "func ToSyscallName(sysno uint) (string, error) {\n\tif errInfo != nil {\n\t\treturn \"\", errInfo\n\t}\n\tn, ok := info.SyscallNumbers[int(sysno)]\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"syscall no %d does not exits\", sysno)\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "2432808a37458689fdd436250e01b1f6", "score": "0.45025378", "text": "func (l *Logger) GetHandler(name string) (Handler, error) {\n\tl.mutex.RLock()\n\tdefer l.mutex.RUnlock()\n\n\thandler, ok := l.handlers[name]\n\n\tif !ok {\n\t\treturn nil, NewRuntimeError(\"cannot get handler\", name)\n\t}\n\n\treturn handler, nil\n}", "title": "" }, { "docid": "cbbc3b8a3c069a83bcde40bf3a5e2fcf", "score": "0.4498133", "text": "func (c *dummyChecker) GetSigHash(script []byte, hashType txscript.SigHashType, sigVersion int) ([]byte, error) {\n\tvar err error\n\tif sigVersion == 1 {\n\t\treturn txscript.CalcWitnessSigHash(script, c.sigHashes, hashType, c.tx, c.nIn, c.amount)\n\t}\n\n\tvar pops []parsedOpcode\n\tpops, err = parseScript(script)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to parse script for sighash\")\n\t}\n\thash := CalcSignatureHash(pops, hashType, c.tx, c.nIn)\n\treturn hash, nil\n}", "title": "" }, { "docid": "65ea39e27dd299fa52b5cb8c21b17939", "score": "0.44845974", "text": "func GetSyscallFnName(name string) (string, error) {\n\t// Get kernel symbols\n\tsyms, err := ioutil.ReadFile(defaultSymFile)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn getSyscallFnNameWithKallsyms(name, string(syms))\n}", "title": "" }, { "docid": "65403485eccb4d06f7dcc046f0c2496c", "score": "0.44593456", "text": "func (n *node) getHandler(method string) HandlerFunc {\n\tmethod = n.fmtMethod(method)\n\th, ok := n.handlers[method]\n\tif !ok {\n\t\th = n.handlers[\"*\"]\n\t}\n\treturn h\n}", "title": "" }, { "docid": "0999c9b6231aa9ef0c7b58f83ad079a4", "score": "0.44103494", "text": "func Dlsym(handle uintptr, name string) (uintptr, error) {\n\tu := fnDlsym(handle, name)\n\tif u == 0 {\n\t\treturn 0, Dlerror{fnDlerror()}\n\t}\n\treturn u, nil\n}", "title": "" }, { "docid": "9aab3b611b9efcb61cfab54bd340d5df", "score": "0.44038066", "text": "func NewHandler(db *sql.DB) *DNSHandler {\n\tcache := &MemoryCache{\n\t\tStorage: make(map[string]Message, config.CacheLimit),\n\t\tMaxCount: config.CacheLimit,\n\t}\n\tcache.Start()\n\n\treturn &DNSHandler{db: db, cache: cache}\n}", "title": "" }, { "docid": "e5949e6cb8849532b4f754f7e1fc1ee8", "score": "0.44007412", "text": "func GetFromRegistry(key string) api.Handler {\n\treturn handlerRegistry[key]\n}", "title": "" }, { "docid": "a1f3bedd5dd6e02313f0c1ffd82de0c7", "score": "0.43965235", "text": "func (h *DBHandler) GetName() string {\n\treturn \"Default handler\"\n}", "title": "" }, { "docid": "0f6efcbd03617382a697827e488821ee", "score": "0.4378453", "text": "func (r *PrefixedRegistry) Get(name string) interface{} {\n\trealName := r.prefix + name\n\treturn r.underlying.Get(realName)\n}", "title": "" }, { "docid": "dc6208cd78dcbebbe3eeabc36159b86a", "score": "0.43773615", "text": "func GetFd(l interface{}) uintptr {\n\tv := reflect.ValueOf(l).Elem().FieldByName(\"fd\").Elem()\n\treturn uintptr(v.FieldByName(\"sysfd\").Int())\n}", "title": "" }, { "docid": "9ee1a8831d5eb7e724b9b343e1cc5f64", "score": "0.43483478", "text": "func (c *Context64) SyscallNo() uintptr {\n\treturn uintptr(c.Regs.Regs[8])\n}", "title": "" }, { "docid": "6b0dba47e20ff342d7be4dba9aa644d1", "score": "0.43326914", "text": "func GetCurrentNS() (string, error) {\n\tbuf := make([]byte, MaxSymLink)\n\tnumBytes, err := syscall.Readlink(netnsfile, buf)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tlink := string(buf[0:numBytes])\n\tnsRegExp := regexp.MustCompile(\"net:\\\\[(.*)\\\\]\")\n\tsubmatches := nsRegExp.FindStringSubmatch(link)\n\tif len(submatches) >= 1 {\n\t\treturn submatches[1], nil\n\t}\n\treturn \"\", errors.New(\"namespace is not found\")\n}", "title": "" }, { "docid": "00830293b94cde2ba42259b212a9235b", "score": "0.43252137", "text": "func (p *Producer) GetNsServerPort() string {\n\tp.RLock()\n\tdefer p.RUnlock()\n\treturn p.nsServerPort\n}", "title": "" }, { "docid": "6f1dcec79ff487a016223f52fd029de7", "score": "0.43127993", "text": "func GetSigOpCount(script []byte) (int, error) {\n\tpops, err := parseScript(script)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn getSigOpCount(pops, false), nil\n}", "title": "" }, { "docid": "db82f69ae7806896a5b48d7d72afd885", "score": "0.43093416", "text": "func (transport *ZMQTransport) getVnodeHandler(dest *Vnode) (VnodeHandler, error) {\n\th, ok := transport.table[dest.String()]\n\tif ok {\n\t\treturn h.handler, nil\n\t}\n\treturn nil, fmt.Errorf(\"local vnode handler not found\")\n}", "title": "" }, { "docid": "8effaf2f189497418c671c267192e168", "score": "0.43050343", "text": "func newSockJSHandler(s *HTTPServer, sockjsPrefix string, sockjsOpts sockjs.Options) http.Handler {\n\treturn sockjs.NewHandler(sockjsPrefix, sockjsOpts, s.sockJSHandler)\n}", "title": "" }, { "docid": "303dceaec85a04317ea3ebfb3835c01f", "score": "0.42859006", "text": "func New(path string) (*Handle, error) {\n\tsetup()\n\n\tn := netns.None()\n\tif path != \"\" {\n\t\tvar err error\n\t\tn, err = netns.GetFromPath(path)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdefer n.Close()\n\n\tsock, err := nl.GetNetlinkSocketAt(n, netns.None(), unix.NETLINK_GENERIC)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Add operation timeout to avoid deadlocks\n\ttv := unix.NsecToTimeval(netlinkSendSocketTimeout.Nanoseconds())\n\tif err := sock.SetSendTimeout(&tv); err != nil {\n\t\treturn nil, err\n\t}\n\ttv = unix.NsecToTimeval(netlinkRecvSocketsTimeout.Nanoseconds())\n\tif err := sock.SetReceiveTimeout(&tv); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Handle{sock: sock}, nil\n}", "title": "" }, { "docid": "ba6cc64661bb77e8c86f64726526af82", "score": "0.427276", "text": "func LookupNS(name string) ([]*net.NS, error)", "title": "" }, { "docid": "ff65ade7ded3bc34ceb11fb96ff3be36", "score": "0.42439407", "text": "func findEventHandlerIdx(eh *EventHandler) int {\r\n\tfor i, v := range globalEventHandlers {\r\n\t\tif v == eh {\r\n\t\t\treturn i\r\n\t\t}\r\n\t}\r\n\treturn handlerNotFound\r\n}", "title": "" }, { "docid": "295264a926ce5db91c994129dbc7a98b", "score": "0.42155582", "text": "func (m *Manager) GetHandle(id string) (string, error) {\n\th, err := m.getHandler(id)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn h.handle(), nil\n}", "title": "" }, { "docid": "0dc409919b529fd81e49907945398a6d", "score": "0.42054424", "text": "func __native_entry__() uintptr", "title": "" }, { "docid": "3675ab95a4cf923f78d6361a2c089900", "score": "0.42050594", "text": "func GetSocket(ctx []T) int32 {\n\tcctx, _ := (*C.modbus_t)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&ctx)).Data)), cgoAllocsUnknown\n\t__ret := C.modbus_get_socket(cctx)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "4b8aaf648488fe56e0955fa814142dc0", "score": "0.4195599", "text": "func (handlers *SimpleHandlers) Get(key string) (Handler, error) {\n\thandlers.safe()\n\tif hand, found := handlers.handlers[key]; found {\n\t\treturn hand, nil\n\t} else {\n\t\treturn hand, errors.New(\"No such handler found\")\n\t}\n}", "title": "" }, { "docid": "085e6668dafb0b46dad94e5feff19ad9", "score": "0.41893134", "text": "func (recv *Device) GetNKeys() int32 {\n\tretC := C.gdk_device_get_n_keys((*C.GdkDevice)(recv.native))\n\tretGo := (int32)(retC)\n\n\treturn retGo\n}", "title": "" }, { "docid": "62599ae196cda0e973e8587dee4507c5", "score": "0.41866153", "text": "func GetByName(name string) (ns.NetNS, error) {\n\tnsPath := filepath.Join(netNSPath, name)\n\tn, err := ns.GetNS(nsPath)\n\tvar ne ns.NSPathNotExistErr\n\tif errors.As(err, &ne) {\n\t\treturn nil, os.ErrNotExist\n\t}\n\n\treturn n, err\n}", "title": "" }, { "docid": "e1d03e99057e409dcd6b19cc39c24133", "score": "0.41838366", "text": "func (m *WindowsFirewallRule) GetPackageFamilyName()(*string) {\n val, err := m.GetBackingStore().Get(\"packageFamilyName\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "cf6f8749447f0f20082a847ad564ddbc", "score": "0.4181124", "text": "func defaultSyscall() { Halt() }", "title": "" }, { "docid": "3584ca5303af61bc9b12ef3f983f55c1", "score": "0.417219", "text": "func GetHandler(packageType string) http.Handler {\n\tswitch packageType {\n\tcase prometheusPackage:\n\t\treturn promhttp.Handler()\n\tdefault:\n\t\t// expvar\n\t\treturn expvar.Handler()\n\t}\n}", "title": "" }, { "docid": "76bb13928208c2d775a2f77fb8b08fc7", "score": "0.41714615", "text": "func (h *NetLinkHandler) GetInterfaceType(ifName string) (string, error) {\n\tlink, err := h.GetLinkByName(ifName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn link.Type(), nil\n}", "title": "" }, { "docid": "585d60bdd749e46af70c0bcfbbf9a4f4", "score": "0.4161523", "text": "func SystemStack() uintptr", "title": "" }, { "docid": "538937101995868fe2dc0f1bfa5c6e42", "score": "0.41600955", "text": "func (b *NFSBackend) Name() string {\n\treturn \"NFS\"\n}", "title": "" }, { "docid": "878f43ea44e35ed943bf5dcad64aee71", "score": "0.41596514", "text": "func (self *TraitSubprocess) GetTermSig() (return__ int) {\n\tvar __cgo__return__ C.gint\n\t__cgo__return__ = C.g_subprocess_get_term_sig(self.CPointer)\n\treturn__ = int(__cgo__return__)\n\treturn\n}", "title": "" }, { "docid": "1ad333d9284dfeecaf5c8d2ec3f343d5", "score": "0.4159397", "text": "func SyscallNameFromErr(err error) string {\n\tif sysErr, ok := err.(*os.SyscallError); ok {\n\t\treturn sysErr.Syscall\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a3277e9cda46c87ed90a2249d122385e", "score": "0.4158635", "text": "func (m *WindowsFirewallRule) GetServiceName()(*string) {\n val, err := m.GetBackingStore().Get(\"serviceName\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "17e72975b8a7ecf1fb7e9ee826483490", "score": "0.41581914", "text": "func (s SingleNodeHashring) GetN(_ string, _ *prompb.TimeSeries, n uint64) (string, error) {\n\tif n > 0 {\n\t\treturn \"\", &insufficientNodesError{have: 1, want: n + 1}\n\t}\n\treturn string(s), nil\n}", "title": "" }, { "docid": "0a10a3a64309b7b9147538bc63c7d371", "score": "0.41556278", "text": "func ExposeNAWS(c *Connection) Negotiator {\n\twidth, height, _ := terminal.GetSize(int(os.Stdin.Fd()))\n\treturn &NAWSHandler{Width: uint16(width), Height: uint16(height), client: true}\n}", "title": "" }, { "docid": "5de735a2542c32f2353534969f3f745b", "score": "0.41513723", "text": "func Nsget(node *xmlx.Node, args ...string) *xmlx.Node {\n\tn := Nget(node, args...)\n\tif n == nil {\n\t\treturn xmlx.NewNode(0)\n\t}\n\treturn n\n}", "title": "" }, { "docid": "e5ae9384d92759b38af23e285941ca25", "score": "0.41476783", "text": "func GetIndexHandler() http.Handler {\n\thnd := &guiIndexHandler{}\n\treturn hnd\n}", "title": "" }, { "docid": "e220c00c85b94ac5413944a02aeab979", "score": "0.413354", "text": "func (Handler) Name() string {\n\treturn stakingModuleName\n}", "title": "" }, { "docid": "6e1892f7a23ab01c88f4633339d5862b", "score": "0.41265434", "text": "func (m *Mux) GetHandler(rname string) *Match {\n\tvar tokens []string\n\tsubrname := rname\n\tpl := len(m.path)\n\tif pl > 0 {\n\t\trl := len(rname)\n\t\tif pl == rl {\n\t\t\tif m.path != rname {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tsubrname = \"\"\n\t\t} else {\n\t\t\tif pl > rl || (rname[0:pl] != m.path) || rname[pl] != '.' {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tsubrname = rname[pl+1:]\n\t\t}\n\t}\n\n\tif len(subrname) == 0 {\n\t\tif m.root.hs == nil {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn &Match{\n\t\t\tHandler: m.root.hs.Handler,\n\t\t\tListeners: m.root.listeners,\n\t\t\tGroup: m.root.hs.group.toString(rname, nil),\n\t\t}\n\t}\n\n\ttokens = make([]string, 0, 32)\n\tstart := 0\n\tfor i := 0; i < len(subrname); i++ {\n\t\tif subrname[i] == btsep {\n\t\t\ttokens = append(tokens, subrname[start:i])\n\t\t\tstart = i + 1\n\t\t}\n\t}\n\ttokens = append(tokens, subrname[start:])\n\n\tvar nm nodeMatch\n\tmatchNode(m.root, tokens, 0, 0, &nm)\n\tif nm.n == nil || nm.n.hs == nil {\n\t\treturn nil\n\t}\n\n\treturn &Match{\n\t\tHandler: nm.n.hs.Handler,\n\t\tListeners: nm.n.listeners,\n\t\tParams: nm.params,\n\t\tGroup: nm.n.hs.group.toString(rname, tokens[nm.mountIdx:]),\n\t}\n}", "title": "" }, { "docid": "401b4654c389f0f366e7d35539a33611", "score": "0.41257682", "text": "func (s simpleHashring) GetN(tenant string, ts *prompb.TimeSeries, n uint64) (string, error) {\n\tif n >= uint64(len(s)) {\n\t\treturn \"\", &insufficientNodesError{have: uint64(len(s)), want: n + 1}\n\t}\n\treturn s[(hash(tenant, ts)+n)%uint64(len(s))], nil\n}", "title": "" }, { "docid": "7becfe94079bc75ba4af9108899050c8", "score": "0.4125536", "text": "func newSockJSHandler(s *SockjsHandler, sockjsPrefix string, sockjsOpts sockjs.Options) http.Handler {\n\treturn sockjs.NewHandler(sockjsPrefix, sockjsOpts, s.sockJSHandler)\n}", "title": "" }, { "docid": "1f5a006ae5d72cae13513e1d9d754a3b", "score": "0.4114793", "text": "func (n *NetworkInstance_Protocol_Isis_Global_Afi) NhType() *NetworkInstance_Protocol_Isis_Global_Afi_NhType {\n\treturn &NetworkInstance_Protocol_Isis_Global_Afi_NhType{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"nh-type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1f5a006ae5d72cae13513e1d9d754a3b", "score": "0.4114025", "text": "func (n *NetworkInstance_Protocol_Isis_Global_Afi) NhType() *NetworkInstance_Protocol_Isis_Global_Afi_NhType {\n\treturn &NetworkInstance_Protocol_Isis_Global_Afi_NhType{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"nh-type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b21e57c9f6acf052a11d5ed1f01bbbd0", "score": "0.41076252", "text": "func (gct *GClient) GetSocket() int32 {\n\treturn gct.handle.GetSocket()\n}", "title": "" }, { "docid": "03af3576700674939672f88a15671c5a", "score": "0.4100518", "text": "func (s *Sym) ReceiverName() string {}", "title": "" }, { "docid": "6f03d2a9141c406d9fa4a6f3a043a784", "score": "0.4086583", "text": "func (c *Config) GetNS() string {\n\tif c.Namespace == \"\" {\n\t\tc.Namespace = DefaultNamespace\n\t}\n\treturn c.Namespace\n}", "title": "" }, { "docid": "abd677ed7a3926afe061caed28e15b3a", "score": "0.40824366", "text": "func (d *App) GetBrowserProcessHandler() *BrowserProcessHandler {\n\treturn lookupAppProxy(d.Base()).GetBrowserProcessHandler(d)\n}", "title": "" }, { "docid": "267b7206dce4e3c155b703f28ce41e6c", "score": "0.40821004", "text": "func (transport *ZMQTransport) GetVnodeHandler(vnode *Vnode) (VnodeHandler, bool) {\n\thandler, err := transport.getVnodeHandler(vnode)\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\treturn handler, true\n}", "title": "" }, { "docid": "449bdc362495a1f897dee9567e3de424", "score": "0.40765774", "text": "func GetNodeByName(handle framework.Handle, nodeName string) (*framework.NodeInfo, error) {\n\tnodeInfo, err := handle.SnapshotSharedLister().NodeInfos().Get(nodeName)\n\tif err != nil || nodeInfo.Node() == nil {\n\t\treturn nil, fmt.Errorf(\"Error getting node %s from snapshot: %s\", nodeName, err)\n\t}\n\treturn nodeInfo, nil\n}", "title": "" }, { "docid": "20543453e960e16e1e5e109b24b70165", "score": "0.40582198", "text": "func (o *JsonWebKey) GetN() string {\n\tif o == nil || o.N == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.N\n}", "title": "" }, { "docid": "58d107c3e3cb8a78307b048a85c27a23", "score": "0.4056033", "text": "func processNameGet(sn subjectName, pk processKind) processName {\n\tpn := fmt.Sprintf(\"%s_%s\", sn, pk)\n\treturn processName(pn)\n}", "title": "" }, { "docid": "17cd054fa5c7186d750b6dbb69eb5048", "score": "0.40553442", "text": "func getHNSNetworkCmd(networkName string) string {\n\treturn \"Get-HnsNetwork | where { $_.Name -eq '\" + networkName + \"'}\"\n}", "title": "" }, { "docid": "11c04a8f52d076b3d44b1ad3cbfd8784", "score": "0.40409297", "text": "func GetHandle(libs []string) (*LibHandle, error) {\n\tfor _, name := range libs {\n\t\tlibname := C.CString(name)\n\t\tdefer C.free(unsafe.Pointer(libname))\n\t\thandle := C.dlopen(libname, C.RTLD_LAZY)\n\t\tif handle != nil {\n\t\t\tutils.Indent(log.Debug, 2)(fmt.Sprintf(\"using bundle: %s\", name))\n\t\t\th := &LibHandle{\n\t\t\t\tHandle: handle,\n\t\t\t\tLibname: name,\n\t\t\t}\n\t\t\treturn h, nil\n\t\t}\n\t}\n\treturn nil, errors.New(\"unable to open a handle to the library\")\n}", "title": "" }, { "docid": "aa6b089ef2c081c5512d5a4f712293e7", "score": "0.4040186", "text": "func (cli *HostWrapper) GetSN() (string, error) {\n\tvals, err := cli.host.GetValues()\n\tif nil != err {\n\t\treturn \"\", err\n\t}\n\treturn vals.String(fieldSN), nil\n}", "title": "" }, { "docid": "21ab652b2eeaed06e29746f786ab093d", "score": "0.40366888", "text": "func (p *Pipeline) getHandlerFromType(s string) (Handler, error) {\n\t// mapping list for the handlers\n\thandlers := map[string]Handler{\n\t\t\"handlerImpl1\": &HandlerImpl1{},\n\t\t\"handlerImpl2\": &HandlerImpl2{},\n\t}\n\n\tstepHandler, handlerExists := handlers[s]\n\tif !handlerExists {\n\t\treturn nil, fmt.Errorf(\"impossible to find a matching step handler for %s\", s)\n\t}\n\treturn stepHandler, nil\n}", "title": "" }, { "docid": "d003a14a9442a57f294fa19b87e2e11b", "score": "0.40295076", "text": "func GetProcessModuleHandle() (hModule uintptr) {\r\n\thModule, _, _ = syscall.Syscall( // (HANDLE)GetModuleHandle(NULL);\r\n\t\tsyscall.NewLazyDLL(\"kernel32.dll\").NewProc(\"GetModuleHandleW\").Addr(),\r\n\t\t1, 0, 0, 0,\r\n\t)\r\n\toutputdebug.String(fmt.Sprintf(\"GetProcessModuleHandle(): 0x%X\", hModule))\r\n\treturn\r\n}", "title": "" }, { "docid": "ba0fa534160fc32d736adf535cd9f5ab", "score": "0.40285087", "text": "func GetGamepadName(gamepad int32) string {\n\treturn js.Global.Get(\"Module\").Call(\"_GetGamepadName\", gamepad).String()\n}", "title": "" }, { "docid": "9149493794cf4c789b5ac74e4f8a72e3", "score": "0.40223196", "text": "func (r *Route) GetHandler() reflect.Value { return r.handler }", "title": "" }, { "docid": "0ff452b6bd6a05de54b5c94f8c3a493d", "score": "0.40213248", "text": "func getexecname() (path unsafe.Pointer, err error) {\n\tr0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&libc_getexecname)), 0, 0, 0, 0, 0, 0, 0)\n\tpath = unsafe.Pointer(r0)\n\tif e1 != 0 {\n\t\terr = errnoErr(e1)\n\t}\n\treturn\n}", "title": "" }, { "docid": "93772af5da7c35c27e0d0f4a1214b529", "score": "0.4021271", "text": "func (this *Symbols) NTType(symbol string) int {\n\tif idx, exist := this.ntIdMap[symbol]; exist {\n\t\treturn idx\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "386263e57123ab747eca17252404a4f3", "score": "0.40135896", "text": "func GetDigestByNid(nid NID) (*Digest, error) {\n\tsn, err := Nid2ShortName(nid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn GetDigestByName(sn)\n}", "title": "" }, { "docid": "1ef4c1302a8b2cc895fe5dca9b8a07be", "score": "0.39992526", "text": "func Get(name string, netNS ns.NetNS) (link netlink.Link, err error) {\n\tif netNS != nil {\n\t\terr = netNS.Do(func(_ ns.NetNS) error {\n\t\t\tlink, err = netlink.LinkByName(name)\n\t\t\treturn err\n\t\t})\n\n\t\treturn\n\t}\n\n\tlink, err = netlink.LinkByName(name)\n\treturn\n}", "title": "" }, { "docid": "ee23630fefb683b1266a66a4020c6b0c", "score": "0.39945084", "text": "func (hl *HostList) Nth(n int) (string, error) {\n\thl.RLock()\n\tdefer hl.RUnlock()\n\n\t_, hr, depth, err := hl.getNthHostRange(n)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif hr.isRange {\n\t\treturn fmtRangeHost(hr, hr.lo+uint(n)-uint(depth)), nil\n\t}\n\treturn hr.prefix, nil\n}", "title": "" }, { "docid": "3363aedf187c47f00b04f046b07bcda5", "score": "0.39922988", "text": "func GetEventNo(APIstub shim.ChaincodeStubInterface) (string, error) {\n\tvar no string\n\tfor {\n\t\tno = getRandomString(16, \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\")\n\t\texisting, err := APIstub.GetState(no)\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Sprintf(\"APIstub.GetState Error. error = %s\\n\", err))\n\t\t\treturn \"\", err\n\t\t} else if existing != nil {\n\t\t\tlogger.Warning(fmt.Sprintf(\"this no exists, no = %s\\n\", no))\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn no, nil\n}", "title": "" }, { "docid": "891b19db88fc6feb02b2a62a23240b01", "score": "0.3992138", "text": "func (r *HashRing) GetNode(name string) (node string, err error) {\n\tr.RLock()\n\tdefer r.RUnlock()\n\n\tif len(r.ring) == 0 {\n\t\treturn \"\", errors.New(\"empty hash ring\")\n\t}\n\tkey := r.generateHash(name)\n\tindex := r.search(key)\n\tnode = r.ring[r.sortedRing[index]]\n\terr = nil\n\treturn\n}", "title": "" }, { "docid": "73b26d8f688cec2c696696a40f95edc8", "score": "0.39873996", "text": "func (v *Window) GetIconName() (string, error) {\n\treturn stringReturn(C.gtk_window_get_icon_name(v.native()))\n}", "title": "" }, { "docid": "f10f9b90eed6d4ecc444d3962640b93c", "score": "0.3985762", "text": "func (d *App) GetRenderProcessHandler() *RenderProcessHandler {\n\treturn lookupAppProxy(d.Base()).GetRenderProcessHandler(d)\n}", "title": "" }, { "docid": "fad396f7b94e2383230e2fd114b7efe1", "score": "0.39832976", "text": "func getErrno() Errno {\n\terrptr := libc___error()\n\treturn Errno(uintptr(*errptr))\n}", "title": "" }, { "docid": "cdc5d20a6980c5278e0b766945653bc3", "score": "0.39765352", "text": "func (r *Route) HandlerNameWithPackage() string {\n\tf := runtime.FuncForPC(r.handler.Pointer()).Name()\n\tparts := strings.Split(f, \"/\")\n\treturn parts[len(parts)-1]\n}", "title": "" }, { "docid": "357f94d1b815adf68a53615a71c71118", "score": "0.39682928", "text": "func (recv *Screen) GetNumber() int32 {\n\tretC := C.gdk_screen_get_number((*C.GdkScreen)(recv.native))\n\tretGo := (int32)(retC)\n\n\treturn retGo\n}", "title": "" }, { "docid": "cd5d427e02a5580d769a433821e89cf5", "score": "0.39671525", "text": "func (d *DLL) FindProc(name string) (proc *Proc, err error)", "title": "" }, { "docid": "12dd6faba8f05ef6e1aee38d7652c02e", "score": "0.3962605", "text": "func sigprocmask1(how, new, old uintptr)", "title": "" }, { "docid": "0bdbffe5c47c7b5f2c040599d0d42177", "score": "0.39492112", "text": "func (v *CBName) NKeys() int { return 1 }", "title": "" }, { "docid": "685c379ef5d989eec5c31732175bbc88", "score": "0.39477554", "text": "func (c *LitRpcClient) GetLNAddress() (string, error) {\n\targs := new(litrpc.NoArgs)\n\n\treply := new(litrpc.ListeningPortsReply)\n\terr := c.rpcConn.Call(\"LitRPC.GetListeningPorts\", args, reply)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn reply.Adr, nil\n}", "title": "" }, { "docid": "ebe59547d5cae6f0d3a7c63b3649844d", "score": "0.39449283", "text": "func (m *WindowsFirewallRule) GetProtocol()(*int32) {\n val, err := m.GetBackingStore().Get(\"protocol\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "title": "" }, { "docid": "d23956a5b232c014002f40dd694a7605", "score": "0.3944449", "text": "func NtQuerySymbolicLinkObject(\n\tLinkHandle Handle,\n\tLinkTarget *UnicodeString,\n\tReturnedLength *uint32,\n) NtStatus {\n\tr0, _, _ := procNtQuerySymbolicLinkObject.Call(uintptr(LinkHandle),\n\t\tuintptr(unsafe.Pointer(LinkTarget)),\n\t\tuintptr(unsafe.Pointer(ReturnedLength)))\n\treturn NtStatus(r0)\n}", "title": "" }, { "docid": "0d1ab2db6ecd09055692941f9552d423", "score": "0.39385164", "text": "func (s *BaseLumenListener) ExitGetName(ctx *GetNameContext) {}", "title": "" }, { "docid": "e3b21134fc7705ffc9f48f675b038231", "score": "0.3937419", "text": "func (n Nan0) GetServiceName() string {\n\treturn n.ServiceName\n}", "title": "" }, { "docid": "edac142943a7d9eb51f5a75ce0385351", "score": "0.3935738", "text": "func relateSyscallName(name string) string {\n\tswitch name {\n\tcase \"newfstat\":\n\t\treturn \"fstat\"\n\tcase \"newlstat\":\n\t\treturn \"lstat\"\n\tcase \"newstat\":\n\t\treturn \"stat\"\n\tcase \"newuname\":\n\t\treturn \"uname\"\n\tcase \"sendfile64\":\n\t\treturn \"sendfile\"\n\tcase \"sysctl\":\n\t\treturn \"_sysctl\"\n\tcase \"umount\":\n\t\treturn \"umount2\"\n\tdefault:\n\t\treturn name\n\t}\n}", "title": "" }, { "docid": "84fea5d243e2f600f1d5c0beacbf0869", "score": "0.39340714", "text": "func (edf Edf) GetNumberSignals() int {\n\treturn getNumberSignals(edf.Header)\n}", "title": "" }, { "docid": "f9bc4af3aba69007d9ec5aa1de656de6", "score": "0.39280653", "text": "func (d *LazyDLL) Handle() uintptr", "title": "" }, { "docid": "fca4d12eed93900e75dcd4eb39caa6de", "score": "0.39272586", "text": "func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {\n\t_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&libc_getpeername)), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)\n\tif e1 != 0 {\n\t\terr = errnoErr(e1)\n\t}\n\treturn\n}", "title": "" }, { "docid": "29aef38a12257db6dfdf71f32a2eb5bc", "score": "0.3925587", "text": "func (r *Route) HandlerName() string {\n\tparts := strings.Split(r.HandlerNameWithPackage(), \".\")\n\treturn parts[len(parts)-1]\n}", "title": "" }, { "docid": "5b63b80620375b2bbf0114181181cb0a", "score": "0.3918823", "text": "func (ev *EventHeapRootUnregister) Name() string {\n\treturn \"EventHeapRootUnregister\"\n}", "title": "" }, { "docid": "07ba6344aafecb1a2950df749c5f99db", "score": "0.39112487", "text": "func (h *SimpleHandle) Name() string { return \"simple\" }", "title": "" }, { "docid": "194816d0d5b5e1874f732304898a3d78", "score": "0.3908845", "text": "func (n *NetworkInstance_Protocol_Isis_Global_AfiAny) NhType() *NetworkInstance_Protocol_Isis_Global_Afi_NhTypeAny {\n\treturn &NetworkInstance_Protocol_Isis_Global_Afi_NhTypeAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"nh-type\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "3d797a5e378a6a28d86840436f9b6d0b", "score": "0.39064813", "text": "func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {\n\t_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&libc___xnet_getsockopt)), 5, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)\n\tif e1 != 0 {\n\t\terr = errnoErr(e1)\n\t}\n\treturn\n}", "title": "" }, { "docid": "1a99c1bf6273a6637ea2c0724139c12c", "score": "0.39019525", "text": "func (m *Message) NST() (*NST, error) {\n\tps, err := m.Parse(\"NST\")\n\tpst, ok := ps.(*NST)\n\tif ok {\n\t\treturn pst, err\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "9afb84852053d9156302a5ff8f8b96bb", "score": "0.38967076", "text": "func (sch CommandHandlerUtil) getMethodName(cmd Command) string {\n\tvar commandFullName string\n\n\tif reflect.ValueOf(cmd).Kind() == reflect.Ptr {\n\t\tcommandFullName = \"Handle\" + reflect.TypeOf(cmd).Elem().Name()\n\t} else {\n\t\tcommandFullName = \"Handle\" + reflect.TypeOf(cmd).Name()\n\t}\n\n\treturn commandFullName\n}", "title": "" }, { "docid": "0ca20cc3269764b4fb35c7071c0db3a4", "score": "0.3893866", "text": "func (recv *Display) GetNScreens() int32 {\n\tretC := C.gdk_display_get_n_screens((*C.GdkDisplay)(recv.native))\n\tretGo := (int32)(retC)\n\n\treturn retGo\n}", "title": "" } ]
e46dd0cf99ca52171699274fbd021425
RegisterPlugin is called when a plugin can be registered
[ { "docid": "9ebcbef627df882754e110bc585c4b5d", "score": "0.72953945", "text": "func (h *RegistrationHandler) RegisterPlugin(pluginName string, endpoint string, versions []string) error {\n\tklog.Infof(\"Register new plugin with name: %s at endpoint: %s\", pluginName, endpoint)\n\n\t// Get node info from the driver.\n\tcsiClient, err := newCsiDriverClient(csiDriverName(pluginName))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), csiTimeout)\n\tdefer cancel()\n\n\tdriverNodeID, maxVolumePerNode, accessibleTopology, err := csiClient.NodeGetInfo(ctx)\n\tif err != nil {\n\t\tif unregErr := unregisterDriver(pluginName); unregErr != nil {\n\t\t\tklog.Error(\"registrationHandler.RegisterPlugin failed to unregister plugin due to previous error: %v\", unregErr)\n\t\t}\n\t\treturn err\n\t}\n\n\tklog.Infof(\"NodeGetInfo: \")\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "9da9c05ec73d75e2c74156b1676c9052", "score": "0.7955147", "text": "func (d *DummyImpl) RegisterPlugin(pluginName string, endpoint string, versions []string) error {\n\treturn nil\n}", "title": "" }, { "docid": "4a3e544591582f2663f49d3ac53a5e0d", "score": "0.7431859", "text": "func (r *R) RegisterPlugin(mr markdown.Renderer) {\n\tr.plugins = append(r.plugins, mr)\n}", "title": "" }, { "docid": "689b60d0d5f98859ae8d31b68a45d4e3", "score": "0.7344676", "text": "func registerPlugin(name string, factory func(fileName string) PluginConfigNG) {\n\tplugins[name] = factory\n}", "title": "" }, { "docid": "67622c575ea6adc0ca5527e903f39492", "score": "0.7332968", "text": "func RegisterPlugin() error {\n\treturn chatbot.RegPlugin(&filePlugin{})\n}", "title": "" }, { "docid": "b0326c5a3c63785cbc4e10f135f408b4", "score": "0.72257876", "text": "func (s *KedsRPCServer) RegisterPlugin(ctx context.Context, req *pb.RegisterPluginRequest) (resp *pb.RegisterPluginResponse, err error) {\n\tplug := plugin.NewPlugin(req.GetPluginDescriptor())\n\tif err = plugin.DefaultRegistry().Register(ut.AddTokenToContext(ctx, plug.GetSha1()), plug); err != nil {\n\t\ts.events.Errorf(\"failed to register plugin: %v\", err)\n\t} else {\n\t\ts.events.Printf(\"registered %s\", plug)\n\t\tut.AddTokenToHeader(ctx, plug.GetSha1())\n\t\ts.Cobra.AddPlugin(ctx, plug, s.bus)\n\t}\n\treturn &pb.RegisterPluginResponse{}, err\n}", "title": "" }, { "docid": "cfe72888b4f24b122b732caf326f022b", "score": "0.7092996", "text": "func Register(name, description string, capabilities *plugin.Capabilities, options ...PluginOption) (*Plugin, error) {\n\trouter := NewRouter()\n\n\tp := &Plugin{\n\t\tpluginHandler: &Handler{\n\t\t\tname: name,\n\t\t\tdescription: description,\n\t\t\tcapabilities: capabilities,\n\t\t\tdashboardFactory: NewDashboardClient,\n\t\t\trouter: router,\n\t\t},\n\n\t\tserverFactory: defaultServerFactory,\n\t}\n\n\tfor _, option := range options {\n\t\toption(p)\n\t}\n\n\tif p.pluginHandler.InitRoutes != nil {\n\t\tp.pluginHandler.InitRoutes(router)\n\t}\n\n\tif err := p.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn p, nil\n}", "title": "" }, { "docid": "608d008d5fe586bbccada73e6399f489", "score": "0.6944985", "text": "func (b *Bot) RegisterPlugin(service Discord, plugin Plugin) {\n\ts := b.Services[service.Name()]\n\tif s.Plugins[plugin.Name()] != nil {\n\t\tlog.Println(\"Plugin with that name already registered\", plugin.Name())\n\t}\n\ts.Plugins[plugin.Name()] = plugin\n}", "title": "" }, { "docid": "01d375f302f9597e9048abb57799daee", "score": "0.6926315", "text": "func (m *manager) Register(pluginID string, factory PluginFactoryFunc) error {\n\tm.logger.Debug(\"Registering backend plugin\", \"pluginId\", pluginID)\n\tm.pluginsMu.Lock()\n\tdefer m.pluginsMu.Unlock()\n\n\tif _, exists := m.plugins[pluginID]; exists {\n\t\treturn fmt.Errorf(\"backend plugin %s already registered\", pluginID)\n\t}\n\n\tpluginSettings := pluginSettings{}\n\tif ps, exists := m.pluginSettings[pluginID]; exists {\n\t\tpluginSettings = ps\n\t}\n\n\thostEnv := []string{\n\t\tfmt.Sprintf(\"GF_VERSION=%s\", m.Cfg.BuildVersion),\n\t}\n\n\thostEnv = append(hostEnv, m.getAWSEnvironmentVariables()...)\n\n\tenv := pluginSettings.ToEnv(\"GF_PLUGIN\", hostEnv)\n\n\tpluginLogger := m.logger.New(\"pluginId\", pluginID)\n\tplugin, err := factory(pluginID, pluginLogger, env)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tm.plugins[pluginID] = plugin\n\tm.logger.Debug(\"Backend plugin registered\", \"pluginId\", pluginID)\n\treturn nil\n}", "title": "" }, { "docid": "5936f3a8afe868add5228cabc21023b1", "score": "0.6920987", "text": "func (m *Manager) Register(name string, plugin Plugin) {\n\tm.mtx.Lock()\n\tdefer m.mtx.Unlock()\n\tm.plugins = append(m.plugins, namedplugin{\n\t\tname: name,\n\t\tplugin: plugin,\n\t})\n\tif _, ok := m.pluginStatus[name]; !ok {\n\t\tm.pluginStatus[name] = &Status{State: StateNotReady}\n\t}\n}", "title": "" }, { "docid": "7cbfe58215d9335656aeae29b9a23ab2", "score": "0.68187726", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, func() (admission.Interface, error) {\n\t\treturn NewPlugin(), nil\n\t})\n}", "title": "" }, { "docid": "c748423d9d0d544be8a0e8c5afe1a457", "score": "0.68018425", "text": "func Registerplugin(col string, p RunnerFactory) {\n\tif allplugin == nil {\n\t\tallplugin = make(map[string]RunnerFactory)\n\t}\n\tif _, ok := allplugin[col]; ok {\n\t\tpanic(\"the plugin name conflict\")\n\t}\n\tallplugin[col] = p\n}", "title": "" }, { "docid": "50f07eaf71e1441c891c30d13b5e9120", "score": "0.6779925", "text": "func Register(p *dt.Plugin) error {\n\tp.Log.Debug(\"registering\", p.Config.Name)\n\tfor _, i := range p.Trigger.Intents {\n\t\ts := \"I_\" + strings.ToLower(i)\n\t\toldPlg := core.RegPlugins.Get(s)\n\t\tif oldPlg != nil && oldPlg.Config.Name != p.Config.Name {\n\t\t\tp.Log.Infof(\"found duplicate plugin or trigger %s on %s\",\n\t\t\t\tp.Config.Name, s)\n\t\t}\n\t\tcore.RegPlugins.Set(s, p)\n\t}\n\teng := porter2.Stemmer\n\tfor _, c := range p.Trigger.Commands {\n\t\tc = strings.ToLower(eng.Stem(c))\n\t\tfor _, o := range p.Trigger.Objects {\n\t\t\to = strings.ToLower(eng.Stem(o))\n\t\t\ts := \"CO_\" + c + \"_\" + o\n\t\t\toldPlg := core.RegPlugins.Get(s)\n\t\t\tif oldPlg != nil && oldPlg.Config.Name != p.Config.Name {\n\t\t\t\tp.Log.Info(\"found duplicate plugin or trigger\",\n\t\t\t\t\tp.Config.Name, \"on\", s)\n\t\t\t}\n\t\t\tcore.RegPlugins.Set(s, p)\n\t\t}\n\t}\n\n\t// registerPlugin is called whenever Keywords or Triggers are changed,\n\t// but we don't want to append duplicate entries to our\n\t// core.AllPlugins.\n\tfor _, plg := range core.AllPlugins {\n\t\tif plg.Config.Name == p.Config.Name {\n\t\t\treturn nil\n\t\t}\n\t}\n\tcore.AllPlugins = append(core.AllPlugins, p)\n\tp.SM.SetStates([][]dt.State{p.States})\n\treturn nil\n}", "title": "" }, { "docid": "f5bd9ca7ef4caa1951265586d9102ffb", "score": "0.67015433", "text": "func (c *Sys) RegisterPlugin(i *RegisterPluginInput) error {\n\treturn c.RegisterPluginWithContext(context.Background(), i)\n}", "title": "" }, { "docid": "53901acb73cc18b7df55ecc179a57ea3", "score": "0.6675893", "text": "func (w *Wasm) RegisterPlugin(name, pluginPath string, pluginConfig *PluginConfig) error {\n\twasmBytes, err := ioutil.ReadFile(pluginPath)\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"unable to load WASM module: %w\", err)\n\t}\n\n\t// always create a config if one does not exist\n\tif pluginConfig == nil {\n\t\tpluginConfig = &PluginConfig{\n\t\t\tCallbacks: &Callbacks{},\n\t\t}\n\t}\n\n\t// Compile the module\n\tmodule, err := wasmer.NewModule(w.store, wasmBytes)\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"unable to instantiate WASM module: %w\", err)\n\t}\n\n\t// validate that there are callbacks for all the imported functions\n\tfor _, i := range module.Imports() {\n\t\t// wasi functions that are provided by the system are loaded in the wasi_... namespaces\n\t\tif strings.HasPrefix(i.Module(), \"wasi_\") ||\n\t\t\t(i.Module() == \"env\" && i.Name() == \"raise_error\") ||\n\t\t\t(i.Module() == \"env\" && i.Name() == \"abort\") {\n\t\t\t// default import\n\t\t} else {\n\t\t\tif pluginConfig == nil {\n\t\t\t\treturn ImportNotFoundError{i.Name(), i.Module()}\n\t\t\t}\n\n\t\t\tif pluginConfig.Callbacks == nil {\n\t\t\t\treturn ImportNotFoundError{i.Name(), i.Module()}\n\t\t\t}\n\n\t\t\tif m, ok := pluginConfig.Callbacks.callbackFunctions[i.Module()]; ok {\n\t\t\t\tif _, ok := m[i.Name()]; !ok {\n\t\t\t\t\treturn ImportNotFoundError{i.Name(), i.Module()}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn ImportNotFoundError{i.Name(), i.Module()}\n\t\t\t}\n\t\t}\n\t}\n\n\tp := &plugin{\n\t\tmodule: module,\n\t\tconfig: pluginConfig,\n\t}\n\n\tw.plugins[name] = p\n\n\treturn nil\n}", "title": "" }, { "docid": "4446549c390f30a814ded27a748e04a7", "score": "0.66689134", "text": "func Register(name string, p Plugin) error {\n\tlogrus.Infof(\"Registering auth plugin: %v\", name)\n\tplugins[name] = p\n\treturn nil\n}", "title": "" }, { "docid": "3167ac3568d0d8faf5dc62b56ecc3572", "score": "0.65956753", "text": "func init() {\n\tp := &MyPlugin{}\n\textractor.Register(p)\n\tsource.Register(p)\n}", "title": "" }, { "docid": "918ff943f227be1ad3cb9c063e399dfb", "score": "0.6471903", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, func(config io.Reader) (admission.Interface, error) {\n\t\treturn New()\n\t})\n}", "title": "" }, { "docid": "69edf46e745b1b532fdbaf447900121b", "score": "0.64271057", "text": "func registerPlugin(constructor interface{}, options ...interface{}) {\n\tvc := reflect.ValueOf(constructor)\n\n\t// Pre-processing options to make it work with reflect\n\tvo := []reflect.Value{}\n\tfor _, oi := range options {\n\t\tvo = append(vo, reflect.ValueOf(oi))\n\t}\n\n\t// Removing limit options from path\n\tpath, limit := extractLimitOptions(vo[0].String())\n\n\t// Writing value back without limiter \"|\" options\n\tvo[0] = reflect.ValueOf(path)\n\n\t// Calling our constructor with list of given options\n\tplugin := vc.Call(vo)[0].Interface()\n\tpluginWrapper := plugin\n\n\tif limit != \"\" {\n\t\tpluginWrapper = NewLimiter(plugin, limit)\n\t} else {\n\t\tpluginWrapper = plugin\n\t}\n\n\t_, isR := plugin.(io.Reader)\n\t_, isW := plugin.(io.Writer)\n\n\t// Some of the output can be Readers as well because return responses\n\tif isR && !isW {\n\t\tPlugins.Inputs = append(Plugins.Inputs, pluginWrapper.(io.Reader))\n\t}\n\n\tif isW {\n\t\tPlugins.Outputs = append(Plugins.Outputs, pluginWrapper.(io.Writer))\n\t}\n}", "title": "" }, { "docid": "41b7c730c3cd5fcdaafd37daf2951830", "score": "0.63503534", "text": "func (r *RegisterPluginRoles) Register(ctx context.Context, p *plugins.Plugin) (*plugins.Plugin, error) {\n\tif err := r.roleRegistry.DeclarePluginRoles(ctx, p.ID, p.Name, p.Roles); err != nil {\n\t\tr.log.Warn(\"Declare plugin roles failed.\", \"pluginId\", p.ID, \"error\", err)\n\t}\n\treturn p, nil\n}", "title": "" }, { "docid": "ebe74724b7fc9d4f33f2cd74fbfa92bf", "score": "0.6347333", "text": "func Register(db *gorm.DB) (Plugin, error) {\n\tp := Plugin{db: db}\n\n\tp.enableCallbacks()\n\n\treturn p, nil\n}", "title": "" }, { "docid": "42884bccb4b1cab5a9e15a962d21775b", "score": "0.62507874", "text": "func (mapcp MyAwesomePostCreatePlugin) RunPlugin() {\n\tlog.Println(\"Awesome post-create plugin event.\")\n}", "title": "" }, { "docid": "c630cad558d70dcfaa36386ac1f3d899", "score": "0.6185661", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, func(io.Reader) (admission.Interface, error) {\n\t\treturn NewCredentialsBlocker()\n\t})\n}", "title": "" }, { "docid": "a1025019d9446dfb988c2e31bc0a4059", "score": "0.618389", "text": "func AddPlugin(plugin Plugin) {\n\tif plugin == nil {\n\t\tpanic(\"xray: plugin should not be nil\")\n\t}\n\tmuPlugins.Lock()\n\tdefer muPlugins.Unlock()\n\tplugins = append(plugins, plugin)\n}", "title": "" }, { "docid": "f7503206de601a8f34d2c700d2110437", "score": "0.615116", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, func(config io.Reader) (admission.Interface, error) {\n\t\treturn NewProvision(), nil\n\t})\n}", "title": "" }, { "docid": "8202d0726174b08c7944e9bcf58f6e43", "score": "0.61280715", "text": "func (r *ExternalServiceRegistration) Register(ctx context.Context, p *plugins.Plugin) (*plugins.Plugin, error) {\n\tif p.ExternalServiceRegistration != nil && r.cfg.Features.IsEnabled(featuremgmt.FlagExternalServiceAuth) {\n\t\ts, err := r.externalServiceRegistry.RegisterExternalService(ctx, p.ID, p.ExternalServiceRegistration)\n\t\tif err != nil {\n\t\t\tr.log.Error(\"Could not register an external service. Initialization skipped\", \"pluginId\", p.ID, \"error\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tp.ExternalService = s\n\t}\n\treturn p, nil\n}", "title": "" }, { "docid": "4b4b8a8921c96b181b4baa7e35067a27", "score": "0.6123775", "text": "func (c *Conductor) register(p lib.Plugin) error {\n\n\t// collect all handlers after registration\n\tvar pp []Handler //nolint\n\tfor _, h := range c.plugins {\n\t\tif strings.HasPrefix(h.Method, p.Name+\".\") && h.Address == p.Address { // already registered\n\t\t\tlog.Printf(\"[WARN] plugin %+v already registered\", p)\n\t\t\treturn nil\n\t\t}\n\n\t\tif strings.HasPrefix(h.Method, p.Name+\".\") && h.Address != p.Address { // registered, but address changed\n\t\t\tlog.Printf(\"[WARN] plugin %+v already registered, but address changed to %s\", h, p.Address)\n\t\t\tcontinue // remove from the collected pp\n\t\t}\n\t\tpp = append(pp, h)\n\t}\n\n\tclient, err := c.RPCDialer.Dial(\"tcp\", p.Address)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't reach plugin %+v: %v\", p, err)\n\t}\n\n\tfor _, l := range p.Methods {\n\t\thandler := Handler{client: client, Alive: true, Address: p.Address, Method: p.Name + \".\" + l}\n\t\tpp = append(pp, handler)\n\t\tlog.Printf(\"[INFO] register plugin %s, ip: %s, method: %s\", p.Name, p.Address, handler.Method)\n\t}\n\tc.plugins = pp\n\treturn nil\n}", "title": "" }, { "docid": "7a0791b421141d1b080a9d6b9cd4869b", "score": "0.6037184", "text": "func (d *DummyImpl) ValidatePlugin(pluginName string, endpoint string, versions []string) error {\n\treturn nil\n}", "title": "" }, { "docid": "e651f70d7a2057259baf1f9894dc96d3", "score": "0.602318", "text": "func (d *DummyImpl) DeRegisterPlugin(pluginName string) {\n}", "title": "" }, { "docid": "38983230282b66fdab7db2de33dd540d", "score": "0.6022583", "text": "func Register(kubeletEndpoint, pluginEndpoint, resourceName string) error {\n\tconn, err := grpc.Dial(kubeletEndpoint, grpc.WithInsecure(),\n\t\tgrpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {\n\t\t\treturn net.DialTimeout(\"unix\", addr, timeout)\n\t\t}))\n\tdefer conn.Close()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't connect to kubelet service: %v \", err)\n\t}\n\tclient := pluginapi.NewRegistrationClient(conn)\n\treqt := &pluginapi.RegisterRequest{\n\t\tVersion: pluginapi.Version,\n\t\tEndpoint: pluginEndpoint,\n\t\tResourceName: resourceName,\n\t}\n\n\t_, err = client.Register(context.Background(), reqt)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't register to kubelet service: %v \", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8902596249ef3bdf3796cad0d9bb9e8b", "score": "0.5984603", "text": "func (p *MDNSRegisterPlugin) Register(name string, rcvr interface{}, metadata string) (err error) {\n\tif strings.TrimSpace(name) == \"\" {\n\t\terr = errors.New(\"Register service `name` can't be empty\")\n\t\treturn\n\t}\n\n\tsm := &serviceMeta{\n\t\tService: name,\n\t\tMeta: metadata,\n\t\tServiceAddress: p.ServiceAddress,\n\t}\n\n\tp.Services = append(p.Services, sm)\n\n\tif p.server == nil {\n\t\tp.initMDNS()\n\t\treturn\n\t}\n\n\tss, _ := json.Marshal(p.Services)\n\ts := url.QueryEscape(string(ss))\n\tp.server.SetText([]string{s})\n\treturn\n}", "title": "" }, { "docid": "b7d47230ce949130c91e8bb441ce6aa6", "score": "0.596786", "text": "func (m *AcceleratorDevicePlugin) Register(kubeletEndpoint, resourceName string) error {\n\tconn, err := dial(kubeletEndpoint, 5*time.Second)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tclient := pluginapi.NewRegistrationClient(conn)\n\treqt := &pluginapi.RegisterRequest{\n\t\tVersion: pluginapi.Version,\n\t\tEndpoint: path.Base(m.socket),\n\t\tResourceName: resourceName,\n\t}\n\n\t_, err = client.Register(context.Background(), reqt)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "227ec206a3a0a41ef1175dbb88e33c35", "score": "0.5927905", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, func(config io.Reader) (admission.Interface, error) {\n\t\treturn newExtendedResourceToleration(), nil\n\t})\n}", "title": "" }, { "docid": "910eeac53600c83cd6fe9559a7160cf0", "score": "0.59274286", "text": "func (dpi *PCIDevicePlugin) register() error {\n\tconn, err := gRPCConnect(pluginapi.KubeletSocket, connectionTimeout)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tclient := pluginapi.NewRegistrationClient(conn)\n\treqt := &pluginapi.RegisterRequest{\n\t\tVersion: pluginapi.Version,\n\t\tEndpoint: path.Base(dpi.socketPath),\n\t\tResourceName: dpi.resourceName,\n\t}\n\n\t_, err = client.Register(context.Background(), reqt)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ec3305d522c38120c80353f0cdb530d2", "score": "0.59252936", "text": "func (dpi *GenericDevicePlugin) Register() error {\n\tconn, err := connect(pluginapi.KubeletSocket, connectionTimeout)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tclient := pluginapi.NewRegistrationClient(conn)\n\treqt := &pluginapi.RegisterRequest{\n\t\tVersion: pluginapi.Version,\n\t\tEndpoint: path.Base(dpi.socketPath),\n\t\tResourceName: fmt.Sprintf(\"%s/%s\", DeviceNamespace, dpi.deviceName),\n\t}\n\n\t_, err = client.Register(context.Background(), reqt)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3f9a65a1e128cf2fb4c506c1a7f69ffe", "score": "0.5907549", "text": "func (spm *SimplePanelManager) RegisterPlugins(plugins []Plugin) error {\n\t//initialize temporary maps\n\tregistered := map[string]bool{}\n\tincludesWithPair := map[PageScope][]pluginTemplatePair{}\n\tpanelHTMLWithPair := map[PageScope]map[pagePosition][]pluginTemplatePair{\n\t\tTaskPage: {},\n\t\tBuildPage: {},\n\t\tVersionPage: {},\n\t}\n\tdataFuncs := map[PageScope]map[string]UIDataFunction{\n\t\tTaskPage: {},\n\t\tBuildPage: {},\n\t\tVersionPage: {},\n\t}\n\n\tfor _, p := range plugins {\n\t\t// don't register plugins twice\n\t\tif registered[p.Name()] {\n\t\t\treturn errors.Errorf(\"plugin '%v' already registered\", p.Name())\n\t\t}\n\n\t\tif uiConf, err := p.GetPanelConfig(); uiConf != nil && err == nil {\n\t\t\tfor _, panel := range uiConf.Panels {\n\n\t\t\t\t// register all includes to their proper scope\n\t\t\t\tfor _, include := range panel.Includes {\n\t\t\t\t\tincludesWithPair[panel.Page] = append(\n\t\t\t\t\t\tincludesWithPair[panel.Page],\n\t\t\t\t\t\tpluginTemplatePair{p.Name(), include},\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\t// register all panels to their proper scope and position\n\t\t\t\tif panel.Page == \"\" {\n\t\t\t\t\treturn errors.New(\"plugin '%v': cannot register ui panel without a Page\")\n\t\t\t\t}\n\t\t\t\tif panel.Position == \"\" {\n\t\t\t\t\tpanel.Position = PageCenter // Default to center\n\t\t\t\t}\n\t\t\t\tpanelHTMLWithPair[panel.Page][panel.Position] = append(\n\t\t\t\t\tpanelHTMLWithPair[panel.Page][panel.Position],\n\t\t\t\t\tpluginTemplatePair{p.Name(), panel.PanelHTML},\n\t\t\t\t)\n\n\t\t\t\t// register all data functions to their proper scope, if they exist\n\t\t\t\t// Note: only one function can be registered per plugin per page\n\t\t\t\tif dataFuncs[panel.Page][p.Name()] == nil {\n\t\t\t\t\tif panel.DataFunc != nil {\n\t\t\t\t\t\tdataFuncs[panel.Page][p.Name()] = panel.DataFunc\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif panel.DataFunc != nil {\n\t\t\t\t\t\treturn errors.Errorf(\n\t\t\t\t\t\t\t\"a data function is already registered for plugin %v on %v page\",\n\t\t\t\t\t\t\tp.Name(), panel.Page)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else if err != nil {\n\t\t\treturn errors.Wrapf(err, \"GetPanelConfig for plugin '%v' returned an error\", p.Name())\n\t\t}\n\n\t\tregistered[p.Name()] = true\n\t}\n\n\t// sort registered plugins by name and cache their HTML\n\tspm.includes = map[PageScope][]template.HTML{\n\t\tTaskPage: sortAndExtractHTML(includesWithPair[TaskPage]),\n\t\tBuildPage: sortAndExtractHTML(includesWithPair[BuildPage]),\n\t\tVersionPage: sortAndExtractHTML(includesWithPair[VersionPage]),\n\t}\n\tspm.panelHTML = map[PageScope]PanelLayout{\n\t\tTaskPage: {\n\t\t\tLeft: sortAndExtractHTML(panelHTMLWithPair[TaskPage][PageLeft]),\n\t\t\tRight: sortAndExtractHTML(panelHTMLWithPair[TaskPage][PageRight]),\n\t\t\tCenter: sortAndExtractHTML(panelHTMLWithPair[TaskPage][PageCenter]),\n\t\t},\n\t\tBuildPage: {\n\t\t\tLeft: sortAndExtractHTML(panelHTMLWithPair[BuildPage][PageLeft]),\n\t\t\tRight: sortAndExtractHTML(panelHTMLWithPair[BuildPage][PageRight]),\n\t\t\tCenter: sortAndExtractHTML(panelHTMLWithPair[BuildPage][PageCenter]),\n\t\t},\n\t\tVersionPage: {\n\t\t\tLeft: sortAndExtractHTML(panelHTMLWithPair[VersionPage][PageLeft]),\n\t\t\tRight: sortAndExtractHTML(panelHTMLWithPair[VersionPage][PageRight]),\n\t\t\tCenter: sortAndExtractHTML(panelHTMLWithPair[VersionPage][PageCenter]),\n\t\t},\n\t}\n\tspm.uiDataFuncs = dataFuncs\n\n\treturn nil\n}", "title": "" }, { "docid": "0c5309a52681b48a032cc7d4841a2417", "score": "0.5906396", "text": "func (k *kubeletStub) Register(ctx context.Context, r *pluginapi.RegisterRequest) (*pluginapi.Empty, error) {\n\tk.Lock()\n\tdefer k.Unlock()\n\tk.pluginEndpoint = r.Endpoint\n\treturn &pluginapi.Empty{}, nil\n}", "title": "" }, { "docid": "316e7c0119b1bffee1e5f80a519e996c", "score": "0.5901135", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, func(config io.Reader) (admission.Interface, error) {\n\t\treturn customresourcevalidation.NewValidator(\n\t\t\tmap[schema.GroupResource]bool{\n\t\t\t\tconfigv1.Resource(\"projects\"): true,\n\t\t\t},\n\t\t\tmap[schema.GroupVersionKind]customresourcevalidation.ObjectValidator{\n\t\t\t\tconfigv1.GroupVersion.WithKind(\"Project\"): projectV1{},\n\t\t\t})\n\t})\n}", "title": "" }, { "docid": "ce58a06419d5f5b2cbbc3a3a04ecdab9", "score": "0.58640987", "text": "func (dpi *GenericDevicePlugin) register() error {\n\tconn, err := gRPCConnect(pluginapi.KubeletSocket, connectionTimeout)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tclient := pluginapi.NewRegistrationClient(conn)\n\treqt := &pluginapi.RegisterRequest{\n\t\tVersion: pluginapi.Version,\n\t\tEndpoint: path.Base(dpi.socketPath),\n\t\tResourceName: dpi.resourceName,\n\t}\n\n\t_, err = client.Register(context.Background(), reqt)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e80475193b08990805439d8735e08c7c", "score": "0.58620095", "text": "func FLBPluginRegister(ctx unsafe.Pointer) int {\n\treturn output.FLBPluginRegister(ctx, \"kinesis\", \"Amazon Kinesis Data Streams Fluent Bit Plugin.\")\n}", "title": "" }, { "docid": "835d4daf7e41c03756dc846dc54ef865", "score": "0.5826056", "text": "func TestPluginAddHandler(t *testing.T) {\n\tt.Parallel()\n\t// make a plugin which is pre-activated\n\tp := &Plugin{activateWait: sync.NewCond(&sync.Mutex{})}\n\tp.Manifest = &Manifest{Implements: []string{\"bananas\"}}\n\tstorage.Lock()\n\tstorage.plugins[\"qwerty\"] = p\n\tstorage.Unlock()\n\n\ttestActive(t, p)\n\tHandle(\"bananas\", func(_ string, _ *Client) {})\n\ttestActive(t, p)\n}", "title": "" }, { "docid": "cc39ec443580cbf9d6119d3368f7d307", "score": "0.5793984", "text": "func RegisterPluginDir(r metrics.Registry, dirPath string) {\n\th := NewExternalPluginHandler(dirPath)\n\n\trefs := make(map[string]metrics.MetricRef)\n\n\tfor _, result := range h.ExecuteAll(\"config\") {\n\t\tif len(result.Stderr) > 0 {\n\t\t\tlog.Errorf(\"plugin error %q: %s\", result.PluginPath, result.Stderr)\n\t\t}\n\n\t\tvar res initResult\n\t\terr := json.Unmarshal(result.Output, &res)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"unable to parse plugin %q: %s\", result.PluginPath, err)\n\t\t\th.RemovePlugin(result.PluginPath)\n\t\t\tcontinue\n\t\t}\n\t\tif len(res.Definitions) == 0 {\n\t\t\tlog.Debugf(\"no metric definitions in %q\", result.PluginPath)\n\t\t\th.RemovePlugin(result.PluginPath)\n\t\t\tcontinue\n\t\t}\n\n\t\tfor name, d := range res.Definitions {\n\t\t\tref := r.Register(name, metrics.AsType(d.Type),\n\t\t\t\tmetrics.WithCommonLabels(d.CommonLabels),\n\t\t\t\tmetrics.WithMeasuredLabels(d.MeasuredLabelKeys...))\n\t\t\trefs[name] = ref\n\t\t}\n\t}\n\n\tr.AddCollector(func(reporter metrics.Reporter) {\n\t\tfor _, result := range h.ExecuteAll() {\n\t\t\tif len(result.Stderr) > 0 {\n\t\t\t\tlog.Errorf(\"plugin error %q: %s\", result.PluginPath, result.Stderr)\n\t\t\t}\n\n\t\t\tvar res metricsResult\n\t\t\terr := json.Unmarshal(result.Output, &res)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"unable to parse plugin %q: %s\", result.PluginPath, err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor name, m := range res.Metrics {\n\t\t\t\tref, ok := refs[name]\n\t\t\t\tif !ok {\n\t\t\t\t\tlog.Debugf(\"undefined metric from plugin %q: %s\",\n\t\t\t\t\t\tresult.PluginPath, name)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\treporter.Update(ref, m.Value, m.LabelValues...)\n\t\t\t}\n\t\t}\n\t})\n}", "title": "" }, { "docid": "8e2be9181fcf7104a0aa8d6e6c863a33", "score": "0.5790607", "text": "func (cli *Client) PluginInstall(ctx context.Context, name, registryAuth string, acceptAllPermissions, noEnable bool, in io.ReadCloser, out io.Writer) error {\n\theaders := map[string][]string{\"X-Registry-Auth\": {registryAuth}}\n\tresp, err := cli.post(ctx, \"/plugins/pull\", url.Values{\"name\": []string{name}}, nil, headers)\n\tif err != nil {\n\t\tensureReaderClosed(resp)\n\t\treturn err\n\t}\n\tvar privileges types.PluginPrivileges\n\tif err := json.NewDecoder(resp.body).Decode(&privileges); err != nil {\n\t\treturn err\n\t}\n\tensureReaderClosed(resp)\n\n\tif !acceptAllPermissions && len(privileges) > 0 {\n\n\t\tfmt.Fprintf(out, \"Plugin %q requested the following privileges:\\n\", name)\n\t\tfor _, privilege := range privileges {\n\t\t\tfmt.Fprintf(out, \" - %s: %v\\n\", privilege.Value)\n\t\t}\n\n\t\tfmt.Fprint(out, \"Do you grant the above permissions? [y/N] \")\n\t\treader := bufio.NewReader(in)\n\t\tline, _, err := reader.ReadLine()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif strings.ToLower(string(line)) != \"y\" {\n\t\t\tresp, _ := cli.delete(ctx, \"/plugins/\"+name, nil, nil)\n\t\t\tensureReaderClosed(resp)\n\t\t\treturn pluginPermissionDenied{name}\n\t\t}\n\t}\n\tif noEnable {\n\t\treturn nil\n\t}\n\treturn cli.PluginEnable(ctx, name)\n}", "title": "" }, { "docid": "56172c1d60978454ee799e9b0a803344", "score": "0.5700257", "text": "func (p *Plugin) InitPlugin(messenger plugin.BinaryMessenger) error {\n\tp.channel = plugin.NewMethodChannel(messenger, channelName, plugin.StandardMethodCodec{})\n\tp.channel.CatchAllHandleFunc(p.catchAllTest)\n\treturn nil\n}", "title": "" }, { "docid": "2faefd9dd92cfaa654576d79c50a42d8", "score": "0.56960475", "text": "func (o PluginMDnsNsReg) NewPlugin(ctx *core.PluginCtx, initJson []byte) (*core.PluginBase, error) {\n\treturn NewMDnsNs(ctx, initJson)\n}", "title": "" }, { "docid": "778114346a1cce81e221f9ae707fac29", "score": "0.56946176", "text": "func (s *FileDriver) Register(pc plugins.SFPluginCache) {\n\tpc.AddDriver(fileDriverName, NewFileDriver)\n}", "title": "" }, { "docid": "7a9789b8da16b86072de485731b19ced", "score": "0.5683805", "text": "func (r *registry) register(name, commandName string, commandArgs []string, kinds ...PluginKind) {\n\tfor _, kind := range kinds {\n\t\tif r.plugins[kind] == nil {\n\t\t\tr.plugins[kind] = make(map[string]pluginInfo)\n\t\t}\n\n\t\tr.plugins[kind][name] = pluginInfo{\n\t\t\tkinds: kinds,\n\t\t\tname: name,\n\t\t\tcommandName: commandName,\n\t\t\tcommandArgs: commandArgs,\n\t\t}\n\t}\n}", "title": "" }, { "docid": "873d324b021605a03d87dd6a994e84ca", "score": "0.5672404", "text": "func Register(_ *v2.MOSNConfig) {\n\tv2.RegisterParseExtendConfig(\"holmes\", OnHolmesPluginParsed)\n}", "title": "" }, { "docid": "d14a69d17dab2ab1695fa62f68a7d532", "score": "0.56278217", "text": "func (plugin *ExamplePlugin) Init() error {\n\n\t// add new metric to default registry (accessible at the path /metrics)\n\t//\n\t// the current value is returned by provided callback\n\t// created gauge is identified by tuple(namespace, subsystem, name) only the name field is mandatory\n\t// additional properties can be defined using labels - key-value pairs. They do not change over time for the given gauge.\n\terr := plugin.Prometheus.RegisterGaugeFunc(prom.DefaultRegistry, \"ns\", \"sub\", \"gaugeOne\",\n\t\t\"this metrics represents randomly generated numbers\", prometheus.Labels{\"Property1\": \"ABC\", \"Property2\": \"DEF\"}, func() float64 {\n\t\t\treturn rand.Float64()\n\t\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// create new registry that will be exposed at /custom path\n\terr = plugin.Prometheus.NewRegistry(customRegistry, promhttp.HandlerOpts{ErrorHandling: promhttp.ContinueOnError})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// create gauge using prometheus API\n\tplugin.temporaryCounter = prometheus.NewGauge(prometheus.GaugeOpts{\n\t\tName: \"Countdown\",\n\t\tHelp: \"This gauge is decremented by 1 each second, once it reaches 0 the gauge is removed.\",\n\t})\n\tplugin.counterVal = 60\n\tplugin.temporaryCounter.Set(float64(plugin.counterVal))\n\n\t// register created gauge to the custom registry\n\terr = plugin.Prometheus.Register(customRegistry, plugin.temporaryCounter)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// create gauge vector and register it\n\tplugin.gaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{\n\t\tName: \"Vector\",\n\t\tHelp: \"This gauge groups multiple similar metrics.\",\n\t\tConstLabels: prometheus.Labels{\"type\": \"vector\", \"answer\": \"42\"},\n\t}, []string{orderLabel})\n\terr = plugin.Prometheus.Register(customRegistry, plugin.gaugeVec)\n\n\treturn err\n\n}", "title": "" }, { "docid": "4627b80381b50ef18a14595197e70ef3", "score": "0.5593187", "text": "func (r *Registration) Init(ic *InitContext) *Plugin {\n\tp, err := r.InitFn(ic)\n\treturn &Plugin{\n\t\tRegistration: r,\n\t\tConfig: ic.Config,\n\t\tMeta: ic.Meta,\n\t\tinstance: p,\n\t\terr: err,\n\t}\n}", "title": "" }, { "docid": "02af033bfaeb425839208363b7fd4497", "score": "0.55923426", "text": "func loadPlugin(pluginPath string) (*Plugin, error) {\n\tsubProcess := execJava(pluginPath, \"info\")\n\tbs, err := subProcess.Output()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tplugin := NewPlugin()\n\tdecoder := json.NewDecoder(strings.NewReader(string(bs)))\n\terr = decoder.Decode(plugin)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tplugin.Path = pluginPath\n\n\tfor _, ext := range plugin.Extensions {\n\t\tplugin.FileFilter[ext] = true\n\t}\n\n\treturn plugin, nil\n}", "title": "" }, { "docid": "64a8066166915abcd807e87927b69f5d", "score": "0.5585546", "text": "func (s *Server) Plugin(plugin ...Plugin) {\n\tfor _, p := range plugin {\n\t\tif err := p.Install(s); err != nil {\n\t\t\tglog.Fatal(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9274b14c66014240257ec8b19fe48e8c", "score": "0.5578126", "text": "func RegisterLoader(fn PluginLoaderFn) {\n\tloaders = append(loaders, fn)\n}", "title": "" }, { "docid": "dd7020f54f4bd268e7f7d151453d3e31", "score": "0.55570716", "text": "func (o PluginMDnsCReg) NewPlugin(ctx *core.PluginCtx, initJson []byte) (*core.PluginBase, error) {\n\treturn NewMDnsClient(ctx, initJson)\n}", "title": "" }, { "docid": "b7a5d586edff2b6f8aed4c20314aaff3", "score": "0.5551206", "text": "func (s *PluginsService) Post(plugin *Plugin) (*http.Response, error) {\n\treq, err := s.client.NewRequest(\"POST\", \"plugins\", plugin)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := s.client.Do(req, nil)\n\n\treturn resp, err\n}", "title": "" }, { "docid": "c03ba4307cf8a3b1fa64252cbff4dc3d", "score": "0.5550482", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(\"PizzaSize\", func(config io.Reader) (admission.Interface, error) {\n\t\treturn New()\n\t})\n}", "title": "" }, { "docid": "360dbb0124cb5c1c476949442c2166c7", "score": "0.5543006", "text": "func InstallPlugin(plugin, repository string) error {\n\tre := regexp.MustCompile(`^` + RegexpPlugin + `$`)\n\tif !re.MatchString(plugin) {\n\t\treturn fmt.Errorf(\"plugin name '%s' is invalid\", plugin)\n\t}\n\tpluginPath := filepath.Join(repository, plugin)\n\tif util.DirExists(pluginPath) {\n\t\tMessage(\"Plugin '%s' already installed in '%s'\", plugin, pluginPath)\n\t\treturn nil\n\t}\n\tgitRepository := \"git@\" + PluginSite + \":\" + plugin + \".git\"\n\tcommand := exec.Command(\"git\", \"clone\", gitRepository, pluginPath)\n\tMessage(\"Running command '%s'...\", strings.Join(command.Args, \" \"))\n\toutput, err := command.CombinedOutput()\n\tif err != nil {\n\t\tre = regexp.MustCompile(\"\\n\\n\")\n\t\tmessage := re.ReplaceAllString(string(output), \"\\n\")\n\t\tmessage = strings.TrimSpace(message)\n\t\tMessage(message)\n\t\treturn fmt.Errorf(\"installing plugin '%s'\", plugin)\n\t}\n\tMessage(\"Plugin '%s' installed in '%s'\", plugin, pluginPath)\n\treturn nil\n}", "title": "" }, { "docid": "de92097b824609297d7e9d57d6d48f17", "score": "0.552807", "text": "func (cli *Client) PluginPush(ctx context.Context, name string, registryAuth string) error {\n\theaders := map[string][]string{\"X-Registry-Auth\": {registryAuth}}\n\tresp, err := cli.post(ctx, \"/plugins/\"+name+\"/push\", nil, nil, headers)\n\tensureReaderClosed(resp)\n\treturn err\n}", "title": "" }, { "docid": "5357be859d0c23f62b9f0f9dd2ee009c", "score": "0.55268097", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(PluginName, func(config io.Reader) (admission.Interface, error) {\n\t\treturn NewLimitRanger(&DefaultLimitRangerActions{})\n\t})\n}", "title": "" }, { "docid": "43a05aabff5e21e8360c847478f3ef73", "score": "0.5522493", "text": "func (a *authorizationPlugin) initPlugin() error {\n\t// Lazy loading of plugins\n\ta.once.Do(func() {\n\t\tif a.plugin == nil {\n\t\t\tvar plugin plugingetter.CompatPlugin\n\t\t\tvar e error\n\n\t\t\tif pg := GetPluginGetter(); pg != nil {\n\t\t\t\tplugin, e = pg.Get(a.name, AuthZApiImplements, plugingetter.Lookup)\n\t\t\t\ta.SetName(plugin.Name())\n\t\t\t} else {\n\t\t\t\tplugin, e = plugins.Get(a.name, AuthZApiImplements)\n\t\t\t}\n\t\t\tif e != nil {\n\t\t\t\ta.initErr = e\n\t\t\t\treturn\n\t\t\t}\n\t\t\ta.plugin = plugin.Client()\n\t\t}\n\t})\n\treturn a.initErr\n}", "title": "" }, { "docid": "0325c797b170cd2aca54face4ef7dd74", "score": "0.5521927", "text": "func (plugin *ExamplePlugin) Init() (err error) {\n\treturn nil\n}", "title": "" }, { "docid": "7e3b87b1b4d6a7aec4431869060cba86", "score": "0.55212957", "text": "func (s *Server) Plugin(plugin ...Plugin) {\n\ts.plugins = append(s.plugins, plugin...)\n}", "title": "" }, { "docid": "c93186cae5986fb7265654449b8ffb7d", "score": "0.54758483", "text": "func (m *MyPlugin) Init(config string) error {\n\treturn nil\n}", "title": "" }, { "docid": "a62ce52176693c3ec343c9307b88a780", "score": "0.5473907", "text": "func (p *Pilot) installPlugin(pilot *v1alpha1.Pilot, plugin string) error {\n\tcmd := exec.Command(p.Options.ElasticsearchOptions.PluginBinary, \"install\", plugin)\n\tcmd.Env = p.env().Strings()\n\tcmd.Stdout = p.Options.StdOut\n\tcmd.Stderr = p.Options.StdErr\n\tif err := cmd.Run(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f1811c149dbc71de9f5dc89964603e81", "score": "0.5469715", "text": "func (p *Plugin) AfterInit() (err error) {\n\tp.Log.Debug(\"REST API Plugin started \")\n\tp.registerHandlersHere()\n\treturn nil\n}", "title": "" }, { "docid": "c0af69efbd4ce179695258d7a2f3ed81", "score": "0.54546285", "text": "func Install(pluginImplName string, newFunc newClientFunc) {\n\tplugins[pluginImplName] = newFunc\n}", "title": "" }, { "docid": "243a2b4af76b232589d43958fc03b4f4", "score": "0.54378587", "text": "func (p *Plugin) InitPlugin(metadata *persist.Metadata, bucket *bolt.Bucket, storage modules.PluginViewStorage, unregisterCallback modules.PluginUnregisterCallback) (persist.Metadata, error) {\n\tp.storage = storage\n\tp.unregisterCallback = unregisterCallback\n\tif metadata == nil {\n\t\tfor _, bucketName := range bucketSlice {\n\t\t\tb := bucket.Bucket([]byte(bucketName))\n\t\t\tif b == nil {\n\t\t\t\tvar err error\n\t\t\t\t_, err = bucket.CreateBucket([]byte(bucketName))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn persist.Metadata{}, fmt.Errorf(\"failed to create bucket %s: %v\", string(bucketName), err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tmetadata = &persist.Metadata{\n\t\t\tVersion: pluginDBVersion,\n\t\t\tHeader: pluginDBHeader,\n\t\t}\n\t} else if metadata.Version != pluginDBVersion {\n\t\treturn persist.Metadata{}, errors.New(\"There is only 1 version of this plugin, version mismatch\")\n\t}\n\treturn *metadata, nil\n}", "title": "" }, { "docid": "c21a7028ca43fd8181452a30565fed7e", "score": "0.5434476", "text": "func init() {\n\tLoadPlugin = func(path string) error {\n\t\tif Enabled {\n\t\t\treturn nil\n\t\t}\n\t\tp, err := plugin.Open(path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn usePlugin(p)\n\n\t}\n\tp, err := findPlugin(\"/lib\", \"lib\", \".\", filepath.Join(os.Getenv(\"GOPATH\"), \"src\", \"github.com\", \"klauspost\", \"cld2\", \"lib\"))\n\tif err != nil {\n\t\tlog.Printf(\"CLD2: Loading plugin: %v\", err)\n\t\treturn\n\t}\n\terr = usePlugin(p)\n\tif err != nil {\n\t\tlog.Printf(\"CLD2: plugin init: %v\", err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "8d823787080c4146d8806fcd35f1cc00", "score": "0.543113", "text": "func (manager *PluginManager) AddPlugin(name string, plugin network.NetworkPlugin) error {\n\tif _, ok := manager.plugins[name]; ok {\n\t\treturn fmt.Errorf(\"conflict plugin with name %s\", name)\n\t}\n\tmanager.plugins[name] = plugin\n\treturn nil\n}", "title": "" }, { "docid": "490fd0245703b6f3cc19a410573b84fe", "score": "0.5425468", "text": "func (cli *Client) PluginSet(ctx context.Context, name string, args []string) error {\n\tresp, err := cli.post(ctx, \"/plugins/\"+name+\"/set\", nil, args, nil)\n\tensureReaderClosed(resp)\n\treturn err\n}", "title": "" }, { "docid": "0c997e5feccd29ec17b2300e8986407d", "score": "0.5424282", "text": "func Plugin(pluginName, version string, silent bool) InstallResult {\n\tlogger.Debugf(true, \"Gathering metadata for %s\", pluginName)\n\tinstallDescription, result := getInstallDescription(pluginName, false)\n\tdefer util.RemoveTempDir()\n\tif !result.Success {\n\t\treturn result\n\t}\n\treturn installPluginWithDescription(installDescription, version, silent)\n}", "title": "" }, { "docid": "d2369398ec77368f6e77181f260f31ac", "score": "0.5424047", "text": "func (r *Router) AddPlugin(id string, i plugins.Plugin) {\n\tr.pluginLock.Lock()\n\tdefer r.pluginLock.Unlock()\n\tr.plugins = append(r.plugins, i)\n}", "title": "" }, { "docid": "d153a4677e67d73da20291d5742fa899", "score": "0.54226464", "text": "func (p *httpxPlugin) Add(plugin Plugin) {\n\tp.plugins = append(p.plugins, plugin)\n}", "title": "" }, { "docid": "35c0c8cd76d8e162e22c1c2f0906db9f", "score": "0.541389", "text": "func init() {\n\tinterfaces.AddPlugin(\"cfapppush\", []string{\"cloudfoundry\"}, Init)\n}", "title": "" }, { "docid": "9013e99a0e487d4b3c8b6a1c4fa4df17", "score": "0.5404497", "text": "func Register(r *Registration) {\n\tregister.Lock()\n\tdefer register.Unlock()\n\n\tif r.Type == \"\" {\n\t\tpanic(ErrNoType)\n\t}\n\tif r.ID == \"\" {\n\t\tpanic(ErrNoPluginID)\n\t}\n\tif err := checkUnique(r); err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor _, requires := range r.Requires {\n\t\tif requires == \"*\" && len(r.Requires) != 1 {\n\t\t\tpanic(ErrInvalidRequires)\n\t\t}\n\t}\n\n\tregister.r = append(register.r, r)\n}", "title": "" }, { "docid": "e1f27350eeb9c4e8b282f4fb7a19367a", "score": "0.5397906", "text": "func (m *Manager) UsePlugin(plugins ...plugin.Plugin) {\n\tm.Plugins.Use(plugins...)\n}", "title": "" }, { "docid": "a871767f108b20f488a5f2449bcf3554", "score": "0.5370894", "text": "func init() {\n\tinterfaces.AddPlugin(\"cfappssh\", []string{\"cloudfoundry\"}, Init)\n}", "title": "" }, { "docid": "e131849c7562c7e89fa714c7d658ccfe", "score": "0.5369215", "text": "func init() {\n\tPlugin = K8sPlugin{\n\t\tPluginName: \"k8s_plugin\",\n\t\tSpecVersion: \"1.0\",\n\t\tserviceManager: service.NewServiceManager(chroot),\n\t\tupdateTarget: &k8sUpdateTarget{},\n\t}\n\n\t// Read manifest files for plugin\n\tif err := Plugin.readManifestFiles(); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "6a3f85485c73749c15e11222215054b3", "score": "0.5361531", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(\"Initializers\", func(config io.Reader) (admission.Interface, error) {\n\t\treturn NewInitializer(), nil\n\t})\n}", "title": "" }, { "docid": "ac8c4c8d1a2caf664ffd5cf7c1505d8f", "score": "0.5356678", "text": "func (p *GoImagePlugin) InitPlugin(messenger plugin.BinaryMessenger) error {\n\tchannel := plugin.NewMethodChannel(messenger, channelName, plugin.StandardMethodCodec{})\n\tchannel.HandleFunc(\"getPlatformVersion\", p.handlePlatformVersion)\n\treturn nil\n}", "title": "" }, { "docid": "01b9c7324601971397b42be55036f009", "score": "0.53522635", "text": "func (p *OfflineStoragePlugin) InitPlugin(messenger plugin.BinaryMessenger) error {\r\n\tchannel := plugin.NewMethodChannel(messenger, channelName, plugin.StandardMethodCodec{})\r\n\tchannel.HandleFunc(\"getPlatformVersion\", p.handlePlatformVersion)\r\n\tchannel.HandleFunc(\"getHomeDir\", p.handleHomeDirectory)\r\n\tchannel.HandleFunc(\"getMakeDir\", p.handleMakeDirectory)\r\n\tchannel.HandleFunc(\"advertiseServer\", p.handleMdnsAdvertisement)\r\n\treturn nil\r\n}", "title": "" }, { "docid": "0a679968e1f9d09a2c68ec90d030134c", "score": "0.5328227", "text": "func (g *GitHubEventServer) RegisterExternalPlugins(p map[string][]plugins.ExternalPlugin) {\n\tg.serveMuxHandler.externalPlugins = p\n}", "title": "" }, { "docid": "136ed3b0f05020a6d4e425aac9913bfb", "score": "0.5321107", "text": "func Register(plugins *admission.Plugins) {\n\tplugins.Register(\"BanFlunder\", func(config io.Reader) (admission.Interface, error) {\n\t\treturn New()\n\t})\n}", "title": "" }, { "docid": "2f51e5429e84e27aacd841854c1a31f3", "score": "0.53135985", "text": "func (p *ExamplePlugin) Init() error {\n\treturn nil\n}", "title": "" }, { "docid": "7bda1928c6e911292ff0325699f38d4a", "score": "0.531217", "text": "func NewMDNSRegisterPlugin(serviceAddress string, port int, m metrics.Registry, updateInterval time.Duration, domain string) *MDNSRegisterPlugin {\n\tif domain == \"\" {\n\t\tdomain = \"local.\"\n\t}\n\treturn &MDNSRegisterPlugin{\n\t\tServiceAddress: serviceAddress,\n\t\tport: port,\n\t\tMetrics: m,\n\t\tUpdateInterval: updateInterval,\n\t\tdomain: domain,\n\t\tdying: make(chan struct{}),\n\t\tdone: make(chan struct{}),\n\t}\n}", "title": "" }, { "docid": "5ffb82a2175f10f80dc1293385661cd9", "score": "0.5297554", "text": "func Register(root *cobra.Command, cfg config.Config) {\n\tpublish := &cobra.Command{\n\t\tUse: \"mqtt-subscribe\",\n\t\tShort: \"subscribes messages from hive\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tmain(cfg)\n\t\t},\n\t}\n\n\troot.AddCommand(publish)\n}", "title": "" }, { "docid": "fe0e2046d8f3f59b5fcceca9431eeec4", "score": "0.5285205", "text": "func (a *Client) UploadPlugin(params *UploadPluginParams, authInfo runtime.ClientAuthInfoWriter) (*UploadPluginCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUploadPluginParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"uploadPlugin\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/plugins\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"multipart/form-data\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &UploadPluginReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*UploadPluginCreated)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for uploadPlugin: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "729a29b450c00dcf382fabadf75e047d", "score": "0.52839345", "text": "func runPluginInstall(cmd *cobra.Command, args []string) {\n\tfmt.Printf(\"\\nInstall plugin for the Project Flogo CLI\\n\")\n\tfmt.Printf(\"Using repository: %s\\n\", installPluginRepoURL)\n\n\trawRepoURL := strings.Replace(installPluginRepoURL, \"github.com\", \"raw.githubusercontent.com\", 1)\n\trawRepoURL = fmt.Sprintf(\"%s/master\", rawRepoURL)\n\n\t// Get the plugin.toml content\n\tpluginTomlContent, err := fgutil.LoadRemoteFile(fmt.Sprintf(\"%s/plugin.toml\", rawRepoURL))\n\tif err != nil {\n\t\tfmt.Printf(\"Error while getting plugin.toml: %s\", err.Error())\n\t\tos.Exit(2)\n\t}\n\n\t// Load the content into a TOML tree\n\tconfig, err := toml.Load(pluginTomlContent)\n\tif err != nil {\n\t\tfmt.Printf(\"Error converting plugin.toml: %s\\n\", err.Error())\n\t\tos.Exit(2)\n\t}\n\n\t// Get the correct key\n\tqueryResult := config.Get(\"plugin\")\n\tif queryResult == nil {\n\t\tfmt.Printf(\"Unknown error occured, no plugin found\\n\")\n\t\tos.Exit(2)\n\t}\n\n\t// Get the plugin structure\n\tpluginMap := queryResult.([]*toml.Tree)[0].ToMap()\n\n\t// Get the GOPATH\n\tout, err := exec.Command(\"go\", \"env\", \"GOPATH\").Output()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tgopath := strings.TrimSuffix(string(out), \"\\n\")\n\n\t// Getting plugin files\n\tfmt.Printf(\"Found plugin: %s\\n\", pluginMap[\"name\"])\n\tfmt.Printf(\"Download files...\\n\")\n\tfor _, filename := range pluginMap[\"files\"].([]interface{}) {\n\t\tlocalPath := filepath.Join(gopath, goPathCLI, filename.(string))\n\t\tremotePath := fmt.Sprintf(\"%s/%s\", rawRepoURL, filename)\n\t\terr := fgutil.CopyRemoteFile(remotePath, localPath)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Err: %s\\n\", err.Error())\n\t\t}\n\t}\n\n\t// Make sure all dependencies are available\n\tcmdExec := exec.Command(\"go\", \"get\", \"-u\", \"./...\")\n\tcmdExec.Dir = filepath.Join(gopath, goPathCLI)\n\tcmdExec.Env = append(os.Environ())\n\n\tout, err = cmdExec.Output()\n\tif err != nil {\n\t\tfmt.Printf(\"Error while executing command: %s\\n\", err.Error())\n\t\tos.Exit(2)\n\t}\n\n\t// Install the new version of the commandline\n\tcmdExec = exec.Command(\"go\", \"install\", \"./...\")\n\tcmdExec.Dir = filepath.Join(gopath, goPathCLI)\n\tcmdExec.Env = append(os.Environ())\n\n\tout, err = cmdExec.Output()\n\tif err != nil {\n\t\tfmt.Printf(\"Error while executing command: %s\", err.Error())\n\t\tos.Exit(2)\n\t}\n\n\tfmt.Printf(\"Installed a new plugin!\\n\\n\")\n}", "title": "" }, { "docid": "b90535185f64bbfbb7ceae60aec0c187", "score": "0.5271213", "text": "func (p *pluginContainer) Add(plugin Plugin) {\n\tp.plugins = append(p.plugins, plugin)\n}", "title": "" }, { "docid": "b90535185f64bbfbb7ceae60aec0c187", "score": "0.5271213", "text": "func (p *pluginContainer) Add(plugin Plugin) {\n\tp.plugins = append(p.plugins, plugin)\n}", "title": "" }, { "docid": "7d72df77a8ec8c87de1bb2b1efb34e89", "score": "0.52692556", "text": "func NewPlugin() plugin.Plugin {\n\treturn ticker{}\n}", "title": "" }, { "docid": "3a03dc1c0a089b2b1601ce0256dd61c3", "score": "0.5248943", "text": "func Plugin() *node.Plugin {\n\tpluginOnce.Do(func() {\n\t\tplugin = node.NewPlugin(\"Clock\", node.Enabled, configure, run)\n\t})\n\treturn plugin\n}", "title": "" }, { "docid": "4665df84ba5bfeb30b7905957240bda9", "score": "0.52476144", "text": "func (cli *Client) PluginEnable(ctx context.Context, name string) error {\n\tresp, err := cli.post(ctx, \"/plugins/\"+name+\"/enable\", nil, nil, nil)\n\tensureReaderClosed(resp)\n\treturn err\n}", "title": "" }, { "docid": "6694dadc08c990400c9ab38e7c8c9445", "score": "0.5242695", "text": "func init() {\n\tPluginManager.Plugins = []*Plugin{\n\t\t&Plugin{\n\t\t\t\"YTSAMPlugin\",\n\t\t\t\"Pulls movies from YTS.AM and allows you to download them\",\n\t\t\t\"Entertainment\",\n\t\t\tytsamplugin.SetupDB,\n\t\t\tytsamplugin.Tables,\n\t\t\tytsamplugin.APIEndpoints,\n\t\t\tytsamplugin.ViewEndpoints,\n\t\t\tytsamplugin.GetMovies,\n\t\t\t[]string{\"torrents\"},\n\t\t},\n\t\t&Plugin{\n\t\t\t\"TorrentPlugin\",\n\t\t\t\"Download torrents\",\n\t\t\t\"Internet\",\n\t\t\ttorrentplugin.SetupDB,\n\t\t\ttorrentplugin.Tables,\n\t\t\ttorrentplugin.APIEndpoints,\n\t\t\ttorrentplugin.ViewEndpoints,\n\t\t\ttorrentplugin.UpdateTorrents,\n\t\t\t[]string{\"torrents\", \"downloads\"},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "973964acafe71a6cb4a0bddeed9f3567", "score": "0.5241776", "text": "func NewPlugin(registryPool types.UnlockHash, oneCoin types.Currency, opts *PluginOptions) *Plugin {\n\tp := new(Plugin)\n\tif opts != nil {\n\t\tp.hackMinimumBlockHeightSinceDoubleRegistrationsAreForbidden = opts.HackMinimumBlockHeightSinceDoubleRegistrationsAreForbidden\n\t}\n\ttypes.RegisterTransactionVersion(tbtypes.TransactionVersionBotRegistration, tbtypes.BotRegistrationTransactionController{\n\t\tRegistry: p,\n\t\tRegistryPoolAddress: registryPool,\n\t\tOneCoin: oneCoin,\n\t})\n\ttypes.RegisterTransactionVersion(tbtypes.TransactionVersionBotRecordUpdate, tbtypes.BotUpdateRecordTransactionController{\n\t\tRegistry: p,\n\t\tRegistryPoolAddress: registryPool,\n\t\tOneCoin: oneCoin,\n\t})\n\ttypes.RegisterTransactionVersion(tbtypes.TransactionVersionBotNameTransfer, tbtypes.BotNameTransferTransactionController{\n\t\tRegistry: p,\n\t\tRegistryPoolAddress: registryPool,\n\t\tOneCoin: oneCoin,\n\t})\n\treturn p\n}", "title": "" }, { "docid": "9f8d9afc68d5e457dd047a57d2d68a99", "score": "0.523639", "text": "func initMetaPlugin() error {\n\tvar err error\n\n\tlp.Lock()\n\tdefer lp.Unlock()\n\n\tif lp.metas != nil {\n\t\treturn nil\n\t}\n\tif lp.plugins == nil {\n\t\tlp.plugins = make(map[string]struct{})\n\t}\n\n\tlp.metas, err = List()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"while getting plugin's metadata: %s\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c1ffa2a582e785de99d76f168e3a272a", "score": "0.523212", "text": "func (pc *PluginController) importPluginProvider(provider string) error {\n\tpc.logger.Printf(\"Importing plugin provider: %s\\n\", provider)\n\tout, err := exec.Command(pc.pluginDir+\"/\"+provider, \"define\").Output()\n\tif err != nil {\n\t\tpc.logger.Printf(\"Skipping %s because %s\\n\", provider, err)\n\t} else {\n\t\tvar pp PluginProvider\n\t\terr = json.Unmarshal(out, &pp)\n\t\tif err != nil {\n\t\t\tpc.logger.Printf(\"Skipping %s because of bad json: %s\\n%s\\n\", provider, err, out)\n\t\t} else {\n\n\t\t\tskip := false\n\t\t\tfor _, p := range pp.Parameters {\n\t\t\t\terr := p.BeforeSave()\n\t\t\t\tif err != nil {\n\t\t\t\t\tpc.logger.Printf(\"Skipping %s because of bad required scheme: %s %s\\n\", pp.Name, p.Name, err)\n\t\t\t\t\tskip = true\n\t\t\t\t} else {\n\t\t\t\t\t// Attempt create if it doesn't exist already.\n\t\t\t\t\tref := pc.dataTracker.NewParam()\n\t\t\t\t\td, unlocker := pc.dataTracker.LockEnts(ref.Locks(\"create\")...)\n\t\t\t\t\tref2 := d(ref.Prefix()).Find(p.Name)\n\t\t\t\t\tif ref2 == nil {\n\t\t\t\t\t\tif _, err := pc.dataTracker.Create(d, p, nil); err != nil {\n\t\t\t\t\t\t\tpc.logger.Printf(\"Skipping %s because parameter could not be created: %s %s\\n\", pp.Name, p.Name, err)\n\t\t\t\t\t\t\tskip = true\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tunlocker()\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !skip {\n\t\t\t\tif _, ok := pc.AvailableProviders[pp.Name]; !ok {\n\t\t\t\t\tpc.logger.Printf(\"Adding plugin provider: %s\\n\", pp.Name)\n\t\t\t\t\tpc.AvailableProviders[pp.Name] = &pp\n\t\t\t\t\tpp.path = pc.pluginDir + \"/\" + provider\n\t\t\t\t\tfor _, aa := range pp.AvailableActions {\n\t\t\t\t\t\taa.Provider = pp.Name\n\t\t\t\t\t}\n\t\t\t\t\tpc.publishers.Publish(\"plugin_provider\", \"create\", pp.Name, pp)\n\t\t\t\t\treturn pc.walkPlugins(provider)\n\t\t\t\t} else {\n\t\t\t\t\tpc.logger.Printf(\"Already exists plugin provider: %s\\n\", pp.Name)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "431b39bb08e9f78cb74d11ff7819c202", "score": "0.5228616", "text": "func (cnpd *sfcCtlrL2CNPDriver) InitPlugin() error {\n\treturn nil\n}", "title": "" }, { "docid": "cb7e2637339183d592903e20a739e29b", "score": "0.52198243", "text": "func init() {\n\tdocker.PreHookCreateContainer.RegisterSubPlugin(opt.mutate)\n\tdocker.PreHookUpdateContainer.RegisterSubPlugin(opt.update)\n}", "title": "" }, { "docid": "9fe075f019bc01cbf8d8b5d72fef62f8", "score": "0.52191085", "text": "func RegisterActive(name string, builder PluginBuilder) {\n\tstats := statsForPlugin(name)\n\tif err := globalPluginsReg.add(pluginBuilder{name, ActiveMonitor, builder, stats}); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "60ba40de207edfdbf5cfa91056882bb6", "score": "0.5217295", "text": "func (p *WebviewPlugin) InitPlugin(messenger plugin.BinaryMessenger) error {\n\tchannel := plugin.NewMethodChannel(messenger, channelName, plugin.StandardMethodCodec{})\n\tchannel.HandleFunc(\"getWebview\", p.handleWebview)\n\treturn nil\n}", "title": "" } ]
4d8a9fdd6ad1fcc73c8f9b472f964f5c
BarDynamicTotal enables dynamic total behaviour.
[ { "docid": "2d4cf9158aa15bb1fe29e085c23e574d", "score": "0.8569316", "text": "func BarDynamicTotal() BarOption {\n\treturn func(s *bState) {\n\t\ts.dynamic = true\n\t}\n}", "title": "" } ]
[ { "docid": "8764ea9690e8ae72b5a4fdd4e5e9c5b1", "score": "0.6822542", "text": "func BarAutoIncrTotal(trigger, amount int64) BarOption {\n\treturn func(s *bState) {\n\t\ts.dynamic = true\n\t\ts.totalAutoIncrTrigger = trigger\n\t\ts.totalAutoIncrBy = amount\n\t}\n}", "title": "" }, { "docid": "318893540a4dd5dd288984f7d33acdc3", "score": "0.58371234", "text": "func (sb *SBratio) AddTotal(t int) {\n\tsb.Total = sb.Total + t\n}", "title": "" }, { "docid": "73ea54b6222fd01704ee947e81fec0e5", "score": "0.5827061", "text": "func (s *Service) DynamicRegionTotal(c context.Context) (map[string]int, error) {\n\trs, err := s.dy.RegionTotal(c, &dymdl.ArgRegionTotal{RealIP: metadata.String(c, metadata.RemoteIP)})\n\tif err != nil {\n\t\tlog.Error(\"s.dy.RegionTotal error(%v)\", err)\n\t\treturn nil, err\n\t}\n\treturn rs, nil\n}", "title": "" }, { "docid": "6f2015d8b44e0052b15e55986fc94e1e", "score": "0.55769485", "text": "func (b *Bar) SetTotal(total int64, final bool) {\n\tb.operateState <- func(s *bState) {\n\t\tif total > 0 {\n\t\t\ts.total = total\n\t\t}\n\t\tif final {\n\t\t\ts.current = s.total\n\t\t\ts.toComplete = true\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2eec69ca3d8437a64a82af9bf0230d78", "score": "0.5365168", "text": "func (t *Output) AddBar(count int) {\n\t// Not implemented\n}", "title": "" }, { "docid": "e8b7b9cbb20413292af6d22793eaf042", "score": "0.53219694", "text": "func (m *ConsumerMutation) AddTotal(f float64) {\n\tif m.addtotal != nil {\n\t\t*m.addtotal += f\n\t} else {\n\t\tm.addtotal = &f\n\t}\n}", "title": "" }, { "docid": "d86d32aaf823afb1d46eeaa9309b9ed2", "score": "0.51055646", "text": "func (tv *TestPowerTableView) Total(ctx context.Context, st state.Tree, bstore blockstore.Blockstore) (uint64, error) {\n\treturn tv.totalPower, nil\n}", "title": "" }, { "docid": "d86d32aaf823afb1d46eeaa9309b9ed2", "score": "0.51055646", "text": "func (tv *TestPowerTableView) Total(ctx context.Context, st state.Tree, bstore blockstore.Blockstore) (uint64, error) {\n\treturn tv.totalPower, nil\n}", "title": "" }, { "docid": "e7840d92f0ef90d5d3d61edded18ec8e", "score": "0.5096683", "text": "func (r *PeerDependenciesListServerResponse) Total(value int) *PeerDependenciesListServerResponse {\n\tr.total = &value\n\treturn r\n}", "title": "" }, { "docid": "c80e017f079e97be4e8d6778439573a1", "score": "0.5037804", "text": "func (tv *TestView) Total(ctx context.Context, st state.Tree, bstore blockstore.Blockstore) (*types.BytesAmount, error) {\n\treturn types.NewBytesAmount(1), nil\n}", "title": "" }, { "docid": "01bf797e5d201c0e3f07f90ee79c9f83", "score": "0.50111467", "text": "func (m *WeChatPayMutation) AddPayerTotal(i int32) {\n\tif m.addpayer_total != nil {\n\t\t*m.addpayer_total += i\n\t} else {\n\t\tm.addpayer_total = &i\n\t}\n}", "title": "" }, { "docid": "2fab92ae96aaf7180674f909d5a85a2b", "score": "0.4961807", "text": "func (m *ConsumerMutation) AddedTotal() (r float64, exists bool) {\n\tv := m.addtotal\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "5eee5449246afea633d9ab34fd5cf29a", "score": "0.49281746", "text": "func Total() uint64 {\n\treturn total\n}", "title": "" }, { "docid": "6f4760d7bf0c8ace21b00f45eeb01ab1", "score": "0.49131972", "text": "func (m MonthlyStatistics) Total() (float64, float64) {\n\tconsumption := 0.0\n\tcosts := 0.0\n\tfor _, part := range m {\n\t\tconsumption = consumption + part.Consumption\n\t\tcosts = costs + part.Costs\n\t}\n\treturn consumption, costs\n}", "title": "" }, { "docid": "d43a291f910171d494709c443c5584bf", "score": "0.4904041", "text": "func (p *BarChart) Add(x, y int) { p.xy = append(p.xy, XY{x, y}) }", "title": "" }, { "docid": "9cb8fd60f09683b297ceb247a6040c22", "score": "0.49019432", "text": "func (c *LoggingClient) Total(stat string, value int64) error {\n\treturn c.fn(\"Total\", stat, value)\n}", "title": "" }, { "docid": "efe99ec2d5a1a474a083871c277e1d72", "score": "0.4889014", "text": "func (c *Chronometer) Total(now time.Time) string {\n\tvar dur time.Duration\n\tfor _, s := range c.TimerList {\n\t\tdur = dur + s.watchTotal(now)\n\t}\n\treturn formatDuration(dur)\n}", "title": "" }, { "docid": "ab3b168f7ce193fc40e1de642957e507", "score": "0.48876944", "text": "func (b *NetworkVerificationBuilder) Total(value int) *NetworkVerificationBuilder {\n\tb.total = value\n\tb.bitmap_ |= 4\n\treturn b\n}", "title": "" }, { "docid": "d4c13e32af52986a3d49cf8b3ba6ca18", "score": "0.48272303", "text": "func (d *Data) Total() int {\n\treturn len(d.cellsByIndex)\n}", "title": "" }, { "docid": "96281c2257011736a9ade5acb181c9f1", "score": "0.48134422", "text": "func Total(r []RowVal) float64 {\n\ttotal := 0.00\n\tvar v float64\n\tvar err error\n\tfor i := range r {\n\t\tv, err = strconv.ParseFloat(r[i].Amount, 64)\n\t\tif err == nil {\n\t\t\ttotal += v\n\t\t}\n\t}\n\treturn total\n}", "title": "" }, { "docid": "c9894743feb4b911c55d1a8c8967d8e0", "score": "0.48125073", "text": "func (o *PurchaseBSDResponse) HasTotal() bool {\n\tif o != nil && o.Total != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b84bace26c5878671bfa43b1a563575f", "score": "0.48097944", "text": "func (m *Metric) Total() float64 {\n\tvar sum float64\n\tfor _, v := range m.MetricMap {\n\t\tsum += v\n\t}\n\n\treturn sum\n}", "title": "" }, { "docid": "ba4d3ed48b1fdbccb3428bf3e50fe3bb", "score": "0.47904915", "text": "func Total() uint64 {\n\tvar total uint64\n\treturn ^total\n}", "title": "" }, { "docid": "26b046df83fca574a06aff11d2c3a20e", "score": "0.4783896", "text": "func (m *ConsumerMutation) SetTotal(f float64) {\n\tm.total = &f\n\tm.addtotal = nil\n}", "title": "" }, { "docid": "0ccbeada396eab642bf5d2fc8beacfd8", "score": "0.47813272", "text": "func (o *IndicatorRatio) SetTotal(v Query) {\n\to.Total = v\n}", "title": "" }, { "docid": "fc22cba6806d803f37569470fcc817bd", "score": "0.47690707", "text": "func Total() uint64 {\n\treturn ^uint64(0)\n}", "title": "" }, { "docid": "a3b91e72762c13d6be8f1181662e2605", "score": "0.47545612", "text": "func (q *ProjetoDado) Total() int {\n\treturn q.TotalBacklog() + q.TotalAgMerge() + q.TotalTeste()\n}", "title": "" }, { "docid": "8012cd4c0304d5b21d25897b37cafc3b", "score": "0.47420684", "text": "func (t *PublishOutput) AddBar(count int) {\n\tif t.barType != nil && *t.barType == aptly.BarPublishGeneratePackageFiles {\n\t\tt.RemainingNumberOfPackages--\n\t\tt.Store(t)\n\t}\n}", "title": "" }, { "docid": "9419feaa43ab43ac5dcdb2540f6d923b", "score": "0.47379923", "text": "func (m *BillMutation) AddPayTotal(i int) {\n\tif m.add_Pay_total != nil {\n\t\t*m.add_Pay_total += i\n\t} else {\n\t\tm.add_Pay_total = &i\n\t}\n}", "title": "" }, { "docid": "0dec2e69d3a635ce0497cc5626f7ca49", "score": "0.4736978", "text": "func (cgl ConsumerGroupLag) Total() uint64 {\n\tvar total uint64\n\tfor _, lag := range cgl.ByPartition {\n\t\ttotal += uint64(lag.Lag())\n\t}\n\treturn total\n}", "title": "" }, { "docid": "853553a9f136a1e2c398ce815d33a6c7", "score": "0.4728349", "text": "func (dim Dimension) Total() int {\n\tr := 1\n\tfor i := 0; i < dim.Len; i++ {\n\t\tr *= dim.Shape[i]\n\t}\n\treturn r\n}", "title": "" }, { "docid": "f4e16d6bf1e7095a82b11dff253f25a5", "score": "0.46938944", "text": "func (o *ObjectiveStatusBudget) GetTotal() float64 {\n\tif o == nil {\n\t\tvar ret float64\n\t\treturn ret\n\t}\n\n\treturn o.Total\n}", "title": "" }, { "docid": "9d5e2475487a213f6ccfbd1254bd70ce", "score": "0.46799046", "text": "func RegisterKubefedClusterTotal(state, cluster string) {\n\tswitch state {\n\tcase ClusterReady:\n\t\tkubefedClusterTotal.WithLabelValues(state, cluster).Set(1)\n\t\tkubefedClusterTotal.WithLabelValues(ClusterNotReady, cluster).Set(0)\n\t\tkubefedClusterTotal.WithLabelValues(ClusterOffline, cluster).Set(0)\n\tcase ClusterNotReady:\n\t\tkubefedClusterTotal.WithLabelValues(state, cluster).Set(1)\n\t\tkubefedClusterTotal.WithLabelValues(ClusterOffline, cluster).Set(0)\n\t\tkubefedClusterTotal.WithLabelValues(ClusterReady, cluster).Set(0)\n\tcase ClusterOffline:\n\t\tkubefedClusterTotal.WithLabelValues(state, cluster).Set(1)\n\t\tkubefedClusterTotal.WithLabelValues(ClusterNotReady, cluster).Set(0)\n\t\tkubefedClusterTotal.WithLabelValues(ClusterReady, cluster).Set(0)\n\t}\n}", "title": "" }, { "docid": "a8d546beeb05662ea301b7ca61bc69b5", "score": "0.46698385", "text": "func (dc *HDatadogMetricsCollector) UpdateTotalDuration(timeSinceStart time.Duration) {\n\tms := float64(timeSinceStart.Nanoseconds() / 1000000)\n\tdc.client.Histogram(dc.getMetricWidCircuitName(dmTotalDuration), ms, nil, 1.0)\n}", "title": "" }, { "docid": "a829ecab9487ad855a602af1f1a8c7d6", "score": "0.464671", "text": "func (m *Metric) PrintTotal() {\n\tfmt.Printf(\"Total: %.1f us\\n\", m.Total())\n}", "title": "" }, { "docid": "2136dfd3bb18c3d6e0fca22c44d2d674", "score": "0.4645563", "text": "func (o *IndicatorRatio) GetTotal() Query {\n\tif o == nil {\n\t\tvar ret Query\n\t\treturn ret\n\t}\n\n\treturn o.Total\n}", "title": "" }, { "docid": "0479ba6793424797af8fa6f121b89a1e", "score": "0.46264035", "text": "func (c *ChartBox) Bar(canvas fc.Canvas, size float64) {\n\tdlen := float64(len(c.data) - 1)\n\tymin := zerobase(c.zerobased, c.minvalue)\n\tfor i, d := range c.data {\n\t\tx := fc.MapRange(float64(i), 0, dlen, c.left, c.right)\n\t\ty := fc.MapRange(d.value, ymin, c.maxvalue, c.bottom, c.top)\n\t\tcanvas.Line(x, c.bottom, x, y, size, c.color)\n\t}\n}", "title": "" }, { "docid": "97bb501816e5113f8b23f67133215af8", "score": "0.462268", "text": "func (updater *ApplyResultUpdaterImpl) SetTotal(total uint32) {\n\tatomic.StoreUint32(&updater.Result.Total, total)\n}", "title": "" }, { "docid": "bbcd2a617abf8a466ae2b565aa8fd4ee", "score": "0.46151543", "text": "func (f *Fitness) CalculateTotal() {\n\tf.Total = f.Distance\n\tf.Total += 100 * math.Pow(f.OverDemand, 2)\n}", "title": "" }, { "docid": "439ca749b1e92157f932b1e71867bb04", "score": "0.4604025", "text": "func (self *ArraySet) SetTotalA(member int) {\n self.Object.Set(\"total\", member)\n}", "title": "" }, { "docid": "48280ddcc617b8282f866b21d594cb12", "score": "0.45969173", "text": "func (c *AppearancesByYears) Total() int {\n\ttotal := 0\n\tfor _, a := range c.Aggregates {\n\t\ttotal += a.Main + a.Alternate\n\t}\n\treturn total\n}", "title": "" }, { "docid": "8793e2f3747fb4307ad886ca1ad03c88", "score": "0.45960885", "text": "func (h *Histogram) Total() uint64 {\n\th.m.Lock()\n\tvar count uint64\n\tfor i := 0; i < len(h._bins); i++ {\n\t\tcount += h._bins[i]._count\n\t}\n\th.m.Unlock()\n\treturn count\n}", "title": "" }, { "docid": "f72150a1162ff562641a230dd70c637a", "score": "0.45955312", "text": "func (o *FileUsageResponseFilesUsage) HasTotal() bool {\n\tif o != nil && o.Total != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d8c6457ad79401bfaa1fe4c9a8edf893", "score": "0.45917872", "text": "func (f FeePool) UpdateTotalValAccum(height int64, totalBondedTokens sdk.Dec) FeePool {\n\tf.TotalValAccum = f.TotalValAccum.UpdateForNewHeight(height, totalBondedTokens)\n\treturn f\n}", "title": "" }, { "docid": "d8c6457ad79401bfaa1fe4c9a8edf893", "score": "0.45917872", "text": "func (f FeePool) UpdateTotalValAccum(height int64, totalBondedTokens sdk.Dec) FeePool {\n\tf.TotalValAccum = f.TotalValAccum.UpdateForNewHeight(height, totalBondedTokens)\n\treturn f\n}", "title": "" }, { "docid": "cd6a38e8816ff63b9b49410ac2cc1d08", "score": "0.45866272", "text": "func (p *Progress) AddToTotal(in <-chan interface{}, out chan<- interface{}, errs chan<- error) {\n\tfor m := range in {\n\t\tatomic.AddInt64(&p.Total, 1)\n\t\tout <- m\n\t}\n}", "title": "" }, { "docid": "484036fc5d8c1b88ff2b1e820d97a399", "score": "0.4583612", "text": "func (dm *DiscountManager) getTotal() float64 {\n var total float64 = dm.subTotal\n var original float64\n var reduced float64\n\n for id, discounts := range dm.discountMap {\n quantity, inBasket := dm.quantities[id]\n\n if !inBasket { continue; }\n\n price := dm.prices[id]\n\n for _, discountFunc := range discounts {\n original = float64(quantity) * price\n reduced = discountFunc(quantity, price)\n\n total -= original - reduced\n }\n }\n\n return total\n}", "title": "" }, { "docid": "43d2f4814431dd15f4a6853aadf571b9", "score": "0.45799676", "text": "func (m *ConsumerMutation) Total() (r float64, exists bool) {\n\tv := m.total\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "bf8ceab508734e9f52d7e1a3b4c32b0b", "score": "0.45776784", "text": "func ProgressBar(total int64, progressCh <-chan int64, doneCh chan<- struct{}) {\n\tbar := pb.New64(total).Start()\n\tbar.SetUnits(pb.U_BYTES)\n\tfor elem := range progressCh {\n\t\tbar.Add64(elem)\n\t}\n\tbar.Finish()\n\tdoneCh <- struct{}{}\n}", "title": "" }, { "docid": "349b0c9937e6074c099f893135efb938", "score": "0.45166385", "text": "func (m *repoMocker) Total(ctx context.Context) int64 {\n\targs := m.Called(ctx)\n\treturn args.Get(0).(int64)\n}", "title": "" }, { "docid": "00c813e6e8e546078a3bf1e20bff959a", "score": "0.45152673", "text": "func (o *ObjectiveStatusBudget) SetTotal(v float64) {\n\to.Total = v\n}", "title": "" }, { "docid": "0900da0527babeeb7b90e4af6fe4201f", "score": "0.4509409", "text": "func drawTotal(c *freetype.Context, total string) {\n\tpt := freetype.Pt(213, 384)\n\tc.SetFontSize(_totalText)\n\t_, _ = c.DrawString(\"Total level:\", pt)\n\tpt = freetype.Pt(239, 404)\n\t_, _ = c.DrawString(total, pt)\n}", "title": "" }, { "docid": "3e261df34e6959f9952ca11792aef428", "score": "0.45026314", "text": "func (m *BillMutation) AddedPayTotal() (r int, exists bool) {\n\tv := m.add_Pay_total\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "8131cd8e98f822e1a7e5ec6212b6f4b3", "score": "0.4502047", "text": "func HaveTotal(count int) Matcher {\n\n\treturn to.WithTransform(func(actual interface{}) int {\n\n\t\tdata, ok := actual.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn -1\n\t\t}\n\n\t\tcount, ok := data[\"count\"].(float64) // NOTE: response comes as float64\n\t\tif !ok {\n\t\t\treturn -1\n\t\t}\n\n\t\treturn int(count)\n\n\t}, to.Equal(count))\n\n}", "title": "" }, { "docid": "f9a79d0ba19c0d94dfe55987cd8cb07f", "score": "0.45016238", "text": "func (o *InstitutionsGetResponse) SetTotal(v int32) {\n\to.Total = v\n}", "title": "" }, { "docid": "0bcbcc6d9781c8d04b2cbfd29a511b5e", "score": "0.44986296", "text": "func (o *PurchaseBSDResponse) GetTotal() string {\n\tif o == nil || o.Total == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Total\n}", "title": "" }, { "docid": "96b577677d6e0b580c8d20840014d2c4", "score": "0.449521", "text": "func (t *TimeBucketCounter) Total() int64 {\n\tt.Lock()\n\tdefer t.Unlock()\n\n\treturn t.currTotal\n}", "title": "" }, { "docid": "eb51cc8da9ea053d8fabb05ecff432df", "score": "0.4479048", "text": "func (m *metricSnowflakeBillingVirtualWarehouseTotal) emit(metrics pmetric.MetricSlice) {\n\tif m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 {\n\t\tm.updateCapacity()\n\t\tm.data.MoveTo(metrics.AppendEmpty())\n\t\tm.init()\n\t}\n}", "title": "" }, { "docid": "72d923d9a4dc9643ea55ad845ebda82a", "score": "0.44771686", "text": "func (o *ListResponse) HasTotal() bool {\n\tif o != nil && o.Total != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "13f2534f06ae10640a8fef52332cc6af", "score": "0.44753224", "text": "func Total() uint64 {\n\treturn math.MaxUint64\n}", "title": "" }, { "docid": "b2896dce0684c59c963825e0daa939a2", "score": "0.4471191", "text": "func (obj *chain) Total() uint {\n\treturn obj.total\n}", "title": "" }, { "docid": "b2896dce0684c59c963825e0daa939a2", "score": "0.4471191", "text": "func (obj *chain) Total() uint {\n\treturn obj.total\n}", "title": "" }, { "docid": "99b8a68b895dd1a1bb1de895b60c2f3d", "score": "0.44683644", "text": "func (rb *HealthRecordBuilder) NodeTotal(nodetotal string) *HealthRecordBuilder {\n\trb.v.NodeTotal = &nodetotal\n\treturn rb\n}", "title": "" }, { "docid": "38bf9d2c8c0f7290d4d0781791d1dc3d", "score": "0.4467735", "text": "func (c *Chronometer) StopTotal(now time.Time) string {\n\treturn formatDuration(c.StopTimer.watchTotal(now))\n}", "title": "" }, { "docid": "3184b84e347e67d847b4e9b4a3ef3823", "score": "0.44659662", "text": "func (m *BillMutation) PayTotal() (r int, exists bool) {\n\tv := m._Pay_total\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "50e2c595161b518a66412f1d4f653028", "score": "0.44651237", "text": "func (_Vbnb *VbnbCaller) TotalBorrows(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Vbnb.contract.Call(opts, &out, \"totalBorrows\")\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "a54d5431997075dfd2596cbc6c8e5ece", "score": "0.4464001", "text": "func (m *Measure) Total() uint64 {\n\treturn m.UserTotal + m.SystemTotal + m.IdleTotal\n}", "title": "" }, { "docid": "32e5bd9d6507e90d9278fde0991d1ae5", "score": "0.44618803", "text": "func updateBillTotalIncVat(bill *data.Bill, billLines []data.BillLines) {\n\t//TODO: Fix so the total values are made from line total to avoid doing the same calculations in several functions\n\tvar lineIncVat float64\n\tbill.TotalIncVat = 0\n\tfor _, v := range billLines {\n\t\tif v.VatUsed == 0 {\n\t\t\tlineIncVat = v.PriceExVat\n\t\t\tlineIncVat -= lineIncVat / 100 * float64(v.DiscountPercentage)\n\t\t} else {\n\t\t\tlineIncVat = v.PriceExVat + (v.PriceExVat / 100.0 * float64(v.VatUsed))\n\t\t\tlineIncVat -= lineIncVat / 100 * float64(v.DiscountPercentage)\n\t\t}\n\t\tlineIncVat *= float64(v.Quantity)\n\t\tbill.TotalIncVat += lineIncVat\n\n\t}\n}", "title": "" }, { "docid": "6d83eff7b5b4628c231cb0742917a138", "score": "0.44585347", "text": "func (m *WeChatPayMutation) AddedPayerTotal() (r int32, exists bool) {\n\tv := m.addpayer_total\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "2613f41b8e16723299d9d6b8bedb71f7", "score": "0.44509104", "text": "func (self *ArraySet) Total() int{\n return self.Object.Get(\"total\").Int()\n}", "title": "" }, { "docid": "41c91aec50f4f16d5df5623dd0c0b2f8", "score": "0.44477808", "text": "func (h *Histogram) Total() (total int64) {\n\tbm := h.bitmap.Clone()\n\tfor {\n\t\tbucket, ok := bm.Next()\n\t\tif !ok {\n\t\t\treturn total\n\t\t}\n\t\ttotal += int64(sumHistogram(&loadBucket(&h.buckets[bucket]).entries))\n\t}\n}", "title": "" }, { "docid": "92bffceaa39dad0b4af65ce1c4a18e58", "score": "0.44475496", "text": "func (res *RealtimeInfo) Total() float64 {\n\treturn float64(res.TotalWH)\n}", "title": "" }, { "docid": "6ba3f19a00a3bf6f181d4239b104b851", "score": "0.44447654", "text": "func (banka Banka) total() {\r\n\tstanje := 0.0\r\n\tfor _, v := range banka.klijenti {\r\n\t\tstanje += v.stanje\r\n\t}\r\n\tfmt.Printf(\"Total: %f\\n\", stanje)\r\n\r\n}", "title": "" }, { "docid": "3f25c502d1654cc5779ea9f2ba93e49e", "score": "0.44427934", "text": "func (m *metricSnowflakeBillingWarehouseVirtualWarehouseTotal) emit(metrics pmetric.MetricSlice) {\n\tif m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 {\n\t\tm.updateCapacity()\n\t\tm.data.MoveTo(metrics.AppendEmpty())\n\t\tm.init()\n\t}\n}", "title": "" }, { "docid": "4e6cf61bb2ac088ff1be9360b8b9c844", "score": "0.44402254", "text": "func (s *Statistics) Total(name string) time.Duration {\n\treturn s.duration(s.enter, s.exit, name)\n}", "title": "" }, { "docid": "f44afbc9a0208a97e7fba4a15577ad8b", "score": "0.44393286", "text": "func (_m *StatusMetrics) SetStatusUpdateTotal(kind string) {\n\t_m.Called(kind)\n}", "title": "" }, { "docid": "59e1e229b73cc8e57d854c9393d62f5b", "score": "0.4436955", "text": "func (bs *basicStatsImpl) TotalBoost() float32 {\n\treturn bs.totalBoost\n}", "title": "" }, { "docid": "13155a53a4cae97db21f5c7c14e49645", "score": "0.44342625", "text": "func updateLineExVatTotal(b []data.BillLines) {\n\tfor i := 0; i < len(b); i++ {\n\t\tsum := b[i].PriceExVat * float64(b[i].Quantity)\n\t\tsum = sum - (sum / 100 * float64(b[i].DiscountPercentage))\n\t\tb[i].PriceExVatTotal = sum\n\t}\n}", "title": "" }, { "docid": "b4e95019f9d7737ac6532fbdbf5549e7", "score": "0.4412881", "text": "func (e *Evaluator) Total() float64 {\n\te.mu.RLock()\n\tweight := e.weight\n\te.mu.RUnlock()\n\treturn weight\n}", "title": "" }, { "docid": "c395b5be6bdbd2f31633a5efa5c46cff", "score": "0.441116", "text": "func (b *MultiBar) AddBar(prefix string) *MultiBarItem {\n\ti := &MultiBarItem{\n\t\tcore: newSingleBarCore(prefix),\n\t}\n\tb.bars = append(b.bars, i)\n\treturn i\n}", "title": "" }, { "docid": "b40513766d36e29da3d3189303268e06", "score": "0.44083434", "text": "func (as Answers) Total() int {\n\treturn len(as)\n}", "title": "" }, { "docid": "f1c6db672e1eb04e5c9073dd52441401", "score": "0.44046357", "text": "func (z *ZipCodeGenerator) SetTotal(total int) {\n\tif len(z.ZipCodeCounts) == 0 {\n\t\tlog.Printf(\"Setting total on zipcode generator not containing any zipcodes for subzone %d\", z.Subzone)\n\t\tz.Total = 0\n\t\treturn\n\t}\n\n\ts := 0\n\tfor _, z := range z.ZipCodeCounts {\n\t\ts += z.Count\n\t}\n\n\tt := 0\n\tfor i := range z.ZipCodeCounts[:len(z.ZipCodeCounts)-1] {\n\t\tz.ZipCodeCounts[i].Count = (z.ZipCodeCounts[i].Count * total) / s\n\t\tt += z.ZipCodeCounts[i].Count\n\t}\n\n\tz.ZipCodeCounts[len(z.ZipCodeCounts)-1].Count = total - t\n\tz.Total = total\n}", "title": "" }, { "docid": "e80c1ddbe3077735690d46ea28e098a6", "score": "0.44008794", "text": "func (g Group) Total(ctx context.Context) (total float64, err error) {\n\tfor _, dice := range g {\n\t\tresult, err := dice.Total(ctx)\n\t\tif err != nil {\n\t\t\treturn total, err\n\t\t}\n\t\ttotal += result\n\t}\n\treturn\n}", "title": "" }, { "docid": "8a213db3f07e7fbe808ed61476afc865", "score": "0.43982694", "text": "func (o *FileUsageResponseFilesUsage) SetTotal(v int32) {\n\to.Total = &v\n}", "title": "" }, { "docid": "2d47e9c19f5abd6ff704f1f2f63d057c", "score": "0.43928617", "text": "func (m *Margaid) Bar(series []*Series, using ...Using) {\n\tif len(series) == 0 {\n\t\treturn\n\t}\n\n\toptions := getPlotOptions(using)\n\n\tmaxSize := 0\n\tfor _, s := range series {\n\t\tif s.Size() > maxSize {\n\t\t\tmaxSize = s.Size()\n\t\t}\n\t}\n\n\tplotWidth := (m.width - 2*m.inset)\n\tbarWidth := plotWidth / float64(maxSize)\n\tbarWidth /= 1.5\n\tbarWidth = math.Min(barWidth, tickDistance)\n\tbarWidth /= float64(len(series))\n\tbarOffset := -(barWidth / 2) * float64(len(series)-1)\n\n\tfor i, s := range series {\n\t\tpoints, err := m.getProjectedValues(s, options.xAxis, options.yAxis)\n\n\t\tif err != nil {\n\t\t\tm.error(err.Error())\n\t\t\treturn\n\t\t}\n\t\tid := m.addPlot(s.title)\n\t\tcolor := m.getPlotColor(id)\n\t\tm.g.\n\t\t\tStrokeWidth(\"1px\").\n\t\t\tColor(color).\n\t\t\tTransform(\n\t\t\t\tsvg.Translation(m.inset, m.height-m.inset),\n\t\t\t\tsvg.Scaling(1, -1),\n\t\t\t)\n\n\t\tfor _, p := range points {\n\t\t\tm.g.Rect(barOffset+float64(i)*barWidth+p.X-barWidth/2, 0, barWidth, p.Y)\n\t\t}\n\t}\n\tm.g.Transform()\n\n}", "title": "" }, { "docid": "9a50247d8889a3ac8740fe1e44151f52", "score": "0.4390527", "text": "func (d *Daily) UpdateTotalFare(actualFare int) {\n\td.dailyTotal += actualFare\n}", "title": "" }, { "docid": "a228d9f582a8d1276dcf54c3b6e10ec0", "score": "0.43826568", "text": "func (mb *MetricsBuilder) RecordSnowflakeBillingVirtualWarehouseTotalDataPoint(ts pcommon.Timestamp, val float64, serviceTypeAttributeValue string) {\n\tmb.metricSnowflakeBillingVirtualWarehouseTotal.recordDataPoint(mb.startTime, ts, val, serviceTypeAttributeValue)\n}", "title": "" }, { "docid": "fcb619d0691bbd353a1e5d13581b5220", "score": "0.43815446", "text": "func getTotalValue(treasures *[]Loot) int {\n\tvar tot = 0\n\tfor _, t := range *treasures {\n\t\ttot += t.Value\n\t}\n\treturn tot\n}", "title": "" }, { "docid": "0dbd53f3946474f695116e765819a7e3", "score": "0.43779022", "text": "func (c *Cart) TotalAmount() float64 {\n\treturn 64\n}", "title": "" }, { "docid": "9e026c9e3f8d972fe276082a1532416a", "score": "0.43679", "text": "func (o *StoragePureArrayUtilizationAllOf) SetTotalReduction(v float32) {\n\to.TotalReduction = &v\n}", "title": "" }, { "docid": "5cada9095c077b30a66bdb9a4be3e8cf", "score": "0.43584132", "text": "func (m *ConsumerMutation) OldTotal(ctx context.Context) (v *float64, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldTotal is only allowed on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldTotal requires an ID field in the mutation\")\n\t}\n\toldValue, err := m.oldValue(ctx)\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"querying old value for OldTotal: %w\", err)\n\t}\n\treturn oldValue.Total, nil\n}", "title": "" }, { "docid": "e2f5b13e1fd91062b8aa98b5c40f7a8c", "score": "0.43543643", "text": "func Total() uint64 {\n\tconst sum uint64 = 18446744073709551615\n\treturn sum\n}", "title": "" }, { "docid": "209af5cc133c365f5557b46703b549a2", "score": "0.4353906", "text": "func (q *ProjetoDado) TotalBacklogM() int {\n\treturn q.Aprovado.QtdMelhoria + q.EmDesenvolvimento.QtdMelhoria\n}", "title": "" }, { "docid": "23fb4244af81a01095a579d1e6e12f67", "score": "0.43511", "text": "func MemTotalNormal() (uint64, error) {\n\tv, err := mem.VirtualMemory()\n\treturn v.Total, err\n}", "title": "" }, { "docid": "51624d1d4873c823e479b97efb604e07", "score": "0.43507662", "text": "func (o *ListResponse) SetTotal(v int32) {\n\to.Total = &v\n}", "title": "" }, { "docid": "41bfb03aad23da6c55156cfc78e5009d", "score": "0.43505588", "text": "func (d *DiskUsageDetail) Total() int {\n\ttotal := *d.Issue +\n\t\t*d.Wiki +\n\t\t*d.File +\n\t\t*d.Subversion +\n\t\t*d.Git +\n\t\t*d.PullRequest\n\treturn total\n}", "title": "" }, { "docid": "e27c0f26a01c2ca3b41c94ffdebab015", "score": "0.43470138", "text": "func (hp *HPACK) DynamicSize() (n uint32) {\n\tfor _, hf := range hp.dynamic {\n\t\tn += hf.Size()\n\t}\n\treturn\n}", "title": "" }, { "docid": "d9e2eec707f7d16567d72962e4e0c447", "score": "0.43464795", "text": "func Total() uint64 {\n\tx := big.NewInt(2)\n\ty := big.NewInt(65)\n\tmod := big.NewInt(0)\n\n\t// Sum of n powers of 2 is 2 ^ (n+1) - 1\n\treturn x.Exp(x, y, mod).Uint64() - 1\n}", "title": "" }, { "docid": "dec23bb8d3401e809fe6e750596023f6", "score": "0.4344795", "text": "func Total() uint64 {\n\treturn 1<<64 - 1\n}", "title": "" }, { "docid": "dec23bb8d3401e809fe6e750596023f6", "score": "0.4344795", "text": "func Total() uint64 {\n\treturn 1<<64 - 1\n}", "title": "" } ]
30ed319206ea8acb79d313a3c17866ed
GetSourcesOk returns a tuple with the Sources field value and a boolean to check if the value has been set.
[ { "docid": "579f89486f6de73bd92c3e307597616e", "score": "0.8368881", "text": "func (o *StackEvent) GetSourcesOk() (*[]string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Sources, true\n}", "title": "" } ]
[ { "docid": "5a244abfb927fb1d5a52a677ca12a288", "score": "0.8398123", "text": "func (o *LogsDateRemapper) GetSourcesOk() (*[]string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Sources, true\n}", "title": "" }, { "docid": "8ebba59d1d0e3ea2aa73e954174f76ff", "score": "0.6946372", "text": "func (o *RebuildOperationResponse) GetSpecificSourcesOk() (*[]string, bool) {\n\tif o == nil || o.SpecificSources == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SpecificSources, true\n}", "title": "" }, { "docid": "ccba453353f242e0a4fb487e87a7db13", "score": "0.6806479", "text": "func (o *CreditFreddieMacAssetVOA24) GetVALIDATION_SOURCESOk() (*ValidationSources, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.VALIDATION_SOURCES, true\n}", "title": "" }, { "docid": "90c395e1877455718a47a8757140b46a", "score": "0.65741336", "text": "func (c *Config) LenSources() int {\n\treturn len(c.Sources)\n}", "title": "" }, { "docid": "b08a800311f2584c8ca31acffaf7935e", "score": "0.6446636", "text": "func (q *QueryResult) GetSources() *Sources {\n if q.Sources != nil {\n return q.Sources\n }\n return nil\n}", "title": "" }, { "docid": "1e112e6858c32db003593c9ab0aa1893", "score": "0.6377914", "text": "func (o *StoragePureProtectionGroup) GetSourceOk() (*string, bool) {\n\tif o == nil || o.Source == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Source, true\n}", "title": "" }, { "docid": "1964ef3f0a66bf2061116b244176b53d", "score": "0.6303042", "text": "func (o *CustomProcessMetadataKey) GetSourceOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Source, true\n}", "title": "" }, { "docid": "a54297245440e073db42caa2eebef499", "score": "0.63022244", "text": "func (c *Client) GetSources(p parameters) (SourceResults, error) {\n\tvar o SourceResults\n\tap := allowedParameters{ //List of allowed parameters and their allowed types\n\t\t\"country\": \"string\",\n\t\t\"category\": \"string\",\n\t\t\"lanague\": \"string\"}\n\tu, err := p.buildURL(c.APIUrl+apiSourcePath, &ap)\n\tif err != nil {\n\t\treturn o, err\n\t}\n\td, err := c.makeRequest(u)\n\tif err != nil {\n\t\treturn o, err\n\t}\n\terr = json.Unmarshal(d, &o)\n\tif err != nil {\n\t\treturn o, nil\n\t}\n\treturn o, nil\n}", "title": "" }, { "docid": "905000d0e0a82240e53bc71a45ac7880", "score": "0.6216163", "text": "func (o *GetRandomRecipes200ResponseRecipesInner) GetSourceUrlOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.SourceUrl, true\n}", "title": "" }, { "docid": "1c9763c531d6a6dfa49a793404f5276d", "score": "0.6206348", "text": "func (o ConnectionMonitorTestGroupResponseOutput) Sources() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ConnectionMonitorTestGroupResponse) []string { return v.Sources }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "5e3f411613990c1d155502c60bd67440", "score": "0.6161884", "text": "func (o *InlineObject1108) GetSourceDataOk() (AnyOfobject, bool) {\n\tif o == nil || o.SourceData == nil {\n\t\tvar ret AnyOfobject\n\t\treturn ret, false\n\t}\n\treturn *o.SourceData, true\n}", "title": "" }, { "docid": "555632ff1250f842fcf1d85460d2af26", "score": "0.6120298", "text": "func (m *HasPayloadLinkResultItem) GetSources()([]DeviceAndAppManagementAssignmentSource) {\n val, err := m.GetBackingStore().Get(\"sources\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]DeviceAndAppManagementAssignmentSource)\n }\n return nil\n}", "title": "" }, { "docid": "161ef40fc8ed97b2f1e0be31eac41b8b", "score": "0.6119763", "text": "func (o *Endpoint) GetSourceIdOk() (*string, bool) {\n\tif o == nil || o.SourceId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SourceId, true\n}", "title": "" }, { "docid": "682eb7a369bc7f3edf8a93eed170aed7", "score": "0.60453624", "text": "func (f *FredClient) GetSources(params map[string]interface{}) (*FredType, error) {\n\n\tfc, err := f.operate(params, sourcesParam)\n\n\tif err != nil {\n\t\tf.logError(sourcesParam, err)\n\t\treturn nil, err\n\t}\n\n\treturn fc, nil\n\n}", "title": "" }, { "docid": "78de0b40ddfc12ca60563eb194d2a4dc", "score": "0.60437846", "text": "func (o *SourceTypesCollection) GetLinksOk() (*CollectionLinks, bool) {\n\tif o == nil || o.Links == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Links, true\n}", "title": "" }, { "docid": "0546d0a9190f604f9ae9347ca3ecafec", "score": "0.60252446", "text": "func (o ConnectionMonitorTestGroupOutput) Sources() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ConnectionMonitorTestGroup) []string { return v.Sources }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "1bae43074b49bd249b0ea88dd86d4545", "score": "0.6013411", "text": "func (o *LogsDateRemapper) GetSources() []string {\n\tif o == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\n\treturn o.Sources\n}", "title": "" }, { "docid": "90bc094dfda76e623b8c1a672379dc60", "score": "0.5979107", "text": "func (c *Config) GetSources() []*Source {\n\treturn c.Sources\n}", "title": "" }, { "docid": "ff797cc6b30a00d7a1785e1c745f8e60", "score": "0.5934599", "text": "func (o *StackEvent) GetUrlsOk() (*[]string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Urls, true\n}", "title": "" }, { "docid": "4807c307bd71a7f086ec8b5280578b39", "score": "0.5926571", "text": "func (o *ForecastDefinition) GetDataSourceOk() (*string, bool) {\n\tif o == nil || o.DataSource == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DataSource, true\n}", "title": "" }, { "docid": "11bc7f3b17bb8e51f56d3b8d8ade6e6e", "score": "0.5919957", "text": "func (o *StackEvent) GetSources() []string {\n\tif o == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\n\treturn o.Sources\n}", "title": "" }, { "docid": "31adefcf867e24f6c4a48101a4cde107", "score": "0.59053826", "text": "func (o *RebuildOperationResponse) HasSpecificSources() bool {\n\tif o != nil && o.SpecificSources != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1198415c9e561ebb41dd16a6029846ad", "score": "0.58853954", "text": "func (o *ImportOperationResponse) GetSourceDirOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.SourceDir, true\n}", "title": "" }, { "docid": "883499db3b9bd7db5caddfe6872b2762", "score": "0.5872823", "text": "func (o *EnabledProviderAccount) GetSourceIdOk() (*string, bool) {\n\tif o == nil || IsNil(o.SourceId) {\n\t\treturn nil, false\n\t}\n\treturn o.SourceId, true\n}", "title": "" }, { "docid": "5b8a5662598f091ffb7cf26072b75d4e", "score": "0.5858489", "text": "func (o *InlineResponse20065ProjectFiles) GetFileSourceOk() (*string, bool) {\n\tif o == nil || o.FileSource == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FileSource, true\n}", "title": "" }, { "docid": "fbf335bf43837f8fecc8c04695b05062", "score": "0.58546484", "text": "func (o *ResourceService) GetSourceServiceOk() (*string, bool) {\n\tif o == nil || o.SourceService == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SourceService, true\n}", "title": "" }, { "docid": "0d75f2f84c14368be6a2da90e5866e17", "score": "0.58533955", "text": "func (c *Client) Sources(p params) (SourcesResponse, error) {\n\treq, err := c.newRequest(\"GET\", \"/v2/sources\", p, nil)\n\n\tvar res SourcesResponse\n\tif err != nil {\n\t\treturn res, err\n\t}\n\t_, err = c.do(req, &res)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\n\tif res.Status == \"error\" {\n\t\treturn res, &apiError{res.Code, res.Message}\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "62b303e671cff8b1e5e139679dec6aef", "score": "0.5837825", "text": "func (o *LogMetricConfig) GetLogSourceFiltersOk() (*[]LogSourceFilter, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.LogSourceFilters, true\n}", "title": "" }, { "docid": "6671ddc1b3137c9cf0b538ccd35f808a", "score": "0.57996315", "text": "func (c *Client) GetSources(options *QueryOptions) (*GetSampleSourceResponse, error) {\n\tres := &GetSampleSourceResponse{}\n\tpath := fmt.Sprintf(\"/sources%s\", query2String(options))\n\terr := c.requestAndParseResponse(\"GET\", path, nil, res)\n\treturn res, err\n}", "title": "" }, { "docid": "42a3c94001a7d64e11321a803c501eab", "score": "0.574434", "text": "func (o *UsageAttributionBody) GetTagConfigSourceOk() (*string, bool) {\n\tif o == nil || o.TagConfigSource == nil {\n\t\treturn nil, false\n\t}\n\treturn o.TagConfigSource, true\n}", "title": "" }, { "docid": "97210a9697ad09493989f06bc09e22ac", "score": "0.5696311", "text": "func (o *ConvertAmounts200Response) GetSourceAmountOk() (*float32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.SourceAmount, true\n}", "title": "" }, { "docid": "2dd21a39bacc628d74707c18b1158537", "score": "0.56555194", "text": "func (f *FileSystemSource) GetSourcesInfo() []pipeline.SourceInfo {\n\n\tsources := make([]pipeline.SourceInfo, len(f.filesInfo))\n\tvar i = 0\n\tfor _, file := range f.filesInfo {\n\t\tsources[i] = pipeline.SourceInfo{SourceName: file.SourceURI, TargetAlias: file.TargetAlias, Size: uint64(file.FileStats.Size())}\n\t\ti++\n\t}\n\n\treturn sources\n}", "title": "" }, { "docid": "7f9d86f5e2fae544f6d1b68019dfa8ad", "score": "0.56281346", "text": "func (o *GetRandomRecipes200ResponseRecipesInner) GetSourceNameOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.SourceName, true\n}", "title": "" }, { "docid": "fa24a9ff92e8a9f4690bd17b610423eb", "score": "0.56239927", "text": "func (o *ApplianceNetworkStatusAllOf) GetSourceHostnameOk() (*string, bool) {\n\tif o == nil || o.SourceHostname == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SourceHostname, true\n}", "title": "" }, { "docid": "30a014a5b51e5f870edf366e4e09132c", "score": "0.5620511", "text": "func (o *DnsEvent) GetSrcPortOk() (*int32, bool) {\n\tif o == nil || o.SrcPort == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SrcPort, true\n}", "title": "" }, { "docid": "de517f226a893133ddeaaf8cffb5de42", "score": "0.56204975", "text": "func (o *SourceTypesCollection) GetDataOk() (*[]SourceType, bool) {\n\tif o == nil || o.Data == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Data, true\n}", "title": "" }, { "docid": "54cd1a9505cf7cc6beef966e86405806", "score": "0.5607262", "text": "func (o *DnsEvent) GetSrcIDOk() (*string, bool) {\n\tif o == nil || o.SrcID == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SrcID, true\n}", "title": "" }, { "docid": "f6fa79e27d5b1e865669ba0ab6fdf5cb", "score": "0.55604005", "text": "func (s *SourceService) FindSources(ctx context.Context, opt platform.FindOptions) ([]*platform.Source, int, error) {\n\tu, err := newURL(s.Addr, sourcePath)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\tSetToken(s.Token, req)\n\n\thc := newClient(u.Scheme, s.InsecureSkipVerify)\n\tresp, err := hc.Do(req)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\tif err := CheckError(resp); err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\tvar bs []*platform.Source\n\tif err := json.NewDecoder(resp.Body).Decode(&bs); err != nil {\n\t\treturn nil, 0, err\n\t}\n\tdefer resp.Body.Close()\n\n\treturn bs, len(bs), nil\n}", "title": "" }, { "docid": "921e9a93ef5f04137be3490833f32385", "score": "0.5555302", "text": "func (N *NewsFeedAPI) GetSources(Query models.NewsQueryParameter) (models.Sources, error) {\n\tvar sourcesFeed models.Sources\n\tquerystring, err := N.BuildQueryString(\"sources\", Query)\n\tfmt.Println(querystring)\n\tresp, err := http.Get(N.Config.APIURL + querystring)\n\tif err != nil {\n\t\tlog.Println(\"Error query the newsapi service sources\")\n\t\treturn sourcesFeed, err\n\t}\n\tjson.NewDecoder(resp.Body).Decode(&sourcesFeed)\n\treturn sourcesFeed, err\n}", "title": "" }, { "docid": "bba0e6e30b345f151958cfa8bddbd23e", "score": "0.55530113", "text": "func GetSources(g1 *viper.Viper) ([]Sources, error) {\n\tvar subtreeKey = \"sources\"\n\tvar cfg []Sources\n\t//for key, value := range SourcesTemplate {\n\t//\tg1.SetDefault(key, value)\n\t//}\n\n\t//g1.AutomaticEnv()\n\t// config already read. substree passed\n\terr := g1.UnmarshalKey(subtreeKey, &cfg)\n\tif err != nil {\n\t\tlog.Fatal(\"error when parsing \", subtreeKey, \" config: \", err)\n\t\t//No sources, so nothing to run\n\t}\n\tfor i, s := range cfg {\n\t\tcfg[i] = populateDefaults(s)\n\t}\n\treturn cfg, err\n}", "title": "" }, { "docid": "be6003bbce97876f921e5f7377108d85", "score": "0.54981947", "text": "func (o *NormalizedProjectRevisionThirdPartyProvider) GetSubjectSourceOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SubjectSource.Get(), o.SubjectSource.IsSet()\n}", "title": "" }, { "docid": "97f39853f2bfed96eabf53cfbe6bfbe2", "score": "0.54825336", "text": "func (o DomainOutput) Sources() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *Domain) pulumi.StringArrayOutput { return v.Sources }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "e6c8a513e156982bc30c72c0bcc8a184", "score": "0.54809517", "text": "func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) GetDataSourceOk() (*FormulaAndFunctionApmDependencyStatsDataSource, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.DataSource, true\n}", "title": "" }, { "docid": "ca56ff9e703c0cfbd0f78393ee167bcd", "score": "0.54738027", "text": "func (o *ConvertAmounts200Response) GetSourceUnitOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.SourceUnit, true\n}", "title": "" }, { "docid": "d31f60c33e1790565612369babd902b0", "score": "0.54183435", "text": "func (h *SourceHandler) handleGetSources(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\n\treq, err := decodeGetSourcesRequest(ctx, r)\n\tif err != nil {\n\t\tEncodeError(ctx, err, w)\n\t\treturn\n\t}\n\n\tsrcs, _, err := h.SourceService.FindSources(ctx, req.findOptions)\n\tif err != nil {\n\t\tEncodeError(ctx, err, w)\n\t\treturn\n\t}\n\n\tres := newSourcesResponse(srcs)\n\n\tif err := encodeResponse(ctx, w, http.StatusOK, res); err != nil {\n\t\tlogEncodingError(h.Logger, r, err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "943de49e4fe7f1a0e5a1090afafb87e0", "score": "0.5402362", "text": "func (o *DnsEvent) GetSrcIPOk() (*string, bool) {\n\tif o == nil || o.SrcIP == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SrcIP, true\n}", "title": "" }, { "docid": "2a24ce43dae2ed863133ad19a86803b0", "score": "0.53811544", "text": "func (o *DnsEvent) GetSrcHostOk() (*string, bool) {\n\tif o == nil || o.SrcHost == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SrcHost, true\n}", "title": "" }, { "docid": "65e9572091a60f43f1342e87dcc7d33a", "score": "0.53761536", "text": "func (o *PipelineFilter) GetConnectorsOk() (*[]string, bool) {\n\tif o == nil || o.Connectors == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Connectors, true\n}", "title": "" }, { "docid": "12fef53da00b1583032816ce43f23134", "score": "0.5371365", "text": "func (GitSource) IsSource() {}", "title": "" }, { "docid": "b1b32dc1613ecefa8ce6e7de44a768dc", "score": "0.534492", "text": "func (o *VersionedRemoteProcessGroup) GetTargetUrisOk() (*string, bool) {\n\tif o == nil || o.TargetUris == nil {\n\t\treturn nil, false\n\t}\n\treturn o.TargetUris, true\n}", "title": "" }, { "docid": "44e82a6abb42f9303e35bbf4a61ef849", "score": "0.5344505", "text": "func SourcesShowFunc() {\n\topt := &SourcesShowOption{\n\t\tFrom: \"\",\n\t\tKey: \"MUST_EDIT_IT\",\n\t\tTo: \"\",\n\t}\n\tv, resp, err := client.Sources.Show(opt)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tos.Exit(1)\n\t}\n\tfmt.Println(resp.StatusCode)\n\tspew.Dump(v)\n}", "title": "" }, { "docid": "f72771a048f2b91cbd3950cbf7b1f2b9", "score": "0.53438175", "text": "func (m *MediaMutation) SourceURICleared() bool {\n\t_, ok := m.clearedFields[media.FieldSourceURI]\n\treturn ok\n}", "title": "" }, { "docid": "72b578c3c752098a3f9b523d2120016e", "score": "0.5338291", "text": "func (o *DnsEvent) GetSrcUserOk() (*string, bool) {\n\tif o == nil || o.SrcUser == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SrcUser, true\n}", "title": "" }, { "docid": "90ff25b4ae4b5bca24aa9818ee8c70b8", "score": "0.53300524", "text": "func (o *GetSourceDevice200ResponseConfigInterface) GetAddressesOk() (*GetSourceDevice200ResponseConfigInterfaceAddresses, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Addresses, true\n}", "title": "" }, { "docid": "60e69fbb6ec066103cede90e6e17acc6", "score": "0.5310182", "text": "func (o InstanceAccessControlAttributesAttributeValueOutput) Sources() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v InstanceAccessControlAttributesAttributeValue) []string { return v.Sources }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "c4db244bb45ebf11ec27839b973f9c9c", "score": "0.5300649", "text": "func (m *HasPayloadLinkResultItem) SetSources(value []DeviceAndAppManagementAssignmentSource)() {\n err := m.GetBackingStore().Set(\"sources\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "464b18957a37016c036ca6b6dd6f8828", "score": "0.52966136", "text": "func (o *FiltersSnapshot) GetStatesOk() (*[]string, bool) {\n\tif o == nil || o.States == nil {\n\t\treturn nil, false\n\t}\n\treturn o.States, true\n}", "title": "" }, { "docid": "1c9e956177b906734afd59b6c12ccde4", "score": "0.5285009", "text": "func (stream *MultiStream) ShouldLogSourceInfo() bool {\n\tfor _, s := range stream.streams {\n\t\tif s.ShouldLogSourceInfo() {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "854d28730be71f82733e1e441cb5dbe1", "score": "0.5278622", "text": "func (o *RebuildOperationResponse) GetSpecificSources() []string {\n\tif o == nil || o.SpecificSources == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn *o.SpecificSources\n}", "title": "" }, { "docid": "9f1e74349c5f982d343b78be23e888b6", "score": "0.52366483", "text": "func IsErrSourceInUse(err error) bool {\n\t_, ok := err.(ErrSourceInUse)\n\treturn ok\n}", "title": "" }, { "docid": "813605141fd2117ffa750e6944ab3681", "score": "0.5230762", "text": "func (o *GetRandomRecipes200ResponseRecipesInner) GetSpoonacularSourceUrlOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.SpoonacularSourceUrl, true\n}", "title": "" }, { "docid": "fc46e4131982240ad222d55faba94882", "score": "0.52270085", "text": "func (o AlertRuleFusionOutput) Sources() AlertRuleFusionSourceArrayOutput {\n\treturn o.ApplyT(func(v *AlertRuleFusion) AlertRuleFusionSourceArrayOutput { return v.Sources }).(AlertRuleFusionSourceArrayOutput)\n}", "title": "" }, { "docid": "83e1e7e4d4d635f2a4cb853d10196fd1", "score": "0.52267474", "text": "func (o *StoragePureProtectionGroup) GetTargetsOk() ([]string, bool) {\n\tif o == nil || o.Targets == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Targets, true\n}", "title": "" }, { "docid": "e4400f242f2e9bb3283eeaef04d080bc", "score": "0.5223538", "text": "func (o *StoragePureProtectionGroup) HasSource() bool {\n\tif o != nil && o.Source != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c348c92c68ef842391ec50404892edc6", "score": "0.5205885", "text": "func SourcesRawFunc() {\n\topt := &SourcesRawOption{Key: \"MUST_EDIT_IT\"}\n\tv, resp, err := client.Sources.Raw(opt)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tos.Exit(1)\n\t}\n\tfmt.Println(resp.StatusCode)\n\tspew.Dump(v)\n}", "title": "" }, { "docid": "b593a8413c781a3435d0b21ec76a2cbb", "score": "0.5203725", "text": "func (o *StorageNetAppSnapMirrorRelationship) GetSourcePathOk() (*string, bool) {\n\tif o == nil || o.SourcePath == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SourcePath, true\n}", "title": "" }, { "docid": "34a64ba7f36e39f509e83a4836cdd403", "score": "0.5201458", "text": "func (f *MACAddressFields) HasSOUR() bool {\n\treturn has1stBit(f.Flags)\n}", "title": "" }, { "docid": "4ed0ce85cdeeac425d9d78c6aa2f5374", "score": "0.5198602", "text": "func (o *SmsTextualMessage) GetDestinationsOk() (*[]SmsDestination, bool) {\n\tif o == nil || o.Destinations == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Destinations, true\n}", "title": "" }, { "docid": "9eed9634d2a02ba402ebb1f08ea77640", "score": "0.51983815", "text": "func (c *Client) FindSources(ctx context.Context, opt platform.FindOptions) ([]*platform.Source, int, error) {\n\tss := []*platform.Source{}\n\terr := c.db.View(func(tx *bolt.Tx) error {\n\t\tsrcs, err := c.findSources(ctx, tx, opt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tss = srcs\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\treturn ss, len(ss), nil\n}", "title": "" }, { "docid": "a260c9aff938f0275f69216ecd4dc925", "score": "0.51913023", "text": "func (o InputOutput) Sources() InputSourceArrayOutput {\n\treturn o.ApplyT(func(v *Input) InputSourceArrayOutput { return v.Sources }).(InputSourceArrayOutput)\n}", "title": "" }, { "docid": "f82d4ef7bf15117e98cd0d2227fae777", "score": "0.51756734", "text": "func (ssp *SampleSet) HasSource(sn SourceName) bool {\n\t_, ok := ssp.Samples[sn]\n\treturn ok\n}", "title": "" }, { "docid": "58f63af75d5f66436d0ff903906bd4a7", "score": "0.5174338", "text": "func HasMountSources(devfileContainer *dw.ContainerComponent) bool {\n\tvar mountSources bool\n\tif devfileContainer.MountSources == nil {\n\t\tmountSources = true\n\t} else {\n\t\tmountSources = *devfileContainer.MountSources\n\t}\n\treturn mountSources\n}", "title": "" }, { "docid": "8653ef5ae798e96c104807ac105f1948", "score": "0.5167372", "text": "func (mo *LicenseManager) SourceAvailable() (bool, error) {\n\tp, err := mo.currentProperty(\"sourceAvailable\")\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif p != nil {\n\t\treturn p.(bool), nil\n\t}\n\treturn false, nil\n\n}", "title": "" }, { "docid": "fa8ce023d1e2a37d2416abee69974d24", "score": "0.51542324", "text": "func (o *FiltersVirtualGateway) GetLinkStatesOk() (*[]string, bool) {\n\tif o == nil || o.LinkStates == nil {\n\t\treturn nil, false\n\t}\n\treturn o.LinkStates, true\n}", "title": "" }, { "docid": "fb384e0b5c20b4530f7345126ecb5a45", "score": "0.51537323", "text": "func (o *Site) GetSitesOk() ([]MicrosoftGraphSite, bool) {\n\tif o == nil || o.Sites == nil {\n\t\tvar ret []MicrosoftGraphSite\n\t\treturn ret, false\n\t}\n\treturn *o.Sites, true\n}", "title": "" }, { "docid": "50a7aae9feefc5b79f9d7ef3ba418245", "score": "0.51493376", "text": "func buildSources(terraformSources *[]interface{}) *[]wavefront.Source {\n\twavefrontSources := make([]wavefront.Source, len(*terraformSources))\n\n\tfor i, t := range *terraformSources {\n\t\tt := t.(map[string]interface{})\n\n\t\twavefrontSources[i] = wavefront.Source{\n\t\t\tName: t[\"name\"].(string),\n\t\t\tQuery: t[\"query\"].(string),\n\t\t}\n\t\tif t[\"disabled\"] != nil {\n\t\t\twavefrontSources[i].Disabled = t[\"disabled\"].(bool)\n\t\t}\n\t\tif t[\"scatter_plot_source\"] != nil {\n\t\t\twavefrontSources[i].ScatterPlotSource = t[\"scatter_plot_source\"].(string)\n\t\t}\n\t\tif t[\"query_builder_enabled\"] != nil {\n\t\t\twavefrontSources[i].QuerybuilderEnabled = t[\"query_builder_enabled\"].(bool)\n\t\t}\n\t\tif t[\"source_description\"] != nil {\n\t\t\twavefrontSources[i].SourceDescription = t[\"source_description\"].(string)\n\t\t}\n\t}\n\n\treturn &wavefrontSources\n}", "title": "" }, { "docid": "214747f2aab2eebe56d20c73c7914c6b", "score": "0.51297665", "text": "func (o *FiltersVirtualGateway) GetStatesOk() (*[]string, bool) {\n\tif o == nil || o.States == nil {\n\t\treturn nil, false\n\t}\n\treturn o.States, true\n}", "title": "" }, { "docid": "279b7bb53ea62e6cd9253f184a00dd64", "score": "0.51158077", "text": "func (repo SourceDynamoDBRepository) GetAllSources() ([]handlers.Source, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "07253bbcac942141c154fa8b563a3742", "score": "0.51047474", "text": "func (o *InlineResponse20065ProjectFiles) HasFileSource() bool {\n\tif o != nil && o.FileSource != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0e21cd4d850a17be2d87ed49c6995d73", "score": "0.5100492", "text": "func (target *BuildTarget) AllSources() []BuildInput {\n\tif target.NamedSources == nil {\n\t\treturn target.Sources\n\t}\n\treturn target.allBuildInputs(target.Sources, target.NamedSources)\n}", "title": "" }, { "docid": "ce640b7b8c593368d7b60bba0a2d2c31", "score": "0.5078507", "text": "func (o *DnsEvent) GetSrcMacOk() (*string, bool) {\n\tif o == nil || o.SrcMac == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SrcMac, true\n}", "title": "" }, { "docid": "c6d1c35575e05e48667e23369599cd31", "score": "0.5069473", "text": "func (o *FiltersFlexibleGpu) GetStatesOk() (*[]string, bool) {\n\tif o == nil || o.States == nil {\n\t\treturn nil, false\n\t}\n\treturn o.States, true\n}", "title": "" }, { "docid": "ab9404765306c60038861b53320aca93", "score": "0.50612456", "text": "func (o *CreditFreddieMacAssetVOA24) GetVALIDATION_SOURCES() ValidationSources {\n\tif o == nil {\n\t\tvar ret ValidationSources\n\t\treturn ret\n\t}\n\n\treturn o.VALIDATION_SOURCES\n}", "title": "" }, { "docid": "cfe2aee872ab45ff30ac7ff2aa035683", "score": "0.5056793", "text": "func (o *StackEvent) GetResourcesOk() (*[]StackEventResource, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Resources, true\n}", "title": "" }, { "docid": "c041273cfed0cde50852cc6084917412", "score": "0.5054149", "text": "func (c *restClient) ListSources(ctx context.Context, req *vmmigrationpb.ListSourcesRequest, opts ...gax.CallOption) *SourceIterator {\n\tit := &SourceIterator{}\n\treq = proto.Clone(req).(*vmmigrationpb.ListSourcesRequest)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tit.InternalFetch = func(pageSize int, pageToken string) ([]*vmmigrationpb.Source, string, error) {\n\t\tresp := &vmmigrationpb.ListSourcesResponse{}\n\t\tif pageToken != \"\" {\n\t\t\treq.PageToken = pageToken\n\t\t}\n\t\tif pageSize > math.MaxInt32 {\n\t\t\treq.PageSize = math.MaxInt32\n\t\t} else if pageSize != 0 {\n\t\t\treq.PageSize = int32(pageSize)\n\t\t}\n\t\tbaseUrl, err := url.Parse(c.endpoint)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\t\tbaseUrl.Path += fmt.Sprintf(\"/v1/%v/sources\", req.GetParent())\n\n\t\tparams := url.Values{}\n\t\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\t\tif req.GetFilter() != \"\" {\n\t\t\tparams.Add(\"filter\", fmt.Sprintf(\"%v\", req.GetFilter()))\n\t\t}\n\t\tif req.GetOrderBy() != \"\" {\n\t\t\tparams.Add(\"orderBy\", fmt.Sprintf(\"%v\", req.GetOrderBy()))\n\t\t}\n\t\tif req.GetPageSize() != 0 {\n\t\t\tparams.Add(\"pageSize\", fmt.Sprintf(\"%v\", req.GetPageSize()))\n\t\t}\n\t\tparams.Add(\"pageToken\", fmt.Sprintf(\"%v\", req.GetPageToken()))\n\n\t\tbaseUrl.RawQuery = params.Encode()\n\n\t\t// Build HTTP headers from client and context metadata.\n\t\thds := append(c.xGoogHeaders, \"Content-Type\", \"application/json\")\n\t\theaders := gax.BuildHeaders(ctx, hds...)\n\t\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\t\tif settings.Path != \"\" {\n\t\t\t\tbaseUrl.Path = settings.Path\n\t\t\t}\n\t\t\thttpReq, err := http.NewRequest(\"GET\", baseUrl.String(), nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\thttpReq.Header = headers\n\n\t\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer httpRsp.Body.Close()\n\n\t\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tbuf, err := io.ReadAll(httpRsp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}, opts...)\n\t\tif e != nil {\n\t\t\treturn nil, \"\", e\n\t\t}\n\t\tit.Response = resp\n\t\treturn resp.GetSources(), resp.GetNextPageToken(), nil\n\t}\n\n\tfetch := func(pageSize int, pageToken string) (string, error) {\n\t\titems, nextPageToken, err := it.InternalFetch(pageSize, pageToken)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tit.items = append(it.items, items...)\n\t\treturn nextPageToken, nil\n\t}\n\n\tit.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)\n\tit.pageInfo.MaxSize = int(req.GetPageSize())\n\tit.pageInfo.Token = req.GetPageToken()\n\n\treturn it\n}", "title": "" }, { "docid": "823a537a486381c49452a78a9a7e9b14", "score": "0.50512415", "text": "func (r *Instance) SourceDestCheck() pulumi.BoolOutput {\n\treturn (pulumi.BoolOutput)(r.s.State[\"sourceDestCheck\"])\n}", "title": "" }, { "docid": "cd0b904cdc5e526e4afd016847983197", "score": "0.5036655", "text": "func LoadSources(format string, src []byte, more ...[]byte) error {\n\treturn dc.LoadSources(format, src, more...)\n}", "title": "" }, { "docid": "03e1daba3f1c3a4605b8cc839cb4e645", "score": "0.5024169", "text": "func (v Newsfeed) GetSuggestedSources(params NewsfeedGetSuggestedSourcesParams) (*NewsfeedGetSuggestedSourcesResponse, error) {\n\tr, err := v.API.Request(\"newsfeed.getSuggestedSources\", params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp NewsfeedGetSuggestedSourcesResponse\n\terr = json.Unmarshal(r, &resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "feff9219c4f72d03baa88787b1746c3a", "score": "0.50221837", "text": "func (o *EquipmentPsu) GetPsuInputSrcOk() (*string, bool) {\n\tif o == nil || o.PsuInputSrc == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PsuInputSrc, true\n}", "title": "" }, { "docid": "fea09800b4ce7bab8954198f31fe53f4", "score": "0.5018504", "text": "func (o *InlineObject1108) HasSourceData() bool {\n\tif o != nil && o.SourceData != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "19e6f7d8328c3d1d5d40772994441d19", "score": "0.5015297", "text": "func (resp *WAFevents) GetSourceCount(filter string) int {\n\tcount := 0\n\tfor _, v := range resp.Result {\n\t\tif v.Source == filter {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "01253e9b44d2b2789492bc8fe0d036c7", "score": "0.50016975", "text": "func (ld LockedProjectPropertiesDelta) SourceChanged() bool {\n\treturn ld.SourceBefore != ld.SourceAfter\n}", "title": "" }, { "docid": "754205e848c53724e065649408a7b07c", "score": "0.4977339", "text": "func (o *WorkspaceLinks) GetSnippetsOk() (*Link, bool) {\n\tif o == nil || o.Snippets == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Snippets, true\n}", "title": "" }, { "docid": "d0f2be7017e2b8499e5b1b98f9e3fc3d", "score": "0.49760795", "text": "func (o *Endpoint) HasSourceId() bool {\n\tif o != nil && o.SourceId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bb966c46abf7284dab09cdd2c5b14d6e", "score": "0.49617764", "text": "func CountSources() int64 {\n\tcount, _ := db.GetEngine(db.DefaultContext).Count(new(Source))\n\treturn count\n}", "title": "" }, { "docid": "2e43a85a4d0fc48a20f69c87a7bc002a", "score": "0.494551", "text": "func (o *StackEvent) SetSources(v []string) {\n\to.Sources = v\n}", "title": "" }, { "docid": "fa0d328129783884df39c1d80f99d26d", "score": "0.49346995", "text": "func HasUrlAliasViaSource(iSource string) bool {\n\tif has, err := Engine.Where(\"source = ?\", iSource).Get(new(UrlAlias)); err != nil {\n\t\treturn false\n\t} else {\n\t\tif has {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "7203dc51a27b39da1cf014096998670f", "score": "0.49253976", "text": "func (c *Client) ExpectLoadedSourcesResponse(t *testing.T) *dap.LoadedSourcesResponse {\n\tt.Helper()\n\tm := c.ExpectMessage(t)\n\tr, ok := m.(*dap.LoadedSourcesResponse)\n\tif !ok {\n\t\tt.Fatalf(\"got %#v, want *dap.LoadedSourcesResponse\", m)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "ed82e666181321c58f5fb0777adce849", "score": "0.49132738", "text": "func (c *Client) ListSources(ctx context.Context, req *vmmigrationpb.ListSourcesRequest, opts ...gax.CallOption) *SourceIterator {\n\treturn c.internalClient.ListSources(ctx, req, opts...)\n}", "title": "" }, { "docid": "954e08f21b6857367427d010736653e8", "score": "0.49105814", "text": "func getMapboxSourcesFromURL(sourcesURL string) ([]string, error) {\n\tallSources, err := getSourcesFromSourcesURL(sourcesURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmapboxSources := make([]string, 0)\n\tfor _, source := range allSources {\n\t\tsourceParts := strings.Split(source, \".\")\n\t\tif len(sourceParts) != 2 {\n\t\t\treturn nil, fmt.Errorf(\"Encountered invalid source in the source URL: %v\", source)\n\t\t}\n\t\tusername := sourceParts[0]\n\t\tif username == \"mapbox\" {\n\t\t\tmapboxSources = append(mapboxSources, source)\n\t\t}\n\t}\n\n\treturn mapboxSources, nil\n}", "title": "" } ]
8f94d15351c149b4952e7f7c699a3884
SetPrice is a paid mutator transaction binding the contract method 0x91b7f5ed. Solidity: function setPrice(uint256 _price) returns()
[ { "docid": "e2f18ab63359b2e1c3bf122f78253192", "score": "0.74672717", "text": "func (_Subscribe *SubscribeTransactorSession) SetPrice(_price *big.Int) (*types.Transaction, error) {\n\treturn _Subscribe.Contract.SetPrice(&_Subscribe.TransactOpts, _price)\n}", "title": "" } ]
[ { "docid": "502066831ddf82fe8f901db81e858dc7", "score": "0.8115763", "text": "func (_Apr *AprTransactor) SetPrice(opts *bind.TransactOpts, _token common.Address, _price *big.Int) (*types.Transaction, error) {\n\treturn _Apr.contract.Transact(opts, \"setPrice\", _token, _price)\n}", "title": "" }, { "docid": "d675d61b6a7f6d483237d24e65a81d31", "score": "0.8059143", "text": "func (_IOrders *IOrdersTransactor) SetPrice(opts *bind.TransactOpts, _market common.Address, _outcome *big.Int, _price *big.Int) (*types.Transaction, error) {\n\treturn _IOrders.contract.Transact(opts, \"setPrice\", _market, _outcome, _price)\n}", "title": "" }, { "docid": "941813b8a12e420bff29af43d7a5af45", "score": "0.7962054", "text": "func (_Subscribe *SubscribeTransactor) SetPrice(opts *bind.TransactOpts, _price *big.Int) (*types.Transaction, error) {\n\treturn _Subscribe.contract.Transact(opts, \"setPrice\", _price)\n}", "title": "" }, { "docid": "b392684b4a23c1fee9fda03f62d6c669", "score": "0.7907126", "text": "func (pu *PaymentUpdate) SetPrice(f float64) *PaymentUpdate {\n\tpu.mutation.ResetPrice()\n\tpu.mutation.SetPrice(f)\n\treturn pu\n}", "title": "" }, { "docid": "f0ece9ed4dcbf91ed1c77e90938a6dfc", "score": "0.78615737", "text": "func (puo *PaymentUpdateOne) SetPrice(f float64) *PaymentUpdateOne {\n\tpuo.mutation.ResetPrice()\n\tpuo.mutation.SetPrice(f)\n\treturn puo\n}", "title": "" }, { "docid": "9118e9f144239468f1b62cf269cc1f85", "score": "0.7811531", "text": "func (_PriceOracleContract *PriceOracleContractTransactor) SetPrice(opts *bind.TransactOpts, _cryptoAmount *big.Int, _fiatAmount *big.Int) (*types.Transaction, error) {\n\treturn _PriceOracleContract.contract.Transact(opts, \"setPrice\", _cryptoAmount, _fiatAmount)\n}", "title": "" }, { "docid": "0ece856b628c6641be7b3b4b58718525", "score": "0.7645776", "text": "func (_Apr *AprTransactorSession) SetPrice(_token common.Address, _price *big.Int) (*types.Transaction, error) {\n\treturn _Apr.Contract.SetPrice(&_Apr.TransactOpts, _token, _price)\n}", "title": "" }, { "docid": "0e4d9af0538882b7ddac9cb49ca6f3f9", "score": "0.7607171", "text": "func (w *World) SetPrice(int64) {\n\n}", "title": "" }, { "docid": "8bd34dac85f30563945633ce0244cff6", "score": "0.7580896", "text": "func (giuo *GroceryItemUpdateOne) SetPrice(f float64) *GroceryItemUpdateOne {\n\tgiuo.mutation.ResetPrice()\n\tgiuo.mutation.SetPrice(f)\n\treturn giuo\n}", "title": "" }, { "docid": "a2f3535bc86a371107645e7a61d1a94a", "score": "0.75571764", "text": "func (_IOrders *IOrdersTransactorSession) SetPrice(_market common.Address, _outcome *big.Int, _price *big.Int) (*types.Transaction, error) {\n\treturn _IOrders.Contract.SetPrice(&_IOrders.TransactOpts, _market, _outcome, _price)\n}", "title": "" }, { "docid": "f9f220d289b9f52909c8ac7578b0a3c8", "score": "0.75235635", "text": "func (giu *GroceryItemUpdate) SetPrice(f float64) *GroceryItemUpdate {\n\tgiu.mutation.ResetPrice()\n\tgiu.mutation.SetPrice(f)\n\treturn giu\n}", "title": "" }, { "docid": "f8e7be9930adb51d678d94319ca49a3d", "score": "0.75134933", "text": "func (buo *BeerUpdateOne) SetPrice(i int64) *BeerUpdateOne {\n\tbuo.mutation.ResetPrice()\n\tbuo.mutation.SetPrice(i)\n\treturn buo\n}", "title": "" }, { "docid": "97bc5a5df1ec76181b343336ecc2f7be", "score": "0.7454937", "text": "func (_Apr *AprSession) SetPrice(_token common.Address, _price *big.Int) (*types.Transaction, error) {\n\treturn _Apr.Contract.SetPrice(&_Apr.TransactOpts, _token, _price)\n}", "title": "" }, { "docid": "114d0ff62fb50197a4c2213a16afd6bd", "score": "0.74492437", "text": "func (drc *DataRoomCreate) SetPrice(f float64) *DataRoomCreate {\n\tdrc.mutation.SetPrice(f)\n\treturn drc\n}", "title": "" }, { "docid": "4519083d47262bad6fe15b4686f353b5", "score": "0.7446293", "text": "func (bu *BeerUpdate) SetPrice(i int64) *BeerUpdate {\n\tbu.mutation.ResetPrice()\n\tbu.mutation.SetPrice(i)\n\treturn bu\n}", "title": "" }, { "docid": "67e12e765d6e719b42f5b0550db761fc", "score": "0.73099023", "text": "func (k Keeper) SetPrice(ctx sdk.Context, name string, price sdk.Coins) {\n\tstore := ctx.KVStore(k.pricesStoreKey)\n\tstore.Set([]byte(name), k.cdc.MustMarshalBinary(price))\n}", "title": "" }, { "docid": "a33b46b4993201b1ad2a3c1ea56745ba", "score": "0.72886044", "text": "func (_IOrders *IOrdersSession) SetPrice(_market common.Address, _outcome *big.Int, _price *big.Int) (*types.Transaction, error) {\n\treturn _IOrders.Contract.SetPrice(&_IOrders.TransactOpts, _market, _outcome, _price)\n}", "title": "" }, { "docid": "b3425f328dcc1601bec3921211fa6c0a", "score": "0.7286845", "text": "func (_PriceOracleContract *PriceOracleContractTransactorSession) SetPrice(_cryptoAmount *big.Int, _fiatAmount *big.Int) (*types.Transaction, error) {\n\treturn _PriceOracleContract.Contract.SetPrice(&_PriceOracleContract.TransactOpts, _cryptoAmount, _fiatAmount)\n}", "title": "" }, { "docid": "53e989058222eca2bafd9c340d61df3c", "score": "0.727157", "text": "func (m *ResourceMutation) SetPrice(i int) {\n\tm.price = &i\n\tm.addprice = nil\n}", "title": "" }, { "docid": "96c69fb9cf135c5267916e8f412f5a29", "score": "0.72327757", "text": "func (_Subscribe *SubscribeSession) SetPrice(_price *big.Int) (*types.Transaction, error) {\n\treturn _Subscribe.Contract.SetPrice(&_Subscribe.TransactOpts, _price)\n}", "title": "" }, { "docid": "3bd0ac677f457a66bc42d9dd45889f27", "score": "0.7215664", "text": "func (k Keeper) SetPrice(ctx sdk.Context, name string, price sdk.Coins) {\n\twhois := k.GetWhois(ctx, name)\n\twhois.Price = price\n\tk.SetWhois(ctx, name, whois)\n}", "title": "" }, { "docid": "88ccc414fe2c5d9972c0bd9c9cd20c0e", "score": "0.7133987", "text": "func (m *OrderMutation) SetPrice(i int) {\n\tm.price = &i\n\tm.addprice = nil\n}", "title": "" }, { "docid": "4956b149bf406d8eebca5bdb53589d96", "score": "0.7117451", "text": "func (m *MedicineMutation) SetPrice(i int) {\n\tm.price = &i\n\tm.addprice = nil\n}", "title": "" }, { "docid": "80cf74ec379a6e74a2f1a137182de4a5", "score": "0.7117111", "text": "func (_PriceOracleContract *PriceOracleContractSession) SetPrice(_cryptoAmount *big.Int, _fiatAmount *big.Int) (*types.Transaction, error) {\n\treturn _PriceOracleContract.Contract.SetPrice(&_PriceOracleContract.TransactOpts, _cryptoAmount, _fiatAmount)\n}", "title": "" }, { "docid": "d9cea3cf32ae295772d581de5410c83f", "score": "0.6632341", "text": "func (contract *TokenTemplet) SetGasPrice(value uint64) (smcError smc.Error) {\n\n\tsender := contract.Sender()\n\towner := contract.Owner()\n\t// Only token's owner can perform\n\tif sender.Address() != owner.Address() {\n\t\tsmcError.ErrorCode = bcerrors.ErrCodeInterContractsNoAuthorization\n\t\treturn\n\t}\n\t// Token's gas price could not be smaller than GasBasePrice\n\t// and up to Max_Gas_Price (1E9 cong)\n\tif value < contract.GasBasePrice() || value > smc.Max_Gas_Price {\n\t\tsmcError.ErrorCode = bcerrors.ErrCodeInterContractsInvalidGasPrice\n\t\treturn\n\t}\n\t//Set token's gas price\n\ttoken := contract.Token()\n\treturn token.SetGasPrice(value)\n}", "title": "" }, { "docid": "4c59b396bbac7cf030d94404e6ccd4f6", "score": "0.66131806", "text": "func (_PMintyMultiSale *PMintyMultiSaleCallerSession) Price(token common.Address, tokenId *big.Int, offerId *big.Int) (*big.Int, error) {\n\treturn _PMintyMultiSale.Contract.Price(&_PMintyMultiSale.CallOpts, token, tokenId, offerId)\n}", "title": "" }, { "docid": "ea4fbf002b81538f48bd8b496bb16c09", "score": "0.6588143", "text": "func (m NoStrikes) SetPrice(value decimal.Decimal, scale int32) {\n\tm.Set(field.NewPrice(value, scale))\n}", "title": "" }, { "docid": "c9759ed8400ce0642e363c7c28e1d69f", "score": "0.65879303", "text": "func (h *StorageHost) setContractPrice(val common.BigInt) error {\n\th.lock.Lock()\n\tdefer h.lock.Unlock()\n\n\th.config.ContractPrice = val\n\treturn h.syncConfig()\n}", "title": "" }, { "docid": "4bdd5a7af7d8fe6202ff41a13b6db8ef", "score": "0.65876055", "text": "func (_Pricing *PricingTransactor) SetBasePrice(opts *bind.TransactOpts, tokens []common.Address, baseBuy []*big.Int, baseSell []*big.Int, buy [][14]byte, sell [][14]byte, blockNumber *big.Int, indices []*big.Int) (*types.Transaction, error) {\n\treturn _Pricing.contract.Transact(opts, \"setBasePrice\", tokens, baseBuy, baseSell, buy, sell, blockNumber, indices)\n}", "title": "" }, { "docid": "a6ae9313055044f6136462a1948d7631", "score": "0.65610754", "text": "func (_PMintyMultiSale *PMintyMultiSaleSession) Price(token common.Address, tokenId *big.Int, offerId *big.Int) (*big.Int, error) {\n\treturn _PMintyMultiSale.Contract.Price(&_PMintyMultiSale.CallOpts, token, tokenId, offerId)\n}", "title": "" }, { "docid": "5997065427c69c4894b7c0f475daed22", "score": "0.6502692", "text": "func (b *book) changePrice(p float64) {\n\tb.price = p\n}", "title": "" }, { "docid": "ad8b90e4c9c46b04a845eae70d84de37", "score": "0.65019524", "text": "func (srv *server) Price(ctx context.Context, in *pb.PriceRequest) (*pb.PriceResponse, error) {\n\ttcpReqs.WithLabelValues(\"PriceRequest\").Add(1)\n\n\tvar (\n\t\tmult = int(putCallMap[strings.ToLower(in.Contract.Putcall)])\n\t\ts = in.Marketdata.Spot.Index.Value\n\t\tv = in.Marketdata.Vol.Index.Value\n\t\tr = in.Marketdata.Rate.Index.Value\n\t\tk = in.Contract.Strike\n\t\tp = quantlib.EuropeanFlatVol(\n\t\t\ts,\n\t\t\tr,\n\t\t\t0,\n\t\t\tv,\n\t\t\tk,\n\t\t\tint(in.Pricingdate),\n\t\t\tint(in.Contract.Expiry),\n\t\t\tmult)\n\t)\n\treturn &pb.PriceResponse{\n\t\tPrice: p,\n\t}, nil\n}", "title": "" }, { "docid": "eddb6b6d84a300bb20c0a537c469a7e9", "score": "0.64461666", "text": "func (_PMintyMultiSale *PMintyMultiSaleCaller) Price(opts *bind.CallOpts, token common.Address, tokenId *big.Int, offerId *big.Int) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _PMintyMultiSale.contract.Call(opts, &out, \"price\", token, tokenId, offerId)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "133fcab93b96ce41c24fe66173f943ab", "score": "0.6430822", "text": "func (srv *server) Price(ctx context.Context, in *pb.PriceRequest) (*pb.PriceResponse, error) {\n\ttcpReqs.WithLabelValues(\"PriceRequest\").Add(1)\n\n\tvar (\n\t\tmult = putCallMap[strings.ToLower(in.Contract.Putcall)]\n\n\t\ts = in.Marketdata.Spot.Index.Value\n\t\tv = in.Marketdata.Vol.Index.Value\n\t\tr = in.Marketdata.Rate.Index.Value\n\t\tk = in.Contract.Strike\n\t\tt = time.Unix(int64(in.Contract.Expiry), 0).Sub(\n\t\t\ttime.Unix(int64(in.Pricingdate), 0)).Hours() / 24.0 / 365.250\n\t\tbs = bs(s, v, r, k, t, mult)\n\t)\n\n\treturn &pb.PriceResponse{\n\t\tPrice: bs,\n\t}, nil\n}", "title": "" }, { "docid": "a50f65f147b39bd38a35388f441d83a1", "score": "0.63149005", "text": "func (_Pricing *PricingTransactorSession) SetBasePrice(tokens []common.Address, baseBuy []*big.Int, baseSell []*big.Int, buy [][14]byte, sell [][14]byte, blockNumber *big.Int, indices []*big.Int) (*types.Transaction, error) {\n\treturn _Pricing.Contract.SetBasePrice(&_Pricing.TransactOpts, tokens, baseBuy, baseSell, buy, sell, blockNumber, indices)\n}", "title": "" }, { "docid": "b76c336cdeceba6f846a72b8999b8a57", "score": "0.6267312", "text": "func (puo *PaymentUpdateOne) AddPrice(f float64) *PaymentUpdateOne {\n\tpuo.mutation.AddPrice(f)\n\treturn puo\n}", "title": "" }, { "docid": "c1b8d8597f038abe163f2f0f65650178", "score": "0.62333083", "text": "func (_Pricing *PricingSession) SetBasePrice(tokens []common.Address, baseBuy []*big.Int, baseSell []*big.Int, buy [][14]byte, sell [][14]byte, blockNumber *big.Int, indices []*big.Int) (*types.Transaction, error) {\n\treturn _Pricing.Contract.SetBasePrice(&_Pricing.TransactOpts, tokens, baseBuy, baseSell, buy, sell, blockNumber, indices)\n}", "title": "" }, { "docid": "aa88bd270573c53bc5edf77da1647ab5", "score": "0.6142239", "text": "func (sp *serviceProvider) ModifyPrice(conn orm.Connection, id uint32, price, salePrice float32) error {\n\tdb := conn.(*gorm.DB).Exec(\"USE shop\")\n\tres := db.Table(\"ware\").Where(\"id = ?\", id).Updates(Ware{Price: price, SalePrice: salePrice})\n\n\treturn res.Error\n}", "title": "" }, { "docid": "22d58211e5d56ae22da48fc800f58b37", "score": "0.6129813", "text": "func (pu *PaymentUpdate) AddPrice(f float64) *PaymentUpdate {\n\tpu.mutation.AddPrice(f)\n\treturn pu\n}", "title": "" }, { "docid": "3153bc33ecc5e2ebe54edf4defc3c46f", "score": "0.61269575", "text": "func (puo *ProductUpdateOne) SetNetPrice(i int) *ProductUpdateOne {\n\tpuo.mutation.ResetNetPrice()\n\tpuo.mutation.SetNetPrice(i)\n\treturn puo\n}", "title": "" }, { "docid": "73aa71d852b2cc50d733f9a1bc57a74a", "score": "0.60854405", "text": "func (self *DGXReserve) SetPriceFeed(gasPrice *big.Int, blockNumber *big.Int, nonce *big.Int, ask1KDigix *big.Int, bid1KDigix *big.Int, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) {\n\topts, err := self.GetTxOpts(PRICING_OP, nil, gasPrice, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\ttimeout, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n\t\tdefer cancel()\n\t\ttx, err := self.BuildTx(timeout, opts, self.reserve, \"setPriceFeed\", blockNumber, nonce, ask1KDigix, bid1KDigix, v, r, s)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\treturn self.SignAndBroadcast(tx, PRICING_OP)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f501129f9c591bdeaeff7f6371dcebd1", "score": "0.60784274", "text": "func (_Booking *BookingTransactor) UpdatePrice(opts *bind.TransactOpts, _pricePerMinute *big.Int) (*types.Transaction, error) {\n\treturn _Booking.contract.Transact(opts, \"updatePrice\", _pricePerMinute)\n}", "title": "" }, { "docid": "5e3629cddd87578855284abf067553dc", "score": "0.6057441", "text": "func (pu *ProductUpdate) SetNetPrice(i int) *ProductUpdate {\n\tpu.mutation.ResetNetPrice()\n\tpu.mutation.SetNetPrice(i)\n\treturn pu\n}", "title": "" }, { "docid": "ce3691a836b0372396d1c99275c3a8e5", "score": "0.60503775", "text": "func (_Subscribe *SubscribeCaller) Price(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Subscribe.contract.Call(opts, out, \"price\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "fb862969c0665216a91386e0b205203a", "score": "0.60450786", "text": "func (o *StrikethroughChangedItem) SetPrice(v float32) {\n\to.Price = v\n}", "title": "" }, { "docid": "f3afd00f63690a2658e50d4e693348a4", "score": "0.6043853", "text": "func (buo *BeerUpdateOne) AddPrice(i int64) *BeerUpdateOne {\n\tbuo.mutation.AddPrice(i)\n\treturn buo\n}", "title": "" }, { "docid": "6a34c764e095e2c3f7a9fcf865c9f7b7", "score": "0.60418355", "text": "func (h *StorageHost) setStoragePrice(val common.BigInt) error {\n\th.lock.Lock()\n\tdefer h.lock.Unlock()\n\n\th.config.StoragePrice = val\n\treturn h.syncConfig()\n}", "title": "" }, { "docid": "01eada98df2e918e99d6ea0d322ac247", "score": "0.6033022", "text": "func (_VehicleBooking *VehicleBookingTransactor) UpdatePrice(opts *bind.TransactOpts, _pricePerMinute *big.Int) (*types.Transaction, error) {\n\treturn _VehicleBooking.contract.Transact(opts, \"updatePrice\", _pricePerMinute)\n}", "title": "" }, { "docid": "f3f6ef0d3c9b62325a90fda13a0200c8", "score": "0.60248107", "text": "func (_Booking *BookingTransactorSession) UpdatePrice(_pricePerMinute *big.Int) (*types.Transaction, error) {\n\treturn _Booking.Contract.UpdatePrice(&_Booking.TransactOpts, _pricePerMinute)\n}", "title": "" }, { "docid": "a35f2f7a6a402d21460a9d3a266545e4", "score": "0.60040134", "text": "func (giuo *GroceryItemUpdateOne) AddPrice(f float64) *GroceryItemUpdateOne {\n\tgiuo.mutation.AddPrice(f)\n\treturn giuo\n}", "title": "" }, { "docid": "85ce418efd15d1e083abc500b0ed80dc", "score": "0.59766614", "text": "func (_VehicleBooking *VehicleBookingTransactorSession) UpdatePrice(_pricePerMinute *big.Int) (*types.Transaction, error) {\n\treturn _VehicleBooking.Contract.UpdatePrice(&_VehicleBooking.TransactOpts, _pricePerMinute)\n}", "title": "" }, { "docid": "26367073c716a841d4391b680276c9cb", "score": "0.59390557", "text": "func (m *MedicineMutation) AddPrice(i int) {\n\tif m.addprice != nil {\n\t\t*m.addprice += i\n\t} else {\n\t\tm.addprice = &i\n\t}\n}", "title": "" }, { "docid": "01562ffc8a248daedb7f35268e6c0364", "score": "0.5937945", "text": "func (m *MedicineMutation) ResetPrice() {\n\tm.price = nil\n\tm.addprice = nil\n}", "title": "" }, { "docid": "af970489ec61191e70141e97f24bfcef", "score": "0.59238327", "text": "func (h *StorageHost) setBaseRPCPrice(val common.BigInt) error {\n\th.lock.Lock()\n\tdefer h.lock.Unlock()\n\n\th.config.BaseRPCPrice = val\n\treturn h.syncConfig()\n}", "title": "" }, { "docid": "7f26f6fd71b6fcb462698aa660154610", "score": "0.5923275", "text": "func (_KVTableTest *KVTableTestSession) Set(id string, item_price *big.Int, item_name string) (*types.Transaction, *types.Receipt, error) {\n\treturn _KVTableTest.Contract.Set(&_KVTableTest.TransactOpts, id, item_price, item_name)\n}", "title": "" }, { "docid": "39ad5b90e0de175aed17a95f66ee2288", "score": "0.5917977", "text": "func (_VehicleBooking *VehicleBookingSession) UpdatePrice(_pricePerMinute *big.Int) (*types.Transaction, error) {\n\treturn _VehicleBooking.Contract.UpdatePrice(&_VehicleBooking.TransactOpts, _pricePerMinute)\n}", "title": "" }, { "docid": "dd4e815fc6ee077095a860044be53c63", "score": "0.5905788", "text": "func (m *ResourceMutation) AddPrice(i int) {\n\tif m.addprice != nil {\n\t\t*m.addprice += i\n\t} else {\n\t\tm.addprice = &i\n\t}\n}", "title": "" }, { "docid": "bdfa73a5b200e0aaf1671f84c843f6f0", "score": "0.59042054", "text": "func (m *OrderMutation) AddPrice(i int) {\n\tif m.addprice != nil {\n\t\t*m.addprice += i\n\t} else {\n\t\tm.addprice = &i\n\t}\n}", "title": "" }, { "docid": "9292cf04dfe6006f029d07a12d3ed9a1", "score": "0.5891657", "text": "func (m *ResourceMutation) ResetPrice() {\n\tm.price = nil\n\tm.addprice = nil\n}", "title": "" }, { "docid": "d1bdcca3ce004a2e327d804e8a55024e", "score": "0.58894646", "text": "func (_Booking *BookingSession) UpdatePrice(_pricePerMinute *big.Int) (*types.Transaction, error) {\n\treturn _Booking.Contract.UpdatePrice(&_Booking.TransactOpts, _pricePerMinute)\n}", "title": "" }, { "docid": "804b2ef55d044c691fad8d9e69b33054", "score": "0.58750796", "text": "func (b *Builder) SetGasPrice(p *big.Int) *Builder {\n\tif p == nil {\n\t\treturn b\n\t}\n\tb.act.gasPrice = &big.Int{}\n\tb.act.gasPrice.Set(p)\n\treturn b\n}", "title": "" }, { "docid": "2fa965584a22ffab1d2e1cb2e0f23761", "score": "0.5863915", "text": "func (giu *GroceryItemUpdate) AddPrice(f float64) *GroceryItemUpdate {\n\tgiu.mutation.AddPrice(f)\n\treturn giu\n}", "title": "" }, { "docid": "285185973ce288f63e6c34219a93a32c", "score": "0.5861989", "text": "func (bu *BeerUpdate) AddPrice(i int64) *BeerUpdate {\n\tbu.mutation.AddPrice(i)\n\treturn bu\n}", "title": "" }, { "docid": "ea232981280b1118f6f812fb3e245471", "score": "0.5842847", "text": "func (_KVTableTest *KVTableTestTransactorSession) Set(id string, item_price *big.Int, item_name string) (*types.Transaction, *types.Receipt, error) {\n\treturn _KVTableTest.Contract.Set(&_KVTableTest.TransactOpts, id, item_price, item_name)\n}", "title": "" }, { "docid": "9011444e02f78cb46d4959543fa31b3a", "score": "0.5829325", "text": "func (_KVTableTest *KVTableTestTransactor) Set(opts *bind.TransactOpts, id string, item_price *big.Int, item_name string) (*types.Transaction, *types.Receipt, error) {\n\treturn _KVTableTest.contract.Transact(opts, \"set\", id, item_price, item_name)\n}", "title": "" }, { "docid": "b043e55965cff96fbbadc882fabdf161", "score": "0.5818948", "text": "func TestOracleKeeper_SetPrice(t *testing.T) {\n\tt.Parallel()\n\n\tinput := NewTestInput(t)\n\tkeeper := input.keeper\n\tctx := input.ctx\n\theader := ctx.BlockHeader()\n\n\t// Set price by oracle 1\n\t{\n\t\t_, err := keeper.SetPrice(\n\t\t\tctx, input.addresses[0], input.stdAssetCode,\n\t\t\tsdk.NewInt(33000001),\n\t\t\tsdk.NewInt(33000000),\n\t\t\theader.Time)\n\t\trequire.NoError(t, err)\n\n\t\t// Get raw prices\n\t\trawPrices := keeper.GetRawPrices(ctx, input.stdAssetCode, header.Height)\n\t\trequire.Equal(t, len(rawPrices), 1)\n\t\trequire.Equal(t, rawPrices[0].AskPrice.Equal(sdk.NewInt(33000001)), true)\n\t\trequire.Equal(t, rawPrices[0].BidPrice.Equal(sdk.NewInt(33000000)), true)\n\t}\n\n\t// Set price by oracle 2\n\t{\n\t\t_, err := keeper.SetPrice(\n\t\t\tctx, input.addresses[1], input.stdAssetCode,\n\t\t\tsdk.NewInt(35000005),\n\t\t\tsdk.NewInt(35000000),\n\t\t\theader.Time)\n\t\trequire.NoError(t, err)\n\n\t\trawPrices := keeper.GetRawPrices(ctx, input.stdAssetCode, header.Height)\n\t\trequire.Equal(t, len(rawPrices), 2)\n\t\trequire.Equal(t, rawPrices[1].AskPrice.Equal(sdk.NewInt(35000005)), true)\n\t\trequire.Equal(t, rawPrices[1].BidPrice.Equal(sdk.NewInt(35000000)), true)\n\t}\n\n\t// Update Price by oracle 1\n\t{\n\t\t_, err := keeper.SetPrice(\n\t\t\tctx, input.addresses[0], input.stdAssetCode,\n\t\t\tsdk.NewInt(37000007),\n\t\t\tsdk.NewInt(37000000),\n\t\t\theader.Time)\n\t\trequire.NoError(t, err)\n\n\t\trawPrices := keeper.GetRawPrices(ctx, input.stdAssetCode, header.Height)\n\t\trequire.Equal(t, rawPrices[0].AskPrice.Equal(sdk.NewInt(37000007)), true)\n\t\trequire.Equal(t, rawPrices[0].BidPrice.Equal(sdk.NewInt(37000000)), true)\n\t}\n}", "title": "" }, { "docid": "328b2fd3919cf385fed9d7631cafaf66", "score": "0.5818805", "text": "func (_Bindings *BindingsTransactor) SetPriceOracle(opts *bind.TransactOpts, newOracle common.Address) (*types.Transaction, error) {\n\treturn _Bindings.contract.Transact(opts, \"_setPriceOracle\", newOracle)\n}", "title": "" }, { "docid": "f80f3792edce5f3dc72f210764383ac4", "score": "0.5802562", "text": "func (m *OrderMutation) ResetPrice() {\n\tm.price = nil\n\tm.addprice = nil\n}", "title": "" }, { "docid": "b848efa2cb3564f1aa37e995ea63b36c", "score": "0.5794195", "text": "func (_Subscribe *SubscribeCallerSession) Price() (*big.Int, error) {\n\treturn _Subscribe.Contract.Price(&_Subscribe.CallOpts)\n}", "title": "" }, { "docid": "11d563ed911c5827d49965881c97b7e8", "score": "0.5789975", "text": "func (o *PriceComponentDto) SetPrice(v float32) {\n\to.Price = v\n}", "title": "" }, { "docid": "166d90edf93ef11224735f5affcb74fb", "score": "0.5723357", "text": "func (s *PriceScheduleSpecification) SetPrice(v float64) *PriceScheduleSpecification {\n\ts.Price = &v\n\treturn s\n}", "title": "" }, { "docid": "53c7d4c7324a3c541839b508caac2d17", "score": "0.57143766", "text": "func (o *ZonePrice) SetPrice(v float64) {\n\to.Price = &v\n}", "title": "" }, { "docid": "ff851d60b7502b776351a8b2930484ff", "score": "0.56975985", "text": "func (self *ETHChain) SetGasPrice(newGasPrice *big.Int) {\n\tself.backend.SetGasPrice(newGasPrice)\n}", "title": "" }, { "docid": "169701d0651c2dc291c28858432ae280", "score": "0.56973493", "text": "func (s *PriceSchedule) SetPrice(v float64) *PriceSchedule {\n\ts.Price = &v\n\treturn s\n}", "title": "" }, { "docid": "8c0d60d6ba66ea49a7118a4520b55a3e", "score": "0.5618084", "text": "func (_Subscribe *SubscribeSession) Price() (*big.Int, error) {\n\treturn _Subscribe.Contract.Price(&_Subscribe.CallOpts)\n}", "title": "" }, { "docid": "ccffc83ad8f6bb44c29b36b47cdecf85", "score": "0.5613326", "text": "func agreeToPrice(ctx contractapi.TransactionContextInterface, assetID string, priceType string) error {\n\t// In this scenario, both buyer and seller are authoried to read/write private about transfer after seller agrees to sell.\n\tclientOrgID, err := getClientOrgID(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttransMap, err := ctx.GetStub().GetTransient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error getting transient: %v\", err)\n\t}\n\n\t// Asset price must be retrieved from the transient field as they are private\n\tprice, ok := transMap[\"asset_price\"]\n\tif !ok {\n\t\treturn fmt.Errorf(\"asset_price key not found in the transient map\")\n\t}\n\n\tcollection := buildCollectionName(clientOrgID)\n\n\t// Persist the agreed to price in a collection sub-namespace based on priceType key prefix,\n\t// to avoid collisions between private asset properties, sell price, and buy price\n\tassetPriceKey, err := ctx.GetStub().CreateCompositeKey(priceType, []string{assetID})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create composite key: %v\", err)\n\t}\n\n\t// The Price hash will be verified later, therefore always pass and persist price bytes as is,\n\t// so that there is no risk of nondeterministic marshaling.\n\terr = ctx.GetStub().PutPrivateData(collection, assetPriceKey, price)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to put asset bid: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "eb2bd2a3ba168d2f4772236ac080c14a", "score": "0.5606446", "text": "func (m *MedicineMutation) Price() (r int, exists bool) {\n\tv := m.price\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "42351d83cda209c14f15eafbc8b844de", "score": "0.55985624", "text": "func (h *StorageHost) setSectorAccessPrice(val common.BigInt) error {\n\th.lock.Lock()\n\tdefer h.lock.Unlock()\n\n\th.config.SectorAccessPrice = val\n\treturn h.syncConfig()\n}", "title": "" }, { "docid": "e604b855888df1dc8e3d2dd70417b3c3", "score": "0.558074", "text": "func (s *BucketBundle) SetPrice(v float64) *BucketBundle {\n\ts.Price = &v\n\treturn s\n}", "title": "" }, { "docid": "ed8dc3c83ab263816283a6159f544b19", "score": "0.5580418", "text": "func (m *ResourceMutation) Price() (r int, exists bool) {\n\tv := m.price\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "51f2713413c4568f1359fda1adcb6e08", "score": "0.5545145", "text": "func (s *Bundle) SetPrice(v float64) *Bundle {\n\ts.Price = &v\n\treturn s\n}", "title": "" }, { "docid": "958f7dd5aad76be89f66fbef0ed94246", "score": "0.55188656", "text": "func (_Bindings *BindingsSession) SetPriceOracle(newOracle common.Address) (*types.Transaction, error) {\n\treturn _Bindings.Contract.SetPriceOracle(&_Bindings.TransactOpts, newOracle)\n}", "title": "" }, { "docid": "9058edb06401189b1ec529c57e6e1555", "score": "0.5498552", "text": "func (_Bindings *BindingsTransactorSession) SetPriceOracle(newOracle common.Address) (*types.Transaction, error) {\n\treturn _Bindings.Contract.SetPriceOracle(&_Bindings.TransactOpts, newOracle)\n}", "title": "" }, { "docid": "2dadde9e793c7a285656df5d450db0ea", "score": "0.5488062", "text": "func (m *OrderMutation) Price() (r int, exists bool) {\n\tv := m.price\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "053f34958115a391f416bf3df13be0c2", "score": "0.5467513", "text": "func (giu *GroceryItemUpdate) ClearPrice() *GroceryItemUpdate {\n\tgiu.mutation.ClearPrice()\n\treturn giu\n}", "title": "" }, { "docid": "d144e3371c7942b7bff518ddbe0066da", "score": "0.54467165", "text": "func (s *RelationalDatabaseBundle) SetPrice(v float64) *RelationalDatabaseBundle {\n\ts.Price = &v\n\treturn s\n}", "title": "" }, { "docid": "cc5b350fe077d7e8acdb68725422855f", "score": "0.5446471", "text": "func Price(v float64) predicate.TradeRecord {\n\treturn predicate.TradeRecord(sql.FieldEQ(FieldPrice, v))\n}", "title": "" }, { "docid": "ff3fabe353a69715da2e9d7fd6378aac", "score": "0.5446295", "text": "func (giuo *GroceryItemUpdateOne) ClearPrice() *GroceryItemUpdateOne {\n\tgiuo.mutation.ClearPrice()\n\treturn giuo\n}", "title": "" }, { "docid": "1c0eede63b169b9054c89b02dc33d867", "score": "0.54321325", "text": "func (_m *MockWallet) SetCoin(coinType CoinType) {\n\t_m.Called(coinType)\n}", "title": "" }, { "docid": "c6264ddca9af82a5bb80fd05d8ffd4b3", "score": "0.5421109", "text": "func (s *ContainerServicePower) SetPrice(v float64) *ContainerServicePower {\n\ts.Price = &v\n\treturn s\n}", "title": "" }, { "docid": "95534693a335ff876a905ba7cce18a37", "score": "0.5418609", "text": "func (s *DistributionBundle) SetPrice(v float64) *DistributionBundle {\n\ts.Price = &v\n\treturn s\n}", "title": "" }, { "docid": "fca25f1f444e3f326ca2a5b00a208c0f", "score": "0.5395695", "text": "func (m NoStrikes) SetStrikePrice(value decimal.Decimal, scale int32) {\n\tm.Set(field.NewStrikePrice(value, scale))\n}", "title": "" }, { "docid": "2891276fa82fc490d65c8202ca50b25f", "score": "0.53908867", "text": "func (puo *ProductUpdateOne) SetSalePrice(i int) *ProductUpdateOne {\n\tpuo.mutation.ResetSalePrice()\n\tpuo.mutation.SetSalePrice(i)\n\treturn puo\n}", "title": "" }, { "docid": "93409cf28dbd28660807491c7cd0b9f1", "score": "0.53491336", "text": "func (p *Executes) ChangePrice() float64 {\n\tp.RLock()\n\tdefer p.RUnlock()\n\treturn p.Price - p.LastPrice\n}", "title": "" }, { "docid": "a0f6c7c0e4d111812f904e32b1a00047", "score": "0.5324827", "text": "func (o GoogleCloudRetailV2alphaPriceInfoOutput) Price() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v GoogleCloudRetailV2alphaPriceInfo) *float64 { return v.Price }).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "ee92084dd41dd2ca6016ef704c3f7908", "score": "0.5311655", "text": "func (pu *ProductUpdate) SetSalePrice(i int) *ProductUpdate {\n\tpu.mutation.ResetSalePrice()\n\tpu.mutation.SetSalePrice(i)\n\treturn pu\n}", "title": "" }, { "docid": "3a2f1d667d9e4265caa631e56ff8194e", "score": "0.5308066", "text": "func (o GoogleCloudRetailV2betaPriceInfoOutput) Price() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v GoogleCloudRetailV2betaPriceInfo) *float64 { return v.Price }).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "f2361825b74ab782a4265c21f6be4845", "score": "0.530651", "text": "func (m *ResourceMutation) SetBookingPrice(i int) {\n\tm.bookingPrice = &i\n\tm.addbookingPrice = nil\n}", "title": "" }, { "docid": "0670cd90f3480bd7e09422c9dc6ee651", "score": "0.53021663", "text": "func (ec *EquipmentCreate) SetEQUIPMENTPRICE(i int) *EquipmentCreate {\n\tec.mutation.SetEQUIPMENTPRICE(i)\n\treturn ec\n}", "title": "" }, { "docid": "270b6a437fe740c65340e7129ed19fe3", "score": "0.528117", "text": "func (m Message) Price() (*field.PriceField, quickfix.MessageRejectError) {\n\tf := &field.PriceField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" } ]
442af3dadc480b3c3ce08e441fef0d3c
GetConstraint returns the stringified scheduling constraint of that assignment.
[ { "docid": "ed418d66a8acb13530d271275be5978a", "score": "0.72435045", "text": "func (a *Assignment) GetConstraint() *peloton_api_v0_task.Constraint {\n\treturn a.GetTask().GetTask().GetConstraint()\n}", "title": "" } ]
[ { "docid": "b7aea59b2584a5a213d09de285ec22a8", "score": "0.61519825", "text": "func (a *Client) GetConstraint(params *GetConstraintParams) (*GetConstraintOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetConstraintParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getConstraint\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/v1/constraints/{id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetConstraintReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetConstraintOK), nil\n\n}", "title": "" }, { "docid": "456b0c08ec1dcfc0b7030f9b64a81475", "score": "0.60455954", "text": "func (m *Lease) GetAssignment() string {\r\n\tif m != nil {\r\n\t\treturn m.Assignment\r\n\t}\r\n\treturn \"\"\r\n}", "title": "" }, { "docid": "ea1587696bcd3a03a65d80943138c00a", "score": "0.5908825", "text": "func (o PolicyOutput) Constraint() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Policy) pulumi.StringOutput { return v.Constraint }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "aafbd8c5a2c108fde25628c17ceb9988", "score": "0.5627967", "text": "func (p *ConstraintProvider) Get(cluster *kubermaticv1.Cluster, name string) (*kubermaticv1.Constraint, error) {\n\n\tconstraint := &kubermaticv1.Constraint{}\n\tif err := p.clientPrivileged.Get(context.Background(), types.NamespacedName{Namespace: cluster.Status.NamespaceName, Name: name}, constraint); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn constraint, nil\n}", "title": "" }, { "docid": "bc89c1c626851b929ff35b623eb3d6d5", "score": "0.5491479", "text": "func (c *Client) getConstraint(ctx context.Context, constraint *unstructured.Unstructured) *Constraint {\n\tname := constraint.GetName()\n\tselfLink := constraint.GetSelfLink()\n\tuid := constraint.GetUID()\n\tconstraintKind := constraint.GetKind()\n\tspecJSON, err := getSpecAsJSON(constraint)\n\tif err != nil {\n\t\tc.log.Error(err, \"could not get constraint spec as JSON string\")\n\t}\n\tvar templateUID types.UID\n\tvar templateSelfLink string\n\tvar templateSpecJSON string\n\ttemplate, err := c.dynamicClient.GetConstraintTemplate(ctx, constraintKind)\n\tif err != nil {\n\t\tc.log.Error(err, \"could not get constraint template\", \"constraintKind\", constraintKind)\n\t} else {\n\t\ttemplateUID = template.GetUID()\n\t\ttemplateSelfLink = template.GetSelfLink()\n\t\ttemplateSpecJSON, err = getSpecAsJSON(template)\n\t\tif err != nil {\n\t\t\tc.log.Error(err, \"could not get constraint template spec as JSON string\")\n\t\t}\n\t}\n\tauditTimestamp, _, _ := unstructured.NestedString(constraint.UnstructuredContent(), \"status\", \"auditTimestamp\")\n\tauditTime, err := time.Parse(time.RFC3339, auditTimestamp)\n\tif err != nil {\n\t\tc.log.Error(err, \"could not parse auditTimestamp, using current time instead\", \"auditTimestamp\", auditTimestamp)\n\t\tauditTime = time.Now()\n\t}\n\treturn &Constraint{\n\t\tName: name,\n\t\tSelfLink: selfLink,\n\t\tUID: uid,\n\t\tKind: constraintKind,\n\t\tAuditTime: auditTime,\n\t\tSpecJSON: specJSON,\n\t\tTemplateUID: templateUID,\n\t\tTemplateSelfLink: templateSelfLink,\n\t\tTemplateSpecJSON: templateSpecJSON,\n\t}\n}", "title": "" }, { "docid": "43398fe88d30ddcfada91bfcfa05dec2", "score": "0.5451615", "text": "func (o *ReportSubscriptions) GetSchedule() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Schedule\n}", "title": "" }, { "docid": "6743630f5d6fee62bc87334835167f64", "score": "0.54464465", "text": "func (s ScheduledJob) GetSchedule() string {\n\treturn s.Schedule\n}", "title": "" }, { "docid": "4b8a51512e24d1eb01539759e6f297de", "score": "0.524762", "text": "func (b *BaseConfig) GetSchedule() string {\n\treturn b.Schedule\n}", "title": "" }, { "docid": "4dbbda3bbb6e89746ea2554d8b0a80d1", "score": "0.51781946", "text": "func (self *Constraint) GetOperator() string {\n\treturn self.operator\n}", "title": "" }, { "docid": "cbb8b68aedb5c8bbb0ec249771a7602b", "score": "0.51739955", "text": "func (o *InlineResponse20086) GetImpactSchedule() string {\n\tif o == nil || o.ImpactSchedule == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ImpactSchedule\n}", "title": "" }, { "docid": "3bc86412c9361d382c9c6cee08593164", "score": "0.5155639", "text": "func GetConstraint(\n\tgraph Graph,\n\tfuncDeps map[types.Entity]map[string]interface{}) ([]Constraint, map[types.Node]string, error) {\n\t// Remove unnecessary JOIN\n\t//\n\t// Assuming an entity E:Place->E1 has functional deps \"dcid\" that maps to C:Place->Col.id,\n\t// if we have the following link in the graph\n\t// \t\tC:Place->Col.id <---> dc/m1rl3k [1]\n\t// that means this entity has been fully resolved.\n\t// If the Place table does not have other links in the graph, then E:Place->E1 can be\n\t// replaced by dc/m1rl3k everywhere to remove the unnecessary JOIN.\n\t// Then can also remove link [1], so it is not used as an SQL condition.\n\tresolvedEntities, err := graph.getResolvedEntity(funcDeps)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tgraph.prune(resolvedEntities)\n\treturn graph.constructConstraint(funcDeps)\n}", "title": "" }, { "docid": "8e01a1b3d6930b616e949153e915016f", "score": "0.51527226", "text": "func (c FillConstraint) String() string {\n\treturn \"FillConstraint\"\n}", "title": "" }, { "docid": "cb479e5382658baa970a3f2fa8ed988d", "score": "0.5146555", "text": "func (sa *SchedulingApplication) GetSchedulingAllocationAsk(allocationKey string) *schedulingAllocationAsk {\n\tsa.RLock()\n\tdefer sa.RUnlock()\n\treturn sa.requests[allocationKey]\n}", "title": "" }, { "docid": "fe5dde716a6d4f01fed8b4b01809c4cf", "score": "0.5117435", "text": "func (self *Constraint) String() string {\n\treturn strings.Trim(self.operator+\" \"+self.version, \" \")\n}", "title": "" }, { "docid": "6bf83a81c156b7a0c5fda451c0c9080b", "score": "0.505911", "text": "func (m *Lease) GetInlineAssignment() *any.Any {\r\n\tif m != nil {\r\n\t\treturn m.InlineAssignment\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "9bf234ead102e57e0a9b008a877bff67", "score": "0.49952465", "text": "func GetAssignment(projectName string, taskIndex string,\n\tworkerId string) (Assignment, error) {\n\tassignment := Assignment{}\n\tsubmissionsPath := GetSatPath(projectName, taskIndex, workerId)\n\tkeys := storage.ListKeys(submissionsPath)\n\t// if any submissions exist, get the most recent one\n\tif len(keys) > 0 {\n\t\tfields, err := storage.Load(keys[len(keys)-1])\n\t\tif err != nil {\n\t\t\treturn Assignment{}, err\n\t\t}\n\t\terr = mapstructure.Decode(fields, &assignment)\n\t\tif err != nil {\n\t\t\tError.Println(err)\n\t\t}\n\t} else {\n\t\tassignmentPath := GetAssignmentPath(projectName, taskIndex, workerId)\n\t\tfields, err := storage.Load(assignmentPath)\n\t\tif err != nil {\n\t\t\treturn Assignment{}, err\n\t\t}\n\t\terr = mapstructure.Decode(fields, &assignment)\n\t\tif err != nil {\n\t\t\tError.Println(err)\n\t\t}\n\t}\n\t// Asssigns default value for BundleFile\n\t// Should get rid of this and separate bundleFiles in the future\n\tif assignment.Task.ProjectOptions.LabelType != \"tag\" {\n\t\tassignment.Task.ProjectOptions.BundleFile = \"image.js\"\n\t}\n\treturn assignment, nil\n}", "title": "" }, { "docid": "c7d1a3fde798f14ae9e76e9b373576c1", "score": "0.49938074", "text": "func (m *ScheduleInformation) GetScheduleId()(*string) {\n return m.scheduleId\n}", "title": "" }, { "docid": "37643e9d5ac52683612e60c2985b94b8", "score": "0.4969618", "text": "func (o *SoftwarerepositoryCategorySupportConstraint) GetConstraintId() string {\n\tif o == nil || o.ConstraintId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ConstraintId\n}", "title": "" }, { "docid": "1a79b6d099e6c8c7072fd13d6455c30f", "score": "0.4940626", "text": "func (c PixelConstraint) String() string {\n\treturn \"PixelConstraint\"\n}", "title": "" }, { "docid": "4f443378f00b3129f73d3e0ca3aee5ed", "score": "0.4933246", "text": "func (m *ScheduleInformation) GetScheduleId()(*string) {\n val, err := m.GetBackingStore().Get(\"scheduleId\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "3fcb8d64ef3128a136b7a2faba2f99fe", "score": "0.48486665", "text": "func (a *Server) GetConstraintReference(ctx context.Context, req *scdpb.GetConstraintReferenceRequest) (*scdpb.GetConstraintReferenceResponse, error) {\n\treturn nil, dsserr.BadRequest(\"not yet implemented\")\n}", "title": "" }, { "docid": "f0eeac8a3dd47287e4471c4ba67ac549", "score": "0.4825107", "text": "func (o *ProcessorConfigDTO) GetSchedulingStrategy() string {\n\tif o == nil || o.SchedulingStrategy == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.SchedulingStrategy\n}", "title": "" }, { "docid": "2a4595a0e040ccc5c02ea2b682e808f0", "score": "0.4817187", "text": "func (o RuleGroupRuleStatementAndStatementStatementByteMatchStatementOutput) PositionalConstraint() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementAndStatementStatementByteMatchStatement) string {\n\t\treturn v.PositionalConstraint\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a5e4a5d259c0afb29de2bd78e969b179", "score": "0.48126924", "text": "func (p *PlanRequest) GetInterval() string {\n\tif p == nil || p.Interval == nil {\n\t\treturn \"\"\n\t}\n\treturn *p.Interval\n}", "title": "" }, { "docid": "e103e01f0c34d336bc4a6e7739755628", "score": "0.47944233", "text": "func (o RuleGroupRuleStatementAndStatementStatementOrStatementStatementByteMatchStatementOutput) PositionalConstraint() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementAndStatementStatementOrStatementStatementByteMatchStatement) string {\n\t\treturn v.PositionalConstraint\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d27570c38926b5981c5211ba5e97c823", "score": "0.47854385", "text": "func (o RuleGroupRuleStatementAndStatementStatementNotStatementStatementByteMatchStatementOutput) PositionalConstraint() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementAndStatementStatementNotStatementStatementByteMatchStatement) string {\n\t\treturn v.PositionalConstraint\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "04788eb7b6a101369e01598305753a16", "score": "0.4778689", "text": "func (o *CreateCronjobParams) GetSchedule() CronJobSchedule {\n\tif o == nil || o.Schedule == nil {\n\t\tvar ret CronJobSchedule\n\t\treturn ret\n\t}\n\treturn *o.Schedule\n}", "title": "" }, { "docid": "6b75ad8a1fe0fbbcc275ca5bb5e3f873", "score": "0.47679216", "text": "func (o ScheduleSpecPtrOutput) Schedule() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ScheduleSpec) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Schedule\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3c5ff1cfd1c2c6f2c0859cfd092a355f", "score": "0.47659254", "text": "func (m *FindMeetingTimesPostRequestBody) GetTimeConstraint()(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TimeConstraintable) {\n return m.timeConstraint\n}", "title": "" }, { "docid": "27157e68dac4ba8faec475d7da273df9", "score": "0.4762168", "text": "func (o RuleGroupRuleStatementAndStatementStatementAndStatementStatementByteMatchStatementOutput) PositionalConstraint() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementAndStatementStatementAndStatementStatementByteMatchStatement) string {\n\t\treturn v.PositionalConstraint\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "57bce6c99f520f92276df633af44df6b", "score": "0.47473904", "text": "func (m *EntitlementManagementSchedule) GetRecurrence()(PatternedRecurrenceable) {\n return m.recurrence\n}", "title": "" }, { "docid": "d3b0880552f9fc8182c097e056ee3bb4", "score": "0.47435737", "text": "func (o *DAG) GetScheduleInterval() ScheduleInterval {\n\tif o == nil || o.ScheduleInterval.Get() == nil {\n\t\tvar ret ScheduleInterval\n\t\treturn ret\n\t}\n\treturn *o.ScheduleInterval.Get()\n}", "title": "" }, { "docid": "f9eb8eb8d9d3cdd17346fe067f01737d", "score": "0.47307643", "text": "func (o *HyperflexClusterBackupPolicyDeployment) GetReplicationSchedule() HyperflexReplicationSchedule {\n\tif o == nil || o.ReplicationSchedule.Get() == nil {\n\t\tvar ret HyperflexReplicationSchedule\n\t\treturn ret\n\t}\n\treturn *o.ReplicationSchedule.Get()\n}", "title": "" }, { "docid": "30f3490f6e0eebe2dfeeebca294d4cc8", "score": "0.47235626", "text": "func (o WebAclRuleStatementOrStatementStatementNotStatementStatementNotStatementStatementByteMatchStatementOutput) PositionalConstraint() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementOrStatementStatementNotStatementStatementNotStatementStatementByteMatchStatement) string {\n\t\treturn v.PositionalConstraint\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4e8d19519c55e5885de8569b2d3acef4", "score": "0.47110257", "text": "func (o WebAclRuleStatementOrStatementStatementNotStatementStatementOrStatementStatementByteMatchStatementOutput) PositionalConstraint() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementOrStatementStatementNotStatementStatementOrStatementStatementByteMatchStatement) string {\n\t\treturn v.PositionalConstraint\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "22aa37a0776a4d40aafe36fef36c37e2", "score": "0.4694612", "text": "func (s *SubaccountRequest) GetSettlementSchedule() string {\n\tif s == nil || s.SettlementSchedule == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.SettlementSchedule\n}", "title": "" }, { "docid": "f027697abc776a61ca4754f28a902595", "score": "0.4692434", "text": "func (m *Shift) GetSchedulingGroupId()(*string) {\n return m.schedulingGroupId\n}", "title": "" }, { "docid": "45095a47a4fd7659e3e6da12a54e8ae4", "score": "0.46917537", "text": "func (o RuleGroupRuleStatementAndStatementStatementByteMatchStatementPtrOutput) PositionalConstraint() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementAndStatementStatementByteMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.PositionalConstraint\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1687beb1aaa93ed3859fa210a3d3b43c", "score": "0.4687019", "text": "func (o *ProcessorConfigDTO) GetSchedulingPeriod() string {\n\tif o == nil || o.SchedulingPeriod == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.SchedulingPeriod\n}", "title": "" }, { "docid": "6b6c599135a88d43cfe3a13ed2158082", "score": "0.46867564", "text": "func (o SyncPropertiesPtrOutput) Schedule() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SyncProperties) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Schedule\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "14e235568612af1be19ac23ef23bef52", "score": "0.46859598", "text": "func GetAssignment(stub *shim.ChaincodeStub, function string, args []string) ([]byte, error) {\n\n\tvar err error\n\n\t// Check there is/are at least 1 Arguments provided as per the the struct - two are computed\n\tif len(args) < 2 {\n\t\tfmt.Println(\"GetAssignment(): Incorrect number of arguments. Expecting 2 args \")\n\t\tfmt.Println(\"GetAssignment(): ./peer chaincode query -l golang -n mycc -c '{\\\"Function\\\": \\\"GetAssignment\\\", \\\"Args\\\": [\\\"101\\\", \\\"200\\\"]}'\")\n\t\treturn nil, errors.New(\"GetAssignment(): Incorrect number of arguments. Expecting at least 1 \")\n\t}\n\n\t// Get the Objects and Display it\n\tAvalbytes, err := QueryLedger(stub, \"WorkerAssignmentTable\", args)\n\tif err != nil {\n\t\tfmt.Printf(\"GetAssignment() : Failed to Query Object \")\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Failed to get Object Data for \" + args[0] + \"\\\"}\"\n\t\treturn nil, errors.New(jsonResp)\n\t}\n\n\tif Avalbytes == nil {\n\t\tfmt.Printf(\"GetAssignment() : Incomplete Query Object \")\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Incomplete information about the key for \" + args[0] + \"\\\"}\"\n\t\treturn nil, errors.New(jsonResp)\n\t}\n\n\tfmt.Printf(\"GetAssignment() : Response : Successfull - \\n\")\n\treturn Avalbytes, nil\n}", "title": "" }, { "docid": "517ce243c1101db4f81aaf1e2e1b6038", "score": "0.46808708", "text": "func (o WebAclRuleStatementOrStatementStatementOrStatementStatementAndStatementStatementByteMatchStatementOutput) PositionalConstraint() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementOrStatementStatementOrStatementStatementAndStatementStatementByteMatchStatement) string {\n\t\treturn v.PositionalConstraint\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4a909e30904833f01fbba9ed71fd8580", "score": "0.46764463", "text": "func (s ScalingConstraints) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d56083704c3bb5532363023947f4188b", "score": "0.46678376", "text": "func (o WebAclRuleStatementOrStatementStatementNotStatementStatementByteMatchStatementOutput) PositionalConstraint() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementOrStatementStatementNotStatementStatementByteMatchStatement) string {\n\t\treturn v.PositionalConstraint\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a639860b4892ccfc930395e38a273c1d", "score": "0.46569112", "text": "func GetSchedule(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *ScheduleState, opts ...pulumi.ResourceOption) (*Schedule, error) {\n\tvar resource Schedule\n\terr := ctx.ReadResource(\"aws:autoscaling/schedule:Schedule\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "5f82dd48cbeada896c297ef2d6c28562", "score": "0.46565068", "text": "func (o RuleGroupRuleStatementAndStatementStatementOrStatementStatementByteMatchStatementPtrOutput) PositionalConstraint() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementAndStatementStatementOrStatementStatementByteMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.PositionalConstraint\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b3ee78a4ba6061973dff27615e65d178", "score": "0.46509075", "text": "func (a *Client) GetPublicConstraint(params *GetPublicConstraintParams) (*GetPublicConstraintOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetPublicConstraintParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getPublicConstraint\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/v1/constraints/account/{name}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetPublicConstraintReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetPublicConstraintOK), nil\n\n}", "title": "" }, { "docid": "71ec02003c9cb64b113e02e7849d51dd", "score": "0.46506968", "text": "func (assignment *DatabaseAccounts_SqlRoleAssignment_Spec_ARM) GetName() string {\n\treturn assignment.Name\n}", "title": "" }, { "docid": "f7df22821c02a58baa7657dcc0f062fa", "score": "0.46505338", "text": "func (o RuleGroupRuleStatementAndStatementStatementNotStatementStatementByteMatchStatementPtrOutput) PositionalConstraint() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementAndStatementStatementNotStatementStatementByteMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.PositionalConstraint\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ec1026e9cd7f7e8661d784a8ec8020c6", "score": "0.46228224", "text": "func (o RuleGroupRuleStatementAndStatementStatementAndStatementStatementByteMatchStatementPtrOutput) PositionalConstraint() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementAndStatementStatementAndStatementStatementByteMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.PositionalConstraint\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "56c132eec7e49c07b3c0382328e0708b", "score": "0.46020567", "text": "func (i Instance) GetSchedule() int {\n\treturn i.schedule\n}", "title": "" }, { "docid": "aaa107f69aa92c80bfa142d49bbf1ff8", "score": "0.4594442", "text": "func (o *SoftwarerepositoryCategorySupportConstraintAllOf) GetConstraintId() string {\n\tif o == nil || o.ConstraintId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ConstraintId\n}", "title": "" }, { "docid": "9a5cfcf9167874e6a3ea3500703f6239", "score": "0.45940673", "text": "func (m *Team) GetSchedule()(Scheduleable) {\n val, err := m.GetBackingStore().Get(\"schedule\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(Scheduleable)\n }\n return nil\n}", "title": "" }, { "docid": "5bcdcf160983334a6e132dffaaffb0af", "score": "0.45882016", "text": "func (o JobOutput) Scheduling() JobSchedulingPtrOutput {\n\treturn o.ApplyT(func(v *Job) JobSchedulingPtrOutput { return v.Scheduling }).(JobSchedulingPtrOutput)\n}", "title": "" }, { "docid": "b11cd2d909e255184f3f5f6dfd922d5a", "score": "0.45850417", "text": "func (o DeliveryConfigPtrOutput) DeliveryRequirement() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DeliveryConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DeliveryRequirement\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7b886690293b528d80fb088f9fbda793", "score": "0.4583293", "text": "func (assignment *RoleAssignment_Spec_ARM) GetName() string {\n\treturn assignment.Name\n}", "title": "" }, { "docid": "78b46efeb9431fbd90413fe5f470acf1", "score": "0.4581856", "text": "func GetSchedule(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *ScheduleState, opts ...pulumi.ResourceOption) (*Schedule, error) {\n\tvar resource Schedule\n\terr := ctx.ReadResource(\"aws:scheduler/schedule:Schedule\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "57cb3d01a66975c69725a5ecf839012d", "score": "0.45813826", "text": "func (s *Subaccount) GetSettlementSchedule() string {\n\tif s == nil || s.SettlementSchedule == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.SettlementSchedule\n}", "title": "" }, { "docid": "73a5f41c424b74e60212e03ec0fdc89c", "score": "0.45808092", "text": "func (s *SchedulerRule) GetPath() string {\n\treturn fmt.Sprintf(\"/api/objects/scheduler/rule/%s\", s.Reference)\n}", "title": "" }, { "docid": "eba1362718d973ddc3dccf9e85c5a947", "score": "0.4579886", "text": "func (m *PrivilegedAccessGroupAssignmentScheduleRequestsRequestBuilder) Get(ctx context.Context, requestConfiguration *PrivilegedAccessGroupAssignmentScheduleRequestsRequestBuilderGetRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedAccessGroupAssignmentScheduleRequestCollectionResponseable, error) {\n requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CreatePrivilegedAccessGroupAssignmentScheduleRequestCollectionResponseFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedAccessGroupAssignmentScheduleRequestCollectionResponseable), nil\n}", "title": "" }, { "docid": "f5bb8192f497e08d5d6d53e57ef119d2", "score": "0.457573", "text": "func (o SyncPropertiesOutput) Schedule() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SyncProperties) *string { return v.Schedule }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d0c557ee0cf34a34c7365daa74f04641", "score": "0.4573152", "text": "func (o ScheduleSpecOutput) Schedule() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ScheduleSpec) string { return v.Schedule }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "eb005142937a529c02be1e2d63aac21a", "score": "0.45685697", "text": "func (t *TransactionRequest) GetPlan() string {\n\tif t == nil || t.Plan == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Plan\n}", "title": "" }, { "docid": "9f06badb8339e18ea6f9a10f6bd732a4", "score": "0.45656887", "text": "func (a *Assignment) GetTask() *Task {\n\treturn a.Task\n}", "title": "" }, { "docid": "a4145f4becbde2c91ca5d4e662c868fa", "score": "0.45582777", "text": "func (p *Plan) GetInterval() string {\n\tif p == nil || p.Interval == nil {\n\t\treturn \"\"\n\t}\n\treturn *p.Interval\n}", "title": "" }, { "docid": "f7b5592a9fdae76ea5a379a6bcc68680", "score": "0.45565167", "text": "func (o DeliveryConfigOutput) DeliveryRequirement() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v DeliveryConfig) *string { return v.DeliveryRequirement }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ba9b8b5fdd807f9d5073b2c58f35b090", "score": "0.45341787", "text": "func (m *GovernanceRoleAssignment) GetSubjectId()(*string) {\n val, err := m.GetBackingStore().Get(\"subjectId\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "4e2c8f8806b403546bbf40f2b0533c37", "score": "0.45277077", "text": "func (o SyncPropertiesResponsePtrOutput) Schedule() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SyncPropertiesResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Schedule\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ea16785362248c8ece6244fe8720e9fb", "score": "0.45105866", "text": "func (s *Swift) GetRoutingBic() string {\n\tif s == nil || s.RoutingBic == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.RoutingBic\n}", "title": "" }, { "docid": "3fa8f1f0ecb225741265764a1980f864", "score": "0.4475275", "text": "func (api *CacophonyAPI) GetSchedule() ([]byte, error) {\n\treq, err := http.NewRequest(\"GET\", joinURL(api.serverURL, apiBasePath, \"schedules\"), nil)\n\treq.Header.Set(\"Authorization\", api.token)\n\t//client := new(http.Client)\n\n\tresp, err := api.httpClient.Do(req)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\tdefer resp.Body.Close()\n\n\treturn ioutil.ReadAll(resp.Body)\n}", "title": "" }, { "docid": "12f986b84397a23ed67a8bd72648c70e", "score": "0.4467573", "text": "func (r *ProjectsSnapshotSchedulePoliciesService) Get(name string) *ProjectsSnapshotSchedulePoliciesGetCall {\n\tc := &ProjectsSnapshotSchedulePoliciesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "title": "" }, { "docid": "6a36567c7a6013b97ea578de3bd980ba", "score": "0.4467521", "text": "func (o *DAG) GetSchedulerLock() bool {\n\tif o == nil || o.SchedulerLock.Get() == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.SchedulerLock.Get()\n}", "title": "" }, { "docid": "9160e1f71aa9c9f6c3c36d71b9af3ac4", "score": "0.44649598", "text": "func (o WebAclRuleStatementOrStatementStatementNotStatementStatementOrStatementStatementByteMatchStatementPtrOutput) PositionalConstraint() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementOrStatementStatementNotStatementStatementOrStatementStatementByteMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.PositionalConstraint\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b411dcdbc6ae27a3b7520dce927911d3", "score": "0.44599715", "text": "func (o WebAclRuleStatementOrStatementStatementNotStatementStatementNotStatementStatementByteMatchStatementPtrOutput) PositionalConstraint() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementOrStatementStatementNotStatementStatementNotStatementStatementByteMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.PositionalConstraint\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c9e1e6c9ffe99de90de1c851c2a2c633", "score": "0.44565195", "text": "func (s AutoTuneMaintenanceSchedule) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f0774a3c9bd13e9e474b0777392bc900", "score": "0.44533864", "text": "func (o WebAclRuleStatementOrStatementStatementNotStatementStatementByteMatchStatementPtrOutput) PositionalConstraint() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementOrStatementStatementNotStatementStatementByteMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.PositionalConstraint\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a2fc6d6f849cc744a3287b0604b75132", "score": "0.44391075", "text": "func (o WebAclRuleStatementOrStatementStatementOrStatementStatementAndStatementStatementByteMatchStatementPtrOutput) PositionalConstraint() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementOrStatementStatementOrStatementStatementAndStatementStatementByteMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.PositionalConstraint\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4193d35fb779b49c4ff214262f7e9d22", "score": "0.4438996", "text": "func (ds *DelaySchedule) String() string {\n\treturn fmt.Sprintf(\"%s %v %v\", StringScheduleDelay, ds.delay, ds.then)\n}", "title": "" }, { "docid": "94be31bdec35a38091fbcab5a052cff9", "score": "0.44365463", "text": "func (o *InlineResponse20015Tasks) GetPriority() string {\n\tif o == nil || o.Priority == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Priority\n}", "title": "" }, { "docid": "14183bbe402719377a62a543f5a380dd", "score": "0.44359395", "text": "func (ptr *RecChaint) String() string {\n\treturn r.recChaint.String()\n}", "title": "" }, { "docid": "30c5bf28913aa61f3ca0e93b6a7d5930", "score": "0.44235244", "text": "func (o VirtualMachineAssessmentPtrOutput) Schedule() VirtualMachineAssessmentSchedulePtrOutput {\n\treturn o.ApplyT(func(v *VirtualMachineAssessment) *VirtualMachineAssessmentSchedule {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Schedule\n\t}).(VirtualMachineAssessmentSchedulePtrOutput)\n}", "title": "" }, { "docid": "eb4e576cbabf3e139aa97f63878ef9ba", "score": "0.4414697", "text": "func (m *emailCampaign) Schedule() int32 {\n\treturn m.scheduleField\n}", "title": "" }, { "docid": "8a73761c484847c88600dd98092e7a1b", "score": "0.44139692", "text": "func (m Message) GetInstrmtAssignmentMethod(f *field.InstrmtAssignmentMethodField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "e6561d7970445c8d481a35b835e8dab9", "score": "0.44075274", "text": "func (cond *AllowedPatternsCondition) GetName() string {\n\treturn cond.Name\n}", "title": "" }, { "docid": "4eb21b3e21bc908bd72d73022832c558", "score": "0.4403768", "text": "func (m *FindMeetingTimesPostRequestBody) GetLocationConstraint()(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.LocationConstraintable) {\n return m.locationConstraint\n}", "title": "" }, { "docid": "cf42fecd4e8ca9a1a9d960f3a12cc7ac", "score": "0.43963778", "text": "func (o VirtualMachineAssessmentOutput) Schedule() VirtualMachineAssessmentSchedulePtrOutput {\n\treturn o.ApplyT(func(v VirtualMachineAssessment) *VirtualMachineAssessmentSchedule { return v.Schedule }).(VirtualMachineAssessmentSchedulePtrOutput)\n}", "title": "" }, { "docid": "06b893367c218b15303ebf88f9e7c27e", "score": "0.43923303", "text": "func (m *GovernanceRoleAssignment) GetSubject()(GovernanceSubjectable) {\n val, err := m.GetBackingStore().Get(\"subject\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(GovernanceSubjectable)\n }\n return nil\n}", "title": "" }, { "docid": "87556b3d0032d3f138d541ca1b8059f0", "score": "0.43897954", "text": "func GetSchedule(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *ScheduleState, opts ...pulumi.ResourceOption) (*Schedule, error) {\n\tvar resource Schedule\n\terr := ctx.ReadResource(\"azure-native:devtestlab:Schedule\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "469e8868b3fba65ea29e2e904d6cf5ef", "score": "0.43861914", "text": "func (req ScheduledRequest) ToString() string {\n\treturn fmt.Sprintf(\"id=%s effective_after=%s locking=%t\", req.ID, req.EffectiveAfter, req.Locking)\n}", "title": "" }, { "docid": "bed71c97e428502304c12e32fb2db4e7", "score": "0.4382214", "text": "func GetScopeAssignment(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *ScopeAssignmentState, opts ...pulumi.ResourceOption) (*ScopeAssignment, error) {\n\tvar resource ScopeAssignment\n\terr := ctx.ReadResource(\"azure-native:managednetwork:ScopeAssignment\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "e34301b5e5a4c00b6d153402bf6147cc", "score": "0.43769267", "text": "func (s *SubscriptionRequest) GetPlan() string {\n\tif s == nil || s.Plan == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.Plan\n}", "title": "" }, { "docid": "9789878c64b9a5c71ba7f1d859c606cc", "score": "0.4371432", "text": "func (rc *RouteConstraint) Get() *RouteConstraint {\n\treturn rc.methodConstraint(\"GET\")\n}", "title": "" }, { "docid": "9cb744ce20cf9a6fe473c3bf1d53506a", "score": "0.43686354", "text": "func (o ImagePipelineSchedulePtrOutput) ScheduleExpression() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ImagePipelineSchedule) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ScheduleExpression\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "eb2bfa875d153d0b2580f5f34bdfad64", "score": "0.4368571", "text": "func (o *SecurityGroupRule) GetName() *string {\n\tname := o.String()\n\treturn &name\n}", "title": "" }, { "docid": "b780a2229fae4f25f445093ff659df86", "score": "0.43682137", "text": "func GetApprovalSetting(cluster string, namespace string, objType string, objName string, containerName string) (string, error) {\n\n\tssmKey := prefix + \"/\" + cluster + \"/\" + namespace + \"/\" + objType + \"/\" + objName + \"/\" + containerName + \"/resourceSpec\"\n\n\t_, insightVersion, err := getParameterValue(ssmKey)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"unable to read approval setting\")\n\t}\n\n\t//Acquire approval setting\n\tapprovalSetting, err := getParameterLabel(ssmKey, insightVersion)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"unable to read approval setting\")\n\t}\n\n\treturn approvalSetting, nil\n\n}", "title": "" }, { "docid": "37369f2ae95e075121a34b50a1821c9c", "score": "0.4356688", "text": "func (m *GovernanceRoleAssignment) GetAssignmentState()(*string) {\n val, err := m.GetBackingStore().Get(\"assignmentState\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "6c5e8308feec65837c264e13ac915aba", "score": "0.43526623", "text": "func ConstraintExpr(expr string) { ctx.ConstraintExpr(expr) }", "title": "" }, { "docid": "4bf6a6af625c9f8fae4b56f8d65b48fa", "score": "0.4350489", "text": "func (s RoutingRule) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "45141a95a6552123468d2d5bcbdf4a6d", "score": "0.43480325", "text": "func GetPrimerSchedule(scheduleSpec string, warmupMinutes int, primerSchedule string) (string, error) {\n\tif primerSchedule != \"\" {\n\t\t// parse primer schedule\n\t\t_, err := cron.ParseStandard(primerSchedule)\n\t\tif err == nil {\n\t\t\treturn primerSchedule, err\n\t\t}\n\n\t\treturn \"\", fmt.Errorf(\"primerSchedule provided is invalid: %v\", err)\n\t}\n\n\t// no pre-defined primer schedule or couldn't parse it, creating it with warmup minutes instead\n\treturn CreatePrimerSchedule(scheduleSpec, warmupMinutes)\n}", "title": "" }, { "docid": "f8e227c144171bd8572a4677000487c6", "score": "0.43469495", "text": "func (a *Allocation) GetNamespace() string {\n\tif a == nil {\n\t\treturn \"\"\n\t}\n\treturn a.Namespace\n}", "title": "" } ]
d4fc4552d86f15c81dd29728388c7b59
Cause function returns cause value.
[ { "docid": "d73d0ab9277c4b488ac1834d11e4a35c", "score": "0.0", "text": "func (e TransactionHashValidationError) Cause() error { return e.cause }", "title": "" } ]
[ { "docid": "15613d56a0cb5447df0d92a5c6ca5271", "score": "0.80447143", "text": "func (c *causeT) Cause() error {\n\treturn c.cause\n}", "title": "" }, { "docid": "31acbf74b99ed5d3625c7b321b9d29e0", "score": "0.8029446", "text": "func (w *withCause) Cause() error {\n\treturn w.causer\n}", "title": "" }, { "docid": "b078240eae39c3a113ebfc8347ee816a", "score": "0.7936285", "text": "func Cause(err error) error {\n\tif cerr, ok := err.(Error); ok {\n\t\treturn cerr.Cause\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "523ab12ce572373d3e2961814c16ea30", "score": "0.78066576", "text": "func (e *Error) Cause() error {\n\tif e.isZero() {\n\t\treturn nil\n\t}\n\treturn e.cause\n}", "title": "" }, { "docid": "e50cc60ef1352e3617d14eec5ffd4e7f", "score": "0.7780144", "text": "func (e *Error) Cause() error {\n\tif e.Err == nil {\n\t\treturn errors.New(e.Detail)\n\t}\n\treturn e.Err\n}", "title": "" }, { "docid": "271630ae081ba45a62638402262c1690", "score": "0.7750088", "text": "func (e *EventBusError) Cause() error {\n\treturn e.Unwrap()\n}", "title": "" }, { "docid": "2dbd1eab9d26e4e7e451be54f3ac5906", "score": "0.77096707", "text": "func Cause(err error) error {\n\treturn errors.Cause(err)\n}", "title": "" }, { "docid": "2dbd1eab9d26e4e7e451be54f3ac5906", "score": "0.77096707", "text": "func Cause(err error) error {\n\treturn errors.Cause(err)\n}", "title": "" }, { "docid": "2dbd1eab9d26e4e7e451be54f3ac5906", "score": "0.77096707", "text": "func Cause(err error) error {\n\treturn errors.Cause(err)\n}", "title": "" }, { "docid": "c134a2913eea489e8e00e1e1b417a7b9", "score": "0.76989394", "text": "func Cause(err error) error {\n\tif u := errors.Unwrap(err); u != nil {\n\t\treturn u\n\t}\n\treturn err\n}", "title": "" }, { "docid": "fecb9f4a1a10b2db294a9e6e956688f4", "score": "0.7697077", "text": "func Cause(err error) error {\n\tvar diag error\n\tif err, ok := err.(Causer); ok {\n\t\tdiag = err.Cause()\n\t}\n\tif diag != nil {\n\t\treturn diag\n\t}\n\treturn err\n}", "title": "" }, { "docid": "de4cb967ea365d54f9249a4c1c716fb6", "score": "0.7693291", "text": "func Cause(e error) error {\n\tif e == nil {\n\t\treturn nil\n\t}\n\tif err, ok := e.(*Error); ok {\n\t\treturn err.stack[0].e\n\t}\n\treturn e\n}", "title": "" }, { "docid": "989129b36ed6e19487f1c5dd11877002", "score": "0.7673275", "text": "func (s *Error) Cause() error {\n\treturn s.err\n}", "title": "" }, { "docid": "55af2b8fcec418123c8aa44370aa84f1", "score": "0.7588349", "text": "func (e *ErrTimeout) Cause() error {\n\treturn e.cause\n}", "title": "" }, { "docid": "7bd95cc747a69dd5f22b0cb02c79a011", "score": "0.758138", "text": "func (e Error) Cause() error {\n\treturn e.cause\n}", "title": "" }, { "docid": "f98caa3d466b10cfc867b529f0d2d006", "score": "0.7494163", "text": "func (e wrappedError) Cause() error {\n\treturn e.inner\n}", "title": "" }, { "docid": "82e3077c380bf2dc68b63306349a1fea", "score": "0.74496055", "text": "func (e *customError) Cause() error {\n\treturn e.error\n}", "title": "" }, { "docid": "3a29fed872dce7733fa8c87d5d3e7311", "score": "0.7254088", "text": "func (a *attachT) Cause() error {\n\treturn a.cause\n}", "title": "" }, { "docid": "2cffa0265e68a2321303d2eeb04e77a4", "score": "0.7231953", "text": "func (e *ClientError) Cause() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "482fc4436d597af8a0c6e538e2eb64fb", "score": "0.7196624", "text": "func (e UserError) Cause() error {\n\treturn e.Inner\n}", "title": "" }, { "docid": "83539e18d91f61614c18dc40ddea0a28", "score": "0.7147589", "text": "func Cause(e error) Codes {\n\tif e == nil {\n\t\treturn OK\n\t}\n\tec, ok := errors.Cause(e).(Codes)\n\tif ok {\n\t\treturn ec\n\t}\n\treturn String(e.Error())\n}", "title": "" }, { "docid": "8710e0d889b2fa62ef43828fca8565da", "score": "0.71364725", "text": "func (s *StorageError) Cause() error {\n\treturn s.error\n}", "title": "" }, { "docid": "2baadfe2bca592fd0b0282ff0b6b42c5", "score": "0.7116992", "text": "func (t *MediaDownloadError) Cause() error {\n\treturn t.cause\n}", "title": "" }, { "docid": "6daee76d0794d945d36b45d9d37d1128", "score": "0.7110021", "text": "func Cause(err error) error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\tfor {\n\t\tinner, ok := err.(hasInnerError)\n\t\tif !ok || inner.Inner() == nil {\n\t\t\tbreak\n\t\t}\n\t\terr = inner.Inner()\n\t}\n\treturn err\n}", "title": "" }, { "docid": "c6d0494dacf59c1d125547440de16999", "score": "0.7107545", "text": "func Cause(e error) Codes {\n\tif e == nil {\n\t\treturn OK\n\t}\n\tec, ok := errors.Cause(e).(Codes)\n\tif ok {\n\t\treturn ec\n\t}\n\treturn UnknownErr\n}", "title": "" }, { "docid": "f3ce1ec14b4dd76f1c34eec8266c89ef", "score": "0.7082849", "text": "func (e *werror) Cause() error {\n\treturn e.cause\n}", "title": "" }, { "docid": "15ee3062f2e0637eb304abce95a5eeda", "score": "0.7040063", "text": "func (e AvalancheSpecificValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "eb0c55e48b2d2ca3abbbb1131e930289", "score": "0.7040032", "text": "func (e EntranceValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "9e7e3582aa27618443ea12ecf85d395e", "score": "0.702734", "text": "func (e StellarSpecificValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "470eccf488f0587408793dcc6157bee0", "score": "0.6995287", "text": "func (err *Error) Cause() error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\tloop := err\n\tfor loop != nil {\n\t\tif loop.error != nil {\n\t\t\tif e, ok := loop.error.(*Error); ok {\n\t\t\t\t// Internal Error struct.\n\t\t\t\tloop = e\n\t\t\t} else if e, ok := loop.error.(iCause); ok {\n\t\t\t\t// Other Error that implements ApiCause interface.\n\t\t\t\treturn e.Cause()\n\t\t\t} else {\n\t\t\t\treturn loop.error\n\t\t\t}\n\t\t} else {\n\t\t\t// return loop\n\t\t\t// To be compatible with Case of https://github.com/pkg/errors.\n\t\t\treturn errors.New(loop.text)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "470eccf488f0587408793dcc6157bee0", "score": "0.6995287", "text": "func (err *Error) Cause() error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\tloop := err\n\tfor loop != nil {\n\t\tif loop.error != nil {\n\t\t\tif e, ok := loop.error.(*Error); ok {\n\t\t\t\t// Internal Error struct.\n\t\t\t\tloop = e\n\t\t\t} else if e, ok := loop.error.(iCause); ok {\n\t\t\t\t// Other Error that implements ApiCause interface.\n\t\t\t\treturn e.Cause()\n\t\t\t} else {\n\t\t\t\treturn loop.error\n\t\t\t}\n\t\t} else {\n\t\t\t// return loop\n\t\t\t// To be compatible with Case of https://github.com/pkg/errors.\n\t\t\treturn errors.New(loop.text)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "16e4ccd70233801e59315c79f4013788", "score": "0.69872385", "text": "func Cause(err error) error {\n\tfor err != nil {\n\t\te, ok := err.(interface {\n\t\t\tUnwrap() error\n\t\t})\n\t\tif !ok {\n\t\t\treturn err\n\t\t}\n\t\terr = e.Unwrap()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f30485a759d3d9e2650d109d00e35a47", "score": "0.68893796", "text": "func (e UTXOValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "384f4784ba32ed3ea08ac7e3d2ab9dc1", "score": "0.68579143", "text": "func (e SentryCFValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "5c6fb469cc702294e08a81156d674a45", "score": "0.6857153", "text": "func (e ParseError) Cause() error { return e.err }", "title": "" }, { "docid": "765fdd501747d983b0118ec44917390c", "score": "0.6841827", "text": "func (e TronSpecificValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "757f6b3428dff32c362906dfb828b385", "score": "0.68320656", "text": "func (e BuildValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "f852e1f12c2bb7f30c1d9fe234849be2", "score": "0.683032", "text": "func (e OasysSpecificValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "469a2c9c685464b9626199f92a9755da", "score": "0.6827057", "text": "func (e AgentCFValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "49496d9e59a14d641e03f74397bb23d6", "score": "0.6800404", "text": "func (e PortError) Cause() error {\n\treturn e.causedBy\n}", "title": "" }, { "docid": "67ff1072e7c4c8244b2c3e26908af596", "score": "0.6773994", "text": "func (e FindNearestEntranceRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "1d466bd624a22abc4eb263c58016c208", "score": "0.676764", "text": "func (e CompensationFeeValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "ddb6ca1024d81de7d7e2536b31a95973", "score": "0.6759489", "text": "func (e GetEntranceRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "a3cf7d4e352946562ed6d8d1be373689", "score": "0.67550737", "text": "func (e IssueValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "9706fc51f57484d7127151a790eab078", "score": "0.6752794", "text": "func (e ExternalService_NetworkingValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "4d9ee760b5343ca976317082b7172a03", "score": "0.67447644", "text": "func (e AnimeResValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "3b7869c88898ebea001417c264b56c4b", "score": "0.6743903", "text": "func (e TransferVolumeValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "ffe9d0455e3af66762b56ca2e9ceb82b", "score": "0.67344904", "text": "func (e BitcoincashSpecificValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "eba04eb32fdd5181dea494fe11266012", "score": "0.6734431", "text": "func (e GetEventRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "db4f8b2c507510737b1755af9e4532af", "score": "0.67337537", "text": "func Cause(err error) error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\tfor err != nil {\n\t\tcause, ok := err.(xerrors.Wrapper)\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\terr = cause.Unwrap()\n\t}\n\treturn err\n}", "title": "" }, { "docid": "09c5bd6a24dd14c41029c9c1524c0796", "score": "0.6730707", "text": "func (e LoggingCFValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "b63033a1a75b219c20de201fd1595639", "score": "0.6730561", "text": "func (e ApiCFValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "813accc21ed9b8f57c9873b2bdada49e", "score": "0.67278224", "text": "func (e UncheckedTransferValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "abd65dee83b0655d628193671230e410", "score": "0.67125475", "text": "func (e HttpTargetValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "c409762fa5e1204dfbf88a9909c02d8b", "score": "0.67067266", "text": "func (e CosmosSpecificValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "b47ac24381848945155711ccefcf37a5", "score": "0.67046654", "text": "func (e C0BanSpecificValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "dea670e13a0f20ae878f2d2b274fbeb1", "score": "0.6690684", "text": "func (e ExternalServiceValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "02649399a6ef281253016bcc524f8a1f", "score": "0.6690272", "text": "func (e FaultPercentageValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "3e079bdbc63713616c8783371ec33658", "score": "0.66846067", "text": "func (e SubstrateSpecificValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "4f6030be385779e50021f874a961b59a", "score": "0.66824156", "text": "func (e HahaRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "8a1feb0012722c418d35cad5c74e169f", "score": "0.66820306", "text": "func (e GetOneRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "23be1ae4f7c9565035882ac9743a7f55", "score": "0.6681415", "text": "func (e TargetValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "7c0b1f1c01e0b70e3c3ac8954a0953de", "score": "0.6672101", "text": "func (e CardanoUTXOSpecificValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "4df1ba5e7ff0c532eee952144bcb9660", "score": "0.66678745", "text": "func (e TransactionValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "1e8115517e4132c0b949797edeb1a140", "score": "0.66662264", "text": "func CauseFrom(err error) error {\n\tif err != nil {\n\t\tif cause, ok := err.(causer); ok {\n\t\t\treturn cause.Cause()\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "40de6b10c9e5ebbcb76949a714167bf0", "score": "0.66647226", "text": "func (e CardanoSpecificValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "7328a767c771bc74c9a02d20fca086ad", "score": "0.6663542", "text": "func (e VacancyV1ValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "b1acb3e1b39b28075d5f3e96d7ceb1f0", "score": "0.66625595", "text": "func (e ResourceV1ValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "03e61628639dccd25de5c2c847a4ce2d", "score": "0.6654516", "text": "func (o AssessmentStatusOutput) Cause() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AssessmentStatus) *string { return v.Cause }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "77e1507921badcd0bbd7b3a193b099eb", "score": "0.6653803", "text": "func (e TransferValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "531df9ec20a3b5b1135c632aa7679e01", "score": "0.6651332", "text": "func (e SubmitBuildRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "edc22b077ba92320b7bc1539a6a9380f", "score": "0.66500455", "text": "func (e GrpcTargetValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "99ec702b65205e68ed30479858df6987", "score": "0.66494477", "text": "func (e SingleClusterValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "f398724d4d3800610cd9036c2d779e83", "score": "0.66420376", "text": "func (e UpdateEntranceRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "151e8acf835bb463f568e06426502d73", "score": "0.66401684", "text": "func (e SpawnRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "b433825bd4a2c385e6f193d5e8f9c7bd", "score": "0.66400635", "text": "func (e MonacoinSpecificValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "7a38585feb382a8871ce6d977b8e2d88", "score": "0.66399264", "text": "func (e CreateTransactionIOSTSpecificValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "5417a75c2c7175fb1802889fa2193fed", "score": "0.6634221", "text": "func (e EthereumSpecificValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "7af2d9b77ccf3c4f16b5b6fbc198e90b", "score": "0.6628551", "text": "func (e RedisTLSCFValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "59160509d0744b99ab1df3d604dda4c8", "score": "0.6626708", "text": "func (e HeaderValidatorConfig_UriPathNormalizationOptionsValidationError) Cause() error {\n\treturn e.cause\n}", "title": "" }, { "docid": "3759223a57d6014610ea81188d5492ea", "score": "0.661934", "text": "func (e EventTriggeredMessageValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "595f2061efe599b5b5ce7fc190b47bb3", "score": "0.6618749", "text": "func (e FindNearestEntranceResponseValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "5f38b511cbe5490ba1e68268a22d0ea0", "score": "0.6618417", "text": "func (e EventValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "5f38b511cbe5490ba1e68268a22d0ea0", "score": "0.6618417", "text": "func (e EventValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "b05af77bb49d7123974eee59c9868dc7", "score": "0.6615002", "text": "func (e EventRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "89d4d98df7312922230d739ffff93a1e", "score": "0.6614961", "text": "func (e ServerEventValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "cf38c6143e496b1d3f84f389ad97c7c1", "score": "0.66128385", "text": "func (e IOSTSpecificValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "4588f13c175a7efebd4c266342847570", "score": "0.66127384", "text": "func (e CreateEntranceRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "a60662c54b5dfbefddbea2e8456be1e7", "score": "0.66119754", "text": "func (e KaixinRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "29f8944beb7eee873a058ad2f593410b", "score": "0.66117555", "text": "func (e ResultValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "1a323556d43b098cb34da88b3df871ae", "score": "0.66102827", "text": "func (e Error) WithCause(err error) Error {\n\te.cause = err\n\treturn e\n}", "title": "" }, { "docid": "3c98bfdca0b0905f7e2152fc17dbbed9", "score": "0.6607901", "text": "func (e UploadRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "8a30f01e4edab0e2294ba261528dab00", "score": "0.6607245", "text": "func (e NemSpecificValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "9e436f17913169250e6a8743014ff075", "score": "0.6602521", "text": "func (e MaintemplateComponentValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "6c2d72b244403c6cadb74f3f93ddb294", "score": "0.66024876", "text": "func (e TransferCosmosSpecificValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "163afa57843a02e3d1ab1328ec46fd1b", "score": "0.6597549", "text": "func (e PrivateApiCFValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "a7f2c6f5e34652391d3ac42632a36a9c", "score": "0.65941656", "text": "func (o AssessmentStatusPtrOutput) Cause() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AssessmentStatus) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Cause\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c3b2fbf4ea61b8093545fc6be65f3cb8", "score": "0.6588304", "text": "func (e GetBuildRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "616436a478a9f119284716b2c56abba0", "score": "0.6581385", "text": "func (e AWSAccountValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "c8275bb449f5b2d745fdcc5f1c71cf8c", "score": "0.6579047", "text": "func (e RequestEventValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "ae289f45e342aaf15c22c2221ba59bbc", "score": "0.6578046", "text": "func (e BitcoinSpecificValidationError) Cause() error { return e.cause }", "title": "" } ]
658727b2eff88aa6d102d97869f9ac9d
String returns the string representation. API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".
[ { "docid": "692a601dc55180b0622b7a9f7016e213", "score": "0.0", "text": "func (s PutResolverRulePolicyOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
[ { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.6543435", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.6543435", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.6543435", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.6543435", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.6543435", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "947af2e687894d6d29a03e631290b565", "score": "0.6452586", "text": "func (s CognitoMemberDefinition) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d5612f7ba09e736647ac5e632243a30b", "score": "0.64330494", "text": "func (s BotMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "796d3da09122d3a6eda8d85cd2072b9e", "score": "0.6376112", "text": "func (s GetMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "844a81f1d0eca520ae47087c72a631f9", "score": "0.63566077", "text": "func (s OidcMemberDefinition) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d9ee2b223b7036b0844ac2370527fbfe", "score": "0.6332982", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Distribution Params:\n Community Tax: %s\n Withdraw Addr Enabled: %t`,\n\t\tp.CommunityTax, p.WithdrawAddrEnabled)\n}", "title": "" }, { "docid": "7810f5262bc9faa785879a38fa9b775d", "score": "0.6266981", "text": "func (s MemberDefinition) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7fdd9d07690703691d426379ec8d9a7a", "score": "0.6263708", "text": "func (s MemberFrameworkAttributes) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "74841839d2e20d32eda2604b690f38eb", "score": "0.6246281", "text": "func (s CreateMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "74841839d2e20d32eda2604b690f38eb", "score": "0.6246281", "text": "func (s CreateMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5c518cab9a26cf655d1488d854d900db", "score": "0.617619", "text": "func (s ApiCallDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1918ba7d7432948a4b58121035f828ce", "score": "0.6152862", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"ACLKey: %v\\n\", p.ACL))\n\tsb.WriteString(fmt.Sprintf(\"DAOOwnerKey: %s\\n\", p.DAOOwner))\n\tsb.WriteString(fmt.Sprintf(\"UpgradeKey: %v\\n\", p.Upgrade))\n\treturn sb.String()\n}", "title": "" }, { "docid": "1f8cd632fedb20ae2db50fc88345f4ca", "score": "0.6133323", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(\n\t\t\"TokenCourse: %d\\n\"+\n\t\t\t\"SubscriptionPrice: %d\\n\"+\n\t\t\t\"VPNGBPrice: %d\\n\"+\n\t\t\t\"StorageGBPrice: %d\\n\"+\n\t\t\t\"BaseVPNGb: %d\\n\"+\n\t\t\t\"BaseStorageGb: %d\\n\"+\n\t\t\t\"CouseChangeSigners: %v\\n\",\n\t\tp.TokenCourse,\n\t\tp.SubscriptionPrice,\n\t\tp.VPNGBPrice,\n\t\tp.StorageGBPrice,\n\t\tp.BaseVPNGb,\n\t\tp.BaseStorageGb,\n\t\tp.CourseChangeSigners,\n\t)\n}", "title": "" }, { "docid": "6fd9f1d4d485cf6d2559650a970dc32b", "score": "0.6121708", "text": "func (s UpdateMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "be5fe10413aca4c98011d6d93dfe98a4", "score": "0.6090379", "text": "func (s GetMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "73c0cab2005d31098ef74dae88190f1f", "score": "0.60684395", "text": "func (s CreateMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "73c0cab2005d31098ef74dae88190f1f", "score": "0.60684395", "text": "func (s CreateMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3901139e74a3c7073fb661bd90272907", "score": "0.6066105", "text": "func (s FeatureParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "faed4e1bb0db60dcb2c6f36e3c1066ed", "score": "0.60643", "text": "func (k *key) String() string {\n\treturn \"api context value \" + k.name\n}", "title": "" }, { "docid": "8d24224fe2d09199e308710466d5c714", "score": "0.5997731", "text": "func (p paramHeader) String() string {\n\treturn fmt.Sprintf(\"%s (%d): %s\", p.typ, p.len, p.raw)\n}", "title": "" }, { "docid": "f0c8ec069ef4f371f74a77c1fff342eb", "score": "0.59934264", "text": "func (s Api) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f0c8ec069ef4f371f74a77c1fff342eb", "score": "0.59934264", "text": "func (s Api) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "540636a34adb1a7967a6f8d5aa0c8445", "score": "0.59871185", "text": "func (s UpdateParam) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a5a738c2efdc9f171b82ac6ba530b5b7", "score": "0.59852576", "text": "func (s MemberSummary) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c8c4ae4808f93da388e9d506cd9913ca", "score": "0.592717", "text": "func (pc ParamChange) String() string {\n\treturn fmt.Sprintf(`Param Change:\n Subspace: %s\n Key: %s\n Subkey: %X\n Value: %X\n`, pc.Subspace, pc.Key, pc.Subkey, pc.Value)\n}", "title": "" }, { "docid": "c5ac32b50515a01e38f8086951fb488b", "score": "0.59267753", "text": "func (s CreateMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c5ac32b50515a01e38f8086951fb488b", "score": "0.59267753", "text": "func (s CreateMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0763cdfe3b89f2f4d83053ed67f8ca3e", "score": "0.59145814", "text": "func (s UpdateMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "bc3052ec2d6d17830a144a788ddc57d3", "score": "0.5904645", "text": "func (s ListMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.58834183", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.58813035", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.58813035", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3815b87970f5ed84eedf754a2150de2c", "score": "0.58696765", "text": "func (s MethodSetting) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "332c8c86d87b0654fa614312ec4429f0", "score": "0.5866431", "text": "func (p Provider) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "1cdad9caaf72275da4ef3e46c448a1a3", "score": "0.585868", "text": "func (p *Parms) String() string {\n\tout, _ := json.MarshalIndent(p, \"\", \"\\t\")\n\treturn string(out)\n}", "title": "" }, { "docid": "bbc0a707148f9155b8d783f7e43faf92", "score": "0.5857473", "text": "func (vl VerbLevel) String() string {\n\treturn fmt.Sprintf(\"%d=%s\", vl, vl.Name())\n}", "title": "" }, { "docid": "d4cb7553dc2c5babac931f8d2e20874e", "score": "0.5855498", "text": "func (s HeaderMatchMethod) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "71d132ba1d30a77fff56311ae4ba8357", "score": "0.58440924", "text": "func (s InvisibleFieldInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d276cf09182d09730c046fea89169f72", "score": "0.58431363", "text": "func (g *Generic) String() string {\n\tparamStr := make([]string, len(g.Params))\n\tfor i, pr := range g.Params {\n\t\tparamStr[i] = pr.String()\n\t}\n\n\treturn fmt.Sprintf(\"{Header: %s, Params: %s}\",\n\t\tg.Header.String(),\n\t\tparamStr,\n\t)\n}", "title": "" }, { "docid": "cdfef40083c53bb9723ce783f15375e4", "score": "0.5826664", "text": "func (c CliParams) String() string {\n\tnameFmt := \"%20s: \"\n\tlines := []string{\n\t\tfmt.Sprintf(nameFmt+\"%t\", \"Debug\", c.Debug),\n\t\tfmt.Sprintf(nameFmt+\"%t\", \"Help Printed\", c.HelpPrinted),\n\t\tfmt.Sprintf(nameFmt+\"%q\", \"Errors\", c.Errors),\n\t\tfmt.Sprintf(nameFmt+\"%s\", \"Input File\", c.InputFile),\n\t\tfmt.Sprintf(nameFmt+\"%d\", \"Count\", c.Count),\n\t\tfmt.Sprintf(nameFmt+\"%s\", \"Points\", c.Points),\n\t}\n\treturn strings.Join(lines, \"\\n\") + \"\\n\"\n}", "title": "" }, { "docid": "2e924ed8b95c5fb25e921c6ac44b5f27", "score": "0.58188033", "text": "func (s MemberConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "621894444e85b1dadecdc7c588e9c52b", "score": "0.581099", "text": "func (p *VCardProperty) String() string {\n\treturn fmt.Sprintf(\" %s (type=%s, parameters=%v): %v\", p.Name, p.Type, p.Parameters, p.Value)\n}", "title": "" }, { "docid": "39e9504fecf3857dbef7c488840dcd72", "score": "0.5810454", "text": "func (o LunOnlineRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "4dbcf4e917e2636916cf8b979f3d6134", "score": "0.5805299", "text": "func (s AuthInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "773ad15412af46740aafdd1afa28c4c8", "score": "0.5803028", "text": "func (s SigningProfileParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "11c90d6ee574cda9903fc75bee8832a0", "score": "0.57964164", "text": "func (s DBClusterMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9c66cccdde8c717e9a130db2918369c1", "score": "0.57953393", "text": "func (s ParameterStringFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "de2779b21a0c4435f4cf673825eb1442", "score": "0.57873785", "text": "func (p *PluginAPI) String() string {\n\tvar lines []string\n\tlines = append(lines, \"Struct PluginAPI:\")\n\tlines = append(lines, \"\\t- Generated on: 2016-12-06 08:06:59.815134005 +0100 CET\")\n\tlines = append(lines, \"\\t- Command: go-bind-plugin -plugin-path plugin.so -plugin-package ./plugin -output-name PluginAPI -output-path plugin_api.go -output-package main -dereference-vars -rebuild\")\n\tlines = append(lines, \"\\nPlugin info:\")\n\tlines = append(lines, \"\\t- package: github.com/wendigo/go-bind-plugin-example/plugin\")\n\tlines = append(lines, \"\\t- sha256 sum: 303cd891bd37c209c0ad0798673bd871af8e6bae3673cc7c261abb54e76e6ae9\")\n\tlines = append(lines, \"\\t- size: 2578348 bytes\")\n\tlines = append(lines, \"\\nExported functions (2):\")\n\tlines = append(lines, \"\\t- CalculateSin func(float64) (float64)\")\n\tlines = append(lines, \"\\t- SayHello func(string)\")\n\n\tlines = append(lines, \"\\nExported variables (1):\")\n\tlines = append(lines, \"\\t- CurrentYear int\")\n\n\treturn strings.Join(lines, \"\\n\")\n}", "title": "" }, { "docid": "ab429420bcc0e75dcb7ca22c09e73967", "score": "0.57807726", "text": "func (s IdentityProviderDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "14a5d8153fa38ed0e3c2c8e5825e17e4", "score": "0.5773225", "text": "func (s CreateMembersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "14a5d8153fa38ed0e3c2c8e5825e17e4", "score": "0.5773225", "text": "func (s CreateMembersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3d29636fde22fff60ec1419e6a474619", "score": "0.57730776", "text": "func (s OutputParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d00241105253d4428c22acb51ad5ae04", "score": "0.577129", "text": "func (obj KeyColumnUsage) String() string {\n\tif data, err := json.Marshal(obj); err != nil {\n\t\treturn fmt.Sprintf(\"<KeyColumnUsage>\")\n\t} else {\n\t\treturn string(data)\n\t}\n}", "title": "" }, { "docid": "a1a197d01d3356cc58146d848344edad", "score": "0.5762477", "text": "func (s GetApiOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7fa9ae680372df047f172b65f4ed06b4", "score": "0.5755384", "text": "func (s ApiKey) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "decd8e9f3b4aa59eb22e199be9f77f20", "score": "0.5752161", "text": "func (o ExportPolicyCreateRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "1e89f691f0ca1e346e18ac407cb71020", "score": "0.5751876", "text": "func (v *Argument) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [3]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Name: %v\", v.Name)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Type: %v\", v.Type)\n\ti++\n\tif v.Annotations != nil {\n\t\tfields[i] = fmt.Sprintf(\"Annotations: %v\", v.Annotations)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"Argument{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "447719bdb220732b4bce8c4dc6d60e01", "score": "0.57429045", "text": "func (p *Parameters) String() string {\n\tif p == nil {\n\t\treturn \"\"\n\t}\n\treturn fmt.Sprintf(\"%s%s%s\", p.URL.String(), p.Headers.String(), p.TLSClient.String())\n}", "title": "" }, { "docid": "965a9abdefe33b7750c8d7579c523240", "score": "0.5730619", "text": "func (s ReadOnlyFieldInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "acb5f15fa51a789751deffe7cde15980", "score": "0.5727092", "text": "func (bs *Bindings) String() string {\r\n\treturn \"PARAM=VALUE\"\r\n}", "title": "" }, { "docid": "fc5a5ad42da54884cfd84053b31bb46a", "score": "0.5715605", "text": "func (o *Webchatmemberinfo) String() string {\n\tj, _ := json.Marshal(o)\n\tstr, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n\treturn str\n}", "title": "" }, { "docid": "2a06959f51277ecf54529ee5b2a72ded", "score": "0.5712939", "text": "func (s MemberFrameworkConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e31bfc3c4e736fc4911e733d7d46a900", "score": "0.5711319", "text": "func (i invocation) String() string {\n\treturn fmt.Sprintf(\"%s %s\", i.name, quotedArgsString(i.finalArgs))\n}", "title": "" }, { "docid": "420fa8ace31be8c1faca8c622cb1dec1", "score": "0.570595", "text": "func (a Access) String() string {\n\tswitch a {\n\tcase Default, PhoneAndEmail:\n\t\treturn \"phone+email\"\n\tcase Phone:\n\t\treturn \"phone\"\n\tcase Email:\n\t\treturn \"email\"\n\tcase Disabled:\n\t\treturn \"disabled\"\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "05c123f93f222656e1cd07c1a3db6741", "score": "0.56994265", "text": "func (s InstanceInformationStringFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "91162058a12197555a9198a77cba4eb6", "score": "0.5698521", "text": "func (s MemberFabricAttributes) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a055cc21dc61ca5dc698ea9ff7d4b847", "score": "0.5689971", "text": "func (s ApiKeyCredential) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7249bc55cee6e54f969343b21734bc93", "score": "0.568137", "text": "func (o SnapmirrorCreateRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "2fc1b2ea1d2dc3b92ae03f3c915fc03e", "score": "0.56801325", "text": "func (p *Param) String() string {\n\tswitch p.ParameterKind {\n\tcase variable, variableDecl:\n\t\treturn strconv.Quote(\"$\" + p.Name)\n\tcase declaration:\n\t\treturn p.Name\n\tcase stringConstant:\n\t\treturn strconv.Quote(p.Name)\n\tcase otherConstant:\n\t\treturn p.Name\n\tcase ignored:\n\t\treturn \"\"\n\tdefault:\n\t\treturn \"<not supported>\"\n\t}\n}", "title": "" }, { "docid": "783de1237c3178c9c58f5582516163ec", "score": "0.56714725", "text": "func (p MigProfileInfo) String() string {\n\tvar suffix string\n\tif len(p.Attributes) > 0 {\n\t\tsuffix = \"+\" + strings.Join(p.Attributes, \",\")\n\t}\n\tif p.C == p.G {\n\t\treturn fmt.Sprintf(\"%dg.%dgb%s\", p.G, p.GB, suffix)\n\t}\n\treturn fmt.Sprintf(\"%dc.%dg.%dgb%s\", p.C, p.G, p.GB, suffix)\n}", "title": "" }, { "docid": "30a6f48663aa14bc52a73a72cc8a55ca", "score": "0.5669653", "text": "func (s EndpointInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2e5cf7aeadef29bfb22dee4204766b1b", "score": "0.56693274", "text": "func (s CreateApiOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "54c92a6a2279bba9408a740ecb74adde", "score": "0.5654512", "text": "func (ps *Segment) String() string {\n\treturn fmt.Sprintf(\"{ Name: %v, IsVariable: %v, IsWildcard: %v }\",\n\t\tps.Name, ps.IsVariable, ps.IsWildcard)\n}", "title": "" }, { "docid": "b43f0fd1497d0d70395b90a0f23f73b4", "score": "0.5649641", "text": "func (s EndpointAccess) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e48cc421d8de6ecad5a5da1526316415", "score": "0.5636675", "text": "func (s ListMembersInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "88d88e2a43e2ff091793f31f1de09861", "score": "0.5634918", "text": "func (p Providers) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "61b9ead56774282db4e04c4b70570b94", "score": "0.56336457", "text": "func (s ParameterMetadata) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4873139562b1e1270fb504c8a70a35e5", "score": "0.56334585", "text": "func (v Vector) String() string {\n\treturn fmt.Sprintf(\"%v:%v\", v.Gate, v.Valve)\n}", "title": "" }, { "docid": "90faaf1f49275808b1cf90892b5cabaf", "score": "0.5633376", "text": "func (b *BitSet) String() string {\n\tm := b.Members()\n\ts := make([]byte, 0, 4*len(m))\n\ts = append(s, '{')\n\tfor _, i := range m {\n\t\ts = append(s, fmt.Sprintf(\" %d\", i)...)\n\t}\n\treturn string(append(s, \" }\"...))\n}", "title": "" }, { "docid": "e041c6be9c819de6a5d40d1fd63acfc8", "score": "0.5630061", "text": "func (s ParametersFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c491613a0dbf57cdf045506b6be0cb1f", "score": "0.56250113", "text": "func (s RestApi) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b2b61165467edf67fea36f7348c30927", "score": "0.5615451", "text": "func (p *ubPayload) String() string {\n\treturn fmt.Sprintf(\"[%s][%s]\", formatFlags(p.flags), p.suffix)\n}", "title": "" }, { "docid": "95412ff336fbc5b06f35ed4ffea03a0d", "score": "0.56137824", "text": "func (this *Name) String() string {\n\tif this.DoubleValue != nil {\n\t\treturn this.Before.String() + strconv.FormatFloat(this.GetDoubleValue(), 'f', -1, 64)\n\t}\n\tif this.IntValue != nil {\n\t\treturn this.Before.String() + strconv.FormatInt(this.GetIntValue(), 10)\n\t}\n\tif this.UintValue != nil {\n\t\treturn this.Before.String() + \"uint(\" + strconv.FormatUint(this.GetUintValue(), 10) + \")\"\n\t}\n\tif this.BoolValue != nil {\n\t\treturn this.Before.String() + strconv.FormatBool(this.GetBoolValue())\n\t}\n\tif this.StringValue != nil {\n\t\tif isId(this.GetStringValue()) {\n\t\t\treturn this.Before.String() + this.GetStringValue()\n\t\t}\n\t\treturn this.Before.String() + strconv.Quote(this.GetStringValue())\n\t}\n\tif this.BytesValue != nil {\n\t\treturn this.Before.String() + fmt.Sprintf(\"%#v\", this.GetBytesValue())\n\t}\n\tpanic(\"unreachable\")\n}", "title": "" }, { "docid": "dde389e53d617fdce15d5304d1290371", "score": "0.5596954", "text": "func (params Params) String() string {\n\treturn fmt.Sprintf(`Treasury Params:\n\tBasePool: %s\n\tPoolRecoveryPeriod: %d\n\tMinStabilitySpread: %s\n\t`, params.BasePool, params.PoolRecoveryPeriod, params.MinStabilitySpread)\n}", "title": "" }, { "docid": "12e91abc3632a1158a717f2f0bdf592f", "score": "0.5596574", "text": "func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string {\n\tsep := \",\"\n\tswitch collectionFormat {\n\tcase \"pipes\":\n\t\tsep = \"|\"\n\tcase \"ssv\":\n\t\tsep = \" \"\n\tcase \"tsv\":\n\t\tsep = \"\\t\"\n\t}\n\n\tswitch t := reflect.TypeOf(obj).String(); t {\n\tcase \"[]string\":\n\t\treturn strings.Join(obj.([]string), sep)\n\tdefault:\n\t\treturn fmt.Sprintf(\"%v\", obj)\n\t}\n}", "title": "" }, { "docid": "f03cd35a740e74ed99ab0128f55710f1", "score": "0.5595446", "text": "func (s WorkflowParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9a2ae00c0bb298d2e574d4479f54796d", "score": "0.55923337", "text": "func (s VocabularyFilterInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0d4dfeb8fd902b515f05c05129702a9a", "score": "0.55913615", "text": "func (s OptionGroupMembership) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e26540770e51fd568fbc7de170aeb593", "score": "0.5591269", "text": "func (s SomeStruct) String() string {\n\treturn fmt.Sprintf(\"p1: %T %+v; p2: %T %+v\", s.p1, s.p1, s.p2, s.p2)\n}", "title": "" }, { "docid": "d713e668abedd315c12ef86d1ee19818", "score": "0.55889904", "text": "func (s EndpointDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7657ce98c9091c9009ef40f193e1f111", "score": "0.5576053", "text": "func (opt OptNameOnly) String() string {\n\treturn \"OptNameOnly: \" + strconv.FormatBool(bool(opt))\n}", "title": "" }, { "docid": "c77da8e77c30d6a397ef3b069cfecb8c", "score": "0.5575287", "text": "func (o IgroupAddRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "6070a102a4c0ca13a7159bbacadc50e2", "score": "0.5573589", "text": "func (s RequiredFieldInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "79f79cadd28fa45a671401aa7685c540", "score": "0.5572192", "text": "func (s GetParameterOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "eed957cb6858fc0c6031de634ccaf403", "score": "0.55715966", "text": "func (s VoiceSettings) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "70654039945d2320f4eee3aa3a793d94", "score": "0.55714524", "text": "func (s KeyValuePair) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "70654039945d2320f4eee3aa3a793d94", "score": "0.55714387", "text": "func (s KeyValuePair) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
8547dab5e07d3a76ae16f0aeff017be3
Begin begins a transaction
[ { "docid": "bc0fb4d499ce2c90f1ed0d701e862846", "score": "0.67670894", "text": "func (db *UserDB) Begin(ctx context.Context) Tx {\n\treturn UserTx{db.db.MustBegin()}\n}", "title": "" } ]
[ { "docid": "b71341508e5797c5d8e3b01d669f460c", "score": "0.7578263", "text": "func (db *DbType) TransactBegin() {\n\tif db.err == nil {\n\t\tif db.transact.ctx == nil {\n\t\t\tdb.transact.ctx = ql.NewRWCtx()\n\t\t}\n\t\t_, _ = db.Exec(\"BEGIN TRANSACTION;\")\n\t\tif db.err == nil {\n\t\t\tdb.transact.nest++\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "f4f0be0511c036721c13ee80553c5ccc", "score": "0.7478627", "text": "func (db *DB) Begin(c context.Context) (tx *Tx, err error) {\n\treturn db.conn().begin(c)\n}", "title": "" }, { "docid": "9f32890e86849765bdc6a8754d6dba56", "score": "0.74730635", "text": "func (db *Database) Begin(qs []*CypherQuery) (*Tx, error) {\n\tpayload := txRequest{Statements: qs}\n\tresult := txResponse{}\n\tne := NeoError{}\n\tresp, err := db.Session.Post(db.HrefTransaction, payload, &result, &ne)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.Status() != 201 {\n\t\treturn nil, ne\n\t}\n\tt := Tx{\n\t\tdb: db,\n\t\threfCommit: result.Commit,\n\t\tLocation: resp.HttpResponse().Header.Get(\"Location\"),\n\t\tErrors: result.Errors,\n\t\tExpires: result.Transaction.Expires,\n\t}\n\tif len(t.Errors) != 0 {\n\t\treturn &t, TxQueryError\n\t}\n\terr = result.unmarshal(qs)\n\tif err != nil {\n\t\treturn &t, err\n\t}\n\treturn &t, err\n}", "title": "" }, { "docid": "96e8ca5f941ef5cba795fca0e1cbcdcc", "score": "0.74569285", "text": "func (s *Session) Begin() error {\n\ts.rollbackSign = true\n\tif s.tx == nil {\n\t\ttx, err := s.db.Begin()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.tx = tx\n\t\ts.commitSign = beginStatus\n\t\treturn nil\n\t}\n\ts.commitSign++\n\treturn nil\n}", "title": "" }, { "docid": "7672033b6c201da343bf18101545812f", "score": "0.7428777", "text": "func (c *TxnController) Begin() revel.Result {\n\n\ttxn := gormdb.DB.Begin()\n\tif txn.Error != nil {\n\t\tc.Log.Panic(\"Transaction begine error\", \"error\", txn.Error)\n\t}\n\n\tc.Txn = txn\n\treturn nil\n}", "title": "" }, { "docid": "d5f25a4e3d63a7e0147725ccedb80c84", "score": "0.73545307", "text": "func (d *Dao) BeginTran(c context.Context) (*sql.Tx, error) {\n\treturn d.db.Begin(c)\n}", "title": "" }, { "docid": "8c709bb05f01102de3417e71362d0166", "score": "0.73534584", "text": "func (db *DB) Begin(ctx context.Context) (tx *Tx, err error) {\n\treturn db.write.begin(ctx)\n}", "title": "" }, { "docid": "26620605dc08483b615d9b1de7e7f4bb", "score": "0.7338445", "text": "func BeginTransaction() {\n\tfmt.Println(\"\\n:: Starting New Transaction ::\\n\")\n\n\tclient, conn := fsutils.MakeFSClient()\n\n\tdefer conn.Close()\n\n\toptions := firestore.TransactionOptions{}\n\tbeginTransactionReq := firestore.BeginTransactionRequest{\n\t\tDatabase: \"projects/firestoretestclient/databases/(default)\",\n\t\tOptions: &options,\n\t}\n\tresp, err := client.BeginTransaction(context.Background(), &beginTransactionReq)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\ttransactionId := resp.GetTransaction()\n\tfmt.Println(\"Successfully began new transaction\", transactionId)\n\tenvironment.SetEnvironment(transactionId)\n\n}", "title": "" }, { "docid": "86e2105fb0d4ad54c2ddb23f64ff5012", "score": "0.7296893", "text": "func (*Store) Begin(_ ...tikv.TxnOption) (kv.Transaction, error) { return nil, nil }", "title": "" }, { "docid": "c285f1c1dd91cf51c93e1ddace20087e", "score": "0.7280623", "text": "func (store *BoltStorage) StartTransaction() error {\n\tbTxn, err := store.db.Begin(true)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Failed to create transaction\")\n\t}\n\tstore.activeTxn = bTxn\n\treturn nil\n}", "title": "" }, { "docid": "69ec3a6da17e0d0acaabf91c78c35714", "score": "0.7246857", "text": "func StartTransaction() {\n\t<-transactionToken\n\n\t// STUB\n}", "title": "" }, { "docid": "3e882029a00065317009348e6086066f", "score": "0.724192", "text": "func (data *Data) begin() (err error) {\n\tdata.tx, err = data.Connection.BeginTx(context.Background(), &sql.TxOptions{\n\t\tIsolation: sql.LevelRepeatableRead,\n\t\tReadOnly: true,\n\t})\n\treturn\n}", "title": "" }, { "docid": "bffb234b6926f967da61af12bd3ff4a3", "score": "0.7238864", "text": "func (sql Table) BeginTx() (cm.Transaction, error) {\n\tt, err := sql.database.Beginx()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Transaction{t}, nil\n}", "title": "" }, { "docid": "19f5182a5d5d57bfa62fc0234c92e2c9", "score": "0.72384214", "text": "func (m *Manager) Begin() error {\n\tvar err error\n\tif m.transaction {\n\t\tlogrus.Panic(\"already in transaction\")\n\t}\n\tm.tx, err = wdbmap.Begin()\n\tif err == nil {\n\t\tm.transaction = true\n\t}\n\treturn err\n}", "title": "" }, { "docid": "339477c46e0eeaf115f97650a7607984", "score": "0.7233218", "text": "func (db *DB) Begin(ctx context.Context) (*Tx, errors.Error) {\n\ttx, err := db.sql.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelReadUncommitted})\n\tif err != nil {\n\t\tdb.errLog.Printf(\"begin: %v\\n\", err)\n\t\treturn nil, errors.InternalError(err)\n\t}\n\n\treturn &Tx{\n\t\tInternalTx: tx,\n\t\tctx: ctx,\n\t\terrLog: log.New(os.Stderr, \"[TX][ERROR]: \", log.LstdFlags),\n\t}, nil\n}", "title": "" }, { "docid": "0b7acfee96e222798b42549a7af01e9e", "score": "0.72264737", "text": "func (db *DB) Begin() (*sql.Tx, error) {\n\treturn db.master.Begin()\n}", "title": "" }, { "docid": "dd5c090ab7f4ffb97e357e747448c2d8", "score": "0.7195773", "text": "func BeginTx(ctx context.Context) (*sqlx.Tx, error) {\n\treturn managerInstance.Handle().BeginTxx(ctx, nil)\n}", "title": "" }, { "docid": "87209992a1b5894d2fae286a3212696f", "score": "0.71924907", "text": "func (db *db) Begin(writable bool) (store.Tx, error) {\n\treturn db.begin(writable)\n}", "title": "" }, { "docid": "4669a1df4901badec64c04060a82fbc1", "score": "0.7163306", "text": "func (db *DB) Begin(ctx context.Context, opts interface{}) (*Tx, error) {\n\ttx, err := db.db.Begin()\n\treturn &Tx{db, tx}, err\n}", "title": "" }, { "docid": "f87e17a4fcc88783704a3b99c50f2bb6", "score": "0.7157525", "text": "func (c *Conn) Begin() (driver.Tx, error) {\n\treturn c.BeginTx(context.Background(), sql.TxOptions{})\n}", "title": "" }, { "docid": "a916b580734da32dd0d4e6c82c2a0821", "score": "0.712545", "text": "func (p *PostGIS) Begin() error {\n\tif p.tx != nil {\n\t\treturn errors.New(\"transaction already open\")\n\t}\n\tif err := p.open(); err != nil {\n\t\treturn err\n\t}\n\tvar err error\n\tp.tx, err = p.db.Begin()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"creating db transaction\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cb9f284c0c084744de0cdf88f004d6fc", "score": "0.71106434", "text": "func (q *Qbs) Begin() error {\n\treturn q.BeginTx(q.ctx, nil)\n}", "title": "" }, { "docid": "da08c91c9b4560ba7895333a9d2c5603", "score": "0.71096355", "text": "func (d *DB) Begin() (*DB, error) {\r\n\ttx, err := d.connection.Begin()\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\tdefer setLastSQL(d, \"BEGIN\")\r\n\td.tx = tx\r\n\td.transactions = append(d.transactions, tx)\r\n\treturn d, err\r\n}", "title": "" }, { "docid": "89e00271a007adbf9be1c6642647914a", "score": "0.7104207", "text": "func (d *DatabaseStorage) Begin() (*sqlx.Tx, error) {\n\treturn d.db.Beginx()\n}", "title": "" }, { "docid": "291006bf28b26cf98e81e497db4929b0", "score": "0.7090228", "text": "func DBBeginTx(db *sql.DB, ctx context.Context, opts *sql.TxOptions,) (*sql.Tx, error)", "title": "" }, { "docid": "d009c2a855cadd482ebe49ab87a151f7", "score": "0.70836866", "text": "func (s SQLDao) Begin() (*sql.Tx, error) {\n\tif s.conn == nil {\n\t\treturn nil, util.ErrDBNotInit\n\t}\n\treturn s.conn.Begin()\n\n}", "title": "" }, { "docid": "c15acaebb8045efa18a4c66f84790072", "score": "0.7079092", "text": "func BeginTransactions() *gorm.DB {\n\tdb.Exec(\"set transaction isolation level serializable\")\n\treturn db.Begin()\n}", "title": "" }, { "docid": "043250da152c7357a1728b0c7b2044fc", "score": "0.70741946", "text": "func (conn *Connection) beginTx() (*sql.Tx, error) {\n\treturn conn.Begin()\n}", "title": "" }, { "docid": "e6d4dc278332ed415ea45d36a695af61", "score": "0.7065193", "text": "func (db *DB) Begin() (*Tx, error) {\n\ttx, err := db.DB.Beginx()\n\treturn &Tx{\n\t\tTx: tx,\n\t\tDB: db,\n\t\ttags: []string{NotificationTagDefault},\n\t\tnotifications: []*Notification{},\n\t\tpostCommitHooks: nil,\n\t\tpostCommitHooksMutex: sync.RWMutex{},\n\t}, err\n}", "title": "" }, { "docid": "370a2bac79aaa0907a21b518403b7d6c", "score": "0.70618415", "text": "func (db *DB) Begin() (*Tx, error) {\n\ttx, err := db.DB.Begin()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Tx{\n\t\tTx: tx,\n\t\twrap: &wrap{conn: tx},\n\t}, nil\n}", "title": "" }, { "docid": "29d43aa61cc71adc1ba27c806b697f04", "score": "0.705998", "text": "func ConnBeginTx(c *sql.Conn, ctx context.Context, opts *sql.TxOptions,) (*sql.Tx, error)", "title": "" }, { "docid": "f2ac96cb8390423dfadaab7c868eea11", "score": "0.70555836", "text": "func (c *conn) Begin() (driver.Tx, error) {\n\treturn c.BeginTx(context.Background(), driver.TxOptions{})\n}", "title": "" }, { "docid": "276775b78876a98238ad89c989644f4f", "score": "0.7053372", "text": "func (db *DB) Begin(writable bool) (*Tx, error) {\n\ttx, err := db.DB.BeginTx(db.ctx, &database.TxOptions{\n\t\tReadOnly: !writable,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Tx{\n\t\tTransaction: tx,\n\t}, nil\n}", "title": "" }, { "docid": "b3b07c54af8711aab968c0b377cccf00", "score": "0.7050309", "text": "func (db *db) begin(writable bool) (*transaction, error) {\n\t// Whenever a new transaction is started, grab a read lock against the\n\t// database to ensure Close will wait for the transaction to finish.\n\t// This lock will not be released until the transaction is closed (via\n\t// Rollback or Commit).\n\tdb.closeLock.RLock()\n\tif db.closed {\n\t\tdb.closeLock.RUnlock()\n\t\treturn nil, makeDbErr(store.ErrDbNotOpen, errDbNotOpenStr, nil)\n\t}\n\n\t// db.txLock.Lock()\n\t// defer db.txLock.Unlock()\n\tdbTx, err := db.store.Begin(writable)\n\tif err != nil {\n\t\tdb.closeLock.RUnlock()\n\t\treturn nil, convertErr(\"begin tx\", err)\n\t}\n\tdb.activeTx.Add(1)\n\ttx := &transaction{\n\t\twritable: writable,\n\t\tdb: db,\n\t\ttx: dbTx,\n\t}\n\treturn tx, nil\n}", "title": "" }, { "docid": "67933a9527033e1d6830772f006c50e7", "score": "0.7049998", "text": "func (c *Connection) Begin() (driver.Tx, error) {\n\treturn nil, ErrAthenaTransactionUnsupported\n}", "title": "" }, { "docid": "46c42737bde3548beb799308a891e631", "score": "0.7041512", "text": "func (t *ReadWriteTransaction) begin(ctx context.Context) error {\n\tt.mu.Lock()\n\tif t.tx != nil {\n\t\tt.state = txActive\n\t\treturn nil\n\t}\n\tsh := t.sh\n\tt.mu.Unlock()\n\n\tvar (\n\t\ttx transactionID\n\t\terr error\n\t)\n\tdefer func() {\n\t\tif err != nil && sh != nil {\n\t\t\t// Got a valid session handle, but failed to initialize transaction=\n\t\t\t// on Cloud Spanner.\n\t\t\tif isSessionNotFoundError(err) {\n\t\t\t\tsh.destroy()\n\t\t\t}\n\t\t\t// If sh.destroy was already executed, this becomes a noop.\n\t\t\tsh.recycle()\n\t\t}\n\t}()\n\t// Retry the BeginTransaction call if a 'Session not found' is returned.\n\tfor {\n\t\ttx, err = beginTransaction(contextWithOutgoingMetadata(ctx, sh.getMetadata(), t.disableRouteToLeader), sh.getID(), sh.getClient(), t.txOpts)\n\t\tif isSessionNotFoundError(err) {\n\t\t\tsh.destroy()\n\t\t\tsh, err = t.sp.take(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontinue\n\t\t} else {\n\t\t\terr = ToSpannerError(err)\n\t\t}\n\t\tbreak\n\t}\n\tif err == nil {\n\t\tt.mu.Lock()\n\t\tt.tx = tx\n\t\tt.sh = sh\n\t\t// Transition state to txActive.\n\t\tt.state = txActive\n\t\tt.mu.Unlock()\n\t}\n\treturn err\n}", "title": "" }, { "docid": "e03746f900826b1b3644f340915bde20", "score": "0.70409214", "text": "func (c *spannerConn) Begin() (driver.Tx, error) {\n\treturn nil, notImplementedError(c, \"Begin\")\n}", "title": "" }, { "docid": "a831063aa7d24d9d34b4d46d06d7d2ea", "score": "0.70336485", "text": "func (q *DB) Begin() (*Transaction, error) {\n\ttx, err := q.DB.Begin()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to open transaction\")\n\t}\n\treturn &Transaction{\n\t\tTx: tx,\n\t\tqueryable: queryable{db: tx, dialect: q.dialect},\n\t}, nil\n}", "title": "" }, { "docid": "f9138a2af089da2b3b5565727b4e110e", "score": "0.7021856", "text": "func (db *UsersDB) Begin() (*sql.Tx, error) {\n\treturn db.nativeDB.Begin()\n}", "title": "" }, { "docid": "d08f3657eb17a88c9b20350aa0875c04", "score": "0.7015642", "text": "func (c *FakeConn) Begin() (driver.Tx, error) {\n\tif c.isBad() {\n\t\treturn nil, driver.ErrBadConn\n\t}\n\tif c.currTx != nil {\n\t\treturn nil, errors.New(\"already in a transaction\")\n\t}\n\tc.currTx = &FakeTx{c: c}\n\treturn c.currTx, nil\n}", "title": "" }, { "docid": "b712a3482959694049bc74d44f49334c", "score": "0.7010807", "text": "func (slf *MySQLModule) Begin() (*Tx, error) {\n\tvar txDBMoudule Tx\n\ttxdb, err := slf.db.Begin()\n\tif err != nil {\n\t\tlog.Error(\"Begin error:%s\", err.Error())\n\t\treturn &txDBMoudule, err\n\t}\n\ttxDBMoudule.slowDuration = slf.slowDuration\n\ttxDBMoudule.tx = txdb\n\treturn &txDBMoudule, nil\n}", "title": "" }, { "docid": "35d1a42361e6209738a27ae016964d60", "score": "0.6977612", "text": "func (db *DB) Begin() (*Tx, error) {\n\ttx, err := db.db.Begin()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tt := &Tx{\n\t\tdb: db,\n\t\ttx: tx,\n\t}\n\treturn t, nil\n\n}", "title": "" }, { "docid": "3a7993dc4fac1cd1f8389e87537a9e50", "score": "0.6947597", "text": "func (c *sqlmock) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {\n\tex, err := c.begin()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tselect {\n\tcase <-time.After(ex.delay):\n\t\treturn c, nil\n\tcase <-ctx.Done():\n\t\treturn nil, ErrCancelled\n\t}\n}", "title": "" }, { "docid": "6f82122de6760376f5d5abc18e1decc0", "score": "0.6946499", "text": "func (c *PostgresConn) Begin(ctx context.Context) (Tx, error) {\n\ttx, err := c.conn.Begin(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &PostgresTx{\n\t\ttx: tx,\n\t}, nil\n}", "title": "" }, { "docid": "3ac2da297acd45f6ede9c9d67ef8f003", "score": "0.69456744", "text": "func Begin() (*Tx, error) {\n\tif _db == nil {\n\t\treturn nil, errors.New(\"database has not been initialized\")\n\t}\n\n\ttx, err := _db.Begin()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Tx{tx}, nil\n}", "title": "" }, { "docid": "59b5b6047e2c105ced50bbf979617c82", "score": "0.6937904", "text": "func (b *Backend) BeginTransaction(ctx context.Context,\n\topts *sql.TxOptions) (trust.Transaction, error) {\n\n\tb.Lock()\n\tdefer b.Unlock()\n\ttx, err := b.db.BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, db.NewTxError(\"create tx\", err)\n\t}\n\treturn &transaction{\n\t\texecutor: &executor{\n\t\t\tdb: tx,\n\t\t},\n\t\ttx: tx,\n\t}, nil\n}", "title": "" }, { "docid": "7115aaf51b6f65e03185caa4a0317b73", "score": "0.6933736", "text": "func (c *Connection) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) {\n\treturn nil, ErrAthenaTransactionUnsupported\n}", "title": "" }, { "docid": "0eef4d1d4cf5c3c3114d06fe3db24d5a", "score": "0.6925733", "text": "func DBBegin(db *sql.DB,) (*sql.Tx, error)", "title": "" }, { "docid": "1e56663f588d028d78ddfc07f8e79060", "score": "0.69226557", "text": "func (env *Env) BeginTxn(parent *Txn, flags uint) (txn *Txn, err error) {\n\ttxn, err = beginTxn(env, parent, flags)\n\tif txn != nil {\n\t\truntime.SetFinalizer(txn, func(v interface{}) { v.(*Txn).finalize() })\n\t}\n\treturn\n}", "title": "" }, { "docid": "3740c911127bd479d5f61f225e436665", "score": "0.6917007", "text": "func (c *Conn) Begin() (driver.Tx, error) {\n\treturn nil, driver.ErrSkip\n}", "title": "" }, { "docid": "ae44b8d25b4d3df60956a39d3e1fb6ab", "score": "0.6914489", "text": "func (s *MerchantRepo) BeginTransaction(ctx context.Context, dbURL string) (*gorm.DB, error) {\n\tDB, ok := s.DBConnections[dbURL]\n\tif !ok {\n\t\treturn nil, errors.New(\"invalid dbURL passed in MerchantRepo\")\n\t}\n\treturn DB.Begin(), nil\n}", "title": "" }, { "docid": "2d492882579a7bb61eb4fd4973d91a39", "score": "0.68960834", "text": "func (tx *Tx) Begin() (Conn, error) {\n\tif tx.rollback {\n\t\treturn nil, ErrTxRolledBack\n\t}\n\n\ttx.push()\n\treturn tx, nil\n}", "title": "" }, { "docid": "c9d240fa97a8fe250ad76d1ca92fe31d", "score": "0.6874283", "text": "func (s *MockServer) BeginTransaction(ctx context.Context, req *pb.BeginTransactionRequest) (*pb.BeginTransactionResponse, error) {\n\tres, err := s.popRPC(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res.(*pb.BeginTransactionResponse), nil\n}", "title": "" }, { "docid": "611383bf95b61feb293bf017cfe81100", "score": "0.6873477", "text": "func (repository *Repository) TransactionStart() *gorm.DB {\n\treturn repository.database.Begin()\n}", "title": "" }, { "docid": "14350b6bd80756ee20afd0089c368712", "score": "0.6855051", "text": "func (tr *XactRepository) BeginTx(ctx context.Context) (tx.Tx, error) {\n\treturn tr.db.BeginTx(ctx, nil)\n}", "title": "" }, { "docid": "e77146550f9b9408e0225bee9871f822", "score": "0.684474", "text": "func (hood *Hood) Begin() *Hood {\n\tif hood.IsTransaction() {\n\t\tpanic(\"cannot start nested transaction\")\n\t}\n\tc := hood.Copy()\n\tq, err := hood.Db.Begin()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tc.firstTxError = nil\n\tc.qo = q\n\n\treturn c\n}", "title": "" }, { "docid": "c5e5a07f562065fec679714c22d8ea12", "score": "0.6811114", "text": "func (conn *Connection) Begin() (*Tx, error) {\n\ttx, err := conn.DB.Beginx()\n\tif err != nil {\n\t\treturn nil, dat.Events.EventErr(\"begin.error\", err)\n\t}\n\tdat.Events.Event(\"begin\")\n\n\tnewtx, err := &Tx{Tx: tx, Queryable: &Queryable{tx}}, nil\n\tif dat.Strict {\n\t\ttime.AfterFunc(1*time.Minute, func() {\n\t\t\tif newtx.state == txPending {\n\t\t\t\tpanic(\"A database session was not closed!\")\n\t\t\t}\n\t\t})\n\t}\n\treturn newtx, err\n}", "title": "" }, { "docid": "530825e2e2b7e1631afc907ec5f26a23", "score": "0.68084943", "text": "func (r *Repo) Begin() (*Tx, error) {\n\tt, err := r.dbmap.Begin()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Tx{\n\t\ttransaction: t,\n\t\tdbmap: r.dbmap,\n\t}, nil\n}", "title": "" }, { "docid": "e40ef1e7fd014f8f3993578a63a61b37", "score": "0.6792329", "text": "func (sdc *ShardConn) Begin(ctx context.Context) (transactionID int64, err error) {\n\terr = sdc.withRetry(ctx, func(conn tabletconn.TabletConn) error {\n\t\tvar innerErr error\n\t\ttransactionID, innerErr = conn.Begin(ctx)\n\t\treturn innerErr\n\t}, 0, false)\n\treturn transactionID, err\n}", "title": "" }, { "docid": "cf5f21a8ba9050fac1fd61c3b53366ff", "score": "0.6788095", "text": "func (db *PostgresDB) Begin(ctx context.Context) (Tx, error) {\n\ttx, err := db.pool.Begin(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &PostgresTx{\n\t\ttx: tx,\n\t}, nil\n}", "title": "" }, { "docid": "e03b7f080e68b6b6c344a436220c5865", "score": "0.67789507", "text": "func (ftc *fakeTabletConn) Begin(ctx context.Context, target *querypb.Target, options *querypb.ExecuteOptions) (queryservice.TransactionState, error) {\n\treturn queryservice.TransactionState{\n\t\tTransactionID: 1,\n\t}, nil\n}", "title": "" }, { "docid": "394d2bd84ded5ca7a17e8fe5b2286b54", "score": "0.6764055", "text": "func (s *Session) BeginTx() error {\n\tif !s.init {\n\t\treturn initError\n\t}\n\ts.canRollback = true\n\tif s.tx != nil {\n\t\ts.commit++\n\t\treturn nil\n\t}\n\n\ttx, err := s.db.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.tx = tx\n\ts.commit = commitInitStatus\n\treturn nil\n}", "title": "" }, { "docid": "97fc868f7a14aea9629622b64db5b859", "score": "0.6752055", "text": "func (c *GormController) Begin() r.Result {\n\ttxn := Gdb.Begin()\n\tif txn.Error != nil {\n\t\tpanic(txn.Error)\n\t}\n\tc.Txn = txn\n\treturn nil\n}", "title": "" }, { "docid": "ea096b2ac0507aed2b31ca46fd38867c", "score": "0.6748534", "text": "func (cn *Conn) Begin() (driver.Tx, error) {\n\tt := time.Now()\n\ttx, err := cn.origin.Begin()\n\n\tif cb, ok := cn.driver.callbacks[OnConnBegin]; ok {\n\t\tcb(OnConnBegin, time.Since(t), err)\n\t}\n\n\tif err != nil {\n\t\treturn tx, err\n\t}\n\treturn &Tx{driver: cn.driver, origin: tx}, nil\n}", "title": "" }, { "docid": "84d19f606bf907c8991b332568028d3c", "score": "0.67447954", "text": "func (t *ReadOnlyTransaction) begin(ctx context.Context) error {\n\tvar (\n\t\tlocked bool\n\t\ttx transactionID\n\t\trts time.Time\n\t\tsh *sessionHandle\n\t\terr error\n\t\tres *sppb.Transaction\n\t)\n\tdefer func() {\n\t\tif !locked {\n\t\t\tt.mu.Lock()\n\t\t\t// Not necessary, just to make it clear that t.mu is being held when\n\t\t\t// locked == true.\n\t\t\tlocked = true\n\t\t}\n\t\tif t.state != txClosed {\n\t\t\t// Signal other initialization routines.\n\t\t\tclose(t.txReadyOrClosed)\n\t\t\tt.txReadyOrClosed = make(chan struct{})\n\t\t}\n\t\tt.mu.Unlock()\n\t\tif err != nil && sh != nil {\n\t\t\t// Got a valid session handle, but failed to initialize transaction=\n\t\t\t// on Cloud Spanner.\n\t\t\tif isSessionNotFoundError(err) {\n\t\t\t\tsh.destroy()\n\t\t\t}\n\t\t\t// If sh.destroy was already executed, this becomes a noop.\n\t\t\tsh.recycle()\n\t\t}\n\t}()\n\t// Retry the BeginTransaction call if a 'Session not found' is returned.\n\tfor {\n\t\tsh, err = t.sp.take(ctx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvar md metadata.MD\n\t\tres, err = sh.getClient().BeginTransaction(contextWithOutgoingMetadata(ctx, sh.getMetadata(), t.disableRouteToLeader), &sppb.BeginTransactionRequest{\n\t\t\tSession: sh.getID(),\n\t\t\tOptions: &sppb.TransactionOptions{\n\t\t\t\tMode: &sppb.TransactionOptions_ReadOnly_{\n\t\t\t\t\tReadOnly: buildTransactionOptionsReadOnly(t.getTimestampBound(), true),\n\t\t\t\t},\n\t\t\t},\n\t\t}, gax.WithGRPCOptions(grpc.Header(&md)))\n\n\t\tif getGFELatencyMetricsFlag() && md != nil && t.ct != nil {\n\t\t\tif err := createContextAndCaptureGFELatencyMetrics(ctx, t.ct, md, \"begin_BeginTransaction\"); err != nil {\n\t\t\t\ttrace.TracePrintf(ctx, nil, \"Error in recording GFE Latency. Try disabling and rerunning. Error: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\tif isSessionNotFoundError(err) {\n\t\t\tsh.destroy()\n\t\t\tcontinue\n\t\t} else if err == nil {\n\t\t\ttx = res.Id\n\t\t\tif res.ReadTimestamp != nil {\n\t\t\t\trts = time.Unix(res.ReadTimestamp.Seconds, int64(res.ReadTimestamp.Nanos))\n\t\t\t}\n\t\t} else {\n\t\t\terr = ToSpannerError(err)\n\t\t}\n\t\tbreak\n\t}\n\tt.mu.Lock()\n\n\t// defer function will be executed with t.mu being held.\n\tlocked = true\n\n\t// During the execution of t.begin(), t.Close() was invoked.\n\tif t.state == txClosed {\n\t\treturn errSessionClosed(sh)\n\t}\n\n\t// If begin() fails, this allows other queries to take over the\n\t// initialization.\n\tt.tx = nil\n\tif err == nil {\n\t\tt.tx = tx\n\t\tt.rts = rts\n\t\tt.sh = sh\n\t\t// State transite to txActive.\n\t\tt.state = txActive\n\t}\n\treturn err\n}", "title": "" }, { "docid": "c808ba4dbbfffbeb27e7e79d3fdbb50c", "score": "0.6740924", "text": "func (d *Dao) BeginBiliDMTrans(c context.Context) (*sql.Tx, error) {\n\treturn d.biliDM.Begin(c)\n}", "title": "" }, { "docid": "9527206f80f431e9b2edddd92b4cdb48", "score": "0.6720132", "text": "func (c *GormController) Begin() revel.Result {\n\ttxn := Db.Begin()\n\tif txn.Error != nil {\n\t\tpanic(txn.Error)\n\t}\n\tc.Tx = txn\n\treturn nil\n}", "title": "" }, { "docid": "627c79f0cba0f0ff9cd6d51e78e7257d", "score": "0.6716765", "text": "func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) {\n\treturn db.master.BeginTx(ctx, opts)\n}", "title": "" }, { "docid": "4a2287ecd9c37769cf983d325f5c7e79", "score": "0.66839176", "text": "func (store *Store) StartTrans() (storage.CypherTransaction, error) {\n\tneoClient := http.Client{\n\t\tTimeout: time.Second * time.Duration(storage.GlobalTimeout),\n\t}\n\treturn &Transaction{currURL: store.url, preURL: store.preurl, neoClient: neoClient, isStarted: false}, nil\n}", "title": "" }, { "docid": "ce8fa940be12d934438d7a0e82ec8641", "score": "0.6664955", "text": "func (state *State) TxBegin(txID string) {\n\tlogger.Debugf(\"txBegin() for txId [%s]\", txID)\n\tif state.txInProgress() {\n\t\tpanic(fmt.Errorf(\"A tx [%s] is already in progress. Received call for begin of another tx [%s]\", state.currentTxID, txID))\n\t}\n\tstate.currentTxID = txID\n}", "title": "" }, { "docid": "cd3024b24993052c354e812e0421d1b6", "score": "0.66574895", "text": "func (s *XenProjectXenStoreSession) StartTransaction() error {\n\tdefer s.disp.Release()\n\n\tresultRaw, err := s.callMethod(\"StartTransaction\")\n\tdefer resultRaw.Clear()\n\n\treturn err\n}", "title": "" }, { "docid": "d26bbd56010e4c7de0594952601782f7", "score": "0.66417044", "text": "func (c *Conn) BeginWriteTransaction() (Transaction, error) {\n\tmutex := c.txMu\n\tmutex.Lock()\n\t_, err := c.SimpleRequest(\"lock\")\n\tif err != nil {\n\t\tmutex.Unlock()\n\t\treturn nil, err\n\t}\n\treturn &writeTransaction{c}, nil\n}", "title": "" }, { "docid": "b014f5d8b8af0a6bf892cf895c73eabb", "score": "0.6622503", "text": "func (n *NullTxManager) Start(context.Context) error { return nil }", "title": "" }, { "docid": "b0501288af7c9ba9f6b1e96c460b76e5", "score": "0.65747523", "text": "func Xsqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { /* sqlite3.c:116344:21: */\n\tvar db uintptr\n\tvar v uintptr\n\tvar i int32\n\n\tdb = (*Parse)(unsafe.Pointer(pParse)).Fdb\n\n\tif Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, ts+12760 /* \"BEGIN\" */, uintptr(0), uintptr(0)) != 0 {\n\t\treturn\n\t}\n\tv = Xsqlite3GetVdbe(tls, pParse)\n\tif !(v != 0) {\n\t\treturn\n\t}\n\tif type1 != TK_DEFERRED {\n\t\tfor i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ {\n\t\t\tvar eTxnType int32\n\t\t\tvar pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt\n\t\t\tif (pBt != 0) && (Xsqlite3BtreeIsReadonly(tls, pBt) != 0) {\n\t\t\t\teTxnType = 0 // Read txn\n\t\t\t} else if type1 == TK_EXCLUSIVE {\n\t\t\t\teTxnType = 2 // Exclusive txn\n\t\t\t} else {\n\t\t\t\teTxnType = 1 // Write txn\n\t\t\t}\n\t\t\tXsqlite3VdbeAddOp2(tls, v, OP_Transaction, i, eTxnType)\n\t\t\tXsqlite3VdbeUsesBtree(tls, v, i)\n\t\t}\n\t}\n\tXsqlite3VdbeAddOp0(tls, v, OP_AutoCommit)\n}", "title": "" }, { "docid": "411bb3cbc5a59b11c702725c9ffbe6d3", "score": "0.6573959", "text": "func (p *ConnPool) Begin() (*Transaction, error) {\n\treturn p.BeginEx(context.Background(), nil)\n}", "title": "" }, { "docid": "fbefae40fbfb7bb2fba4252a503445e5", "score": "0.65693355", "text": "func (node *node) BeginTx(ctx context.Context, opts *sql.TxOptions) (Node, error) {\n\tclone := node.clone()\n\n\tswitch {\n\tcase clone.tx == nil:\n\n\t\t// Create new transaction.\n\t\ttx, err := clone.db.BeginTx(ctx, opts)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tclone.tx = tx\n\n\tcase clone.savePointEnabled:\n\n\t\t// Already in a transaction: using savepoints\n\t\tclone.nested = true\n\n\t\t// Savepoints name must start with a char and cannot contain dashes (-)\n\t\tclone.savePointID = \"sp_\" + strings.Replace(uuid.Must(uuid.NewV1()).String(), \"-\", \"_\", -1)\n\t\t_, err := node.tx.Exec(\"SAVEPOINT \" + clone.savePointID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\tdefault:\n\n\t\t// Already in a transaction: reusing current one.\n\t\tclone.nested = true\n\t}\n\n\treturn clone, nil\n}", "title": "" }, { "docid": "57b942f7d0e708c6330ce456e4c3dd10", "score": "0.6557279", "text": "func rtreeBeginTransaction(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:194529:12: */\n\tvar pRtree uintptr = pVtab\n\n\t(*Rtree)(unsafe.Pointer(pRtree)).FinWrTrans++\n\treturn SQLITE_OK\n}", "title": "" }, { "docid": "2f28e84b80268420daf2cf3448a745ff", "score": "0.65342915", "text": "func (s *Service) StartTransaction(ctx context.Context, req Request, callbacks ...func() error) (*Response, error) {\n\t// Insert new transaction with initial state\n\ttransactionID, err := s.Ts.Insert(ctx, req.Source, req.Destination, req.Reference, req.Data)\n\tif err != nil {\n\t\t// Failed to append transaction, err is returned and no rollback required.\n\t\treturn nil, err\n\t}\n\n\tif err := s.applyTransaction(ctx, req, transactionID, callbacks...); err != nil {\n\t\tif err := s.recoverFromError(ctx, transactionID, req, Pending); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, err\n\t}\n\n\ttr, err := s.commitTransaction(ctx, req, transactionID)\n\tif err != nil {\n\t\tif err := s.recoverFromError(ctx, transactionID, req, Applied); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn &Response{\n\t\tTransactionID: transactionID,\n\t\tLastModified: tr.LastModified.Unix(),\n\t}, nil\n}", "title": "" }, { "docid": "9e8a9f4158938de3def876d9cb9f0861", "score": "0.65332115", "text": "func (mc *driverConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "c56ee36e5af2b82155f554c4ad4ea1e1", "score": "0.6520708", "text": "func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\top := \"db.BeginTx\"\n\tsp, _ := db.startSpan(ctx, op, \"\")\n\tstart := time.Now()\n\ttx, err := db.db.BeginTx(ctx, opts)\n\tobserveDuration(ctx, sp, start, op, err)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Tx{tx: tx, connInfo: connInfo{instance: db.instance, user: db.user}}, nil\n}", "title": "" }, { "docid": "575abc4089381099af1eedb9cdf48017", "score": "0.64996314", "text": "func (ftc *fakeTabletConn) Begin(ctx context.Context) (transactionID int64, err error) {\n\treturn 0, fmt.Errorf(\"not implemented in this test\")\n}", "title": "" }, { "docid": "9bf3b8266a99ac817f3efb6db6509e15", "score": "0.64928263", "text": "func (c *Context) BeginTx(db *sql.DB) *Tx {\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tc.Set(KeyRequestTx, tx)\n\treturn &Tx{tx}\n}", "title": "" }, { "docid": "20458beaeeff43af60a4ef23accd6413", "score": "0.64815784", "text": "func Begin() error {\n\tdb, err := sql.Open(\"go_ibm_db\", con)\n\t_, err = db.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8cf566391765ee35eb64ebcc2f724f67", "score": "0.6475823", "text": "func Begin() (*TxAdapter, error) {\n\treturn getDefault().Begin()\n}", "title": "" }, { "docid": "26170848e8041c4a8352a6f9629ab107", "score": "0.6473069", "text": "func (m *mockDB) Begin() (Tx, error) {\n\texpected := m.popExpected()\n\ttx := m.nextTx()\n\tif tx == nil || expected == nil {\n\t\treturn nil, xerrors.New(\"gsorm.mockDB.Begin is not expected\")\n\t}\n\t_, ok := expected.(*expectedBegin)\n\tif !ok {\n\t\treturn nil, xerrors.New(\"gsorm.mockDB.Begin is not expected\")\n\t}\n\treturn tx, nil\n}", "title": "" }, { "docid": "91f886dd04dde19e8e1a120f7e376df1", "score": "0.6467362", "text": "func startTransaction(ctx context.Context, reqID string) (Transaction, error) {\n\tvar trans Transaction\n\tvar err error\n\n\ttrans.client, err = datastore.NewClient(ctx, conf.ProjectID)\n\tif err != nil {\n\t\treturn trans, fmt.Errorf(\"startTransaction: datastore client creation failed with %v\", err)\n\t}\n\n\ttrans.tx, err = trans.client.NewTransaction(ctx)\n\tif err != nil {\n\t\treturn trans, fmt.Errorf(\"startTransaction: opening a datastore transaction failed with %v\", err)\n\t}\n\n\tvar requests []models.Request\n\tancestor := datastore.NameKey(\"RequestID\", reqID, nil)\n\tquery := datastore.NewQuery(\"Request\").Ancestor(ancestor).Transaction(trans.tx)\n\n\tif trans.keys, err = trans.client.GetAll(ctx, query, &requests); err != nil {\n\t\treturn trans, fmt.Errorf(\"startTransaction: obtaining request from the datastore failed with %v\", err)\n\t}\n\n\tif len(requests) < 1 {\n\t\treturn trans, fmt.Errorf(\"startTransaction: no request received with ID %s\", reqID)\n\t}\n\ttrans.req = requests[0]\n\n\treturn trans, nil\n}", "title": "" }, { "docid": "127d8ee1edbec5e0bbab72816dac7586", "score": "0.6461206", "text": "func (c *conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {\n\treturn c.beginTx(ctx)\n}", "title": "" }, { "docid": "cd3651243e4fa86b1b5c14ff96cb8cec", "score": "0.64607716", "text": "func (s *Store) BeginTransaction() (store.Transaction, error) {\n\ts.inMemoryMux.Lock()\n\n\treturn &Transaction{\n\t\tinMemory: s.inMemory,\n\t\tinMemoryCopy: s.inMemory.Copy(),\n\t\tclosed: false,\n\t\tcommitCb: func(trn *Transaction) {\n\t\t\tfor _, n := range trn.matchNotifications {\n\t\t\t\ts.matchNotificationsBroadcaster.Submit(n)\n\t\t\t}\n\t\t},\n\t\tdone: func(_ *Transaction) { s.inMemoryMux.Unlock() },\n\t}, nil\n}", "title": "" }, { "docid": "266bbe189bc3f274fa2b0a2eac865de4", "score": "0.6451712", "text": "func (t *Tracer) StartTransaction(name, transactionType string) *Transaction {\n\ttx := t.newTransaction(name, transactionType)\n\ttx.Timestamp = time.Now()\n\treturn tx\n}", "title": "" }, { "docid": "11108cc7402a6b652995a07f6c190df3", "score": "0.6447281", "text": "func (sh *sqlxHandler) BeginTx(ctx context.Context, opts interface{}) (txCtx Context, err error) {\n\tvar tx *sqlx.Tx\n\tswitch opts.(type) {\n\tcase *sql.TxOptions:\n\t\ttx, err = sh.db.BeginTxx(ctx, opts.(*sql.TxOptions))\n\tdefault:\n\t\ttx, err = sh.db.BeginTxx(ctx, nil)\n\t}\n\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"failed to begin sqlx transaction\")\n\t\treturn\n\t}\n\n\ttxCtx = &txContext{\n\t\tContext: context.Background(),\n\t\ttxKey: sqlxTxKey{},\n\t}\n\ttxCtx.SetTx(tx)\n\treturn\n}", "title": "" }, { "docid": "ca1335f6611a885a23258ce5828e9be0", "score": "0.6432235", "text": "func (c *Conn) BeginTx(ctx context.Context, opts sql.TxOptions) (_ driver.Tx, err error) {\n\tif c.rdsDataService == nil {\n\t\treturn nil, fmt.Errorf(\"connection already closed\") //@TODO test\n\t}\n\n\tif c.transactionID != \"\" {\n\t\treturn nil, fmt.Errorf(\"a transaction already started\") //@TODO test\n\t}\n\n\tvar out *rdsds.BeginTransactionOutput\n\tif out, err = c.rdsDataService.BeginTransactionWithContext(ctx, &rdsds.BeginTransactionInput{\n\t\t// Schema: @TODO add schema support\n\t\tDatabase: aws.String(c.databaseName),\n\t\tResourceArn: aws.String(c.resourceARN),\n\t\tSecretArn: aws.String(c.secretARN),\n\t}); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to being transaction: %w\", err)\n\t}\n\n\tc.transactionID = aws.StringValue(out.TransactionId)\n\treturn c, nil\n}", "title": "" }, { "docid": "73fae40fc527c5023fca5fe265116613", "score": "0.6411358", "text": "func (d *DB) BeginTransaction() (connection.DB, error) {\n\tif d.tx != nil {\n\t\treturn d, nil\n\t}\n\ttx, err := d.conn.Begin()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"trying to begin a transaction\")\n\t}\n\treturn &DB{\n\t\ttx: tx,\n\t\tlogger: d.logger,\n\t}, nil\n}", "title": "" }, { "docid": "a16f00b83b3af8b206649a72b8bb19d8", "score": "0.6402702", "text": "func (t *Tx) Start() error {\n\tstamp := time.Now().Unix()\n\n\terr := t.store.Open()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn t.write(stamp, 0)\n}", "title": "" }, { "docid": "e121cc1f1f23256e05cd0b7ecebe3528", "score": "0.6398952", "text": "func (c *conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {\n\tif opts.Isolation != 0 {\n\t\treturn nil, errors.New(\"isolation levels are not supported\")\n\t}\n\n\tvar err error\n\n\t// if the ReadOnly flag is explicitly specified, create a non promotable transaction,\n\t// otherwise start with a promotable read only transaction.\n\tif opts.ReadOnly {\n\t\tc.nonPromotable = true\n\t}\n\n\tc.tx, err = c.db.Begin(false)\n\treturn c, err\n}", "title": "" }, { "docid": "961edfc19ca48c5bf2a8a0fa4d50860d", "score": "0.6396079", "text": "func (s *sessionImpl) StartTransaction(opts ...*options.TransactionOptions) error {\n\terr := s.CheckStartTransaction()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.didCommitAfterStart = false\n\n\ttopts := options.MergeTransactionOptions(opts...)\n\tcoreOpts := &session.TransactionOptions{\n\t\tReadConcern: topts.ReadConcern,\n\t\tReadPreference: topts.ReadPreference,\n\t\tWriteConcern: topts.WriteConcern,\n\t}\n\n\treturn s.Client.StartTransaction(coreOpts)\n}", "title": "" }, { "docid": "3346e341feb10fc9b67db02389d51001", "score": "0.63789976", "text": "func (c *Conn) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\top := \"conn.BeginTx\"\n\tsp, _ := c.startSpan(ctx, op, \"\")\n\tstart := time.Now()\n\ttx, err := c.conn.BeginTx(ctx, opts)\n\tobserveDuration(ctx, sp, start, op, err)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Tx{tx: tx}, nil\n}", "title": "" }, { "docid": "94a47f94b210f314ea8bcccc8e6c75b0", "score": "0.63715506", "text": "func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\ttx, err := db.DB.BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Tx{Tx: tx, DB: db}, nil\n}", "title": "" }, { "docid": "e96d64f8e249d3d5f52c4224020c4e9d", "score": "0.6350717", "text": "func (s *session) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {\n\t// connection is bad\n\tif !s.valid {\n\t\treturn s, driver.ErrBadConn\n\t}\n\n\tif opts.ReadOnly {\n\t\treturn s, ErrNoReadOnly\n\t}\n\tif sql.IsolationLevel(opts.Isolation) != sql.LevelDefault {\n\t\tif int(opts.Isolation) > len(isolationLevelMap) {\n\t\t\treturn s, ErrInvalidIsolationLevel\n\t\t}\n\t\tlevel := isolationLevelMap[int(opts.Isolation)]\n\n\t\tif level == isolationNotImplemented {\n\t\t\treturn s, ErrInvalidIsolationLevel\n\t\t}\n\n\t\t// send the option change command to set isolation level\n\t\toptCmd := optionCmd{msg: newMsg(optionCmdToken), command: optionSet,\n\t\t\toption: optionIsolationLevel, value: level}\n\n\t\tif err := s.b.send(ctx, normalPacket, &optCmd); err != nil {\n\t\t\ts.valid = false\n\t\t\treturn s, s.checkErr(err, \"tds: isolation level set failed\", false)\n\t\t}\n\n\t\tfor f := s.initState(ctx, map[token]messageReader{}); f != nil; f = f(s.state) {\n\t\t}\n\n\t\tif s.state.err = s.checkErr(s.state.err, \"tds: isolation level set failed\", true); s.state.err != nil {\n\t\t\ts.valid = false\n\t\t\treturn s, s.state.err\n\t\t}\n\t}\n\t_, err := s.simpleExec(ctx, `begin tran\n\t\tif @@transtate != 0 raiserror 25000 'Invalid transaction state'`)\n\treturn s, s.checkErr(err, \"tds: begin failed\", true)\n}", "title": "" }, { "docid": "9a6b3d0e7b8de21590b2b2c146a49456", "score": "0.6346855", "text": "func (node *node) Begin() (Node, error) {\n\treturn node.BeginTx(context.Background(), nil)\n}", "title": "" }, { "docid": "b3013c617d8fc320e8dc8ec0f1fdd3ce", "score": "0.63419414", "text": "func (tx *Transaction) Begin() error {\n\tmessage := tx.newBundleControlMessage(openflow13.OFPBCT_OPEN_REQUEST)\n\ttx.ofSwitch.subscribeMessage(tx.ID, tx.controlReplyCh)\n\ttx.successAdd = make(map[uint32]bool)\n\t// Start a new goroutine to listen Bundle Control reply and error messages if received from OFSwitch.\n\tgo tx.listenReply()\n\n\terr := tx.sendControlRequest(message.Header.Xid, message)\n\tif err != nil {\n\t\ttx.ofSwitch.unSubscribeMessage(tx.ID)\n\t\tclose(tx.controlReplyCh)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" } ]
ec41fc1fb8cf2090676b9f25c0e2c40c
Unwrap provides access to the underlying error object.
[ { "docid": "aebcbae165b58368dbf4e0527c639c3c", "score": "0.7640062", "text": "func (e *Error) Unwrap() error {\n\treturn e.error\n}", "title": "" } ]
[ { "docid": "b2f43752c44f977ce3671ada9c4c7d03", "score": "0.7692751", "text": "func (err *Error) Unwrap() error {\n\treturn &err.Err\n}", "title": "" }, { "docid": "1098fcb35d23be4c56accb984685074f", "score": "0.7677178", "text": "func Unwrap(err error) error {\n\treturn errors.Unwrap(err)\n}", "title": "" }, { "docid": "1098fcb35d23be4c56accb984685074f", "score": "0.7677178", "text": "func Unwrap(err error) error {\n\treturn errors.Unwrap(err)\n}", "title": "" }, { "docid": "3ddc3e2542fbd4872ee28632c85a2d87", "score": "0.7675769", "text": "func (err *Error) Unwrap() error {\n\treturn err.Err\n}", "title": "" }, { "docid": "3ddc3e2542fbd4872ee28632c85a2d87", "score": "0.7675769", "text": "func (err *Error) Unwrap() error {\n\treturn err.Err\n}", "title": "" }, { "docid": "df4907006b0402bfd07af339885e5c00", "score": "0.7651303", "text": "func (we *WrappedError) Unwrap() error {\n\treturn we.err\n}", "title": "" }, { "docid": "23ee8ff3b54fcf86821797ba8956ab54", "score": "0.7608058", "text": "func (e *Error) Unwrap() error { return e.Err }", "title": "" }, { "docid": "61699af9462eb70188c5583c0a15a5f2", "score": "0.7594257", "text": "func Unwrap(err error) error {\n\tif e, ok := err.(interface{ Unwrap() error }); ok {\n\t\treturn e.Unwrap()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "838a57579d435ec6462de090651c714d", "score": "0.7582917", "text": "func (e *Error) Unwrap() error { return e.cause }", "title": "" }, { "docid": "5eadf99823f6cae04815561520ecd316", "score": "0.75812864", "text": "func (e wrapError) Unwrap() error {\n\treturn e.error\n}", "title": "" }, { "docid": "8baf93301a850fbca521e971e64880e7", "score": "0.7578117", "text": "func Unwrap(err error) error {\n\treturn stderrors.Unwrap(err)\n}", "title": "" }, { "docid": "6f9dcb4992c4c5ffd33782d7cf16a213", "score": "0.755847", "text": "func (e Error) Unwrap() error {\n\treturn e.err\n}", "title": "" }, { "docid": "21c1bfab0e81d402159efef006f275b2", "score": "0.75563824", "text": "func (e Error) Unwrap() error { return e.Err }", "title": "" }, { "docid": "1adfc69a92145cf328f64c43502a2185", "score": "0.7556263", "text": "func (e *Error) Unwrap() error {\n\tif e == nil {\n\t\treturn nil\n\t}\n\treturn e.Err\n}", "title": "" }, { "docid": "752c0064bd813a898e7e9b79a0793a7a", "score": "0.7553787", "text": "func (e Error) Unwrap() error { return e.Cause }", "title": "" }, { "docid": "517b31d02fbd11e3a4b1841a931a9b5d", "score": "0.7527855", "text": "func (e *Error) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "517b31d02fbd11e3a4b1841a931a9b5d", "score": "0.7527855", "text": "func (e *Error) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "517b31d02fbd11e3a4b1841a931a9b5d", "score": "0.7527855", "text": "func (e *Error) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "517b31d02fbd11e3a4b1841a931a9b5d", "score": "0.7527855", "text": "func (e *Error) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "437b68c0d6f78c9515e1ff8219b91059", "score": "0.7511515", "text": "func (e *Error) Unwrap() error {\n\treturn e.Cause\n}", "title": "" }, { "docid": "53f1611cfca26481e6a711fd25fb1996", "score": "0.7505377", "text": "func (e *Error) Unwrap() error {\n\tif e == nil || e.Err == nil {\n\t\treturn nil\n\t}\n\n\treturn e.Err\n}", "title": "" }, { "docid": "afdd93de3e06e46b933b94a905525c99", "score": "0.7493543", "text": "func (e Error) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "afdd93de3e06e46b933b94a905525c99", "score": "0.7493543", "text": "func (e Error) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "afdd93de3e06e46b933b94a905525c99", "score": "0.7493543", "text": "func (e Error) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "76285ca73a71eee0bcb2cefd8606696d", "score": "0.7468565", "text": "func (e *errorT) Unwrap() error {\n\treturn e.err\n}", "title": "" }, { "docid": "d67fe3221b658b05dde7180f10dd06e8", "score": "0.7452596", "text": "func (e TracingError) Unwrap() error {\n\treturn e.error\n}", "title": "" }, { "docid": "a4d5d320c5dbc790eaca16c8fec21791", "score": "0.7444986", "text": "func Unwrap(err error) error {\n\tu, ok := err.(interface {\n\t\tUnwrap() error\n\t})\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn u.Unwrap()\n}", "title": "" }, { "docid": "ca5a93dc3b64f413b8d8664a91decd0c", "score": "0.7435885", "text": "func (e ErrNewCredentialsInvalid) Unwrap() error {\n\treturn e.underlyingError\n}", "title": "" }, { "docid": "5f90f59504ce2714795f39cd08dce2c7", "score": "0.74317473", "text": "func (e Error) Unwrap() error {\n\treturn e.wrapped\n}", "title": "" }, { "docid": "a6b16d5f9abfaa00e1834b2ed7687ff6", "score": "0.74064875", "text": "func (e *Error) Unwrap() error {\n\tif e == nil {\n\t\treturn nil\n\t}\n\treturn e.wrapErr\n}", "title": "" }, { "docid": "5e950191dfd4c5e4aebe4c5b34283e95", "score": "0.7394246", "text": "func (r generalError) Unwrap() error {\n\treturn r.err\n}", "title": "" }, { "docid": "cf86e0436e6c9b5a608cc2855d9c0a1f", "score": "0.7386862", "text": "func (tfe TransactionOperationFailedError) InternalUnwrap() error {\n\treturn tfe.errorCause\n}", "title": "" }, { "docid": "bbc283fa75d4478930ea84f612a2c047", "score": "0.73649335", "text": "func (e *ConversionError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "16ee909e776d1eef3e5df92df898fc8e", "score": "0.7314654", "text": "func (e *Error) Unwrap() error { return errors.New(e.Message) }", "title": "" }, { "docid": "c4e2049ba12d606ca4d86433efa9da5d", "score": "0.7296987", "text": "func (e *ConvertError) Unwrap() error { return e.err }", "title": "" }, { "docid": "c5e1e0077c0081ee23b2bebefc1ee339", "score": "0.72950226", "text": "func (se *simpleErr) Unwrap() error {\n\treturn se.err\n}", "title": "" }, { "docid": "c40570d8d9b92099ffdbdb67c607f965", "score": "0.7287835", "text": "func (e *WrappedErr) Unwrap() error {\n\treturn e.wrapped\n}", "title": "" }, { "docid": "7b63c614bf76b616031fac0bbc69cab5", "score": "0.7239571", "text": "func (e *errorWithDNSState) Unwrap() error {\n\treturn e.underlying\n}", "title": "" }, { "docid": "3039a92be4939a396534ddd0bc934077", "score": "0.722096", "text": "func (a *APIError) Unwrap() error {\n\treturn a.err\n}", "title": "" }, { "docid": "d817763dcabfe49bda5b1e0573196a41", "score": "0.719412", "text": "func (e ErrorInfo) Unwrap() error {\n\treturn e.err\n}", "title": "" }, { "docid": "28eb9ed49fa2155304d8722bfd018254", "score": "0.7188075", "text": "func (e *apiError) Unwrap() error {\n\treturn e.wrapped\n}", "title": "" }, { "docid": "2556b52d4dae1d9d84db96a926a5acae", "score": "0.7145877", "text": "func (e InternalError) Unwrap() error {\n\treturn e.inner\n}", "title": "" }, { "docid": "838427f5bffff86473f6d8d4d9b86683", "score": "0.7139916", "text": "func (e UnauthorizedError) Unwrap() error {\n\treturn e.inner\n}", "title": "" }, { "docid": "f045c368c2d07fae58e0f63fa68a69a5", "score": "0.7122506", "text": "func (e *MaxAttemptsError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "4b477ad2865bbd9eb3c2c0dc8f3ba524", "score": "0.70999056", "text": "func (err *jerr) Unwrap() error {\n\treturn err.error\n}", "title": "" }, { "docid": "c56854cb5c6f0a62817da8686abd6102", "score": "0.7096202", "text": "func (e *NotSupportedError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "b3a32c962600ad5da6462c33f46bd6f2", "score": "0.70894694", "text": "func (e EventError) Unwrap() error {\n\treturn e.error\n}", "title": "" }, { "docid": "588fbaee35240b92ae62c4d3bd253c31", "score": "0.7077619", "text": "func (e *RPCError) Unwrap() error {\n\treturn e.wrapped\n}", "title": "" }, { "docid": "5fab893b9d57da7d2a3a6d635f8d7a72", "score": "0.7071632", "text": "func (e *RemoteClusterConnectionError) Unwrap() error { return e.Err }", "title": "" }, { "docid": "f090abebfa1beabdcb4a2211f0d4df64", "score": "0.70649993", "text": "func (e errWithReason) Unwrap() error {\n\treturn e.err\n}", "title": "" }, { "docid": "936e0abc63d81995367676a784f73662", "score": "0.70604604", "text": "func (he *HTTPError) Unwrap() error {\n\treturn he.Internal\n}", "title": "" }, { "docid": "c863db49488277ba0c65537c8941164f", "score": "0.70555776", "text": "func (e *InvalidStateError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "99e0cd8ff3b998ec7ba5bf00352382d7", "score": "0.7054969", "text": "func (e *InvalidRepositoryTypeError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "980f336c231f96be4af61057f330996c", "score": "0.7039676", "text": "func (e ConnectionError) Unwrap() error {\n\treturn e.Wrapped\n}", "title": "" }, { "docid": "d3b36f872bded8e024b05b268b06a092", "score": "0.70348287", "text": "func (e authenticationError) Unwrap() error {\n\treturn e.err\n}", "title": "" }, { "docid": "2007062a8a0d19dd07e7159c147aa14b", "score": "0.7021669", "text": "func (e *statusError) Unwrap() error {\n\treturn e.err\n}", "title": "" }, { "docid": "c32f26a96ebbd25f1986f52a9ea59c28", "score": "0.70213264", "text": "func (e *OperationError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "cb36e1d23353673466a8c1a004f5d3bf", "score": "0.7004347", "text": "func (m *MismatchErr) Unwrap() error {\n\treturn ErrMismatchErr\n}", "title": "" }, { "docid": "5b351b3a36a0bab7ed958fd0a682d48c", "score": "0.70019096", "text": "func (e *NotFoundError) Unwrap() error {\n\treturn e.err\n}", "title": "" }, { "docid": "b10790bb7cde56feb177a1d74a087bda", "score": "0.6998481", "text": "func (e *NotReadableError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "2fe005a306a155b004e5abd6700fb078", "score": "0.699132", "text": "func (e *TypeError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "abbd1ecbc1179d0b97818389d5b777b1", "score": "0.69765514", "text": "func Unwrap(err error) error {\n\tfor {\n\t\tswitch specific := err.(type) {\n\t\tcase *HereError:\n\t\t\terr = specific.error\n\t\tcase *CauseError:\n\t\t\terr = specific.error\n\t\tcase *TraceError:\n\t\t\terr = specific.error\n\t\tcase *ContextError:\n\t\t\terr = specific.error\n\t\tcase *SubjectError:\n\t\t\terr = specific.error\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "80b269ca4d6d24a4c473851dbfbc658b", "score": "0.6948718", "text": "func (e *UnknownError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "5e44b4bf761ae0b260576789d25d27b0", "score": "0.6947425", "text": "func (e *CLAManagerError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "cc17ad810c66a77df6274d9c8f0a3cb1", "score": "0.6942164", "text": "func (e NotAllowedError) Unwrap() error {\n\treturn e.inner\n}", "title": "" }, { "docid": "280bd3d39e033632d0abc34ae5ffe269", "score": "0.6939301", "text": "func (e *QueryError) Unwrap() error {\n\treturn e.err\n}", "title": "" }, { "docid": "8a13a31919fccfa1059a3dced89fd187", "score": "0.69268817", "text": "func (e *CommandError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "006266603cf71474e6641e759766b290", "score": "0.69153583", "text": "func unwrap(err error) {\n\tswitch v := err.(type) {\n\tcase nil:\n\t\tlog.Println(\"No error.\")\n\tcase *errorType:\n\t\tfmt.Println(\"*** err = \", err)\n\t\tif v.previous != nil {\n\t\t\tunwrap(v.previous)\n\t\t}\n\t\tfmt.Println(\"No more errors to unwrap, exiting.\")\n\t}\n\n}", "title": "" }, { "docid": "bbe19fb5dec61ba35a38d33c4d4d5810", "score": "0.6895695", "text": "func (e *ErrReplacement) Unwrap() error {\n\treturn e.backendError\n}", "title": "" }, { "docid": "65fb9b29f73530aa0a8459d7949942c2", "score": "0.68797123", "text": "func (e *LazyErrorWithCaller) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "e460a4351210106c388e60ce6b953197", "score": "0.6873593", "text": "func (err PanicError) Unwrap() error {\n\treturn err.RecoveredErr\n}", "title": "" }, { "docid": "b5eebaf13859c86d918abf913d84759d", "score": "0.68576443", "text": "func (e *EnrollError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "5cd0de58920dbb94b8b3497b3f7369d0", "score": "0.6857374", "text": "func (e *InvalidAccessError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "4b5034d592972fa5a2bc84c198790571", "score": "0.6835515", "text": "func (e *EventHandlerError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "ec21db8cc24a9a5956cc566d92ce8abd", "score": "0.68348235", "text": "func (e ParseDSNError) Unwrap() error { return e.err }", "title": "" }, { "docid": "f880dee0db9f63c2d49efda4d2362734", "score": "0.682465", "text": "func (e *registryError) Unwrap() error { return e.Err }", "title": "" }, { "docid": "c646a85097220403cc9356db662936be", "score": "0.6814914", "text": "func (e *OutboxError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "6e875de2e0c7719131ef4a073ba076c3", "score": "0.6787639", "text": "func Unwrap(err error) error {\n\tfor {\n\t\twrap, ok := err.(Wrapped)\n\t\tif !ok {\n\t\t\treturn err\n\t\t}\n\n\t\tinner := wrap.Unwrap()\n\t\tif inner == nil {\n\t\t\tbreak\n\t\t}\n\t\terr = inner\n\t}\n\treturn err\n}", "title": "" }, { "docid": "8e39b4e39f10287e51882b852f991aad", "score": "0.67832947", "text": "func (de DispositionError) UnWrap() error {\n\treturn de.err\n}", "title": "" }, { "docid": "59207e2e6e4e543c7915855e15f8d8d5", "score": "0.6778247", "text": "func (e *RequestSendError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "74c4f916fcc1b54e31069adf95d088d0", "score": "0.67759967", "text": "func (e errorChain) Unwrap() error {\n\tif len(e) == 1 {\n\t\treturn nil\n\t}\n\n\treturn e[1:]\n}", "title": "" }, { "docid": "f301116a1880ee067d1d837eee9301cf", "score": "0.6752595", "text": "func (e *MarshalerError) Unwrap() error { return e.Err }", "title": "" }, { "docid": "2789673fa9e4c0296a18bc9814a76296", "score": "0.67520833", "text": "func (e DatabaseQueryError) Unwrap() error {\n\treturn e.inner\n}", "title": "" }, { "docid": "d5975970c83dd85d17ad68b184ce4e54", "score": "0.67042", "text": "func (e NotFoundError) Unwrap() error {\n\treturn e.inner\n}", "title": "" }, { "docid": "3524f1a219a1f5b20593b71ee62e8a25", "score": "0.6696411", "text": "func (e *ErroredType) Unwrap() Type {\n\treturn e.inner\n}", "title": "" }, { "docid": "f2aa58fbca9e3f77325a8e73829e494a", "score": "0.66636133", "text": "func (e *E) Unwrap() error {\n\treturn e.cause\n}", "title": "" }, { "docid": "6a587955025cdba44ca2a596f0161a6a", "score": "0.66496986", "text": "func (err *ErrPushRejected) Unwrap() error {\n\treturn fmt.Errorf(\"%w - %s\", err.Err, err.StdErr)\n}", "title": "" }, { "docid": "6a587955025cdba44ca2a596f0161a6a", "score": "0.66496986", "text": "func (err *ErrPushRejected) Unwrap() error {\n\treturn fmt.Errorf(\"%w - %s\", err.Err, err.StdErr)\n}", "title": "" }, { "docid": "18cfaccbc4436451c622e331c57f0fa1", "score": "0.6608523", "text": "func (e RuleError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "6906a25ea0ab5754c221eb4569988298", "score": "0.65742457", "text": "func (e BadRequestError) Unwrap() error {\n\treturn e.inner\n}", "title": "" }, { "docid": "0a6a9694f596bdd7ca8ea5e8b11ed7be", "score": "0.6571135", "text": "func (err *errMaybeCensorship) Unwrap() error {\n\treturn err.Err\n}", "title": "" }, { "docid": "a6b0ee34c9667d112221fe2fbbff5174", "score": "0.6568164", "text": "func (c Chain) Unwrap() error {\n\tif len(c) == 1 {\n\t\tif e, ok := c[0].Err.(unwrap); ok {\n\t\t\treturn e.Unwrap()\n\t\t}\n\t\treturn c[0].Err\n\t}\n\treturn c[:len(c)-1]\n}", "title": "" }, { "docid": "6d9f4ecabe4945011206f0b27dfa6330", "score": "0.65537643", "text": "func (e *LazyErrorFromPanic) Unwrap() error {\n\treturn ErrPanic\n}", "title": "" }, { "docid": "65c1147b34dc83f05e37e74f54f09a98", "score": "0.6534393", "text": "func (e *roleError) Unwrap() error {\n\treturn e.wrap\n}", "title": "" }, { "docid": "acbe7e3ec9973d3ad3690d105f702864", "score": "0.65086746", "text": "func (e EntityNotFoundError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "0dacaf001e9b64dd7742e1c93700c2d5", "score": "0.64793426", "text": "func (e *ErrDoubleSpend) Unwrap() error {\n\treturn e.backendError\n}", "title": "" }, { "docid": "353dc5919fdc24ddf04f94b5923290b2", "score": "0.6477625", "text": "func (e *InvalidModificationError) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "80194ff09f107f9375266965b5df1e33", "score": "0.6466621", "text": "func (err errBrokenConnection) Unwrap() error {\n\treturn err.underneath\n}", "title": "" }, { "docid": "f2d79202ece3494339447eb571672ec4", "score": "0.63891953", "text": "func (e *ErrInMempool) Unwrap() error {\n\treturn e.backendError\n}", "title": "" }, { "docid": "23713af13edbd15076dd4e13ef653f6e", "score": "0.6363954", "text": "func (w WaitQueueTimeoutError) Unwrap() error {\n\treturn w.Wrapped\n}", "title": "" } ]